Skip to content

fix(capture): stop storing the session's own brief as a durable memory (#329) - #331

Closed
abogartz wants to merge 1 commit into
mainfrom
329-capture-precision
Closed

abogartz wants to merge 1 commit into
mainfrom
329-capture-precision

Conversation

@abogartz

@abogartz abogartz commented Nov 7, 2026

Copy link
Copy Markdown
Owner

Problem

Auto-capture stores the session's own brief back at the user. #329 measured 7 of 14 captured rows restating the task framing, with one instruction arriving as three near-identical preference/context rows in three scopes — GATE-3's 0.9 overlap floor does not see reworded duplicates. In a real repository this stores last week's ticket as a permanent preference and injects it into every future session of that repo.

Volume was never the problem. captureMax is already 3 per pass. Precision is.

Change

Three rules added to buildCapturePrompt (src/capture/prompt.ts):

  1. Skip the task as it was asked — the request, the task's scope, the constraints that came with it. Store what was learned or decided while doing it.
  2. Durability test: keep a candidate only if a session that never saw this conversation would still need it.
  3. Few is better than full: collapse same-area overlap onto the row carrying the specific number, path or command.

Measurement

Fixture that reproduces the failure: the harness restates the same constraint in every user turn, which is what a long graded task looks like. temperature: 0, verified identical across repeated passes, so one pass per variant is enough. Seat: llama.cpp-family, thinking on, to match the live results9/B1C arms.

prompt variant framing row stored? completion tokens wall
old (shipped) yes 656 11.4 s
this PR (all three lines) no 1,095 19.7 s
ablation: no overlap-collapse line no 3,084 63.2 s
ablation: durability test only yes 1,025 17.7 s

Old prompt, the bad row verbatim:

[preference scope=repo constraints] User requires changes only inside src/; no new
files outside src/, no docs edits, no test/ directory, and no inspecting harness or
grading scripts.

This PR emits no framing row and replaces it with the durable fact the old prompt missed:

[learning scope=testing] The repo's own test suite can be run with `bun test ./src` from src/__tests__.

Rows are also more specific on a second fixture: they name src/pricing.ts and Math.min(10.00, subtotal) where the old prompt wrote "capped by subtotal".

Two things the ablations settled:

  • The framing rule is the load-bearing one. The durability test alone leaves the framing row in place.
  • The "few is better than full" line bounds deliberation, it does not improve precision. Removing it raised reasoning from 2,931 to 11,534 characters and wall clock from 19.7 s to 63.2 s. Giving the model permission to emit fewer rows makes it stop thinking sooner. Counter-intuitive, and the reason all three lines are kept.

Cost

Completion tokens 656 → 1,095 and wall 11.4 s → 19.7 s on that fixture (1.7×), thinking on. This lands on top of the capture cost already recorded in #330, and it cannot be offset through the host today: reasoning_effort is not reachable from a plugin (#330, upstream anomalyco/opencode#47366), and this seat ignores the model field so captureModel cannot select a non-reasoning model.

Test plan

  • bun scripts/merge-gate.ts — 1038 pass / 19 skip / 0 fail unit, 30 pass e2e, typecheck clean.
  • New test pins the presence of all three rules; a silent drop here costs precision that no downstream gate can recover.
  • Live re-measure with run-capture.sh against a build of this branch, classified the same way as results9/CAPTURE-ANALYSIS.md. Auto-capture stores the current request as durable preference: 7 of 14 captured rows were task framing #329 stays open until that is done — this PR isolates the prompt rule offline, which is the sharper test of the rule but not the end-to-end one.

Reproduce: precision-ab.ts in the benchmark repo.

Refs #329. Found by the #315 benchmark work.

Auto-capture stored the current request back at the user. On the benchmark,
7 of 14 captured rows restated the task framing, and one instruction arrived
as three near-identical preference/context rows in three scopes, because
GATE-3's 0.9 overlap floor does not see reworded duplicates. In a real
repository this stores last week's ticket as a permanent preference and then
injects it into every future session of that repo.

Add three rules to buildCapturePrompt: skip the task as it was asked, apply a
durability test (would a session that never saw this conversation need it),
and collapse same-area overlap onto the row carrying the specific number,
path or command.

Measured on a fixture that reproduces the failure (the harness restates the
same constraint in every user turn, temperature 0, deterministic across
passes). Old prompt emitted exactly the bad row:

  [preference scope=repo constraints] User requires changes only inside src/;
  no new files outside src/, no docs edits, no test/ directory, and no
  inspecting harness or grading scripts.

The new prompt emits no framing row and replaces it with the durable fact
(the repo's suite runs with `bun test ./src` from src/__tests__). Rows are
also more specific: they name src/pricing.ts and Math.min(10.00, subtotal).

Cost: completion tokens 656 -> 1,095 and wall clock 11.4s -> 19.7s on that
fixture, thinking on. Two ablations isolate the three rules: dropping the
durability test leaves the framing row in place, so the framing rule is the
load-bearing one; dropping the overlap-collapse line raises reasoning to
11,534 chars and 63.2s, so the "few is better than full" line is what bounds
deliberation rather than what improves precision. All three lines are kept.

Reproduce: precision-ab.ts in the benchmark repo.

Refs #329 (the live run-capture.sh re-measure is still open; this commit isolates the prompt rule offline.)
@abogartz

abogartz commented Nov 8, 2026

Copy link
Copy Markdown
Owner Author

Closing in favour of #354 (branch capture-input-shape), per the #337 decision.

The labelled REQUESTS split wins. It is validated end-to-end by the hint-chain benchmark — 30/30 chain links, zero framing rows, 2026-11-07. This PR was measured only offline against the fixture. Splitting the input is also the sharper fix: the model no longer has to infer which half of one undifferentiated block is the task.

One rule from here is ported onto #354. 652ac10 adds "Few is better than full" verbatim, because your ablation shows that line is cost control rather than precision — removing it took completion tokens 1,095 → 3,084 and wall clock 19.7 s → 63.2 s — and the labelled block supplies no equivalent bound.

The other two rules are not ported. The REQUESTS-block rule does "skip the task as it was asked" more directly, and the durability test is covered by the existing "details that only mattered inside this conversation" skip plus the REQUESTS expiry rule. Carrying all three onto the split would give a small capture model two overlapping rule sets, which is the contradiction #337 warns against.

The live run-capture.sh re-measure in this PR's test plan moves to #338, which runs it on main against the merged prompt. Nothing measured here is discarded: the ablation table is reproduced in the #354 body.

@abogartz abogartz closed this Nov 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant