A Go CLI tool for managing multiple isolated Claude Code configuration environments.
claudenv allows you to maintain separate Claude Code configurations for different projects or workflows. It manages your ~/.claude directory and ~/.claude.json file by creating isolated environments under ~/.claudenv and using symlinks to switch between them seamlessly.
- Multiple Environments: Create and manage isolated Claude configurations (main, work, personal, project-specific, etc.)
- Safe Initialization: Automatically backs up your existing Claude config into a "main" environment
- Easy Switching: Switch between environments with a single keypress
- Interactive TUI: User-friendly terminal interface built with Bubble Tea
- Smart Protection: Prevents accidental deletion of active or main environments
- Empty Environment Detection: Different confirmation flows for empty vs. populated environments
go install github.com/mickstar/claudenv/cmd/claudenv@latestMake sure $GOPATH/bin (usually ~/go/bin) is in your PATH.
git clone https://github.com/mickstar/claudenv.git
cd claudenv
go build -o claudenv ./cmd/claudenvNote: Pre-built binaries are not provided to avoid the complexity of code signing requirements (especially for macOS). The Go installation method is simple and works across all platforms.
Simply run:
claudenvOn first run, you'll be prompted to initialize the environment system:
- Press
ito initialize - Your existing
~/.claudeand~/.claude.jsonwill be moved to~/.claudenv/main/ - Symlinks will be created in their place
Navigation:
↑/↓ork/j- Navigate between environmentsEnter- Switch to the selected environment
Actions:
n- Create a new environmentd- Delete the selected environmentqorCtrl+C- Quit
Creating an Environment:
- Press
nto open the create dialog - Enter a name for your environment
- Optionally toggle "Switch to this environment once created" (checked by default)
- Press
Enterto create, orEscto cancel
Deleting an Environment:
- Select the environment you want to delete
- Press
d - Confirm deletion:
- For empty environments: Type
yto confirm - For environments with data: Type
DELETE(case-sensitive) to confirm
- For empty environments: Type
Note: You cannot delete the "main" environment or the currently active environment.
claudenv creates a directory structure like this:
~/.claudenv/
├── main/
│ ├── .claude/
│ └── .claude.json
├── work/
│ ├── .claude/
│ └── .claude.json
└── personal/
├── .claude/
└── .claude.json
When you switch environments, claudenv updates the symlinks:
~/.claude→~/.claudenv/<active-env>/.claude~/.claude.json→~/.claudenv/<active-env>/.claude.json
Claude Code automatically populates these directories on first use, so new environments start empty and get configured naturally when you run Claude Code.
claudenv stores its configuration in ~/.claudenv.json:
{
"environments": [
{"name": "main"},
{"name": "work"},
{"name": "personal"}
],
"location": "/Users/username/.claudenv",
"active": "main"
}- Go 1.21 or later (for installation)
- macOS, Linux, or Windows with symlink support
MIT License - see LICENSE file for details.
Created by mickstar
Issues and pull requests are welcome! Please feel free to contribute on GitHub.
