Repository navigation
feat(backup): essentials backup (bots, memory, settings, conversations) with an in-place restore - #33
Merged
Merged
Conversation
…s and conversations, and restores without touching work folders A whole data folder easily passes the 10 GB / 100,000-file limit with turn checkpoints, conversation work folders and project clones. Essentials leaves those out; its restore keeps them in place and swaps bot folders' children (SOUL, MEMORY.md, memory/, skills) one by one with a journal it can roll back. Export defaults to essentials in Settings; full stays available.
4 of 5 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changed
Export can now make an essentials backup, and restoring one works on this computer or a new one.
bots.json,bots/<id>/(SOUL and the rest), each work folder'sMEMORY.md,memory/andskills/, settings files,messages.db(conversations),attachments/and the other top-level state files.checkpoints/,task-workspaces/,events/,native/,tool-results/,browser-uploads/.workspaces/<id>/: project clones, scripts and.claude/settings.json(see Why).bots/andworkspaces/are never moved as a whole.bots/<id>/<child>,workspaces/<id>/{MEMORY.md,memory,skills}) are swapped one by one. The replaced originals go to the safety copy.nested/nestedExisting, so an interrupted restore rolls back the same way the top-level swap does.summary.scopeis allowlisted and must beessentialsorfull.scope(defaultfull), so existing callers behave as before.server/workspace-backup-essentials.ts, next toworkspace-backup-policy.ts/-team-private.ts. This keepsserver/workspace-backup.tsunder the 1,000-line ratchet (992).Why
Exporting a real install fails with "The workspace exceeds the 10 GB backup limit." What people need to move their bots is a tiny share of the data folder.
checkpoints/workspaces/task-workspaces/Why
.claude/settings.jsonis left out: its hooks name absolute script paths. When the script is missing on the new computer, the hook exits non-zero and blocks the bot's tools.How it was verified
Checks:
pnpm typecheck✅pnpm lint✅pnpm i18n:check✅Vitest, 120 related files (backup, settings, locales, shared): 1608 passed, 1 skipped.
New tests:
server/workspace-backup.test.ts→essentials workspace backups(12 tests):scope.data.duckdb, checkpoints, task work, other bots' folders and.claudestay. The originals are in the safety copy.checkpoints/…,Task-Workspaces/…,workspaces/a/repo/…,workspaces/a/.claude/…,Workspaces/…, a file atbots/README, a file atworkspaces/a. Unknown scopes in options and in the manifest are refused too.server/workspace-backup-http.test.ts: scope defaults tofull,essentialsis passed through, and an unknown scope gets 400.src/components/WorkspaceBackupSettings.test.ts: essentials is checked by default; picking Everything sendsfull; the choice resets on reopen; the preview shows the scope.scripts/testingguards: the file-size ratchet passes.analytics-docs.test.tsfails, and it fails the same way on unmodifiedmain, so this PR does not cause it.Before / After
Before (main):
The workspace exceeds the 10 GB backup limit.(about 15.6 GB, about 131k files).After: I ran the real export and restore code on an APFS copy-on-write clone of a real data folder. The live folder was not touched. The six big roots were swapped for marker files, and each work folder got a marker
repo/file.MEMORY.mdchanged after the backup came back to the backup version; the markerrepo/file stayed; checkpoints, task-workspaces, events, native, tool-results and browser-uploads markers all stayed;data.duckdbstayed in the 3 bots that have oneHow the design review changed it
I debated the plan with a reviewer bot before implementing. What changed:
workspaces/andbots/. The first design moved those folders whole and carried the work files back, and a rollback could lose repo clones. They now stay put and only their carried children are swapped, with journal entries for each..claude/settings.jsonleft out because of the hook problem above.bots/<id>/data.duckdb) stay in place because of the per-child swap.scope.Limits / not in this PR
PhoneDevicesSection) and is covered by component tests. Midnight/Daylight screenshots were not captured.bursts.dbis not snapshotted.bots.json.*.tmpis not excluded..claude/settings.jsonwith the same absolute-path hooks.Checklist
pnpm typecheckpasses; the related vitest suites pass. I did not run the fullpnpm testlocally; the related 120 files did run.dist-server/edits