┌──────────────────────────────────────────────────────────────────┐
│ FULL STACK INTEGRATION │
├──────────────────────────────────────────────────────────────────┤
│ APPLICATION LAYER (opencode-owl) │
│ ├── #42 Stable-first prompt ordering │
│ │ → global memories → skills → facts → session context │
│ ├── #43 Embedding LRU cache │
│ │ → avoid repeated Ollama/vLLM embed calls │
│ ├── #44 MCP query result cache │
│ │ → 30s TTL for repeated memory_query calls │
│ ├── #45 AHE Trace v4: prefix_hash + prefix_len_tokens │
│ │ → measure what prefix is being cached │
│ ├── #46 memory_prefix_report tool │
│ │ → diagnose prefix stability, recommend ordering │
│ └── #47 cache_control marker (blocked on OpenCode upstream) │
├──────────────────────────────────────────────────────────────────┤
│ NVIDIA SKILLS LAYER │
│ └── #49 NVIDIA Skills installed in registry │
│ → cuOpt, AI-Q skills injected as stable skill prefix │
│ → AHE eval tasks auto-augmented with NVIDIA tool knowledge │
├──────────────────────────────────────────────────────────────────┤
│ HARDWARE LAYER (GB10 — 121.6 GB VRAM) │
│ ├── #50 vLLM + RadixAttention (--enable-prefix-caching) │
│ │ → Skill prefix (< 5K tokens) cached as KV tensors │
│ │ → TTFT: ~2s → ~30ms for cached prefix │
│ ├── #51 nv-embed-v2 (4096-dim) via vLLM │
│ │ → Better semantic search → better memory retrieval │
│ ├── #52 AI-Q Blueprint deep analysis │
│ │ → Multi-agent failure root-cause synthesis │
│ ├── #53 cuOpt MILP eviction (GPU-optimal cache replacement) │
│ │ → Replace LRU with globally-optimal eviction policy │
│ └── #54 TensorRT-LLM FP8 backend │
│ → 3–8× faster AHE eval, paged KV cache │
└──────────────────────────────────────────────────────────────────┘
1. memory_query("nvidia cuopt")
↓ [#43 cache miss → SQLite FTS5 + nv-embed-v2 KNN]
2. retrieve: [cuopt-install skill, cuopt-routing skill, ...]
↓
3. chat.system.transform [#42 stable-first ordering]
┌─────────────────────────────────────┐
│ [STABLE PREFIX — cached by vLLM] │
│ global/preference: ... │
│ global/skill: ... │
│ project/skill: cuopt-install ... │ ← NVIDIA skill injected
│ cuopt-routing ... │
├─────────────────────────────────────┤
│ [DYNAMIC — recomputed every turn] │ ← cache breakpoint here
│ project/fact: ... │
│ <current_task>: ... │
└─────────────────────────────────────┘
↓
4. vLLM RadixAttention lookup [#50]
prefix_hash matches? → KV cache HIT → skip prefill
→ TTFT drops from 2s → 30ms
↓
5. AHE trace records: [#45]
prefix_hash: "a3f8c102"
prefix_cache_hit_tokens: 4821
prefix_cache_miss_tokens: 0
↓
6. AHE summary:
avg_prefix_cache_hit_rate: 0.97
total_tokens_saved: 2.1M
estimated_speedup: 4.3×
Week 1: #49 (10 min) → #50 (1 day) → #42 (1h) → #51 (2h)
Week 2: #43 (2h) → #44 (1h) → #45 (2h) → #46 (3h)
Week 3+: #52 (3 days) → #53 (2 wk) → #54 (1 wk)
Purpose
Tracking issue for the complete vertical integration of Prefix KV Cache across all layers in opencode-owl on the GB10 GPU. This issue documents how the application-layer Prefix-KV issues (#42–#48) and the hardware-layer NVIDIA issues (#49–#54) form a cohesive system.
Architecture Overview
Data Flow: Prefix KV Cache End-to-End
Key Metrics to Track
Implementation Order
Success Definition
This vertical integration is complete when:
pass@1improves by ≥ 10% due to richer NVIDIA skill injectionavg_prefix_cache_hit_rate> 90% in AHE runsavg_latency_sreduces by ≥ 3× compared to Ollama backend baselinememory_prefix_reportshowscache_eligible: true,current_order_is_optimal: trueRelated