CCM — Claude Code Manager
The power-user toolkit for Claude Code. Manages accounts, sessions, environments, and usage from the terminal.
GitHub: https://github.com/dr5hn/ccm
1. Installation Check
Before running any CCM command, verify it's installed:
ccm version
If not found, install it:
curl -fsSL https://raw.githubusercontent.com/dr5hn/ccm/main/install.sh | bash
This installs to ~/.ccm/bin/ccm — no sudo required. After install, the user needs to restart their terminal or source ~/.zshrc.
2. Command Reference
Account Management
| Command |
Description |
ccm add |
Add current logged-in Claude account |
ccm remove <id> |
Remove account by number, email, or alias |
ccm switch [id] |
Switch to next account, specific, or project-bound |
ccm undo |
Revert to previous account |
ccm list |
List all managed accounts and project bindings |
ccm alias <id> <name> |
Set friendly name (e.g., ccm alias 1 work) |
ccm reorder <from> <to> |
Reorder account positions |
ccm bind [path] <account> |
Bind project directory to an account |
ccm unbind [path] |
Remove project binding |
ccm bind list |
Show all project bindings |
ccm hook |
Output shell hook for auto-switch on cd (global mode — rewrites creds) |
ccm hook --isolated |
Shell hook that sets CLAUDE_CONFIG_DIR per-shell on cd (config + history isolation, not credentials) |
ccm verify [id] |
Verify backup integrity |
ccm history |
Show recent switch history |
ccm export <path> |
Export accounts to archive |
ccm import <path> |
Import from archive |
Session Management
| Command |
Description |
ccm session list |
List all project sessions with size, age, status |
ccm session info <project-path> |
Detailed info for a project's sessions |
ccm session search <query> [--limit N] |
Full-text search across all sessions |
ccm session relocate <old> <new> |
Update sessions after moving a project folder |
ccm session summary [path] [--limit N] |
What happened in each session (topic, tools, files) |
ccm session clean [--dry-run] |
Find and remove orphaned sessions |
ccm session archive [--older-than Nd] |
Compress old sessions to tar.gz |
ccm session restore <archive> |
Restore from archive |
ccm session archives |
List all archives |
Environment Snapshots
| Command |
Description |
ccm env snapshot [name] |
Save current Claude Code configuration |
ccm env restore <name> [--force] |
Restore from a snapshot |
ccm env list |
List all snapshots |
ccm env delete <name> |
Remove a snapshot |
ccm env audit |
Audit MCP servers for token efficiency |
Usage Stats
| Command |
Description |
ccm usage summary |
Claude Code footprint overview |
ccm usage top [--count N] |
Top projects by disk usage |
ccm usage history [--days N] [--project <path>] |
Token usage by project and day |
ccm usage sessions [--project <path>] [--days N] |
Per-session tokens and estimated cost |
ccm usage dashboard [--days N] [--account <name>] |
Per-account token usage |
ccm usage compare |
Side-by-side account comparison |
Health & Maintenance
| Command |
Description |
ccm doctor |
14 health checks (disk, tmp, processes, hooks, locks, cache) |
ccm doctor --fix |
Auto-fix safe issues |
ccm clean debug [--days N] |
Clean debug logs (default: older than 30 days) |
ccm clean telemetry |
Remove telemetry data |
ccm clean todos [--days N] |
Remove old todo files |
ccm clean history [--keep N] |
Trim history.jsonl (default: keep 1000) |
ccm clean tmp [--days N] |
Clean orphaned tmp output files (default: 1 day) |
ccm clean processes |
Kill orphaned Claude subagent processes (macOS) |
ccm clean cache |
Clean plugin cache (old versions) |
ccm clean all [--dry-run] |
Clean everything safe to clean |
Profiles & Monitoring
| Command |
Description |
ccm switch --isolated <account> |
Switch with CLAUDE_CONFIG_DIR isolation (config + history, not credentials) |
ccm profiles list |
List all isolated profiles |
ccm profiles sync <name> |
Sync settings to a profile |
ccm profiles delete <name> |
Remove a profile |
ccm watch --threshold N [--auto] |
Monitor rate limits, auto-switch accounts |
ccm watch stop |
Stop the watcher |
ccm watch status |
Show watcher state |
ccm recover |
Fix inconsistent credential state |
ccm codex status |
Show Codex CLI rate limits, plan, model, and token usage |
ccm setup |
First-run setup wizard |
Project Setup
| Command |
Description |
ccm init |
Auto-generate .claudeignore for detected project type |
ccm init --force |
Overwrite existing .claudeignore |
Statusline
| Command |
Description |
ccm statusline |
Install smart statusline in Claude Code |
ccm statusline install |
Same as above |
ccm statusline remove |
Remove statusline and settings |
Standalone install (no CCM needed): curl -fsSL https://raw.githubusercontent.com/dr5hn/ccm/main/statusline.sh | bash
Shows: context bar, tokens, session cost, duration, burn rate, 5hr/7d rate limits, directory, branch, version.
Permission Rules
| Command |
Description |
ccm permissions audit |
Scan for duplicates, contradictions, verbatim rules, bloat |
ccm permissions audit --fix |
Auto-remove duplicate rules |
3. Common Workflows
First-time setup
# Install CCM
curl -fsSL https://raw.githubusercontent.com/dr5hn/ccm/main/install.sh | bash
source ~/.zshrc
# Run the setup wizard (adds accounts, sets aliases, installs statusline)
ccm setup
Daily account switching
ccm switch work # switch to work account
ccm switch personal # switch back
ccm undo # revert last switch
Project-specific accounts
ccm bind ~/work/project work # bind project to work account
ccm bind ~/personal/side-project personal
ccm bind list # show all bindings
# Now `ccm switch` in a bound directory auto-switches to the right account
Auto-switch on cd (shell hook)
# Add to ~/.zshrc or ~/.bashrc — pick ONE mode:
# Global mode (simple, rewrites ~/.claude creds on each cd):
eval "$(ccm hook)"
# Isolated mode (recommended when you use multiple terminals at once):
eval "$(ccm hook --isolated)"
# Sets CLAUDE_CONFIG_DIR in THIS shell only, so each terminal keeps its own
# config and session history. NOTE: credentials are NOT isolated — Claude Code
# reads those from the macOS Keychain / ~/.claude/.credentials.json regardless
# of CLAUDE_CONFIG_DIR (upstream: anthropics/claude-code#70697).
cd ~/work/project # → auto-switches to work account
cd ~/personal/side # → auto-switches to personal account
Token usage analytics
ccm usage history # last 7 days, all projects
ccm usage history --days 30 # last 30 days
ccm usage history --project . # current project only
Search conversation history
ccm session search "error handling" # find across all sessions
ccm session search "API" --limit 5 # limit results
Concurrent sessions
ccm switch --isolated work # isolated profile for terminal 1
# In another terminal:
ccm switch --isolated personal # isolated profile for terminal 2
ccm profiles list # see all active profiles
ccm profiles sync work # sync latest settings to a profile
Rate limit monitoring
ccm watch --threshold 80 # alert when rate limit hits 80%
ccm watch --threshold 80 --auto # auto-switch accounts at threshold
ccm watch status # check watcher state
ccm watch stop # stop monitoring
Install statusline
ccm statusline # install — shows cost, tokens, rate limits, branch
ccm statusline remove # uninstall
New project setup
ccm init # auto-generate .claudeignore
ccm permissions audit # check for dead/duplicate permission rules
Disk cleanup
ccm doctor # see what's eating space (13 checks)
ccm doctor --fix # auto-fix safe issues
ccm clean tmp # clean orphaned tmp output files
ccm clean processes # kill leaked subagent processes
ccm clean all --dry-run # preview all cleanups
Moving a project folder
# After moving ~/old-project to ~/new-location/project:
ccm session relocate ~/old-project ~/new-location/project
Before risky config changes
ccm env snapshot before-experiment
# ... make changes ...
ccm env restore before-experiment # if things break
4. Important Notes
- After switching accounts, restart Claude Code for changes to take effect
ccm doctor --fix only removes data older than 30 days — recent data is never touched
- Environment snapshots do NOT capture credentials — only configuration
ccm switch --isolated isolates config and session history per terminal, but NOT credentials — that is blocked upstream (anthropics/claude-code#70697)
ccm codex status is read-only: it parses Codex's own session rollout files and never writes to ~/.codex
- Install statusline before using
ccm watch (provides rate limit data)
- Session relocate updates both session files and memory references
- Project bindings are auto-cleaned when an account is removed
- Orphaned process detection is macOS only (ppid=1 unreliable on Linux)
1---2name: ccm3description: Claude Code Manager — manage accounts, sessions, environments, and optimize token usage. Use when the user mentions switching Claude accounts, cleaning up sessions, environment snapshots, disk usage, token optimization, Claude Code health check, orphaned sessions, orphaned processes, tmp files, MCP audit, project bindings, session search, token usage history, account reorder, profiles, isolated, concurrent sessions, CLAUDE_CONFIG_DIR, isolated hook, watch, rate limit, auto-switch, dashboard, session archive, setup wizard, recover, usage dashboard, usage compare, claudeignore, permission rules, statusline, status bar, or says "ccm", "doctor", "clean cache", "clean tmp", "session list", "session search", "env snapshot", "bind", "unbind", "reorder", "usage history", "init", "permissions audit", "statusline", "ccm watch", "ccm profiles", "ccm setup", "ccm recover", "ccm hook", "hook --isolated", "codex", "codex status", "codex usage", "codex rate limit".4---56# CCM — Claude Code Manager78The power-user toolkit for Claude Code. Manages accounts, sessions, environments, and usage from the terminal.910**GitHub:** https://github.com/dr5hn/ccm1112## 1. Installation Check1314Before running any CCM command, verify it's installed:1516```bash17ccm version18```1920If not found, install it:2122```bash23curl -fsSL https://raw.githubusercontent.com/dr5hn/ccm/main/install.sh | bash24```2526This installs to `~/.ccm/bin/ccm` — no sudo required. After install, the user needs to restart their terminal or `source ~/.zshrc`.2728## 2. Command Reference2930### Account Management3132| Command | Description |33|---------|-------------|34| `ccm add` | Add current logged-in Claude account |35| `ccm remove <id>` | Remove account by number, email, or alias |36| `ccm switch [id]` | Switch to next account, specific, or project-bound |37| `ccm undo` | Revert to previous account |38| `ccm list` | List all managed accounts and project bindings |39| `ccm alias <id> <name>` | Set friendly name (e.g., `ccm alias 1 work`) |40| `ccm reorder <from> <to>` | Reorder account positions |41| `ccm bind [path] <account>` | Bind project directory to an account |42| `ccm unbind [path]` | Remove project binding |43| `ccm bind list` | Show all project bindings |44| `ccm hook` | Output shell hook for auto-switch on cd (global mode — rewrites creds) |45| `ccm hook --isolated` | Shell hook that sets `CLAUDE_CONFIG_DIR` per-shell on cd (config + history isolation, not credentials) |46| `ccm verify [id]` | Verify backup integrity |47| `ccm history` | Show recent switch history |48| `ccm export <path>` | Export accounts to archive |49| `ccm import <path>` | Import from archive |5051### Session Management5253| Command | Description |54|---------|-------------|55| `ccm session list` | List all project sessions with size, age, status |56| `ccm session info <project-path>` | Detailed info for a project's sessions |57| `ccm session search <query> [--limit N]` | Full-text search across all sessions |58| `ccm session relocate <old> <new>` | Update sessions after moving a project folder |59| `ccm session summary [path] [--limit N]` | What happened in each session (topic, tools, files) |60| `ccm session clean [--dry-run]` | Find and remove orphaned sessions |61| `ccm session archive [--older-than Nd]` | Compress old sessions to tar.gz |62| `ccm session restore <archive>` | Restore from archive |63| `ccm session archives` | List all archives |6465### Environment Snapshots6667| Command | Description |68|---------|-------------|69| `ccm env snapshot [name]` | Save current Claude Code configuration |70| `ccm env restore <name> [--force]` | Restore from a snapshot |71| `ccm env list` | List all snapshots |72| `ccm env delete <name>` | Remove a snapshot |73| `ccm env audit` | Audit MCP servers for token efficiency |7475### Usage Stats7677| Command | Description |78|---------|-------------|79| `ccm usage summary` | Claude Code footprint overview |80| `ccm usage top [--count N]` | Top projects by disk usage |81| `ccm usage history [--days N] [--project <path>]` | Token usage by project and day |82| `ccm usage sessions [--project <path>] [--days N]` | Per-session tokens and estimated cost |83| `ccm usage dashboard [--days N] [--account <name>]` | Per-account token usage |84| `ccm usage compare` | Side-by-side account comparison |8586### Health & Maintenance8788| Command | Description |89|---------|-------------|90| `ccm doctor` | 14 health checks (disk, tmp, processes, hooks, locks, cache) |91| `ccm doctor --fix` | Auto-fix safe issues |92| `ccm clean debug [--days N]` | Clean debug logs (default: older than 30 days) |93| `ccm clean telemetry` | Remove telemetry data |94| `ccm clean todos [--days N]` | Remove old todo files |95| `ccm clean history [--keep N]` | Trim history.jsonl (default: keep 1000) |96| `ccm clean tmp [--days N]` | Clean orphaned tmp output files (default: 1 day) |97| `ccm clean processes` | Kill orphaned Claude subagent processes (macOS) |98| `ccm clean cache` | Clean plugin cache (old versions) |99| `ccm clean all [--dry-run]` | Clean everything safe to clean |100101### Profiles & Monitoring102103| Command | Description |104|---------|-------------|105| `ccm switch --isolated <account>` | Switch with CLAUDE_CONFIG_DIR isolation (config + history, not credentials) |106| `ccm profiles list` | List all isolated profiles |107| `ccm profiles sync <name>` | Sync settings to a profile |108| `ccm profiles delete <name>` | Remove a profile |109| `ccm watch --threshold N [--auto]` | Monitor rate limits, auto-switch accounts |110| `ccm watch stop` | Stop the watcher |111| `ccm watch status` | Show watcher state |112| `ccm recover` | Fix inconsistent credential state |113| `ccm codex status` | Show Codex CLI rate limits, plan, model, and token usage |114| `ccm setup` | First-run setup wizard |115116### Project Setup117118| Command | Description |119|---------|-------------|120| `ccm init` | Auto-generate .claudeignore for detected project type |121| `ccm init --force` | Overwrite existing .claudeignore |122123### Statusline124125| Command | Description |126|---------|-------------|127| `ccm statusline` | Install smart statusline in Claude Code |128| `ccm statusline install` | Same as above |129| `ccm statusline remove` | Remove statusline and settings |130131Standalone install (no CCM needed): `curl -fsSL https://raw.githubusercontent.com/dr5hn/ccm/main/statusline.sh | bash`132133Shows: context bar, tokens, session cost, duration, burn rate, 5hr/7d rate limits, directory, branch, version.134135### Permission Rules136137| Command | Description |138|---------|-------------|139| `ccm permissions audit` | Scan for duplicates, contradictions, verbatim rules, bloat |140| `ccm permissions audit --fix` | Auto-remove duplicate rules |141142## 3. Common Workflows143144### First-time setup145```bash146# Install CCM147curl -fsSL https://raw.githubusercontent.com/dr5hn/ccm/main/install.sh | bash148source ~/.zshrc149150# Run the setup wizard (adds accounts, sets aliases, installs statusline)151ccm setup152```153154### Daily account switching155```bash156ccm switch work # switch to work account157ccm switch personal # switch back158ccm undo # revert last switch159```160161### Project-specific accounts162```bash163ccm bind ~/work/project work # bind project to work account164ccm bind ~/personal/side-project personal165ccm bind list # show all bindings166# Now `ccm switch` in a bound directory auto-switches to the right account167```168169### Auto-switch on cd (shell hook)170```bash171# Add to ~/.zshrc or ~/.bashrc — pick ONE mode:172173# Global mode (simple, rewrites ~/.claude creds on each cd):174eval "$(ccm hook)"175176# Isolated mode (recommended when you use multiple terminals at once):177eval "$(ccm hook --isolated)"178# Sets CLAUDE_CONFIG_DIR in THIS shell only, so each terminal keeps its own179# config and session history. NOTE: credentials are NOT isolated — Claude Code180# reads those from the macOS Keychain / ~/.claude/.credentials.json regardless181# of CLAUDE_CONFIG_DIR (upstream: anthropics/claude-code#70697).182183cd ~/work/project # → auto-switches to work account184cd ~/personal/side # → auto-switches to personal account185```186187### Token usage analytics188```bash189ccm usage history # last 7 days, all projects190ccm usage history --days 30 # last 30 days191ccm usage history --project . # current project only192```193194### Search conversation history195```bash196ccm session search "error handling" # find across all sessions197ccm session search "API" --limit 5 # limit results198```199200### Concurrent sessions201```bash202ccm switch --isolated work # isolated profile for terminal 1203# In another terminal:204ccm switch --isolated personal # isolated profile for terminal 2205ccm profiles list # see all active profiles206ccm profiles sync work # sync latest settings to a profile207```208209### Rate limit monitoring210```bash211ccm watch --threshold 80 # alert when rate limit hits 80%212ccm watch --threshold 80 --auto # auto-switch accounts at threshold213ccm watch status # check watcher state214ccm watch stop # stop monitoring215```216217### Install statusline218```bash219ccm statusline # install — shows cost, tokens, rate limits, branch220ccm statusline remove # uninstall221```222223### New project setup224```bash225ccm init # auto-generate .claudeignore226ccm permissions audit # check for dead/duplicate permission rules227```228229### Disk cleanup230```bash231ccm doctor # see what's eating space (13 checks)232ccm doctor --fix # auto-fix safe issues233ccm clean tmp # clean orphaned tmp output files234ccm clean processes # kill leaked subagent processes235ccm clean all --dry-run # preview all cleanups236```237238### Moving a project folder239```bash240# After moving ~/old-project to ~/new-location/project:241ccm session relocate ~/old-project ~/new-location/project242```243244### Before risky config changes245```bash246ccm env snapshot before-experiment247# ... make changes ...248ccm env restore before-experiment # if things break249```250251## 4. Important Notes252253- After switching accounts, restart Claude Code for changes to take effect254- `ccm doctor --fix` only removes data older than 30 days — recent data is never touched255- Environment snapshots do NOT capture credentials — only configuration256- `ccm switch --isolated` isolates config and session history per terminal, but NOT credentials — that is blocked upstream (anthropics/claude-code#70697)257- `ccm codex status` is read-only: it parses Codex's own session rollout files and never writes to `~/.codex`258- Install statusline before using `ccm watch` (provides rate limit data)259- Session relocate updates both session files and memory references260- Project bindings are auto-cleaned when an account is removed261- Orphaned process detection is macOS only (ppid=1 unreliable on Linux)