Opinionated & intelligent workspace management cli for parallel coding agents, wraps git worktrees.
- Creates isolated workspaces under
repo/.worktrees/<name>/ - Delegates initialization to Claude CLI (copies untracked .env files, target/, node_modules, etc.)
- Automatically intelligent merges changes from workspaces onto the repo root using the Claude CLI
- Runs agent commands directly in your current terminal
git- Claude Code CLI (
claude)
Clone, then install globally:
cargo install --path .- Decide to build a new feature, add tests, etc. e.g.
fix cargo test sir n codex "fix cargo test"- auto generates a workspace name and opens the codex tui with my prompt- Follow-ups in codex and testing in terminal or review in Cursor
sir settlein workspace directory to intelligently settle back to main with auto-generated clean commits- Repeat & parallelize!
Read the whole README, there are useful tips!
Config file lookup order:
~/.config/sir/config.toml~/.sir.toml
Defaults:
claude_bin = "claude"
claude_model = "sonnet"Example:
claude_bin = "claude"
claude_model = "sonnet"Runs sanity checks and prints explicit remediation commands.
Checks include:
- inside a git repo
.worktrees/exists (creates it if missing).worktrees/is gitignoredgit worktreesupport (git worktree list)- Claude CLI installed
Creates/opens a workspace and then runs your agent command in that workspace in the current terminal.
Behavior:
- Ensures
.worktrees/ - Uses automatic naming by default:
- sends your full
<agent_cmd...>to Claude and asks for a short workspace name - if Claude returns
null(or invalid output), falls back to a generated two-word name (for example:pink elephant)
- sends your full
- Use
--name/-nwhen you want an explicit workspace name - Creates new worktrees from
HEADby default- use
--from <revision>to choose a different base revision
- use
- Creates a worktree branch under
sir/*:- derived from the workspace name (whitespace collapsed to
-for branch safety) - if branch exists:
git worktree add repo/.worktrees/<name> <branch> - else:
git worktree add -b <branch> repo/.worktrees/<name> <revision> - note: if branch already exists,
--fromis ignored
- derived from the workspace name (whitespace collapsed to
- Newly created worktrees are seeded with current uncommitted changes from the source repo by default
- applies tracked staged/unstaged diff from
HEAD - copies untracked files (excluding ignored files)
- if workspace already exists, seeding is skipped
- applies tracked staged/unstaged diff from
- If an existing workspace looks incomplete or not git-backed,
sirauto-recreates it before running the agent command - Runs Claude init prompt from repo root to copy:
.env(if present, non-destructive)target/(if present)node_modules/(if present)- no symlinks
- uses
--model sonnetby default (configurable viaclaude_model)
- Runs
<agent_cmd...>through your$SHELLwith cwd set to the workspace - After the agent command exits, leaves you in an interactive
$SHELLin that workspace
Examples:
sir new claude -p "fix flaky indexing test"
sir n codex
sir new --name feature-a claude -p "fix failing tests"
sir n -n bugfix-42 codex
sir new --from main codexWorkspace listing from .worktrees/ (excluding _logs, _tmp) plus any other linked git worktrees for this repo (for example Codex-managed external worktrees).
For each workspace, prints:
- short index (
IDX) for fast targeting - name
- backend detection (
gitorunknown) - source (
localorlinked) - status summary (
git status -sb)
Examples:
sir status
sir t --jsonOpens an interactive shell in workspace <name>.
In non-interactive environments, it prints the workspace path instead of launching a shell.
Example:
sir open fooRemoves workspace by <name-or-index>, or removes all clean workspaces with --all-clean.
Behavior:
sir rm <name-or-index>:- resolves target from
sir statusrows (local + linked external worktrees) - supports either workspace name or
IDX - removes git-backed workspaces with
git worktree remove --force - if the workspace is non-git leftovers, deletes the directory directly
- resolves target from
sir rm --all-clean:- scans all discovered workspaces from
sir status(local + linked) - for git-backed workspaces, checks
git status --porcelain - removes only workspaces with no unstaged/untracked changes
- skips dirty workspaces (including untracked files)
- staged-only changes are treated as clean for this check
- scans all discovered workspaces from
Example:
sir rm foo
sir rm 2
sir rm --all-cleanDelegates integration of a workspace back to main to Claude.
Behavior:
- Workspace resolution:
- provided name:
repo/.worktrees/<name> - omitted name: inferred from current directory when inside a linked git worktree (
.worktrees/<name>or an external worktree path such as Codex-managed worktrees)
- provided name:
- Runs Claude in workspace with
--dangerously-skip-permissions - Uses
--model sonnetby default (configurable viaclaude_model) - Appends
--prompt <text>(or an inferred additional prompt) to the settle instructions- convenience behavior: when run inside a workspace,
sir settle "extra instruction"treats the argument as additional prompt if it is not an existing workspace name
- convenience behavior: when run inside a workspace,
- Prompt instructs Claude to:
- inspect status/diff/log with git
- produce clean commit(s) and strong commit messages
- integrate/rebase/merge onto latest
main - resolve conflicts
- not remove/prune the workspace worktree during settle
- update
.envwhen example env files changed (without overwriting secrets)
- After Claude returns, prints post-check:
git status -sbat repo root
- If
sir settleis run while your current directory is inside a linked worktree, it opens an interactive shell at the repo root after settle completes
Examples:
sir settle foo
cd .worktrees/foo && sir settle
sir settle foo --prompt "run full test suite before final integration"
cd .worktrees/foo && sir settle "run full test suite before final integration"
# also works from external linked worktrees (example path shape):
cd ~/.codex/worktrees/3ed7/sir && sir settle- Workspace names cannot contain path separators and cannot be
_logsor_tmp. siris git-only.
Using just:
just build
just test
just clippy
just fmt
just run -- --help