memory / contradiction_log.py — ContradictionLog

Append-only audit log of belief revisions. Drives "I previously thought X, but updated because…" explanations.

Storage

Entry shape

{
  "timestamp":   "ISO",
  "new_fact":    str,
  "superseded":  [{ "id": str, "text": str }],
  "deleted_ids": [str],
  "reason":      str
}

API

MethodPurpose
__init__(memory_dir)Open log file.
record(new_fact, old_facts, deleted_ids, reason="")Append revision.
get_recent(limit=10)Most recent entries.
explain_belief_change(query)Search recent entries by substring.
clear()Wipe.