Compare commits

..

2 Commits

7 changed files with 112 additions and 7 deletions

View File

@@ -46,3 +46,8 @@ This file tracks all major tracks for the project. Each track has its own detail
---
---
- [ ] **Track: Improve conductors use of 4-tier mma architecture workflow, skills, subagents. Introduce a seaprate skill for each dedicated tier and a dedicated cli tool to execute the roles appropriate/gather context as defined for that role's domain.**
*Link: [./tracks/mma_formalization_20260225/](./tracks/mma_formalization_20260225/)*

View File

@@ -0,0 +1,5 @@
# Track mma_formalization_20260225 Context
- [Specification](./spec.md)
- [Implementation Plan](./plan.md)
- [Metadata](./metadata.json)

View File

@@ -0,0 +1,8 @@
{
"track_id": "mma_formalization_20260225",
"type": "feature",
"status": "new",
"created_at": "2026-02-25T18:48:00Z",
"updated_at": "2026-02-25T18:48:00Z",
"description": "Improve conductors use of 4-tier mma architecture workflow, skills, subagents. Introduce a seaprate skill for each dedicated tier and a dedicated cli tool to execute the roles appropriate/gather context as defined for that role's domain."
}

View File

@@ -0,0 +1,27 @@
# Implementation Plan: 4-Tier MMA Architecture Formalization
## Phase 1: Tiered Skills Implementation
- [ ] Task: Create `mma-tier1-orchestrator` skill in `.gemini/skills/`
- [ ] Task: Create `mma-tier2-tech-lead` skill in `.gemini/skills/`
- [ ] Task: Create `mma-tier3-worker` skill in `.gemini/skills/`
- [ ] Task: Create `mma-tier4-qa` skill in `.gemini/skills/`
- [ ] Task: Conductor - User Manual Verification 'Phase 1: Tiered Skills Implementation' (Protocol in workflow.md)
## Phase 2: `mma-exec` CLI - Core Scoping
- [ ] Task: Scaffold `scripts/mma_exec.py` with basic CLI structure (argparse/click)
- [ ] Task: Implement Role-Scoped Document selection logic (mapping roles to `product.md`, `tech-stack.md`, etc.)
- [ ] Task: Implement the "Context Amnesia" bridge (ensuring a fresh subprocess session for each call)
- [ ] Task: Integrate `mma-exec` with the existing `ai_client.py` logic
- [ ] Task: Conductor - User Manual Verification 'Phase 2: mma-exec CLI - Core Scoping' (Protocol in workflow.md)
## Phase 3: Advanced Context Features
- [ ] Task: Implement AST "Skeleton View" generator using `tree-sitter` in `scripts/mma_exec.py`
- [ ] Task: Add dependency mapping to `mma-exec` (providing skeletons of imported files to Workers)
- [ ] Task: Implement logging/auditing for all role hand-offs in `logs/mma_delegation.log`
- [ ] Task: Conductor - User Manual Verification 'Phase 3: Advanced Context Features' (Protocol in workflow.md)
## Phase 4: Workflow & Conductor Integration
- [ ] Task: Update `conductor/workflow.md` with new MMA role definitions and `mma-exec` commands
- [ ] Task: Create a Conductor helper/alias in `scripts/` to simplify manual role triggering
- [ ] Task: Final end-to-end verification using a sample feature implementation
- [ ] Task: Conductor - User Manual Verification 'Phase 4: Workflow & Conductor Integration' (Protocol in workflow.md)

View File

@@ -0,0 +1,43 @@
# Specification: 4-Tier MMA Architecture Formalization
## Overview
This track aims to formalize and automate the 4-Tier Hierarchical Multi-Model Architecture (MMA) within the Conductor framework. It introduces specialized skills for each tier and a new specialized CLI tool (`mma-exec`) to handle role-specific context gathering and "Context Amnesia" protocols.
## Goals
- Isolate cognitive load for sub-agents by providing only domain-specific context.
- Minimize token burn through "Context Amnesia" and AST-based skeleton views.
- Formalize the Orchestrator (Tier 1), Tech Lead (Tier 2), Worker (Tier 3), and QA (Tier 4) roles.
## Functional Requirements
### 1. Specialized Tier Skills
Create four new Gemini CLI skills located in `.gemini/skills/`:
- **mma-tier1-orchestrator:** Focused on product alignment, high-level planning, and track management.
- **mma-tier2-tech-lead:** Focused on architectural design, tech stack alignment, and code review.
- **mma-tier3-worker:** Focused on TDD implementation, surgical code changes, and following specific specs.
- **mma-tier4-qa:** Focused on test analysis, error summarization, and bug reproduction.
### 2. Specialized CLI: `mma-exec`
A new Python-based CLI tool to replace/extend `run_subagent.ps1`:
- **Role Scoping:** Automatically determines which project documents (Product, Tech Stack, etc.) to include based on the active role.
- **AST Skeleton Views:** Integrates with `tree-sitter` to generate and provide only the interface/signature skeletons of dependency files to Tier 3 Workers.
- **Context Amnesia Protocol:** Ensures each role execution starts with a fresh, scoped context to prevent history-induced hallucinations.
- **Conductor Integration:** Designed to be called by the Conductor agent or manually by the developer.
### 3. Workflow Integration
- Update `conductor/workflow.md` to formalize the use of `mma-exec` and the tiered skills.
- Add specific commands/aliases within the Conductor context to trigger role hand-offs.
## Non-Functional Requirements
- **Performance:** Context gathering (including AST parsing) must be fast enough for interactive use.
- **Transparency:** All hand-offs and context inclusions must be logged for developer auditing.
## Acceptance Criteria
- [ ] Four new skills are registered and accessible.
- [ ] `mma-exec` tool can successfully spawn a worker with only AST skeleton views of requested dependencies.
- [ ] A test task can be implemented using the tiered delegation flow without manual context curation.
- [ ] `workflow.md` documentation is fully updated.
## Out of Scope
- Migrating existing tracks to the new architecture (only new tasks/tracks are required to use it).
- Automating the *decision* of when to hand off (remains semi-automated/manual per user preference).

View File

@@ -2,6 +2,7 @@ import subprocess
import json
import sys
import time
import os
class GeminiCliAdapter:
def __init__(self, binary_path="gemini"):
@@ -24,13 +25,17 @@ class GeminiCliAdapter:
accumulated_text = ""
env = os.environ.copy()
env["GEMINI_CLI_HOOK_CONTEXT"] = "manual_slop"
process = subprocess.Popen(
command,
stdin=subprocess.PIPE,
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
text=True,
shell=True
shell=True,
env=env
)
try:

View File

@@ -29,7 +29,17 @@ def main():
tool_name = hook_input.get('tool_name')
tool_args = hook_input.get('tool_input', {})
# 3. Use 'ApiHookClient' (assuming GUI is on http://127.0.0.1:8999)
# 3. Check context — if not running via Manual Slop, we pass through (allow)
# This prevents the hook from affecting normal CLI usage.
hook_context = os.environ.get("GEMINI_CLI_HOOK_CONTEXT")
if hook_context != "manual_slop":
print(json.dumps({
"decision": "allow",
"reason": "Non-programmatic usage (GEMINI_CLI_HOOK_CONTEXT not set)."
}))
return
# 4. Use 'ApiHookClient' (assuming GUI is on http://127.0.0.1:8999)
client = ApiHookClient(base_url="http://127.0.0.1:8999")
try:
@@ -38,20 +48,22 @@ def main():
response = client.request_confirmation(tool_name, tool_args)
if response and response.get('approved') is True:
# 5. Print 'allow' decision
# 6. Print 'allow' decision
print(json.dumps({"decision": "allow"}))
else:
# 6. Print 'deny' decision
# 7. Print 'deny' decision
print(json.dumps({
"decision": "deny",
"reason": "User rejected tool execution."
"reason": "User rejected tool execution in GUI."
}))
except Exception as e:
# 7. Handle cases where hook server is not reachable
# 8. Handle cases where hook server is not reachable
# If we ARE in manual_slop context but can't reach the server, we should DENY
# because the user expects to be in control.
print(json.dumps({
"decision": "deny",
"reason": f"Hook server unreachable or error occurred: {str(e)}"
"reason": f"Manual Slop hook server unreachable: {str(e)}"
}))
except Exception as e: