Skip to content

Repository files navigation

cprof — one personal Claude subscription, one for work; the right account per repository, without thinking about it

CI License Platform Bash Requires Tests

You have two Claude subscriptions. Claude Code has one login.

Log in for work, and your side project bills the company. Log in for yourself, and the work repo runs on a personal account. Switching means logging out, logging back in, and remembering which one you are on — every time you change directory.

cprof makes the directory decide.

cd into a work repo and claude runs as work; cd into a side project and it runs as personal; cprof list shows both profiles with their 5-hour and 7-day usage bars

Each profile is its own Claude config directory with its own credentials, so the accounts never touch. A default covers most of your work, a directory rule routes a whole tree, and a per-repository pin overrides both.

$ cprof list
PROFILE   PLAN  ACCOUNT            5H              7D              FLAGS
work      team  you@acme.com       ▓▓▓▓░░░░░░ 42%  ▓▓░░░░░░░░ 18%  native
personal  max   you@personal.dev   ▓▓▓▓▓▓▓▓▓░ 91%  ▓▓▓▓▓▓░░░░ 60%  (default) (active)

$ cd ~/dev/acme/api && cprof which
work  native (keychain)  rule ~/dev/acme

Install

brew install dcotelo/tap/cprof

Or without Homebrew — no sudo, installs to ~/.local, needs jq on PATH. Download the installer, read it, then run it:

curl -fsSLO https://raw.githubusercontent.com/dcotelo/cprof/main/install.sh && less install.sh

then, once it reads right:

bash install.sh

Then one line in your shell config, and you are done:

claude() { eval "$(cprof env)"; command claude "$@"; }

The Claude Code plugin is optional and adds the ambient parts — a warning when you walk into a directory expecting a different account, /profile, and the statusline — the account, the model, the directory and its branch, and bars for the context window and the usage window:

claude plugin marketplace add dcotelo/cprof
claude plugin install cprof@dcotelo

Quickstart walks the whole setup — profiles, rules, default — in about two minutes. Requires macOS; Homebrew pulls in jq, and usage data needs curl, which macOS ships. Install details covers the plugin-only path and updating.

Why it is built this way

  • Nothing is moved, nothing is re-authenticated. Your existing login stays exactly where it is, as a native profile. Adding cprof to a working setup changes nothing about that setup.
  • Your customisations follow you. A Claude config directory holds plugins, skills, settings and CLAUDE.md as well as credentials — so a naive profile switch would silently switch away everything you have installed. cprof links them, and never links the files that identify you.
  • It cannot lose your account. login snapshots the keychain first and restores it if a profile login writes to the shared item. env never exits non-zero, so a broken config degrades to stock Claude Code rather than a broken shell.
  • You can see it at a glance. Every profile has a colour, hashed from its name so two profiles differ with no configuration at all — and you can pick your own:

work in magenta personal in green client in cyan

Docs · Routing · Install details · Commands · Statusline · Usage and fallback · Safety

Quickstart

Five steps, about two minutes. Needs macOS.

# 1. install the CLI (jq comes with it), and the plugin for the ambient parts
brew install dcotelo/tap/cprof
claude plugin marketplace add dcotelo/cprof
claude plugin install cprof@dcotelo

# 2. route `claude` through it
cat >> ~/.zshrc <<'RC'
claude() { eval "$(cprof env)"; command claude "$@"; }
RC
exec zsh

# 3. keep the account you already use, then add a second one
cprof add work --native        # adopts your current keychain login
cprof add personal             # ~/.claude-profiles/personal, sharing
                                       # your plugins, skills and settings
cprof login personal           # interactive, opens a browser

# 4. choose the default profile, and route one tree to the other
cprof default personal
cprof rule add ~/dev/<company> work

# 5. confirm
cprof list
cprof which
$ cprof list
PROFILE   PLAN  ACCOUNT            5H              7D              FLAGS
work      team  you@<company>.com  ▓▓▓▓░░░░░░ 42%  ▓▓░░░░░░░░ 18%  native
personal  max   you@personal.dev   ▓▓▓▓▓▓▓▓▓░ 91%  ▓▓▓▓▓▓░░░░ 60%  (default) (active)

$ cd ~/dev/<company>/api && cprof which
work  native (keychain)  rule ~/dev/<company>

That is the whole setup. From here claude picks the account for you; the only rule to remember is that a change takes effect on the next claude launch, never in a running session, because credentials are read at process start.

Nothing was moved or re-signed-in along the way: --native adopts your existing login where it already lives, and step 3's login writes only inside the new profile's own directory.

What you get

Usage you can see before you hit it

Two accounts means two rate limits, and the one you are about to hit is rarely the one you are looking at. cprof list carries each profile's 5-hour and 7-day windows as a bar; cprof usage <name> adds the per-model weekly limits and when each window resets.

cprof list with 5H and 7D usage bars per profile, cprof usage work showing the full breakdown with reset times, and cprof doctor warning that personal is at 91% of its 5-hour window

A profile that runs out can hand the session to a fallback account instead of stopping.

A statusline that answers "which account is this?"

One line inside the session: the account, the model, the directory and its branch, then bars for the context window and the usage window.

cprof statusline --full rendering the account, model, directory and branch with context and usage bars; the same session after narrowing the layout to a six-cell usage bar; and cprof doctor reporting a rejected statusline.bar.width setting

Which segments appear, how they are laid out, the bar glyphs and width, the warning thresholds and every colour are configurable — and cprof doctor names any setting it rejects rather than failing quietly. See Statusline.

Documentation

Doc What is in it
Routing How a directory decides the account: defaults, rules, repository pins, resolution order, importing a directory you already use
Install details The plugin-only path, what the installer writes, updating, uninstalling
Commands Every subcommand and what it does
Statusline Segments, layout, bars, thresholds, the colour palette, and what cprof doctor reports
Usage and fallback Usage headroom, the 5-hour and 7-day windows, and fallback accounts
Safety Keychain snapshots, what cprof never touches, and the security assessment
Contributing Development setup, conventions, dependency policy, releasing

Found a bug? Open an issue — templates are provided. Security problems go through private vulnerability reporting instead; see SECURITY.md. Contributions: CONTRIBUTING.md.

License

MIT — see LICENSE.

Maintained by @dcotelo · dcotelo.dev

About

Per-repository Claude account switching: keep personal and work subscriptions separate.

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

5 stars

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages