A bash wrapper around the claude CLI that automatically switches Claude profiles based on your current working directory. Useful when you have multiple Claude accounts (e.g. personal and work clients).
cld reads a list of profile names and symlinks ~/.claude and ~/.claude.json to the matching profile's data before launching Claude. The active profile is selected by matching profile names against your current directory path — the last match wins, with the first profile in the list as the default.
1. Clone or copy claude.bash somewhere permanent:
git clone https://github.com/canshield-digital/cld.git ~/tools/cld2. Source it in your shell config (~/.bashrc or ~/.zshrc):
source ~/tools/cld/claude.bash3. Create the profile list:
mkdir -p ~/.config/claude-profiles
cat > ~/.config/claude-profiles/list <<EOF
personal
client-a
client-b
EOFThe first entry (personal) is the default when no directory match is found.
4. First run:
If ~/.claude and ~/.claude.json already exist (from a prior claude install), cld will prompt you to migrate them into the default profile on first run:
** ~/.claude or ~/.claude.json exist as real files — looks like first run **
** Move them to profile 'personal' in ~/.config/claude-profiles? [y/N]
Enter y to migrate automatically, then log in to the remaining profiles separately.
Use cld exactly as you would use claude:
cld # launches Claude with the auto-selected profile
cld "explain this" # passes arguments through to claudeGiven the profile list:
personal
client-a
client-b
| Working directory | Selected profile |
|---|---|
~/personal/notes |
personal |
~/work/client-a/project |
client-a |
~/work/client-b/site |
client-b |
~/other/random/dir |
personal (default) |
Switch into a directory matching each profile and run cld to authenticate:
cd ~/work/client-a && cld # logs in as client-a
cd ~/work/client-b && cld # logs in as client-b
cd ~/myproject && cld # logs in as personal (default)~/.config/claude-profiles/
├── list # one profile name per line
├── .claude-personal/ # Claude config dir for 'personal'
├── .claude-personal.json # Claude credentials for 'personal'
├── .claude-client-a/
├── .claude-client-a.json
├── .claude-client-b/
└── .claude-client-b.json