Features

Continuing at the limit

By jhyunwoo
Last updated November 30, 2026
Checked with ccam 0.16.1 and Claude Code 2.1.302

On this page

When a usage limit stops Claude Code, you can wait for the reset or go on right away as another of your accounts. ccam gives you four ways to go on:

  • ccam next --continue opens this folder's last conversation as another account, whether or not the two share history (below). Plain ccam next opens a new session as the next account.
  • Inside Claude Code, the ccam plugin tells you when a limit stops a session, and /ccam:switch hands the conversation on.
  • With automatic switching turned on (Linux and macOS), ccam moves an interactive session that Claude Code stops at its limit by itself.
  • For scripts that run claude -p, ccam --fallback runs the command again as another account (below).

Usage

Switching to the next account

ccam next

ccam next starts a new Claude Code session as the next account: the logged-in account after the one you used last, in number order. ccam prints the switch as → <from> → <to> on standard error, then starts Claude Code as the new account the same way ccam <name> does. <from> is the account you used last, or with --continue the account the conversation belongs to.

Team and Enterprise seats. Automatic account selection (ccam next, --fallback, ccam pick, ccam agent, the dashboard's n and, once you turn it on, auto_switch) also switches between seats of the same Claude Team or Enterprise organization, which may violate Anthropic's terms. Read the FAQ and check with your organization and Anthropic before you rely on it.

Choosing the account with the most room

ccam next --auto
ccam next --auto --max-usage 80
ccam next --auto --strategy balance

--auto looks up every account's usage at once, as ccam usage does, and picks the logged-in account with the most room, skipping accounts at 100% (how). The → line then gives the reason for the choice. Two options change how it ranks the accounts:

  • --max-usage <1-100>: accounts below this usage come first, and the others only when none is below it. Without the option, auto_max_usage in config.toml applies, otherwise 100.
  • --strategy headroom|expiring|balance: headroom takes the least weekly usage among the accounts within 3 points of the lowest 5-hour usage, expiring the account whose 5-hour window resets first, and balance the one with the most weekly quota left per day (strategies). Without the option, auto_strategy applies, otherwise headroom.
ccam next --auto --cross-org
ccam next --auto --wait
  • --cross-org: also choose accounts of another organization. Without it, ccam stays in the organization of the account you switch from, unless cross_org = true (organizations).
  • --wait[=<duration>]: when no account has room, wait for the first one to reset instead of exiting with code 75. ccam waits at most 5 hours, or as long as you give (--wait=2h). The value goes after =: --wait 2h is refused with the hint --wait takes its value after '=': --wait=2h (details).

These four options work only together with --auto.

Continuing the conversation

ccam next --continue
ccam next -c --auto
ccam next -c --brief

--continue (-c) opens this folder's last conversation on the new account instead of a new session, whether or not the two accounts share history. Together with --auto, the conversation goes to the account with the most room. --continue below explains how ccam finds the conversation and carries it over.

--brief works only with --continue. Instead of resuming the whole conversation, the new account starts a new one from a summary ccam writes of the last one, so it does not read the whole conversation again (--brief).

Passing options to Claude Code

ccam next -c --auto -- --dangerously-skip-permissions

Unlike ccam <name>, which passes everything after the name on, ccam next reads its arguments itself. Claude Code's own options, such as --dangerously-skip-permissions or --model, therefore go after --, and ccam passes them to claude unchanged; with --continue, the --resume arguments come before them. Without the --, ccam stops with ccam: unknown flag: --dangerously-skip-permissions.

Previewing the choice

ccam --dry-run next --auto

--dry-run prints → <from> → <to> and the command line ccam would run, without starting Claude Code or recording a launch, so the rotation does not move on. With --continue as well, it also says which conversation it would continue:

$ ccam --dry-run next --auto --continue
→ personal → work (12% of its 5 hours used, the least)
  continuing "Fix the flaky tests" (about 182k tokens); work does not share personal's history, so Claude Code copies it into work
CLAUDE_CONFIG_DIR=/home/you/.local/share/ccam/profiles/work CCAM_PROFILE=work /usr/local/bin/claude --resume /home/you/.local/share/ccam/profiles/personal/projects/-home-you-code-app/4f1c….jsonl --fork-session

How it works

Every launch through ccam writes its time to ~/.local/state/ccam/last-used/<name>, and ccam next reads these files to know which account you used last.

  1. ccam lists the accounts that have a working login: a Claude login in .credentials.json, or on macOS in the Keychain, that has not fully expired or been cleared by Claude Code. Accounts that use an API key have no plan limits and are never chosen.
  2. Without --auto, ccam takes turns: it starts after the account you used last and takes the next logged-in account in number order. With --continue, it starts at the account that holds the conversation and stays in its organization, unless cross_org = true.
  3. With --auto, ccam looks up every account's usage at once, as ccam usage does, and takes the one with the most room. Accounts at 100%, accounts of another organization (unless --cross-org) and folders logged in to the same Claude account are left out.
  4. ccam then starts the chosen account exactly as ccam <name> would: it checks the account's links, applies MCP sharing, registers the session and replaces itself with Claude Code (Switching accounts).

How ccam picks an account explains both rules step by step, with the settings that change them (auto_max_usage, auto_strategy, cross_org) and what happens when no account has room: ccam exits with code 75, or with --wait waits for the first reset.

--continue

  1. ccam looks for this folder's last conversation in every account: of the <session>.jsonl files in projects/<folder>/ (the folder name is the working folder, links resolved, with every character other than a letter or digit turned into -, as Claude Code names it), the one with the newest prompt or reply. Sessions without one, such as a session that only ran /mcp, /usage or /status, or an empty file, are skipped. If a session left a note (a usage limit or /ccam:switch, see below) and no conversation has a prompt or reply more than 2 minutes after it, that exact session is used instead; the rows Claude Code writes at /exit do not count.
  2. The account it belongs to is the one you switch from, and the new account is chosen as above, within the same organization unless cross_org = true (or --cross-org with --auto). When several accounts share that history, it belongs to the one whose .claude.json says it ran the conversation last (lastSessionId), otherwise to the one used last.
  3. If the new account shares that history (the same group folder), ccam starts claude --resume <session id>, that very conversation (--continue would open whichever is newest in the folder).
  4. Otherwise it starts claude --resume <the conversation's file> --fork-session: Claude Code copies the whole conversation, under a new session ID, into the new account's own history, and the original stays as it was. From then on the new account's --continue finds it.
  5. Unless you give --agent after --, ccam also passes on the agent the conversation runs as: the agent setting of the folder's .claude/settings.local.json or .claude/settings.json or of the account's settings.json, else the agent the conversation's last agent-setting row names. Claude Code does not bring the agent back when it copies a conversation (step 4), and would go on as its default agent, with every tool. When the new account does not share the old one's agents, plugins and settings (the same agents and plugins folders and settings.json, through a group), ccam adds a line after the one about the move: work does not share personal's agents, plugins and settings, so it may not have agent "reviewer" or may define it differently: the conversation may go on without that agent's tool limits.

ccam says how big the conversation is: the new account reads all of it again with its first reply. Prompt caches are never shared between organizations, and every personal plan is an organization of its own, so when the two accounts belong to different ones ccam adds prompt caches are not shared between organizations, so the first reply reads it all again. When the old account is signed in to MCP servers the new one is not, ccam names them: work is not signed in to MCP servers that personal is signed in to: linear (sign in with /mcp there; sign-ins are not shared). Sharing history in a group avoids the copy, keeps one conversation, and also shares the checkpoints /rewind restores code from (file-history/).

--brief

--continue resumes the whole conversation, and the new account reads all of it again with its first reply. ccam next --continue --brief starts a new conversation instead, from a summary that ccam writes of the old one without asking a model:

$ ccam next --auto --continue --brief
→ personal → work (12% of its 5 hours used, the least)
  starting a new conversation with ccam's summary of "Fix the flaky tests" instead of resuming it (about 182k tokens)
  summary (6k characters): /home/you/.local/state/ccam/brief/4f1c….md

The summary holds, in this order and only where there is something to say:

  1. the conversation's title;
  2. the path of its transcript, for Claude to search when it needs a detail;
  3. your first request, when there were more than four;
  4. the summary Claude Code wrote when it last compacted the conversation;
  5. your last four requests, with ! commands and slash commands as you typed them;
  6. Claude's last reply;
  7. the todo list;
  8. the 10 files Claude changed last;
  9. the folder's git status --short --branch, up to 800 characters.

The todo list keeps at most 10 items: finished items are dropped first, then the steps furthest ahead, so the current step and the next ones stay. Long parts are cut in the middle, and the whole summary stays under 16,000 characters.

ccam saves it as ~/.local/state/ccam/brief/<session>.md, readable only by you, and the next --brief removes summaries older than 7 days. Claude Code starts with one prompt, and attaches the file it mentions: Read @"<the summary>", the summary ccam wrote of my earlier Claude Code conversation, which is not loaded here. Then reply with one or two sentences on where the work stands, and wait for my next message. A prompt you give after -- takes the place of the last sentence (Then: <your prompt>), and your other options after -- follow it.

Claude Code ends a mention at a " and cuts it at a #, so when the summary's path has either, ccam mentions it by its path relative to the working folder; when that path has one too, the prompt names the file, and Claude reads it with its Read tool, which asks first because the file is outside the working folders (in a -p run in Manual mode, Claude Code denies the read and Claude goes on without the summary).

ccam --dry-run next --continue --brief prints the summary and saves nothing. The old conversation stays as it was, and the new one knows only what the summary says, so use --brief when the task matters more than every detail of how you got there. Without --continue, ccam stops with --brief works with --continue; when it cannot read the conversation or finds nothing in it to summarize, it stops and says that ccam next --continue without --brief resumes it whole. The relay and auto_switch always resume the whole conversation. Claude Code's own --brief option goes after --, like its other options.

Inside Claude Code

The ccam plugin adds two hooks (Claude Code 2.1.78 or later):

  • When a turn stops at a usage limit, it notes the conversation and shows a desktop notification in terminals that support one (iTerm2, WezTerm, Windows Terminal, kitty, Ghostty): ccam: work hit its 5-hour limit (resets 3:45pm). `ccam next --continue` continues the conversation on another account.

    It knows every message Claude Code counts as a usage limit: the 5-hour, weekly, plain and model limits (You've hit your session limit, You've hit your limit, You've reached your … for a model's allowance), usage credits and spend limits, and an organization that stopped the account.

    When Claude Code has written the refused request into the conversation, the hook also records the full window until its reset (the limit record), except for a stop set by an organization, which its admins can lift at any time. A short server throttle or an API key's rate limit is not a usage limit and is left alone, and so are unattended sessions (-p runs and background sessions). A subagent or workflow agent that stops at a usage limit counts as its session's stop, even while the main conversation only waits for it: Claude Code writes that refused request into the agent's own file in the session's subagents folder, and the hook reads it there. When several agents stop at once, the session gets one note and one notification.

    Claude Code 2.1.234 and later also waits in the session and continues by itself after a 5-hour reset; the notification gives you the choice to switch instead, and with auto_switch on (Linux and macOS), ccam switches for you when another account has room. When no other account may take over, because no other account belongs to the same Team or Enterprise organization, or none is another personal plan (with cross_org on, any other Claude account may), the notification ends with You have no other personal plans, so ccam cannot move this conversation. or You have no other accounts in Acme, so ccam cannot move this conversation. instead.

  • /ccam:switch [account] notes the conversation and ends the turn before any request is made: type /exit, then run ccam next --continue to continue it on the account you named (or on the next one). In a session that has no conversation yet, it says there is nothing to continue. Only what you type runs it: from plugin 0.3.2, Claude cannot run /ccam:switch, and a job Claude schedules (CronCreate, ScheduleWakeup or .claude/scheduled_tasks.json) passes it to Claude as plain text.

    When the account you name is outside the conversation's organization (a seat of another Team or Enterprise organization, a personal plan for a seat or the other way around, or an API key account on either side), ccam next --continue asks first, whatever cross_org says: ccam: /ccam:switch named home, a personal plan, but this conversation is on work, a Claude Team seat in Acme. Move it to home? [y/N]. It asks the same before an account it picks itself when you name none, which cross_org = true lets it take from another organization: ccam: the account picked for /ccam:switch is home, a personal plan, …. Only y or yes moves it; on Linux and macOS, keys typed before the question are dropped first. Any other answer, or no terminal to ask on, leaves the conversation and the note where they are: the conversation stays on work, a Claude Team seat in Acme: it moves to home, a personal plan, only when you answer yes on a terminal. `ccam next --continue` asks again, and `ccam work --resume <session id>` continues it as work (after a pick, ccam next --continue picks again). As with automatic choices, an account whose organization ccam cannot tell fits any.

The note lives in ~/.local/state/ccam/handoff/<account>/<session>.json, one file per session, so two sessions of one account never overwrite each other's. It is kept for 12 hours and used once, when the next session is about to start; a launch that fails leaves it for the next try. It belongs to the folder the session started in, even after a cd in Claude Code's shell. ccam rename updates the names in it; if the account it names has since been removed, ccam says so and chooses as usual.

Relay

With relay = true at the top of config.toml, ccam keeps running alongside interactive sessions instead of replacing itself with Claude Code, and after /ccam:switch it continues that session's conversation by itself (a note another session left is not acted on): the hook ends Claude Code, and ccam runs ccam next --continue with that session's note. Without an account named, it takes the one with the most room, counting the conversation's model, and when cross_org = true lets that be an account of another organization, it asks the question above before it moves the conversation there. On Windows the hook cannot end Claude Code: type /exit, and ccam continues it. Nor does the hook end it for an account outside the conversation's organization: it says ccam: type /exit; ccam then asks whether to continue this conversation on home, a personal plan (work is a Claude Team seat in Acme)., and ccam asks the question above once you have typed /exit. That costs one waiting ccam process per session, which is why it is off by default.

The relayed session keeps what resuming a conversation does not restore: options such as --add-dir, --mcp-config, the tool lists, --settings, --plugin-dir and the system prompt options, the conversation's permission mode, the session's effort level and the agent the conversation runs as (see --continue). Claude Code itself restores --model and --name from the conversation. Anything else (--worktree, --debug, --remote-control, options ccam does not know) is named in ccam: not carried over: …. The switch never asks the shared-history question, and what you typed while it ran is dropped; its only question is the one before an account of another organization.

The relay continues the conversation only when Claude Code ended the way /ccam:switch asked it to: not when you typed /exit first, pressed Ctrl+C while it ended, or ccam got a hangup or another signal, and not when the terminal is gone. The note then stays, and ccam next --continue continues it later. A session started under the relay of an older version of ccam, or an unattended one (-p runs and background sessions), is not ended by the hook; it gets the /exit message instead. claude remote-control runs without a relay.

auto_switch

With auto_switch = true at the top of config.toml (Linux and macOS), ccam makes the move itself when Claude Code stops an interactive session at a usage limit and another account of the same kind has room: the plugin's hook ends Claude Code, and ccam continues the conversation there the way the relay does after /ccam:switch. It is off by default and experimental, and turning it on may break the terms of your plan. Automatic switching explains how to turn it on, when it moves a session, what a move costs, what it never does and what Anthropic's terms say.

Run again at the limit

ccam next is for an interactive session that has stopped. A non-interactive run, claude -p in a script or a scheduled job, cannot wait for you, so --fallback before the account name lets ccam switch for it:

ccam --fallback work -p "fix the failing tests" --output-format json
ccam --fallback -p "summarise" < notes.txt
ccam run --fallback work -p "review the diff"

Without an account name, as in the second line, the first attempt runs as the folder's account or the default one. ccam run --fallback work is the long form of ccam --fallback work.

$ ccam --fallback personal -p "summarise" < notes.txt
ccam: personal reached its usage limit; running the command again as work
Summary: …
  1. --fallback works only together with -p or --print; otherwise ccam stops and points to ccam next --auto --continue.
  2. Piped standard input is read once, up to 10 MiB, and given to every attempt. Like Claude Code, ccam waits at most 3 seconds for it to start (except with --input-format stream-json); if a pipe stays open but sends nothing, the run gets no input and ccam notes this on standard error.
  3. ccam starts claude as a child process instead of exec, holds its standard output back, and passes standard error through as it comes.
  4. When claude exits with 0, or fails for another reason, the held output and the exit code are passed on unchanged. So is a run ended by a signal (an exit code above 128): it was asked to stop, and is not run again.
  5. A failure counts as the usage limit when Claude Code's message says so, any of the usage-limit messages the hook knows, also inside --output-format json or stream-json output, or when the account's usage shows its 5-hour, weekly or --model window at 100% (a limit record included).
  6. Then the output of that attempt is dropped and the same command runs as another logged-in account: the one --auto would choose (how), then accounts whose usage cannot be looked up, in number order. Accounts at 100% are skipped, accounts with an API key login are never tried, and each account is tried at most once.
  7. With -c, --continue, -r or --resume among the arguments, only accounts in the same history group are tried, so the conversation can be found.
  8. Only accounts of the same organization are tried, as with --auto (cross_org = true lifts this).

The next account is chosen by the same rules as --auto (auto_max_usage, auto_strategy, the --model window). When no account is left, ccam prints the last attempt's output, says that no logged-in account has room left, and exits with code 75. With --wait before the account name (ccam --fallback --wait=2h work -p …), it waits for the first account to reset instead, then may try every account again; it always sleeps at least once first, so an account that has just hit its limit is not run again at once. The duration limits the total waiting time of the run, not each wait. Written with a space (--wait 30m), it is refused with the same hint as ccam next. A leading -- before Claude Code's arguments works as for any launch (ccam --fallback work -- -p …). ccam --dry-run --fallback work -p … prints the command of the first attempt.

Interactive sessions are not switched on their own unless you turn on auto_switch. With ccam statusline install, the status line adds → ccam next --auto --continue once the 5-hour or weekly usage reaches 90%, unless it wraps a status line command of your own (Usage of every account).

Safety and edge cases

  • Accounts without a login are never chosen. With no other logged-in account, plain ccam next stops with no logged-in account other than <name>.
  • With --continue and no conversation in the folder: no account has a conversation in <folder> to continue.
  • With --auto, when the organization rule leaves no account: no logged-in account to pick among <name>'s (<organization>); --cross-org also looks at the others.
  • With --auto and no logged-in account: no logged-in account to pick. When every account is full or its usage is unknown: no account with known usage and headroom (see `ccam usage`). Both end with exit code 75.
  • --max-usage, --strategy, --wait and --cross-org work only with --auto, and a value outside 1-100 or an unknown strategy is refused.
  • A fork copies the conversation, not the account's other state: checkpoints of the original account's file-history/ do not come along unless history is shared.
  • --auto makes network requests even with --dry-run. It only reads, and never writes token files.
  • The chosen account starts through the same path as ccam <name>, so the same checks apply, including the warning when another Claude Code session sharing the same history is already running in this folder.
  • last-used is only written when Claude Code actually starts. --dry-run leaves it alone, so a dry run does not move the rotation forward.
  • --fallback holds standard output until an attempt ends, so streaming output such as --output-format stream-json arrives in one piece at the end. A client that streams stream-json input and waits for replies before it sends more cannot use --fallback. Files the first attempt changed before it hit the limit stay changed; the next attempt starts the prompt again.