diff --git a/.gemini/agents/tier1-orchestrator.md b/.gemini/agents/tier1-orchestrator.md index acb50b6..b8238e1 100644 --- a/.gemini/agents/tier1-orchestrator.md +++ b/.gemini/agents/tier1-orchestrator.md @@ -5,16 +5,16 @@ model: gemini-3.1-pro-preview tools: - read_file - list_directory - - search_files + - discovered_tool_search_files - grep_search - - get_file_summary - - get_python_skeleton - - get_code_outline - - get_git_diff - - web_search - - fetch_url + - discovered_tool_get_file_summary + - discovered_tool_get_python_skeleton + - discovered_tool_get_code_outline + - discovered_tool_get_git_diff + - discovered_tool_web_search + - discovered_tool_fetch_url - activate_skill - - run_powershell + - discovered_tool_run_powershell --- STRICT SYSTEM DIRECTIVE: You are a Tier 1 Orchestrator. Focused on product alignment, high-level planning, and track initialization. diff --git a/.gemini/agents/tier2-tech-lead.md b/.gemini/agents/tier2-tech-lead.md index 792a755..7924ce4 100644 --- a/.gemini/agents/tier2-tech-lead.md +++ b/.gemini/agents/tier2-tech-lead.md @@ -7,16 +7,16 @@ tools: - write_file - replace - list_directory - - search_files + - discovered_tool_search_files - grep_search - - get_file_summary - - get_python_skeleton - - get_code_outline - - get_git_diff - - web_search - - fetch_url + - discovered_tool_get_file_summary + - discovered_tool_get_python_skeleton + - discovered_tool_get_code_outline + - discovered_tool_get_git_diff + - discovered_tool_web_search + - discovered_tool_fetch_url - activate_skill - - run_powershell + - discovered_tool_run_powershell --- STRICT SYSTEM DIRECTIVE: You are a Tier 2 Tech Lead. Focused on architectural design and track execution. diff --git a/.gemini/agents/tier3-worker.md b/.gemini/agents/tier3-worker.md index 0bc2c11..4889193 100644 --- a/.gemini/agents/tier3-worker.md +++ b/.gemini/agents/tier3-worker.md @@ -7,19 +7,19 @@ tools: - write_file - replace - list_directory - - search_files + - discovered_tool_search_files - grep_search - - get_file_summary - - get_python_skeleton - - get_code_outline - - get_git_diff - - web_search - - fetch_url + - discovered_tool_get_file_summary + - discovered_tool_get_python_skeleton + - discovered_tool_get_code_outline + - discovered_tool_get_git_diff + - discovered_tool_web_search + - discovered_tool_fetch_url - activate_skill - - run_powershell + - discovered_tool_run_powershell --- 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, codebase investigation, and web tools. -You CAN execute PowerShell scripts or run shell commands via run_powershell for verification and testing. +You CAN execute PowerShell scripts or run shell commands via discovered_tool_run_powershell for verification and testing. Follow TDD and return success status or code changes. No pleasantries, no conversational filler. diff --git a/.gemini/agents/tier4-qa.md b/.gemini/agents/tier4-qa.md index 1c12d35..fd16830 100644 --- a/.gemini/agents/tier4-qa.md +++ b/.gemini/agents/tier4-qa.md @@ -5,19 +5,19 @@ model: gemini-2.5-flash-lite tools: - read_file - list_directory - - search_files + - discovered_tool_search_files - grep_search - - get_file_summary - - get_python_skeleton - - get_code_outline - - get_git_diff - - web_search - - fetch_url + - discovered_tool_get_file_summary + - discovered_tool_get_python_skeleton + - discovered_tool_get_code_outline + - discovered_tool_get_git_diff + - discovered_tool_web_search + - discovered_tool_fetch_url - activate_skill - - run_powershell + - discovered_tool_run_powershell --- 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, and web tools. -You CAN execute PowerShell scripts or run shell commands via run_powershell for diagnostics. +You CAN execute PowerShell scripts or run shell commands via discovered_tool_run_powershell for diagnostics. ONLY output the requested analysis. No pleasantries. diff --git a/.gemini/settings.json b/.gemini/settings.json index d532ab3..afd7f27 100644 --- a/.gemini/settings.json +++ b/.gemini/settings.json @@ -6,7 +6,7 @@ "whitelist": [ "*" ], - "discoveryCommand": "type .gemini\\tools.json", + "discoveryCommand": "powershell.exe -NoProfile -Command \"Get-Content .gemini/tools.json -Raw\"", "callCommand": "python scripts/tool_call.py" }, "hooks": { diff --git a/scripts/mma_exec.py b/scripts/mma_exec.py index 897b759..d4256a7 100644 --- a/scripts/mma_exec.py +++ b/scripts/mma_exec.py @@ -177,16 +177,16 @@ 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 (get_code_outline, get_python_skeleton), " \ - "version control (get_git_diff), and web tools (web_search, fetch_url). " \ - "You CAN execute PowerShell scripts via run_powershell for verification and testing. " \ + "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 (get_code_outline, get_python_skeleton), " \ - "version control (get_git_diff), and web tools (web_search, fetch_url). " \ - "You CAN execute PowerShell scripts via run_powershell for diagnostics. " \ + "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: system_directive = f"STRICT SYSTEM DIRECTIVE: You are a stateless {role}. " \ @@ -209,7 +209,7 @@ 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. - allowed_tools = "read_file,write_file,replace,list_directory,glob,grep_search,search_files,get_file_summary,get_python_skeleton,get_code_outline,get_git_diff,run_powershell,activate_skill,codebase_investigator,web_search,fetch_url" + 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}" diff --git a/scripts/tool_discovery.py b/scripts/tool_discovery.py new file mode 100644 index 0000000..188d183 --- /dev/null +++ b/scripts/tool_discovery.py @@ -0,0 +1,44 @@ +import json +import sys +import os + +# Add project root to sys.path +sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), ".."))) + +try: + import mcp_client +except ImportError as e: + # Print the error to stderr to diagnose + print(f"ImportError in discovery: {e}", file=sys.stderr) + print("[]") + sys.exit(0) + +def main(): + specs = list(mcp_client.MCP_TOOL_SPECS) + + # Add run_powershell (manually define to match ai_client.py) + specs.append({ + "name": "run_powershell", + "description": ( + "Run a PowerShell script within the project base_dir. " + "Use this to create, edit, rename, or delete files and directories. " + "The working directory is set to base_dir automatically. " + "stdout and stderr are returned to you as the result." + ), + "parameters": { + "type": "object", + "properties": { + "script": { + "type": "string", + "description": "The PowerShell script to execute." + } + }, + "required": ["script"] + } + }) + + # Output as JSON array of FunctionDeclarations + print(json.dumps(specs, indent=2)) + +if __name__ == "__main__": + main()