jj-waltz is a Jujutsu workspace switcher with the short binary name jw.
It is built for fast parallel development, reliable shell integration, and clean distribution.
jw works inside an existing Jujutsu repository.
Have jj (0.39 or newer) and git on your PATH.
The walkthrough below creates a disposable JJ repository to practice in.
Install the current source with Cargo (Rust 1.88 or newer).
cargo install --git https://github.com/EzraCerpac/jj-waltz --lockedYou can also install a release from the public Homebrew tap.
brew install EzraCerpac/tap/jj-waltzIf jw merge --help fails after a Homebrew install, use the Cargo command above.
Run the setup for your shell now.
Add it to your shell's startup file to enable it in future sessions
(for example, ~/.zshrc, ~/.bashrc, or ~/.config/fish/config.fish).
This lets jw switch change your shell's directory.
Fish has the richest completions.
If zsh already runs compinit in your startup file, put the jw line after it.
# bash
eval "$(jw shell init bash)"
# zsh
autoload -Uz compinit && compinit
eval "$(jw shell init zsh)"
# fish
jw shell init fish | source
# elvish
eval (jw shell init elvish | slurp)
# PowerShell
jw shell init powershell | Out-String | Invoke-ExpressionWithout shell initialization, jw switch prints the destination path.
In an empty scratch directory, create a demo repository and open a workspace.
jj git init jw-demo
cd jw-demo
jw switch greeting
jw currentjw switch greeting creates and enters jw-demo.greeting next to jw-demo.
jw current prints greeting.
Make a small change there, then switch back to the original workspace.
echo Hello > greeting.txt
jj describe -m "Add a greeting"
jw switch default
jw currentjw current now prints default.
Land the change from there.
jw merge deletes the greeting checkout directory after landing its change.
jw merge greeting
jj log -r 'parents(@)'
jw listThe log shows Add a greeting immediately before your working-copy change.
jw list shows only default.
See Merging workspaces for more options.
Jujutsu workspaces are powerful, but the raw workflow is still more manual than it needs to be.
jj-waltz makes switching feel intentional: create or jump in one command, preserve your current subdirectory, and integrate cleanly with your shell.
This project is directly inspired by Worktrunk,
which set a high bar for ergonomic worktree tooling. Worktrunk is a quality
benchmark, not this project's command specification: jj-waltz stays focused on
JJ-native workspace lifecycle and cross-workspace coordination.
The responsibility split is deliberate:
jjowns revision-graph work, bookmarks, fetch/push, and operation-log recovery.jw mergeis the one exception: it runs a fixed rebase-and-land sequence throughjj.jwowns workspace creation, navigation, links, lifecycle metadata, and safe cross-workspace coordination.- Forge tools such as
ghandglabown pull requests, merge requests, and CI.
Core workspace operations remain offline. Optional forge information must degrade to a warning rather than make local workspace management fail.
jw context [PATH]reports Git topology and JJ identity without changing eitherjw add <name>...creates one or more JJ workspaces without switchingjw switch <name>creates or switches to a JJ workspacejw switch <name>...creates any missing workspaces and switches to the last onejw s <name>short alias for the main workflowjw ^andjw -switch to the default and previous workspaces- preserve the current subdirectory when switching between sibling workspaces
- shortcuts for current, previous, and default workspaces:
@,-,^ jw list(jw l,jw ls) keeps its compact legacy output;--format=jsonemits a frozen repository snapshotjw status [workspace]explains one workspace from the same snapshot contractjw doctorreports repository, trunk, metadata, and workspace consistency checksjwopens the interactive workspace manager in a terminal;jw uiselects it explicitlyjw adopt <name> --base <revset>records an existing workspace as managed without rewriting JJ statejw repair <name> --base <revset> (--bookmark <bookmark> | --no-bookmark)repairs existing managed metadata without changing JJ statejw path,jw remove <name>...,jw prune,jw root, andjw currentjw merge [workspace]lands a workspace before your@(or--intoa bookmark), then removes itjw reconcile-external <name>reconciles stale JJ state after external checkout cleanup--executesupport for jumping into editors or agents after switching- optional automatic bookmark creation for new workspaces
- optional workspace links via
.jwlinks.tomlfor sharing large ignored directories - optional copy-on-write workspace creation (
--cow) on APFS, Btrfs, and XFS - shell integration for
fish,zsh,bash,elvish, andpowershell - generated shell completions from the CLI definition
jw context can inspect an unfamiliar checkout's identity. Its JSON uses schema
version 1 with separate git and jj objects, nullable identity fields, and
diagnostics. Git-only and non-repository paths are valid results. Discovery does
not refresh a working copy.
Keep native app tasks in the checkout the app creates. Use Git when that checkout has Git only, and JJ when it already has a JJ workspace, including an adopted linked Git worktree. A related JJ primary checkout does not require routing into another workspace. Keep the requested starting commit and an explicit working directory.
Give each checkout one writer; an orchestrator can inspect a worker's state and
results read-only. Native apps own their created checkouts and Git registrations,
so cleanup belongs to the app. jw workspace lifecycle is optional. The
native app skill reference describes capability
and ownership checks. jw context and jw adopt do not initialize or adopt a Git
worktree into JJ.
Install the bundled Herdr UI to create and remove jw workspaces from Herdr:
herdr plugin install EzraCerpac/jj-waltz/plugins/herdrThe plugin builds the jw binary from the same repository revision and delegates all
workspace paths, links, bookmarks, and removal checks to it. See
plugins/herdr for keybindings and local development.
If you keep large ignored data in one workspace and want it accessible from others,
define link relationships in the default workspace's .jwlinks.toml:
[[link]]
source = "data"
target = "../ezra-cerpac/data"
required = trueWhen you run jw switch, jw creates symlinks in the receiving workspace unless you
pass --no-links. You can also run jw links apply manually from any workspace; it
still uses the default workspace's configuration. .jwlinks.local.toml overrides the
shared file for an entry with the same source. Relative targets resolve from the
workspace receiving the links, so the same rule can work across sibling and nested
workspaces.
Sources must stay inside the receiving workspace. Absolute sources and parent traversal
such as ../outside are rejected. All rules are checked before jw changes the filesystem,
so a later conflict does not leave earlier links behind.
For machine-specific overrides, add .jwlinks.local.toml (recommended to keep ignored).
jw doctor checks these relationships in every managed workspace. A configured source
is PASS when it resolves canonically to its target, including an ordinary path. A
missing source when its target exists, a missing required target, or a source occupied
by a private path or wrong link is FAIL. An optional missing target is WARN/SKIP
only when the source is absent or is the correct dangling link. A managed workspace
whose path is stale or missing gets a separate workspace diagnostic and link inspection
is SKIP.
jw add --cow and jw switch --cow fill a new workspace by cloning the current
workspace's tracked files instead of letting JJ write each one. Clones share
storage until either copy changes: APFS clonefile(2) on macOS and reflinks on
Linux filesystems such as Btrfs and XFS. Creation is typically several times
faster, and a new workspace uses almost no extra disk space. Enable it for every
new workspace in config, and use --no-cow to opt out for one command:
[workspace]
copy_on_write = trueThe result matches an ordinary JJ checkout of the creation base, including the
current workspace’s sparse patterns. Only files JJ tracks are cloned, so
ignored and untracked files such as .env or node_modules never reach the new
workspace; use workspace links to share those. JJ adopts the
clone with the current workspace's working-copy state, then jw restores @ from
its parent, so uncommitted edits in the current workspace never leak into the new
one.
When the filesystem cannot clone, jw warns and uses ordinary JJ workspace
creation. With Watchman configured, or if JJ rejects the copied working-copy
state, jw also recreates through the ordinary path. Every fallback preserves
the current workspace’s sparse patterns.
To generate completions manually:
jw shell completions fish
jw shell completions zsh
jw shell completions bash
jw shell completions elvish
jw shell completions powershelljw add frontend tests docs
jw switch frontend tests docs
jw switch -x opencode feature-ui
jw ^
jw -
jw ls
jw list --format=json
jw status @ --format=json --refresh=none
jw doctor
jw remove frontend testsIn a terminal, bare jw opens the Ratatui workspace manager by default. The
bare command can instead run the legacy list or help view through the top-level
config setting:
default_command = "ui" # "ui", "list", or "help"A bare invocation outside a terminal prints help; explicit jw ui requires a
terminal. Build from source with Rust 1.88 or newer.
Use arrows or j/k to move, Space to mark a row, a to select visible rows,
c to clear selection, / to search, and ? for help. Click a checkbox to select
with the mouse. Selections survive searches and filters; the header counts hidden
selections too. Enter switches to the highlighted workspace and exits.
Re-source jw shell init ... after updating to enable this shell behavior.
Press m outside text-entry fields to toggle mouse controls. In text-selection
mode, drag normally to select text using your terminal; keyboard controls still
work. Press m again to restore row clicks and mouse scrolling. The footer shows
the active mode. Colors follow your terminal palette: cyan identifies focus and
shortcuts, magenta bookmarks, green integrated work and success, yellow unfinished
work and warnings, and red conflicts, errors, and destructive actions. Text labels
remain visible alongside the colors.
f cycles filters; 1–4 select all, integrated bookmarks, unfinished work, or
problems. Bookmark integration and workspace work are separate columns: a merged
bookmark can still have newer workspace work. “In trunk” means local graph
ancestry, not squash-merge equivalence or GitHub merge status. The resolved trunk
is shown above the table. File state starts as unchecked; i refreshes the
highlighted workspace, and removal refreshes its selected targets.
n creates a workspace from an editable trunk, highlighted-workspace, or custom
revision. h opens the read-only health report, y requests copying the path via
the terminal clipboard protocol, and Tab opens details on narrow terminals.
Clipboard support depends on the terminal; the path is also shown in the notice.
d previews removal of the marked rows, or the highlighted row when none are
marked. p opens Prune missing workspaces: it forgets registrations whose
directories are already gone. Remove also permanently deletes existing directories.
Current and default workspaces cannot be removed by the manager.
Risky rows are excluded initially;
r explicitly includes them. The preview shows how many rows will be removed,
skipped, or blocked and explains why. If eligible workspaces contain files not
recorded by JJ, choose i to delete the listed files or s to skip those
workspaces. These files can include ignored caches, build output, and private
files; JJ cannot restore them after deletion. Enter waits for this choice and
does nothing if no workspace is eligible. Directory deletion is permanent.
JJ's operation log is not a full undo for directory removal.
In the preview, b toggles keeping or deleting eligible associated local
bookmarks. The last confirmed choice is remembered across repositories in
$XDG_STATE_HOME/jj-waltz/ui.json, falling back to
~/.local/state/jj-waltz/ui.json. The initial choice is keep. Bookmarks associated
with surviving managed workspaces are preserved; remote bookmarks are untouched.
Unmanaged workspaces never have inferred bookmarks deleted. If saving the choice
fails, removal still runs and reports a separate preference warning.
Each target is revalidated before mutation. Changed targets require another review. Independent rows continue after a failure; results identify partial progress, and failed rows remain selected for an explicit retry. No batch rollback or automatic repair is performed.
jw merge lands a workspace's work and retires the workspace in one step. Like
git merge, it brings the named workspace into where you are:
jw merge feature-api # insert feature-api's work before your @
jw merge # from inside a workspace: insert it before the default workspace's @
jw merge feature-api --into main # rebase onto main instead, and advance main
jw merge feature-api --squash # combine the workspace's revisions into one first
jw merge feature-api --into main --push
jw merge feature-api --keep-dir # land and forget it, but leave its directory
jw merge feature-api --force # delete its directory even if untracked files would be lostThe landed work is the workspace's publish tip (a non-empty @, otherwise its sole
parent) and every ancestor not already in the destination. By default it is inserted
between the receiving workspace's @ and its parent, as jj rebase -B @ would, so
uncommitted work stays on top and no bookmark moves. With --into, it is rebased onto
the bookmark, which is fast-forwarded, and --push pushes it. Then the merged
workspace and its directory are removed, along with its associated bookmark when that
bookmark points into the landed work. The --into target, trunk bookmarks, and
bookmarks pointing anywhere else, such as one associated with trunk through jw repair,
are kept with a warning. Merging the current workspace moves the shell to the default
workspace.
Deleting the directory loses every file JJ does not track, so jw merge only deletes
the ones you have marked regenerable. Mark them in your ignore files: a # jw:trash line
starts a trash section, which runs until the next blank line or # jw: line.
# jw:trash
target/
node_modules/
*.log
# Everything else stays precious, including rules appended later.
.env*Every other untracked file is precious: one ignored by a rule outside a trash section,
such as a local secret, and one JJ leaves untracked although it is not ignored, such as
a file snapshot.auto-track excludes or one too large to snapshot. Before changing
anything, jw merge refuses if any precious file has no identical copy at the same path
in the default workspace, and lists each one with the ignore file, line, and pattern that
decided it. Move regenerable patterns into a trash section, pass --keep-dir to
land and forget the workspace while keeping its directory, pass -f/--force to skip
the check and delete the directory with those files, or delete or move the listed files
and rerun.
Some tools write their own .gitignore inside a directory that also holds source you
track, and rewrite it on every run. inlang's project.inlang/.gitignore is * with
exceptions for its settings. You cannot keep a marker in such a file, and no rule above
it can override it, because Git lets the deepest ignore file decide. Adopt it instead
from a .gitignore in a directory above it, with a path relative to that directory:
# jw:trash-rules project.inlang/.gitignoreEvery ignoring rule in an adopted file is trash; its negations still re-include files,
which JJ then tracks. Only adopt a file whose rules cover nothing but regenerable files.
When merge refuses over a rule in an untracked nested .gitignore, it suggests the line.
Trash sections work in every ignore file Git and JJ read: .gitignore in any directory,
the Git directory's info/exclude, and core.excludesFile, so personal trash such as
.DS_Store can live in your global ignore file. jw merge asks Git which rule decides
each path (git check-ignore<
B7D8
/code>), so it needs git on PATH unless you pass --keep-dir or --force.
jw merge refuses the default workspace, conflicted or divergent working copies, merge
commits, conflicted revisions, and directories holding precious untracked files (unless
--force is passed).
The initial check runs before jw merge rewrites your changes.
If the final file check finds precious files, jw merge keeps the checkout and its
workspace registration. Any completed landing or push stays in place.
If landing leaves conflicts or the push fails, jw merge keeps the workspace.
Resolve the problem and rerun jw merge. It skips work that already landed.
A conflicted landing names the jj op restore operation that undoes it.
When a workspace has a bookmark created by jw, jw remove asks before deleting
that bookmark. The safe default is to keep it. Scripts can choose explicitly:
jw remove --delete-bookmark feature-api
jw remove --keep-bookmark feature-apiRemoval is planned before mutation, so default/current-workspace checks and bookmark
choices happen before cleanup. Before deleting a directory, jw snapshots the target
working copy, so its tracked and new files survive in the workspace's last commit. A
stale target fails safely before anything changes; inspect it and run jj workspace update-stale there before retrying. jw then forgets the workspace, moves the
directory aside, and deletes it in the background, so removing a checkout with large
dependency trees returns immediately. --keep-dir and already-missing directories
only forget; --keep-dir preserves files. Ignored and other files outside JJ's
snapshot are deleted with the directory, as before; use --keep-dir when they need
preservation. The interactive manager still requires review of ignored/untracked files.
If the directory cannot be moved or deleted, jw reports the remaining path as a partial removal after cleaning bookmarks and lifecycle metadata.
Breaking change in v0.8.0: new workspace creation can inherit colocation from its primary workspace; earlier jw versions defaulted to JJ-only. To retain that previous behavior, set the following in jw configuration:
[workspace]
colocate = falseOr pass --no-colocate for one command. Existing workspaces are not converted.
Automatic copy-on-write creation remains JJ-only.
jw add feature --colocate and jw switch feature --colocate create a JJ workspace
with a linked Git worktree on JJ 0.46 or another build advertising that capability.
Git-aware tools can use the new workspace's .git link. Without a jw override,
new workspaces inherit the primary workspace's actual colocation when its
effective JJ git.colocate setting is true and JJ advertises workspace colocation.
Creation from a registered JJ-only sibling uses the same primary policy. An unverified or
non-colocated primary, a disabled JJ setting, or an older JJ keeps creation JJ-only.
To explicitly enable colocation globally:
[workspace]
colocate = trueSet colocate = false to explicitly keep new workspaces JJ-only; omit the setting
to inherit automatically. --colocate and --no-colocate override the jw setting
for one command. They affect
only newly created workspaces; switching to an existing workspace never converts
it. Explicit colocation requests on unsupported JJ versions fail before creation and
advise upgrading to JJ 0.46+ or using --no-colocate. Non-Git backends also fail
before creation.
jw records provenance only for Git worktrees it creates. jw remove cleans that
workspace's Git registration, and --keep-dir retains its files while removing the
Git link. Missing checkout paths can be pruned if the recorded registration still
matches. Cleanup validates both live topology and the ownership marker, and never
runs a global Git worktree prune. Changed topology or missing/damaged provenance
requires inspection instead of automatic deletion. Native app checkouts remain
externally owned, including after adoption.
When forgetting, jw temporarily detaches only its validated Git link to prevent JJ's repository-wide pruning from deleting unrelated missing registrations, then cleans only the matching owned registration. A failed removal restores the link when the workspace is still registered; unverifiable outcomes retain lifecycle metadata and the owned registration for inspection.
jw doctor validates recorded ownership against live topology and the marker,
and reports invalid provenance as a metadata-consistency error.
Lifecycle metadata writes use schema 3; schemas 1 and 2 remain readable without
inferring ownership. Older jw versions refuse schema 3 records. Preserve the metadata
and Git administrative ownership marker for cleanup, and use a current jw version.
If a process is interrupted after detaching .git, inspect .jj/jw-detached-git
and the retained metadata before recovering the link or finishing cleanup.
Automatic inheritance chooses JJ-only when copy-on-write is selected, including
through global config. Explicit colocation and copy-on-write cannot be combined.
Use --no-cow or --no-colocate to override one configured option for a command.
jw reads user config from $XDG_CONFIG_HOME/jj-waltz/config.toml, or
~/.config/jj-waltz/config.toml when XDG_CONFIG_HOME is not set.
To create a bookmark automatically whenever jw switch creates a workspace:
[workspace]
create_bookmark = true
bookmark_template = "{workspace}"bookmark_template defaults to {workspace}. The {workspace} token is replaced
with the resolved workspace name, so templates like wip/{workspace} are valid.
For one command, jw switch --bookmark custom-name feature-a overrides the config,
and jw switch --no-bookmark feature-a suppresses configured bookmark creation.
Explicit --bookmark is single-workspace only; for batch add or switch, use
bookmark_template.
Status compares against one configured trunk revision. It defaults to JJ's
trunk() revset:
[trunk]
revset = "trunk()"The revset must resolve to exactly one revision. Workspace creation also resolves
one exact base before changing anything. With no --at, jw uses the sole
parents(@) revision, preserving sibling-workspace behavior. An empty merge
working copy has multiple parents, so implicit creation stops before mutation;
use --at @ when creating directly from that merge is intentional.
# Historical human list; does not load trunk or managed metadata.
jw list
# Versioned snapshot. List JSON refreshes current workspace by default.
jw list --format=json --refresh=current
jw list --format=json --refresh=none
jw list --format=json --refresh=all
# One workspace. Tokens @, -, ^, and default are supported.
jw status @
jw status feature-api --format=json --refresh=none
# Complete diagnostics. An unhealthy report is still written before exit 1.
jw doctor --format=jsonlist and status JSON use schema version 1 and include frozen JJ operation and
resolved trunk IDs. Known missing values stay explicit null; JSON contains no
ANSI escapes. doctor uses its own schema-versioned report because it must remain
valid even when trunk or metadata is broken.
Doctor keeps schema version 1 while adding the workspace-link diagnostic code.
Consumers should ignore unknown additive diagnostic codes and fields. Human link
results map to PASS, WARN, FAIL, or SKIP; machine output keeps the existing
passed, failed, and skipped states, with severity distinguishing optional
warnings from informational skips and errors. jw status does not inspect or expose
link health in this change.
jw adopt NAME --base REVSET [--bookmark BOOKMARK | --no-bookmark] records lifecycle
intent for an existing workspace. Adoption is insert-only: it requires no existing
managed record and never replaces one. It does not move revisions or bookmarks and
does not refresh the working copy.
Native apps own the Git checkouts they create, including checkouts adopted into JJ.
Keep agent work there, use the actual Git or JJ capability, and give each checkout
one writer; an orchestrator stays read-only in a worker's checkout. jw lifecycle
management is optional and does not require creating a second workspace.
Linked Git topology without valid jw creation provenance makes removal, forgetting
(even --keep-dir), UI removal, and
pruning ineligible. jw adopt persists that owner for damaged or missing checkout
metadata; live topology is protected without adoption. Let the owning app remove
both checkout and Git registration. Then jw reconcile-external NAME can explicitly
forget leftover JJ state and remove the external metadata, retaining commits and
bookmarks. Native JJ forgetting can remove Git registration on some builds, and
undo does not restore that side effect.
jw repair NAME --base REVSET (--bookmark BOOKMARK | --no-bookmark) repairs an
existing readable managed record. NAME is literal; routing shortcuts such as @,
-, and ^ are not accepted. The named workspace must be registered with JJ, and
the base must resolve to exactly one revision. With --bookmark, the bookmark must
already exist locally at one frozen JJ operation; --no-bookmark clears the recorded
association. The checkout path does not need to be usable.
Repair replaces only the recorded creation base and associated bookmark. It preserves
the record's historical timestamps, creation operation, intended remote, and external owner. The
metadata write is atomic, so validation or write failure leaves the old record intact.
The command does not create or move bookmarks, rewrite commits, refresh working
copies, or create a JJ operation. Doctor points invalid bases and missing associated
bookmarks to jw repair; corrupt records still require manual restore, while missing
records still use jw adopt.
CONTEXT.md defines workspace, snapshot, trunk, metadata, stack,
publication, integration, cleanup, and refresh vocabulary. The
architecture notes define dependency direction, metadata
storage, and JSON compatibility. Defined roadmap concepts do not imply an
unlisted command is available; the feature list and jw --help are the current
command surface.
jw supports JJ 0.39 and newer within its tested compatibility window. CI pins
the oldest supported release, 0.39.0, and newer compatibility targets, 0.44.0,
0.45.1, 0.46.0, and 0.47.1, instead of following a moving latest label. On JJ 0.45 and newer,
doctor's divergence remedy can use jj converge --no-interactive; older supported
versions retain the manual merge-or-abandon guidance.
Run cargo test --locked --all-targets for the Rust tests. To exercise the real
PR 9943 adopted-worktree ownership fixtures, set JW_TEST_PINNED_JJ to the exact
ede10cda453017def68e672a5715220ddf10c09b build when running
cargo test --locked --test external_owner. Those fixtures also demonstrate native
forget/undo registration loss and ordinary jw creation/removal. On Unix, build with
cargo build --locked, then run uv run --with pyte tests/terminal_ui.py for
real terminal interaction, shell switching, terminal restoration, and a
50-workspace responsiveness check. The terminal checks use disposable repositories.
This project supports AI-assisted development workflows, and portions of its implementation and documentation may be created with AI assistance. All shipped behavior is intended to be human-reviewed, tested, and maintained to production standards.
jj-waltz is under active development. The core workflow is already functional, and the project is being hardened into a complete standalone CLI with robust testing, release automation, and public distribution.
MIT