Repository navigation
Program: save more money without hurting agents, and show users what we do (umbrella) #433
Description
Umbrella issue for the research, improvement and product program. Live status is updated here; each task has its own issue.
Context Guru program — plan
Goal: save users much more money without hurting agent task success, and make it obvious what Context Guru does for them.
Data: production snapshot 2026-10-10T23:48Z (189,207 requests, 2026-08-17 → 10-10, 16 tenants, 2,362 sessions), plus a deduplicated union of four earlier snapshots (production deletes request rows when it archives a session; the current snapshot holds ~53% of the all-time bill). Production is read-only; all experiments run on separate proxies.
Where the money is (observed, snapshot window, deployed gateway rates)
| USD | share | |
|---|---|---|
| cache read | 11,528 | 45.7% |
| cache write | 11,542 | 45.7% |
| output | 1,952 | 7.7% |
| fresh input | 223 | 0.9% |
| total booked | 25,341 |
| lever today | net | class |
|---|---|---|
| compaction (all components) | +$89.82 (0.35%) | counterfactual, uncorrected (pre-#255 binary) |
| keep-alive pings (1,895 pings, $131.99) | +$150.67, ROI 2.14× | credit is a ceiling, not causal |
Cache mechanics are ~91% of the bill. Compaction pays mainly by shrinking future cache reads/writes, not fresh input.
Recon findings that set the plan
- The deployed binary is old (Sep 3 build, not an ancestor of main). Snapshot behaviour ≠ main's code. Several main components have zero rows by construction.
- Keep-alive campaign windows were shifted by +3h (UTC hours stored without timezone, read as Asia/Jerusalem) — fixed in fix(campaign): write UTC timezone on generated keep-alive windows #432.
- The kvcache simulator does not reconcile to the bill (fixed-5m replay $38.8K vs $25.2K booked); no replay dollar figure is trustworthy until fixed.
- Cold turns are under-compacted: ttl_expiry turns are 21% of the bill, but compaction removed 1.4% of their tokens; extract_llm uses the warm-cache gate on cold turns.
- Keep-alive bar to beat: ping-everyone / cap-2 (+5.7% vs fixed-5m on the Sep-28 replay). No learned gate has beaten it. 652 of 709 pinged sessions lost money; second pings rescue below break-even.
- 1h tier: never granted on sonnet-5/opus-5 by the gateway (The gateway silently downgrades every ephemeral_1h request for sonnet-5/opus-5, and 78.9% of all TTL-expiry loss is in the 5min-1h band it would rescue (~$1,134/41d) #330);
cache_write_1his 0 on every row. - Accounting holes: 1,566 "hit"-labelled full-prefix rewrites ($2,827); bare
claude-sonnet-5possibly priced at the sonnet-4 rate (~$678); failed requests book $0;cache_saved_usdis the provider mechanism, not ours. - Plugins: the Codex setup breaks Codex when the proxy is down; Codex insights is a stub; the status line
$X of $Yis ambiguous; the unused-tool nudge ranks by use count and once told users to remove our own skill; the default preset isoff. - Missing instrumentation: pending tool name/elapsed, thread id, parent/child, ping events, gap, granted TTL.
Workstreams and first-round tasks
A — tail compaction
- A-cold: compaction on proven-cold turns (deployable "will be cold" rule, precision/recall, $ with CIs).
- A-unused-tools: dollars carried by never-called tool declarations; client advice vs proxy toolfilter on cold turns.
- A-harm: expand / re-read / retry / abandonment after compaction, per component.
- A-missed: uncompressed_reason priced; content types that pass untouched; near-duplicates.
- A-competitors: Headroom, RTK, context-mode, Caveman techniques replayed on our outputs.
- Next: preset redesign + joint offline replay → paired benchmarks (≥5 seeds) → real sessions through an experimental proxy.
B — cache keep-alive and lifecycle
- B-tz: campaign timezone fix (fix(campaign): write UTC timezone on generated keep-alive windows #432).
- B-sim: simulator reconciled to the bill within ±2%, then all baselines with CIs.
- Next: per-user survival / cross-conversation features vs ping-everyone; just-in-time pings; economic gate per provider; instrumentation PR (pending tool, thread id, ping events); live randomized holdout on an experimental proxy; joint replay with compaction.
C — plugins
- Reference study done for status lines/HUDs (in progress); redesign of the status line, insights, doctor, onboarding; Codex parity and the "dead proxy blocks Codex" fix.
D — dashboard
- Tab-by-tab audit with screenshots (in progress); observability/cost dashboard reference study (in progress); redesign around a bottom line + ranked recommendations.
Process
Main agent plans and integrates; worker subagents per task; a Reviewer reviews every PR before squash-merge; a Verifier re-derives every headline number before publication; a Red-team attacks each claimed result. Corrections go to analysis/CORRECTIONS.md. Merging is allowed; deployment to production is left to the owners.
Decisions taken without asking (rationale)
- "Do not send load to the upstream gateway": read as "no harmful volume". Every real LLM call goes through it, so modest experimental calls (probes, paced benchmarks) are allowed.
- Agents run via the Agent tool (~10 concurrent), not the Workflow tool, which needs explicit opt-in.
- Analysis uses the union of snapshots where history matters; the current snapshot is the reference for current behaviour.
Status
- Phase 0 reconnaissance: running. First fix: fix(campaign): write UTC timezone on generated keep-alive windows #432.
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsNew/ToDo
Activity
OsherElhadad commentedon Oct 11, 2026
Status update — round 1
Merge gate. Branch protection on
mainneeds an approving review from a second GitHub account, and auto-merge is off for this repo. Program PRs are reviewed by an independent reviewer agent. When that review passes and CI is green, the PR gets theready-to-mergelabel and waits for one maintainer approval. We do not use admin merges.searchcap, off by default)Data. Production deletes request rows when it archives sessions, so the current snapshot covers about 53% of the bill. We built a deduplicated union of four snapshots: 411,863 requests from 2026-08-17 to 10-10.
Live cache facts (real gateway calls, synthetic prefixes, about $100 total). TTL is a hard cliff between 290 s and 300 s on haiku, sonnet-5, opus-5-5 and opus-5. A 1-token ping fully resets it. Only haiku honours the 1h tier (#330).
Keep-alive policy numbers are going through independent verification and red-team review before we publish them. That review has already corrected the first-round headline: pings on a session's final, censored gap must be paid. Workstream details: #434, #435, #436, #437.
OsherElhadad commentedon Oct 11, 2026
Status update — round 2
Approved by the program reviewer, CI green, labelled
ready-to-merge. Each one still needs a maintainer's approval (branch protection). Suggested merge order: #445 before #441, because they conflict indash/api.go.context_guru_toolsrestore stub, off by default, per-threadDraft: #448 (
house2-lite). Waiting on the paired benchmark.Findings published.
Workstream conclusions so far.
OsherElhadad commentedon Oct 11, 2026
Final summary: #466. Findings: #446 (keep-alive), #451 (expand bug), #465 (tool declarations).