I've been using Claude Code heavily for a few months. Skills, custom rules, MCP configs, memories across a dozen projects. Built up a nice setup.
Then I thought: what happens if this laptop dies tomorrow?
I went looking for where Claude Code actually stores everything. It's... a lot of places.
~/.claude/
├── CLAUDE.md # your global instructions
├── settings.json # global settings
├── memories/ # things Claude remembers about you
├── skills/ # custom skills/commands
├── rules/ # behavior rules
├── plans/ # saved plans
├── projects/ # per-project memories, encoded paths
│ ├── -home-you-project-a/
│ │ └── memory/
│ └── -home-you-project-b/
│ └── memory/
# PLUS every project directory:
~/myproject/.claude/
├── CLAUDE.md
├── settings.json
├── skills/
└── rules/
A typical power user has 600+ items spread across 8+ scopes. Most of these files you probably never manually touched. Claude Code creates them quietly in the background as you work.
And none of it is backed up by default.
Lose the machine, lose everything. The memories Claude built about your codebase. The skills you wrote. The MCP configurations that took you an afternoon to get right. All of it.
Manual backup is impractical because you'd have to know every location, remember to run it, and do it consistently. That last part is what actually kills you.
What claude-code-backup does
It's a tool that discovers every Claude Code file across all scopes (global and every project), copies them to ~/.claude-backups/latest/, and commits the diff to a private GitHub repo.
The scanner is extracted from Claude Code Organizer, so it knows exactly where to look. Not just ~/.claude/. It finds project-scoped .claude/ directories too, and decodes those hashed paths under ~/.claude/projects/.
What it backs up:
- Memories (global + per-project)
- Skills (full directories, not just manifests)
- MCP configurations
- Rules
- Agents and commands
- CLAUDE.md files (global and project-level)
- Settings
- Plans
- Sessions
- Plugins
The export lands in ~/.claude-backups/latest/ as a clean directory tree. Git tracks it, so you get full version history. If you accidentally delete a rule or a memory gets corrupted, you can diff back to any previous state.
The automation part
This is where it gets actually useful. The tool sets up a systemd timer on Linux or a LaunchAgent on macOS.
It runs on boot and again every few hours. The Linux timer has Persistent=true, which means if your machine was off when a scheduled run was supposed to happen, it catches up on the next boot. You don't need to remember anything. You don't need it to be running in a terminal somewhere.
The setup is one command (check the repo README for exact usage). After that, it just works in the background.
Why git history matters here
Your settings aren't static. Claude Code memories change as you work. You add a rule, then modify it a week later, then realize the old version was better. MCP configs drift.
Most backup tools give you a snapshot. Git gives you a timeline. You can see exactly when a setting changed, diff it against any previous version, and restore individual files without rolling back everything.
For something like Claude Code memories, which change incrementally over time, this is the right storage model.
The private GitHub repo also means your settings follow you across machines. New laptop, new dev container, whatever. Check out the repo and you have your full Claude Code environment back.
The scanner
The part I find interesting technically is the discovery logic. Claude Code doesn't store all project configs in one place. When you work in /home/you/projects/myapp, Claude Code creates a directory at ~/.claude/projects/-home-you-projects-myapp/ (the path gets encoded). Then there's also myapp/.claude/ for project-level settings.
The scanner knows both of these patterns. It walks your filesystem looking for .claude/ directories and cross-references them against the encoded paths in ~/.claude/projects/. A naive glob would miss half the files.
This scanner is the same one that powers Claude Code Organizer. It's been tested on real setups with hundreds of items across many projects, not just a toy ~/.claude/ with three files in it.
Who this is for
If you're a light Claude Code user with a single project and no custom configuration, you probably don't need this. The default settings aren't precious.
But if you've spent time building up your Claude Code setup (custom skills, rules tuned to your workflow, per-project memories, MCP configurations), then you have something worth protecting. The more you've invested in configuration, the more painful it is to lose.
Power users who work across multiple projects especially benefit. You might have 10+ project scopes, each with their own memories and rules. That's a lot of state to reconstruct from scratch.
I wrote this because I couldn't find anything that actually solved this problem. There are general dotfiles backup tools, but they don't know about Claude Code's directory structure or the encoded project paths. You'd have to figure out all the locations yourself and maintain the list as Claude Code's storage format evolves.
This is a dedicated solution. It knows where everything is.
mcpware
/
claude-code-backup
Automatic backup of all Claude Code settings to GitHub
Claude Code Backup
Automatic backup of all your Claude Code settings to GitHub. One command to set up, runs on boot and every few hours.
What gets backed up
Everything Claude Code stores across your machine, not just ~/.claude/:
- Memories (127 files across 8 scopes in my setup)
- Skills (full directories, recursively)
- MCP server configs (every .mcp.json, .claude.json, settings-embedded servers)
- Rules, Agents, Commands (.md files)
- CLAUDE.md files (global + every project)
- Settings (settings.json, settings.local.json)
- Plans (.md files)
- Sessions (.jsonl conversation files)
- Plugins (cached plugin directories)
It uses the same scanner as Claude Code Organizer to discover items across all scopes (global + every project directory you've ever opened Claude Code in).
Quick start
npx @mcpware/claude-code-backup init
This will:
- Scan your Claude Code settings and show what it found
- Ask for your GitHub repo URL
- Ask your preferred backup interval (default: every 4 hours)
- Install a systemd timer (Linux) or…
⭐ Star the repo if you've ever lost settings you worked hard to build.
Top comments (0)