Backing up and restoring Claude Code configuration and memory
claude-codebackupconfigmemoryskillsgit
Claude Code keeps its state in several places: global settings, the MCP config in the home directory, skills, plugins, plans, and per-project memory and session transcripts. Justin backs all of it up to a git repo with three scripts and a /cfg skill, so a machine rebuild or a bad edit can be undone.
What lives where
| Backup repo path | Live path |
|---|---|
global/settings.json |
~/.claude/settings.json |
global/settings.local.json |
~/.claude/settings.local.json |
global/claude.json |
~/.claude.json (MCP servers; in HOME, not ~/.claude/) |
skills/ |
~/.claude/skills/ |
plugins/*.json |
~/.claude/plugins/ |
plans/*.md |
~/.claude/plans/ |
projects/<name>/memory/ |
~/.claude/projects/<name>/memory/ |
projects/<name>/sessions/*.jsonl |
~/.claude/projects/<name>/*.jsonl (flat at the project root) |
Project directory names are the absolute path with every non-alphanumeric character replaced by - (/home/justin/dev/tldr becomes -home-justin-dev-tldr; a directory named with an emoji becomes several dashes).
The tooling
- Repo
~/dev/claude-config/; scriptsbackup.sh,restore.sh,diff.shin~/claude-code-backup-guide/scripts/;backup-config.jsonin the repo lists which projects to include. /cfg ssaves (and adds the current project tobackup-config.jsonif missing),/cfg rrestores non-interactively (--yes),/cfg lsdiffs backup against live.- Restart Claude Code after a restore for settings to take effect.
Gotchas
- Settings and
~/.claude.jsoncan contain API keys and tokens for MCP servers; keep the backup repo private. - Session transcripts are large; include only the projects you care about.
- Memory directories also hold
ai-activity.jsonllogs written by headless runs (claude-service (ProcrastinAI's webhook runner for headless Claude)); they are part of the record worth keeping.
Finding a past conversation
With no memory notes to go on, grep -i <words> ~/.claude/history.jsonl lists every prompt typed into Claude Code with its project (working directory) and sessionId; then look in that directory for files the session wrote. The full transcripts under ~/.claude/projects/<dir>/*.jsonl may already have been cleaned up (a July 2026 freight-brokerage session survived only as the files it left in ~/dev/dad), which is why every project should save its own memory at the end of a session.