Skip to content

Enhancement: recall useful memories across different wording #409

Closed

Description

@WhollyMindless

User need

A useful memory should be findable when a later session asks for it in different words. For example, "create some test users" should be able to find the relevant memory about "seeding fixture accounts," without requiring the user to remember the wording of the saved entry.

Proposed experience

Improve recall across aliases, synonyms, and paraphrases while retaining the ability to abstain when there is no useful match. Relevant memories should remain discoverable within the correct repository and context budget.

The desired outcome is more useful retrieval without a corresponding increase in irrelevant or misleading memories. Evaluation should include both missed relevant memories and wrong matches, along with latency and resource cost. A higher hit count alone would not demonstrate success.

Existing context

Recorded as an enhancement for consideration. Priority, design, decomposition, relationship to #405, and implementation ownership remain with the maintainer.

Activity

  1. added
    proposal
    retrieval
    severity:low
    on Nov 14, 2026
  2. abogartz commented on Nov 14, 2026

    @abogartz
    Owner

    Proposal: tag-space recall via a local tagger with a growable taxonomy

    Discussion summary from the maintainer thread. No commitment implied; the ticket stays spec:incomplete-adjacent until AC0 lands.

    Problem. This is the classic vocabulary mismatch problem from information retrieval: the query and the memory use different words for the same concept. #405 shows it is a matching failure, not a ranking failure — 7 of 21 curated gold pairs retrieve nothing even when the gold row is the only thing in the store. No ranking or routing change fixes a matching failure; the link between "test users" and "seeding fixture accounts" has to live somewhere.

    Proposal. Put the link in a shared tag space maintained by a small local classifier:

    1. Write side. Every memory is tagged at capture time against a tag taxonomy. Tags are stored on the row as plain text and are auditable.
    2. Read side. The query is tagged once with the same taxonomy. Match score is IDF-weighted soft tag agreement between the query's tag distribution and each row's, combined with the existing lexical lane.
    3. Abstention. Rows scoring below a fitted threshold are not injected. The threshold is calibrated on labeled data, never hand-picked.

    The classifier acts as a learned thesaurus: the query's words never meet the memory's words; both meet only in the label space. IDF weighting is required — without it, common tags dominate and everything matches everything.

    Why mostly-correct is enough. Pair recall is roughly p², because both sides must agree. A tagger with top-3 tag recall of 0.9 per side yields about 81% pair recall; soft scoring (using the full probability distribution, not argmax labels) lifts above that floor. The bar is a small, mostly accurate model, not a frontier one.

    Model class. "Jev-like" means the System One shape: typed questions with option lists supplied per request. Two consequences:

    • The taxonomy is not in the weights, so it is runtime data (see the growable table below).
    • Cloud inference is ruled out for this repo (privacy, dependency). The local field is real: Kev (Apache-2.0, Qwen-based, fine-tunable on our own labeled examples) and encoder-class models — GLiFormer (~400M), ModernBERT/Laya (421M) — which run on CPU via ONNX on Linux and macOS. MLX is excluded; no GPU is assumed; onnxruntime-node would run in-process with no Python daemon.
    • Honesty about the gap: on JevBench's official run, the encoder-vs-Jev gap is a class gap concentrated in the hard tier (long-policy, multi-hop: ~38% vs ~73% accuracy). On the standard tier for short texts encoders reach ~70–76%, and the easy tier is saturated. Relevance tagging is standard-tier work.
    • Two caveats that transfer: shipped calibration on local models is poor (hard-tier ECE 0.22 vs Jev 0.09), so refitting is mandatory; and encoders show shared-prompt contamination between questions, which this design avoids by construction (a read is one query-tagging call, not per-candidate scoring).

    Growable tag table. The taxonomy lives in the store as a table: preferred term, aliases, description (the description is prompt text), status, counts, provenance. New concepts (e.g. "aws") flow through a promotion pipeline:

    • Naming comes from the capture model's existing kw aliases; the tagger itself cannot invent tag names because it is non-generative.
    • Bookkeeping is code-only: normalize → alias lookup → embedding distance to active tags → if close, propose an alias (the same merge-review pattern used for memory consolidation); if far and seen on at least N distinct rows, promote to active.
    • Archive, never delete: tags whose usage decays stop being offered as options but remain valid on stored rows.
    • Versioning: adding an option changes the classifier's score distribution, so the taxonomy version is pinned together with the calibration temperature and thresholds as one unit, and taxonomy changes replay the case bank as a regression gate.
    • Scaling: a single pass over all options works to roughly 100 active tags; past that, embedding-preselect the top-K options (code-only, deterministic).

    Draft acceptance criteria.

    • AC0 — Case bank: extend recall: 7 of 21 curated query/gold pairs retrieve nothing, even with the gold alone in the store (needShared=2) #405's 21 gold pairs to ≥100 labeled query/gold pairs with per-row gold tags. All other ACs are measured on a held-out split. Blocks everything.
    • AC1 — Taxonomy is runtime data: closed option set per call, seeded from existing scope/type/kw, with an other fallback; ≥95% of live-store rows taggable without other; versioned together with calibration.
    • AC2 — Tagger quality: top-3 tag recall ≥ 0.90 per side on held-out rows; report pair recall.
    • AC3 — Retrieval effect: the tag lane raises recall@N on gold pairs over the lexical lane alone, and wrong-match rate stays at or below baseline. Both axes; a higher hit count alone is not success.
    • AC4 — Abstention: ≥90% of below-threshold queries truly have no gold in the store; threshold fitted on the case bank.
    • AC5 — Cost: one model call per read; ≤100 ms added on CPU-only Linux and macOS laptops; ≤500 MB int8 ONNX; zero network.
    • AC6 — Degradation: model absent or not yet downloaded → today's lexical behavior, unchanged.
    • AC7 — Harmlessness: tags are assigned only by the pipeline, never claimed by row content; a tag-spoofing test row cannot enter the injection budget; the taxonomy stays coarse (tags are categories, not content summaries).
    • AC8 — Calibration: refit temperature and thresholds on the case bank; report held-out ECE.
    • AC9 — Governance: alias normalization, distinct-row promotion floor, archive-not-delete, case-bank regression on taxonomy change, IDF smoothing floor for young tags.

    What this does not claim. Full recall. Concepts the taxonomy never defined cannot surface through the tag lane; containment is the other fallback to the lexical lane plus periodic taxonomy review driven by other-heavy queries. The promotion gate must stay cheap — a new concept should land after 3–5 rows, not 50 — or the coverage ceiling returns.

    Sequencing. AC0 first, then a fine-tuning spike (multi-label head on an encoder, trained on case-bank tags) before any integration decision. Relationship to existing issues: #405's keyword and threshold gaps define the lexical-lane baseline this lane must beat, and the case bank is shared; #40's write-time keywords are respected — the tagger adds one local call at read time and kw becomes the naming source for the taxonomy.

  3. WhollyMindless commented on Nov 14, 2026

    @WhollyMindless
    ContributorAuthor

    I support exploring a local, inspectable vocabulary bridge. The case-bank-first sequencing and lexical fallback are useful foundations. A few suggestions for the experiment and draft acceptance criteria:

    • AC0: include difficult negatives and separate evaluation. Alongside paraphrases, include queries with no relevant memory and memories that share a topic but answer a different question. Keep model training, threshold calibration, and final testing separate; group related paraphrases of the same memory so they cannot leak across those splits.
    • Measure against the inexpensive recall: 7 of 21 curated query/gold pairs retrieve nothing, even with the gold alone in the store (needShared=2) #405 alternatives too. The exact-keyword/second-token gate is a useful baseline experiment, with its precision cost measured against background rows. This would show what additional benefit the classifier buys beyond a smaller lexical change.
    • Category agreement needs a relevance check. Two memories can both concern authentication while only one answers a logout question. Tags could improve candidate discovery, but shared categories alone would not establish that a row belongs in the injection budget. Preserve repository boundaries and the existing provenance constraints throughout.
    • Measure pair retrieval directly, and both sides of abstention. The p-squared estimate assumes independent successes and compatible labels; top-3 tag recall does not establish that retrieval result, or guarantee that soft scoring improves it. AC4 should also report how often queries with a relevant memory are rejected. A high fraction of correct abstentions can coexist with too many missed answers.
    • Try a small fixed taxonomy before adding its growth machinery. First establish that the tag vocabulary improves retrieval. Promotion, aliases, archiving and recalibration can then be evaluated as additions, including how existing rows are retagged or compared across taxonomy versions.
    • Include Windows in AC5 and test the actual Bun integration. ONNX Runtime lists Windows CPU binaries alongside Linux and macOS (platform table); that is a starting point for testing, not proof of this model/runtime combination. Measure cold startup, warm query latency and resident memory as well as model download size.

    These are design suggestions for the case bank and prototype; I have not benchmarked the proposed models. The part I find most promising is the auditable vocabulary bridge. I would want evidence that its categories retrieve the right memories before committing to the taxonomy-management machinery. Sequencing and implementation choices remain with the maintainer.

  4. abogartz commented on Nov 14, 2026

    @abogartz
    Owner

    Thanks — all six points accepted, one as a genuine correction. Revised below. The phase split you proposed is adopted: prove the vocabulary bridge before building its management machinery.

    Corrections accepted.

    • Windows (AC5). My AC5 contradicted the repo's own platform commitment: CI already runs test-windows on windows-latest, and the runtime is Bun ≥1.3.0. The unproven part is not ONNX Runtime's Windows CPU binaries but onnxruntime-node's native bindings under Bun specifically. AC5 now names Windows and Bun, and requires measuring cold startup, warm query latency, resident memory, and download size on that runtime, per your note that the platform table is a starting point and not proof.
    • Abstention, both sides (AC4). As written, AC4 measured only abstention precision. A design could pass it while rejecting many answerable queries. AC4 now requires the false-rejection rate as well: of queries that do have a gold row, how many fall below threshold. Report as risk at coverage, both directions.

    Revisions accepted.

    • AC0 (case bank). Now includes: (a) difficult negatives — memories that share a topic with the query but answer a different question; (b) queries with no relevant memory in the store; (c) split hygiene — related paraphrases of the same memory are grouped so they cannot leak across the training, threshold-calibration, and final-test splits.
    • AC3 (baseline). The tag lane must beat the tuned lexical lane, not today's. The exact-keyword/second-token fix from recall: 7 of 21 curated query/gold pairs retrieve nothing, even with the gold alone in the store (needShared=2) #405 is run as a baseline experiment first, with its precision cost measured against background rows. This makes the classifier's marginal benefit explicit, and it may shrink the remaining scope. Hard-negative injection rate (shared category, wrong answer) is reported as its own metric, addressing your point that category agreement alone does not establish a row belongs in the injection budget — injection requires passing the joint score threshold, and that threshold is now measured against exactly this failure class.
    • p² (heuristic only). Agreed: the independence assumption does not hold when the same model tags both sides, and label compatibility across taxonomy versions is a separate threat. The estimate stays in the discussion as intuition; AC2 requires measuring pair recall directly and top-3 tag recall is not treated as establishing it.
    • Phasing. Phase 1: fixed small taxonomy, tag-lane retrieval measurement against the tuned lexical baseline, two-sided abstention, platform feasibility on Windows/Bun. Phase 2 (contingent on phase-1 evidence): the growth pipeline — promotion, aliases, archiving, recalibration — plus the problem your comment sharpens: how rows tagged under older taxonomy versions are retagged or compared across versions, since option descriptions are prompt text and changing them changes the conditions under which existing tags were assigned.

    Revised AC set.

    Phase 1:

    • AC0 — Case bank: ≥100 labeled query/gold pairs (extending recall: 7 of 21 curated query/gold pairs retrieve nothing, even with the gold alone in the store (needShared=2) #405), including difficult negatives and no-gold queries; grouped splits for training, calibration, and test.
    • AC1 — Fixed taxonomy: closed set seeded from existing scope/type/kw, with an other fallback; ≥95% of live-store rows taggable without other.
    • AC2 — Tagger quality: top-3 tag recall ≥ 0.90 per side and directly measured pair recall on held-out data.
    • AC3 — Retrieval effect: tag lane beats the recall: 7 of 21 curated query/gold pairs retrieve nothing, even with the gold alone in the store (needShared=2) #405-tuned lexical baseline on recall@N, with wrong-match rate at or below baseline; hard-negative injection rate reported separately.
    • AC4 — Abstention, both directions: below-threshold queries truly lack gold ≥90% of the time, and false-rejection rate on answerable queries reported; threshold fitted on the case bank.
    • AC5 — Cost and platform: one model call per read; ≤100 ms added warm on CPU-only Linux, macOS, and Windows under Bun; ≤500 MB int8 ONNX; cold start, resident memory, and download size measured; zero network.
    • AC6 — Degradation: model absent → today's lexical behavior, unchanged.
    • AC7 — Harmlessness: tags assigned only by the pipeline; tag-spoofing rows cannot enter the budget; taxonomy stays coarse. Repository boundaries and provenance constraints preserved throughout.

    Phase 2 (only if phase 1 shows the categories retrieve the right memories):

    • AC8 — Calibration: temperature and thresholds refit on the case bank; held-out ECE reported.
    • AC9 — Governance: alias normalization, distinct-row promotion floor, archive-not-delete, case-bank regression on taxonomy change, IDF smoothing for young tags, and a defined retagging/comparability policy across taxonomy versions.

    Sequencing unchanged otherwise: AC0 first, then the #405 lexical baseline experiment, then the fine-tuning spike. The auditable vocabulary bridge is the part worth the risk; the management machinery only earns its complexity after the bridge is measured.

  5. abogartz commented on Nov 14, 2026

    @abogartz
    Owner

    POC result: the platform holds, the tag lane does not — proposing a pivot to write-side kw quality

    Ran the phase-1 experiment early on a throwaway branch (poc/409-tag-space, poc-409/RESULTS.md, commit 4ee6683) before the full case bank existed, using the audited bench fixture as the eval set. Two findings; the second one kills the read-path tag lane as proposed.

    Setup. MacBook Air M2, 8 GB RAM (slowest supported-class machine). Bun 1.4.3 + @huggingface/transformers 4.3.2 + onnxruntime-node 1.30, q8 ONNX. No daemon, no Python, no network after model download. Eval set: bench/fixtures/recall-dataset.ts — 52 memories, 105 queries, topically adjacent distractors by design. Caveats stated up front: the lexical scorer in the POC is a toy overlap scorer, not the repo's real one, so absolute numbers are not comparable to the published bench; comparisons between lanes on the same scorer are valid. The tagger tested is zero-shot, not fine-tuned — this was a go/no-go probe, not AC2.

    Finding 1 — platform and speed assumptions hold.

    Model warm p50 warm p95 RSS after load cached cold load
    all-MiniLM-L6-v2 (22M, embedding) 4 ms 14 ms +54 MB 132 ms
    nli-deberta-v3-small (144M, NLI) 17 ms 32 ms +263 MB ~550 ms
    nli-deberta-v3-base (304M, NLI) 50 ms 150 ms +319 MB ~6 s (incl. download)

    AC5's ≤100 ms warm budget clears on this machine with room, at ≤400 MB RSS, under Bun, in-process. One real exception: zero-shot NLI scores one (text, label) pair per label, so a 13-tag taxonomy costs ~320 ms per query. Any read-path model must be single-pass (a fine-tuned head), not zero-shot.

    Finding 2 — the topic-level tag lane is at chance, and so are dense embeddings.

    Lanes on the same fixture and scorer (chance = 1/52 ≈ 0.019):

    Lane r1 r3
    lexical, content only 0.514 0.610
    lexical + kw (the shipped #40 bridge) 0.657 0.771
    zero-shot soft tag agreement (13 tags, deberta-v3-small) 0.076 0.133
    sparse top-2 tag match, IDF-weighted 0.029 0.124
    MiniLM-L6 embeddings, cosine 0.029 0.067
    bge-small-en-v1.5 embeddings, cosine 0.029 0.067
    embedding + lexical rank fusion 0.076 0.190
    lexical+kw with bounded tag bonus 0.486 0.629
    tag filter → lexical re-rank 0.524 0.619

    Every attempt to blend tag or embedding signal into the lexical lane made it worse. Rescue analysis: of 24 queries the tuned lexical lane misses at r3, 7 have gold sharing an active tag — the signal exists but is far too weak to pay for the noise it adds.

    The mechanism of the failure is exactly the objection raised in review: category agreement is not relevance. The fixture's distractors are topically adjacent by design (its anti-rigging rule 2), so topic-level similarity — whether NLI tags or dense vectors — is structurally blind on the exact axis the fixture measures. bge-small ranks gold #1 on near-lexical queries and past rank 27 on strict paraphrases (bimodal rank distribution). What bridges the gap is the row-specific keyword set: it encodes the paraphrase relation ("test users" ↔ "seed fixture accounts"), not the topic.

    Consequences, as I read them.

    1. The growable taxonomy and its governance machinery should not be built. The evidence says the topic-level premise underneath it is wrong for this eval design, not merely untuned.
    2. Read-path embeddings (the Mem0-style option) are negative-value on this fixture: 100–200 MB of dependency for chance-level ranking.
    3. The strongest measured lane is the shipped kw bridge (+14 points of r1 over content-only). The open question therefore moves to the write side: can a small fine-tuned single-pass model generate or repair kw better than the capture model does today? That experiment keeps the model batch, offline, and latency-free, where this POC's platform numbers clearly apply, and it targets the relation-level signal the POC says is the one that works.
    4. AC0 (the case bank, with difficult negatives and grouped splits) remains the prerequisite — the kw-quality experiment needs it just as the tag experiment did.

    This falsifies the read-path half of my own proposal and I think that is the result the review asked for before committing to machinery. Sequencing and interpretation remain with the maintainer. Happy to file the kw-quality experiment as a scoped ticket once the case bank exists.

  6. abogartz commented on Nov 14, 2026

    @abogartz
    Owner

    POC part 2: the pivot, tested — kw quality is the whole gap, and telemetry closes part of it without any model

    Follow-up on the throwaway branch (poc/409-tag-space, commit 84ad5e4, poc-409/RESULTS.md §4). Same fixture, same toy scorer and same caveats as part 1: absolute numbers are not the published bench; between-lane comparisons on the same scorer are what count.

    1. Headroom — is kw quality even the lever? Oracle experiment (deliberately leaky, upper bound only): append each query's own tokens to its gold row. Toy-scorer r1 goes 0.657 → 1.000. Separately, 12 of 105 queries share zero content words with gold even with today's keywords. The entire distance between today's retrieval and perfect retrieval on this fixture is a keyword-quality gap. The lever exists and it is large.

    2. Can a local model generate the missing aliases without seeing the queries? Tested two cheap shapes; both fail zero-shot.

    Approach r1 r3 Failure mode
    current kw (baseline) 0.657 0.771 —
    encoder pool expansion (bge-small, corpus vocabulary, top-4 added) 0.686 0.790 +3 pts, noisy: borrows words from topically adjacent distractor rows
    Qwen2.5-0.5B-Instruct (offline, q8), generated kw replaces 0.495 0.581 echoes the fact verbatim instead of paraphrasing
    Qwen2.5-0.5B-Instruct, generated kw appended 0.657 0.762 no gain

    Small models fail the theory-of-mind step — "words a different person would use" — without fine-tuning, and fine-tuning needs (memory → alias) supervision that does not exist yet. Dead end as a phase-1 move.

    3. The deployable shape: telemetry-learned keyword repair. Production sees real queries. When a query fails to surface gold and the session later succeeds against a specific memory, that (query → memory) pair is evidence; the query's distinctive tokens are appended to that memory's keywords. Code-only, plain text, auditable, no model, no read-path cost. Simulated with a seeded 50/50 per-query split; additions capped at 8 tokens per row; the test set restricted to queries sharing ≤2 content tokens with ANY training query (a novelty filter that kills near-duplicate memorization):

    Split r1 now r1 + telemetry r3 now r3 + telemetry
    test (51 queries) 0.627 0.647 0.765 0.804
    novel-only (44) 0.682 0.705 0.773 0.841

    12 training misses produced the learning; generalization survives the novelty filter, which says the learned tokens encode relations rather than memorized strings. Side effects measured honestly: 4 of 51 test queries ranked worse — learned tokens can steal rank on neighbours, so a real pipeline needs a cap below 8, an IDF discount for learned tokens, and decay. Net effect positive on this fixture.

    4. The structural consequence. The telemetry pairs that drive repair are exactly the (query → memory) supervision a fine-tuned generator or reranker would need. The sequence becomes: log misses → repair keywords immediately (cheap, measured) → the accumulated pairs become the AC0 case bank → optionally fine-tune a model to pre-empt phrasings the store has not yet seen. The classifier moves from phase-1 prerequisite to phase-3 upside. This also answers the review's "measure against the inexpensive #405 alternatives" point: the inexpensive alternative is not just the second-token gate — it is the failure log itself.

    Caveats. Single fixture, toy scorer, one seeded split, cap untuned at 8, assumes a (query → memory) success signal that does not exist in the product yet — producing that signal honestly is itself AC0-adjacent work. A deeper stress bench (false-pair noise, token bloat, negative transfer, the repo's real scorer) is in progress; I will post results as they land.

  7. WhollyMindless commented on Nov 14, 2026

    @WhollyMindless
    ContributorAuthor

    The telemetry direction suggests a useful next question: how do we turn an observed query-to-memory association into trustworthy, recoverable learning? A few suggestions for the proposed repair path:

    • Define the success signal before learning from it. A successful session after reading a memory does not by itself establish that the memory answered the query. Incorrect associations could reinforce themselves. Explicit user confirmation could provide an initial source of labeled pairs; a row merely being retrieved, cited, or present during a successful task should be distinguished from confirmed relevance.
    • Treat learned keywords as durable memory writes. Queries can contain private project details or secrets. Appending their words to a global memory could broaden visibility even when the main content is unchanged. Scope, redaction, provenance and undo should apply to keyword additions too, including the source query's project boundary.
    • Keep the conclusions tied to what the experiment measures. The oracle result establishes that query-derived aliases can recover this fixture under this scorer. It does not establish that keyword quality explains every production retrieval failure. Likewise, the novelty-filtered split measures new wording against existing memories; broader transfer across memories or projects remains a separate question. Those limits still leave a useful direction to test.
    • Consider proposing repairs before applying them automatically. This could feed the interactive review in Enhancement: a review inbox for what a session learned #410/Enhancement: memory optimization review, including project/global scope #412: "You found this memory using different wording — add these search aliases?" That would collect confirmed associations while making overly broad additions and negative transfer visible. Record the source and acceptance of each repair so it can be inspected and reversed; optional automation can follow evidence about the signal's reliability.

    The planned real-scorer and false-pair stress tests already address several of the remaining questions. These suggestions focus on the attribution and write boundaries around the experiment; I have not independently reproduced the POC results.

  8. abogartz commented on Nov 14, 2026

    @abogartz
    Owner

    Correction to the telemetry result: the +7 novel-transfer was a toy-scorer artifact

    Follow-up stress bench on the throwaway branch (commit 69fdead, poc-409/RESULTS.md §5). I reran the telemetry experiment with the shipped scorer (src/recall/score.ts: stopword abstention, Robertson-IF, and the two-concept evidence gate) at the published store sizes, instead of the toy overlap scorer used in my previous comment. The headline number there — +7 pts r3 on novel held-out queries — does not survive that rerun, and I am correcting it so the published record is not misleading.

    What the shipped scorer shows (50/50 seeded split, cap 4, sizes 50/200/500):

    Metric baseline + telemetry
    r3 on novel held-out queries 0.694 / 0.706 / 0.686 unchanged — better = 0 in every arm at every size
    strict-class r3 0.278–0.316 unchanged
    same-query replay r3 (train queries re-run) 0.63 1.00
    false-pair noise eps 0.5 — −4 pts r1, 0 pts r3
    negative transfer on untouched gold — none

    Why the toy result was wrong. The shipped matcher requires a query to share at least two content tokens with a memory before it injects anything. A paraphrase, by design, does not share the training query's distinctive tokens, so a single learned token cannot clear that gate. My toy scorer had no such gate, so it rewarded exactly the near-duplicate transfer that production deliberately refuses. The +7 was measuring a matcher the project chose not to ship.

    What still holds, and is worth something. Telemetry-learned keywords are a perfect repair mechanism for observed phrasings: same-query replay goes 0.63 → 1.00 at every store size, it is immune to false-pair noise at r3 (the two-concept gate itself filters wrong-row tokens), it causes no negative transfer, and it costs nothing at read time. Real user traffic is far more repetitive than a curated fixture, so production replay value is likely larger than the fixture shows. What it is not is a generalization mechanism: novel phrasings still need a relation-level bridge — the capture model's kw (shipped) or a fine-tuned generator — and the telemetry pairs remain that generator's training corpus.

    The classifier question is being reopened separately with a controlled experiment; I will report that on its own thread rather than fold it in here.

  9. abogartz commented on Nov 14, 2026

    @abogartz
    Owner

    Part 3: the classifier, tested fairly — plus the full proposal with my recommendations

    Two prior comments in this thread are superseded by the correction above (the +7 novel-transfer number was a toy-scorer artifact). This comment closes the POC: a controlled classifier test built to answer the objection that my first tag experiment was set up wrong (it was), a production-shaped replay bench, and the complete build/don't-build proposal. Branch poc/409-tag-space, commits 4ee6683..ce142ae, full writeup in poc-409/RESULTS.md.

    The contrived classifier test: I could not make it fail

    A fully authored 8-row store. The gold's facet combination (benchmarks + testing + documentation) is distinctive; its content deliberately shares fewer than two tokens with each query, so the lexical lane abstains. A zero-shot classifier tags both sides; tags are appended as kw — the exact proposed integration — and ranked by the shipped scorer. Model: nli-deberta-v3-base (304M, q8), threshold 0.5.

    Query lexical lane tag lane
    "how do I run the bench" rank 1 rank 1
    "what is the command for the scoring report" ABSTAIN rank 1
    "where can I find the recall numbers after a run" ABSTAIN rank 1

    Breaking-point sweep: facet-sharing distractors added one at a time; gold stays inside the injection window through 11 rows (rank 2 once a testing neighbour arrives, never out).

    Setup sensitivity is real and material. The same test with nli-deberta-v3-small (144M) tags the query "how do I run the bench" as {readme, monitoring} — wrong — and returns an empty tag set for another query. My original tag POC used the small model in a standalone lane on an adversarial fixture; three handicaps stacked. The architecture was never the thing that failed.

    Where the boundary actually is

    Re-running the real fixture with the base model separates two things I had conflated:

    • Tag coverage is fine: 21/24 queries that the lexical lane misses share at least one active tag with their gold (small model: 7/24).
    • Tag discrimination is at chance: sparse-tag ranking gives r1 ≈ 0.086. The fixture's distractors share facets by design — the separating information is the question focus, not the facet, and tags encode facets.

    So: the tag lane works when the gold is facet-identifiable (real memories like "the bench lives in bench/" usually are), and is structurally blind on same-facet-different-question pairs (which the fixture deliberately is all of).

    Rescue-only integration (tags select candidate rows only when the baseline abstains; the two-concept evidence gate unchanged): zero rescue, zero harm, all store sizes. Candidates without shared tokens score nothing through the gate. Respecting the gate makes the tag lane a no-op; bypassing it (tested as L5/L6 arms) scores below baseline. The gate is precisely what protects precision.

    Replay-heavy stream: the surviving claim is stronger than I said

    Production-shaped traffic through the shipped scorer: 262 items, every query recurs 1–3× plus deterministic near-variants; telemetry learns sequentially on misses.

    Item kind baseline r3 with telemetry
    first occurrence 0.66 0.88
    repeat 0.64 0.87
    near-variant 0.61 0.79

    Near-variants clear the two-concept gate after repair (+18 pts) because they share most tokens with the original query. Overall stream r3 ≈ 0.65 → ≈ 0.85. The curated 50/50 split understated telemetry because it forbids repetition; real traffic repeats.

    The full proposal

    Recommend (phase 1, no models on the read path)

    1. A rank/success signal for recall. Nothing else here works without it, and it does not exist in the product yet. Cheap: log injected ids + whether the session referenced them.
    2. Telemetry-learned kw. On a miss (gold exists but ranked outside the window, or abstention with a later-confirmed reference), append the query's distinctive non-stopword tokens to the gold row's kw. Cap 2–4 tokens, IDF-discount learned tokens, decay them over time. Measured: same-query replay r3 0.63 → 1.00; noise at eps 0.5 costs 0 pts r3; no negative transfer; zero read-path cost. This is a memorization cache of failures, not a generalizer — that is a feature: it is the one mechanism here with no downside profile.
    3. Keep improving capture-model kw quality. It remains the only shipped bridge for genuinely novel phrasings, and it is where the remaining strict-paraphrase gap lives.

    Conditional (phase 2, only if the prerequisites land)

    1. Read-path tag classifier — recommend only if all of: (a) a base-class single-pass model is acceptable (≈304M params, ≈50 ms warm on an M2 Air, ≈320 MB RSS — feasible but the floor; smaller models mislabel); (b) a fine-tuned multi-label head replaces zero-shot NLI (per-label cost makes zero-shot ~320 ms/query at 13 tags); (c) the target store actually contains facet-identifiable golds. On this fixture its discrimination is chance, so it must be validated on production-shaped stores before anyone commits to it.
    2. Telemetry pairs as a fine-tune corpus. The (query → gold) pairs logged in step 2 are exactly the supervision a small alias-generator or reranker would need. Accumulate them now; decide on a model later with real data.

    Discourage

    • Taxonomy-management machinery (growable tag sets, merge tooling): built for a read path that does not pay off. If tags ever return, they return as per-row learned aliases, which is what kw already is.
    • Read-path dense embeddings (Mem0-style): negative value on this eval design; every blend into the lexical lane made it worse; bge-small ranks gold past 27 on strict paraphrases.
    • Zero-shot NLI on the read path: per-label forward passes, dead on latency.
    • Sub-150M models for tagging or alias generation: mislabels, echoes facts verbatim, or returns empty.
    • Anything that bypasses the two-concept evidence gate: it is the precision defense; every arm that routed around it lost.

    Footguns encountered (documented so the next person does not repeat them)

    1. @huggingface/transformers v4 zero-shot takes candidate labels positionally — pipe(text, labels, opts), not an options field. Silently wrong results otherwise.
    2. A telemetry bug that learned nothing looked like success: rankOf dereferenced .gold on a string (indexOf(undefined) → 0), so every query looked already-satisfied and the learn gate never fired. Test the success signal itself, not just the outcome.
    3. Toy scorers lie in a specific direction: scoring without the two-concept gate rewards exactly the near-duplicate transfer that production deliberately refuses. I published a +7 result from such a scorer; the shipped scorer said 0.
    4. Fixture query order is easy→hard per gold: "last query per gold" train/test splits are adversarially biased. Use a deterministic hash split.
    5. Corpus-vocabulary pool expansion contaminates: alias pools built from the whole store borrow words from topically-adjacent distractor rows (+3 pts noise, not signal).
    6. Setup sensitivity is first-order: model class and threshold flipped the contrived test from 3/3 to mislabel/empty. Report both, always.
    7. Small instruct LLMs fail the theory-of-mind step of alias generation ("words a different person would use") and echo the fact verbatim instead.
  10. abogartz commented on Nov 15, 2026

    @abogartz
    Owner

    Part 3: the scorer is a cliff, local verifiers cannot rescue it, and the free lane is the caller

    POC continues on poc/409-tag-space (poc-409/RESULTS.md §8–10, opt1-lit.ts, gate-ablate.ts, opt1-rerank*.ts, opt1-agentexp.ts). This part supersedes the "read path is closed" pessimism with a measured way through it.

    1. The scorer is a cliff, not a ranker

    For every test miss at store sizes 50/200/500, the gold row is rank 1 or nowhere — zero misses have gold at ranks 2–8. The two-concept gate admits or executes; ranking barely happens. This kills, on this fixture, every idea whose mechanism is reordering candidates: rerankers over the lexical set, embedding lanes, tag-space rescoring. #405's "matching failure, not ranking failure" is now measured, not asserted.

    2. Gate surgery and local verification: both Pareto-dominated

    Gate ablation (variant scorer G0-verified byte-equal to the shipped one on all 51 test queries first):

    • single-concept gate: +4–10 r1 but abstention 0.28→0.06 and wrong matches 5–10x. Rejected — this is exactly why the gate exists (the df=1 "should" incident).
    • phrase-level kw bridge (≥2 tokens inside one kw phrase): never fires. The fixture's strict paraphrases share exactly ONE alias token with gold — "agree twice" is structurally unsatisfiable for them.
    • kw-df caps: untunable — the fixture inflates kw document-frequencies by design (variants inherit keywords), so no stable K exists.
    • single-kw-token admission (kw_bridge): the only lever that moves recall, +7–12 r1, at 4–5x wrongTop1. Fails the ticket's two-axis bar alone.

    Last read-path idea from the literature (two-stage retrieve-then-rerank, repurposed as gate rescue): bridge-admit on one kw token, verify each candidate with a tiny local model, only on queries that abstain today. Two verifiers, both fast enough to be irrelevant excuses:

    • cross-encoder/ms-marco-MiniLM-L-6-v2 (22M, 2.1 ms/pair warm): rejected every gold bridge pair (all ≈ −11, the irrelevant floor). It bridges surface paraphrase (+5.2 on "csv export runs out of memory") and dies on synonym leaps (−11.4 on "throttling rules never take effect" vs "rate limiter reads Redis DB 3", while a lexical probe of the same pair scores +7.1).
    • nli-deberta-v3-base (304M, 13.9 ms/pair, P(entailment), premise=memory): no separation at all — gold 0.001–0.17, wrongs 0–0.11, fully overlapping. A memory does not entail a question.

    Every threshold of both is Pareto-dominated by the shipped scorer. Mechanism identified: strict paraphrases share zero content words with gold content, and synonym-leap bridging is precisely what fails below 304M.

    3. The free lane: the caller donates the bridge

    The product already runs a large chat model in every session — the one making the tool call. If the tool description tells it to write synonyms and alias phrases into the recall query, the bridge costs nothing: zero added latency, no new dependency, no scorer change, no taxonomy.

    Protocol: a fresh subagent (same model class as the session) saw only the 51 test queries — no repo access — and returned 3–6 alternative phrases per query ("why do my throttling rules never take effect" → "rate limiting config; 429 not enforced; limiter bypass debug"). Output audited for fixture-only tokens: none found. Scored with the shipped scorer against the human-kw store:

    size arm r1 abstain wrongTop1
    50 original 0.694 0.286 0.020
    50 + expansion 0.939 0.020 0.041
    200 original 0.706 0.275 0.020
    200 + expansion 0.941 0.020 0.039
    500 original 0.686 0.275 0.039
    500 + expansion 0.941 0.020 0.039

    Flip audit (size 200): 13 abstain→hit, 1 wrong→hit, 1 abstain→wrong, 1 hit→wrong. +14 hits for +1 wrong — compare kw_bridge's +4 for +5. First Pareto-dominant lever in this entire POC on the ticket's own criterion.

    Why it works where every local model died: the gate never needed a smarter matcher — it needed the query to arrive with a second vocabulary. The session model shares domain vocabulary with the memory author (in production, often the same model family), so its synonyms land on the words the memory actually uses.

    Caveats, stated before anyone finds them

    1. One draw of one model class; the eval measures the product configuration, but a different product model may expand better or worse.
    2. The subagent was instructed, not sandboxed, not to read the repo; the contamination audit is output-side.
    3. The two harm flips are real: expansion can pull a competitor ahead of gold.
    4. Fixture memories are human-authored; production memories are model-authored, which should share MORE vocabulary with the expander — the fixture is the harder case.

    Running now, will report

    • Negative-query harm test (the decisive one): most real queries have no useful memory. Expansion adds ~30 tokens of vocabulary to every call — does abstention survive on no-gold queries?
    • Variance: independent second expansion draw.
    • Wording-drift ladder: recall vs paraphrase distance, with/without expansion.
    • Capture-side audit of the alternative hypothesis: were concepts ever landing (truncation, dupe rejection), or was resurfacing always the failure?

    Implementation shape if it survives: rewrite the memory_recall tool description to require 3–5 synonym phrases in the query. Small prompt change, small code change, no model.

  11. abogartz commented on Nov 15, 2026

    @abogartz
    Owner

    Part 4: stress-testing the expansion lane — it leaks, and an IF floor plugs it

    Part 3 promised four stress tests. Three are in, plus the capture-side audit of the competing hypothesis. poc-409/opt1-stress{,2,3}.ts (+ *-out.json), commits through 89abcd9.

    Variance: stable

    An independent second expansion draw (fresh subagent, same protocol): r1 0.941 again at all store sizes (wrongs +1 query vs draw 1). The +23 is not a lucky draw.

    Harm: the naive lane leaks badly

    The decisive test — most real recall calls have no useful memory. 25 no-gold queries (off-fixture domains + deliberate near-misses like "gRPC vs REST", "docker build cache", "PCI compliance"), expanded blind by the same protocol:

    arm false-injection on no-gold queries
    shipped (original only) 0.16
    + expansion, shipped gate 0.44

    The near-misses caught exactly what theory predicted: "price API tiers" → rate-limiter row (the expansion's own "rate limit charges" token), "gRPC vs REST" → the fastify-vs-express row, "OpenTelemetry" → a test-suite row. Appending ~40 content tokens to every call makes two accidental agreements common. Not shippable as-is.

    Gate shapes trade; they do not escape

    exp2 (row must match ≥2 expansion tokens), both1 (≥1 original + ≥1 expansion token), rescue-only (expand only when the original abstains): all move along the Pareto frontier (gold r1 0.86–0.94, harm 0.28–0.44) without returning to baseline harm.

    The IF floor escapes

    Robertson-IF is already computed. Requiring the top-1's shared-token score ≥ F:

    F gold r1 harm false-inject
    0–6 0.941 0.44
    7 0.922 0.32
    8 0.922 0.28
    10 0.902–0.922 0.16 = baseline

    The mechanism matches the hypothesis from part 2: gold expansion matches ride rare tokens (timestamptz, crashloopbackoff, pagerduty); false matches ride common ones (library, choice, config). A score floor keeps the rare-token bridges and drops the common-token collisions. +20 recall points at zero measured harm increase — on the ticket's two axes, this is the shape.

    Footgun, stated: F=10 was tuned on this fixture at size 200. Document frequencies scale with store size, so F must be fitted on a case bank (AC4-style), not hardcoded.

    The capture-side audit of the alternative hypothesis

    Was the problem memories not landing (truncation, dupe rejection)? Live store numbers: auto-capture wrote 380 rows with 16 refusals (~4%); capture lag p50 16 ms. Writes land. Meanwhile 41% of the store (461 of 1,122 rows) has never been retrieved in 30 days. Some of that is healthy aging, but it is consistent with the cliff: the gate executes rows at read time that capture did its job on. The failure is resurfacing, not capture.

    Where this lands

    Implementation shape: memory_recall tool description requires 3–5 synonym phrases plus an IF-score floor on injection, fitted on a case bank. No models, no taxonomy, no cloud. Remaining proof: the end-to-end test — #316-style warm-vs-cold on new bugs in a known repo, where the memory's wording was always slightly off the new bug's. That is the bench the "autocapture doesn't help novel bugs" verdict deserves a re-run against.

  12. WhollyMindless commented on Nov 15, 2026

    @WhollyMindless
    ContributorAuthor

    Two concrete checks from an independent probe of published main (6728d49, v0.25.0), following the expansion results above. These may be useful before integration:

    1. Exercise the actual memory_recall handler as a separate evaluation path. The POC description identifies src/recall/score.ts as the tested scorer, but memory_recall currently uses its own substring-count matcher, with scope/type bonuses and a default limit of 20. It does not use the injection scorer's stopword filter, two-concept gate, or Robertson-IF score. In a synthetic store, the query why do my throttling rules never take effect returned a row containing Rate limiter reads Redis DB 3. with keywords throttling and rate limit store through the actual tool handler; scoreMemories abstained. Adding the reported expansion made the injection scorer admit it, while the tool already returned it. A description change plus an injection-only score floor therefore would not by itself connect the tested behavior to the tool's returned results. Suggest evaluating the actual handler and checking every returned row, with any intended scorer alignment made explicit.

    2. Check ties and memory-order sensitivity before interpreting “rank 1 or nowhere.” The public buildStore puts authored rows before their variants, and the benchmark conversion gives every row the same timestamp. With the keyword-enabled 200-row fixture and query which redis db does the rate limiter use, the expected m02 (DB 3) and variant m02#105 (DB 975) both score 10.886856910082415. Reversing the input rows makes that conflicting variant rank first and moves the expected row to fourth. Suggest seeded memory-order permutations and explicit tie reporting; some variants are equivalent answers, but this one changes the configuration value. This check could distinguish an admission cliff from fixture ordering that hides a ranking ambiguity.

    Reproduction scope: Windows, Bun 1.4.4, unchanged published matcher functions and the registered recall handler; storage, host/schema, visibility and telemetry boundaries were stubbed with fictional visible rows. No live user store was accessed. I could not fetch poc/409-tag-space or 89abcd9, so these are observations about published code and fixtures, not a reproduction or refutation of your POC. Your experiment may already handle these distinctions. Both checks are offered as small validation steps; sequencing and implementation remain your call.

  13. abogartz commented on Nov 15, 2026

    @abogartz
    Owner

    POC lanes for #409 — retrieval without another prompt nudge

    Written 2026-11-15 after reading the POC results and running the K-block smoke. This is a menu
    of untried lanes, ordered by cost. Nothing here is implemented; the shipped path is unchanged
    (plugin 0.25.0, branch poc/409-tag-space at e9be15e).

    Premise

    The failure this ticket describes is a vocabulary gap between the asking session and the stored
    row. The K-block added a second finding: when the asking model is told to bridge that gap itself,
    it does not. It issued one query ("build test commands invariants bugs", 5 words) at step 2 of a
    41-event run, received the [matcher] nudge in the result, then made 18 more tool calls without
    re-querying. That is the documented norm, not a local quirk: agents re-retrieve in ~10% of cases
    and return the same documents 53% of the time when they do (arXiv 2601.07711), and prompt-level
    rules about tool behavior are followed "at most partly" (arXiv 2610.06191). Instructions placed in
    tool output are the lowest-priority channel in the hierarchy (arXiv 2404.13208). So every lane
    below removes the model's decision rather than asking the model to decide better.

    Already closed — do not repeat

    Lane Where it died
    Zero-shot tag taxonomy RESULTS §2 — r1 0.076 vs 0.657 lexical+kw
    Dense embeddings, and embedding+lexical fusion RESULTS §2 — 0.029–0.076 r1
    Zero-shot NLI / cross-encoder as gate rescue RESULTS §9 — gold and wrong distributions overlap or invert
    1.5B write-side alias generation RESULTS §8 arm E — format failure 5/52 before semantics
    Prompting the session model to expand its query RESULTS §10–11 and the K-block smoke: works in a query-only fixture (r1 0.94), measures 0.44 false injection under stress without an IF floor, and in the loop it simply does not fire
    Loosening the two-concept gate RESULTS §9 — +7–12 r1 for 4–5× wrongTop1

    The untried space is: model-free corpus feedback, tokenization, write-side fields other than
    aliases, structural (path) retrieval, and using signals the agent already emits.

    Lane 0 — Measure usage before measuring retrieval (do this first)

    Claim. If the agent ignores rows that recall already returns, no retrieval improvement can
    move outcomes, and the ticket should be narrowed or closed.

    Method. Offline, no model. The K-block run directories hold full transcripts
    (results10/<pass>-<task>/out.jsonl, 41 events, tool_use with arguments). For each
    memory_recall result, parse the returned rows, extract the paths and backticked commands they
    cite (the extraction already exists: extractPathRefs in src/gate/resolver.ts, used by
    src/inject/attribution.ts), and test whether any later tool_use in the same transcript names
    one of those paths or commands. Report three numbers per run: recalled rows, rows whose refs
    appear later, rows that were the only source of a later-read path.

    Why it is new. attribution.ts already computes this shape, but only for rows that rode the
    injection block. Recall hits are recorded in the use ledger with src: "recall"
    (src/hits/ledger.ts:32, written at src/tools/recall.ts:83), and no caller joins them to later
    tool calls.

    Kill criterion. If ≤20% of recalled rows are later referenced, stop optimizing retrieval and
    write that finding into #409.

    Cost. One afternoon, no model calls.

    Lane 1 — Pseudo-relevance feedback on the abstain path

    Claim. The misses are gate abstentions, not rank errors (RESULTS §9: "every miss is a gate
    abstention"). On an abstain there is no evidence to rank, but there is usually a near-miss row
    whose vocabulary is closer to the store's than the query's. Feed those terms back and search once
    more.

    Method. In poc-409/ (not in src/), add a runner that reproduces the shipped scorer on
    bench/fixtures/recall-dataset.ts (105 queries, 52 memories). Baseline: scoreMemories
    (src/recall/score.ts:57). Treatment: when the shipped scorer returns nothing, compute an
    ungated IF ranking (copy the scoring loop, skip the needShared gate at score.ts:66), take the
    top 3 rows, harvest up to 5 content terms they use that the query does not, add them with weight
    0.5, re-score. Optionally one second round only.

    Falsification. Beat baseline r1 by ≥5 points at ≤2× wrongTop1 across all 105 queries, and
    hold the 25 no-gold queries in poc-409/neg-queries.txt at baseline harm. Any drift into the
    0.44-harm regime kills it; that is the documented failure mode of feedback expansion (SoK,
    arXiv 2603.07379, semantic drift).

    Why it is new. Only expansion of the query by a model was tested. Corpus feedback on your
    own store was never tried, and it cannot be contaminated by an external vocabulary.

    Cost. Hours. No model, no dependency. Precedent: Rocchio relevance feedback (1971); RM3,
    Lavrenko & Croft, SIGIR 2001.

    Lane 2 — Tokenization before semantics

    Claim. A slice of the synonym wall is morphology and identifier shape, not vocabulary.

    Method. words() (src/recall/score.ts:8) lowercases and splits on non-alphanumerics, so
    getUserAccount is one token, get_user_account is another, and "deploy" never matches
    "deployment". In a runner, compare the shipped tokenizer against: (a) split on _ and case
    boundaries before lowercasing; (b) suffix stripping (plural, -ing, -ed, -tion); (c) a small
    abbreviation map (db, cfg, env, auth, repo); (d) character 4-grams as a low-weight fallback for
    query terms that match nothing. Measure with the store's kw present and absent, because the
    alias field already covers some of this.

    Falsification. <3 points r1, or any rise in wrongTop1 on the no-gold set.

    Why it is new. No tokenizer experiment appears in RESULTS; all vocabulary work moved to
    aliases instead. Precedent for subword matching: fastText, arXiv 1607.01759.

    Cost. Hours, no model. Highest certainty per unit of work on this list.

    Lane 3 — Write the question, not only the answer

    Claim. Question-to-question is an easier lexical match than question-to-fact.

    Method. The capture prompt already asks for kw ("how a DIFFERENT session would ask for
    this", src/capture/prompt.ts:77). Add one field, asked: the single sentence a future session
    would type to need this row, with no repo name, no session name, no "we". Index it in the
    haystack. Note that this rides the shipped capture model, which is far larger than the 1.5B model
    that failed in §8 arm E, so the format wall may not reproduce.

    Test. Generate asked for the 52 fixture memories with whichever model the product runs, then
    score the 105 queries with and without the field indexed.

    Watch. #329 measured that session-scoped prose gets stored back as durable rows. asked must
    be generic or it reintroduces that leak.

    Falsification. <5 points r1, or asked text that fails a "would this make sense in a fresh
    repo" audit.

    Cost. 1–2 days including the audit. No extra model call at capture time.

    Lane 4 — Give the model a table of contents

    Claim. A 5-word query looks like not knowing what is in the store. Choosing from a list is a
    different task from recalling vocabulary.

    Method. Two steps, cheapest first. (a) On gate abstain, return the scopes that exist, so the
    next attempt can aim. (b) A second tool, memory_index, returning scopes plus row titles capped
    by the injection budget. Before building (b), test the hypothesis offline: for each of the 105
    queries, would a title list have contained the gold row's scope or title tokens? That stat costs
    nothing and tells you whether (b) can possibly help.

    Why it is new. No browsing affordance exists today; the agent gets either hits or silence.
    Precedent: MemGPT hierarchical memory (arXiv 2310.08560) and the search/find/open toolset in
    arXiv 2605.05538, where navigation is a separate action from search.

    Kill criterion. If gold titles share no tokens with their queries, skip (b).

    Cost. (a) is a small change to the recall return string; (b) is a new tool and a budget.

    Lane 5 — Negative aliases

    Claim. Expansion's blocker is harm, and harm is row-level, not score-level. The IF floor only
    works with a threshold fitted per store size (RESULTS §11).

    Method. Add an optional avoid field: words that must not bring this row back. Score effect:
    drop the row when an avoid token is present and no kw token matches. Mine the initial avoid
    sets from the 25 no-gold queries and the wrong wins already recorded in poc-409/neg-expansions.tsv
    and expansions2.tsv.

    Test. Same two axes on the same sets, with the expansion lane on, so the comparison is against
    the 0.44-harm regime rather than against baseline.

    Falsification. Harm at or near baseline while gold r1 stays ≥0.90.

    Why it is new. The store schema has no negative field; the schema is at
    src/store/model/memory.ts. Precedent: Rocchio's negative feedback; negative expansion is standard
    IR practice and does not need a model.

    Cost. ~1 day plus a fixture pass.

    Lane 6 — Retrieve by reference, not by wording

    Claim. When the agent is reading a file, exact-word matching is unnecessary: the memory
    already names the file.

    Method. contextualPull (src/inject/pull.ts:30) fires on grep/glob/read and scores
    argText(args) lexically. Add a deterministic reference channel: rows citing the touched path, or
    a path in the same directory, ride alongside the lexical picks. extractPathRefs already exists;
    the store is already loaded in that path. Measure first, offline: from the K-block transcripts,
    for each later-read path, was there a stored row citing it? That number is the upper bound on what
    this lane can add.

    Why it is new. References are used for attribution and for the CONFLICT check, never as a
    retrieval key.

    Falsification. Coverage stat near zero, or the added rows dominate the budget.

    Cost. Hours for the measurement, ~1 day for the channel.

    Lane 7 — Score the agent's tool arguments, not its prose

    Claim. The model's prose query is vague; its shell and read calls carry exact paths, symbols
    and commands, which is the vocabulary the matcher rewards.

    Method. The injection lane scores the latest prompt only
    (src/inject/epochs.ts:195). Compose the scoring query as prompt + the last two tool calls the
    session made (the call ledger already exists via callsFor(sid)), and score at epoch freeze only.
    Freeze-time scoring keeps the prompt cache safe; there is no per-request churn.

    Test. Offline first: replay the K-block transcript prompts and tool arguments, compare the
    top-5 row sets for prompt-only versus prompt+args, and check whether the rows the agent later used
    enter the set.

    Falsification. No change in top-5 composition on ≥30% of turns.

    Cost. Hours offline; small change if it wins.

    Lane 8 — Distill a bridge classifier, do not train from scratch

    Claim. The 22M cross-encoder failed at gate rescue zero-shot; it was trained for passage
    relevance, not for synonym leaps between a terse memory and a terse query. That is a
    distribution gap, not a capacity proof.

    Method. Reuse the §10 expansion pairs as positives and the 25 no-gold queries as hard
    negatives. Fine-tune cross-encoder/ms-marco-MiniLM-L-6-v2 (already measured at 2.1 ms/pair on
    this machine) as a binary bridge classifier, evaluate on held-out pairs, then plug it into gate
    rescue. Only worth starting if Lanes 1–2 fail to close the gap; it is the most expensive lane and
    the only one needing training time on the M2.

    Falsification. Held-out precision below the shipped scorer's precision at the same recall.

    Cost. Days. Platform budget already verified (RESULTS §1: ≤400 MB RSS, warm 2–14 ms).

    Guardrails for whoever runs these

    1. Two axes always: r1 (or r3) and wrongTop1 on no-gold queries. A hit-rate win alone is not a win
      (recall: 7 of 21 curated query/gold pairs retrieve nothing, even with the gold alone in the store (needShared=2) #405 says this explicitly).
    2. Freeze any threshold before the eval. The §11 footgun is real: an IF floor tuned on one store
      size does not transfer.
    3. Offline replay before end-to-end. The current K-block is 10/10 timeouts at 150 s, and
      run2-ab.ts:216-220 overwrites the hidden-suite grade with timeout, so a finished-but-slow
      fix is recorded as a failure. No outcome claim should be drawn from that block as configured.
    4. Keep negative controls. bench/runners/recall-quality.ts already ships deliberately wrong arms
      so the metric can fail; keep that discipline in poc-409/.

    My order

    Lane 0, then 1 and 2. All three are offline, model-free, and cheap enough to run several times in
    one afternoon, and together they answer whether the problem is the query, the tokenizer, or the
    fact that nobody uses what is already retrieved. Lane 4 is the strongest product idea if Lane 0
    says recalled rows are used but the right ones are never fetched.

    References

    • Rocchio (1971), Relevance Feedback in Information Retrieval, The SMART Retrieval System.
    • Lavrenko & Croft (2001), Relevance-Based Language Models, SIGIR.
    • arXiv 2601.07711 — Is Agentic RAG worth it? (agents re-retrieve ~10%; 53% same docs)
    • arXiv 2610.06191 — Judged Useless, Queried Anyway (prompt rules followed "at most partly")
    • arXiv 2404.13208 — The Instruction Hierarchy (tool output is lowest priority)
    • arXiv 2603.07379 — SoK: Agentic RAG (query drift without convergence criteria)
    • arXiv 2605.05538 — AgenticRAG enterprise harness (search/find/open; up to five reformulations
      per call)
    • arXiv 2403.19302 — MQ4CS (1–5 multi-aspect queries in a single call)
    • arXiv 2310.08560 — MemGPT (hierarchical memory navigation)
    • arXiv 1607.01759 — fastText (subword n-grams)
    • arXiv 2406.19215 — SeaKR (uncertainty-triggered retrieval; not viable without logits)
  14. 8 remaining items

  15. abogartz commented on Nov 15, 2026

    @abogartz
    Owner

    Lane 8 result: killed without training — and §9 needs one sentence corrected

    Follow-up to the Lane 3 comment. Full write-up: poc-409/RESULTS.md §23. Script: poc-409/lane8.ts
    (+ lane8-out-{50,200,500}.json). No training ran.

    Lane 8's claim: the 22M MS MARCO cross-encoder failed as a gate verifier (§9) because it was
    pretrained for passage relevance, so that is a distribution gap, not a capacity proof; fine-tune it on
    §10's expansion pairs as positives and the no-gold queries as hard negatives. Cost on this machine:
    days, 8 GB, no torch in the system python. Pricing it first was the cheap move.

    §9 was over-read

    §9 swept absolute thresholds — the gate's own question, "admit this pair or not" — and found no
    separation. That is not the same as no signal. Used as a ranker inside the pool that bridge
    admission already produced, where one slot is on offer, the frozen model ranks the gold above the kin
    rows most of the time, including when the gold sits on the irrelevant floor:

    store per-query AUC, frozen CE same, pools where gold < −10 same, lexical admission score pooled AUC (z)
    50 0.694 0.694 (6 pools) 0.660 0.700 (2.21)
    200 0.861 0.866 (11 pools) 0.459 0.721 (2.63)
    500 0.841 0.878 (7 pools) 0.500 0.778 (2.82)

    At store 200, 11 of 13 gold pairs score below −10 — the model calls them irrelevant in absolute terms
    and still puts them first inside their own pool. The lexical score that built the pool is at chance.

    The prize is capped, and the frozen model already has most of it

    The bridge stage's ceiling is not the 30 abstentions. It is the abstentions whose pool contains the
    gold at all:

    store abstentions / 105 pools holding gold = ceiling frozen CE ranks it top-1 headroom for a fine-tune
    50 33 13 (12.4 r1 points) 10 3
    200 30 13 (12.4) 9 4
    500 30 9 (8.6) 6 3

    A perfect fine-tune wins 3-4 queries over a model that needs no training.

    The labels do not exist

    Bridge pairs are by definition the pairs the shipped gate rejects, so the positive count equals the
    column above:

    store positive pairs outside the §11 test fold negative pairs (kin) negative pairs (no-gold)
    50 13 5 52 35
    500 9 4 183 104

    Training a binary classifier on 13 positives and holding out 5 is not a measurement. The lane's own
    falsification — held-out precision below the shipped scorer's at the same recall — cannot be read at
    n = 5 with a margin wider than the 4-query prize.

    Harm forces the thing the model lacks

    Top-1 admission, threshold swept, store 200 (13 of the 25 no-gold queries get a pool at all):

    CE threshold gold rescues (of 13) wrongTop1 (of 13) wrongTop1 (of 25)
    none 9 1.00 0.52
    −11.4 5 0.69 0.36
    −11.0 2 0.62 0.32
    −5 1 0.08 0.04
    0 0 0 0

    Same Pareto shape at every store size: harm near zero costs almost every rescue. A fine-tune would
    have to supply exactly what the frozen model does not have — an absolute score separating floor-gold
    from floor-kin — from 13 positives that all sit on that floor.

    Compute was never the constraint: 204 new pairs in 414 ms warm, 2.0 ms/pair, matching §1. A full
    matrix pass is seconds. Labels are the wall.

    Verdict

    Lane 8 is killed without training. Not because a 22M model cannot bridge — it can, 0.86 within-pool
    AUC — but because the stage it would serve is capped at 13 of 105 queries, the frozen model already
    takes 9, and the last 4 cannot be bought with 13 labels without paying 52% wrongTop1 on the no-gold
    set.

    Two things to carry out of this: §9's mechanism sentence should be read as "no absolute relevance
    signal at ≤304M", which is what was measured; and the menu is now exhausted — Lanes 0, 2, 3, 4, 5, 6,
    7, 8 closed, Lane 1 closed standalone but payable behind the dedup pass, Lane 9 (near-duplicate
    suppression) shipped behind OPENCODE_MEMORY_DEDUP. What is left is not a retrieval lane: it is an
    outcome measurement with a budget where runs finish, because the 150 s K-block times out 18/18 and
    cannot separate anything.

  16. abogartz commented on Nov 16, 2026

    @abogartz
    Owner

    Case bank (AC0) is built — it kills the IF floor, retires the 0.16 baseline, and settles item 3

    AC0 ("a case bank of query/gold pairs with difficult negatives and grouped splits") has been the stated blocker on every precision claim in this thread. It exists now. Two of this ticket's numbers did not survive it.

    Why it was needed, in one measurement

    Re-running §11's floor sweep with grouped splits — the fixture writes 2–3 phrasings per gold row, so a query-level split lets a threshold see one phrasing and get scored on another — and holding out half the 25 negatives:

    rule (held-out half, store 200) gold r1 / 46 false injection / 14
    shipped today, no expansion 32 4
    expansion, no floor 39 9
    expansion + F=8 39 7
    expansion + F=14 35 4

    Fitting on the fit half picks F=8 (harm already 0 there on 11 negatives); F=8 held out is 3 false injections above baseline. McNemar on the paired outcomes: F=8 vs F=14 is 3/0 discordant, p=0.25. A 21-percentage-point difference in false-injection rate is statistically invisible at n=14. That is what "needs a case bank" actually meant, and it is a power problem, not a modelling problem.

    What the bank is

    recall calls with a query, 30 days 1,067
    distinct queries (bank rows) 404
    near-duplicate query groups (Jaccard ≥ 0.5) 254
    store snapshot 1,175 injectable rows, hash 9fb43da547cba1be
    labelled (query, row) pairs 1,863 + 404 controls

    Real query text out of the session transcripts, each resolved against the store its own session could see (visibility from the session's directory, not an ambient reader), scored by both matchers, plus one random visible row per query that neither matcher returned. One row per distinct query, not per call — a scheduled task issued 515 of the 1,067 calls, and counting calls would measure that task instead of retrieval.

    Judge. A 27B seat, temperature 0, no tools, no repo access, told explicitly that a row being returned is not evidence it belongs. Rows are shuffled with controls so it cannot learn which is which.

    Calibration. Of 404 control rows — a random row that merely happened to be in the store — 8 were called relevant (2.0%) and 0 were called an answer. That is the floor every number below has to clear.

    Reliability. A different model (DeepSeek V4 Flash) re-labelled a 60-case sample: kappa 0.71 on "does this query have an answer in the window", 0.75 on "is this row an answer", 0.58 on the 3-way scale. Only 2 of 284 row judgements differ by two levels. A blind third reader (me) then scored a 27-row sheet: exact kappa 0.20 against the main seat and 0.48 against the second, but 24/27 raw agreement with the main seat on answer-or-not. Read that as the scale being soft exactly where the 3-way kappa said it was soft — the useful-vs-nothing line — with me the most generous of the three, most likely because I know what each query was actually for and the other two can only read it. The answer boundary, which is what every headline below uses, holds across all three.

    Data files are gitignored — they carry live query text and live memory prose. Scripts, aggregate JSON and the summary are committed on the POC branch poc/409-tag-space under poc-409/casebank/. That branch is local only (nothing here touches src/); say the word and I will push it, or open a docs-only PR with the scripts and SUMMARY.md so the instrument is reviewable.

    Labels on real traffic

    queries
    an answer was returned 295
    something useful, nothing answers 65
    no answer returned 109 (27.0%)
    of which nothing even useful 44

    Across all 404 queries and 1,863 labelled returned rows: 527 answer, 559 useful-but-not-an-answer, 777 irrelevant. The window the agent receives is majority filler today.

    Finding 1 — the IF floor has no admissible value

    Admissibility rule fixed before looking: a floor may be chosen only if, on the fit half of groups, it loses no gold at rank 1 and shows no-gold queries no extra window. The only admissible value is F=0.

    Held-out exchange rate:

    F gold@1 lost non-answers removed no-gold windows avoided McNemar on gold@1
    3 5 12 0 5/0 p=0.063
    4 8 27 1 8/0 p=0.008
    6 14 53 5 14/0 p=0.000
    8 30 108 14 30/0 p=0.000
    10 36 145 21 36/0 p=0.000

    Every floor starts costing answers before it removes enough noise to be worth buying. §11's "F=10, +20 recall at zero harm" was read off the same 25 hand-written negatives it was then scored on. §11's escape does not hold; the floor lane is closed, not deferred.

    Finding 2 — the 0.16 false-injection baseline was fiction

    The whole precision framing assumed the shipped scorer abstains on ~84% of queries with nothing relevant. On real no-gold queries it does not:

    no-gold queries still shown a window
    recall tool, held-out half 50 / 59 (0.85)
    injection scorer, held-out half 39 / 59 (0.66)
    all no-gold queries, tool 96 / 109 (0.88)

    The tool returned at least one row on 217 of 227 held-out queries — it almost never abstains. My synthetic negatives shared no vocabulary at all with the fixture, which is the only reason the scorer abstained on them and the only reason a floor looked free. Any future precision claim must use the real rate as its baseline.

    Finding 3 — item 3 is a real win, and it is not free

    The reviewer was right that memory_recall uses its own substring matcher rather than the injection scorer. Both matchers were now run over the same 227 held-out real queries:

    top 3 tool's matcher injection scorer
    answer inside the window 148 160
    rows admitted 570 485
    rows that do not answer 362 262
    no-gold queries shown a window 50 39
    answer at rank 1 125 126

    Paired (McNemar): an answer where the other had none — tool 5, injection 17, p=0.017. But the injection scorer abstains where the tool returns something on 11 queries vs 1 (p=0.006), and rank 1 is a dead tie (55.1% vs 55.5%).

    So alignment is a genuine gain in what lands in the window and a genuine cost in how often anything is returned. That is a product decision, not a benchmark result, and I am not opening a PR for it without one.

    What the bank does not fix

    • Power is asymmetric. The row-level axis has n=1,863 and certifies small shifts. The query-level "nothing in the store answers this" axis has 109 cases (59 held out), so a query-level harm claim is certifiable only at ~12 points. Real traffic in a dense store is mostly answerable; more real traffic will not fix this, constructed cross-domain negatives will.
    • The tool returns up to 20 rows today; the bank labels the top 5. Rows 6–20 are unlabelled.
    • 13 queries returned nothing from either matcher and carry no label.
    • Store drift retires cases. provenance.json's store hash is what a later fit must be checked against.
    • It measures what the matcher returns. It still says nothing about whether the session model uses it — the §13 result (expansion fired in 0 of 15 in-loop transcripts) is untouched by any of this.

    Reproduce

    cd poc-409/casebank
    bun build.ts            # live store + session db -> pinned snapshot, 404 queries, candidates + controls
    bun judge.ts --batch 6  # labels; cached per batch, resumable
    bun assemble.ts         # casebank.jsonl, grouped fit/test split, SUMMARY.md
    bun judge.ts --audit --ids audit-sample.jsonl --batch 5
    bun agreement.ts        # cross-seat kappa + the blind audit sheet
    bun analyze.ts          # item 3, the floor, power -> analyze-out.json
    

    build.ts --from-snapshot recomputes scores against the pinned snapshot and refuses to run if candidate membership moved — the judge's row numbers are positions in that order.

  17. abogartz commented on Nov 16, 2026

    @abogartz
    Owner

    Tracking: the four PRs this ticket produced

    Everything measured here is now in review as four independent pull requests, each branched off origin/main (6728d49, v0.25.0). All four are mergeable with all required checks green. None is merged.

    PR change default measured
    #415 near-duplicate suppression inside a returned window off, OPENCODE_MEMORY_DEDUP=0.8 restores composition 0.006 → 0.791; the live replay prices the threshold — 0.5–0.7 suppresses rows that are merely related (92% at 0.5) and pushes the window to rank 9–20, 0.8 suppresses only true copies on 17% of calls and never moves rank 1
    #416 default window 20 rows → 5 on (it changes the default) r1 and r3 unchanged, precision 4.1% → 13.1%, 74% of returned characters removed
    #417 split identifiers (camelCase, _, ., -) in the matcher tokenizer on no-gold rows per call 0.60 → 0.44 at unchanged recall; live top-5 churn 7.7%
    #418 a memory_recall match must share two of the query's words once the query has three off, OPENCODE_MEMORY_QUERY_GATE=1 held-out returned rows 571 → 480, non-answering rows 363 → 272, queries with no answer available still shown a window 0.847 → 0.678, paired 10-to-0 (McNemar p=0.002), recall unchanged

    What the case bank retired from this ticket

    Two numbers earlier in this thread no longer hold, and the correction is worth more than either original claim.

    §11's abstention floor is dead, not deferred. "F=10 restores baseline harm at +20 r1" was fit on the same 25 negatives it was scored on. Re-run with the gold rows split by family and half the negatives held out, the only admissible value under a no-gold-loss and no-extra-window constraint is F=0. McNemar F=8 vs F=14 on the held-out negatives: 3/0 discordant, p=0.25 — a 21-point difference in false injection is invisible at n=14.

    The assumed 0.16 false-injection baseline was fiction. The synthetic negatives shared no vocabulary with the store, so the tool never matched them. On real traffic the tool shows a window to 85% of queries where nothing in the store answers the query. The failure mode is not confident noise on hostile queries; it is that the tool essentially never abstains.

    The instrument is 404 real recall queries from 30 days of session transcripts, scored against a pinned 1,175-row store snapshot, labelled by two unrelated reader seats (kappa 0.71 query-has-answer, 0.75 row-is-answer, 2 rows of 284 apart by two levels). Calibration: 8 of 404 control rows called relevant, 0 called an answer. Its data files are derived from the live store and are deliberately not committed; the builders are not yet landed either, so these numbers are not reproducible from the pull requests alone. That is a fair review objection and it is open.

    What the four PRs do not claim

    • No outcome evidence. Every number above is a retrieval metric against relevance labels. Nothing here shows a retrieval change makes a task succeed. The outcome run is still blocked: a 150s K-block killed 18 of 18 runs and a full budget saturates so no arm separates. That is the one measurement worth building next.
    • feat(recall): two-concept admission for memory_recall behind a flag #418 does not find more answers. Answer coverage moved 148 → 149 on the held-out half, which is one query. The larger gain in item 3 (+12 answers, p=0.017) comes from IDF ranking, which means replacing the matcher, and its rank 1 is a tie. That work is not in any PR.
    • The read-side expansion lane still does not fire. 0 of 15 in-loop transcripts. The case bank left that blocker untouched.

    Before more than one is merged

    #415, #416 and #418 all change the same returned window — one suppresses copies, one shortens it, one narrows admission — and each was measured alone. The combined effect on composition and on the no-gold axes is not yet measured, so I would not merge more than one without re-running the published bench runner and the case-bank arms against the combination. Say which order you want and I'll produce those numbers.

  18. abogartz commented on Nov 16, 2026

    @abogartz
    Owner

    Instrument rebuild + all four PRs reworked (2026-11-16)

    The labels were clipped; they have been rebuilt. The store never truncated (cap 4,000 chars, write gate rejects rather than cuts) — but the case-bank judge saw row prose clipped to 500 chars, so 83% of the original labels were partial. All 1,863 pairs were relabelled with full text; a byte-identical rerun reproduced 2,267/2,267 labels (temperature 0 is reproducible), yet changing a batch neighbour's text flips 13.6% of unchanged rows — batch context, not sampling noise. Every pair a gate moved in or out of a window (44) was re-adjudicated in isolation on two seats; the isolated seats overturned 29 of the 36 disputed ANSWER labels. RESULTS §25 is marked void; §26 documents the protocol.

    Reworked, pushed, CI green, none merged:

    Open: the outcome run with separable arms (the only measurement that can price 0.8 dedup and the limit trade against task success), and IDF ranking for the +12-answer class.

  19. added a commit that references this issue on Nov 17, 2026
  20. added 3 commits that reference this issue on Nov 17, 2026
  21. added a commit that references this issue on Nov 17, 2026
  22. abogartz commented on Nov 17, 2026

    @abogartz
    Owner

    Closing: the two halves of this problem that can be fixed lexically are fixed and shipped.

    Shipped:

    Reframing: the reliable lever was not making the search guess the searcher's synonyms — it was making capture write down tomorrow's words, because tomorrow's searcher is staring at a symptom. The auto-alias experiment (main model generating synonym keywords) made retrieval significantly worse (gold@5 207 vs 216; McNemar p=0.004) and was killed.

    Remaining gap — queries sharing no token with a row or its keywords — needs embeddings and is tracked in #420.

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

    proposalretrievalseverity:low

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions