workon
Development workspace launcher using Zellij.
Opens a project directory in a Zellij session using a layout you pick. The default layout is 3 panes:
- Left top (80%): Claude CLI
- Left bottom (20%): Terminal
- Right (50%): branchdiff
You can switch to a different layout per invocation with -c <name> — see Custom configs.
Dependencies
The remaining dependencies are derived from whichever config you launch. The default config requires:
- claude - Claude CLI
- branchdiff - Git/jj diff TUI
A different config (see Custom configs) may require different binaries — workon will detect them by parsing the active layout and tell you what's missing.
Installation
Or build from source:
Usage
The session is named after the project by default. Pass --name to override
it — handy for running a second session of the same project under a distinct
name. With -w, --name also labels the worktree and the saved bookmark.
Workspace mode (-w)
Creates an ephemeral jj workspace in ~/.worktrees/ for running a second independent session on the same repo. The workspace is cleaned up when the Zellij session closes.
What it does:
- Initializes jj (colocated) if the project only has git
- Creates a jj workspace branched from trunk (main/master)
- Clones gitignored files (build artifacts,
node_modules/,target/, etc.) using APFSclonefile(2)on macOS for near-instant copy-on-write directory cloning, with cross-platform reflink fallback via clonetree - For Rails apps: creates an isolated test database and loads the schema
- Launches a Zellij session in the workspace
- On exit: prompts to bookmark uncommitted work, forgets the jj workspace, drops any test database, and removes the directory in the background
The primary session (workon mbc) is unaffected — it works directly in the project directory as before.
Limitations
- The workspace shares the development database with the primary session. Don't run migrations or the Rails server from a workspace.
parallel_rspecuses shared test databases. Usebundle exec rspecin the workspace for isolated specs.
Custom configs
A "config" is a named Zellij layout file. Pick one with -c <name>; the default is used when -c is omitted (or -c default is passed explicitly).
Creating a config
Configs are zellij layout files (.kdl) stored in ~/.config/workon/configs/. To make one:
1. Create the directory (one-time, if it doesn't exist yet):
2. Pick a name — letters, digits, -, or _ only. The filename must match what you'll pass to -c. For example, to make a config called opencode:
3. Write the layout. Here's a 4-pane starter (opencode + branchdiff + specdiff) you can adapt:
default_mode "locked"
layout {
tab {
pane split_direction="vertical" {
pane split_direction="horizontal" size="50%" {
pane command="opencode" size="80%" focus=true
pane size="20%"
}
pane split_direction="horizontal" size="50%" {
pane command="branchdiff" size="80%"
pane command="specdiff" size="20%"
}
}
}
}
on_force_close "quit"
session_serialization false
4. Launch it:
Tips:
- Mark exactly one pane with
focus=true. workon uses it to detect which config a running session was launched with. Without it, the layout-mismatch guard can't reliably distinguish your configs. - Every
command="..."in the layout must be a binary on yourPATH. workon checks before launching and tells you what's missing. - For the full layout syntax, see the zellij layout docs.
Where configs are loaded from
The default config (no -c flag, or -c default) is resolved in this order:
~/.config/workon/configs/default.kdl— your override, if present~/.config/workon/layout.kdl— legacy single-config path, still honored- The embedded default layout (claude + branchdiff)
Named lookup (-c foo) only checks ~/.config/workon/configs/foo.kdl and errors if the file is missing.
Layout-mismatch guard
A zellij session is named after its project directory, and zellij ignores the layout when attaching to an existing session. To prevent silently re-attaching with the wrong layout, workon inspects the running session's process tree and refuses to attach if the requested config's focused command isn't present:
$ workon -c opencode # but a default-config session is already running
Error: zellij session 'workon' is already running in the main worktree with a
different layout. Zellij keeps the original layout when reattaching, so
'opencode' would be ignored.
To open it as a separate workspace, run: workon -w -c opencode
To replace the running session instead: workon --new-session -c opencode
This works in both directions — bare workon against a session you started with -c opencode will also be refused.
--resume requires a claude config
-r/--resume injects --session-id into the layout's claude pane. Configs without a command="claude" pane are rejected up-front:
$ workon -w --resume <id> -c opencode
Error: --resume only works with claude-based configs (active config: opencode)
Session management
Sessions are named after the directory basename. Running workon mbc twice reattaches to the existing session. Use -n to start fresh.
If a zellij server is hung, workon detects the unresponsive IPC (5s timeout), kills only the server bound to your project's session (other sessions are left alone), removes the stale socket, and launches a fresh session. Recovery runs whether or not you pass -n. Pre-flight checks before attach and launch ensure the no-timeout interactive zellij commands won't block on a wedged server.
Workspace sessions are named <project>-ws-<id> (e.g., mbc-ws-a1b2c3) and don't collide with primary sessions.
Claude Code setup
To skip the workspace trust prompt and auto-allow file operations in worktrees, add to ~/.claude/settings.json:
Workspace trust is also pre-seeded in ~/.claude.json automatically on each workon -w launch.
Tips
- Click URLs:
Cmd+Shift+Clickto open hyperlinks (Shift bypasses zellij mouse handling) - Locked mode: Zellij starts in locked mode. Press
Ctrl+Gto unlock for Zellij features.