Skip to content

memory: confidence axis + contradiction supersession - #437

Merged
yogthos merged 2 commits into
mainfrom
feat/memory-confidence-supersession
Jun 18, 2026
Merged

memory: confidence axis + contradiction supersession#437
yogthos merged 2 commits into
mainfrom
feat/memory-confidence-supersession

Conversation

@yogthos

@yogthos yogthos commented Jun 18, 2026

Copy link
Copy Markdown
Collaborator

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 confidence column 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

  • Schema v13: re-adds confidence REAL (default 0.6) and superseded_at; superseded_by (inert since v7) now holds the successor uid.
  • Confidence is genuinely read — the whole point:
    • Eviction: folded into effective salience as a tiebreak among equal-salience entries (bounded ±0.1 so it never jumps the kind hierarchy).
    • Search: confidence DESC tiebreak after relevance/salience.
    • Curation: annotated in the curator render ([kind | N uses | conf C | id]) so the LLM curator can verify/re-confidence contested facts.
    • View: surfaced in lifecycle meta.
  • Supersession (the producer): new supersede action retires a contradicted fact to status='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.
  • Producer wiring: the background review pass gets a "supersede contradicted facts" instruction. supersede is in the tool enum but kept out of SYSTEM_PROMPT, consistent with the Phase 1 treatment of background-driven actions.
  • Refactor: add_entry's hot-tier compaction extracted to a shared insert_into_hot so supersede reuses the working-reserve rules rather than duplicating them.

Review notes

A /code-review high pass (3 finder angles) ran on the diff. Acted on:

  • Made the "read in curation" claim true — the curator render now surfaces confidence (it was claimed but not wired); this is the dirge-lerb trap and was the top finding.
  • Added a production-value eviction test (a harsh-superseded fact at 0.5 evicts before a default 0.6 sibling via the real path, not forced UPDATEs) and made the eviction-weight doc honest about its tiebreak role.
  • Fixed two stale comments (orphaned compaction comment; the "confidence column is gone" import comment) and documented supersession as terminal (recovery is to re-add, not restore — reviving alongside the successor would create competing facts).

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

Yogthos 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
@yogthos
yogthos merged commit e401b0c into main Jun 18, 2026
11 checks passed
@yogthos
yogthos deleted the feat/memory-confidence-supersession branch June 18, 2026 16:10
yogthos pushed a commit that referenced this pull request Jun 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant