Files
manual_slop/conductor/tracks/gemini_cli_parity_20260225/spec.md

2.0 KiB

Specification: Gemini CLI Parity

Overview

Achieve full functional and behavioral parity between the Gemini CLI integration (gemini_cli_adapter.py, cli_tool_bridge.py) and the direct Gemini API implementation (ai_client.py). This ensures that users leveraging the Gemini CLI as a headless backend provider experience the same level of capability, reliability, and observability as direct API users.

Functional Requirements

  • Token Estimation Parity: Implement accurate token counting for both input and output in the Gemini CLI adapter to match the precision of the direct API.
  • Safety Settings Parity: Enable full configuration and enforcement of Gemini safety filters when using the CLI provider.
  • Tool Calling Parity: Synchronize tool definition mapping, call handling, and response processing between the CLI bridge and the direct SDK.
  • System Instructions Parity: Ensure system prompts and instructions are consistently passed and handled across both providers.
  • Bridge Robustness: Enhance the cli_tool_bridge.py and adapter to improve latency, error handling (retries), and detailed subprocess observability.

Non-Functional Requirements

  • Observability: Detailed logging of CLI subprocess interactions for debugging.
  • Performance: Minimize the overhead introduced by the bridge mechanism.
  • Maintainability: Ensure that future changes to ai_client.py can be easily mirrored in the CLI adapter.

Acceptance Criteria

  • Token counts for identical prompts match within a 5% margin between CLI and Direct API.
  • Safety settings configured in the GUI are correctly applied to CLI sessions.
  • Tool calls from the CLI are successfully executed and returned via the bridge without loss of context.
  • System instructions are correctly utilized by the model when using the CLI.
  • Automated tests verify that responses and tool execution flows are identical for both providers.

Out of Scope

  • Performance optimizations for the gemini CLI binary itself.
  • Support for non-Gemini CLI providers in this track.