Updates three Gemini skill files to match the Claude command methodology: mma-orchestrator/SKILL.md: - New Section 0: Architecture Fallback with links to all 4 docs/guide_*.md - New Surgical Spec Protocol (6-point mandatory checklist) - New Section 5: Cross-Skill Activation for tier transitions - Example 2 rewritten with surgical prompt (exact line refs + API calls) - New Example 3: Track creation with audit-first workflow - Added py_get_definition to tool usage guidance mma-tier1-orchestrator/SKILL.md: - Added Architecture Fallback and Surgical Spec Protocol summary - References activate_skill mma-orchestrator for full protocol mma-tier2-tech-lead/SKILL.md: - Added Architecture Fallback section - Added Surgical Delegation Protocol with WHERE/WHAT/HOW/SAFETY example Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
8.9 KiB
name, description
| name | description |
|---|---|
| mma-orchestrator | Enforces the 4-Tier Hierarchical Multi-Model Architecture (MMA) within Gemini CLI using Token Firewalling and sub-agent task delegation. |
MMA Token Firewall & Tiered Delegation Protocol
You are operating within the MMA Framework, acting as either the Tier 1 Orchestrator (for setup/init) or the Tier 2 Tech Lead (for execution). Your context window is extremely valuable and must be protected from token bloat (such as raw, repetitive code edits, trial-and-error histories, or massive stack traces).
To accomplish this, you MUST delegate token-heavy or stateless tasks to Tier 3 Workers or Tier 4 QA Agents by spawning secondary Gemini CLI instances via run_shell_command.
CRITICAL Prerequisite:
To ensure proper environment handling and logging, you MUST NOT call the gemini command directly for sub-tasks. Instead, use the wrapper script:
uv run python scripts/mma_exec.py --role <Role> "..."
0. Architecture Fallback & Surgical Methodology
Before creating or refining any track, consult the deep-dive architecture docs:
docs/guide_architecture.md: Thread domains, event system (AsyncEventQueue,_pending_gui_tasksaction catalog), AI client multi-provider architecture, HITL Execution Clutch blocking flow, frame-sync mechanismdocs/guide_tools.md: MCP Bridge 3-layer security model, full 26-tool inventory with params, Hook API GET/POST endpoints with request/response formats, ApiHookClient method referencedocs/guide_mma.md: Ticket/Track/WorkerContext data structures, DAG engine (cycle detection, topological sort), ConductorEngine execution loop, Tier 2 ticket generation, Tier 3 worker lifecycle with context amnesiadocs/guide_simulations.md:live_guifixture lifecycle, Puppeteer pattern, mock provider JSON-L protocol, visual verification patterns
The Surgical Spec Protocol (MANDATORY for track creation)
When creating tracks (activate_skill mma-tier1-orchestrator), follow this protocol:
-
AUDIT BEFORE SPECIFYING: Use
get_code_outline,py_get_definition,grep_search, andget_git_diffto map what already exists. Previous track specs asked to re-implement existing features (Track Browser, DAG tree, approval dialogs) because no audit was done. Document findings in a "Current State Audit" section with file:line references. -
GAPS, NOT FEATURES: Frame requirements as what's MISSING relative to what exists.
- GOOD: "The existing
_render_mma_dashboard(gui_2.py:2633-2724) has a token usage table but no cost column." - BAD: "Build a metrics dashboard with token and cost tracking."
- GOOD: "The existing
-
WORKER-READY TASKS: Each plan task must specify:
- WHERE: Exact file and line range (
gui_2.py:2700-2701) - WHAT: The specific change (add function, modify dict, extend table)
- HOW: Which API calls (
imgui.progress_bar(...),imgui.collapsing_header(...)) - SAFETY: Thread-safety constraints if cross-thread data is involved
- WHERE: Exact file and line range (
-
ROOT CAUSE ANALYSIS (for fix tracks): Don't write "investigate and fix." List specific candidates with code-level reasoning.
-
REFERENCE DOCS: Link to relevant
docs/guide_*.mdsections in every spec. -
MAP DEPENDENCIES: State execution order and blockers between tracks.
1. The Tier 3 Worker (Execution)
When performing code modifications or implementing specific requirements:
- Pre-Delegation Checkpoint: For dangerous or non-trivial changes, ALWAYS stage your changes (
git add .) or commit before delegating to a Tier 3 Worker. If the worker fails or runsgit restore, you will lose all prior AI iterations for that file if it wasn't staged/committed. - Code Style Enforcement: You MUST explicitly remind the worker to "use exactly 1-space indentation for Python code" in your prompt to prevent them from breaking the established codebase style.
- DO NOT perform large code writes yourself.
- DO construct a single, highly specific prompt with a clear objective. Include exact file:line references and the specific API calls to use (from your audit or the architecture docs).
- DO spawn a Tier 3 Worker.
Command:
uv run python scripts/mma_exec.py --role tier3-worker "Implement [SPECIFIC_INSTRUCTION] in [FILE_PATH] at lines [N-M]. Use [SPECIFIC_API_CALL]. Use 1-space indentation." - Handling Repeated Failures: If a Tier 3 Worker fails multiple times on the same task, it may lack the necessary capability. You must track failures and retry with
--failure-count <N>(e.g.,--failure-count 2). This tellsmma_exec.pyto escalate the sub-agent to a more powerful reasoning model (likegemini-3-flash). - The Tier 3 Worker is stateless and has tool access for file I/O.
2. The Tier 4 QA Agent (Diagnostics)
If you run a test or command that fails with a significant error or large traceback:
- DO NOT analyze the raw logs in your own context window.
- DO spawn a stateless Tier 4 agent to diagnose the failure.
- Command:
uv run python scripts/mma_exec.py --role tier4-qa "Analyze this failure and summarize the root cause: [LOG_DATA]" - Mandatory Research-First Protocol: Avoid direct
read_filecalls for any file over 50 lines. Useget_file_summary,py_get_skeleton, orpy_get_code_outlinefirst to identify relevant sections. Usegit diffto 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 & Outline Views
To minimize context bloat for Tier 2 & 3:
- Use
py_get_code_outlineorget_treeto map out the structure of a file or project. - Use
py_get_skeletonandpy_get_importsto understand the interface, docstrings, and dependencies of modules. - Use
py_get_definitionto read specific functions/classes by name without loading entire files. - Use
py_find_usagesto pinpoint where a function or class is called instead of searching the whole codebase. - Use
py_check_syntaxafter making string replacements to ensure the file is still syntactically valid. - Only use
read_filewithstart_lineandend_linefor specific implementation details once target areas are identified. - Tier 3 workers MUST NOT read the full content of unrelated files.
5. Cross-Skill Activation
When your current role requires capabilities from another tier, use activate_skill:
- Track creation/refinement:
activate_skill mma-tier1-orchestrator— applies the Surgical Spec Protocol - Track execution:
activate_skill mma-tier2-tech-lead— applies persistent context and TDD workflow - Quick code task: Spawn via
mma_exec.py --role tier3-worker(stateless, no skill activation needed) - Error analysis: Spawn via
mma_exec.py --role tier4-qa(stateless, no skill activation needed)
Example 2: Spawning a Tier 3 Worker with Surgical Prompt
User: Please implement the cost tracking column in the token usage table. Agent (You):
{
"command": "python scripts/mma_exec.py --role tier3-worker \"In gui_2.py, modify _render_mma_dashboard (lines 2685-2699). Extend the token usage table from 3 columns to 5 by adding 'Model' and 'Est. Cost' columns. Use imgui.table_setup_column() for the new columns. Import cost_tracker and call cost_tracker.estimate_cost(model, input_tokens, output_tokens) for each tier row. Add a total row at the bottom. Use 1-space indentation.\"",
"description": "Delegating surgical implementation to Tier 3 Worker with exact line refs."
}
Example 3: Creating a Track with Audit
User: Create a track for adding dark mode support. Agent (You):
- First, audit the codebase:
py_get_code_outline gui_2.py→ find_render_theme_panel(lines 2993-3030). - Read the existing implementation:
py_get_definition gui_2.py _render_theme_panel. - Check for existing color constants:
grep_search "vec4\|C_" gui_2.py. - Now write the spec with a "Current State Audit" section documenting what the theme panel already does.
- Write tasks referencing the exact lines and imgui color APIs to use.