Repository navigation
Closed
Labels
benchEnd-to-end effectiveness benchmarks (A/B evals, recall-quality)captureAuto-capture pipeline: envelope compatibility, trigger coverage, trigger economicsreleasedseverity:mediumReal but narrow: robustness, hygiene, or gated behind multiple preconditions
Description
Part of #386.
Goal
The plugin can say, for one session, what its own memory work cost — capture included,
cache accounted for, in the plugin's own status output rather than only in a bench harness.
Findings
- Capture does not appear in the session's event stream. It is a separate model call made
at session end, so anything reading the session's usage sees zero. - Its reply can land after
opencode runhas exited. The bench read the meter at that
instant and reported capture as free for its entire history. Fixed in the bench by
draining until capture requests and replies balance. - Measured cost: roughly 5,000 completion tokens per session, about a third of what the
session itself generates, withcached_tokens: 0because the capture prompt is the
prefix of nothing. - 94% of capture's completion tokens are reasoning.
- The provider reports
inputas only the uncached remainder, so an event-stream total is
not a cost. Measured: 13,393 reported against 187,856 actually moved.
Acceptance criteria
status(or the ledger) reports, per session: generation tokens, capture tokens, cache
read tokens, and the number of capture calls, sourced from provider usage rather than
from an internal estimate.- A session that triggers no capture reports capture cost 0 and says why (no signal, gate
refused, model disabled), so 0 is never ambiguous between "free" and "never ran". - A capture call whose reply arrives after the session ends is still attributed to that
session, proven by a test that delays the reply. - The bench's
billedFromand the plugin's own number agree within 2% on the same wire
log, so the harness is not the only thing that can see this. - Nothing in the repo quotes a session cost that excludes capture.
Not in scope
Making capture cheaper. That is the sibling ticket, and it should be decided with this
number visible rather than guessed at without it.
Metadata
Metadata
Assignees
Labels
benchEnd-to-end effectiveness benchmarks (A/B evals, recall-quality)captureAuto-capture pipeline: envelope compatibility, trigger coverage, trigger economicsreleasedseverity:mediumReal but narrow: robustness, hygiene, or gated behind multiple preconditions
Activity
abogartz commentedon Nov 11, 2026
PR #394 ships the part that is buildable. Criterion 1's capture half cannot be met with the current host API, and criterion 4 depends on it.
Probed against a running host with a throwaway plugin, 2026-11-11:
ctx.generateexposes exactly one member:text.generate.text({ model, prompt })resolves to{ text }— nousage, notokens.status/<session>.json, and itsmeasuredcovers only the session's own turns.ctx.sessiondoes exposecreate/prompt/wait;session.promptaccepted the call and blocked without returning in the probe window.So the choice was an estimate that says it is an estimate, or a zero. #394 ships chars/4 with
receipt=noneon the line and "estimate, no provider receipt" in the render.Met: criterion 2 (zero with a reason; an unread cost renders nothing), criterion 3 (tested with a parked reply — the receipt carries
session=and appears when the reply lands, which is the race that billed capture as free), criterion 5 (README updated; no other repo claim quotes a session token figure).Also fixed, and it was a live one:
Number("")is0, so acapture_costline whose character count failed to render would have been billed as a free capture — the exact failure this ticket exists to remove. Blank counts are now skipped, not read as zero.Session side is genuinely provider-sourced:
Measurednow carriesoutputandreasoning, split, because 94% of a capture call's completion tokens were reasoning and folding them hides the cost. Optional on the persisted payload so a newer panel reading an older file shows nothing rather than "generated nothing".Criteria 1 (capture) and 4 moved to #395, which names both routes and their costs. Criterion 3 of #395 re-verifies the
base4transport result, because moving capture ontoctx.session.*changes the one component whose output that benchmark measures.Verification:
bun run gate— 1204 unit tests, 30 e2e against a real opencode host, typecheck and lint clean.Merge pull request #394 from abogartz/387-session-cost-accounting
chore(release): 0.24.0 [skip ci]
abogartz-opencode-self-improvement commentedon Nov 12, 2026
🎉 This issue has been resolved in version 0.24.0 🎉
The release is available on:
Your semantic-release bot 📦🚀