- aggregation_smarter_summaries: Sub-agent summarization, hash-based caching - system_context_exposure: Expose hidden _SYSTEM_PROMPT for user customization
4.6 KiB
4.6 KiB
Specification: System Context Exposure
1. Overview
This track exposes the hidden system prompt from ai_client.py to users for customization.
Current Problem:
_SYSTEM_PROMPTinai_client.py(lines ~118-143) is hardcoded- It contains foundational instructions: "You are a helpful coding assistant with access to a PowerShell tool..."
- Users can only see/appending their custom portion via
_custom_system_prompt - The base prompt that defines core agent capabilities is invisible
Goal:
- Make
_SYSTEM_PROMPTvisible and editable in the UI - Allow users to customize the foundational agent instructions
- Maintain sensible defaults while enabling expert customization
2. Current State Audit
Hidden System Prompt Location
src/ai_client.py:
_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. "
...
)
Related State
_custom_system_prompt- user-defined append/injection_get_combined_system_prompt()- merges bothset_custom_system_prompt()- setter for user portion
UI Current State
- AI Settings → System Prompts shows global and project prompts
- These are injected as
[USER SYSTEM PROMPT]after_SYSTEM_PROMPT - But
_SYSTEM_PROMPTitself is never shown
3. Functional Requirements
3.1 Base System Prompt Visibility
- Add "Base System Prompt" section in AI Settings
- Display current
_SYSTEM_PROMPTcontent - Allow editing with syntax highlighting (it's markdown text)
3.2 Default vs Custom Base
- Maintain default base prompt as reference
- User can reset to default if they mess it up
- Show diff between default and custom
3.3 Persistence
- Custom base prompt stored in config or project TOML
- Loaded on app start
- Applied before
_custom_system_promptin_get_combined_system_prompt()
3.4 Provider Considerations
- Some providers handle system prompts differently
- Verify behavior across Gemini, Anthropic, DeepSeek
- May need provider-specific base prompts
4. Data Model
4.1 Config Storage
[ai_settings]
base_system_prompt = """..."""
use_default_base = true
4.2 Combined Prompt Order
_SYSTEM_PROMPT(or custom base if enabled)[USER SYSTEM PROMPT](from AI Settings global/project)- Tooling strategy (from bias engine)
5. UI Design
Location: AI Settings panel → System Prompts section
┌─ System Prompts ──────────────────────────────┐
│ ☑ Use Default Base System Prompt │
│ │
│ Base System Prompt (collapsed by default): │
│ ┌──────────────────────────────────────────┐ │
│ │ You are a helpful coding assistant... │ │
│ └──────────────────────────────────────────┘ │
│ │
│ [Show Editor] [Reset to Default] │
│ │
│ Global System Prompt: │
│ ┌──────────────────────────────────────────┐ │
│ │ [current global prompt content] │ │
│ └──────────────────────────────────────────┘ │
└──────────────────────────────────────────────┘
When "Show Editor" clicked:
- Expand to full editor for base prompt
- Syntax highlighting for markdown
- Character count
6. Acceptance Criteria
_SYSTEM_PROMPTvisible in AI Settings- User can edit base system prompt
- Changes persist across app restarts
- "Reset to Default" restores original
- Provider APIs receive modified prompt correctly
- No regression in agent behavior with defaults
7. Out of Scope
- Changes to actual agent behavior logic
- Changes to tool definitions or availability
- Changes to aggregation or context handling
8. Dependencies
ai_client.py-_SYSTEM_PROMPTand_get_combined_system_prompt()gui_2.py- AI Settings panel renderingmodels.py- Config structures