interplane.Get Omega
Read in your language

aien-sovereign-core-mv

AienOS host runtime: inference scheduling, paged KV state, the aien CLI and Spark verification tooling. Its inference engine is in alpha testing (DGX Spark GB10); Omega is the implementation destination.

Brought by drakestapleton

branch main Branches Tags History

aien-sovereign-core-mv / crates / aien-allen-memory / RETENTION.md

108 lines · 5327 bytes Raw Blame History Rendered
1# What forget does, and what it does not do
2
3Crate `aien-allen-memory`, tracking aien-spark/aien-architecture#159.
4
5## The claim, stated narrowly
6
7After `forget`, the item is **unreadable in the memory store**. That is the whole
8claim. It is not a claim that the content is erased from the machine, from
9other systems, or from anything that already received it.
10
11## How it works
12
13Each item version is encrypted (ChaCha20-Poly1305) under its own random 32-byte
14key. The ciphertext lives in `log/` and stays there. The key lives in
15`keys/<item>-v<version>.key` (file mode 0600, folder 0700).
16
17Forget runs in this order:
18
191. Write an intent marker in `pending/` (item id or scope only).
202. Overwrite each key file with zeros, fsync, delete it, fsync the keys folder.
213. Append a Forget record to `log/` (item id, scope, time; no content).
224. Remove the marker.
23
24A crash between steps leaves the item unreadable to this API (a marker exists, so
25recall skips it). `inspect` reports `forgotten (key removal pending)` while the
26key file is still there and `forgotten (key missing, record pending)` once it is
27gone; after the record is appended it reports `forgotten`. A crash after step 1
28but before step 2 finishes leaves the key on disk until the next open completes
29steps 2 to 4. A missing key on an item nobody asked to forget is
30reported as `Unresolved: key missing`, never as live and never as forgotten.
31
32A correction destroys the superseded version's key the same way.
33
34## What forget keeps
35
36- The Forget record keeps metadata: item id, scope, time. It never holds content.
37- The Put and Correct records keep their ciphertext. Without the key it cannot
38 be read, but it is still on disk.
39
40## What forget does NOT reach
41
42- Daemon logs and transcripts.
43- The daemon generation record (the sovereign-core #301 ledger records of model turns).
44- The agent chat archive.
45- Persona and compose task reports.
46- Model context that was already sent: a model that saw the text before the
47 forget keeps whatever it kept.
48- Cortex entries.
49- Any copy of the plaintext the owner made, including `export` output.
50- Backups or snapshots that include `keys/` taken before the forget.
51- Filesystem journal blocks or SSD remapped (wear-levelled) blocks that may still
52 hold the old key bytes. Zeroing a file does not promise the physical cells are
53 overwritten.
54
55## Restore and backups
56
57- A restore from a backup taken AFTER the forget cannot bring the content back:
58 the key was already gone.
59- A backup taken BEFORE the forget that includes `keys/` CAN bring back the key.
60 Recommendation: back up `log/` only and leave `keys/` out, or re-forget after
61 the restore. The store helps: every open runs `reapply_forgets()`, which
62 destroys the key of any item that has a Forget record, and of any superseded
63 version. This only works while the log is intact and newer than the forget.
64 A restore that also rolls `log/` back to before the forget removes the Forget
65 record, so nothing remembers it; this crate cannot detect that (NOT_PROVED).
66- Keys are not wrapped by a master key. Whoever can read `keys/` and `log/` can
67 read live content. The protection is scope separation in the API and access
68 to the folder, not secrecy from the machine's owner.
69
70## Integrity limits
71
72- The hash chain is unkeyed. Anyone who can write the store folder as the same
73 user can rebuild a valid chain, and removing the newest records (tail
74 truncation) is not detected. The chain catches accidents and clumsy edits, not
75 a same-user attacker. Encryption binds each ciphertext to agent, root, item,
76 version, scope and kind, so moving or relabelling a ciphertext is refused, but
77 a writer who also holds the key can forge content.
78- Key files are opened without following symlinks and a symlinked key or folder
79 is refused; the keys folder is tightened to 0700 on open.
80- Open also sweeps keys that no record refers to (leftovers of a crashed write)
81 and stale temporary files. This assumes a single writer.
82- Changing or forgetting an item needs a grant for the item's scope (or the
83 owner-facing `InspectAll`).
84
85## Scopes
86
87`personal`, `work`, `project:<name>`. Recall takes a `ScopeGrant` for exactly one
88scope, built by the daemon from the request's authorised context. A scope named
89inside a query string, a model reply or a task is only search text and never
90widens a grant. `InspectAll` exists for the owner-facing inspect command.
91
92## Standing goals
93
94Items of kind `goal` are "host goal records, not subject intents". The host never
95writes SubjectState. A real subject intent needs an aienos ADR 0018 amendment.
96
97## Other limits
98
99- Writers take an exclusive lock (flock on `lock` in the store folder) per
100 operation. Only an open that gets the lock sweeps orphan keys, removes stale
101 temp files and finishes pending forgets; an open that does not (or
102 `open_read_only`) changes nothing. flock covers processes on one machine, not
103 network filesystems. Single writer per store is otherwise assumed. A second writer racing the same record
104 number loses cleanly (`Conflict`); key files of a crashed put may be left
105 behind and are harmless (no ciphertext refers to them).
106- The store needs a filesystem that supports hard links.
107- Timestamps are informational. Nothing orders or trusts them.
108- Not wired into the daemon or CLI yet.