Skip to content

Default ON the recall quality flags (dedupe 0.8, query gate) - #426

Merged
abogartz merged 9 commits into
mainfrom
fix/default-on-flags
Nov 18, 2026
Merged

abogartz merged 9 commits into
mainfrom
fix/default-on-flags

Conversation

@abogartz

Copy link
Copy Markdown
Owner

Closes #425.

Principle

Default ON. An opt-in quality flag is a fix that stays dark for everyone who does not read the env table.

Flips

Flag Old default New default Off-switch kept
OPENCODE_MEMORY_DEDUP off 0.8 =0 → plain top-limit slice, byte-identical
OPENCODE_MEMORY_QUERY_GATE off on off/no/n/false/any zero

Why these defaults are earned

  • Dedup at 0.8, live replay (Enhancement: recall useful memories across different wording #409 §17): touches 17% of calls, never changes top-1, never drops a term's last carrier; window composition 0.006 → 0.791.
  • Query gate: the injection scorer has applied the same two-concept rule by default for months (LONG_QUERY_TOKENS); the tool path lagging behind was the inconsistency. Case bank: 404 real queries, two independent readers.

Semantics detail

The gate's off rule is a deny-list again on purpose, but inverted and zero-aware: 0, 00, 0.0 all mean off (a shell user writing =no means off); garbage like tureh means on — a typo must not silently disable a default-ON path. Misconfigured dedup values (<0.5, unparsable) still turn the pass off rather than running something nobody asked for.

Tests

  • Both flag test files re-pinned to the new defaults, off-switches still covered.
  • Merge gate green: 1,438 unit + 34 e2e, 0 fail.

A quality fix behind an opt-in flag is not a fix: both #409 recall wins
shipped dark.

- OPENCODE_MEMORY_DEDUP unset now means 0.8 (live replay: touches 17% of
  calls, never changes top-1, never drops a term's last carrier). =0
  keeps the plain slice byte-identical; an explicit misconfiguration
  still turns the pass off.
- OPENCODE_MEMORY_QUERY_GATE unset now means ON: the two-concept
  admission the injection scorer already applies, so the tool and the
  injected block agree. Off only for an explicit negative (off/no/n/
  false or any zero); a typo cannot silently disable it.
- README rows rewritten.

@WhollyMindless WhollyMindless left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[P2] Default-on admission drops the identifier/prose match that #417 restored.

Reproduced through the real memory_recall handler on d1b97d3, with an isolated store containing one settled row in scope pricing, content DISCOUNT_TIERS controls the pricing schedule. Query discount tiers returns that row with OPENCODE_MEMORY_QUERY_GATE=off, but returns No matching memories with the flag unset. Dedup cannot explain this single-row case.

rowConcepts keeps discount_tiers as one word, while queryConcepts produces discount and tiers, so sharedConcepts is zero. Enabling this gate by default therefore regresses an ordinary identifier-to-prose lookup; the injection tokenizer already understands these segments. Please consider aligning admission with the identifier-aware concept handling before making it the default, with this composed-handler case pinned. The existing focused flag/gate tests pass.

Also, this head does not yet contain #422; the known #421 scope-token fix should precede enabling dedup by default. That is an existing finding/dependency, not a new report.

Disclosure: the base includes my earlier contributions. This is a reproduced finding on the maintainer-authored delta, not an independent approval. Implementation and disposition remain yours.

- dedupeWindow tokenizes lazily with a per-index cache: eager
  ranked.map(contentTokens) cost 1.7ms/12.5ms/96.4ms at
  200/2k/10k candidates on EVERY query recall once the default turned
  on; lazy cost is window-sized, semantics unchanged.
- casebank off-arms: 'delete process.env.OPENCODE_MEMORY_DEDUP' now
  means 0.8 ON — the replay's off arm would have silently measured
  off===on and voided §17. Set =0 explicitly.
- new test/dedupe-tool.test.ts: dedup default ON pinned through the
  real memory_recall handler (newer copy survives by default; =0
  returns both). Unit pins alone could not catch a hardcoded 0 in
  src/tools/recall.ts.
- README: unparsable and >1 also turn the pass off, not only <0.5.
- recall-gate.test.ts header no longer claims unset=unchanged.

@abogartz abogartz left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review verdict: APPROVE (posted as comment — GitHub refuses approve/request-changes on self-authored PRs).

Inverted semantics verified value-by-value: unset/empty/whitespace → on/0.8; off/no/n/false and every zero form → off; garbage → on for the gate, off for a threshold misconfiguration; no old explicit value changes meaning — only unset. Sole consumer is src/tools/recall.ts; injection and pull untouched; no suite harness pins the flags off.

All four review findings addressed in the follow-up commit: casebank off-arms fixed (delete now means ON — the replay would have silently measured off===on and voided §17); dedupeWindow tokenizes lazily with a per-index cache (eager cost measured 1.7/12.5/96.4 ms at 200/2k/10k candidates on every query recall); new test/dedupe-tool.test.ts pins the default through the real handler (newer copy survives by default, =0 returns both); README states unparsable/>1 also mean off. Merged main (incl. #422); merge gate green: 1,462 unit + 34 e2e, 0 fail.

@WhollyMindless WhollyMindless left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The follow-up fixes and #422 integration are present, but my identifier-admission finding remains on 2c0a3e4. Retested the real handler: discount tiers finds DISCOUNT_TIERS controls the pricing schedule with the gate off and returns No matching memories with the flag unset. The focused suites pass apart from this added regression probe; admission code is unchanged. This is separate from the four findings in the maintainer self-review. Original report: #426 (review) . Please keep that finding open or explicitly record its disposition before treating all review findings as addressed. Prior authorship disclosure still applies; no approval implied.

WhollyMindless #426 review: with the gate default-on, `discount tiers`
returned No matching memories for the row `DISCOUNT_TIERS controls the
pricing schedule` — rowConcepts kept the identifier one word while the
prose query offered two concepts. Default-on admission must not regress
the identifier-to-prose lookup the #417 scorer tokenizer restored.

rowConcepts now emits underscore SEGMENTS alongside the whole word:
`discount_tiers` contributes discount and tiers too. Word-level, not
substring: build2837 (no separator) still shares nothing with 283; the
whole word is kept, so an identifier query still hits. Pinned with the
reviewer's composed-handler probe (red before the fix) plus a
rowConcepts unit.
@abogartz

Copy link
Copy Markdown
Owner Author

@WhollyMindless finding accepted and fixed — rowConcepts now emits underscore SEGMENTS alongside the whole identifier word, so discount tiers is admitted against DISCOUNT_TIERS controls the pricing schedule, aligned with the #417 scorer tokenizer. Word-level, not substring: build2837 still shares nothing with 283, and the whole word is kept so an identifier query still hits. Your composed-handler probe is pinned as a test (red before the fix, green after), plus a rowConcepts unit. Merge gate green (1,464 unit + 34 e2e).

@WhollyMindless WhollyMindless left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The original DISCOUNT_TIERS / discount tiers reproduction now passes on bf12aea, along with the focused suites. Thank you for adding the handler regression.

[P2] A camelCase identifier still loses its previously working prose lookup under the new default. In the same isolated real-handler probe, use scope pricing, content discountTiers controls the pricing schedule, and query discount: gate off returns the row, flag unset returns No matching memories. The new rowConcepts expansion handles underscores only; recallHaystack lowercases the content before tokenization, so the camel boundary is already lost. The #417 scorer tokenizer handles camel segments as well as separators. Please consider constructing admission vocabulary from the original-case fields with equivalent identifier segmentation, preserving the whole-token protections against build2837/283. This is a remaining identifier case, not a request to restore arbitrary substring admission.

Original underscore probe: passes. Existing focused gate/dedup suites: pass. Added camelCase handler probe: fails at default admission, passes with the gate off. Prior authorship disclosure applies; implementation and disposition remain yours.

WhollyMindless round-2 probe: `discount` found `discountTiers controls
the pricing schedule` with the gate off and abstained with it on. The
first fix handled underscore separators only, and recallHaystack
lower-cases before tokenizing, so the camel boundary was gone before
segmentation could see it.

rowConcepts now runs the #417 scorer tokenizer (words()) over an
original-case haystack — the same whole-form-plus-segments granularity
that ranks the row — via a new recallHaystackRaw. Admission can no
longer be narrower than the scorer that put the row in the window.
Whole forms kept: build2837 still shares nothing with 283. Both
round-2 probes pinned (red before, green after).
@abogartz

Copy link
Copy Markdown
Owner Author

@WhollyMindless round-2 finding accepted and fixed — rowConcepts now runs the #417 scorer tokenizer (words()) over an original-case haystack (new recallHaystackRaw), so admission carries the same whole-form-plus-camel/separator-segment granularity that ranks the row. Your probe (discount vs discountTiers controls the pricing schedule) is pinned as a composed-handler test, red before the fix, green after, plus a rowConcepts unit covering camel, underscore and the build2837/283 non-match. The class is now closed structurally: admission cannot be narrower than the scorer, because it is the scorer's tokenizer. Merge gate green: 1,466 unit + 34 e2e.

@WhollyMindless WhollyMindless left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The original camelCase probe now passes on ea83688, as does the underscore probe. The focused gate/dedup suites plus those independent probes pass (40 tests).

[P2] The replacement tokenizer regresses exact underscore identifiers inside qualified names. Through the real memory_recall handler, seed one settled row in scope schema with content table.db_id stores the foreign key, then query db_id: gate off returns the row; flag unset returns No matching memories. Holding the rest of this checkout constant and substituting only the previous bf12aea gate implementation makes both assertions pass.

words("table.db_id") emits table.db_id and table; it splits the suffix into db and id, both below the length cutoff. The query gate still treats db_id as one concept. The former row tokenizer retained it after splitting at the dot. Please consider retaining those exact qualified-name components alongside the new camel/separator vocabulary, with this handler case pinned. This asks to preserve an exact identifier lookup, not arbitrary substring admission.

Disclosure: the base includes earlier contributions by me; this is verification of the maintainer-authored delta, not independent approval of my own code. Implementation and disposition remain yours.

…w round 3)

WhollyMindless round-3 probe: `db_id` found `table.db_id stores the
foreign key` with the gate off and abstained with it on. words()
segments at EVERY separator, so the dotted identifier yields
table/db/id — the underscore-joined suffix never reaches admission
whole, and `db_` + `id` is below the length floor as `db_id` is one
query concept. My round-2 claim that admission 'is the scorer's
tokenizer' was wrong: the scorer ranks via segment overlap, which
admission-by-identity does not replicate for exact identifier queries.

rowConcepts is now the UNION of the scorer tokenizer (original case:
whole + camel/separator segments) and the pre-round-2 WORD split
(underscore inside, everything else a separator). Both keep their
length floor: build2837 still shares nothing with 283. Round-3 probe
pinned at unit and handler level, red before, green after.
@abogartz

Copy link
Copy Markdown
Owner Author

@WhollyMindless round-3 finding accepted and fixed. rowConcepts is now the UNION of the scorer tokenizer (original case: whole forms + camel/separator segments) and the pre-round-2 WORD split (underscore inside, everything else a separator), so table.db_id contributes table.db_id, table, db, id AND db_id. Both vocabularies keep their length floor — build2837 still shares nothing with 283, no substring admission anywhere. Your probe is pinned at unit and handler level (red before the fix, green after). My round-2 claim that admission 'is the scorer's tokenizer' was wrong, and your probe is exactly why: the scorer ranks via segment overlap, which admission-by-token-identity does not replicate for an exact identifier query. Merge gate green: 1,458 unit + 34 e2e.

@WhollyMindless WhollyMindless left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verified on b024e77 with the original isolated real-handler probes: db_id now retrieves the row containing table.db_id with the gate unset, and the prior DISCOUNT_TIERS / discount tiers and discountTiers / discount cases still pass. I inspected the vocabulary union and reran the focused gate/dedup suites: 43 tests, 95 assertions, no failures, including the build2837/283 non-match protection.

This addresses all three identifier-admission reproductions I reported. The scope of this verification is those cases and the focused suites; it does not independently validate the private case-bank efficacy claims. As previously disclosed, the base includes earlier contributions by me; this is not independent approval of my own code.

@abogartz
abogartz merged commit 8ae839e into main Nov 18, 2026
7 of 8 checks passed
abogartz-opencode-self-improvement Bot pushed a commit that referenced this pull request Nov 18, 2026
# [0.30.0](v0.29.0...v0.30.0) (2026-11-18)

### Bug Fixes

* **gate:** admission carries identifier SEGMENTS ([#425](#425) review) ([bf12aea](bf12aea)), closes [#426](#426) [#417](#417)
* **gate:** admission keeps exact suffixes of dotted names ([#425](#425) review round 3) ([b024e77](b024e77))
* **gate:** admission segments camelCase too ([#425](#425) review round 2) ([1fcae59](1fcae59)), closes [#417](#417)
* **recall:** review findings on the default flip ([#425](#425)) ([0fc51e4](0fc51e4))

### Features

* **recall:** default ON the dedupe and query-gate quality flags ([#425](#425)) ([d1b97d3](d1b97d3))
@abogartz-opencode-self-improvement

Copy link
Copy Markdown

🎉 This PR is included in version 0.30.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Default ON the recall quality flags (dedupe, query gate)

2 participants