Personal_AI_Infrastructure icon indicating copy to clipboard operation
Personal_AI_Infrastructure copied to clipboard

v5 install creates empty MEMORY/ skeleton without migrating prior data

Open catchingknives opened this issue 7 months ago • 3 comments

Summary

Heads up on something I ran into upgrading from v4 → v5: the installer creates the v5 MEMORY/ directory skeleton (WORK/, STATE/, LEARNING/, RELATIONSHIP/, VOICE/) but doesn't appear to copy data from the prior install into them. The backup directory is created correctly with everything intact, so no data is actually lost — but the new install starts empty, and the user has to know to manually rsync from the backup to get their context back. Wanted to flag in case the migration step is supposed to run and isn't, or in case it's worth adding one.

Reproduction

  1. Run a v3 or v4 install for a while so ~/.claude/MEMORY/ accumulates real data.
  2. Run the v5 installer.
  3. Backup is created correctly at ~/.claude.backup-{TIMESTAMP}/ ✅
  4. New ~/.claude/MEMORY/{WORK,STATE,LEARNING,RELATIONSHIP,VOICE}/ directories are created empty, timestamps ~2 minutes after the backup.
  5. Context-recall skills (/w <topic>, /cs <topic>) return "no prior work" because they're reading the new empty directories.

What was in the backup but didn't make it to the new install

From my own upgrade (one data point):

  • MEMORY/WORK/ — 266 session directories (22 MB)
  • MEMORY/LEARNING/ — 119 MB across ALGORITHM, FAILURES, REFLECTIONS, SIGNALS, SYNTHESIS, SYSTEM
  • MEMORY/STATE/ — 148 KB (work.json, session-names.json, algorithms/, progress/)
  • MEMORY/RESEARCH/ — 860 KB
  • MEMORY/SECURITY/ — 344 KB
  • MEMORY/RELATIONSHIP/ — 12 KB
  • MEMORY/VOICE/ — 516 KB (voice-events.jsonl)
  • agent-memory/ — wasn't carried over at all (had ClaudeResearcher/, Engineer/ agent state)

The PAI/USER/ migration looked partially complete — schema renames were applied (DAIDENTITY.md → DA_IDENTITY.md) and new bootstrap files added (PRINCIPAL_IDENTITY.md, OPINIONS.md, OUR_STORY.md, FEED.md), which is great. But pre-existing user data outside the renamed set wasn't included: FINANCES/, HEALTH/, PAISECURITYSYSTEM/, AISTEERINGRULES.md, ASSETMANAGEMENT.md, PRODUCTIVITY.md, REMINDERS.md, TOOLNOTES.md, STATUSLINE/, Tools/, Workflows/, plus several TELOS/*.md files (FRAMES, IDEAS, LEARNED, MODELS, MOVIES, PREDICTIONS, PROJECTS, RESONANCE, STATUS, TRAUMAS, WRONG).

Why I'm flagging it

The shipped v5 CLAUDE.md and MEMORY.md reference paths like MEMORY/WORK/curated-projects/..., STATE/work.json, and STATE/session-names.json as authoritative — so the Algorithm, /w, and /cs skills all read from them. When those directories are empty post-upgrade, the user gets no signal that their data is sitting one directory over in the backup. For a system framed as a Life OS / second brain, I think a lot of users will assume their context is gone rather than realize they need to migrate manually.

Suggestions (in order of effort)

  1. Add a one-liner to the post-install output pointing the user at the backup and giving the rsync commands. Lowest-effort fix — would have saved me an hour.
  2. Detect a non-empty backup at install time and prompt — something like "Found 266 prior work sessions and 119 MB of learning signals in your previous install. Migrate? [Y/n]".
  3. Migrate-by-default with rsync -a for MEMORY/, agent-memory/, and rsync -a --ignore-existing for PAI/USER/ so the v5 schema files win on rename collisions but everything else carries over.

Happy to send a PR for any of these if it'd help — let me know which direction you'd want it to go.

Workaround for anyone hitting this in the meantime

B=~/.claude.backup-{TIMESTAMP}
L=~/.claude
rsync -a "$B/MEMORY/" "$L/MEMORY/"
rsync -a "$B/agent-memory/" "$L/agent-memory/"
rsync -a --ignore-existing "$B/PAI/USER/" "$L/PAI/USER/"

The --ignore-existing flag on USER/ is the important bit — without it, the old v3/v4 schema files would overwrite the new v5 ones (DA_IDENTITY.md, PRINCIPAL_IDENTITY.md, etc.).

Environment

  • PAI version (post-upgrade): 5.0.0
  • Algorithm version: v6.3.0
  • Memory schema: v7.6
  • macOS Darwin 25.4.0
  • Backup directory: ~/.claude.backup-20260502-144406/

Thanks for the work on v5 — really appreciate it.

catchingknives avatar May 04 '26 13:05 catchingknives

Adding scope to this issue from a fresh upgrade — three more directories follow the same pattern (backed up correctly, new install starts empty, no hint that the user needs to migrate manually):

  • ~/.claude/projects/ — Claude Code's per-project conversation transcripts. In my upgrade: 12 project dirs / 633 MB in backup, 1 dir (the active session) in new install. Effect: every prior CC conversation appears gone.
  • ~/.claude/sessions/ — Claude Code session metadata JSONs. In my upgrade: 215 files in backup, 5 in new install.
  • ~/.claude/Tools/ (the user's private Tools directory, distinct from PAI/TOOLS/). All custom integration scripts gone post-install — a2a, qualys-api, m365-browser, edge-cookie-bridge, custom CLIs. Same skeleton-vs-data pattern as MEMORY.

Identity files are a softer version of the same:

  • ~/.claude/PAI/USER/PRINCIPAL_IDENTITY.md is overwritten back to the bootstrap template (Name: User, Timezone: America/Los_Angeles) even when the prior install had real values. Probably belongs to #1168's "drops marker over populated USER/" cluster but worth noting here too.
  • ~/.claude/PAI/USER/Config/PAI_CONFIG.yaml ditto — principal.name: "User", da.name: "PAI", no email, no voice_id.

So the suggestions in this thread (post-install rsync hint, detect-and-prompt, migrate-by-default) should explicitly cover projects/, sessions/, user Tools/, and the identity files in addition to MEMORY/ + agent-memory/.

For my own upgrade, the working post-install command set was:

B=~/.claude.backup-{TIMESTAMP}
L=~/.claude
rsync -a --ignore-existing "$B/MEMORY/"     "$L/MEMORY/"
rsync -a --ignore-existing "$B/projects/"   "$L/projects/"
rsync -a --ignore-existing "$B/sessions/"   "$L/sessions/"
rsync -a "$B/Tools/" "$L/Tools/"
rsync -a --ignore-existing "$B/PAI/USER/CLIENTS/" "$L/PAI/USER/CLIENTS/"
# Then re-edit PRINCIPAL_IDENTITY.md and PAI_CONFIG.yaml by hand

klausagnoletti avatar May 05 '26 09:05 klausagnoletti

Confirming this hit on a v4 → v5 migration on WSL2 + systemd-user. Adding two specific manifestations that may share the root cause — TELOS content and Pulse cron scripts — and a worked recovery procedure in case it's useful for the migrate-by-default suggestion in (3).

TELOS sub-case

After v4→v5 install, ~/.claude/PAI/USER/TELOS/ contained sample-template placeholders for all 9 overlap files (BELIEFS, BOOKS, CHALLENGES, GOALS, MISSION, NARRATIVES, PROBLEMS, STRATEGIES, WISDOM) — every file marked 🎯 SAMPLE TEMPLATE — placeholder. The v4 backup at ~/.claude.v4-cutover-{ts}/skills/PAI/USER/TELOS/ had 20 personalized files totaling ~38 KB with real Life-OS content. All overwritten by v5 sample templates.

Root cause appears to be the structural shift skills/PAI/USER/ (v4) → PAI/USER/ (v5). install.sh's template population landed sample content at the new path because there was nothing at the new path to compare against — and the v4 source path wasn't checked.

diff -rq ~/.claude.v4-cutover-.../skills/PAI/USER ~/.claude/PAI/USER:

  • 38 v4 files not pulled forward
  • 23 differ (most are TELOS — v5 sample templates landed on top)
  • 23 net-new in v5

Pulse-cron-scripts sub-case (same non-migration pattern)

v4 also had skills/PAI/PULSE/Assistant/checks/*.ts (tasks, heartbeat, diary, growth), monitor-{air,nest,sleep}.ts, lifelog-digest.ts, apple-health-ingest.ts, StalenessReview.ts. PULSE.toml in v5 still references several of these by name, but the scripts are not in ~/.claude/PAI/PULSE/ after install. 15 of 25 cron-referenced scripts are silently missing. When cron tries to run them, ENOENT.

So the migration gap affects both USER/ and PULSE/Assistant/ directories — same underlying issue, two surfaces.

Local recovery (worked end-to-end)

# 1. Snapshot v5 BEFORE overlay — reversibility:
ts=$(date -u +%Y%m%dT%H%M%SZ)
mkdir -p ~/.claude/PAI/USER/TELOS.snapshots/$ts
cp -a ~/.claude/PAI/USER/TELOS/. ~/.claude/PAI/USER/TELOS.snapshots/$ts/

# 2. Per-file cp from v4 backup (NOT bulk-cp — keeps v5 net-new files alive):
for f in BELIEFS BOOKS CHALLENGES GOALS MISSION NARRATIVES PROBLEMS STRATEGIES WISDOM; do
  cp ~/.claude.v4-cutover-{ts}/skills/PAI/USER/TELOS/$f.md ~/.claude/PAI/USER/TELOS/$f.md
done

# 3. Verify each restored file no longer has the SAMPLE marker:
grep -L "🎯 SAMPLE TEMPLATE" ~/.claude/PAI/USER/TELOS/*.md   # should list all 9

# 4. Regenerate the rolled-up TELOS summary:
bun ~/.claude/PAI/TOOLS/GenerateTelosSummary.ts

Snapshot under TELOS.snapshots/ (sibling, not child, of TELOS/) avoids the Telos skill's directory enumeration recursing into the backup.

On the three suggestions in the original issue

Option (3) — migrate-by-default with rsync -a --ignore-existing for PAI/USER/ — would have caught the TELOS case if it also walked the v4 directory layout (skills/PAI/USER/) and not just the new v5 path. The fix needs source-path detection across the schema shift, not just dest-path inspection. Same pattern would unblock the cron-scripts case.

Happy to send a separate issue specifically for the cron-scripts manifestation if it'd help triage, but the underlying bug (install.sh has no user-content preservation pass that walks both old and new directory layouts) seems to be one root cause with multiple visible failures.

JElliottMiller avatar May 12 '26 14:05 JElliottMiller

Hey @catchingknives, thanks for raising this, and sorry it sat for a while.

We're changing how LifeOS ships. Instead of cloning a full ~/.claude directory and running it as a complete system, LifeOS is becoming a skill you install through an agentic installer. The installer hands integration to your own AI, which reads your actual machine (your OS, your paths, your harness) and wires the hooks and system prompt in where they belong.

That's aimed right at what you hit here. The old "one directory, one layout, hope it matches your setup" approach is exactly what broke for so many people, and the new model should handle it far better because your AI does the integration per machine instead of us guessing.

So we're closing this in prep for that release. If it still bites you once the skill-based version is out, reopen or file a fresh one and we'll jump on it. Appreciate you taking the time.

danielmiessler avatar Jun 21 '26 03:06 danielmiessler