# Specification: Review vendor api usage in regards to conservative context handling

## Overview
This track aims to optimize token efficiency and transparency by reviewing and improving how vendor APIs (Gemini and Anthropic) handle conservative context pruning. The primary focus is on extracting, plotting, and exposing deep metrics to the GUI so developers can intuit how close they are to API limits (e.g., token caps, cache counts, history bleed).

## Scope
- **Gemini Hooks:** Review explicit context caching, cache invalidation, and tools declaration. 
- **Global Orchestration:** Review global context boundaries within the main prompt lifecycle.
- **GUI Metrics:** Expose as much metric data as possible to the user interface (e.g., plotting token usage, visual indicators for when "history bleed" occurs, displaying the number of active caches).

## Functional Requirements
- Implement extensive token and cache metric extraction from both Gemini and Anthropic API responses.
- Expose these metrics to the Dear PyGui frontend, potentially utilizing visual plots or progress bars to indicate token budget consumption.
- Implement tests to explicitly verify context rules, ensuring history pruning acts conservatively and predictable without data loss.

## Non-Functional Requirements
- Ensure GUI rendering of new plots or dense metrics does not block the main thread.
- Adhere to the "Strict State Management" product guideline.

## Out of Scope
- Major feature additions unrelated to context token management or telemetry.
- Expanding the AI's agentic capabilities (e.g., new tools).