Skip to content

Commands

CommandWhat
initFirst-run wizard: remote (private), machine identity, roots, hooks
syncWalk → redact → manifest → tripwire → commit → push (--dry-run)
pullFetch latest into the staging repo (no write to ~/.claude)
restoreRestore here, rewriting paths (--dir, --backup, --force, --prune)
statusSync state: remote, last sync, roots, hooks
globalinstall / uninstall / status the global sync hooks in ~/.claude (alias hooks)
projectinstall / uninstall / status this repo's guard hook + CLAUDE.md guide (committed)
localsame as project, but gitignored (.claude/settings.local.json)
guardPreToolUse hook enforcing worktree/PR discipline (wired by project/local)
guideinstall / 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)
mcplist / 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)
accountManage 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
configget / set / show / path / edit (~/.clauderig/config.json)
doctorHealth-check environment + sync + worktree discipline (--fix repairs)
uiInteractive 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

sh
clauderig hooks install

Wires 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.

sh
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:

sh
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:

json
"worktree": { "autoOpen": true, "openCmd": "cursor -n" }
  • autoOpen (default false) — whether new opens a window at all. Off by default; --open/--no-open override it per run. worktree open is an explicit request and always opens regardless.
  • openCmd (default code -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.

Released under the MIT License.