# Stage 21: Opt-In Prompt Proxy (aq21_prompt_proxy / DB-UNIT-08)

Answers recurring prompts at 0 model calls or injects compact cards on explicit opt-in while forwarding other calls untouched.

- Atomic micro-queue: `aq21_prompt_proxy` (visibility: `public_commons`)
- Backing database unit: `DB-UNIT-08` (`Opt-In Prompt & Inference Wire Proxy Rule Core`)
- Database cell: `telemetry-db.teleon.dev` (`teleon_core.prompt_proxy_rule_sets`, `teleon_core.direct_deterministic_hit_catalog`, `teleon_core.wire_observation_headers`)
- Claim row hydration: `single_self_contained_flat_task_row` (100% context inline, normalized writeback)
- Track 2 Sister queue (`SISTER-08`): `sq08-improve-proxy-queue.teleon.dev` (Tune direct-answer confidence thresholds, context byte budgets, and promote frequent queries to 0-call cards.)
- Lanes: 0-Call Direct, <=2 KiB Card Inject, Byte Passthrough

## Execution engines & AI Agent freedom contract

- **Deterministic (0 model calls)**: `wire_metadata_rule_and_direct_responder_v1` (5-protocol wire matcher & responder)
- **Hybrid (<=1 model call)**: `compact_context_selector_hybrid_v1`
- **AI Agent & Bot Fleet (1..6 calls)**: `custom_enterprise_policy_simulator_v1` (Direct-answer rule & budget curator)
  - Contract: **Instructions + Resources + Freedom to search for new resources and new ways not bound by instructions**

## Database invariants

- Rule evaluation matches metadata only (never prompt prose) with strict deny -> require -> select precedence.
- User BYO provider keys pass only to the user's chosen inference host and never enter Teleon storage.

## External & internal bot fleet actions

- Promote verified deterministic answers for high-frequency utility prompts
- Trim injected reference cards to strict <=2 KiB budgets
- Verify byte-identical passthrough when proxy opt-in is off

## Sister self-tuning areas

- Tune direct_response_min_score and max_injected_context_bytes per model family
- Promote high-frequency repeated tasks into verified deterministic direct-hit cards
- Add wire codec support and aspect tags for new local/cloud inference endpoints
