ProjectMux — declarative tmux workspaces
ProjectMux is a declarative tmux workspace manager for Linux and WSL. Define a
project's windows in YAML — shells, commands, and CLI coding agents — and choose
whether each one runs on the host or inside the repository's Dev Container.
You describe a workspace once: its windows, what each one runs, where it runs,
and which one gets focus. ProjectMux observes what tmux and the container
runtime are actually doing, then makes the machine match that description.
Why ProjectMux
- One workspace definition. Layer shared defaults, per-repository
configuration, and machine-local overrides without repeating every window.
- Host and container windows. Each tmux window runs on the host or inside
the repository's Dev Container, decided per window.
- Reconciliation, not a startup script. ProjectMux observes what exists,
explains the drift, and converges toward the declared workspace instead of
blindly recreating it.
- Worktree-aware lookup. Open a repository by name from configured roots;
working inside a linked git worktree resolves to the repository it belongs to.
- Readable by humans and machines. Concise terminal reports, or a versioned
JSON envelope with documented exit codes.
- No replacement ecosystem. Your tmux configuration, container runtime,
editor, shell, and
devcontainer.json stay exactly as they are.
Quick start
You need git and tmux on PATH, on Linux or WSL2. Container-backed windows
need more; see Platform support.
Install:
go install github.com/gambtho/projectmux/cmd/projectmux@latest
Create a minimal set of defaults:
mkdir -p ~/.config/projectmux
cat > ~/.config/projectmux/defaults.yaml <<'YAML'
version: 1
repository_roots:
- /home/you/workspace
devcontainer:
enabled: auto
windows:
- name: shell
shell: true
focus: true
YAML
Every window opens with a second shell pane beside it by default — same
directory, same container if the window runs in one. Add panes: [] to a
window to keep it single-pane, or declare your own panes list.
Then open any repository under a configured root:
cd ~/workspace/my-project
projectmux config --validate
projectmux open
You attach, detach, and navigate with tmux exactly as you normally would.
[!IMPORTANT]
ProjectMux is alpha. Every documented command works, but nothing it emits
is a compatibility contract below 1.0 — the configuration schema, the
command surface, the JSON envelopes, and the exit codes may all change, and
there is no migration support for v0.x configuration.
Project status
The command surface is complete; nothing about it is frozen.
ProjectMux opens, attaches to, stops, and reports on workspaces, starts
containers at boot, and diagnoses its own installation. Every command listed
below works.
Nothing is a compatibility contract below 1.0. Expect breaking changes to
the configuration schema, the command surface, the JSON envelopes, and the
exit codes while the version remains below 1.0. There is no migration support,
and v0.x builds are published as prereleases.
Releases up to v0.4.0 named the JSON output and the exit codes as contracts
that held even during the alpha. That claim is withdrawn. It was made before
anything pinned those shapes, and only the config --json envelope is
checked against a fixed set of keys today. ProjectMux emits ten envelope
shapes across nine commands — config emits two, one for its digest report
and one for --validate — so a field in any of the other nine could be
renamed by accident without a test noticing.
Human-readable output remains the least stable of the three outputs: human
text, --json, and the exit codes. Parse --json if you automate against
ProjectMux — but pin the version you tested against.
Linux and WSL2 are the supported platforms for v1. macOS and native Windows are
not supported and are not currently being tested.
ProjectMux requires git and tmux on PATH. Container-backed windows
additionally require a Docker-compatible runtime and the Dev Containers CLI;
workspaces that keep every window on the host need neither.
projectmux doctor reports which of these it can find, and their versions.
Install
From a release
Releases publish static linux/amd64 and linux/arm64 binaries with a
SHA256SUMS file. Download both, verify, then install:
VERSION=v0.5.0
ARCH=amd64 # or arm64
BASE=https://github.com/gambtho/projectmux/releases/download/$VERSION
curl -fsSLO $BASE/projectmux-linux-$ARCH
curl -fsSLO $BASE/SHA256SUMS
sha256sum --check --ignore-missing SHA256SUMS
mkdir -p ~/.local/bin
install -m 0755 projectmux-linux-$ARCH ~/.local/bin/projectmux
--ignore-missing lets you verify the one binary you downloaded against the
file covering both. Verification is the point of publishing checksums — if
sha256sum does not print OK, do not install the binary.
While the version is below 1.0, releases are marked as prereleases.
Upgrading from v0.4.0
Run projectmux rebuild once after installing. It is a required step, not an
optional one.
v0.5.0 keys workspaces and containers on the repository rather than the git
worktree, which changes both the stored schema and every workspace ID. The
schema migration moves each stored row verbatim, treating its recorded path as
a repository root, because telling a main worktree from a linked one needs to
ask git and a migration must never fail because a directory moved. The result
is deliberately over-counted, never wrong: one repository per path until
rebuild collapses the linked worktrees into their parents and retags live
sessions onto their repository. status reports a repository whose recorded
root is not a main worktree as needing this run. See
rebuild for what it reports and
refuses.
--json consumers should read the conventions
first: schema_version is 2, the workspace path field is now repo_root
rather than worktree, is_primary is gone, and session is new.
With go install
go install github.com/gambtho/projectmux/cmd/projectmux@latest
The binary reports its version correctly when installed this way; see
version.
From source
git clone https://github.com/gambtho/projectmux
cd projectmux
CGO_ENABLED=0 go build -o projectmux ./cmd/projectmux
Go 1.25 or newer is required. The binary is statically linked and has no runtime
dependency on cgo.
Run the tests, the vet pass, the linter, and a formatting check the same way CI
does:
test -z "$(gofmt -l .)"
go vet ./...
go run github.com/golangci/golangci-lint/v2/cmd/golangci-lint@v2.12.2 run ./...
go test -race ./...
The configuration and resolver tests are hermetic: they create throwaway git
repositories in temporary directories and require no live tmux session, Docker
daemon, or Dev Containers CLI.
Configuration
Configuration lives under $XDG_CONFIG_HOME/projectmux (falling back to
~/.config/projectmux when XDG_CONFIG_HOME is unset), and state under
$XDG_STATE_HOME/projectmux (falling back to ~/.local/state/projectmux).
Three environment variables override where ProjectMux looks. Each is intended
for tests, and for running a second ProjectMux beside a working one without
disturbing it:
| Variable |
Overrides |
PROJECTMUX_CONFIG_ROOT |
the configuration directory |
PROJECTMUX_STATE_ROOT |
the state directory holding state.db |
PROJECTMUX_TMUX_SOCKET |
the tmux server, passed to tmux as -L <name> |
Set together, they give a fully separate installation: it cannot see or change
the sessions or records of the default one. Because tmux cannot move a client
between servers, open and attach refuse with exit code 6 when your terminal
is attached to a different server than PROJECTMUX_TMUX_SOCKET names — detach
first, or use open --no-attach.
Three layers are read, in order, and later layers override earlier ones:
| Layer |
Path |
Purpose |
| Defaults |
defaults.yaml |
settings shared by every workspace |
| Workspace |
workspaces/<slug>.yaml |
settings for one repository |
| Local |
workspaces/<slug>.local.yaml |
machine-specific overrides, not usually committed |
Every layer is optional. A missing file, an empty file, and a comment-only file
are all treated as an empty document.
<slug> is the repository name. A linked git worktree inherits its parent
repository's slug, so every worktree of a project shares one configuration.
Windows merge by name, not by position. An overriding layer that names an
existing window edits that window in place and leaves the base ordering alone;
a window whose name is new is appended. repository_roots may only be set in
defaults.yaml, because it is what makes lookup by workspace name possible in
the first place.
Configuration is validated strictly and fails before anything is mutated.
Unknown fields, invalid enum values, durations without units, unsupported schema
versions, duplicate window names, more than one focused window, and a window
that does not name exactly one of agent, command, or shell are all errors.
Example
version: 1
# Only meaningful in defaults.yaml. Directories searched when you name a
# workspace instead of running inside it.
repository_roots:
- /home/you/workspace
devcontainer:
enabled: auto # auto | true | false
start_timeout: 5m
environment:
CGO_ENABLED: "1"
windows:
- name: agent-1
agent: claude
focus: true
- name: shell
shell: true
- name: build
command: make test
cwd: sub/dir # relative to the repository root; may not escape it
location: container
location is left unresolved when you omit it. It is decided later against the
workspace's actual container binding rather than being defaulted to container
or host at load time.
Usage
cd ~/workspace/my-project
projectmux open # create the session if needed, then attach
projectmux status # what is running, and what would change
projectmux stop # end the session
projectmux <workspace> with no command is shorthand for open, so
projectmux my-project opens that workspace from anywhere.
Commands
| Command |
What it does |
open |
observe, ensure, record, and attach the workspace session |
attach |
attach to a live session; never creates one |
stop |
end the session, and with --container its container |
autostart |
start containers for registered repositories at boot |
config |
print the merged configuration, or --validate it |
list |
recorded workspaces and live identity-carrying sessions |
status |
observe one workspace and explain drift |
doctor |
diagnose dependencies, config, state, and drift |
rebuild |
recover lost registrations from the identity keys live sessions carry |
version |
print the version |
Every command that produces a report accepts --json for a versioned envelope
and --compact for that envelope on one line.
Full command reference → — flags, arguments, real
output, and the exit code each command returns.
Commands that accept <workspace> resolve it from the current directory when
you omit it, or look it up by name under the configured repository_roots.
Either way the answer is a repository: a linked worktree — including the
conventional .worktrees/ and .claude/worktrees/ directories — resolves to
its parent repository rather than being a workspace of its own.
Exit codes
| Code |
Meaning |
| 0 |
success |
| 1 |
unexpected or I/O failure |
| 2 |
usage error |
| 3 |
the workspace name matched more than one repository |
| 4 |
the workspace name matched no repository |
| 5 |
invalid configuration |
| 6 |
the plan refused: a conflict or uncertainty; do not blindly retry |
A mistyped bare command resolves as a workspace name rather than a usage
error — projectmux opne exits 4 when no repository matches that name, not 2.
Flag-shaped tokens and bad arguments to real commands still exit 2.
Relationship to tmux and Dev Containers
ProjectMux is a layer above both, and it owns neither.
tmux is the terminal multiplexer ProjectMux drives. ProjectMux does not
replace it, wrap its key bindings, or manage your tmux.conf; it creates and
reconciles sessions and windows and otherwise leaves tmux to you. You attach,
detach, and navigate with tmux exactly as you normally would.
Dev Containers provide the optional container a window can run in.
ProjectMux reads the standard devcontainer.json your editor already uses and
delegates to the Dev Containers CLI rather than defining a competing container
format:
devcontainer.enabled: auto uses a container when the repository has a Dev
Container configuration.
devcontainer.enabled: true requires one and fails if it is missing.
devcontainer.enabled: false keeps every window on the host.
The design goal is that a workspace remains usable without ProjectMux. Removing
it should leave a working repository, a working tmux, and a working Dev
Container.
Questions
Does ProjectMux replace tmux?
No. It is a workspace controller built on tmux. Your existing key bindings,
plugins, and tmux.conf keep working, and ProjectMux never edits them.
Does ProjectMux require Docker?
Only for container-backed windows. A workspace whose windows all run on the
host needs just git and tmux — no container runtime and no Dev Containers
CLI are involved.
Can it run CLI coding agents?
Yes. An agent window launches the configured command — claude, codex, or
anything else on PATH — in an ordinary tmux window, on the host or in the Dev
Container. ProjectMux manages the workspace lifecycle only: it does not assign
tasks, coordinate models, or interpret agent output, and it is not an
agent-orchestration platform.
Does it support git worktrees?
Yes, by treating the repository as the unit. Working in a linked worktree —
including those in the conventional .worktrees/ and .claude/worktrees/
directories — resolves to the repository it belongs to, so every worktree of a
project shares one workspace identity, one tmux session, and one Dev Container
rather than each getting its own.
Does it create or manage worktrees?
No. Managing project source and creating worktrees are explicit non-goals.
ProjectMux opens repositories that already exist; git and your existing tools
remain responsible for creating and removing their worktrees.
Which operating systems are supported?
Linux and WSL2. macOS and native Windows are not supported and are not
currently tested.
Documentation
- Command reference — every command, its flags, its output,
and its exit codes.
- Design — the full design document: architecture, identity
and state, reconciliation, and the decisions behind them.
License
MIT. See LICENSE.