[bug] CortexLedger — a fold-owned memory file with no ledger events cannot be…
What happened
CortexLedger — a fold-owned memory file with no ledger events cannot be anchored once the ledger has any event: verify says CRITICAL no-events and suggests adopt, adopt prints 'nothing to adopt', genesis refuses because the ledger is not empty
Summary
Title: CortexLedger: a fold-owned memory file with no ledger events cannot be anchored once the ledger has any event
Version: LifeOS 8.761.0
What happens
CortexLedger.ts verify (and MemoryHealthCheck.ts) report CRITICAL:
The suggested fix does nothing:
CortexLedger.ts adoptprintsmatches the ledger, nothing to adopt, becauseinspectDrift()inMemoryWriter.tsreturnsnullwhen the file has no head in the fold (// pre-genesis: nothing to drift from).CortexLedger.ts genesisrefuses:ledger already has events (genesis is only the FIRST anchor).CortexLedger.ts checkpointcovers only files that already have events.
So verify asks for adopt, adopt reports success, and verify stays CRITICAL.
How we got there
The ledger was first written by a memory/set on DA_MEMORY.md (via MemorySystem.add). PRINCIPAL_MEMORY.md had no write since then, so it never got an event, and genesis was no longer allowed.
Repro
- Empty
MEMORY/LEDGER/cortex-events.jsonl. - Write DA memory once through
MemorySystem.add(do not rungenesis). bun LIFEOS/TOOLS/CortexLedger.ts verify→ PRINCIPAL_MEMORY: no-events, CRITICAL.bun LIFEOS/TOOLS/CortexLedger.ts adopt→ "nothing to adopt"; verify still CRITICAL.
Workaround
Rewrite the file with its own entries: bun LIFEOS/TOOLS/MemoryWriter.ts read <abs path> | jq -r '.entries[]' | bun LIFEOS/TOOLS/MemoryWriter.ts set <abs path>. This appends a memory/set event and verify goes OK.
Suggested fix (one of)
adopt: when a fold-owned file has no head, append an anchoring checkpoint for that file instead of returning "nothing to adopt".genesis: allow anchoring files that have no events even when the ledger is not empty.- At minimum, make the verify hint point at a command that actually works.
Side note: MemoryWriter.ts read/set rejects the path when <home>/<path> is a symlink and the path is given after realpath (Path not in allowlist … Got: <home>/<path>); the unresolved <home>/.claude/<path> path works.
Details
- Kind: bug
- LifeOS version: 8.761.0
Filed with the LifeOS /feedback command. The reporter approved this exact text before it was sent; paths, secrets and personal details were stripped locally.
[!NOTE] 🤖 Kai (AI assistant) responding on behalf of Daniel Miessler
Thanks @Hoyass. You hit the same dead end as #2412: once the ledger had other events, nothing could anchor a memory file it had never anchored.
That's fixed in source. CortexLedger.ts adopt now refuses an unanchored file with EUNANCHORED and tells you to run it again with --force, which writes the first anchor so verify passes (17/17 adopt tests pass here). It lands in the next release, and your workaround is fine until then. The install gap that gets a ledger into this state is #2420, also fixed now. You're added to the README credits.