Skip to content

Use symptom clauses to tell added facts from changed ones, and surface ambiguous pairs instead of dropping one #449

Done

Description

@abogartz

Why this exists

#448 established that the dedup false positive is not a threshold problem: the pair worth releasing scores 0.8235 and the changed-fact pair the suite pins scores 0.8333, so any separating threshold is a window one hundredth wide fitted to two observations. A token-overlap score cannot tell "the swap replaced a fact" from "the swap added one".

This issue proposes attacking the input and the output instead of the constant. Both ideas come out of that analysis, and both were measured against the maintainer's store on 2026-11-19. A throwaway POC is following; its results will be appended here rather than asserted now.

Idea 1 — a symptom clause is the discriminator the score is missing

The asymmetry that makes this work: a changed fact keeps its symptom, an added fact brings a new one. Two rows answering the same question share the symptom, so a When <symptom>: prefix adds shared tokens and pushes them closer. Two rows answering different questions bring different symptom prose, and they move apart.

Measured on the two pairs from #448, using clauses written in the shape the gate already enforces:

pair today with symptom clauses desired
npm run build vs npm run build:example-images 0.8235 suppressed — wrong 0.500 both kept — right keep both
runbook every friday vs every monday, same symptom 0.8333 suppressed — right 0.875 suppressed — right suppress
the gufo cutover, written twice 1.000 suppressed — right 1.000 suppressed — right suppress

Three cases, one threshold, all correct — and the direction is structural rather than tuned: distinct symptoms contribute distinct tokens, so the parallel-fact case cannot re-collide by accident.

The honest caveat. The symptom clauses in that table were authored by hand for the experiment, not produced by a capture run. The direction holds by construction; the specific 0.500 is authorship. Before this is built, the claim needs real rows captured under the rule, or a POC that derives symptoms from the store rather than from a person.

The gap that matters. The symptom rule currently binds learning and blocker only (symptomRuleEnabled in src/gate/gate.ts). The BabylonDocs rows are pattern, which is exempt — and the exempt types are where shape collisions live, because they are short, formulaic and written in batches. So the concrete change is extending the convention to pattern, and possibly context.

Idea 2 — surface both, flagged AMBIGUOUS, instead of dropping one

Today the pass silently deletes a row. Even when it is right, the reader never knows a sibling existed; when it is wrong, the loss is invisible — which is exactly why #448 needed a full store replay to find.

There is a working precedent for the alternative. conflictLine() in src/recall/conflicts.ts renders both facts, the provenance and a fixed Action onto a row; src/recall/relevant.ts attaches it to a shallow copy of the rendered text and adds a header caveat so the reader knows CONFLICT rows were code-checked. An AMBIGUOUS variant is the same plumbing with the verdict left open: keep both rows, attach a line naming the sibling and the reason, and let the model pick by what it is actually doing.

The two ideas are complementary, not competing. Idea 1 prevents most collisions at write time; idea 2 makes the residue visible at read time. Visibility has value on its own — a flagged pair is debuggable, a dropped one is not.

What has to be decided before idea 2 is built

  • Window slots. Grouping both spends 2 of the 5 slots instead of 1. Negligible on the current store, which holds exactly one such pair, but it needs a cap: a scope of parallel short facts could otherwise eat the window.
  • Signature change. dedupeWindow returns a filtered list today. A group marker has to ride through src/recall/relevant.ts and src/inject/epochs.ts. The CONFLICT path shows the shape — rendered copy plus header caveat — but it is not a one-liner.
  • Work moved to the model. More prompt text, and a standing instruction that may be ignored. CONFLICT tolerates this because its Action is fixed; AMBIGUOUS deliberately leaves the choice open, so it needs wording strong enough that "pick one" does not degrade into "use the first".
  • When to group at all. Grouping every pair in a near-copy band would re-admit the crowding the pass exists to prevent. The candidate rule to test is: suppress when the rows are genuinely interchangeable, group when they are same-shape-different-content, and the symptom clause is what tells them apart — so idea 2 depends on idea 1 rather than standing alone.

Context: how much of this pass is doing anything?

Worth settling alongside these ideas. On the maintainer's store the dropped-chunk guard, not the threshold, decides what the pass ever sees: rows differing by a timestamp have different dropped fragments and are never compared, so all 149 pr-watch cursor rows are exempt and all 78 candidates in the repository's own review scope are stopped there. The ADR's stated motivation is timestamp-differing rows crowding the window. What the pass actually suppresses is prose with no short fragments — and its one visible effect today is the wrong one in #448.

So the question may not be "what should the threshold be" but "should this pass's remaining job be flagging rather than dropping". Ideas 1 and 2 are compatible with that answer; idea 2 is basically it.

Out of scope

Embedding-based semantic recall — that is #420, and this should be re-tested against whatever lands there. Also the write-gate gap where identical prose filed as two types is promoted twice, named in bench/dedup-live-results.md; it is a separate defect.

Activity

  1. abogartz commented on Nov 19, 2026

    @abogartz
    OwnerAuthor

    POC results — 2026-11-19, throwaway, against the maintainer's live store

    Scripts (temp, not committed): poc-symptom.ts, poc-symptom2.ts. Scan set: 1,321 active rows — this repository plus un-stamped rows, since both share a window.

    The headline: idea 1 is not what the store supports, and the POC turned up a structural rule that gets all three cases right without touching the threshold.

    A. Symptom coverage is near zero

    type rows with a When …: clause
    context 571 0 (0%)
    learning 373 48 (13%)
    decision 149 0 (0%)
    pattern 109 3 (3%)
    preference 65 0 (0%)
    blocker 54 0 (0%)

    The rule binds learning and blocker, and 325 of 373 learning rows and all 54 blocker rows predate it — scripts/symptom-fixer.ts repairs them keyword-only by design, so they stay non-conformant. Extending the convention to pattern would therefore change nothing about the BabylonDocs pair sitting in the store right now. It is a forward-only fix, and calling it a fix for #448 would be wrong.

    B. No evidence that symptom rows collide less

    Within the same token-count band: 16-30 tokens, both-symptom pairs mean 11.0% overlap against 6.9% for neither-symptom — i.e. more, not less, on a sample of 16 pairs against 7,980. The 31+ band is a wash (9.6% vs 9.4%). n=16 measures nothing. The hand-authored experiment in the issue body stands alone, and it should not be treated as evidence.

    C. The structural split — this is the finding

    Classify a colliding pair by what is unique to each side:

    • identical — nothing unique either way. A copy.
    • addition — one row's tokens contained in the other. The rows name different things; the shorter claim is not restated by the longer one, it only looks that way because build:example-images tokenizes to include build.
    • substitution — each row says something the other does not. Same statement, changed world.

    All three named cases, with no threshold change:

    pair score class rule correct?
    gufo cutover written twice 1.000 identical drop older yes
    npm run build vs build:example-images 0.824 addition keep both, flagged yes
    runbook every friday vs every monday 0.833 substitution (friday ↔ monday) drop older yes

    Wider scan with the guards off, 96 pairs: 29 identical, 1 addition, 66 substitution. The substitution class is the pr-watch cursor rows — correctly named, and the dropped-chunk guard already exempts them. The identical class in that unguarded scan is contaminated by rows like late 0 vs late 1, whose single digits are dropped chunks, so the tokens match while the facts do not; the shipped guard is what stops those, and it must stay.

    D. What the rule would change on the real store

    Replayed at window 5 across every scope: today 1 row is dropped; under the rule, 0 are dropped and 1 pair is flagged and both kept. One extra slot out of 513 used.

    would now surface both:
      BabylonDocs build:example-images command: run "npm run build:example-images" …
      BabylonDocs build command: run "npm run build" …
    

    Rendered in the CONFLICT style, with the unique tokens named so the reader can see why they are not copies:

    AMBIGUOUS (BabylonDocs). Two rows share shape and differ in content, Jaccard 0.824:
      1. BabylonDocs build command: run "npm run build" from the repo root (package.json). (2026-10-18T22:04:01.959Z)
      2. BabylonDocs build:example-images command: run "npm run build:example-images" from the repo root (package.json). (2026-10-18T22:04:01.989Z)
    Only in 1: (nothing). Only in 2: example-images, example, images.
    Action: neither supersedes the other — the difference is an identifier, not a value.
    Pick by what you are actually doing; if both apply, use both.
    

    Revised recommendation

    Lead with the structural rule, not the symptom clause or a new threshold. It needs no capture-convention change, no threshold change, and no model instruction beyond one Action line; on this store it changes exactly one decision, and that decision is the wrong one today.

    Where it can be wrong, and why that is the cheap side. If a row is superseded by a longer row that contains it — "the runbook rotates the key on Friday" followed by "…on Friday, and we moved the window to Tuesday" — the pair classifies as addition and both are kept, where today the older is dropped. That costs one extra row in a window. The failure it prevents is losing a command outright, which is #448. The asymmetry is the whole argument for trying it.

    Honest limits. addition has exactly one live example plus the reasoning. The class is defined structurally, so it is reproducible, but one observation is not a distribution — a real change needs fixtures for the shapes above before it ships, and the identical case must keep relying on the dropped-chunk guard rather than on token equality.

    Symptom clauses stay worth doing as a capture-quality improvement — the recall argument in ADR 0007 is independent of all this — but this POC does not support them as the discriminator, and #449 should not sell them as one.

  2. abogartz commented on Nov 19, 2026

    @abogartz
    OwnerAuthor

    POC round 2 — the store-cruft objection, and what it changes

    A fair objection was raised against the previous comment: this repository is the author's own store,
    auto-captured by one agent over months, and the symptom rule is new with a handful of users. New stores
    will be conformant from their first row. Judging a forward-looking convention by a backlog that predates
    it is not evidence.

    That objection is correct and part of the previous comment is retracted. It does not survive contact with
    the one measurement the store can make, and it surfaces a failure mode neither idea predicted.

    Retracted: "no evidence that symptom rows collide less"

    The band analysis compared 16 both-symptom pairs against 7,980 pairs from a pre-rule backlog. The
    conformant rows are 48 of 373 learning rows, all written under the rule by the same agent. That sample
    says nothing about symptom-bearing rows in general, and the conclusion should not have been drawn from it.
    Coverage is a property of the rule's age, not of the convention's value.

    What the store can answer: do authors reuse a symptom for the same question?

    This cannot be synthesized — hand-written clauses are authorship, already conceded once. But 48 rows were
    captured under the rule, and their clauses can be compared with each other. Splitting each row into clause
    and fact and scoring the parts separately, across the 35 same-scope pairs among them:

    mean Jaccard identical
    the When …: clause alone 0.062 0 of 35
    the fact that follows it 0.070 —

    A symptom clause is a diversifier, not a unifier. Authors state a new symptom per incident, and the
    clause is if anything less repetitive than the fact it introduces. Nothing in this is cruft — those rows
    are the convention working exactly as written. The consequence is what matters.

    The consequence, measured

    Symptom-first capture pushes same-scope rows apart. That is a collision reducer, which reads like a win.
    The pass exists to catch the case where rows should still collide:

    pair today with distinct symptoms desired
    npm run build vs build:example-images 0.824 — suppressed, wrong 0.455 — both kept, and the dropped-chunk guard blocks the comparison outright keep both
    runbook every friday vs every monday 0.833 — suppressed, right 0.750 — below threshold, so the stale friday row survives drop older

    So symptom-first capture resolves #448 by re-admitting the §17 case the tool test pins. Not by tuning — by
    making the pair invisible to the pass. The intuition that symptoms would help the model pick between two
    commands is right; the side effect is that they also hide a superseded fact.

    Does the structural rule survive this? Yes, and it becomes more necessary

    The identical / addition / substitution split is token-set algebra. It does not care how many rows in a
    store are cruft, or whose store it is. In a symptom-first store the pass fires rarely — the guard already
    exempts timestamped rows and symptoms now push prose apart — so each firing carries more weight, and a
    firing that silently deletes a row is worse, not better. The two ideas compose, with the structural rule
    doing the work that remains.

    A third idea this produced, and why it is not ready

    If the clause is a distinctness signal and the fact is the collision signal, score them separately:

    pair whole content fact only class(fact) desired
    build pair, distinct symptoms 0.455 0.700 addition keep both
    build pair, shared symptom 0.800 0.700 addition keep both
    runbook pair, distinct symptoms 0.750 0.818 substitution drop older
    runbook pair, shared symptom 0.857 0.818 substitution drop older

    The fact-only score is stable against symptom wording — 0.700 and 0.818 regardless of whether the
    clause is shared or invented — and it classifies both pairs correctly. That is the property the whole
    discussion has been looking for: a score that does not move when the prose around the fact changes.

    It is not shippable. The build pair reaches the right answer only because 0.700 falls below the threshold,
    a tenth of a point on text authored here, not because it was classified as addition. The margin is the
    shared scaffolding that the clause itself supplies. Treat this as a direction to test on a real corpus.

    The implementation constraint, and a latent trap. The symptom is not a field. It is prose, matched by
    one boolean in src/gate/gate.ts:461. That regex is greedy — [^\n]{0,160}: runs to the last colon on
    the line — which is harmless while it only answers yes-or-no, and wrong the moment anything tries to split
    the row. An early version of this POC did exactly that and silently swallowed the command out of the build
    row, producing a confident 0.400 that was pure artifact. Any "score the fact, use the clause for
    distinctness" design needs the symptom stored as a separate field, not parsed back out.

    Store-cruft cuts both ways, including against an earlier claim of mine

    This store is one author, auto-captured, stylistically homogeneous. That inflates similarity, which is
    probably why the false positive exists here at all. A multi-user store would likely show more paraphrase
    pairs in the 0.85–0.95 band — the band where this store has zero rows, and the reason "raise it to 0.9,
    nothing is in between" looked safe. That argument was as store-dependent as the coverage one, and it should
    not be reused.

    Where this leaves #449

    1. Structural classification — unchanged by any of the above, fixes Window dedup at 0.8 hides one of two different build commands (live false positive) #448 without touching the threshold
      or the capture convention, and is the only proposal that keeps the §17 behavior. Still the lead.
    2. Symptom clauses — worth keeping as capture quality, on the recall argument in ADR 0007, which is
      independent of this. Not as a dedup discriminator: they reduce collisions in general, including the one
      collision the pass is for.
    3. Split scoring — the most promising measurement here, blocked on making the symptom a real field and
      on a corpus that is not one author's store or my own prose.
    4. Needed before any of it ships: a second store. Every number in this issue comes from one author's
      auto-captured data. That is the actual gap, larger than any of the design questions.
  3. abogartz commented on Nov 19, 2026

    @abogartz
    OwnerAuthor

    Idea 2 shipped as #450, and idea 1 did not — which is the shape the POC comments predicted.

    Built. The structural split from the round-1 comment is the rule now. classifyPair reads the leftover token sets; an addition clash keeps both rows and reports the pair, and #450 adds the AMBIGUOUS render in the CONFLICT style with the verdict left open. Replayed on the same scan set: one suppression reversed, one extra slot of 514.

    Not built, on purpose. Extending the symptom convention to pattern would change nothing about the row already in the store, and the round-2 measurement says a symptom clause is a diversifier rather than a unifier — 35 same-scope pairs among the conformant rows, zero identical clauses, mean clause overlap 0.062 against 0.070 for the facts themselves. Distinct symptoms pushed the changed-fact pair from 0.833 to 0.750, below the threshold, so the stale row survives. Symptoms remain worth having for the recall argument in ADR 0007; they are not a dedup discriminator.

    Still open, and this is what should keep this issue alive.

    1. Split scoring. Scoring the fact alone was stable against symptom wording — 0.700 and 0.818 whether the clause is shared or invented — and classified both known pairs correctly. Blocked on the symptom being a real field rather than prose matched by one greedy boolean in src/gate/gate.ts. The most promising thing measured here.
    2. A second store. Every number in this issue, and in feat(dedup): keep an additive clash instead of collapsing it #450, comes from one author's auto-captured data. The addition class rests on one live example plus the reasoning. That is the actual gap, larger than any design question on the list.
    3. How much of the pass should exist. The dropped-chunk guard, not the threshold, decides what the pass ever sees, and the rows the ADR names as its motivation are exempt from it. feat(dedup): keep an additive clash instead of collapsing it #450 makes the surviving behavior correct; it does not make the pass fire where the record says it was meant to.

    Keeping this open against those three.

  4. added
    enhancement
    retrieval
    severity:low
    proposal
    on Nov 20, 2026
  5. WhollyMindless commented on Nov 21, 2026

    @WhollyMindless
    Contributor

    We tried the second-store experiment on OpenCode 2.3.2 with OCSI 0.33.7 (c48aea6). We deliberately chose related tasks in one benchmark-reporting project, including fixes to how its JSON, Markdown and HTML reports handle the same data. We let the agent choose what to remember and supplied no sample memories or suggested wording.

    In the archived snapshot, one recall query matched all nine memories in scope. Zero of the 36 pairs reached the 0.8 dedup threshold. The closest pair scored 0.252 on content-and-keyword Jaccard. Six memories carried the auto-capture tag. Looking only at the 15 pairs among those six, the maximum was 0.245. In the shipped comparison order, the polarity guard screened out eight pairs and differing short chunks screened out the other 28. We froze the last completed-session snapshot when a later memory_forget removed two rows, and verified the replay from the archive.

    For this workload, it was easy to get memories relevant to the same query and hard to get two worded alike enough to exercise classifyPair. That leaves the live addition example from #448 as the positive case. A fixture can reproduce it reliably. To learn how often it happens in use, the next sample I’d look for is a longer-running project that revisits the same commands or procedures as they change.

  6. WhollyMindless commented on Nov 21, 2026

    @WhollyMindless
    Contributor

    Do you remember what you were doing in BabylonDocs when the npm run build and npm run build:example-images memories were created? The replay shows their timestamps only 30 ms apart and both use the same “run … from the repo root” wording. Did one operation record several scripts from package.json together, or did those facts enter the store some other way?

    Even a rough recollection of the task and how the rows were written would help us try the same workflow on another repo and see whether a close pair emerges on its own.

  7. added
    tier:full
    on Nov 23, 2026
  8. ocsi-architect commented on Nov 27, 2026

    @ocsi-architect

    Scoring-input fix, measured at 966bb7e (from a closed proposal)

    Seed row: The default timeout is 30 seconds. The rewording pair is the seed against Thirty seconds is the default timeout.; the correction pair is the seed against Change the default timeout to 90 seconds.

    Normalization experiment — offline measurement with the tokenizer copied verbatim, not integrated code:

    variant rewording correction separable under existing floors
    as-is 0.3333 0.4444 no — inverted: the correction outscores the restatement
    dot de-glue only 0.7143 0.4444 only by moving a deliberately pinned floor
    numeral word-forms only 0.5000 0.4444 a 0.0556-wide band — fragile
    both 1.0000 0.4444 yes — the existing 0.90 floor already sits in the 0.5556-wide gap

    Two caveats travel with this table. First, the numbers are an offline measurement with a copied tokenizer, not integrated code. Second, a score of 1.0 lands above the 0.90 floor, which under today's semantics means review-gated rather than rejected, so "reject the duplicate" still needs its exact outcome decided.

    Calibration bank unmoved

    Nine calibration pairs measured unchanged across all four variants: 0.2500 / 0.2632 / 0.2800 / 0.3000 / 0.9000 / 0.8667 / 0.8462 / 0.4375 / 0.0909. None of the nine carries a trailing dot, so the de-glue variant cannot touch them. The only word-form numeral in the bank (ninety, in a below-floor pair) swaps one unique token for another, moving neither intersection nor union. No pin moves; the fix is additive with respect to the existing calibration.

    Why this is an input fix, not another threshold

    The variants do not propose a new constant. They remove representation artifacts — glued sentence dots, word-form/digit disjointness — so the existing floors mean what they claim: OVERLAP_FLOOR 0.90 separates restatements from distinct facts because restatements score near 1.0 on content, not because the floor was retuned to dodge a surface effect. That is the same direction as this ticket's existing proposal: attack the input, not the constant.

    The limit, stated honestly

    This makes a restatement recognizable as a restatement. It says nothing about telling an added fact from a changed one — the correction pair sits at 0.4444 in every variant. Discriminating replacement from addition remains this ticket's actual problem.

    The numbers came from a row of closed proposal #471; the full four-row record lives in this ticket's closure comment there.

  9. abogartz commented on Dec 1, 2026

    @abogartz
    OwnerAuthor

    Closed as done. Its buildable half shipped as #450 (src/recall/dedupe.ts:140, src/recall/ambiguous.ts:202); the symptom-clause discriminator was measured against on record. Split scoring waits on a second corpus.

    Reopen it whenever the premise comes back; nothing here is deleted and the history stays put.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementproposalretrievalseverity:lowtier:full

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions