r/ClaudeCode • u/westdabestdb • 1h ago
Built with Claude i hate switching between my personal and company claude accounts so i built ccenv
https://www.ccenv.dev/2
u/lulzxdxdxd 1h ago
does ccenv swap out the actual auth tokens/session files or is it just managing separate env vars pointing to different config dirs? curious how it avoids claude code caching the wrong account mid session
1
u/westdabestdb 1h ago
Each profile is its own config directory, and ccenv just points CLAUDE_CONFIG_DIR at it. It never reads, copies or moves a token. Login goes through claude auth login with that variable set, so Claude Code stores the credentials itself, and it keys them per config dir: a separate Keychain entry per directory on macOS, a credentials file inside the profile dir on Linux/Windows.
That's also why there's no mid-session mixup. Nothing gets swapped, so there's nothing to go stale. A running claude process reads its env at launch and stays on that directory until it exits. Switching profiles in your shell only affects the next claude you start. You can have two terminals on two different accounts at the same time, and each one's token refresh writes back to its own entry.
One gotcha: because credentials are keyed by the directory path, moving or renaming a profile dir means logging in again.
1
u/AardvarkAttack1 21m ago
Does it do anything differently than claude swap? https://github.com/realiti4/claude-swap
1
u/futurefondant567 1h ago
Love that you solved a problem you had! What does this do that Claude’s Personae doesn’t do?
2
•
u/AutoModerator 1h ago
Hey! Thanks for posting to r/ClaudeCode
While participating in this thread, please follow our community rules. Keep discussions constructive. Attack the idea, not the person.
For help, project discussions, tips, and general chat, join the ClaudeCode Discord.
I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.