Skip to the content.

ctxview default-on witness (2026-06-28)

The O(1) context planner (internal/ctxplan + the gateway --ctx-view-budget wiring in maybePlanMessages/maybeElideKVResidency) ships off by default because, the design note says, it rewrites in-flight turn history and should be “gate[d] until you have watched a real session.” This note is that watch: the GPU-free, re-runnable evidence that the planner is correct and fail-open enough to flip to a conservative default-on.

What was run on this host (win32, no GPU), all green

  1. Synthetic known-answer selfcheckgo run ./cmd/ctxplanbench -selfcheck (exit 0):

    selfcheck replay: 5 turns, peak-planned 16/20, faithful 5/5, 5 ref → 3 faults (3 served), oldest-recall 0.020
    planning cost:    full-scan 15 cand, bounded-probe 15 cand (peak 5/128), plan-agree 5/5 turns
    

    The O(1) invariants hold: resident peak ≤ budget (16/20), exact recall every turn (faithful 5/5), every forecast-miss served (3 ref → 3 faults, 3 served, 0 refused, 0 lost), and the bounded probe is identical to the full scan (plan-agree 5/5).

  2. End-to-end on-the-wire gateway testgo test ./internal/gateway -run TestCtxViewHTTP (ok ... 34.750s). Reads the bytes that actually reach a mock upstream and asserts: OFF forwards the full history; ON forwards strictly fewer, bounded ≤ budget, never empty; the Anthropic passthrough OFF byte-equals the inbound; and ON stubs the off-topic middle ([fak] ctxview-elided) while keeping the cached system prefix byte-identical, preserving message count, with exact recall of the elided span (0 lost facts).

What the fleet already dogfooded

The realized-reuse half landed and was immediately dogfooded: the #1066-honest cache-value gate (fak nightrun score, commit d7548e81) reports the WITNESSED realized KV-prefix reuse ratio over multi-turn sessions, and a follow-up (94fbbbda, #1114) tuned its regression floor to the measured 75.1% realized reuse from a real run. So the planner’s value (turn-over-turn KV-prefix reuse) is observed on real traffic, not just modelled.

Why this clears the flip gate

Honest residuals