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

@@ -177,14 +177,15 @@ def execute_agent(role: str, prompt: str, docs: list[str]) -> str:
system_directive = "STRICT SYSTEM DIRECTIVE: You are a stateless Tier 3 Worker (Contributor). " \
"Your goal is to implement specific code changes or tests based on the provided task. " \
"You have access to tools for reading and writing files (e.g., read_file, write_file, replace), " \
"codebase investigation (codebase_investigator), and web tools (discovered_tool_web_search, discovered_tool_fetch_url). " \
"codebase investigation (discovered_tool_get_code_outline, discovered_tool_get_python_skeleton), " \
"version control (discovered_tool_get_git_diff), and web tools (discovered_tool_web_search, discovered_tool_fetch_url). " \
"You CAN execute PowerShell scripts via discovered_tool_run_powershell for verification and testing. " \
"Follow TDD and return success status or code changes. No pleasantries, no conversational filler."
elif role in ['tier4', 'tier4-qa']:
system_directive = "STRICT SYSTEM DIRECTIVE: You are a stateless Tier 4 QA Agent. " \
"Your goal is to analyze errors, summarize logs, or verify tests. " \
"You have access to tools for reading files, exploring the codebase (codebase_investigator), " \
"and web tools (discovered_tool_web_search, discovered_tool_fetch_url). " \
"You have access to tools for reading files, exploring the codebase (discovered_tool_get_code_outline, discovered_tool_get_python_skeleton), " \
"version control (discovered_tool_get_git_diff), and web tools (discovered_tool_web_search, discovered_tool_fetch_url). " \
"You CAN execute PowerShell scripts via discovered_tool_run_powershell for diagnostics. " \
"ONLY output the requested analysis. No pleasantries."
else:
@@ -208,11 +209,11 @@ def execute_agent(role: str, prompt: str, docs: list[str]) -> str:
# Use subprocess with input to pipe the prompt via stdin, avoiding WinError 206.
# We use -p 'mma_task' to ensure non-interactive (headless) mode and valid parsing.
# Whitelist tools to ensure they are available to the model in headless mode.
# Using 'discovered_tool_run_powershell' as it's the confirmed name for shell access.
allowed_tools = "read_file,write_file,replace,list_directory,glob,grep_search,discovered_tool_search_files,discovered_tool_get_file_summary,discovered_tool_run_powershell,activate_skill,codebase_investigator,discovered_tool_web_search,discovered_tool_fetch_url"
# Using 'discovered_tool_*' names as they are provided by tool_discovery.py
allowed_tools = "read_file,write_file,replace,list_directory,glob,grep_search,discovered_tool_search_files,discovered_tool_get_file_summary,discovered_tool_get_python_skeleton,discovered_tool_get_code_outline,discovered_tool_get_git_diff,discovered_tool_run_powershell,activate_skill,codebase_investigator,discovered_tool_web_search,discovered_tool_fetch_url"
ps_command = (
f"if (Test-Path 'C:\\projects\\misc\\setup_gemini.ps1') {{ . 'C:\\projects\\misc\\setup_gemini.ps1' }}; "
f"gemini -p 'mma_task' --allowed-tools {allowed_tools} --output-format json --model {model}"
f"gemini -p 'mma_task' --allowed-tools {allowed_tools} --approval-mode yolo --output-format json --model {model}"
)
cmd = ['powershell.exe', '-NoProfile', '-Command', ps_command]