# Implementation Plan: Gemini CLI Parity ## Phase 1: Infrastructure & Common Logic - [x] Task: Initialize MMA Environment `activate_skill mma-orchestrator` - [x] Task: Audit `gemini_cli_adapter.py` and `ai_client.py` for parity gaps (Findings: missing count_tokens, safety settings, and robust system prompt handling in CLI adapter) - [x] Task: Implement common logging utilities for CLI bridge observability - [x] Task: Conductor - User Manual Verification 'Infrastructure & Common Logic' (Protocol in workflow.md) ## Phase 2: Token Counting & Safety Settings - [x] Task: Write failing tests for token estimation in `GeminiCLIAdapter` - [x] Task: Implement token counting parity in `GeminiCLIAdapter` - [x] Task: Write failing tests for safety setting application in `GeminiCLIAdapter` - [x] Task: Implement safety filter application in `GeminiCLIAdapter` - [x] Task: Conductor - User Manual Verification 'Token Counting & Safety Settings' (Protocol in workflow.md) ## Phase 3: Tool Calling Parity & System Instructions - [x] Task: Write failing tests for system instruction usage in `GeminiCLIAdapter` - [x] Task: Implement system instruction propagation in `GeminiCLIAdapter` - [x] Task: Write failing tests for tool call/response mapping in `cli_tool_bridge.py` - [x] Task: Synchronize tool call handling between bridge and `ai_client.py` - [x] Task: Conductor - User Manual Verification 'Tool Calling Parity & System Instructions' (Protocol in workflow.md) ## Phase 4: Final Verification & Performance Diagnostics - [x] Task: Implement automated parity regression tests comparing CLI vs Direct API outputs - [x] Task: Verify bridge latency and error handling robustness - [x] Task: Conductor - User Manual Verification 'Final Verification & Performance Diagnostics' (Protocol in workflow.md) ## Phase 5: Edge Case Resilience & GUI Integration Tests - [x] Task: Implement tests for context bleed prevention (filtering non-assistant messages) - [x] Task: Implement tests for parameter name resilience (dir_path/file_path aliases) - [x] Task: Implement tests for tool call loop termination and payload persistence - [x] Task: Conductor - User Manual Verification 'Edge Case Resilience' (Protocol in workflow.md)