Skip to main content

Module memory_update

Module memory_update 

Source
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

  1. Fetch recent memories from the target workspace.
  2. For each existing memory, compute keyword overlap and entity matching with the new content.
  3. Classify the relationship: Contradiction, Supplement, Correction, or Obsolescence.
  4. Return UpdateCandidate structs for every pair whose confidence exceeds the threshold (0.3).
  5. The caller may then call apply_update to commit a chosen action and record it in the update_log table.

§Invariants

  • Detection never panics on any input.
  • Empty workspace returns an empty candidate list.
  • apply_update always writes one row to update_log.
  • Confidence scores are in the range [0.0, 1.0].

Structs§

UpdateCandidate
A candidate memory that may need to be updated.
UpdateDetector
Core update-detection engine.
UpdateLogEntry
A stored entry in the update_log table.
UpdateResult
Result of applying an update to an existing memory.

Enums§

ConflictType
Classifies the relationship between new content and an existing memory.
UpdateAction
The action to take when an update is detected.

Constants§

CREATE_UPDATE_LOG_TABLE
DDL for the update_log table.

Functions§

apply_update
Apply action to an existing memory and return the result.
create_update_log
Insert one row into update_log and return the stored entry.
list_update_logs
List update log entries, optionally filtered to a specific memory.