Repository navigation
Description
What this is about
Every time a session ends, the plugin runs a "capture": it sends the conversation to a model and asks "is there anything worth remembering?" This works, but nobody has measured what it costs. On our test setup each capture sends about 2,000 prompt tokens and takes 20-35 seconds of model time — and it re-reads the whole conversation every single time, including parts it already mined. Long sessions pay that over and over.
What it does
Two switches, both off by default, that make capture cheaper:
- Only capture when something happened. If the turn just read files or re-ran a command that already passed, there is probably nothing new to store — skip the model call. Capture still fires when the agent edits a file, when a failing test starts passing, when a command passes for the first time, or when the user states a rule.
- Only look at new parts. Remember how far capture looked last time, and send only the messages after that point.
One rule matters more than the savings: if the user stated a rule out loud ("the tax rate must be 8.25%"), capture must always run, even when nothing else happened. Losing a rule the user told us is much worse than wasting one capture.
Acceptance
- Both switches off by default; typecheck, lint, and the full test suite green.
- A test that proves: user states a rule + switch on + no other activity → the rule is still stored.
- A cost table posted on this issue: the same task run 5 times each with (a) no plugin, (b) plugin with default capture, (c) switch 1 on, (d) both switches on. Report capture count, tokens, and time per session as ranges.
- A keep / tune / kill decision for each switch, recorded here.
One model, small samples: quote ranges, not points.
Part of the guidance-precision workstream (#335); the no-plugin baseline also feeds the write-latency ticket #317.
Activity
[-]Port signal-gate + delta-window capture and bench the capture cost floor (mystery 3)[/-][+]Cheaper auto-capture: measure the cost and add the two switches[/+]chore(release): 0.22.0 [skip ci]
abogartz commentedon Nov 9, 2026
Half of this is now shipped. The two switches are on
mainvia PR #366 (merge12b7a72, released with v0.21.0 or later):captureOnSignalskips a turn that produced nothing durable,captureDeltamines only what has not been mined. Both default OFF, so nothing changes for a default install until someone opts in.The measurement half is still open: arm E has n=1, which is why the ticket stays open. The capture tax measured so far is roughly 2k prompt tokens and 20-35 s of model time per session, and no public claim is being made on one model with a narrow fixture family.
abogartz commentedon Nov 11, 2026
Named first, per #392. The cost table on this issue reports a median drop 20,506 -> 10,009 when the capture switches are enabled, and this issue's title is "Cheaper auto-capture".
That drop cannot be explained by the switches: capture cost was identical between those arms. The magnitude fits a cache-state change, not anything the switches do. The number is not a saving produced by the feature; it is two runs that started from different cache states.
Cost retraction (#392). The token figure above came from
runSession().tokens = input + output + reasoning, with cache excluded and capture excluded. On this providerinputis only the uncached remainder: one run reported 13,393 of 187,856 tokens that actually moved — 7%. A metric that undercounts by 93% still produces a plausible number, and a plausible number gets quoted.Disposition: retracted as a cost claim. Do not quote it as tokens moved, saved, or spent. The stored wire logs for this run carry no provider
usageobject, so no recomputed figure exists.Corrected metric, in force:
work = session generation + capture generation, with cache read/write reported separately and never folded in. Two results survive it, both with n and seat named on #386: transport 0/5 to 5/5 (leak-checked, one seat) and reuse median 0.98x (n=6, no measurable effect).Rules now written down where contributors hit them: no cost claim below n=6 pairs per arm; a ratio at 6 <= n < 21 is labelled "20% resolution"; the word "cheaper" does not appear without an n, a seat and a metric named on the same line; no dollar figure without a hosted-provider measurement.
ocsi-architect commentedon Nov 25, 2026
Closing: both switches shipped.
captureOnSignal(skips a capture whose turn produced nothing durable) andcaptureDelta(mines only turns since the last capture cursor) are read atsrc/capture/runtime.ts:221-222and drive the dispatch path; both default off. Verified against maina573a3b.