A Rust CLI tool for managing multiple OpenCode profiles through isolated config and data directories.
opencode-multi enables multi-profile support for OpenCode by managing separate config and data environments. Each profile gets:
- Isolated configuration directory (
~/.config/opencode-multi/profiles/{name}/) - Isolated data directory (
~/.local/share/opencode-multi/profiles/{name}/) - Separate authentication state (separate
auth.jsonper profile)
This allows you to:
- Use different OpenCode accounts/providers per profile
- Maintain separate plugin configurations
- Keep work and personal environments completely isolated
cargo install opencode-multigit clone https://github.com/dominic-codespoti/opencode-multi.git
cd opencode-multi
cargo install --path .# Create two profiles
opencode-multi create work
opencode-multi create personal
# Or create profiles from your existing OpenCode setup
opencode-multi create work --init
opencode-multi create personal --init
# List profiles
opencode-multi list
# Run OpenCode with a profile
opencode-multi run work
# In another terminal, switch to personal profile
opencode-multi run personalCreate a new profile with scaffolded directory structure.
# Create a blank profile
opencode-multi create my-profile
# Create a profile initialized from existing OpenCode configuration
opencode-multi create my-profile --initWithout --init, creates:
~/.config/opencode-multi/profiles/{name}/~/.config/opencode-multi/profiles/{name}/plugins/~/.config/opencode-multi/profiles/{name}/commands/~/.config/opencode-multi/profiles/{name}/agents/~/.config/opencode-multi/profiles/{name}/modes/~/.local/share/opencode-multi/profiles/{name}/
With --init, copies your existing OpenCode config from ~/.config/opencode/ as the starting point.
Display all profiles with status information.
opencode-multi listOutput:
NAME CONFIG AUTH STATUS
work yes yes healthy
personal yes no needs-auth
Display detailed information about a profile.
opencode-multi show workLaunch OpenCode with the specified profile.
# Basic usage
opencode-multi run work
# With additional OpenCode arguments
opencode-multi run work -- --model openai/gpt-5Copy an existing profile to a new profile.
opencode-multi clone work work-backupDelete a profile and all its data.
# With confirmation prompt
opencode-multi remove old-profile
# Skip confirmation
opencode-multi remove old-profile --yesCheck system health and profile status.
opencode-multi doctorOutput:
[ok] opencode found at /usr/local/bin/opencode
[ok] Config root exists
[ok] Data root exists
[ok] Profile 'work' healthy
[warn] Profile 'personal' needs authentication
OpenCode reads configuration from a config directory and stores runtime data (including auth.json) in a data directory. opencode-multi works by:
- Managing separate config/data directories per profile
- Setting environment variables when launching OpenCode:
OPENCODE_CONFIG_DIR→ profile's config directoryXDG_DATA_HOME→ profile's data parent directoryOPENCODE_PROFILE→ profile name (for reference)
This approach requires no modifications to OpenCode itself.
~/.config/opencode-multi/
└── profiles/
├── work/
│ ├── opencode.json
│ ├── plugins/
│ ├── commands/
│ ├── agents/
│ └── modes/
└── personal/
├── opencode.json
├── plugins/
├── commands/
├── agents/
└── modes/
~/.local/share/opencode-multi/
└── profiles/
├── work/
│ └── opencode/
│ └── auth.json
└── personal/
└── opencode/
└── auth.json
# 1. Create work profile
opencode-multi create work
# 2. Run OpenCode and authenticate with work account
opencode-multi run work
# Inside OpenCode: /connect (authenticate with work provider)
# 3. Create personal profile
opencode-multi create personal
# 4. Run OpenCode and authenticate with personal account
opencode-multi run personal
# Inside OpenCode: /connect (authenticate with personal provider)
# 5. Switch between profiles anytime
opencode-multi run work # Uses work auth
opencode-multi run personal # Uses personal auth- Rust 1.70+ (for building from source)
- OpenCode installed and available in PATH
MIT © Dominic Codespoti