Repository navigation
feat(retrieval): write-time keywords + recency tie-break + per-char accuracy (#40) - #97
Conversation
|
Ran a fresh-eyes review of this branch against a scratch merge of
Two LOW notes, neither blocking:
One merge-order note: #96's head is a strict ancestor of this branch — worth landing #96 first so #97 stays a clean stack (see comment there). |
…ccuracy (#40) The strict-paraphrase wall is a vocabulary problem, not a ranking problem: the user's words are not the memory's words. Ranking alone cannot cross it, so this moves the effort to write time and keeps the read path deterministic. - kw (retrieval keywords): a row carries 3-5 aliases (other names, other verb forms, the literal command), stored as one logfmt field and normalised at the write choke point. Indexed into the same haystack as scope/type/content by scoreMemories and memory_recall; NEVER rendered — formatMemory is untouched, so injection bytes, the content cap and the epoch fingerprint stay what the prose says. memory_remember/memory_update take kw (wire contract move, recorded in boundaries.test); malformed/credential-shaped kw is rejected like tags; capture asks the mining model for them and cleans them; they ride export/import and stay out of GATE-3 dedup (restating prose with new aliases still collapses). - recency tie-break: score -> open threads -> newest row. - bench: prod+kw arm, accuracy per 1k injected characters (real renderer, real k=3 window, abstention = a miss costing zero characters), and a permutation control (every row gets another memory's aliases) so the +16 points is proven to come from meaning rather than token volume. Store 200: strict R@1 0% -> 26%, near 28% -> 67%, all 50% -> 66%; top-1 noise unchanged at 6%; abstentions 47 -> 30. Shipped-arm numbers are byte-identical to main, which is what a pure tie-break must do.
…#40) Two LOW notes from the fresh-eyes review of #97, both pinned red-first: - kw items carrying the storage comma used to round-trip fragmented ("build, test" -> ["build", " test"]). normalizeKeywords now splits on the delimiter, so aliases never store it; the read path trims, which also heals rows already on disk written before the fix. - the recency tie-break compared ISO stamps as strings, so for one and the same instant a legacy second-precision row outranked a millisecond row. Date.parse first with a string fallback (the ledger hands "" for never-used rows); the three other raw ts comparisons in inject.ts go through the same comparator, so "recency is numeric" holds in one place.
3f03fe9 to
c022bfc
Compare
5a525b9 to
3a91bfd
Compare
Same class as the #97 review note, one layer up: the pool sort, the cluster-order sort and the survivor tie-break in survivorFor all compared ISO stamps as strings, so a legacy second-precision row could be called newer than a millisecond row from the same second plus change. cmpTs is now exported from inject.ts and is the single comparator for recency.
Same class as the #97 review note, one layer up: the pool sort, the cluster-order sort and the survivor tie-break in survivorFor all compared ISO stamps as strings, so a legacy second-precision row could be called newer than a millisecond row from the same second plus change. cmpTs is now exported from inject.ts and is the single comparator for recency.
|
Both LOW notes fixed in
Thanks for running the combined-tree check against #89 — the kw-scalar observation made the comma-as-delimiter fix safe to do on the write side. |
# [0.10.0](v0.9.2...v0.10.0) (2026-10-25) ### Bug Fixes * **retrieval:** delimiters and stamps compare honestly in the ranking ([#40](#40)) ([3a91bfd](3a91bfd)), closes [#97](#97) ### Features * **retrieval:** write-time keywords + recency tie-break + per-char accuracy ([#40](#40)) ([fdbabf2](fdbabf2))
|
🎉 This PR is included in version 0.10.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
# [0.13.0](v0.12.0...v0.13.0) (2026-10-25) ### Bug Fixes * **#45:** cluster ordering compares instants, not glyphs ([8610b45](8610b45)), closes [#45](#45) [#97](#97) ### Features * **#45:** consolidation that has to earn its merge — deterministic, read-proven, proposal-only ([2751d3e](2751d3e)), closes [#45](#45) [#40](#40) [#45](#45)
Same class as the abogartz#97 review note, one layer up: the pool sort, the cluster-order sort and the survivor tie-break in survivorFor all compared ISO stamps as strings, so a legacy second-precision row could be called newer than a millisecond row from the same second plus change. cmpTs is now exported from inject.ts and is the single comparator for recency.
What
Implements #40 (epic #84, item 2): remaining ranking scope — recency tie-break, write-time
kw=keywords (the vocabulary-wall attack), and accuracy-per-1k-injected-chars reporting.Headline (published bench, store 200, k=3)
kwR@1kwR@3Top-1 wrong-memory noise: 6% → 6% (unchanged). Abstentions: 47 → 30. The one changed variable is the index, so this is the bridge and nothing else.
How
1. Write-time keywords (
kw) — the vocabulary bridge.Memory.kw/AppendMemoryInput/WriteCandidate, stored as akw=logfmt field, normalised at the write choke point (normalizeKeywords: trim, lowercase, de-dupe, ≤8 × ≤48 chars, total — junk shortens the list, it never fails a write the prose deserved).scope + type + content + kw) inscoreMemoriesand intomemory_recall's scorer. Never rendered:formatMemoryis untouched, so injection bytes, the content cap and the epoch fingerprint are exactly what the prose says. Pinned by test: a keyword never appears in an injected block and never changes a row's rendered length.memory_remember/memory_updategained akwargument (wire contract moves — recorded, not silent:test/boundaries.test.tsdocuments the change and pins the new capture); malformedkwis rejected at the boundary liketags, credential-shapedkwis rejected by gate and store.kw.2. Recency tie-break. The cascade is now
score → open threads → newest row. A real score difference is never overridden by recency (pinned); an open thread still outranks a newer settled row, because that is what pinning means; epoch-freeze-safe since a row'stsnever changes. Publishedprodnumbers are byte-identical tomain, which is exactly what a pure tie-break should do.3. Accuracy per 1k injected characters. New bench table computed with the real
formatMemoryrenderer over the real k=3 window, abstention counted as a miss that costs zero characters — with a "how to read it" line, because a ratio computed over abstentions flatters the abstainer.The control (why the +16 points is not authorship)
The
kwarm is the only place in this benchmark where a human wrote extra text that helps the gold row win, so it carries a permutation control: every row is given another memory's keyword set (fixed rotation, deterministic).Pinned in
test/negative-eval.test.ts: if plausible-but-wrong aliases ever caught up, the bridge would be measuring extra tokens and the test goes red.test/recall-dataset.test.tsalso pins the authoring shape (every gold has 3-5 keywords, ≤48 chars, lowercase, variants inherit their base's set so the bridge competes with equals) and states, in the file, the rule it cannot enforce mechanically — keywords are written from each memory's own content, never from the query list.Evidence
bun test ./test/: 417 pass / 5 skip / 0 fail (branch base was 395/5/0),tsc --noEmitclean,biome linterror-free.bench/recall-results.mdmatches.test/keywords.test.ts(12: store round-trip, normalisation caps, control-char and credential floors, gate rejection, export/import carry, dedup neutrality, the bridge isolated on one row, never-rendered, recall-by-keyword, three recency-cascade cases), plus capture parser/prompt tests, wire-capture updates and the dataset gates.Also
README updated: its "nothing keyword-side crosses it" claim was a promise the shipped code now keeps differently — rewritten with the numbers and what is still unsolved (26% is a third of the wall; embeddings remain the only general crossing).
Closes #40. Part of #84.