Part 5 of 15 · 3 min read
Forgetting means every version, every copy, and the file's own bytes
A delete that leaves the deleted value sitting in a summary, or sitting in the file's unused disk space, has not actually deleted anything.
Think of shredding a document versus just dropping it in an unlocked recycling bin behind your desk, with a photocopy of it still pinned to the wall next door. Only the first one, done to both the original and the copy, actually removes the information from reach.
In plain words: a hard delete removes a record entirely, every version of it, not just a flag that hides it. Scrub means also removing the value from copies elsewhere, such as a summary that quoted it. Secure delete means telling the database to overwrite the disk space of deleted rows, because an ordinary delete can leave the old bytes sitting in the file.
A worked example. When the user says "Please forget my phone number," a correct forget has to do three separate things: remove every version of the phone fact (not just the current one), scrub any copy of the number quoted in a session summary, and overwrite the deleted bytes on disk so a raw scan of the file doesn't still find the digits. Tested across two worlds -- the number stated on an ordinary line, or quoted as the first line of a session summary -- only the combination of scrubbing and the current-row delete leaves the file genuinely free of the number; skipping the scrub step leaves the number sitting in the summary even after the fact row is gone.
The key lines. From code/mini-memory/store.py:
# from code/mini-memory/store.py
def forget_fact(self, key: str, scrub: bool = True) -> int:
"""Hard delete: every version of the fact, anything quarantined under that key and, with scrub=True, every copy of the value in other tables (a summary that quoted it)."""
values = [r[0] for r in self.db.execute("SELECT value FROM facts WHERE key = ?", (key,))]
n = self.db.execute("DELETE FROM facts WHERE key = ?", (key,)).rowcount
self.db.execute("DELETE FROM quarantine WHERE key = ?", (key,))
if scrub:
for v in values:
self.db.execute("UPDATE episodes SET summary = REPLACE(summary, ?, '[removed]'), decisions = REPLACE(decisions, ?, '[removed]')", (v, v))
Read it as: the function first collects every value that key ever held, then deletes the fact rows, then rewrites every other table that might quote one of those values. Forgetting one fact means touching every table that could have copied it. It is not enough to touch the table it was originally stored in. That is the entire reason a single DELETE FROM facts is not enough on its own.
Hard delete, scrub, secure delete
A hard delete removes a record entirely, every version, not just a flag that hides it. Scrub means also removing the value from copies elsewhere, such as a summary that quoted it. Secure delete means telling the database to overwrite the space of deleted rows, since an ordinary delete can leave the old bytes in the file.
Example: the one world where scrub is off and the number is quoted in a summary is the only row in the whole experiment where the number is still in the file after "forgetting" it -- which is the precise, reproducible shape of a forget that looks successful in the application but fails the only test that actually matters, a byte scan of the file.