Skip to content

slatkisasa/codexmux

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Codexmux

codexmux is a local CLI for saving, listing, and switching between multiple OpenAI Codex CLI account profiles.

It keeps the same command model throughout:

  • .tar as the archive format
  • a TTY-only interactive home on bare codexmux
  • interactive account picking for switch when no account name is provided
  • styled terminal output for TTY users
  • plain, script-safe output when redirected or piped

Install

Homebrew

Install from the personal tap:

brew install slatkisasa/tap/codexmux

Download a release asset

Download a macOS archive from GitHub Releases:

  • codexmux_Darwin_arm64.tar.gz
  • codexmux_Darwin_x86_64.tar.gz
  • checksums.txt

Build from source

git clone https://github.com/slatkisasa/codexmux.git
cd codexmux
go build -o codexmux .

Install into your Go bin directory

go install github.com/slatkisasa/codexmux@latest

From a local clone, you can still install the current checkout with:

go install .

If your Go bin directory is already on PATH, the command will be available as:

codexmux

Commands

Core commands:

codexmux list
codexmux current
codexmux save <name>
codexmux add <name>
codexmux switch <name>

The CLI also exposes Cobra's generated shell-completion command:

codexmux completion

Additional behavior:

  • codexmux with no subcommand opens an interactive home in a TTY
  • codexmux with no subcommand prints normal help outside a TTY
  • codexmux switch with no <name> opens an interactive picker in a TTY
  • codexmux switch with no <name> fails with a usage error in non-TTY mode
  • codexmux save with no <name> prompts in a TTY

Storage Layout

The storage layout stays compatible with existing users:

Path Purpose
~/.codex Active Codex profile
~/.codex-switch/state Current and previous account state
~/codex-data/<name>.tar Saved account archive

The state file remains:

CURRENT=...
PREVIOUS=...

Archive Compatibility

  • Saves and restores use .tar
  • The Go CLI ignores legacy .zip archives
  • Restore validation rejects unsafe archive paths before replacing ~/.codex

TTY vs Non-TTY Output

TTY mode:

  • codexmux opens a compact interactive action menu with account summary
  • compact styled blocks for current, list, success, warning, error, and progress output
  • interactive picker for switch without a name

Non-TTY mode:

  • plain text only
  • no borders, color, or interactive prompts
  • output stays easy to parse in scripts

Examples:

codexmux
codexmux list | cat
codexmux current > /tmp/codexmux-state.txt
codexmux switch work

Example Flows

First save

codex login
codexmux save personal

Add a new account, then save it

codexmux add work
codex login
codexmux save work

Interactive switch

codexmux

Choose Switch Account, then select the target account.

Direct interactive switch

codexmux switch

If stdin/stdout are attached to a TTY, the command opens a keyboard-driven picker.

Non-interactive scripted switch

codexmux switch personal

Safety Notes

  • account names allow only A-Z, a-z, 0-9, ., _, and -
  • empty names, separators, and traversal-like inputs are rejected
  • archives are validated before extraction
  • extraction happens in a staging directory first
  • ~/.codex is only replaced after validation and extraction succeed

Development

Run tests:

go test ./...

Build:

go build -o codexmux .

About

A local CLI for saving, listing, and switching between multiple OpenAI Codex CLI account profiles.

Topics

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Languages