The **Cockpit** is the mission control for your AI agents. While the "Engine" handles reasoning, the Cockpit ensures that reasoning is safe, cost-effective, and auditable. In v1.8.4, the Cockpit has evolved from a dashboard into an **Autonomous Evolution Engine** with standardized security middleware.

---

## 🛰️ Shadow Routing & Fleet Dashboard
The **Fleet Dashboard** (Mission Control) allows you to manage multiple agents from a single pane of glass. 
*   **Shadow Mode**: Deploy a new version (v2) alongside production (v1).
*   **Estate Health**: Gain visibility into "The Builder", "The Strategist", and "The Guardian" personas.
*   **Access**: Securely managed via the **`agent-ops` CLI** or the integrated **Operational Guide**.

## 🧠 Hive Mind (Semantic Caching)
The Hive Mind is a specialized middleware that prevents redundant LLM calls.
1. **Request**: User asks a common question.
2. **Lookup**: Hive Mind checks a Vector Store (AlloyDB/Memorystore) for semantically similar historical answers.
3. **Hit**: If a match is >90% similar, the answer is served in 10ms for $0 cost.
[**Read FinOps Guide**](TECHNICAL_FINOPS_GUIDE.md)

## 🛡️ Standardized Guardrails (v1.8.4)
The Cockpit now provides a standardized security middleware for agent developers.
*   **PII Scrubbing**: Automatically mask emails, API keys, and tokens using `guardrails.scrub_pii()`.
*   **Adversarial Defense**: Use `guardrails.validate_prompt()` to block instruction-overrides and injection attempts before they reach the model.
*   **Agent Decorators**: Wrap your core reasoning logic with `@guardrails.wrap_agent_call` for unified governance.

## 📊 Operational Metrics & SME Personas
Every audit result is framed through the lens of a [**Principal SME Persona**](TECHNICAL_AUDIT_GUIDE.md).
- **Token Velocity**: Monitoring for prompt runaways or recursive loops.
- **Reasoning Density**: Quality gained per token spent. [**Read Quality Guide**](TECHNICAL_QUALITY_GUIDE.md).
- **Cost Drift**: Predictive auditing of monthly Gemini consumption.

## 🚦 Human-in-the-Loop (HITL)
For high-stakes actions, the Cockpit allows you to define "Gatekeeper" tools.
- When an agent calls a gated tool, the Cockpit pauses execution and requests human approval via the **Face (A2UI)**.
- **A2UI v1.3 Features**: Leverage new adaptive surfaces for structured human feedback. [**Read UX Guide**](TECHNICAL_UX_GUIDE.md).

---

## 🏛️ Autonomous Evolution (New in v1.3)
The Cockpit no longer just finds problems; it synthesizes fixes.
*   **Autonomous Architect**: Runs `make arch-review` to generate ADRs and ROI analysis. [**Read Architect Guide**](TECHNICAL_ARCH_REVIEW.md).
*   **Context-Aware Patching**: Trigger code synthesis to harden your agent's logic.

## 🛡️ Advanced Governance & Discovery
The Cockpit uses a centralized **Discovery Engine** to intelligently map and audit your agentic estate.

### 🧩 `cockpit.yaml` Configuration
Standardize your project's governance by placing a `cockpit.yaml` in your root directory:
```yaml
entry_point: "src/my_agent.py"  # Override autodetection
exclude:                       # Custom ignore patterns
  - "legacy_code/**"
  - "experimental/**"
threshold: 80                  # Minimum health score for CI/CD pass
```

### 🔍 Discovery Engine Capabilities
*   **`.gitignore` Compliance**: Automatically respects your project's ignore rules to reduce scan noise.
*   **Library Isolation**: Intelligently ignores third-party libraries (`venv`, `node_modules`) to eliminate false positives in security reports.
*   **AST Brain Detection**: Uses Abstract Syntax Tree analysis to find where your agent logic (Vertex AI, LangChain, etc.) is actually initialized.

## 🌐 Global Governance Hub
The Cockpit can act as a **Centralized Auditor** for any agentic codebase.
*   **External Repos**: Use `make audit-all TARGET=/path/to/remote-repo`. The Discovery Engine will automatically identify the agent's entry point and apply governance standards.

---
*Generated by the AgentOps Cockpit Orchestrator. Global Governance Division (v1.8.4).*
