feat(mma): Optimize sub-agent research with get_code_outline and get_git_diff

This commit is contained in:
2026-02-27 20:43:44 -05:00
parent 138e31374b
commit a6e264bb4e
7 changed files with 87 additions and 10 deletions

View File

@@ -26,13 +26,17 @@ If you run a test or command that fails with a significant error or large traceb
1. **DO NOT** analyze the raw logs in your own context window.
2. **DO** spawn a stateless Tier 4 agent to diagnose the failure.
3. *Command:* `uv run python scripts/mma_exec.py --role tier4-qa "Analyze this failure and summarize the root cause: [LOG_DATA]"`
4. Avoid direct reads to files, use file summaries or ast skeletons for files if they are code and we have a tool for parsing them.
4. **Mandatory Research-First Protocol:** Avoid direct `read_file` calls for any file over 50 lines. Use `get_file_summary`, `get_python_skeleton`, or `get_code_outline` first to identify relevant sections. Use `git diff` to understand changes.
## 3. Persistent Tech Lead Memory (Tier 2)
Unlike the stateless sub-agents (Tiers 3 & 4), the **Tier 2 Tech Lead** maintains persistent context throughout the implementation of a track. Do NOT apply "Context Amnesia" to your own session during track implementation. You are responsible for the continuity of the technical strategy.
## 4. AST Skeleton Views
To minimize context bloat for Tier 2 & 3, use "Skeleton Views" of dependencies (extracted via `mcp_client.py` or similar) instead of full file contents, unless the Tier 3 worker is explicitly modifying that specific file.
## 4. AST Skeleton & Outline Views
To minimize context bloat for Tier 2 & 3:
1. Use `get_code_outline` to map out the structure of a file.
2. Use `get_python_skeleton` to understand the interface and docstrings of dependencies.
3. Only use `read_file` with `start_line` and `end_line` for specific implementation details once target areas are identified.
4. Tier 3 workers MUST NOT read the full content of unrelated files.
<examples>
### Example 1: Spawning a Tier 4 QA Agent