You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Write latency is model synopsis generation, not plugin (gate = 4ms); real costs: memory_init 25s critical path + graph built but never consumed #317
benchEnd-to-end effectiveness benchmarks (A/B evals, recall-quality)enhancementNew feature or requestseverity:mediumReal but narrow: robustness, hygiene, or gated behind multiple preconditionstier:standardBehavior inside an existing pattern: fixer plus full review, no blind arch
Measured from benchmark transcripts (state.time per tool call, both runs):
tool
median
p90
max
memory_remember
4.2–4.9s
8.5s
11.7s
memory_update
6.5s
10.8s
12.0s
memory_recall
0.56s
0.7s
1.4s
memory_read (status/list/evidence)
<1s
memory_init
25s
Writes are ~10× reads, and the cost is roughly FLAT across store size (B1 22-row store and B4 41-row store both ~4.2–6.2s) — so it is a fixed per-write cost, not a scan. Dark run (zero contention) still shows ~4.2s, so it is not GPU queueing. This is a material part of the B1 cold-start tax (1.85× A billable) and adds seconds to every capture in production.
Suspects (unverified):
runWriteGate path: per-write snapshotFiles of the whole store; tree() scan for stale-ref checks; loadCanonical registry load; lock acquisition.
identity/repokey.ts runs git rev-parse / git remote get-url synchronously — if uncached per write that is process-spawn cost on every call.
No embeddings and no network in the write path by design ("zero-embedding" dedupe), so those are ruled out.
Graph is built but not wired: memory_init pays ~25s to index the codebase-memory graph, but the read/write paths do not appear to consume it — latency paid for no benefit. Verify whether gate1 ("canonical graph") actually queries the index or just the store.
Work
Profile one memory_remember in-process (bun --cpu-prof or staged performance.now() around: identity bind, gate1, stale-ref scan, dupes, snapshot, append, evidence write). Produce a stage-cost table.
Identify the dominant stage(s); fix or move off the critical path (candidate: append row first, run gates/snapshot async, surface blocks on next read).
Decide the graph question explicitly: wire graph checks into the paths that should use them, or drop/defer memory_init indexing from the default flow. One or the other — not 25s for nothing.
Re-measure in the benchmark (B1 pass) to confirm cold tax shrinks.
Acceptance
Stage-cost table in the issue.
memory_remember median < 1s locally (read parity class), or a written rationale for a floor.
memory_init off the first-write critical path or justified.
changed the title [-]memory_remember ~4.5s / memory_update ~6.5s vs reads ~0.5s — fixed per-write cost, graph built but unwired[/-][+]Write latency is model synopsis generation, not plugin (gate = 4ms); real costs: memory_init 25s critical path + graph built but never consumed[/+]on Nov 6, 2026
opencode-reported tool duration (state.time) for the same call
2,020ms
benchmark-reported durations
4.2–6.5s
The plugin write path is not slow. The gap between 4ms and 2,020ms is the model generating the tool-call arguments — the synopsis (~200–400 output tokens at local decode speed) — which opencode accounts inside the tool part's lifetime. That explains every pattern in the original data: writes (big args) 10× slower than reads (tiny args), memory_update > memory_remember (larger payload), flat vs store size (nothing scans), dark-run persistence (decode speed is contention-light but unchanged).
So the synopsis cost is REAL but it is output tokens the model already pays — it is in the token accounting, not hidden wall-clock overhead. No async-gates fix needed; the gate is 4ms.
Remaining genuine work, retitled:
memory_init ~25s indexer spawn on the first-write critical path — background it or trust an existing stamp.
Graph built, never consumed: codebase-memory is referenced only in src/init/* (+ tool descriptions). gate1 resolves refs against the live file tree, not the index. Either wire gate1/graph consumers to the index or stop paying 25s to build it in the default flow. Decision ticket.
Instrumentation was temporary; plugin tree reverted clean.
Nothing consumes the graph.codebase-memory is referenced only in src/init/* and tool descriptions. gate1 resolves refs against the live file tree; evidence events are identical with the graph present or absent.
The build usually fails anyway. Across the interactive benchmark stores: graph=unavailable ×29 vs graph=indexed ×3. The 25s was typically spent FAILING (manual spawn from a shell succeeds — the failure is host-environment-specific). The 3 successful builds were never read by anything.
Cost when it works: 11.5–26s per init on the first-write critical path.
DECISION PROPOSED: make graph indexing opt-in. Either default ensureGraph to skip (env OPENCODE_CBM_ENABLE=1 to opt in) or drop it from runInit until a consumer exists. Keeps the 25s out of memory_init, removes the flaky spawn, changes zero gate behavior (proven above). A future graph-consuming gate can flip the flag back on with its own ticket.
AC status: stage-cost table posted (2026-11-06 comment); rationale-for-floor satisfied by the same analysis (gate 4-7ms, the rest is model synopsis output tokens); memory_init off the critical path via #323 (graph indexing opt-in, default OFF). Remaining: the B1 re-run showing reduced cold tax — seat-serial bench queue behind results-f-main-x6 (#350) and #347.
Scope note from the 2026-11-09 backlog sweep, so the board shows only the one open item.
Already satisfied, verified against main at f8f42fd today:
Stage-cost table: posted 2026-11-06 — the plugin-internal write is 4–7 ms; the 2.0 s+ figure is host-reported tool duration, i.e. model synopsis output tokens, not plugin work.
Open item, one line: the B1 re-run showing the reduced cold tax. It is queued behind #347 on the same serial seat, and it is itself a run on merged main — so it can take #347's queue slot rather than holding a second ticket open. When #347 lands the B1 numbers, close this as completed with a pointer.
Correction to my 2026-11-09 scope note, one hour later: the graph is not opt-in, it is gone.
PR #368 (231-remove-graph) merged 2026-11-09 into main @ f8f42fd. Verified on that tree: no file matching graph|cbm remains, and ensureGraph has zero occurrences under src/. The PR's own reason matches this ticket's finding — nothing ever read the index back, and the gate audit came out byte-identical with it present, so the ~25 s was pure cost.
So of this ticket's three work items:
Stage-cost table — done (2026-11-06 comment): plugin-internal write 4–7 ms, the 2.0 s+ figure is host-reported tool duration, i.e. model synopsis output.
Dominant stage identified — same analysis; nothing on the plugin side to move off the critical path.
Remaining, unchanged: the B1 re-run showing the reduced cold tax. That is now a run on a tree with the graph removed and the retrieval fixes (#364) and capture cost levers (#366) merged, so it measures something different from the 2026-11-06 numbers. It belongs in the benchmark queue with #347, which is the gate for it.
Not actionable — no code change remains on this revision, and the one open acceptance item is a bench-queue measurement the owner reserved to themselves.
Checked against 6e33179 (current main), read-only:
1. The write-path mechanism is intact, and the ticket's own claim (latency is model synopsis, not plugin) is already owner-settled by instrumentation. Every suspect the ticket lists still exists and says what the ticket says — runWriteGate (src/gate/gate.ts:339), whole-store snapshotFiles inside the write (src/gate/gate.ts:1074), the stale-ref tree() scan (src/gate/gate.ts:290), loadCanonical (src/gate/gate.ts:230, called at :561), synchronous git rev-parse / git remote get-url (src/identity/repokey.ts:175-176) — and none of it is the cost: the owner's 2026-11-06 instrumentation comment shows the plugin-internal write (bind + all 4 gates + append + evidence) at 4–7 ms against 2,020 ms host-reported duration for the same call, and rules explicitly: "No async-gates fix needed; the gate is 4ms." AC1 (stage-cost table) and AC2 (median <1s or a written rationale for a floor) were satisfied by that comment and the floor rationale; the owner restated this in the 2026-11-08 and 2026-11-09 status notes. There is no code for a fixer to write against items 1–2 of the work list.
2. The graph question is decided and shipped, not open. PR #368 (231-remove-graph) is merged — f8f42fd is an ancestor of 6e33179 (git merge-base --is-ancestor confirms). rg -in 'ensureGraph|codebase-memory|cbm' src/ matches only three explanatory comments (src/init/detect.ts:7, src/init/format.ts:3, src/init/run.ts:7); src/init/run.ts:1-9 documents memory_init as deterministic manifest parsing through the write gate with no indexer spawn. AC3 satisfied by removal.
3. The only open AC is "Benchmark B1 re-run shows reduced cold tax" — a live-model measurement in the maintainer's serial bench queue, not a change on this tree. B1 is not defined anywhere in this repo (rg -n '\bB1\b|cold tax|billable' returns only unrelated fixture prose in bench/fixtures/availability-cases.ts); it is an interactive profile run of the external harness against a live local model, which no fixer change can produce or a reviewer check. And the owner ruled its ownership explicitly (2026-11-09 scope note): it "can take #347's queue slot rather than holding a second ticket open. When #347 lands the B1 numbers, close this as completed with a pointer." #347 has since closed (final comment 2026-11-10: t3 ×5 50/50, t7 ×3 29/30 on merged main) — that table is warm-vs-cold chain evidence, not the B1 cold-start tax figure, so the pointer this ticket awaits has still not landed. The pending move is the owner running the bench and closing; per the standing rule, a ticket whose remaining work lives in maintainer hands is a refusal, and dispatching a fixer here would spend a serial slot on a run only the owner performs.
What would make this actionable: an owner-authored code request. As filed, the remaining item is a measurement. If any code work is wanted from this ticket, the owner would need to define it on the issue — e.g. a hermetic in-tree cold-tax regression runner (the bench/runners/ style, like write-latency.ts, which measures the gate path without a live model) that a fixer could implement and a reviewer could execute. Absent that, the correct disposition is the one the owner already prescribed: the B1 number comes off the serial bench queue and this issue closes completed with a pointer.
benchEnd-to-end effectiveness benchmarks (A/B evals, recall-quality)enhancementNew feature or requestseverity:mediumReal but narrow: robustness, hygiene, or gated behind multiple preconditionstier:standardBehavior inside an existing pattern: fixer plus full review, no blind arch
Activity
[-]memory_remember ~4.5s / memory_update ~6.5s vs reads ~0.5s — fixed per-write cost, graph built but unwired[/-][+]Write latency is model synopsis generation, not plugin (gate = 4ms); real costs: memory_init 25s critical path + graph built but never consumed[/+]abogartz commentedon Nov 6, 2026
Resolved by instrumentation (2026-11-06)
Temp stage timers inside
runWriteGate+ a seeded 40-row store probe (opencode run, B profile):state.time) for the same callThe plugin write path is not slow. The gap between 4ms and 2,020ms is the model generating the tool-call arguments — the synopsis (~200–400 output tokens at local decode speed) — which opencode accounts inside the tool part's lifetime. That explains every pattern in the original data: writes (big args) 10× slower than reads (tiny args),
memory_update>memory_remember(larger payload), flat vs store size (nothing scans), dark-run persistence (decode speed is contention-light but unchanged).So the synopsis cost is REAL but it is output tokens the model already pays — it is in the token accounting, not hidden wall-clock overhead. No async-gates fix needed; the gate is 4ms.
Remaining genuine work, retitled:
memory_init~25s indexer spawn on the first-write critical path — background it or trust an existing stamp.codebase-memoryis referenced only insrc/init/*(+ tool descriptions). gate1 resolves refs against the live file tree, not the index. Either wire gate1/graph consumers to the index or stop paying 25s to build it in the default flow. Decision ticket.Instrumentation was temporary; plugin tree reverted clean.
abogartz commentedon Nov 6, 2026
Graph: disable-and-time proof (2026-11-06)
Kill switch:
OPENCODE_CBM_BIN=/nonexistent(graceful →action: unavailable).ensureGraphin-process (force, moderate)memory_inite2e tool duration (opencode run)Three independent legs of the proof:
codebase-memoryis referenced only insrc/init/*and tool descriptions. gate1 resolves refs against the live file tree; evidence events are identical with the graph present or absent.graph=unavailable×29 vsgraph=indexed×3. The 25s was typically spent FAILING (manual spawn from a shell succeeds — the failure is host-environment-specific). The 3 successful builds were never read by anything.DECISION PROPOSED: make graph indexing opt-in. Either default
ensureGraphto skip (envOPENCODE_CBM_ENABLE=1to opt in) or drop it fromrunInituntil a consumer exists. Keeps the 25s out ofmemory_init, removes the flaky spawn, changes zero gate behavior (proven above). A future graph-consuming gate can flip the flag back on with its own ticket.abogartz commentedon Nov 8, 2026
AC status: stage-cost table posted (2026-11-06 comment); rationale-for-floor satisfied by the same analysis (gate 4-7ms, the rest is model synopsis output tokens); memory_init off the critical path via #323 (graph indexing opt-in, default OFF). Remaining: the B1 re-run showing reduced cold tax — seat-serial bench queue behind results-f-main-x6 (#350) and #347.
abogartz commentedon Nov 9, 2026
Scope note from the 2026-11-09 backlog sweep, so the board shows only the one open item.
Already satisfied, verified against
mainatf8f42fdtoday:memory_initgraph indexing is opt-in, default OFF (Make codebase-memory graph indexing opt-in (default OFF): 25s/init for an artifact nothing reads #323, closed completed). The ~25 s is off the critical path.Open item, one line: the B1 re-run showing the reduced cold tax. It is queued behind #347 on the same serial seat, and it is itself a run on merged main — so it can take #347's queue slot rather than holding a second ticket open. When #347 lands the B1 numbers, close this as completed with a pointer.
abogartz commentedon Nov 9, 2026
Correction to my 2026-11-09 scope note, one hour later: the graph is not opt-in, it is gone.
PR #368 (
231-remove-graph) merged 2026-11-09 intomain@f8f42fd. Verified on that tree: no file matchinggraph|cbmremains, andensureGraphhas zero occurrences undersrc/. The PR's own reason matches this ticket's finding — nothing ever read the index back, and the gate audit came out byte-identical with it present, so the ~25 s was pure cost.So of this ticket's three work items:
Remaining, unchanged: the B1 re-run showing the reduced cold tax. That is now a run on a tree with the graph removed and the retrieval fixes (#364) and capture cost levers (#366) merged, so it measures something different from the 2026-11-06 numbers. It belongs in the benchmark queue with #347, which is the gate for it.
ocsi-triager commentedon Dec 1, 2026
Triager
Not actionable — no code change remains on this revision, and the one open acceptance item is a bench-queue measurement the owner reserved to themselves.
Checked against
6e33179(currentmain), read-only:1. The write-path mechanism is intact, and the ticket's own claim (latency is model synopsis, not plugin) is already owner-settled by instrumentation. Every suspect the ticket lists still exists and says what the ticket says —
runWriteGate(src/gate/gate.ts:339), whole-storesnapshotFilesinside the write (src/gate/gate.ts:1074), the stale-reftree()scan (src/gate/gate.ts:290),loadCanonical(src/gate/gate.ts:230, called at:561), synchronousgit rev-parse/git remote get-url(src/identity/repokey.ts:175-176) — and none of it is the cost: the owner's 2026-11-06 instrumentation comment shows the plugin-internal write (bind + all 4 gates + append + evidence) at 4–7 ms against 2,020 ms host-reported duration for the same call, and rules explicitly: "No async-gates fix needed; the gate is 4ms." AC1 (stage-cost table) and AC2 (median <1s or a written rationale for a floor) were satisfied by that comment and the floor rationale; the owner restated this in the 2026-11-08 and 2026-11-09 status notes. There is no code for a fixer to write against items 1–2 of the work list.2. The graph question is decided and shipped, not open. PR #368 (
231-remove-graph) is merged —f8f42fdis an ancestor of6e33179(git merge-base --is-ancestorconfirms).rg -in 'ensureGraph|codebase-memory|cbm' src/matches only three explanatory comments (src/init/detect.ts:7,src/init/format.ts:3,src/init/run.ts:7);src/init/run.ts:1-9documentsmemory_initas deterministic manifest parsing through the write gate with no indexer spawn. AC3 satisfied by removal.3. The only open AC is "Benchmark B1 re-run shows reduced cold tax" — a live-model measurement in the maintainer's serial bench queue, not a change on this tree. B1 is not defined anywhere in this repo (
rg -n '\bB1\b|cold tax|billable'returns only unrelated fixture prose inbench/fixtures/availability-cases.ts); it is an interactive profile run of the external harness against a live local model, which no fixer change can produce or a reviewer check. And the owner ruled its ownership explicitly (2026-11-09 scope note): it "can take #347's queue slot rather than holding a second ticket open. When #347 lands the B1 numbers, close this as completed with a pointer."#347has since closed (final comment 2026-11-10: t3 ×5 50/50, t7 ×3 29/30 on merged main) — that table is warm-vs-cold chain evidence, not the B1 cold-start tax figure, so the pointer this ticket awaits has still not landed. The pending move is the owner running the bench and closing; per the standing rule, a ticket whose remaining work lives in maintainer hands is a refusal, and dispatching a fixer here would spend a serial slot on a run only the owner performs.What would make this actionable: an owner-authored code request. As filed, the remaining item is a measurement. If any code work is wanted from this ticket, the owner would need to define it on the issue — e.g. a hermetic in-tree cold-tax regression runner (the
bench/runners/style, likewrite-latency.ts, which measures the gate path without a live model) that a fixer could implement and a reviewer could execute. Absent that, the correct disposition is the one the owner already prescribed: the B1 number comes off the serial bench queue and this issue closes completed with a pointer.