← Back to Blog
October 22, 2026

How to Restore SaveState After a Crash

Node v22.23.4, npm 10.9.9, and @savestate/cli 0.9.0. Snapshot, corrupt the project, list, restore.

This is a restore after a crash, using the published npm package @savestate/cli. The shell started with HOME=/tmp/ss-crash-restore/home and SAVESTATE_PASSPHRASE=crash-slip-demo. The working directory was $HOME/night-desk. node -v printed v22.23.4 and exited 0. npm -v printed 10.9.9 and exited 0. The commands below are the ones that ran, and the transcripts are the text those commands printed.

The project before the crash

$ cat > CLAUDE.md << 'EOF'
# Night desk

After a crash, keep the note crash-slip-19 in CLAUDE.md.
Do not start a second deploy until this file is restored.
EOF
$ mkdir -p .claude
$ printf '%s\n' '{"permissions":{"allow":["Bash(npm test)"]}}' > .claude/settings.json

cat CLAUDE.md exited 0 and printed:

# Night desk

After a crash, keep the note crash-slip-19 in CLAUDE.md.
Do not start a second deploy until this file is restored.

cat .claude/settings.json exited 0 and printed:

{"permissions":{"allow":["Bash(npm test)"]}}

Published package

$ npx -y @savestate/cli --version

Exit code 0.

0.9.0
npm notice
npm notice New major version of npm available! 10.9.9 -> 12.2.1
npm notice Changelog: https://github.com/npm/cli/releases/tag/v12.2.1
npm notice To update run: npm install -g npm@12.2.1
npm notice

Init

$ npx -y @savestate/cli init

Exit code 0. The banner line contains U+2014. The transcript writes that character as [U+2014].


⚡ SaveState [U+2014] Time Machine for AI

✔ Created .savestate/ directory
✔ Detected platform: Claude Code

  Your snapshots will be encrypted with a passphrase.
  You can also set SAVESTATE_PASSPHRASE env var.


✓ SaveState initialized!

  Next steps:
  savestate snapshot      Capture your first snapshot
  savestate config        Configure storage & adapters
  savestate adapters      See available platform adapters

The Claude Code adapter detected CLAUDE.md. The passphrase came from SAVESTATE_PASSPHRASE. Init did not prompt.

Snapshot

$ npx -y @savestate/cli snapshot --label before-crash

Exit code 0.


✔ Full snapshot created!

  ID:         ss-2026-10-22T21-24-43-e7kolm
  Adapter:    Claude Code
  Type:       full
  Label:      before-crash
  Files:      10 files in archive
  Archive:    1.2 KB
  Encrypted:  1.3 KB
  Storage:    local
  Status:     ✓ Encrypted & stored

  Restore with: savestate restore ss-2026-10-22T21-24-43-e7kolm
$ ls -l "$HOME/.savestate"

Exit code 0.

total 4
-rw-r--r-- 1 ubuntu ubuntu 1290 Oct 22 21:24 ss-2026-10-22T21-24-43-e7kolm.saf.enc

The archive file is 1290 bytes. The snapshot lines above call the encrypted size 1.3 KB. On this machine the path is /tmp/ss-crash-restore/home/.savestate/ss-2026-10-22T21-24-43-e7kolm.saf.enc.

Crash the project

CLAUDE.md was overwritten. .claude/settings.json was removed.

$ printf 'CORRUPTED AFTER CRASH\n' > CLAUDE.md
$ rm .claude/settings.json

cat CLAUDE.md exited 0 and printed:

CORRUPTED AFTER CRASH

ls -la .claude exited 0. The directory had no settings.json:

total 8
drwxr-xr-x 2 ubuntu ubuntu 4096 Oct 22 21:24 .
drwxr-xr-x 4 ubuntu ubuntu 4096 Oct 22 21:24 ..

List

$ npx -y @savestate/cli list

Exit code 0. The date is local time.


📋 Snapshots
   Storage: local

  ID                             Date                  Adapter      Label               Size
  ──────────────────────────────────────────────────────────────────────────────────────────
  ss-2026-10-22T21-24-43-e7kolm  Oct 22, 21:24         claude-code  before-crash      1.3 KB

  1 snapshot

Restore

$ npx -y @savestate/cli restore latest

Exit code 0.


🔄 Restoring from snapshot: latest

✔ Restore complete!

  Snapshot:      ss-2026-10-22T21-24-43-e7kolm
  Timestamp:     2026-10-22T21:24:43.644Z
  Platform:      claude-code
  Adapter:       claude-code
  Label:         before-crash
  Identity:      ✓ restored
  Memory:        0 entries restored
  Conversations: 0 indexed

  ✓ Your AI state has been restored.
  Existing files were backed up with .bak extension.

The files came back

cat CLAUDE.md exited 0 and printed the snapshotted text:

# Night desk

After a crash, keep the note crash-slip-19 in CLAUDE.md.
Do not start a second deploy until this file is restored.

cat CLAUDE.md.bak exited 0 and printed the crashed bytes:

CORRUPTED AFTER CRASH

cat .claude/settings.json exited 0 and printed the snapshotted file:

{"permissions":{"allow":["Bash(npm test)"]}}

ls -la .claude exited 0:

total 12
drwxr-xr-x 2 ubuntu ubuntu 4096 Oct 22 21:24 .
drwxr-xr-x 4 ubuntu ubuntu 4096 Oct 22 21:24 ..
-rw-r--r-- 1 ubuntu ubuntu   45 Oct 22 21:24 settings.json

The overwritten CLAUDE.md was saved as CLAUDE.md.bak. The deleted .claude/settings.json was written back, and there was no settings.json.bak.

Pro is $9/mo.

This restore used one local encrypted snapshot. Pro is $9/mo. Card today. No waitlist.

Subscribe to Pro, $9/mo

After you pay, claim the API key yourself. Then savestate login.

Prefer the CLI first? Install from npm

Questions? See the FAQ or open an issue on GitHub.