memory: land ticket #000017 (memory-root lifelong learning summary)

Periodic, deterministic projection over audit_events that summarizes
recurring failure motifs, audit-mode distribution, and falsification
state. Sibling layer to providence_cache (per-cache_key answers) and
audit_events (per-event chain) — memory_root is the cross-query
behavior history a SelfModel optionally cites.

Surface:

- arborist.memory.{canonical,projections,snapshot,store,falsify}
- Three default branch projections at v1 (PROJECTION_VERSION pin):
  - failure-motif:violations (counts violation tags from
    providence_write events)
  - audit-mode-distribution (STRICT/HYBRID/UNGROUNDED counts)
  - falsification-state (current cache state distribution)
- memory_root = SHA-256 over canonical body bytes; sort-invariant
  on branches.
- CLI: arborist memory snapshot|show|branches|falsify
- Audit events: memory_snapshot_landed, memory_falsified,
  memory_marked_stale.

SelfModel integration: arborist.selfmodel.snapshot reads latest live
memory_root and folds into SelfModel body. Already shipped in #000014;
this ticket completes the round-trip (memory shifts → SelfModel root
shifts).

Tests: tests/test_memory_root.py (15 cases). Full suite: 1040 passed,
36 skipped.
This commit is contained in:
russell@unturf.com 2026-05-07 16:46:41 -04:00
parent 69f91d39a6
commit 3d8f8fbd47
No known key found for this signature in database
10 changed files with 1212 additions and 10 deletions

View file

@ -62,7 +62,7 @@ Newest first. Update on every open/close.
| #000020 | Capital-cost ledger (8-capital queues) | closed · landed 2026-05-07 | 2026-05-07 | — |
| #000019 | Specification methodology for π* and V | open · awaiting go/no-go | 2026-05-07 | — |
| #000018 | Adversarial soft-hash covert-channel analysis | open · awaiting go/no-go | 2026-05-07 | — |
| #000017 | Memory-root: lifelong learning audit chain | open · awaiting go/no-go | 2026-05-07 | — |
| #000017 | Memory-root: lifelong learning audit chain | closed · landed 2026-05-07 | 2026-05-07 | — |
| #000016 | ZK Phase-2 frontier proof (concretize) | open · awaiting go/no-go | 2026-05-07 | — |
| #000015 | π* domain library + cross-domain composition | open · awaiting go/no-go | 2026-05-07 | — |
| #000014 | SelfModel: schema, falsification, integration | closed · landed 2026-05-07 | 2026-05-07 | — |

View file

@ -1,7 +1,8 @@
# Ticket #000017 — Memory-root: lifelong learning audit chain
**Status:** open · awaiting go/no-go
**Status:** closed · landed 2026-05-07
**Opened:** 2026-05-07
**Closed:** 2026-05-07
**Scope:** Spec + initial wire-up of a `memory_root` commitment that
binds an arborist-hosted agent's evolving cross-query memory into the
audit chain. Distinct from per-query providence cache (which is keyed
@ -247,12 +248,41 @@ claims X" to "agent's behavior history when claim was made."
## 6. Status
**Open · awaiting go/no-go.** Smaller surface than SelfModel
(ticket #000014); could land standalone or batched with #000014
since they reference each other. Recommended sequence: #000014
first (identity), then #000017 (history) since SelfModel optionally
cites memory_root.
**Closed 2026-05-07.** Scope delivered:
Closure criterion: schema lands, `arborist memory snapshot`
produces a deterministic memory_root, branch projections covered
by tests, audit chain stays clean.
- Schema migration `_migrate_memory_root` adds `memory_records` +
`memory_branch_summaries` tables. Sibling state — does NOT enter
cache_key by default (per §2.4 advisory mode).
- Module `arborist.memory`:
- `canonical.py``MemorySnapshot` + `BranchSummary` dataclasses,
`branch_digest`, `memory_root` SHA-256 derivation. Branch order
invariant (sorted by branch_id before hashing).
- `projections.py` — three deterministic projections at v1:
`failure-motif:violations`, `audit-mode-distribution`,
`falsification-state`. Projection rule version pinned via
`PROJECTION_VERSION = "projections-v1"`.
- `snapshot.py``snapshot(conn)` runs default branch set against
current state, returns a `MemorySnapshot`. Side-effect-free.
- `store.py``store_snapshot` persists + emits
`memory_snapshot_landed` audit event. Idempotent on same root.
- `falsify.py``falsify` and `mark_stale` flip state and emit
`memory_falsified` / `memory_marked_stale` audit events.
- CLI: `arborist memory snapshot|show|branches|falsify`.
- SelfModel integration (ticket #000014 already shipped): SelfModel
snapshot reads the latest live memory_root and folds it into the
SelfModel canonical body. SelfModel root therefore changes when
memory_root changes.
- Tests: `tests/test_memory_root.py` — 15 cases covering canonical
body stability, root invariance under branch order, snapshot
determinism + high-water progression, store idempotency,
falsify/mark_stale, projection determinism, audit-chain integrity.
Full suite: 1040 passed, 36 skipped.
Out-of-scope items (deferred to follow-ups):
- Cascade re-evaluation (`arborist memory cascade`). Memory
falsification stays advisory (option B in §2.3); explicit
cascade is a follow-up.
- Cross-shard memory reconciliation. Per-shard for now.
- Memory-driven retrieval routing.
- Fork inheritance (mesh / v8 concern).