diff --git a/MMA_Support/mma_tiered_orchestrator_skill.md b/MMA_Support/mma_tiered_orchestrator_skill.md index c4cc0ae..098a6cc 100644 --- a/MMA_Support/mma_tiered_orchestrator_skill.md +++ b/MMA_Support/mma_tiered_orchestrator_skill.md @@ -10,19 +10,23 @@ You are operating as a Tier 1 Product Manager or Tier 2 Tech Lead within the MMA To accomplish this, you MUST delegate token-heavy or stateless tasks to "Tier 3 Contributors" or "Tier 4 QA Agents" by spawning secondary Gemini CLI instances via `run_shell_command`. +**CRITICAL Prerequisite:** +To avoid hanging the CLI and ensure proper environment authentication, you MUST NOT call the `gemini` command directly. Instead, you MUST use the wrapper script: +`.\scripts\run_subagent.ps1 -Prompt "..."` + ## 1. The Tier 3 Worker (Heads-Down Coding) When you need to perform a significant code modification (e.g., refactoring a 500-line script, writing a massive class, or implementing a predefined spec): 1. **DO NOT** attempt to write or use `replace`/`write_file` yourself. Your history will bloat. 2. **DO** construct a single, highly specific prompt. 3. **DO** spawn a sub-agent using `run_shell_command` pointing to the target file. - *Command:* `gemini ask "Modify [FILE_PATH] to implement [SPECIFIC_INSTRUCTION]. Only write the code, no pleasantries." --model gemini-1.5-flash` + *Command:* `.\scripts\run_subagent.ps1 -Prompt "Modify [FILE_PATH] to implement [SPECIFIC_INSTRUCTION]. Only write the code, no pleasantries."` 4. If you need the sub-agent to automatically apply changes instead of just returning the text, use `gemini run` or pipe the output appropriately. However, the best method is to let the sub-agent modify the code and return "Done." ## 2. The Tier 4 QA Agent (Error Translation) If you run a local test (e.g., `npm test`, `pytest`, `go run`) via `run_shell_command` and it fails with a massive traceback (e.g., 200+ lines of `stderr`): 1. **DO NOT** analyze the raw `stderr` in your own context window. 2. **DO** immediately spawn a stateless Tier 4 agent to compress the error. -3. *Command:* `gemini ask "Summarize this stack trace into a 20-word fix: [PASTE_SNIPPET_OF_STDERR_HERE]" --model gemini-1.5-flash` +3. *Command:* `.\scripts\run_subagent.ps1 -Prompt "Summarize this stack trace into a 20-word fix: [PASTE_SNIPPET_OF_STDERR_HERE]"` 4. Use the 20-word fix returned by the Tier 4 agent to inform your next architectural decision or pass it to the Tier 3 worker. ## 3. Context Amnesia (Phase Checkpoints) @@ -38,7 +42,7 @@ When you complete a major Phase or Track within the `conductor` workflow: **Agent (You):** ```json { - "command": "gemini ask "Summarize this stack trace into a 20-word fix: [snip first 30 lines...]" --model gemini-1.5-flash", + "command": ".\\scripts\\run_subagent.ps1 -Prompt \"Summarize this stack trace into a 20-word fix: [snip first 30 lines...]\"", "description": "Spawning Tier 4 QA to compress error trace statelessly." } ``` @@ -48,7 +52,7 @@ When you complete a major Phase or Track within the `conductor` workflow: **Agent (You):** ```json { - "command": "gemini ask "Read file_cache.py and implement the ASTParser class using tree-sitter. Ensure you preserve docstrings but strip function bodies. Output the updated code or edit the file directly." --model gemini-1.5-flash", + "command": ".\\scripts\\run_subagent.ps1 -Prompt \"Read file_cache.py and implement the ASTParser class using tree-sitter. Ensure you preserve docstrings but strip function bodies. Output the updated code or edit the file directly.\"", "description": "Delegating implementation to a Tier 3 Worker." } ``` diff --git a/conductor/workflow.md b/conductor/workflow.md index 68624a5..2f18157 100644 --- a/conductor/workflow.md +++ b/conductor/workflow.md @@ -364,9 +364,10 @@ A task is complete when: To emulate the 4-Tier MMA Architecture within the standard Conductor extension without requiring a custom fork, adhere to these strict workflow policies: ### 1. Active Model Switching (Simulating the 4 Tiers) -- **Phase Planning & Macro Merges (Tier 1):** Use high-reasoning models (e.g., Gemini 1.5 Pro or Claude 3.5 Sonnet) when running \/conductor:setup\ or when reviewing a major phase checkpoint. -- **Track Delegation & Implementation (Tier 2/3):** Switch your CLI to a mid-tier model (e.g., Gemini 1.5 Flash) before invoking \/conductor:implement\. This reserves the expensive model for architecture decisions while letting Flash handle the heads-down coding. -- **QA/Fixing (Tier 4):** If a test fails with a massive traceback, **DO NOT** paste the traceback into the main conductor thread. Instead, switch to a fast/cheap model in a separate, isolated CLI instance, ask for the fix, and then manually apply the fix or provide the 20-word solution to the Conductor thread. +- **Activate MMA Orchestrator Skill:** To enforce the 4-Tier token firewall explicitly, invoke `/activate_skill mma-orchestrator` (or use the `activate_skill` tool) when planning or executing new tracks. +- **Phase Planning & Macro Merges (Tier 1):** Use high-reasoning models (e.g., Gemini 1.5 Pro or Claude 3.5 Sonnet) when running `/conductor:setup` or when reviewing a major phase checkpoint. +- **Track Delegation & Implementation (Tier 2/3):** The MMA Orchestrator skill autonomously dispatches Tier 3 (Heads-Down Coding) tasks to secondary stateless instances of Gemini CLI (via `.\scripts\run_subagent.ps1 -Prompt "..."`) rather than performing heavy coding directly in the main thread. +- **QA/Fixing (Tier 4):** If a test fails with a massive traceback, **DO NOT** paste the traceback into the main conductor thread. Instead, the MMA Orchestrator skill instructs you to spawn a fast/cheap model sub-agent (via a shell command) to compress the error trace into a 20-word fix, keeping the main context clean. ### 2. Context Checkpoints (The Token Firewall) - The **Phase Completion Verification and Checkpointing Protocol** is the project's primary defense against token bloat. diff --git a/scripts/run_subagent.ps1 b/scripts/run_subagent.ps1 new file mode 100644 index 0000000..8efefa1 --- /dev/null +++ b/scripts/run_subagent.ps1 @@ -0,0 +1,12 @@ +param( + [Parameter(Mandatory=$true)] + [string]$Prompt, + + [string]$Model = "gemini-3-flash-preview" +) + +# Ensure the session has the API key loaded +. C:\projects\misc\setup_gemini.ps1 + +# Piping an empty string ensures stdin is closed, forcing the Gemini CLI to terminate naturally after answering. +echo "" | gemini $Prompt --model $Model