Repository navigation
Description
Symptom
write_promoted evidence lines grow with session length and re-serialize the session's entire tool-call history on every promoted write. Measured on the dogfood host, 2026-10-28 (20 promoted writes):
| Measurement | Value |
|---|---|
write_promoted line bytes |
min 564 · median 4,529 · max 21,785 |
Distinct call= ids inside one evidence_refs=[…] |
grew monotonically, ~570 ids by the last write of a long session |
| Evidence file for the day | 0.45 MB, dominated by these lines |
Not auto-capture
Worth stating explicitly because it was the initial guess: autoCapture is false in the live config, today's evidence contains zero capture events (capture_lag, auto_capture_refused, model-call lines), and all 20 promoted writes were manual memory_remember calls with grounded_by=engagement. The growth is in the write gate's grounding telemetry, so it happens on every ordinary session with capture off.
Root cause
evidenceCalls(sid) (src/triggers.ts:204-206) returns every call id recorded for the session:
export function evidenceCalls(sid: string): string[] {
return session(sid).calls.map((c) => c.call);
}src/gates.ts:675 writes that whole array into the line: evidence_refs: bracketList(ctx.evidenceCalls).
session(sid).calls is unbounded per session — SESSION_CAP = 64 (src/sessions.ts:8) caps the number of sessions held, not the number of calls inside one; the list is only dropped on LRU eviction or finalizeSession. So each promoted write costs O(calls so far) and a long session costs O(n²) bytes overall. Evidence day-files have no size cap or rotation (rotation exists only for the use ledger, src/hits.ts:65).
Impact
- Disk growth in
memory/evidence/, and slower reads for everything that parses those files (captureLag,blockedRecent,memory_status, the viewer). - A single 22 KB logfmt line is fragile for readers and for any future line-length limit.
- No token cost — evidence is never injected into a prompt. This is a telemetry-hygiene and I/O bug, not a context-cost bug.
Proposed fix
Keep the audit signal, bound the line:
- Cap the refs that are rendered (e.g. the most recent N ≈ 10 engagement calls) and always include the calls GATE-4 actually reasons about: the gate-check call and the FAIL→PASS pair.
- Record
evidence_refs_countalongside the truncated list so "how much engagement backed this write" survives as a number even when the ids do not. - If full provenance must persist, write the complete chain once per session to its own file keyed by
chainid and reference that key from the line, instead of repeating it per write.
Acceptance criteria
- Test with a synthetic session of 1,000 recorded calls: a promoted write's evidence line stays under a pinned byte budget.
- GATE-4 grounding behavior unchanged — existing engagement-grounding tests stay green, and a write grounded only by the FAIL→PASS pair still passes when the pair falls outside the rendered window.
-
memory_status,blockedRecent, and the viewer read the new shape without special-casing. - A backfill/compaction note in the docs for existing oversized day-files (or an explicit decision to leave them).
Out of scope
The prompt-cache invalidation issue (separate, higher priority). Auto-capture trigger economics (label capture).
Activity
WhollyMindless commentedon Oct 29, 2026
Intent to work this, unless it's already yours — you filed it two hours ago with the root cause mapped (
evidenceCallsreturns the unbounded per-session call list;SESSION_CAPcaps sessions, not calls), and no one has claimed it.Plan, regression-first, matching the program's shape:
write_promotedline's bytes do not grow with session length beyond a constant, and (b) one promoted write in a long session costs O(1) serialized bytes, not O(calls). Red on currentmainby construction.evidence_refsexists to show WHICH behavior grounded the write — that argument does not need all ~570 ids, it needs the recent/relevant window. Leaning toward: keep the ids that actually ground the verdict (the engagement/gate_checkwindow the gate consults) capped at the tail, with anevidence_total=field so the count stays honest andmemory_evidencecan say "12 of 570 shown". A cap alone (tail-N) would silently drop the earliest grounding evidence from a write that cites it — the count field is what keeps that from becoming a new truth problem, same family as P2: memory_update claims nothing was written after post-append audit failure; retry leaves two active rows #155's audit-line lessons.One heads-up from the #158 fix round that just landed on that file:
write_promoted's record now flows through theevidenceErrorwrap andauditCaveat, so whichever of our branches moves that line first, the other rebases over it cheaply.If you're already on it, say the word and I'll stand down.
test: reproduce growing promotion evidence (#163)
abogartz-opencode-self-improvement commentedon Oct 29, 2026
🎉 This issue has been resolved in version 0.14.19 🎉
The release is available on:
Your semantic-release bot 📦🚀
chore(release): 0.15.28 [skip ci]