Copying an existing setup
On this page
If you used Claude Code before ccam, your setup lives in ~/.claude and ~/.claude.json. ccam migrate copies it into a share group, so every account that shares those items through the group starts with the setup you already have. The source folder is only read, and plain claude keeps working as before. Run it once after your first ccam add; when ~/.claude.json has MCP servers, the first ccam add names them in its tip.
Usage
Copying with the checklist
ccam migrateccam migrate copies from ~/.claude into the group default. On a terminal, without item options and without --yes, ccam first shows a checklist:
Copy into group default
From /home/me/.claude
Choose what to copy (Space to toggle)
❯ [✔] MCP servers
[✔] settings.json
[✔] global CLAUDE.md
[✔] skills, agents, commands, plugins
[ ] conversation history
space to toggle · enter to show the plan · esc to cancelSpace (or x) toggles the item under the cursor, the arrow keys or j/k move, Enter shows the plan, and Esc, q or Ctrl+C prints Cancelled.. Items the source has nothing for are marked not found. If you uncheck everything, ccam prints Nothing selected. and stops.
Then ccam prints the plan and asks before it copies:
$ ccam migrate --yes
Copy from /home/me/.claude into group default (/home/me/.local/share/ccam/groups/default):
mcp ~/.claude.json new: fs, linear
sign-ins not copied (a sign-in works for one account only); sign in with /mcp: linear in personal, work
settings settings.json new: 61 B
not found, skipped: keybindings.json
memory CLAUDE.md new: 11 B
extensions agents/ add 1 file the group lacks (6 B)
skills/ add 1 file the group lacks (13 B)
not found, skipped: commands/, plugins/, output-styles/, rules/
Conversation history (projects/, history.jsonl) is not included; add --history to copy it.
✓ Copied into group default: 2 MCP servers, settings.json, CLAUDE.md, agents/, skills/
MCP sign-ins are not copied (a sign-in works for one account only). Sign in with /mcp to linear in personal, work.
Group default: personal, workA group affects only its own accounts, and only the items it shares, so the summary lists the group's accounts. When the group does not share one of the copied items, or some accounts are not in it, ccam prints the ccam group set <group> --add <items> and ccam group join <group> <accounts> commands that change that.
Previewing the plan
ccam --dry-run migrate--dry-run prints the plan and stops before any question or copy. The checklist still appears, so you can preview a selection.
Choosing items without the checklist
ccam migrate --settings --mcp
ccam migrate --history --yesItem options copy only the items you name, and ccam shows no checklist:
--settings:settings.json;--memory: the globalCLAUDE.md;--extensions:agents/,commands/,skills/,plugins/,output-styles/andrules/;--mcp: the user MCP servers (mcpServersin.claude.json);--history: the conversation history (projects/andhistory.jsonl).
-y or --yes copies without asking, and on a conflict keeps the group's copy. When you give no item options and ccam shows no checklist, because there is no terminal or you gave --yes, it copies everything except conversation history, which is left out by default because projects/ can be large.
Copying from another folder or into another group
ccam migrate ~/.claude-work --group workThe folder argument names the Claude Code folder to copy from; without it, ccam uses ~/.claude. -g or --group names the group to copy into; without it, default. The names on, off, local and none are refused, for example with "off" cannot be a group name.
How it works
ccam builds a complete plan before it copies anything: it picks the items, reads the source and the group, and plans every path. Nothing is written until you confirm.
- Find the source. ccam refuses a path that is missing, not a folder, or holds no known Claude Code entry. For MCP servers alone, an empty or missing
~/.claudeis fine as long as~/.claude.jsonhas servers. ccam finds the.claude.jsonthat belongs to the folder: inside it, or for~/.claudewithout one inside,~/.claude.jsonnext to it. That is where Claude Code keeps it whenCLAUDE_CONFIG_DIRis not set. - Map items to paths. Every path comes from the same allow list groups use. The MCP servers are read out of
.claude.jsonby scanning for that one key rather than parsing the whole file. - Copy, never move. Files go to
~/.local/share/ccam/groups/<group>/through a temporary file beside the target that is then renamed, so an interrupted copy never leaves a partial file. MCP servers go into the group'smcp.jsonunder its lock: a server that another ccam process adds in the meantime is kept, and the copies made for Remote Control are updated afterwards.
Each item maps one source path to one group path:
The two history rows are dashed because they are copied only with --history. .credentials.json and .claude.json are on ccam's list of files never shared and never reach the group: ccam stops with an internal error if one ever shows up among the paths, and the folder walk skips them by name.
ccam gives every path a state, which is what each plan line describes:
- Missing: not in the source, or a file where a folder is expected. Listed once per item as
not found, skipped. - Linked: the source path already resolves to the group's copy, for example when the source is a ccam profile folder.
- Same: the group already has identical content.
- New: the group lacks it, so it is copied whole.
- Merge: a folder on both sides. ccam adds only the files the group lacks; files that differ stay as the group has them and the plan says
group copies kept. Forplugins/, the registriesinstalled_plugins.jsonandknown_marketplaces.jsonare merged, and the absolute plugin paths are rewritten to point at the group's folder. - Conflict: a file on both sides with different content. You choose per file:
keep group,use mine, plusmerge JSONfor.jsonfiles (a deep merge in which the group wins on clashing values) ormerge by lineforhistory.jsonl. An MCP server whose definition differs is a conflict too, withkeep grouporuse mine. The first choice listed is the default when you press Enter;--yesalways keeps the group's copy.
The checklist is the same kind ccam add uses; ccam marks missing items by checking the paths and the MCP server list.
MCP sign-ins
MCP servers that sign in with OAuth keep their tokens in the login file, .credentials.json under mcpOAuth, not in the server list. ccam does not copy them. A copied sign-in holds the same refresh token as the original, and the server rotates that token at the first renewal: every other holder, the source ~/.claude included, is then logged out of that server. So for each copied server the source is signed in to, the plan's sign-ins line lists the group's accounts that must sign in themselves with /mcp, and the summary repeats it. An entry without a token is not a sign-in and is not listed, nor is an account that has its own sign-in already, or a server whose definition the group keeps. No login file is written.
Safety and edge cases
- The source is only read. No file in it is moved, linked or changed, and the source login is never written, including on macOS where it may be read from the Keychain.
- Before a group file is replaced, by
use mine, a merge, or new MCP servers in an existingmcp.json, the group's copy is saved in<group>/.ccam-backup/<time>/. The folder name is unique per run, so two runs in the same second do not overwrite each other's backups. The summary prints the path. - With
--yes, every conflict keeps the group's copy, and ccam says how to choose instead: run the same command without--yes. - If nothing would change, ccam prints
Nothing to copy.; if every conflict keeps the group's copy,Nothing to copy: the group keeps its own copies. - If a copy fails halfway, ccam stops with
The source folder was not changed. Group files replaced so far are saved infollowed by the backup folder. Running it again copies the files that were not copied completely. - When several groups share MCP, the commands that
ccam doctor,ccam extandccam mcp listsuggest readccam migrate --mcp --group <a|b>. - A missing source ends with
no Claude Code folder at <path>. Give the folder to copy from: ccam migrate <folder>.