memory: confidence axis + contradiction supersession - #437
Merged
Conversation
added 2 commits
June 18, 2026 12:02
Re-introduce a confidence (truth-likelihood) column on memories, dropped as write-only in v9 (dirge-lerb). This time it's genuinely read: it folds into the eviction effective-salience (a tiebreak among equal-salience entries, bounded so it never jumps the kind hierarchy), breaks ties in search ordering, is surfaced in view meta, and is annotated in the curator render so the curator can act on contested facts. The producer is supersession. A new 'supersede' action retires a contradicted fact to status='superseded' (kept as an audit record via superseded_by/superseded_at, excluded from the snapshot/views/search/ eviction like a tombstone) and writes the corrected fact as a new entry. 'harsh' distinguishes a flat denial (successor held at reduced confidence, 0.5) from a natural update (0.7). The background review pass drives it on contradictions; supersede is in the tool enum but kept off SYSTEM_PROMPT. Supersession is terminal by design — recovery is to re-add. Schema v13. add_entry's hot-tier compaction is extracted to a shared insert_into_hot so supersede reuses the working-reserve rules. v9 dropped confidence and v13 re-adds it, so the chain round-trips to a fresh default; the v9 test now covers that. Idea #4 from the Elastic agent-memory writeup, bundled with supersession per the dirge-lerb lesson that a bare confidence column gets reverted. bd: dirge-fa10
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Phase 2 of applying the Elastic agent-memory ideas. This is idea #4 (confidence), bundled with supersession per the lesson from migration v9/dirge-lerb: a bare
confidencecolumn was reverted once for being write-only, so this time it ships with both a producer that varies it and consumers that read it.What changed
confidence REAL(default 0.6) andsuperseded_at;superseded_by(inert since v7) now holds the successor uid.confidence DESCtiebreak after relevance/salience.[kind | N uses | conf C | id]) so the LLM curator can verify/re-confidence contested facts.supersedeaction retires a contradicted fact tostatus='superseded'— excluded from snapshot/views/search/eviction exactly like a tombstone, but kept as an audit record (superseded_by/superseded_at) — and writes the corrected fact as a new entry.harsh=true(user flatly denied the old fact) discounts the successor to 0.5; a natural update lands at 0.7.supersedeis in the tool enum but kept out ofSYSTEM_PROMPT, consistent with the Phase 1 treatment of background-driven actions.add_entry's hot-tier compaction extracted to a sharedinsert_into_hotsosupersedereuses the working-reserve rules rather than duplicating them.Review notes
A
/code-review highpass (3 finder angles) ran on the diff. Acted on:Migration interaction: v9 dropped confidence and v13 re-adds it, so a pre-v9 DB round-trips to a fresh default; the v9 test now covers the drop-then-re-add.
Tests
New tests: supersession retire/audit-chain, harsh confidence discount, snapshot exclusion + persistence, eviction-by-confidence (forced and production values), default confidence + view surfacing, curator annotation, and the v13 migration. Full suite green (2790), clippy + fmt clean.
bd: dirge-fa10