Conversation
…memory Implements two research features in the MAGMA graph memory subsystem: **Kumiho AGM-inspired belief revision (#2441)** - New `BeliefRevisionEngine` in `graph/belief_revision.rs`: detects contradicting edges using semantic similarity + relation domain matching (not exact string match) - Superseded edges receive `valid_to` timestamp and `superseded_by` pointer to the new edge, creating an immutable revision audit trail - Contradiction heuristic: same entity pair + same relation domain + high fact similarity (default threshold 0.85) — reinforcing facts are never superseded - New fact embedded once at insertion; existing edges embedded only for same-domain candidates, avoiding the N+1 embedding problem - Migration 056 adds `superseded_by INTEGER` column and index to graph edges table **D-MEM RPE-based tiered graph extraction routing (#2442)** - New `RpeRouter` in `graph/rpe.rs`: gates MAGMA graph extraction with a Reward Prediction Error signal computed from embedding similarity to recent context and entity novelty ratio - Low-RPE turns (routine/repeated) skip expensive graph extraction (SQLite-only write) - High-RPE turns (new entities, belief contradictions) trigger full MAGMA pipeline - Safety valve: `max_skip_turns` (default 5) forces extraction after N consecutive skips regardless of RPE, preventing silent coverage gaps - RPE state stored in bounded VecDeque (size 10) on MemoryState; cold start returns RPE=1.0 (maximum surprise) Config: [memory.graph.belief_revision] enabled = false, similarity_threshold = 0.85 [memory.graph.rpe] enabled = false, threshold = 0.3, max_skip_turns = 5 Both features are disabled by default and add 27 unit tests (6805 total). Closes #2441, closes #2442
e2914ec to
e6be194
Compare
bug-ops
added a commit
that referenced
this pull request
Mar 30, 2026
Each physical connection to sqlite::memory: is a separate empty database. When the pool size is >1, queries routed to connections other than the one that ran migrations hit a schema-less DB and fail with "no such column: superseded_by". Capping max_connections at 1 for :memory: URLs ensures all queries share the same migrated schema. Fixes 91 failing graph tests introduced after migration 056 (superseded_by column) in PR #2465. Closes #2468
bug-ops
added a commit
that referenced
this pull request
Mar 30, 2026
Each physical connection to sqlite::memory: is a separate empty database. When the pool size is >1, queries routed to connections other than the one that ran migrations hit a schema-less DB and fail with "no such column: superseded_by". Capping max_connections at 1 for :memory: URLs ensures all queries share the same migrated schema. Fixes 91 failing graph tests introduced after migration 056 (superseded_by column) in PR #2465. Closes #2468
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.
Summary
valid_toand asuperseded_bypointer. Fixes the known limitation where graph edges never expire due to varying relation strings.max_skip_turns = 5) prevents silent coverage gaps.Changes
crates/zeph-memory/src/graph/belief_revision.rs— newBeliefRevisionEngine, contradiction heuristic, 13 testscrates/zeph-memory/src/graph/rpe.rs— newRpeRouter, RPE compute, safety valve, 9 testscrates/zeph-db/migrations/sqlite/056_kumiho_dmem.sql+ postgres variant —superseded_bycolumn + indexcrates/zeph-config/src/memory.rs—BeliefRevisionConfig,RpeConfig(nested, matchingSpreadingActivationConfigpattern)crates/zeph-memory/src/graph/resolver/mod.rs— belief revision called after edge insertcrates/zeph-core/src/agent/persistence.rs— RPE gate before graph extraction spawnTest plan
cargo +nightly fmt --checkcleancargo clippy --all-targets --workspace -- -D warningscleancargo nextest run --workspace --lib --bins— 6805 passed (+27 new tests vs base)similarity_thresholdandthresholdboth annotated withvalidate_similarity_threshold(rejects NaN/Inf/-1.0)Closes #2441, closes #2442