conductor(checkpoint): Checkpoint end of Phase 1 (Directory Migration)

This commit is contained in:
2026-05-07 21:37:58 -04:00
parent 49acb884e1
commit 2065dd8559
119 changed files with 3 additions and 3 deletions
@@ -0,0 +1,38 @@
# Audit of Hidden Prompts
## 1. `_SYSTEM_PROMPT` (src/ai_client.py, L128)
```python
_SYSTEM_PROMPT: str = (
"You are a helpful coding assistant with access to a PowerShell tool (run_powershell) and MCP tools (file access: read_file, list_directory, search_files, get_file_summary, web access: web_search, fetch_url). "
"When calling file/directory tools, always use the 'path' parameter for the target path. "
"When asked to create or edit files, prefer targeted edits over full rewrites. "
"Always explain what you are doing before invoking the tool.\n\n"
"When writing or rewriting large files (especially those containing quotes, backticks, or special characters), "
"avoid python -c with inline strings. Instead: (1) write a .py helper script to disk using a PS here-string "
"(@'...'@ for literal content), (2) run it with `python <script>`, (3) delete the helper. "
"For small targeted edits, use PowerShell's (Get-Content) / .Replace() / Set-Content or Add-Content directly.\n\n"
"When making function calls using tools that accept array or object parameters "
"ensure those are structured using JSON. For example:\n"
"When you need to verify a change, rely on the exit code and stdout/stderr from the tool — "
"the user's context files are automatically refreshed after every tool call, so you do NOT "
"need to re-read files that are already provided in the <context> block."
)
```
**Status:** Necessary for reliable agent functioning, especially the instructions about writing large files and avoiding re-reading automatically refreshed context. However, it should be exposed so advanced users can override or customize it.
## 2. File Refresh Markers (src/ai_client.py)
**Gemini:** `\n\n[SYSTEM: FILES UPDATED]\n\n{ctx}` (Lines 1111, 1222, 1845, 2066)
**Anthropic:** `[FILES UPDATED — current contents below. Do NOT re-read these files with PowerShell.]\n\n{ctx}` (Line 1557)
**Status:** Necessary for the agent to realize files have changed post-tool execution. Could be simplified or made configurable, but hardcoding them isn't the worst offense as they are functional markers. Exposing the text of these markers might just cause users to accidentally break the agent's context awareness. We should probably keep them as hardcoded constants but maybe unify them or expose a toggle in settings if someone wants to disable auto-refresh. The spec says to "expose them in the GUI... Create fields for project-specific context markers."
## 3. Max Rounds Warning (src/ai_client.py)
**Gemini:** `\n\n[SYSTEM: MAX ROUNDS. PROVIDE FINAL ANSWER.]`
**Anthropic:** `SYSTEM WARNING: MAX TOOL ROUNDS REACHED. YOU MUST PROVIDE YOUR FINAL ANSWER NOW WITHOUT CALLING ANY MORE TOOLS.`
**Status:** Necessary functional safety net.
## 4. `src/aggregate.py`
No hidden prompts or markers found here. The context aggregation simply structures the files into markdown `### <path>\n\n<content>`.
## Conclusion
The `_SYSTEM_PROMPT` is the primary target for exposure. It's a large block of text that heavily biases the agent's behavior. We should expose it as "Global Agent Instructions" in the AI Settings.
The context markers (`[FILES UPDATED]`) should also be exposed per the specification, perhaps as "Context Refresh Marker" and "Max Rounds Warning" fields.
@@ -0,0 +1,5 @@
# Track cull_hidden_prompts_20260502 Context
- [Specification](./spec.md)
- [Implementation Plan](./plan.md)
- [Metadata](./metadata.json)
@@ -0,0 +1,8 @@
{
"track_id": "cull_hidden_prompts_20260502",
"type": "chore",
"status": "new",
"created_at": "2026-05-02T12:00:00Z",
"updated_at": "2026-05-02T12:00:00Z",
"description": "Review investigation of codebase and expose/cull any hidden invisible prompting either from the system or directly that the user cannot handle for any discussion/session."
}
@@ -0,0 +1,22 @@
# Implementation Plan: Expose/Cull Hidden Invisible Prompting
## Phase 1: Audit and Identification [checkpoint: 30107fd]
- [x] Task: Audit `src/ai_client.py` to identify all hardcoded `_SYSTEM_PROMPT` strings and tool execution instructions.
- [x] Task: Audit `src/aggregate.py` to identify all injected context markers (e.g., `[SYSTEM: FILES UPDATED]`).
- [x] Task: Document identified hidden prompts and determine their necessity vs. redundancy.
- [x] Task: Conductor - User Manual Verification 'Phase 1: Audit and Identification' (Protocol in workflow.md)
## Phase 2: Expose Necessary Prompts in GUI [checkpoint: 3b59028]
- [x] Task: Modify `src/gui_2.py` to add new editable text areas in the "AI Settings" or "Project Settings" panel.
- [x] Create fields for global system tool instructions.
- [x] Create fields for project-specific context markers.
- [x] Task: Update `src/app_controller.py` state initialization to load these new fields from `config.toml` and `manual_slop.toml`.
- [x] Task: Ensure changes are correctly saved and flushed to the project files via `_flush_to_project()` and `_flush_to_config()`.
- [x] Task: Conductor - User Manual Verification 'Phase 2: Expose Necessary Prompts in GUI' (Protocol in workflow.md)
## Phase 3: Cull and Integrate Configured Prompts
- [x] Task: Update `src/ai_client.py`'s `_get_combined_system_prompt()` to utilize the user-configured tool instructions from the AppController state instead of hardcoded strings.
- [x] Task: Update `src/aggregate.py` or `src/ai_client.py` to use the user-configured context markers (like `[FILES UPDATED]`) instead of hardcoded ones.
- [x] Task: Remove the legacy hardcoded strings from the codebase.
- [x] Task: Run tests to ensure tool execution and context refresh still function correctly.
- [x] Task: Conductor - User Manual Verification 'Phase 3: Cull and Integrate Configured Prompts' (Protocol in workflow.md)
@@ -0,0 +1,28 @@
# Specification: Expose/Cull Hidden Invisible Prompting
## 1. Overview
The goal of this track is to review the codebase to identify, expose, or cull any hidden or invisible prompting injected by the system during discussion/sessions. This ensures the user has full control and visibility over the exact context sent to the AI API.
## 2. Functional Requirements
### 2.1 Identify Hardcoded Prompts
- Audit `src/ai_client.py` to identify the hardcoded `_SYSTEM_PROMPT` and any tool execution instructions appended to requests.
- Audit `src/aggregate.py` to identify headers and contextual markers injected during context aggregation (e.g., `[SYSTEM: FILES UPDATED]`).
### 2.2 Expose Prompts in GUI
- For prompts that are necessary for the system to function (e.g., tool usage instructions, `[FILES UPDATED]` logic), expose them in the GUI (e.g., in "AI Settings" or "Project Settings").
- Create editable text areas or configurable options so the user can modify or disable these prompts per-project or globally.
- Ensure the modified prompts are correctly persisted and loaded by the `AppController`.
### 2.3 Cull Redundant Prompts
- Remove any legacy or redundant prompting that no longer serves a purpose or duplicates user-defined system prompts.
## 3. Acceptance Criteria
- [ ] All hardcoded system prompts in `ai_client.py` and `aggregate.py` are identified.
- [ ] Necessary system prompts are exposed as editable fields within the GUI.
- [ ] Users can modify or disable the default tool instructions or aggregation markers.
- [ ] The `ai_client` utilizes the user-configured prompts instead of hardcoded strings.
- [ ] Unnecessary or redundant hidden prompts are removed from the codebase.
## 4. Out of Scope
- Modifying the Tiered MMA worker prompts in `mma_prompts.py` (this track focuses on the core discussion/session loop).
- Adding a "Raw Prompt Preview" modal (this was an alternative option not selected).