4.9 KiB
Conductor Self-Reflection & Upgrade Strategy Proposal
1. Executive Summary
This proposal outlines a strategic path for upgrading the Gemini CLI conductor extension to fully embrace the 4-Tier Hierarchical Multi-Model Architecture principles. By migrating from a monolithic, context-heavy single-agent loop to a compartmentalized, multi-model delegation system, Conductor can drastically reduce token burn, mitigate hallucination loops, and grant developers surgical Human-In-The-Loop (HITL) control over execution tasks.
2. Memory Siloing & Token Firewalling
Current Evaluation
Currently, the conductor extension relies heavily on reading index files and full markdown texts recursively through the project structure. This injects entire tracks, plans, guidelines, and specifications into the LLM context continuously. While beneficial for ensuring alignment with user instructions, this linear scaling creates immense token bloat during repetitive planning and execution loops.
Proposed Upgrade Strategy
To align with the 4-Tier Architecture, the Conductor extension must implement Token Firewalling:
- Curated Manifests & Viewports: Implement an extension tool or AST parser hook to generate "Skeleton Views" or restricted tree maps instead of fully loading index files into the prompt.
- Stateless Sub-Agent Invocations: Delegate localized tasks (like writing documentation updates to a single file) to a background sub-agent (via
run_shell_commandleveraging a separate stateless invocation, or by utilizing Gemini CLI's sub-agent framework). This prevents the main conductor thread from storing the trial-and-error generation in its history. - Amnesiac Context Management: Incorporate lifecycle hooks (
before_tool_call,after_tool_call) to clean up unnecessary tool outputs from the active memory array, only keeping the 50-token summaries of execution outcomes.
3. Execution Clutch & Linear Debug Mode
Current Evaluation
Conductor currently employs an iterative, fire-and-forget execute_tasks workflow where each replace, write_file, and run_shell_command is done sequentially via its prompt instructions. While autonomous, the user's only control mechanism during rapid tool-calling is the standard CLI prompt interruption, which may leave tracked artifacts in an inconsistent state or execute runaway hallucinated loops.
Proposed Upgrade Strategy
To enforce precise developer control, Conductor should natively embed a Human-In-The-Loop Execution Clutch:
- Interactive Checkpoints (Trust Levels): Use extension hooks like
before_tool_callto intercept payload executions based on heuristic models. Tools likereplacemight trigger an interactive payload editor (vim/ CLI editor plugin) before applying the JSON parameters, ensuring full developer review. - Global Linear Mode Flag: Implement a
gemini conductor:implement --stepflag. This configures the engine to pause execution and prompt the user usingask_usernatively after every major milestone, allowing validation of file diffs and tool payloads before resuming. - Rollback Mutators: Provide quick access commands (e.g., via
after_tool_call) to reject the change, auto-restoring the last known file state, and feeding the error/feedback directly back to the model without breaking the run loop.
4. Multi-Model/Sub-Agent Delegation
Current Evaluation
Conductor heavily relies on the single primary LLM instantiated by the Gemini CLI session. When acting as a PM, Tech Lead, and Worker simultaneously, the model experiences extreme context exhaustion. Furthermore, handling minor formatting, syntax repairs, or summaries with expensive high-tier reasoning models results in suboptimal cost-efficiency.
Proposed Upgrade Strategy
Conductor should leverage the native Sub-Agent & Skill Routing capabilities:
- Dynamic Tier Routing: Utilize specific Sub-agents (like
codebase_investigatorfor planning/AST generation) and custom Skills for discrete tasks. - Stateless Utility Agents (Tier 4): Hook into test runner commands via
after_tool_call. Ifpytestfails with massivestderr, immediately invoke a cheap background utility sub-agent to parse the log and return a condensed 20-word summary back to the main Orchestrator, rather than feeding the main Orchestrator raw traceback tokens. - Contract Stubbers: Embed
contract_stubberskills that explicitly limit a sub-agent's action strictly to writingclassordefdefinitions, ensuring cross-module dependency generation without full implementation drift.
5. Implementation Strategy
These upgrades can be realized by augmenting the gemini-extension.json manifest with designated MCP hooks, adding new custom Skills to ~/.gemini/skills/, and overriding default CLI execution flows with before_tool_call and after_tool_call interception logic tailored explicitly for Token Firewalling and Execution Checkpoints.