projectmux

module
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 6, 2026 License: MIT

README

ProjectMux

ProjectMux turns a declarative YAML description of a project workspace into a running tmux session, where individual windows may run on the host or inside a Dev Container.

You describe a workspace once — its windows, what each one runs, where it runs, and which one gets focus — and ProjectMux is responsible for making the machine match that description.

Status: alpha

The command surface is complete; the contracts are not yet stable. ProjectMux opens, attaches to, stops, and reports on workspaces, starts containers at boot, and diagnoses its own installation. Every command listed below works.

Breaking changes to the configuration schema, the command surface, and the exit codes should be expected while the version remains below 1.0. There is no migration support, and v0.x builds are published as prereleases.

Two things are compatibility contracts even during the alpha:

  • The JSON output of projectmux config --json, which carries a schema_version field.
  • The exit codes listed below.

Human-readable output is deliberately not a contract. Parse --json instead.

Platform support

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.1.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.

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, and a formatting check the same way CI does:

test -z "$(gofmt -l .)"
go vet ./...
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). Set PROJECTMUX_CONFIG_ROOT to point at a different directory; this is intended for tests and for trying out a configuration without disturbing your own.

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 worktree; 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 ~/src/slabledger
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 slabledger 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 primary worktrees 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
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, including linked worktrees in the conventional .worktrees/ and .claude/worktrees/ directories.

Exit codes
Code Meaning
0 success
1 unexpected or I/O failure
2 usage error
3 the workspace name matched more than one worktree
4 the workspace name matched no worktree
5 invalid configuration
6 the plan refused: a conflict or uncertainty; do not blindly retry

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 means "use a container when this repository has a Dev Container configuration"; true requires one and fails if it is missing; 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.

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.

Directories

Path Synopsis
cmd
projectmux command
Command projectmux orchestrates declarative tmux workspaces whose windows may run on the host or inside a Dev Container.
Command projectmux orchestrates declarative tmux workspaces whose windows may run on the host or inside a Dev Container.
internal
cli
Package cli parses commands, chooses human or JSON presentation, and maps typed errors to exit codes.
Package cli parses commands, chooses human or JSON presentation, and maps typed errors to exit codes.
config
Package config loads, merges, normalizes, validates, and digests the layered YAML that describes a workspace's desired state.
Package config loads, merges, normalizes, validates, and digests the layered YAML that describes a workspace's desired state.
container
Package container is the design-§5 container adapter: it owns every docker and devcontainer invocation, translating their output into domain observations.
Package container is the design-§5 container adapter: it owns every docker and devcontainer invocation, translating their output into domain observations.
controller
Package controller owns the workspace domain types, the interfaces it consumes, snapshot assembly (Observe), pure planning (BuildPlan), and reconciliation (Ensure, Stop).
Package controller owns the workspace domain types, the interfaces it consumes, snapshot assembly (Observe), pure planning (BuildPlan), and reconciliation (Ensure, Stop).
controller/fake
Package fake provides in-memory implementations of the controller's interfaces for tests in this and later slices.
Package fake provides in-memory implementations of the controller's interfaces for tests in this and later slices.
doctor
Package doctor diagnoses a projectmux installation: dependencies, configuration, the state database, and the drift between what the store records and what tmux and Docker actually hold.
Package doctor diagnoses a projectmux installation: dependencies, configuration, the state database, and the drift between what the store records and what tmux and Docker actually hold.
lock
Package lock provides the per-workspace filesystem lock (design §9).
Package lock provides the per-workspace filesystem lock (design §9).
resolve
Package resolve turns a workspace name or a working directory into the canonical worktree and the identity derived from it.
Package resolve turns a workspace name or a working directory into the canonical worktree and the identity derived from it.
run
Package run executes subprocesses with contexts, timeouts, structured argv, bounded output capture, and retained exit status.
Package run executes subprocesses with contexts, timeouts, structured argv, bounded output capture, and retained exit status.
state
Package state owns the SQLite database holding current operational metadata.
Package state owns the SQLite database holding current operational metadata.
tmux
Package tmux is the read-only tmux adapter: it owns every tmux command this slice issues and translates tmux output into domain types.
Package tmux is the read-only tmux adapter: it owns every tmux command this slice issues and translates tmux output into domain types.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL