https://github.com/omriariav/claude-plans-backup
Back up and restore your entire Claude Code config (~/.claude) as one sanitized tarball — migrate between accounts or machines without losing skills, plugins, MCP servers, hooks, or memory.
https://github.com/omriariav/claude-plans-backup
anthropic backup claude claude-code cli developer-tools dotfiles mcp migration restore
Last synced: 2 days ago
JSON representation
Back up and restore your entire Claude Code config (~/.claude) as one sanitized tarball — migrate between accounts or machines without losing skills, plugins, MCP servers, hooks, or memory.
- Host: GitHub
- URL: https://github.com/omriariav/claude-plans-backup
- Owner: omriariav
- Created: 2026-06-16T05:49:44.000Z (8 days ago)
- Default Branch: main
- Last Pushed: 2026-06-16T09:37:56.000Z (8 days ago)
- Last Synced: 2026-06-16T10:15:35.019Z (8 days ago)
- Topics: anthropic, backup, claude, claude-code, cli, developer-tools, dotfiles, mcp, migration, restore
- Language: Shell
- Size: 32.2 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.html
Awesome Lists containing this project
README
claude-plans-backup
/* Default styles provided by pandoc.
** See https://pandoc.org/MANUAL.html#variables-for-html for config info.
*/
code{white-space: pre-wrap;}
span.smallcaps{font-variant: small-caps;}
div.columns{display: flex; gap: min(4vw, 1.5em);}
div.column{flex: auto; overflow-x: auto;}
div.hanging-indent{margin-left: 1.5em; text-indent: -1.5em;}
/* The extra [class] is a hack that increases specificity enough to
override a similar rule in reveal.js */
ul.task-list[class]{list-style: none;}
ul.task-list li input[type="checkbox"] {
font-size: inherit;
width: 0.8em;
margin: 0 0.8em 0.2em -1.6em;
vertical-align: middle;
}
.display.math{display: block; text-align: center; margin: 0.5rem auto;}
/* CSS for syntax highlighting */
html { -webkit-text-size-adjust: 100%; }
pre > code.sourceCode { white-space: pre; position: relative; }
pre > code.sourceCode > span { display: inline-block; line-height: 1.25; }
pre > code.sourceCode > span:empty { height: 1.2em; }
.sourceCode { overflow: visible; }
code.sourceCode > span { color: inherit; text-decoration: inherit; }
div.sourceCode { margin: 1em 0; }
pre.sourceCode { margin: 0; }
@media screen {
div.sourceCode { overflow: auto; }
}
@media print {
pre > code.sourceCode { white-space: pre-wrap; }
pre > code.sourceCode > span { text-indent: -5em; padding-left: 5em; }
}
pre.numberSource code
{ counter-reset: source-line 0; }
pre.numberSource code > span
{ position: relative; left: -4em; counter-increment: source-line; }
pre.numberSource code > span > a:first-child::before
{ content: counter(source-line);
position: relative; left: -1em; text-align: right; vertical-align: baseline;
border: none; display: inline-block;
-webkit-touch-callout: none; -webkit-user-select: none;
-khtml-user-select: none; -moz-user-select: none;
-ms-user-select: none; user-select: none;
padding: 0 4px; width: 4em;
color: #aaaaaa;
}
pre.numberSource { margin-left: 3em; border-left: 1px solid #aaaaaa; padding-left: 4px; }
div.sourceCode
{ }
@media screen {
pre > code.sourceCode > span > a:first-child::before { text-decoration: underline; }
}
code span.al { color: #ff0000; font-weight: bold; } /* Alert */
code span.an { color: #60a0b0; font-weight: bold; font-style: italic; } /* Annotation */
code span.at { color: #7d9029; } /* Attribute */
code span.bn { color: #40a070; } /* BaseN */
code span.bu { color: #008000; } /* BuiltIn */
code span.cf { color: #007020; font-weight: bold; } /* ControlFlow */
code span.ch { color: #4070a0; } /* Char */
code span.cn { color: #880000; } /* Constant */
code span.co { color: #60a0b0; font-style: italic; } /* Comment */
code span.cv { color: #60a0b0; font-weight: bold; font-style: italic; } /* CommentVar */
code span.do { color: #ba2121; font-style: italic; } /* Documentation */
code span.dt { color: #902000; } /* DataType */
code span.dv { color: #40a070; } /* DecVal */
code span.er { color: #ff0000; font-weight: bold; } /* Error */
code span.ex { } /* Extension */
code span.fl { color: #40a070; } /* Float */
code span.fu { color: #06287e; } /* Function */
code span.im { color: #008000; font-weight: bold; } /* Import */
code span.in { color: #60a0b0; font-weight: bold; font-style: italic; } /* Information */
code span.kw { color: #007020; font-weight: bold; } /* Keyword */
code span.op { color: #666666; } /* Operator */
code span.ot { color: #007020; } /* Other */
code span.pp { color: #bc7a00; } /* Preprocessor */
code span.sc { color: #4070a0; } /* SpecialChar */
code span.ss { color: #bb6688; } /* SpecialString */
code span.st { color: #4070a0; } /* String */
code span.va { color: #19177c; } /* Variable */
code span.vs { color: #4070a0; } /* VerbatimString */
code span.wa { color: #60a0b0; font-weight: bold; font-style: italic; } /* Warning */
claude-plans-backup
claude-plans-backup
A hardened Claude Code config backup/restore skill. Moves a Claude
Code setup to a new machine (or rebuilds it after a
wipe/reinstall) without losing your skills, plugins, MCP servers, hooks,
agents, CLAUDE.md, and memory.
When it's worth running
Scenario
What survives on its own
What this tool is for
New machine / clean reinstall
nothing — ~/.claude doesn't exist there yet
the core use case: back up here, restore there to
rebuild marketplaces, plugins, MCP, hooks, agents,
CLAUDE.md, and memory
Same machine, account switch only (e.g. personal →
Enterprise via /login)
everything — /login swaps credentials but leaves
~/.claude intact
a rollback snapshot to take before you
switch; you normally won't run restore at all
Notes for the same-machine case:
- Your
--resumehistory is preserved automatically — the
transcripts never move. - The switch is mostly just
/logininto the new account,
then/mcpto re-auth OAuth servers (token-based MCP servers
keep working — their token lives in~/.claude.json, which
stays put). - If the new account pushes managed settings that
overwrite yoursettings.json, pull just that file out of
the backup tarball — don't run the full restore (it would reinstall
plugins that are already there).
How it works
-
Captures the whole setup, including the easy-to-miss
pieces. Settings, skills, commands, agents, hooks, globalCLAUDE.md, keybindings, and tmux config — withagents/,hooks/, andCLAUDE.md
explicitly included and hook scripts re-chmod'd on
restore. -
Strips credentials two ways. Removes
secret-named keys and redacts
secret-shaped values (sk-ant-, JWTs,ghp_,AKIA, PEM) fromsettings.jsonand~/.claude.json..credentials.jsonis never included. -
Restores without clobbering. Merges onlymcpServersinto the targetsettings.json
(backing the original up first), so it leaves an account's managed
settings intact.~/.claude.jsonis touched only if you
explicitly opt in. -
Previews before it acts. Restore prints its full
plan and changes nothing until you pass--apply. -
Safe by construction. Restore runs commands from
explicit args (noeval), the tarball is written0600, and.gitignorekeeps it (confidential
config/memory, and transcripts if you opt in) out of version
control.
Install (make it an active
skill)
Then invoke in Claude Code with /claude-config-backup,
or just run the scripts directly.
Back up (old machine /
current account)
bash skills/claude-config-backup/scripts/backup.sh --dry-run # preview inventory
bash skills/claude-config-backup/scripts/backup.sh # build tarball in $HOME
# options: --yes (no prompts), --out DIR (write elsewhere)Produces ~/claude-backup-YYYY-MM-DD-HHMM.tar.gz (mode
0600) containing a sanitized config,
RESTORE.md, MANIFEST.txt, and a bundled
restore-claude.sh.
By default the archive includes your settings, skills, commands,
agents, hooks, CLAUDE.md, and auto-memory
— but not conversation transcripts, which are opt-in
(the prompt defaults to no; --yes skips them).
They are the bulk of the data and rarely needed on the new machine — see
below.
Restore (new machine /
Enterprise account)
# 1. install Claude Code, then: /login (into the new account)
tar xzf claude-backup-*.tar.gz -C ~/
bash ~/restore-claude.sh # PREVIEW by default — prints the plan, changes nothing
bash ~/restore-claude.sh --apply # execute (add --yes to accept all prompts)
# then: /mcp to reconnect servers (secrets are never backed up — OAuth or token re-auth)Restore previews by default: it runs the
claude CLI and settings changes only when you pass
--apply, so you can read the full plan before anything
mutates.
How
claude --resume works (and why transcripts are opt-in)
Each Claude Code session is stored locally as a .jsonl
file (the full message + tool-call history) under:
~/.claude/projects/<encoded-cwd>/<session-uuid>.jsonl
The subdirectory name is your working directory with
/ and . replaced by - (e.g.
/home/foo/bar.baz → -home-foo-bar-baz).
claude --resume lists the sessions for your
current directory's encoded folder and replays the chosen one
back into a fresh session. It is purely local and
file-based — no server or account state is involved.
Two consequences for migration:
-
Resume is account-independent. Switching
plans/accounts (e.g. Max → Enterprise) changes auth/billing, not your
transcripts. On the same machine, resume works regardless of which
account you're logged into. -
Resume is path-dependent. It keys off the encoded
working directory. On a new machine, restored transcripts only surface
under--resumeif you stand in a directory whose path
matches the original (same username + same repo paths → works). If paths
differ, the.jsonlfiles restore fine but won't be listed —
the history isn't lost, just not one-click resumable (the files are
plain JSON).
So transcripts are off by default: they're large
(often gigabytes), and resume continuity only pays off when the new
machine keeps the same paths. Include them (answer yes at the
prompt) when you want full --resume history and
the target machine will use the same username and repo locations.
What it never touches
~/.claude/.credentials.json, token/secret values,
plugins/cache/, and runtime state (sessions/,
telemetry/, daemon/,
file-history/, history.jsonl).
Security notes
- The tarball is written
0600and holds auto-memory (and
transcripts, if you opt in) = confidential content even
after sanitization. Keep it on managed storage, not personal cloud. - Hook/skill scripts are archived verbatim, not scanned. Keep secrets
in env/keychain, never hard-coded in a script. - An Enterprise account may push managed settings;
restore only merges mcpServers rather than overwritingsettings.json, so it won't fight org policy.