v3/docs/adr/ADR-354-agentdb-write-verification-temporal-supersession.md
Status: Proposed
Authors: claude (dream-cycle agent, 2026-06-28)
Dream Cycle Issue: #TBD (filed same night)
References: TRUSTMEM (arXiv 2606.25161), MemStrata (arXiv 2606.26511), MemClaw (arXiv 2606.24535)
Two Grade A arXiv papers published in June 2026 expose two distinct but related gaps in AgentDB's write pipeline:
Gap 1 — No write verification: AgentDB commits memory updates without checking coverage (all key facts captured), preservation (no prior facts silently dropped), or faithfulness (no new facts hallucinated). TRUSTMEM (Yang et al., 2606.25161) demonstrates that unguarded memory updates accumulate 40.1% omissions, 79.1% corruptions, and 50.0% hallucinations at scale. A MemoryTransitionVerifier reduces all three.
Gap 2 — No temporal supersession: AgentDB uses embedding similarity to detect stale facts, which achieves only 0.20–0.47 accuracy on evolving-knowledge workloads. MemStrata (Yadav, 2606.26511) shows that deterministic supersession rules — keyed on entity:predicate pairs — achieve 0.95–1.00 accuracy on the same workloads by hard-replacing rather than similarity-ranking.
These gaps are architectural: both require changes to the AgentDB write path and the maintenance module, not just tuning of existing retrieval parameters.
Add two new components to AgentDB's write path:
Insert a verification step after LLM-produced memory updates and before they are committed to AgentDB storage:
interface MemoryWriteVerification {
coverage: number; // 0–1: fraction of source facts captured
preservation: number; // 0–1: fraction of prior facts retained where expected
faithfulness: number; // 0–1: fraction of written facts grounded in source
verdict: 'commit' | 'retry' | 'rollback';
}
coverage < 0.8 → retry with gap-filling promptfaithfulness < 0.85 → rollback + alertpreservation < 0.9 on a non-superseding write → rollback + alertImplementation: lightweight LLM-as-judge call (Haiku tier, ~500ms, ~$0.0002 per write) comparing the proposed write against the source context and prior memory state.
Every AgentDB write MUST declare an entityPredicateKey string (e.g., "user:prefs:theme", "agent:ruflo:version"). The write path checks for an existing record with the same key:
This replaces the current similarity-threshold stale-detection approach. Keys can be auto-generated from the entity + predicate fields of a structured memory record, or manually specified.
Positive:
Negative / Trade-offs:
| Phase | Work | Target |
|---|---|---|
| 1 | Implement MemoryWriteVerifier (Haiku-judge, 3 metrics) | Sprint N+1 |
| 2 | Add entityPredicateKey field to AgentDB write schema | Sprint N+1 |
| 3 | Implement EntityPredicateSupersessionLayer in write path | Sprint N+1 |
| 4 | Instrument + measure against internal evolving-knowledge eval set | Sprint N+2 |
| 5 | Add provenance tracking per write (writer identity, supersedes pointer) | Sprint N+2 |