Skip to content

Cortex ledger: adopt cannot anchor a fold-owned file with no events, so health stays CRITICAL #2819

Open

Description

@BS-WS04

Version

LifeOS 8.761.0 · attestation: not run

What is broken

When the Cortex ledger holds events for only some fold-owned files, a file with no events at all can never be anchored, and the memory health check stays CRITICAL with a remedy that does nothing. On this install the ledger was created during the 8.761.0 upgrade with a single memory/set row for PRINCIPAL_MEMORY.md; DA_MEMORY.md has no row. CortexLedger.ts verify reports DA_MEMORY.md: no-events and MemoryHealthCheck tells the user to run CortexLedger.ts adopt. But adopt goes through inspectDrift, which returns null for a file with no ledger head ("pre-genesis: nothing to drift from"), so it prints "matches the ledger, nothing to adopt" and appends nothing. genesis refuses because the ledger already has events. No CLI path anchors the file; it only clears once the reviewer happens to write that file.

Where (file:line)

LIFEOS/TOOLS/MemoryWriter.ts:786

Repro on a clean tree

1. Ledger with events for PRINCIPAL_MEMORY.md only (here: a fresh 8.761.0 ledger whose first row is a reviewer `memory/set` on PRINCIPAL_MEMORY.md).
2. `bun ~/.claude/LIFEOS/TOOLS/CortexLedger.ts verify` → `DA_MEMORY.md: no-events`, status CRITICAL.
3. `bun ~/.claude/LIFEOS/TOOLS/CortexLedger.ts adopt` → `DA_MEMORY.md: matches the ledger, nothing to adopt`; no row appended.
4. `bun ~/.claude/LIFEOS/TOOLS/CortexLedger.ts genesis` → refused: ledger already has events.
5. `verify` still reports `no-events`; MemoryHealthCheck stays CRITICAL with the same `adopt` remedy.

Negative control: the captured probe runs adopt then verify; verify still prints `DA_MEMORY.md: no-events`.

Negative control

Probe: cd $HOME/.claude/LIFEOS && bun TOOLS/CortexLedger.ts adopt; bun TOOLS/CortexLedger.ts verify · exit 2 · captured 2026-11-15T08:28:29.808Z

Red looks like: DA_MEMORY.md: no-events

  LIFEOS/USER/PRINCIPAL/PRINCIPAL_MEMORY.md: matches the ledger, nothing to adopt
  LIFEOS/USER/DIGITAL_ASSISTANT/DA_MEMORY.md: matches the ledger, nothing to adopt
ledger verify: CRITICAL (1 rows)
  LIFEOS/USER/PRINCIPAL/PRINCIPAL_MEMORY.md: ok
  LIFEOS/USER/DIGITAL_ASSISTANT/DA_MEMORY.md: no-events — no ledger event anchors this file; it cannot be verified

Suggested fix

Let adopt anchor an unanchored file: when foldState().files has no head for rel but the ledger has other events, append a memory/adopt (or per-file checkpoint) carrying the live bytes instead of returning null from inspectDrift. Alternatively let genesis anchor only the files that have no events yet, and point the no-events remedy text in MemoryHealthCheck at whichever command does that.

Environment

  • OS: macOS 26.6.2 (arm64)
  • Harness: claude-code
  • bun: 1.3.8 · git: 2.39.5
  • Doctor broken: none

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions