Expand description
Historical Memory Update Detection — RML-1213
A-Mem-inspired automatic memory update detection. When new information contradicts or supplements existing memories, this module detects the relationship and suggests an appropriate action.
§How it works
- Fetch recent memories from the target workspace.
- For each existing memory, compute keyword overlap and entity matching with the new content.
- Classify the relationship: Contradiction, Supplement, Correction, or Obsolescence.
- Return
UpdateCandidatestructs for every pair whose confidence exceeds the threshold (0.3). - The caller may then call
apply_updateto commit a chosen action and record it in theupdate_logtable.
§Invariants
- Detection never panics on any input.
- Empty workspace returns an empty candidate list.
apply_updatealways writes one row toupdate_log.- Confidence scores are in the range [0.0, 1.0].
Structs§
- Update
Candidate - A candidate memory that may need to be updated.
- Update
Detector - Core update-detection engine.
- Update
LogEntry - A stored entry in the
update_logtable. - Update
Result - Result of applying an update to an existing memory.
Enums§
- Conflict
Type - Classifies the relationship between new content and an existing memory.
- Update
Action - The action to take when an update is detected.
Constants§
- CREATE_
UPDATE_ LOG_ TABLE - DDL for the
update_logtable.
Functions§
- apply_
update - Apply
actionto an existing memory and return the result. - create_
update_ log - Insert one row into
update_logand return the stored entry. - list_
update_ logs - List update log entries, optionally filtered to a specific memory.