`: Open directly on the specified tab.
## Examples
[Section titled “Examples”](#examples)
```bash
# Open dashboard with default layout
workmux dashboard
# Open with smaller preview pane (40% of height)
workmux dashboard --preview-size 40
# Open diff view directly for current worktree
workmux dashboard --diff
# Show only agents in the current tmux session
workmux dashboard --session
# Open directly on the Worktrees tab
workmux dashboard --tab worktrees
```
See the [Dashboard guide](/guide/dashboard/) for keybindings and detailed documentation.
# docs
> Display the README with terminal formatting
Displays the README with terminal formatting. Useful for quick reference without leaving the terminal.
```bash
workmux docs
```
When run interactively, renders markdown with colors and uses a pager (`less`). When piped (e.g., to an LLM), outputs raw markdown for clean context.
## Using with AI agents
[Section titled “Using with AI agents”](#using-with-ai-agents)
You can ask an agent to read the docs and configure workmux for you:
```plaintext
> run `workmux docs` and configure workmux so that on the left pane
there is claude as agent, and on the right side neovim and empty
shell on top of each other
⏺ Bash(workmux docs)
⎿
… +923 lines
⏺ Write(.workmux.yaml)
⎿ Wrote 9 lines to .workmux.yaml
⏺ Created .workmux.yaml with the layout:
- Left: claude agent (focused)
- Right top: neovim
- Right bottom: empty shell
```
# init
> Generate a .workmux.yaml configuration file
Generates `.workmux.yaml` with example configuration and `""` placeholder usage.
```bash
workmux init
```
# last-done
> Switch to the most recently completed or waiting agent
Switches to the agent that most recently completed its task or is waiting for user input. Repeated invocations cycle through all done/waiting agents in reverse chronological order (most recent first). The cycle resets when a new agent finishes, so you always see the latest first.
This is a hidden command (not shown in `--help`), typically invoked via a tmux keybinding.
```bash
workmux last-done
```
## How it works
[Section titled “How it works”](#how-it-works)
1. Finds all agents with “done” or “waiting” status.
2. Sorts them by most recent status change first.
3. Switches to the most recent one.
4. On repeated invocations, advances to the next oldest agent in the list.
5. When a new agent finishes (the most recent timestamp changes), the cycle resets back to the newest.
## Tmux keybinding
[Section titled “Tmux keybinding”](#tmux-keybinding)
Add to `~/.tmux.conf` for quick access:
```bash
bind l run-shell "workmux last-done"
```
Then press `prefix + l` to jump to the last completed or waiting agent. Press again to cycle to the next oldest.
## Examples
[Section titled “Examples”](#examples)
```bash
# Jump to the most recently completed/waiting agent
workmux last-done
# Press again to cycle to the next oldest
workmux last-done
```
## Related
[Section titled “Related”](#related)
* [Status tracking](/guide/status-tracking/) explains how agent status is detected and displayed
# list
> List all git worktrees with their agent, window, and merge status
Lists git worktrees with their agent status, multiplexer window status, and merge status. Alias: `ls`
```bash
workmux list [options] [worktree-or-branch...]
```
## Arguments
[Section titled “Arguments”](#arguments)
| Argument | Description |
| -------------------- | ----------------------------------------------------------------------------------------------- |
| `worktree-or-branch` | Filter by worktree handle (directory name) or branch name. Multiple values supported. Optional. |
## Options
[Section titled “Options”](#options)
| Flag | Description |
| -------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `--all` | Include worktrees from every repository represented by a tracked agent in the current multiplexer instance. Repositories without tracked agents cannot be discovered. |
| `--pr` | Show GitHub PR status for each worktree. Requires the `gh` CLI to be installed and authenticated. Note that it shows pull requests’ statuses with [Nerd Font](https://www.nerdfonts.com/) icons, which requires Nerd Font compatible font installed. |
| `--json` | Output as JSON. Produces a JSON array with `project`, `project_path`, `handle`, `branch`, `path`, `is_main`, `mode`, `has_uncommitted_changes`, `is_open`, `agent_statuses`, and `created_at`. |
## Examples
[Section titled “Examples”](#examples)
```bash
# List all worktrees
workmux list
# List with PR status
workmux list --pr
# Output tracked projects as one JSON response
workmux list --all --json
# Filter to a specific worktree
workmux list my-feature
# Filter to multiple worktrees
workmux list feature-auth feature-api
```
## Remote workspaces
[Section titled “Remote workspaces”](#remote-workspaces)
Workspaces on [remote servers](/guide/remote/) are listed alongside local worktrees. Their path names the remote instead of a local directory, with a note while a workspace is still being set up, has a merge or cleanup in progress, or its remote can’t be reached. AGENT and UNMERGED come from the remote’s last known state, and AGENT says when the agent’s session ended, for example `exited (host rebooted)`. In JSON output, they carry a `remote` field with the remote’s name, `path` is the worktree’s path on the remote, and `agent_statuses` and `has_uncommitted_changes` describe the remote worktree. Local worktrees have no `remote` field.
## Example output
[Section titled “Example output”](#example-output)
```plaintext
BRANCH AGE AGENT MUX UNMERGED PATH
main - - - - ~/project
user-auth 2h 🤖 ✓ - ~/project__worktrees/user-auth
bug-fix 3d ✅ ✓ ● ~/project__worktrees/bug-fix
api-work 1w - ✓ - ~/project__worktrees/api-work
```
## Key
[Section titled “Key”](#key)
* AGE column shows how old the worktree is, based on directory creation time. Uses compact units: `m`, `h`, `d`, `w`, `mo`, `y`. Shows `-` for the main worktree or when creation time is unavailable.
* AGENT column shows the current agent status using [status icons](/guide/status-tracking/):
* `🤖` = agent is working
* `💬` = agent is waiting for user input
* `✅` = agent finished
* When multiple agents run in one worktree, shows a count (e.g., `2🤖 1✅`)
* When stdout is piped (e.g., by a script or agent), text labels are used instead: `working`, `waiting`, `done`
* `✓` in MUX column = multiplexer window exists for this worktree
* `●` in UNMERGED column = branch has commits not merged into main
* `-` = not applicable
# merge
> Merge a branch and clean up the worktree, window, and local branch
Merges a branch into a target branch (main by default) and automatically cleans up all associated resources (worktree, tmux window, and local branch).
```bash
workmux merge [branch-name] [flags]
```
When to use `merge` vs `remove`
`workmux merge` performs the git merge locally. Use it when you want to merge directly without a pull request.
If your workflow uses pull requests, the merge happens on the remote after review. In that case, use [`workmux remove`](/reference/commands/remove/) to clean up the worktree after your PR is merged.
## Arguments
[Section titled “Arguments”](#arguments)
* `[branch-name]`: Optional name of the branch to merge. If omitted, automatically detects the current branch from the worktree you’re in.
## Options
[Section titled “Options”](#options)
| Flag | Description |
| ---------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `--into ` | Merge into the specified branch instead of main. Useful for stacked PRs, git-flow workflows, or merging subtasks into a parent feature branch. If the target branch has its own worktree, the merge happens there; otherwise, the main worktree is used. |
| `--ignore-uncommitted` | Commit any staged changes before merging without opening an editor. |
| `--keep, -k` | Keep the worktree, window, and branch after merging (skip cleanup). Useful when you want to verify the merge before cleaning up. |
| `--cleanup` | Clean up after merging, overriding `merge_keep: true`. |
| `--notification` | Show a system notification on successful merge. Useful when delegating merge to an AI agent and you want to be notified when it completes. |
| `--rebase` | Rebase the feature branch onto the target before merging (creates a linear history via fast-forward merge). If conflicts occur, you’ll need to resolve them manually and run `git rebase --continue`. |
| `--squash` | Squash all commits from the feature branch into a single commit on the target. You’ll be prompted to provide a commit message in your editor. |
## Merge strategies
[Section titled “Merge strategies”](#merge-strategies)
By default, `workmux merge` performs a standard merge commit (configurable via `merge_strategy`). You can override the configured behavior with these mutually exclusive flags:
* `--rebase`: Rebase the feature branch onto the target before merging (creates a linear history via fast-forward merge). If conflicts occur, you’ll need to resolve them manually in the worktree and run `git rebase --continue`.
* `--squash`: Squash all commits from the feature branch into a single commit on the target. You’ll be prompted to provide a commit message in your editor.
If you don’t want to have merge commits in your main branch, use the `rebase` merge strategy, which does `--rebase` by default.
\~/.config/workmux/config.yaml
```yaml
merge_strategy: rebase
```
To keep the worktree, window, and branch after every merge unless overridden, set:
```yaml
merge_keep: true
```
Use `workmux merge --cleanup` to clean up for a single merge when this default is enabled.
## What happens
[Section titled “What happens”](#what-happens)
1. Determines which branch to merge (specified branch or current branch if omitted)
2. Determines the target branch (`--into` or main branch from config)
3. Checks for uncommitted changes (errors if found, unless `--ignore-uncommitted` is used)
4. Commits staged changes if present (unless `--ignore-uncommitted` is used)
5. Merges your branch into the target using the selected strategy (default: merge commit)
6. Deletes the tmux window unless keep behavior is enabled via `--keep` or `merge_keep: true`
7. Removes the worktree unless keep behavior is enabled via `--keep` or `merge_keep: true`
8. Deletes the local branch unless keep behavior is enabled via `--keep` or `merge_keep: true`
## Remote workspaces
[Section titled “Remote workspaces”](#remote-workspaces)
For a workspace on a [remote server](/guide/remote/), run `workmux merge ` from the project on your machine. workmux fetches the branch and the uncommitted work into a local copy, then merges it as usual; all options apply. The remote agent keeps running until the merge succeeds, and its worktree, container and window are then removed. If the remote workspace changed after the fetch, it is kept and the merge still lands.
See [merging remote workspaces](/guide/remote/git/#merging) for preparing the merge worktree, uncommitted work, conflicts and `--keep`. In a remote workspace’s pane, or from its agent, `workmux merge` asks the local machine to merge it; see [remove or merge from a remote pane](/guide/remote/usage/#remove-or-merge-from-a-remote-pane).
## Typical workflow
[Section titled “Typical workflow”](#typical-workflow)
When you’re done working in a worktree, simply run `workmux merge` from within that worktree’s tmux window. The command will automatically detect which branch you’re on, merge it into main, and close the current window as part of cleanup.
## Examples
[Section titled “Examples”](#examples)
```bash
# Merge branch into main (default: merge commit)
workmux merge user-auth
# Merge the current worktree you're in
# (run this from within the worktree's tmux window)
workmux merge
# Rebase onto main before merging for a linear history
workmux merge user-auth --rebase
# Squash all commits into a single commit
workmux merge user-auth --squash
# Merge but keep the worktree/window/branch to verify before cleanup
workmux merge user-auth --keep
# ... verify the merge in main ...
workmux remove user-auth # clean up later when ready
# Merge into a different branch (stacked PRs)
workmux merge feature/subtask --into feature/parent
```
# open
> Open or switch to a tmux window for an existing worktree
Opens or switches to a tmux window for a pre-existing git worktree. If the window already exists, switches to it. If not, creates a new window with the configured pane layout and environment. Accepts multiple names to open several worktrees at once.
```bash
workmux open [name...] [flags]
```
## Arguments
[Section titled “Arguments”](#arguments)
* `[name...]`: One or more worktree names, matching the worktree directory or handle. The tmux target can differ when a worktree uses `--target-name` or `--parent-session`. Optional with `--new` when run from inside a worktree.
## Options
[Section titled “Options”](#options)
Use `-b` or `--background` to open without switching away from your current window or session. This also applies to existing targets, multiple worktrees, and remote workspaces.
| Flag | Description |
| -------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `-n, --new` | Force opening in a new window even if one already exists. Creates a duplicate window with a suffix (e.g., `-2`, `-3`). Useful for having multiple terminal views into the same worktree. In tmux, the duplicate appears immediately to the right of the window where the command runs. Cannot be used with session mode. |
| `--mode ` | Override the multiplexer mode for this command. `session` persists the mode change for subsequent opens. `window` converts a session-mode worktree back to window mode. Session mode is only supported with tmux. |
| `-s, --session` | Shorthand for `--mode session`. Persists the mode change for subsequent opens. Cannot be combined with `--mode`. |
| `--target-name ` | Override the workmux-managed tmux target name for this command. In window mode, creates or selects window ``. In session mode, creates or selects session ``. Cannot be used with multiple worktree names. |
| `--parent-session ` | Window mode only. Creates the workmux-managed window inside the named tmux session without applying `window_prefix` to that parent session. Cannot be used with session mode or multiple worktree names. |
| `--config ` | Use an alternate config file for this invocation. Still merges with global config. Useful for per-command config overrides like `workmux open feat/my-branch --config /path/to/workmux.session.yaml`. |
| `--run-hooks` | Re-runs the `post_create` commands (these block window creation). |
| `--force-files` | Re-applies file copy/symlink operations. Useful for restoring a deleted `.env` file. |
| `-p, --prompt ` | Provide an inline prompt for AI agent panes. |
| `-P, --prompt-file ` | Provide a path to a file containing the prompt. |
| `-c, --continue` | Resume the agent’s most recent conversation in this worktree. Injects the appropriate flag for the configured agent (e.g., `--continue` for Claude, `--resume` for Gemini). |
| `-e, --prompt-editor` | Open your editor to write the prompt interactively. |
| `--prompt-file-only` | Write the prompt file to the worktree without injecting it into agent commands. |
## What happens
[Section titled “What happens”](#what-happens)
1. Verifies that a worktree with `` exists.
2. If the target exists and `--new` is not set, switches to it unless `--background` is set.
3. Otherwise, creates a new tmux window or session. In tmux, duplicate windows appear immediately to the right of the window identified by `$TMUX_PANE`. `--target-name` can override the managed target, and `--parent-session` can choose the parent session for a window-mode target.
4. (If specified) Runs file operations and `post_create` hooks.
5. Sets up your configured tmux pane layout.
6. Switches your tmux client to the new window unless `--background` is set.
In tmux window mode without `--parent-session`, `$TMUX_PANE` identifies the calling pane and its parent session. When `$TMUX_PANE` is absent or stale, workmux uses live pane working directories when their closest matches identify one session. A tmux server with one session is the final fallback. Remaining ambiguity requires `--parent-session `. The working directory selects the Git repository and only provides conservative evidence for tmux placement.
## Remote workspaces
[Section titled “Remote workspaces”](#remote-workspaces)
For a workspace on a [remote server](/guide/remote/), `open` reopens the local window and reattaches it to the remote session. The agent was never stopped by `close`, so nothing restarts. If the remote session has ended, `open` starts the workspace’s panes again. After a remote host reboot, agents resume their most recent conversation, and `open` says whether the agent continued its conversation or started a new one.
A remote workspace created with `add --parent-session` reopens in its recorded parent session, creating the session again if needed.
Prompts, `--continue`, `--new`, `--run-hooks`, `--force-files`, `--target-name`, `--parent-session` and session mode aren’t available for remote workspaces. With `mode: session` in the config, pass `--mode window` to open a remote workspace.
## Examples
[Section titled “Examples”](#examples)
```bash
# Open or switch to a window for an existing worktree
workmux open user-auth
# Open without switching away from the current window
workmux open user-auth --background
# Force open a second window for the same worktree (creates user-auth-2)
workmux open user-auth --new
# Open a new window for the current worktree (run from within the worktree)
workmux open --new
# Open in session mode (converts from window mode if needed)
workmux open user-auth --mode session
# Convert a session-mode worktree back to a window
workmux open user-auth --mode window
# Recreate a closed worktree with a custom window target
workmux open user-auth --target-name review-auth
# Recreate a window-mode worktree inside a named tmux session
workmux open user-auth --parent-session prs --target-name review-auth
# Recreate a worktree as a custom-named session
workmux open user-auth --mode session --target-name review-auth
# Resume the agent's last conversation
workmux open user-auth --continue
# Resume and send a follow-up prompt
workmux open user-auth --continue -p "Continue implementing the login flow"
# Open and re-run dependency installation
workmux open user-auth --run-hooks
# Open and restore configuration files
workmux open user-auth --force-files
# Open multiple worktrees at once
workmux open user-auth api-refactor bugfix-login
```
# path
> Print the filesystem path of a worktree
Prints the filesystem path of an existing worktree. Useful for scripting or quickly navigating to a worktree directory.
```bash
workmux path
```
## Arguments
[Section titled “Arguments”](#arguments)
* ``: Worktree name (the directory name).
## Examples
[Section titled “Examples”](#examples)
/Users/you/project\_\_worktrees/user-auth
```bash
# Get the path of a worktree
workmux path user-auth
# Use in scripts or with cd
cd "$(workmux path user-auth)"
# Copy a file to a worktree
cp config.json "$(workmux path feature-branch)/"
```
# reap-agents
> Exit tracked agent processes older than a configured age
Exit tracked agent processes whose last state update is older than a threshold.
```bash
workmux reap-agents
workmux reap-agents --hours 48
workmux reap-agents --hours 24 --force
```
By default, the command prints matching agents without exiting them. It still reconciles workmux state while checking live panes. Pass `--force` to interrupt matching agents and remove their workmux agent state after they exit.
## Options
[Section titled “Options”](#options)
* `--hours `: Age threshold in hours. Defaults to `24`.
* `-f, --force`: Actually exit matching agents instead of showing what would happen.
## Example output
[Section titled “Example output”](#example-output)
```text
Would exit %12 in feature-a (25h, done, Update docs)
Run with -f/--force to exit these agents.
```
# rebase
> Rebase a worktree branch onto its base branch
Rebases a worktree branch onto its saved base branch. If the branch does not have a saved local base branch, workmux rebases onto the configured main branch.
```bash
workmux rebase [name]
```
## Arguments
[Section titled “Arguments”](#arguments)
* `[name]`: Optional worktree name or branch. If omitted, workmux detects the current worktree from the current directory.
## What happens
[Section titled “What happens”](#what-happens)
1. Determines which worktree branch to rebase
2. Reads the saved base branch recorded when the worktree was created
3. Falls back to the configured main branch when the saved base is not a local branch
4. Runs `git rebase ` inside the worktree
5. Leaves the worktree, window, and branch in place
## Remote workspaces
[Section titled “Remote workspaces”](#remote-workspaces)
For a workspace on a [remote server](/guide/remote/), workmux sends your local base branch to the remote and runs the rebase there, committing as your local git identity. The agent keeps running. On a conflict, the rebase stops in the remote worktree: open the workspace and run `git rebase --continue` or `git rebase --abort` in its shell pane.
## Examples
[Section titled “Examples”](#examples)
```bash
workmux rebase user-auth
workmux rebase
```
# remote
> Set up, check and manage SSH remotes that run agents
Commands for [remote servers](/guide/remote/): SSH-reachable Linux machines that run individual agents. Remotes are defined under `remotes:` in the global config (see [configuration](/guide/configuration/#remotes)). Create a remote agent with [`workmux add --remote`](/reference/commands/add/).
## remote
[Section titled “remote”](#remote)
List the configured remotes.
```bash
workmux remote
```
Shows each remote’s name, its SSH host and its status: reachable or not, whether the node is set up, and the workmux version and protocol it runs. The remote that `placement` selects is marked as the default.
## remote setup
[Section titled “remote setup”](#remote-setup)
Install the node on a remote.
```bash
workmux remote setup
```
**Arguments:**
* `` - Remote name from `remotes:` in the global config
Uploads the workmux binary for this workmux version into the remote’s node root (the release, downloaded and checksum-verified on the local machine, or the configured `binary`), and installs workmux’s status hooks for the supported agents in the remote user’s agent directories. OpenCode’s hooks are installed once the OpenCode sandbox image is on the remote. Running it again only installs what is missing. An interrupted install is recovered by the next run.
Commands that need the node, such as `add --remote` and `remote login`, install it automatically, so `setup` is mostly useful as a first check, and after you make OpenCode’s sandbox image available on the remote (its hooks depend on the OpenCode version in that image).
## remote doctor
[Section titled “remote doctor”](#remote-doctor)
Check that a remote can run agents.
```bash
workmux remote doctor
```
**Arguments:**
* `` - Remote name from `remotes:` in the global config
Prints one row per check, with a fix for each failing row:
| Check | What it checks |
| ----------- | --------------------------------------------------------------------------------------------------------- |
| `ssh` | The SSH connection works without a prompt |
| `arch` | The remote runs Linux on a supported architecture |
| `node` | The node binary is installed and speaks this workmux’s protocol |
| `git` | Git is installed |
| `tmux` | tmux 3.3 or newer is installed |
| `linger` | systemd linger is enabled, so agents survive logout |
| `agents` | Resolved mode and deciding setting; in host mode, default CLI required and other configured CLIs optional |
| `container` | Docker works for the SSH user (Docker mode only) |
| `hooks` | workmux’s status hooks are installed for each agent |
| logins | One row per configured agent, with the credential files found on the remote |
| `image` | The sandbox image of the default agent can be pulled (it is pulled as part of the check) |
Uses the current directory’s effective config, like `add`; outside a project, uses global config. See [server or Docker](/guide/remote/setup/#server-or-docker). Exits with status 1 when any check fails. Missing logins are warnings, not failures.
## remote login
[Section titled “remote login”](#remote-login)
Log an agent in on a remote, where its remote agents find the login.
```bash
workmux remote login [-- ...]
workmux remote login --import
workmux remote login claude --setup-token
```
**Arguments:**
* `` - Remote name from `remotes:` in the global config
* `` - `claude`, `codex`, `gemini`, `opencode`, `pi` or `omp`
* `...` - Extra arguments for the agent’s login command, after `--`
**Options:**
* `--import` - Copy this machine’s credential files for the agent instead of logging in. Cannot be combined with `--setup-token` or extra arguments.
* `--setup-token` - Claude only: run `claude setup-token` and keep the token it prints for every Claude agent using the remote’s node root
Without `--import`, runs the agent’s own login flow on the remote, attached to your terminal: in the agent’s sandbox image with `container` isolation, or directly on the host when sandboxing is off or `isolation: none` is set. Browser logins that call back to `localhost` get their ports forwarded from the local machine. See [logins and secrets](/guide/remote/logins/) for each agent’s flow and the limits of `--import`.
## remote pull
[Section titled “remote pull”](#remote-pull)
Bring a remote workspace home.
```bash
workmux remote pull [--no-hooks]
```
**Arguments:**
* `` - Handle of the remote workspace
**Options:**
* `--no-hooks` - Skip `post_create` hooks for the local worktree
Stops the remote agent, recreates the workspace as a local worktree with the same branch, staged changes, unstaged changes and untracked files, opens its window with your configured panes, and removes the remote workspace. The remote agent’s conversation is not carried over; the local window starts a fresh agent. Run it from the project’s repository.
If the remote can’t be reached after the work came home, the remote cleanup is left pending and a later command finishes it (see [merging](/guide/remote/git/#uncommitted-work-conflicts-and-cleanup)). See [what doesn’t come home](/guide/remote/git/#what-doesnt-come-home).
## remote gc
[Section titled “remote gc”](#remote-gc)
List what a remote holds that no workspace uses, and remove it.
```bash
workmux remote gc [--dry-run | --force]
```
**Arguments:**
* `` - Remote name from `remotes:` in the global config
**Options:**
* `--dry-run` - Only list what would be removed
* `--force` - Remove without asking, including workspaces whose work exists only on the remote. Cannot be combined with `--dry-run`.
Lists workspaces this machine has no record of, stray worktrees, tmux sessions, containers, supervisors, refs and state files, unused node binaries, and local records of workspaces the remote no longer has. Then asks before removing them. Workspaces with uncommitted changes or commits beyond their base are only removed with `--force`. Without a terminal, nothing is removed unless `--force` is given. See [cleaning up a server](/guide/remote/troubleshooting/#cleaning-up-a-server).
## remote logs
[Section titled “remote logs”](#remote-logs)
Show the output of merges and removals requested from remote panes.
```bash
workmux remote logs []
```
**Arguments:**
* `` - Remote name from `remotes:` in the global config
* `` - Request ID, as printed in the remote pane
Without a request ID, lists the saved log files for the remote. With one, prints that request’s output, including hook output. Logs are kept on the local machine, need no connection to the remote, and aren’t deleted automatically. See [operation logs](/guide/remote/git/#operation-logs).
## Examples
[Section titled “Examples”](#examples)
```bash
# Install and check a new remote
workmux remote setup devbox
workmux remote doctor devbox
# Log Codex in on the remote, using device auth instead of a browser callback
workmux remote login devbox codex -- --device-auth
# Give the remote's Claude agents a long-lived token
workmux remote login devbox claude --setup-token
# Copy Gemini's credential files from this machine
workmux remote login devbox gemini --import
# Move a remote workspace to the local machine
workmux remote pull my-feature
# Preview, then remove leftovers
workmux remote gc devbox --dry-run
workmux remote gc devbox
```
# remove
> Remove worktrees, tmux windows, and branches without merging
Removes worktrees, tmux windows, and branches without merging (unless you keep the branches). Useful for abandoning work or cleaning up experimental branches. Supports removing multiple worktrees in a single command. Alias: `rm`
```bash
workmux remove [name]... [flags]
```
## Arguments
[Section titled “Arguments”](#arguments)
* `[name]...`: One or more worktree names (the directory names). Defaults to current directory name if omitted.
## Options
[Section titled “Options”](#options)
| Flag | Description |
| ------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `--all` | Remove all worktrees at once (except the main worktree). Prompts for confirmation unless `--force` is used. Safely skips worktrees with uncommitted changes or unmerged commits. |
| `--gone` | Remove worktrees whose upstream remote branch has been deleted (e.g., after a PR is merged on GitHub). Automatically runs `git fetch --prune` first. |
| `--force, -f` | Skip confirmation prompt and ignore uncommitted changes. |
| `--keep-branch, -k` | Remove only the worktree and tmux window while keeping the local branch. |
## Examples
[Section titled “Examples”](#examples)
```bash
# Remove the current worktree (run from within the worktree)
workmux remove
# Remove a specific worktree with confirmation if unmerged
workmux remove experiment
# Remove multiple worktrees at once
workmux rm feature-a feature-b feature-c
# Remove multiple worktrees with force (no confirmation)
workmux rm -f old-work stale-branch
# Use the alias
workmux rm old-work
# Remove worktree/window but keep the branch
workmux remove --keep-branch experiment
# Force remove without prompts
workmux rm -f experiment
# Remove worktrees whose remote branches were deleted (e.g., after PR merge)
workmux rm --gone
# Force remove all gone worktrees (no confirmation)
workmux rm --gone -f
# Remove all worktrees at once
workmux rm --all
```
## Remote workspaces
[Section titled “Remote workspaces”](#remote-workspaces)
Pass the handle of a workspace on a [remote server](/guide/remote/) to remove its worktree, agent, container and window from the remote. Uncommitted changes on the remote refuse the removal without `--force`, and commits its base doesn’t have ask for confirmation, as with a local worktree. `--keep-branch` fetches the branch to your machine before the remote copy goes. `pre_remove` hooks run on the remote.
If the remote is unreachable or no longer configured, `--force` forgets the workspace on this machine only, leaving whatever exists on the remote for [`workmux remote gc`](/reference/commands/remote/#remote-gc). `--all` and `--gone` only consider local worktrees.
In a remote workspace’s pane, or from its agent, `workmux rm` asks the local machine to remove that workspace. See [remove or merge from a remote pane](/guide/remote/usage/#remove-or-merge-from-a-remote-pane).
## Deferred filesystem cleanup
[Section titled “Deferred filesystem cleanup”](#deferred-filesystem-cleanup)
When removing a worktree from its own terminal target, filesystem cleanup runs in a detached worker after that target closes. Surviving background processes can still write into the renamed `.workmux_trash_*` directory. Rust cleanup continues deleting unrelated files and directories after an individual failure, using descriptor-relative operations without following symlink targets. Workmux retries `DirectoryNotEmpty` errors with backoff for a five-second retry window; an individual recursive deletion can take longer. It does not kill those processes.
Before renaming the worktree, Workmux saves a pending filesystem-cleanup record under `$XDG_STATE_HOME/workmux/pending-cleanup/` (by default, `~/.local/state/workmux/pending-cleanup/`). The record includes the original and quarantine paths and the captured directory’s device and inode. It is cleared only after filesystem deletion succeeds.
If deletion fails, the record remains and the worker writes the error and a bounded snapshot of remaining entries, along with the paths and errors from failed deletion operations, to `workmux.log` in the same state directory. Records also survive failures in intervening Git operations. They are diagnostic recovery records, not an automatic cleanup queue: inspect them and stop any remaining writers before manually recovering the exact quarantined directory. Do not replay branch deletion from a record, since Git cleanup may already have completed and the original branch or worktree path may have been reused.
# rename
> Rename a worktree, its tmux window/session, and optionally the branch
Renames a worktree’s directory, its tmux window or session, and the per-worktree workmux metadata stored in git config. Optionally also renames the underlying git branch.
```bash
workmux rename [old-name] [--branch]
```
## Arguments
[Section titled “Arguments”](#arguments)
* `[old-name]`: Optional current worktree name (the directory name). Defaults to the current worktree when run from inside one.
* ``: The new handle. This becomes the worktree directory name and the tmux window/session base name.
## Options
[Section titled “Options”](#options)
| Flag | Description |
| ---------------- | --------------------------------------------------------------------------------------------------------- |
| `--branch`, `-b` | Also rename the underlying git branch to match ``. Fails if the worktree is on a detached HEAD. |
## What gets renamed
[Section titled “What gets renamed”](#what-gets-renamed)
1. The worktree directory (`git worktree move`)
2. The tmux window or session (matching duplicates like `wm-feature-2` are renamed preserving their `-N` suffix)
3. `workmux.worktree..*` git config entries (e.g. the stored window/session mode)
4. Agent state files in `$XDG_STATE_HOME/workmux/agents/*.json` (updates `workdir`, `window_name`, `session_name`)
5. Sandbox container marker directory, if present
6. The local git branch, only when `--branch` is passed
## Examples
[Section titled “Examples”](#examples)
```bash
# Rename a worktree from inside it
workmux rename feature-new
# Rename a specific worktree by name
workmux rename feature-old feature-new
# Also rename the branch to match
workmux rename feature-old feature-new --branch
```
## Notes
[Section titled “Notes”](#notes)
* The main worktree cannot be renamed.
* Rename is non-destructive: uncommitted changes and untracked files survive.
* Submodules are not handled specially; `git worktree move` will error out if the worktree contains submodules.
* Any shell already running inside the old directory will have a stale `$PWD` after the rename. Run `cd` (or `cd `) to refresh.
* Collisions are rejected up front: if the new path, tmux target, or branch already exists, the command aborts before making any changes.
# resurrect
> Restore worktree windows after a tmux or computer crash
Restores worktree windows after a tmux or computer crash. Uses persisted agent state files to detect which worktrees had active agents before the crash, then reopens them with each agent’s resume arguments.
```bash
workmux resurrect [--dry-run]
```
## Options
[Section titled “Options”](#options)
* `--dry-run`: Show what would be restored without actually doing it.
## How it works
[Section titled “How it works”](#how-it-works)
1. Reads agent state files from `~/.local/state/workmux/agents/`
2. Filters to the current multiplexer backend and instance
3. Matches each state file’s working directory to a git worktree in the current repo
4. Skips worktrees that are already open, no longer exist, or are the main worktree
5. Opens each matched worktree with the resume arguments for the remembered agent
6. Uses agent-specific behavior, such as Codex’s resume subcommand with its last-session flag
7. Cleans up consumed stale state files
Agent state from known earlier multiplexer boots is compacted to one recovery candidate per exact working directory. Unrestored worktrees remain recoverable across repeated restarts without retaining duplicate records for every boot. Current-boot records, records without a reliable boot identity, malformed files, and state owned by another multiplexer instance or backend are preserved. Each instance compacts its own history when workmux observes that instance with a reliable boot identity.
## Remote workspaces
[Section titled “Remote workspaces”](#remote-workspaces)
Agents on [remote servers](/guide/remote/) kept running while the local tmux was down, so `resurrect` reopens their windows and reattaches them without restarting anything. A remote agent whose session ended, for example because the remote host rebooted, is skipped: run `workmux open ` to start it again.
## Examples
[Section titled “Examples”](#examples)
```bash
# Preview what would be restored
workmux resurrect --dry-run
# Restore all worktrees that had agents running
workmux resurrect
```
## Example output
[Section titled “Example output”](#example-output)
```plaintext
continue-flag -> restoring
dashboard-fix -> skipping (already open)
auth-refactor -> restoring
(2 state file(s) from other projects ignored)
✓ Restored 2 worktree(s): continue-flag, auth-refactor
```
# sandbox
> Manage sandbox backends and tooling
Commands for managing sandbox functionality across container (Docker/Podman/Apple Container) and Lima backends.
## Container commands
[Section titled “Container commands”](#container-commands)
### sandbox build
[Section titled “sandbox build”](#sandbox-build)
Build the sandbox container image locally (two-stage: base + agent).
```bash
workmux sandbox build
```
Builds the image locally for the configured agent. This is an alternative to using the pre-built image from `ghcr.io/raine/workmux-sandbox`. Most users should use `workmux sandbox pull` instead.
### sandbox pull
[Section titled “sandbox pull”](#sandbox-pull)
Pull the latest sandbox image from the container registry.
```bash
workmux sandbox pull
```
Pulls the pre-built image for the configured agent from `ghcr.io/raine/workmux-sandbox:{agent}`. This is the recommended way to get and update the sandbox image.
### sandbox init-dockerfile
[Section titled “sandbox init-dockerfile”](#sandbox-init-dockerfile)
Export a customizable Dockerfile for building your own sandbox image.
```bash
workmux sandbox init-dockerfile [--force]
```
**Options:**
* `--force` - Overwrite existing Dockerfile
Creates a `Dockerfile.sandbox` in the current directory with the base system setup (Debian, git, workmux) and agent-specific installation (e.g., Claude Code) combined into a single file.
## Lima commands
[Section titled “Lima commands”](#lima-commands)
### sandbox stop
[Section titled “sandbox stop”](#sandbox-stop)
Stop Lima VMs to free resources.
```bash
# Interactive mode - show list and select VM
workmux sandbox stop
# Stop specific VM
workmux sandbox stop
# Stop all workmux VMs
workmux sandbox stop --all
# Skip confirmation prompt
workmux sandbox stop --all --yes
```
**Arguments:**
* `` - Name of the VM to stop (optional, conflicts with `--all`)
**Options:**
* `--all` - Stop all workmux VMs (those starting with `wm-` prefix)
* `-y, --yes` - Skip confirmation prompt
This command helps you stop running Lima VMs created by workmux to free up system resources. When run without arguments, it shows an interactive list of running workmux VMs for you to choose from. The command will ask for confirmation before stopping any VMs unless `--yes` is provided.
**Notes:**
* This command only works with Lima backend and requires `limactl` to be installed
* Only running VMs are shown in interactive mode
* If a specified VM is already stopped, the command reports this and exits successfully
* Non-interactive environments (pipes, scripts) require `--all` or a specific VM name
### sandbox prune
[Section titled “sandbox prune”](#sandbox-prune)
Delete unused Lima VMs to reclaim disk space.
```bash
# Interactive - show VMs and confirm deletion
workmux sandbox prune
# Skip confirmation and delete all workmux VMs
workmux sandbox prune --force
```
**Options:**
* `-f, --force` - Skip confirmation and delete all workmux VMs
Lists all workmux Lima VMs (those starting with `wm-` prefix) with their size, age, and last accessed time, then prompts for confirmation before deleting them. Requires `limactl` to be installed.
## General commands
[Section titled “General commands”](#general-commands)
### sandbox agent
[Section titled “sandbox agent”](#sandbox-agent)
Run the configured agent inside a sandbox with full RPC support. Unlike `shell`, this starts an RPC server so the agent can call workmux commands (e.g., `workmux add` to spawn sub-agents).
```bash
# Run the configured agent (from config or defaults to claude)
workmux sandbox agent
# Run a specific command instead
workmux sandbox agent -- claude -p "coordinate these tasks"
```
**Options:**
* `` - Command to run instead of the configured agent
This command runs a sandboxed agent in the current directory. It delegates to the same supervisor process used by `workmux sandbox run`, which handles RPC server setup, sandbox dispatch (Lima or container), environment variables, and cleanup.
The key difference from `sandbox shell` is that this starts an RPC server, enabling the guest to call `workmux add` from inside the sandbox. Guest-side `workmux add` detects the sandbox environment and routes through SpawnAgent RPC to the host, where sub-agents are created normally (and sandboxed if the project config says so).
**Requirements:**
* Must be run from inside a git repository (sandbox needs git directories for mounts)
* Sandbox must be configured (image pulled or built)
**Use case:** Running a coordinator agent inside a sandbox so it can spawn sub-agents via `workmux add` while still being isolated from the host.
### sandbox shell
[Section titled “sandbox shell”](#sandbox-shell)
Start an interactive shell in a sandbox. Uses the same mounts and environment as a normal worktree sandbox. Works with both container and Lima backends.
```bash
# Start a new shell (container backend starts a new container, Lima connects to existing VM)
workmux sandbox shell
# Run a specific command instead of bash
workmux sandbox shell --
# Exec into an existing container (container backend only)
workmux sandbox shell --exec
```
**Options:**
* `-e, --exec` - Exec into an existing container for this worktree instead of starting a new one (container backend only)
* `` - Command to run instead of bash
**Backend behavior:**
* **Container:** Starts a fresh container with the same mounts and environment as a normal worktree sandbox. With `--exec`, attaches to an existing container instead.
* **Lima:** Connects to the Lima VM for the current worktree (creating it if needed). The `--exec` flag is not supported since Lima VMs are persistent and `shell` always connects to the existing VM.
### sandbox install-dev
[Section titled “sandbox install-dev”](#sandbox-install-dev)
Cross-compile and install workmux into container images and running Lima VMs for local development.
```bash
# Cross-compile and install into containers and running VMs
workmux sandbox install-dev
# Use release profile (slower build, faster binary)
workmux sandbox install-dev --release
# Skip compilation, copy existing binary
workmux sandbox install-dev --skip-build
```
**Options:**
* `--skip-build` - Skip cross-compilation and copy the previously built binary
* `--release` - Use release profile (default is debug for faster iteration)
This is a developer-only command for getting local workmux builds into sandbox environments. The host macOS binary cannot run inside Linux containers or VMs, so this command cross-compiles for the correct Linux architecture.
For container sandboxes, it builds a thin overlay image (`FROM ` + `COPY workmux`) on top of the configured sandbox image, replacing it in-place. For Lima VMs, it copies the binary into each running VM.
**Prerequisites:**
* Rust cross-compilation target: `rustup target add aarch64-unknown-linux-gnu`
* Cross-linker: `brew install messense/macos-cross-toolchains/aarch64-unknown-linux-gnu`
The binary is installed to `~/.local/bin/workmux` inside the VM, which is already on PATH.
### sandbox run
[Section titled “sandbox run”](#sandbox-run)
Run a command inside a sandbox (internal, used by pane setup).
```bash
workmux sandbox run --
```
This is an internal command generated by `wrap_for_lima()` during pane setup. It runs the host-side supervisor process that:
1. Ensures the Lima VM is running
2. Starts a TCP RPC server on a random port
3. Runs the command inside the VM via `limactl shell`
4. Passes `WM_SANDBOX_GUEST=1`, `WM_RPC_HOST`, `WM_RPC_PORT`, and `WM_RPC_TOKEN` env vars to the guest
5. Exits with the agent command’s exit code
The RPC server handles requests from the guest workmux binary:
* `SetStatus`: updates the tmux pane status icon
* `SetTitle`: renames the tmux window
* `Heartbeat`: health check
* `SpawnAgent`: runs `workmux add` on the host to create a new worktree
**Guest-side `workmux add`:** When `workmux add` runs inside a sandbox, it automatically detects the sandbox environment and routes through SpawnAgent RPC instead of trying to create worktrees locally (which would fail due to missing tmux). This enables coordinator agents running in sandboxes to spawn sub-agents. Only a subset of `add` flags are supported over RPC; unsupported flags (`--base`, `--pr`, `--with-changes`, `--count`, `--foreach`, `--name`, `--agent`, `--wait`) are explicitly rejected with clear error messages.
## Quick Setup
[Section titled “Quick Setup”](#quick-setup)
```bash
# 1. Enable in config (~/.config/workmux/config.yaml or .workmux.yaml)
# sandbox:
# enabled: true
# The pre-built image is pulled automatically on first run.
# To pull it explicitly:
workmux sandbox pull
```
## Example
[Section titled “Example”](#example)
```bash
# Pull the latest sandbox image
workmux sandbox pull
# Output:
# Pulling image 'ghcr.io/raine/workmux-sandbox:claude'...
# Image 'ghcr.io/raine/workmux-sandbox:claude' is up to date.
```
## See also
[Section titled “See also”](#see-also)
* [Sandbox guide](/guide/sandbox/) for full setup instructions
# shell
> Open a shell in a remote workspace from the local terminal
Opens an interactive shell in a workspace on a [remote server](/guide/remote/) and runs it in the current terminal. It starts in the workspace’s working directory, and you don’t need the server’s SSH address or the worktree path.
```bash
workmux shell [name] [--host]
```
## Arguments
[Section titled “Arguments”](#arguments)
* `[name]`: Remote workspace handle or branch, or `project:handle`, as for [`send`](/guide/remote/usage/#commands-on-remote-workspaces). When omitted, it uses the remote workspace whose window the command runs in.
## Options
[Section titled “Options”](#options)
| Flag | Description |
| -------- | ------------------------------------------------------------------------------------- |
| `--host` | In a workspace whose agent runs in Docker, run the shell on the server, not in Docker |
## Where the shell runs
[Section titled “Where the shell runs”](#where-the-shell-runs)
* **Agent on the server directly** (`isolation: none`): the shell runs on the server, with the server’s `workmux` and the workspace’s environment, like the window’s other panes.
* **Agent in Docker:** the shell runs in a new container of the workspace, with the same image, mounts and environment as the agent’s. This does not depend on `sandbox.target`. `--host` runs the shell on the server instead. It is the only way to get a server shell, and that shell has no `workmux`.
The first line in the shell says which of these you got.
## Opening it next to the agent
[Section titled “Opening it next to the agent”](#opening-it-next-to-the-agent)
A tmux split of a remote workspace’s window starts a shell on the local machine. Run `workmux shell` in that split to replace it with a shell on the server:
```bash
# in a new split of the remote window
workmux shell
```
You can also bind a key to open a split running the remote shell. Add a binding like this to your tmux config:
```bash
bind S split-window -h "workmux shell"
```
The split closes when the shell exits.
## Ending the shell
[Section titled “Ending the shell”](#ending-the-shell)
* Exiting the shell ends it on the server, and `workmux shell` returns. The agent and its workspace keep running.
* When the connection drops, the pane shows a status line and reconnects to the same shell, as the window’s other panes do.
* Closing the pane, or pressing `q` while it is disconnected, also ends the shell on the server. If the server can’t be reached at that moment, the shell keeps running there until the workspace’s agent is restarted or the workspace is removed.
* Commands that stop the agent, such as `remove` and `merge`, end its shells too. So does `workmux open` when it restarts the agent after a server reboot.
## Errors
[Section titled “Errors”](#errors)
* A local worktree name is refused. Use `cd "$(workmux path )"` for local worktrees.
* If the server can’t be reached, `shell` fails at once and names the server.
* A workspace that never started on the server is refused with a hint to run `workmux open `.
# sidebar
> Control a live agent status sidebar in tmux or Zellij
Controls a live agent status sidebar on the left or top edge of tmux windows or Zellij tabs. On tmux, each sidebar shows active agents across all sessions by default. On Zellij, the sidebar is scoped to the current Zellij session.
```bash
workmux sidebar # Toggle sidebar on/off (all sessions)
workmux sidebar on # Ensure the global sidebar is running
workmux sidebar off # Ensure the global sidebar is stopped
workmux sidebar --session on # Ensure it is running in this session
workmux sidebar --session off # Ensure it is stopped in this session
workmux sidebar on --position top # Enable with a top sidebar
workmux sidebar on --width 40 # Set left sidebar width in columns
workmux sidebar on --height 3 # Set top sidebar height in rows
```
## What it shows
[Section titled “What it shows”](#what-it-shows)
Each agent row displays:
* Status icon (working/waiting/done with spinner animation)
* Project and worktree name (e.g. `myproject/fix-bug`)
* Elapsed time since last status change
* Git diff stats, plus optional pull request number and check status in custom templates
## Keybindings
[Section titled “Keybindings”](#keybindings)
| Key | Action |
| ------- | ------------------------- |
| `j`/`k` | Navigate up/down |
| `Enter` | Run the configured action |
| `o` | Focus the agent pane |
| `g`/`G` | Jump to first/last |
| `v` | Toggle layout mode |
| `f` | Toggle session filter |
| `V` | Toggle rule-based views |
| `z` | Toggle sleeping on agent |
| `t` | Toggle grouping |
| `h`/`l` | Unfold/fold current group |
| `s` | Toggle the current fold |
| `S` | Fold/unfold every group |
| `?` | Show these keys |
| `q` | Open quit confirmation |
## Mouse support
[Section titled “Mouse support”](#mouse-support)
Click an agent row or top-bar chip to jump to its pane, or scroll to navigate the list. tmux requires mouse mode (`set -g mouse on`); Zellij needs no extra mouse configuration.
## Navigation commands
[Section titled “Navigation commands”](#navigation-commands)
Switch between agents from any pane, in the same order shown in the sidebar. Navigation uses the same filter mode as the sidebar view, so on tmux it cycles through all sessions by default:
| Command | Action |
| ------------------------------- | ---------------------------------------------------- |
| `workmux sidebar next` | Switch to the next agent (wraps) |
| `workmux sidebar prev` | Switch to the previous agent (wraps) |
| `workmux sidebar jump ` | Jump to the Nth agent (1-indexed) |
| `workmux sidebar filter` | Toggle session filter (none/session) |
| `workmux sidebar filter ` | Set filter mode: `none`/`all` or `session`/`project` |
| `workmux sidebar group` | Toggle grouping between grouped and flat |
| `workmux sidebar group ` | Set grouping: `none`/`off`, `project` or `session` |
| `workmux sidebar group --clear` | Drop the runtime grouping and follow config again |
### Example tmux keybindings
[Section titled “Example tmux keybindings”](#example-tmux-keybindings)
```bash
# Alt+j / Alt+k to cycle agents (no prefix needed)
bind -n M-j run-shell "workmux sidebar next"
bind -n M-k run-shell "workmux sidebar prev"
# Alt+1..9 to jump directly
bind -n M-1 run-shell "workmux sidebar jump 1"
bind -n M-2 run-shell "workmux sidebar jump 2"
bind -n M-3 run-shell "workmux sidebar jump 3"
# ...
# Or with prefix key (avoids terminal conflicts)
bind C-j run-shell "workmux sidebar next"
bind C-k run-shell "workmux sidebar prev"
```
## Configuration
[Section titled “Configuration”](#configuration)
```yaml
stale_after: 5h # dashboard and sidebar timeout; default: 1h
sidebar:
position: left # "left" (default) or "top"
width: 40 # left width in columns (default: "10%", clamped 25-50)
# width: "15%"
layout: tiles # left only: "compact" or "tiles" (default)
enter_action: focus # "focus" (default) or "select"
git_status: true # collect Git status and GitHub PR/check data (default)
dim_stale: true # dim stale agents using stale_after
group_by: project # "project" or "session"; unset keeps one flat list
collapse_stale: true # while grouped, fold stale agents behind a toggle
```
Set `enter_action: select` to show the selected agent’s window while keeping focus in its sidebar, so `j`/`k` can continue scanning agents. Press `o` to focus the selected agent’s pane. If the target window has no sidebar, Enter falls back to focusing the agent pane. Mouse clicks always focus the pane.
For a horizontal top bar:
```yaml
sidebar:
position: top
height: 3 # top height in rows
horizontal:
item_width: 24 # horizontal chip width in columns (default, clamped 12-80)
templates:
horizontal:
- "{status_icon} {primary} {pane_suffix} {fill} {elapsed}"
- "{secondary} {fill} {git_stats}"
- "{pane_title}"
```
Set `sidebar.git_status: false` in the global config to stop the sidebar daemon from watching worktrees and collecting Git status. Git status, pull request, and check tokens then render empty. This setting is daemon-wide and does not affect the dashboard’s independent Git status updates.
Explicit width values bypass the default 25-50 column clamp (minimum 1 column). Layout preference can also be toggled at runtime with `v` and is persisted across restarts. Height only applies to `position: top`; set it as a row count for the number of horizontal lines you want to show. The top bar uses a horizontal chip layout, so `v` has no effect there. Horizontal templates render as many configured lines as the current height allows. `horizontal.item_width` controls each chip width and is clamped between 12 and 80 columns. Position changes take effect when the sidebar is enabled. Use `workmux sidebar on --position top` or `--position left` to override the configured placement. Width and height also accept percentages, such as `workmux sidebar on --width 15%`. Repeating `on` with appearance options applies them without creating duplicate panes. The `off` action rejects position and dimension flags because they have no effect while stopping the sidebar.
## Named views
[Section titled “Named views”](#named-views)
Use named views to show agents from selected sessions or project directories. Add `sidebar.views` to your global config at `~/.config/workmux/config.yaml` (or `$XDG_CONFIG_HOME/workmux/config.yaml`). Views cannot be set per project.
```yaml
sidebar:
views:
- name: Named sessions
sessions: [foo, bar, xyz]
- name: Code
project_dirs: [~/code]
- name: Work
project_dirs: [~/work]
- name: Other
other: true
```
Views are enabled by default when configured. Each window uses the first view matching its agent’s session or project, then Other if nothing matches, or All if there is no Other view. Switching to another window shows that window’s view without changing the one you left.
In a window with several agents, the view follows the active agent and stays on that view when you focus the sidebar. A window without a registered agent uses its oldest pane’s session and working directory.
### Turning views on and off
[Section titled “Turning views on and off”](#turning-views-on-and-off)
Press `V` to toggle views for every sidebar in the tmux server:
* **On:** each window shows agents matching its own view.
* **Off:** every sidebar shows all agents.
```bash
workmux sidebar view # Toggle views on/off
workmux sidebar view on # Apply each window's matching rules
workmux sidebar view off # Show all agents in every sidebar
```
The view name appears at the bottom of the sidebar, or All when views are off. A view with no matching agents shows “No matching agents”. Turning the sidebar off and on preserves the toggle; restarting tmux enables views again.
The `f` session filter works in both modes. When it is on, each sidebar shows only agents in its current session, whether or not views are enabled. Views do not change row grouping (`sidebar.group_by`) or which windows have a sidebar (`sidebar --session`). `next`, `prev`, and `jump` follow the current window’s view once the sidebar updates.
A top sidebar needs at least two rows: one for the view name and one for agents. With no views configured, `V` does not change which agents appear.
### Matching rules
[Section titled “Matching rules”](#matching-rules)
* `sessions` matches exact, case-sensitive tmux session names. `foo` does not match `foobar` or `Foo`; wildcards are not supported.
* `project_dirs` matches each directory and its subdirectories. `~/code` does not match `~/code-old`. Use absolute paths or `~` for your home directory; environment variables such as `$HOME` are not expanded. Symlinks are resolved for paths that exist.
* Linked worktrees belong to the main repository’s directory, even if the worktree is stored elsewhere. Bare repositories use the bare directory. If workmux cannot identify a repository, it uses the agent’s recorded working directory. After moving a repository, allow about 30 seconds for views to update.
* An agent matches a view if it matches any of its session names or project directories. The same agent can appear in more than one view.
* `other: true` shows agents that match none of the other views. Only one view can use it, and that view cannot also have `sessions` or `project_dirs`. Without an Other view, unmatched agents appear only in All.
* Give each view a unique name other than `All`, without leading or trailing spaces. Each view needs `sessions`, `project_dirs`, or `other: true`.
## How it works
[Section titled “How it works”](#how-it-works)
When enabled, a background daemon polls tmux state every 2 seconds and pushes snapshots to each sidebar pane over a Unix socket. The sidebar creates a tmux pane on the configured edge of every existing window. A tmux hook (`after-new-window`) ensures newly created windows also get a sidebar automatically.
Running `workmux sidebar` again disables the sidebar globally, killing all sidebar panes, the daemon, and removing hooks. `workmux sidebar on` and `workmux sidebar off` provide idempotent alternatives for scripts and tmux configuration.
On Zellij, the daemon polls the current session and adds a sidebar to each tab, including new tabs within about two seconds. workmux installs no Zellij hooks. See [Zellij sidebar](/guide/zellij/#sidebar).
### Session-scoped mode
[Section titled “Session-scoped mode”](#session-scoped-mode)
By default, the sidebar appears in all tmux sessions. Use `--session` to scope it to the current session only, leaving other sessions untouched:
```bash
workmux sidebar --session on # Ensure it is enabled in the current session
workmux sidebar --session off # Ensure it is disabled in the current session
```
You can enable session-scoped sidebars in multiple sessions independently. Each session can be toggled or explicitly enabled and disabled without affecting others.
If the global sidebar is already active, `workmux sidebar --session` hides the sidebar in the current tmux session only. Run it again to show the sidebar in that session again while other sessions remain globally managed.
Starting global mode still replaces any session-scoped sidebars.
## Limitations
[Section titled “Limitations”](#limitations)
* Zellij support is experimental and limited to the current Zellij session, so `--session` has no additional effect there. See [Zellij limitations](/guide/zellij/#known-limitations).
## Example tmux binding
[Section titled “Example tmux binding”](#example-tmux-binding)
```bash
bind C-t run-shell "workmux sidebar"
```
# status
> Query tracked agent status for worktrees
Reports tracked agents in the current repository or in explicitly requested worktrees.
```bash
workmux status [WORKTREE ...] [--all] [--json] [--git]
```
## Options
[Section titled “Options”](#options)
* `--all`: Include tracked agents across every repository in the current multiplexer instance. This option conflicts with explicit worktree arguments.
* `--json`: Emit a machine-readable observation object.
* `--git`: Include staged, unstaged, and unmerged commit information for each returned agent.
Worktree arguments support `project:handle` syntax for cross-project queries.
The table includes `PROJECT` and `SESSION` columns when the results are not limited to one repository: with `--all`, outside a Git repository, or when explicit targets resolve to more than one project. The `SESSION` column is omitted when every agent’s session is named after its project.
## JSON output
[Section titled “JSON output”](#json-output)
```json
{
"context": {
"backend": "tmux",
"instance": "/private/tmp/tmux-501/default"
},
"scope": {
"repository": "/Users/user/code/project",
"all": false,
"targets": []
},
"state_files_total": 3,
"state_files_invalid": 1,
"state_files_invalid_unattributed": 0,
"state_files_invalid_matching_context": 0,
"state_files_matching_context": 2,
"reconciled_agent_count": 1,
"agents": [],
"target_errors": []
}
```
The counts describe successive stages of the observation.
* `state_files_total`: JSON state files found in the workmux agents directory, including files that cannot be decoded. Atomic-write temporary files are excluded.
* `state_files_invalid`: State files that cannot be decoded across all multiplexer contexts.
* `state_files_invalid_unattributed`: Invalid state files whose filenames do not unambiguously identify a backend and instance.
* `state_files_invalid_matching_context`: Invalid state files attributed to the selected backend and instance. A nonzero value in either this field or `state_files_invalid_unattributed` makes the command fail.
* `state_files_matching_context`: Readable state files whose backend and instance exactly match `context`.
* `reconciled_agent_count`: Agents accepted by live multiplexer reconciliation before repository and target filtering.
* `agents`: Reconciled agents inside the declared `scope`.
* `target_errors`: Requested worktrees that could not be resolved. Each error contains the original `target`, a stable `code`, and a human-readable `message`.
The observation does not remove stale or invalid state files. It excludes stale entries from `agents` and leaves persisted evidence available for later cleanup or diagnosis. If invalid state blocks an observation, inspect the agents directory under the workmux XDG state directory and remove or repair the file reported in the warning log.
`scope.repository` is the current repository when it can be resolved. With no explicit targets, agents are filtered to that repository. `--all` sets `scope.all` to `true`, sets `scope.repository` to `null`, and returns every reconciled agent in the selected multiplexer context. Outside a Git repository, a no-target query also returns every reconciled agent, with `scope.all` set to `false`. `scope.targets` contains the requested worktree selectors.
Each agent contains `worktree`, `branch`, `project`, `project_path`, `status`, `elapsed_secs`, `title`, `pane_id`, `workdir`, `agent_kind`, `session`, `window_name`, and `updated_ts`. `project` and `project_path` are `null` when the agent’s Git repository cannot be resolved. With `--git`, the entry also contains a `git` object.
Agents on [remote servers](/guide/remote/) are reported with the local ones, labelled with the remote’s name. When the remote can’t be reached, they keep their last known status, marked as disconnected. In JSON output, a remote agent has a `remote` object:
* `name`, `host`: the remote and its SSH host
* `ws_id`: the workspace’s id on the remote
* `pane`: the agent’s pane index in the remote session
* `attached`: whether a local window relays the agent
* `connected`: whether the remote answered recently
* `last_seen`: Unix time of the remote’s last answer, or `null`
* `ended`: present when the agent’s session ended under it, for example `host_reboot` after the remote host restarted. `workmux open` starts it again.
Local agents have no `remote` field.
## Safe automation
[Section titled “Safe automation”](#safe-automation)
Check the exit status before interpreting the JSON. Most failures produce no JSON. When some explicit targets resolve and others do not, the command emits the complete observation with details in `target_errors` and exits nonzero. This preserves successful results without presenting a partial query as fully successful.
A successful empty `agents` array has different meanings depending on the counts:
* `state_files_total > 0` and `state_files_matching_context == 0`: persisted state exists, but none describes the selected backend and instance. A fleet-wide consumer should fail closed.
* `reconciled_agent_count > 0` and `agents` is empty: tracked agents exist in the selected multiplexer context but fall outside the repository or target scope.
* `reconciled_agent_count == 0`: no readable state in the selected context was accepted by live reconciliation.
State files for another context can belong to an old or concurrently running multiplexer instance. Their presence is evidence of another context, not proof that the selected context is wrong.
Workmux can observe only agents that produced tracking state. An agent without configured or functioning status hooks remains invisible to this command.
## Errors
[Section titled “Errors”](#errors)
The command fails when it cannot complete the requested observation, including:
* invalid backend overrides
* unresolved multiplexer instance identity
* state inventory read failures
* invalid state files attributed to the selected multiplexer context
* multiplexer query or response parsing failures
* Git query failures when `--git` is requested
* missing or ambiguous requested worktrees, reported in `target_errors` when an observation can otherwise be completed
# sync-files
> Re-apply file operations (copy/symlink) to existing worktrees
Re-applies file operations (copy and symlink from the `files` config) to existing worktrees. Useful when you add new entries to the config or a symlink was accidentally deleted.
Unlike `open --force-files`, this command does not require tmux and works standalone from inside any worktree.
```bash
workmux sync-files [--all]
```
## Options
[Section titled “Options”](#options)
| Flag | Description |
| ------- | --------------------------------------------------- |
| `--all` | Sync all worktrees instead of just the current one. |
## Examples
[Section titled “Examples”](#examples)
```bash
# Sync files to the current worktree
workmux sync-files
# Sync files to all worktrees at once
workmux sync-files --all
```
# update
> Update workmux to the latest version
Updates workmux to the latest version by downloading the prebuilt binary from GitHub Releases.
```bash
workmux update
```
## What happens
[Section titled “What happens”](#what-happens)
1. Checks the latest release version from the GitHub API
2. Compares with the currently installed version
3. Downloads the correct binary for your OS and architecture
4. Verifies the SHA-256 checksum
5. Atomically replaces the current binary (with rollback on failure)
If workmux is already up to date, it reports this and exits.
## Homebrew installs
[Section titled “Homebrew installs”](#homebrew-installs)
If workmux was installed via Homebrew, the command will detect this and instruct you to use `brew upgrade` instead:
```bash
brew upgrade workmux
```
## Supported platforms
[Section titled “Supported platforms”](#supported-platforms)
The command downloads prebuilt binaries for:
* macOS (Apple Silicon / Intel)
* Linux (x86\_64 / ARM64)
## Automatic update check
[Section titled “Automatic update check”](#automatic-update-check)
Workmux periodically checks for new versions in the background. When an update is available, a one-line notice is printed to stderr:
```plaintext
Update available: workmux v0.1.124 -> v0.1.125 (run `workmux update`)
```
The check runs at most once every 24 hours via a detached background process and never slows down your commands. The notice is shown at most once per day and only in interactive terminals.
### Disabling
[Section titled “Disabling”](#disabling)
To disable the automatic update check, either:
* Set `auto_update_check: false` in the global config (`~/.config/workmux/config.yaml`)
* Set the environment variable `WORKMUX_NO_UPDATE_CHECK=1`
## Requirements
[Section titled “Requirements”](#requirements)
* `curl` must be available in PATH (used for downloading)
* `tar` must be available in PATH (used for extraction)
* `sha256sum` or `shasum` must be available (used for checksum verification)
* Write permission to the directory containing the workmux binary