Commands
| Command | What |
|---|---|
init | First-run wizard: remote (private), machine identity, roots, hooks |
sync | Walk → redact → manifest → tripwire → commit → push (--dry-run) |
pull | Fetch latest into the staging repo (no write to ~/.claude) |
restore | Restore here, rewriting paths (--dir, --backup, --force, --prune) |
status | Sync state: remote, last sync, roots, hooks |
global | install / uninstall / status the global sync hooks in ~/.claude (alias hooks) |
project | install / uninstall / status this repo's guard hook + CLAUDE.md guide (committed) |
local | same as project, but gitignored (.claude/settings.local.json) |
guard | PreToolUse hook enforcing worktree/PR discipline (wired by project/local) |
guide | install / uninstall / status / show the CLAUDE.md guide block standalone (--global targets ~/.claude/CLAUDE.md, --path overrides; install previews in a scrollable UI, skipped with -y or off a TTY) |
mcp | list / get / add / remove / enable / disable MCP servers (--scope user|project|local, --transport stdio|http|sse, --env, --header); bare mcp on a TTY opens an interactive screen (mirrors claude mcp) |
account | Manage multiple Claude Code logins: add / list (alias ls/status) / run <id|email> [-- claude args] / switch / sessions (alias ps) / remove (alias rm) / purge. run --no-share isolates a session; switch takes --dry-run / --force / --kill |
config | get / set / show / path / edit (~/.clauderig/config.json) |
doctor | Health-check environment + sync + worktree discipline (--fix repairs) |
ui | Interactive dashboard |
The worktree / branch / prune verbs (rig worktree, rig branch, rig prune) live in rig — claudeRig wires the guard that makes them the default path. See Worktree discipline below.
The sync → restore loop
sync snapshots your ~/.claude setup, redacts secret-bearing fields, rewrites machine-specific paths into a portable form, and commits/pushes to your private repo. restore does the inverse on another machine: it pulls, rewrites the portable paths into this OS's slugs, and merges — keeping any local secrets in place so a new machine simply re-authenticates.
Hooks
clauderig hooks installWires two Claude Code hooks: SessionStart → pull (so each session starts from the latest synced state) and Stop → sync (so your work is captured when a session ends). Both are portable across OSes and idempotent.
Worktree discipline
clauderig guard (a PreToolUse hook) and rig worktree make worktrees and PRs the default path for Claude Code, and stop a session from scrambling your VS Code chat history by moving its working directory. Chat history is keyed to the folder path, so the model edits from one pinned window while worktrees open in their own window for review only.
rig worktree new <branch> # sibling checkout off mainline (prints the path)
rig worktree new <branch> --open # …and open a review window for this run
rig worktree new fix/x --base release-1
rig worktree list # this repo's worktrees (alias: ls)
rig worktree open <branch> # (re)open a worktree's review window (branch or path)
rig worktree rm <branch> # remove the worktree, keep the branch (-f if dirty)Worktrees live at <parent>/<repo>-worktrees/<branch> — a sibling of the repo, so they never clutter the primary checkout and each gets its own review-window history. new never moves the session's cwd; it prints the path and, when opted in, opens a separate window.
Configuring the review window
By default new does not open a window — opt in per run with --open, or always with the worktree.autoOpen config. Both whether it opens and what it opens are configurable:
clauderig config set worktree.autoOpen true # always auto-open (like --open)
clauderig config set worktree.openCmd "cursor -n" # open Cursor instead of VS Code
clauderig config set worktree.openCmd "" # reset to the default (code -n)This writes a worktree block to ~/.clauderig/config.json:
"worktree": { "autoOpen": true, "openCmd": "cursor -n" }autoOpen(defaultfalse) — whethernewopens a window at all. Off by default;--open/--no-openoverride it per run.worktree openis an explicit request and always opens regardless.openCmd(defaultcode -n) — the program plus any flags; the worktree path is appended as the final argument and run directly (no shell). Examples:code -n,cursor -n,code-insiders -n,subl -n,idea.
When the opener isn't on PATH, new/open print the command to run instead, and clauderig doctor flags it.
TIP
See the worktree-discipline doc for the guard rules and the full model.
TIP
See the design doc for the full picture.