Switching accounts
On this page
You switch accounts by starting Claude Code as the account you want: ccam work, ccam 2, a shortcut such as ccwork, or the dashboard. Everything after the name goes to claude unchanged, so use it wherever you would type claude: in a terminal, in a script or with input piped in. A session stays on its account until it ends; to carry a conversation over to another account, see Continuing at the limit.
Usage
Starting an account
ccam work
ccam 2
ccam run workccam work starts Claude Code as the account work, and ccam 2 starts the account with number 2 in ccam list. ccam run work is the long form of ccam work; ccam run without a name starts the folder's account or the default one (below). Account names cannot be ccam command names such as add, list, run or usage, so ccam <word> is never ambiguous.
Passing arguments to Claude Code
ccam work --resume
ccam work -p "fix the tests" --output-format json
cat log.txt | ccam work -p "find the cause"ccam does not read the arguments after the account name. It passes them to claude in the same order, so ccam work --resume runs claude --resume as work, and ccam work --help shows Claude Code's help. A -- after the name is optional. Standard input, the exit code and signals behave as with claude, so you can pipe input in and run it from scripts.
ccam reads its own options only before the account name: --dry-run and --fallback (below), -v or --version as the first argument, which prints ccam <version>, and -h or --help, which shows ccam's help as ccam --help or ccam run --help. After the name, every argument belongs to Claude Code, including --dry-run and --help.
Shortcut commands
A shortcut is a command of its own for one account, such as ccwork for work. ccam add offers to create one, and ccam shortcut adds one later:
$ ccam shortcut work ccwork
✓ shortcut for work: ccworkccwork --resume then does what ccam work --resume does. Shortcut commands covers renaming, removing and Windows.
The dashboard
ccam without arguments opens the dashboard when standard input and output are a terminal, and prints ccam list otherwise. Move to an account (with the arrows, or by typing its number) and press Enter to start it; n starts the account with the most room and o offers --continue, --resume or other arguments. The dashboard closes before Claude Code starts, so the terminal is restored first.
Without an account name
ccam -p "summarise"
ccam use work
ccam folder work ~/code/companyWhen the first argument starts with - and is not one of ccam's own flags, ccam picks the account for you and passes all arguments to Claude Code. It uses the account set for the current folder with ccam folder, otherwise the default account: the one set with ccam use, or the account with the lowest number if you have not set one (details).
ccam use work makes work the default account. ccam folder work ~/code/company makes work the account for that folder and every folder below it, whatever the default is.
Previewing a launch
ccam --dry-run work -p "fix the tests"--dry-run prints the command ccam would run and exits without starting Claude Code. It works as ccam --dry-run work, ccam run --dry-run work and ccam --dry-run (for the folder's account or the default), and --dry-run and --fallback can come in either order.
The dry run prints one line you could paste into a shell, or into PowerShell on Windows. It starts with what the launch changes in the environment: CLAUDE_CONFIG_DIR and CCAM_PROFILE always, env -u <name> for a variable it drops (such as an inherited CCAM_RELAY), and, for an API key account, its endpoint, its model and where the key comes from (ANTHROPIC_API_KEY="$WORK_KEY"), never the key itself:
$ ccam --dry-run work -p "fix the tests"
CLAUDE_CONFIG_DIR=/home/me/.local/share/ccam/profiles/work CCAM_PROFILE=work /home/me/.local/bin/claude --mcp-config=/home/me/.local/share/ccam/groups/default/mcp.json -p 'fix the tests'PS> ccam --dry-run work -p "fix the tests"
& { $saved = @{}; foreach ($k in 'CLAUDE_CONFIG_DIR','CCAM_PROFILE') { $saved[$k] = [Environment]::GetEnvironmentVariable($k) }; $env:CLAUDE_CONFIG_DIR='C:\Users\me\.local\share\ccam\profiles\work'; $env:CCAM_PROFILE='work'; try { $p = Start-Process -FilePath 'C:\Users\me\.local\bin\claude.exe' -ArgumentList '--mcp-config=C:\Users\me\.local\share\ccam\groups\default\mcp.json -p "fix the tests"' -NoNewWindow -Wait -PassThru; $global:LASTEXITCODE = $p.ExitCode } finally { foreach ($k in $saved.Keys) { [Environment]::SetEnvironmentVariable($k, $saved[$k]) } } }The PowerShell line puts the variables back afterwards, as VAR=x cmd does in a shell, and hands Claude Code its command line through Start-Process, so Windows PowerShell 5.1 and PowerShell 7 run it the same way. When a launch sets a variable to an empty value, a # line below it says that PowerShell before 7.5 removes such a variable instead. For a claude.cmd installed by npm, the line runs the cmd.exe command the launch would use (below), and an argument the launch would refuse there fails the dry run too.
Running again at the limit
ccam --fallback work -p "fix the tests"--fallback is for -p and --print runs. When the account reaches its usage limit, ccam runs the same command again as the logged-in account with the most room, and passes on only the output of the run that finished (how it decides). Without -p, ccam stops and points to ccam next --auto --continue.
How it works
A launch adds about 4 ms before Claude Code starts. ccam reads ~/.config/ccam/config.toml, finds the account, checks the links between the account folder and its groups, adds the group's MCP servers, records the session and replaces itself with claude, with CLAUDE_CONFIG_DIR set to the account folder and CCAM_PROFILE set to its name. Nothing of ccam keeps running, unless you turn on relay or auto_switch. How ccam works walks through each step.
Remote Control
ccam work rc (or ccam work remote-control) starts Claude Code's Remote Control as work. Remote Control sessions read MCP servers only from the account's .claude.json, so when the account shares MCP servers, ccam offers to copy them there first (Using Remote Control with ccam).
Safety and edge cases
- When the shell has
CLAUDE_CODE_OAUTH_TOKEN,ANTHROPIC_API_KEYorANTHROPIC_AUTH_TOKENset, Claude Code may use that key or token instead of the account's own login, so ccam warns you on standard error before it starts (ccam: $ANTHROPIC_API_KEY is set, so Claude Code may use that key instead of work's login…). It only reads the variables; an API key account clears them instead. - An unknown name or number stops with
no account "<name>"and points toccam list. With no accounts at all, ccam asks you to add one withccam add <name>. - If a shared path became an ordinary file or points to the wrong place, ccam stops with
stopped because of share link problems:, lists them, and asks you to runccam doctor --fix. It does not move data on the launch path. - If another Claude Code session that shares conversation history with this account (same group) is running in the same folder, ccam warns that the history can mix and asks
Run anyway? [y/N]. The folder is matched with symbolic links resolved. Without a terminal (standard input from/dev/nullcounts as none), or from a job in the background, it shows the warning and continues. A new-prun starts a conversation of its own and gets no warning;--version,--helpand subcommands that open no conversation, such asmcp,authorplugin, are not checked at all. --dry-runskips the MCP sync, the new-server notice, themcp listnote, the history check, the session marker, the title and the last-use time, and does not exec. It still checks share links, and creates a missing link as a normal launch would.ccam work rcwhileworkis already running leaves.claude.jsonalone, says so, and starts Remote Control without the group's servers; run it again after the session exits to copy them. With--dry-runit prints the message but neither asks nor copies.- With
mcp_strategy = "sync", a failed sync printsccam: MCP sync failed (launching anyway): …and Claude Code starts with the servers it already had. - On Windows, a
claude.cmdthat npm installed runs incmd.exewith its full path and every argument quoted, so thatcmd.exereads none of them as its own syntax (&,%PATH%). An argument with a line break cannot be passed that way and is refused, with the advice to install the native Claude Code.