Multi-account profile isolation for AI CLI tools like Claude Code and Codex.
This project provides isolated profile wrappers for AI CLI tools, allowing you to maintain separate configurations, authentication, and workspaces for different contexts (e.g., personal vs. work accounts).
AI CLI tools like Claude Code and Codex typically store their configuration, authentication tokens, and chat history in your home directory:
~/.config/claude/- Claude Code settings & auth~/.codex/- Codex settings & auth
This makes it difficult to:
- Use different accounts for work and personal projects
- Keep work and personal chat histories separate
- Switch between profiles without re-authenticating
This project creates wrapper scripts that run AI CLIs in isolated environments:
claude-work- Claude Code with isolated config/auth in~/.claude-work/codex-work- Codex with isolated config/auth in~/.codex-work/
Each wrapper maintains its own:
- ✅ Authentication credentials
- ✅ Configuration settings
- ✅ Chat/conversation history
- ✅ Cached data
- macOS or Linux
zshshell- Claude Code CLI installed (for claude-work)
- Codex CLI installed (for codex-work)
bash install-claude-work.shThis will:
- Create
~/.ai-cli-profiles/claude-workwrapper - Add
~/.ai-cli-profilesto your PATH in~/.zshrc - Set up isolated environment in
~/.claude-work/
bash install-codex-work.shThis will:
- Create
~/.ai-cli-profiles/codex-workwrapper - Add
~/.ai-cli-profilesto your PATH in~/.zshrc - Set up isolated environment in
~/.codex-work/
Restart your terminal or run:
source ~/.zshrc# Personal account (default)
claude --version
claude login
# Work account (isolated)
claude-work --version
claude-work loginEach profile maintains separate:
- Login credentials
- Settings in
~/.config/claude/vs~/.claude-work/home/.config/claude/ - Chat history
# Personal account (default)
codex --version
codex login
# Work account (isolated)
codex-work --version
codex-work loginEach profile maintains separate:
- API keys/auth
- Settings in
~/.codex/vs~/.codex-work/ - Conversation history
ai-cli-profiles/
├── README.md # This file
├── install-claude-work.sh # Claude work profile installer
└── install-codex-work.sh # Codex work profile installer
After installation, you'll have:
~/.ai-cli-profiles/
├── claude-work # Claude work wrapper script
└── codex-work # Codex work wrapper script
~/.claude-work/ # Claude work profile data
└── home/
├── .config/claude/ # Isolated config
├── .cache/ # Isolated cache
└── .local/ # Isolated data
~/.codex-work/ # Codex work profile data
└── (Codex configuration)
The claude-work wrapper:
- Creates an isolated
HOMEdirectory at~/.claude-work/home/ - Sets environment variables to redirect XDG paths:
XDG_CONFIG_HOMEXDG_CACHE_HOMEXDG_DATA_HOMEXDG_STATE_HOME
- Adjusts
PATHto include the isolated.local/bin - Executes the real
claudebinary with the isolated environment
The codex-work wrapper:
- Sets
CODEX_HOMEto~/.codex-work/ - Executes the
codexbinary with the isolated environment
You can create additional profiles by:
- Copying an install script
- Changing the wrapper name (e.g.,
claude-client-a,codex-project-x) - Changing the sandbox directory (e.g.,
~/.claude-client-a,~/.codex-project-x) - Running the modified script
To remove a profile:
# Remove wrapper
rm ~/.ai-cli-profiles/claude-work
rm ~/.ai-cli-profiles/codex-work
# Remove isolated data
rm -rf ~/.claude-work
rm -rf ~/.codex-work
# Remove from PATH (edit ~/.zshrc and remove the line)
# export PATH="$HOME/.ai-cli-profiles:$PATH"MIT
Feel free to open issues or submit pull requests!