Git Ops Intelligent git operations orchestrator. Routes read-only queries inline for speed, dispatches write operations to a background Sonnet agent ( ) to free the main session. Architecture Safety Tiers Tier 1: Read-Only - Run Inline No subagent needed. Execute directly via Bash for instant results. | Operation | Command | |-----------|---------| | Status (rich) | — one-shot HEAD + sync + tree + worktrees + branches + PR | | Worktree survey | — per-worktree state, drift detection, prunable/WIP/ghost/orphan triage | | Status (bare) | | | Log | | | Diff (unstaged) | | | Diff (staged) | | | Di…

\\t' read -r path branch head; do\n [ -z \"$path\" ] && continue\n\n # Canonical absolute (for orphan comparison)\n canon_path=$( (cd \"$path\" 2>/dev/null && pwd -P) || echo \"$path\" )\n\n # Display path\n if [ \"$path\" = \"$REPO_ROOT\" ]; then\n disp=\"\u003ctrunk>\"\n else\n disp=\"${path#$REPO_ROOT/}\"\n [ ${#disp} -gt 38 ] && disp=\"...${disp: -35}\"\n fi\n\n # Ghost: registered but filesystem gone\n if [ ! -d \"$path\" ]; then\n printf \"%-40s %-20s %-22s %-12s %s\\n\" \"\u003c$disp>\" \"$branch\" \"FILESYSTEM GONE\" \"?\" \"git worktree prune\"\n GHOSTS=$((GHOSTS+1))\n continue\n fi\n\n # Tree state\n staged=$(git -C \"$path\" diff --cached --name-only 2>/dev/null | wc -l | tr -d ' ')\n unstaged=$(git -C \"$path\" diff --name-only 2>/dev/null | wc -l | tr -d ' ')\n untracked=$(git -C \"$path\" ls-files --others --exclude-standard 2>/dev/null | wc -l | tr -d ' ')\n\n # Upstream sync\n ahead=0\n behind=0\n if [ \"$branch\" != \"(detached)\" ] && git -C \"$path\" rev-parse '@{u}' >/dev/null 2>&1; then\n ahead=$(git -C \"$path\" rev-list --count '@{u}..HEAD' 2>/dev/null || echo 0)\n behind=$(git -C \"$path\" rev-list --count 'HEAD..@{u}' 2>/dev/null || echo 0)\n fi\n\n # Age\n age=\"?\"\n if [ -n \"$head\" ]; then\n age=$(git log -1 --format='%ar' \"$head\" 2>/dev/null | sed 's/ ago//')\n fi\n\n # Merged into trunk?\n merged=false\n if [ -n \"$head\" ] && [ \"$branch\" != \"$TRUNK\" ] && \\\n git rev-parse --verify \"$TRUNK\" >/dev/null 2>&1 && \\\n git merge-base --is-ancestor \"$head\" \"$TRUNK\" 2>/dev/null; then\n merged=true\n fi\n\n # Build state string\n state=\"\"\n dirty=false\n [ \"$staged\" -gt 0 ] && state=\"${state} ${staged}s\" && dirty=true\n [ \"$unstaged\" -gt 0 ] && state=\"${state} ${unstaged}u\" && dirty=true\n [ \"$untracked\" -gt 0 ] && state=\"${state} ${untracked}?\" && dirty=true\n [ \"$ahead\" -gt 0 ] && state=\"${state} +${ahead}\"\n [ \"$behind\" -gt 0 ] && state=\"${state} -${behind}\"\n state=\"${state# }\"\n [ -z \"$state\" ] && state=\"clean\"\n [ \"$merged\" = true ] && state=\"$state (merged)\"\n\n # Verdict\n if [ \"$branch\" = \"$TRUNK\" ]; then\n verdict=\"(trunk)\"\n elif [ \"$dirty\" = true ]; then\n verdict=\"has WIP\"\n WIP=$((WIP+1))\n elif [ \"$ahead\" -gt 0 ]; then\n verdict=\"unpushed\"\n UNPUSHED=$((UNPUSHED+1))\n elif [ \"$merged\" = true ]; then\n verdict=\"PRUNABLE\"\n PRUNABLE=$((PRUNABLE+1))\n else\n verdict=\"in-flight\"\n fi\n\n printf \"%-40s %-20s %-22s %-12s %s\\n\" \"$disp\" \"$branch\" \"$state\" \"$age\" \"$verdict\"\ndone \u003c \"$TMP_REG\"\n\n# --- Orphans: filesystem entries in .claude/worktrees/ with no registration ---\nwhile IFS= read -r fs_path; do\n [ -z \"$fs_path\" ] && continue\n registered=false\n while IFS=

Git Ops Intelligent git operations orchestrator. Routes read-only queries inline for speed, dispatches write operations to a background Sonnet agent ( ) to free the main session. Architecture Safety Tiers Tier 1: Read-Only - Run Inline No subagent needed. Execute directly via Bash for instant results. | Operation | Command | |-----------|---------| | Status (rich) | — one-shot HEAD + sync + tree + worktrees + branches + PR | | Worktree survey | — per-worktree state, drift detection, prunable/WIP/ghost/orphan triage | | Status (bare) | | | Log | | | Diff (unstaged) | | | Diff (staged) | | | Di…

\\t' read -r reg_path _ _; do\n reg_canon=$( (cd \"$reg_path\" 2>/dev/null && pwd -P) || echo \"$reg_path\" )\n if [ \"$reg_canon\" = \"$fs_path\" ]; then\n registered=true\n break\n fi\n done \u003c \"$TMP_REG\"\n if [ \"$registered\" = false ]; then\n disp=\"${fs_path#$REPO_ROOT/}\"\n printf \"%-40s %-20s %-22s %-12s %s\\n\" \"$disp\" \"?\" \"UNREGISTERED\" \"?\" \"manual review (DO NOT touch)\"\n ORPHANS=$((ORPHANS+1))\n fi\ndone \u003c \"$TMP_FS\"\n\nrm -f \"$TMP_REG\" \"$TMP_FS\"\n\n# --- Summary ---\necho \"\"\necho \"Summary: $WT_COUNT registered / $FS_COUNT in .claude/worktrees / $ORPHANS orphan\"\necho \" PRUNABLE (merged, clean, linked): $PRUNABLE\"\necho \" WIP (uncommitted changes): $WIP\"\necho \" Unpushed (ahead of upstream): $UNPUSHED\"\necho \" Ghost (registered, FS missing): $GHOSTS\"\necho \" Orphan (FS exists, unregistered): $ORPHANS ← read-only, never rm without review\"\n\n# Legend note (shown only if abbreviations appear in output)\nif [ \"$WIP\" -gt 0 ] || [ \"$UNPUSHED\" -gt 0 ]; then\n echo \"\"\n echo \" STATE legend: Ns=staged, Nu=unstaged, N?=untracked, +N=ahead, -N=behind\"\nfi\n\n# Exit 1 if anything needs attention\nif [ \"$GHOSTS\" -gt 0 ] || [ \"$ORPHANS\" -gt 0 ] || [ \"$PRUNABLE\" -gt 0 ]; then\n exit 1\nfi\nexit 0\n","content_type":"application/x-sh; charset=utf-8","language":"bash","size":6234,"content_sha256":"d12d2344e1f76199015c42165447919aae3e7ceaed6e956d68bffa16c407ff39"}],"content_json":{"type":"doc","content":[{"type":"heading","attrs":{"level":1},"content":[{"text":"Git Ops","type":"text"}]},{"type":"paragraph","content":[{"text":"Intelligent git operations orchestrator. Routes read-only queries inline for speed, dispatches write operations to a background Sonnet agent (","type":"text"},{"text":"git-agent","type":"text","marks":[{"type":"code_inline"}]},{"text":") to free the main session.","type":"text"}]},{"type":"heading","attrs":{"level":2},"content":[{"text":"Architecture","type":"text"}]},{"type":"code_block","attrs":{"wrap":false,"language":""},"content":[{"text":"User intent (commit, PR, rebase, status, etc.)\n |\n +---> Tier 1: Read-only (status, log, diff, blame)\n | |\n | +---> Execute INLINE via Bash (fast, no subagent)\n |\n +---> Tier 2: Safe writes (commit, push, tag, PR, stash)\n | |\n | +---> Gather context from conversation\n | +---> Dispatch to git-agent (background, Sonnet)\n | | +---> Fallback: general-purpose with inlined protocol\n | +---> Agent executes and reports back\n |\n +---> Tier 3: Destructive (rebase, reset, force-push, branch -D)\n |\n +---> Dispatch to git-agent (background, Sonnet)\n | +---> Fallback: general-purpose with inlined protocol\n +---> Agent produces PREFLIGHT REPORT (does NOT execute)\n +---> Orchestrator relays preflight to user\n +---> On confirmation: re-dispatch with execute authority","type":"text"}]},{"type":"heading","attrs":{"level":2},"content":[{"text":"Safety Tiers","type":"text"}]},{"type":"heading","attrs":{"level":3},"content":[{"text":"Tier 1: Read-Only - Run Inline","type":"text"}]},{"type":"paragraph","content":[{"text":"No subagent needed. Execute directly via Bash for instant results.","type":"text"}]},{"type":"table","attrs":{"layout":null},"content":[{"type":"tr","content":[{"type":"th","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Operation","type":"text"}]}]},{"type":"th","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Command","type":"text"}]}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Status (rich)","type":"text","marks":[{"type":"strong"}]}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"bash $HOME/.claude/skills/git-ops/scripts/status.sh","type":"text","marks":[{"type":"code_inline"}]},{"text":" — one-shot HEAD + sync + tree + worktrees + branches + PR","type":"text"}]}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Worktree survey","type":"text","marks":[{"type":"strong"}]}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"bash $HOME/.claude/skills/git-ops/scripts/worktree-survey.sh","type":"text","marks":[{"type":"code_inline"}]},{"text":" — per-worktree state, drift detection, prunable/WIP/ghost/orphan triage","type":"text"}]}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Status (bare)","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"git status --short","type":"text","marks":[{"type":"code_inline"}]}]}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Log","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"git log --oneline -20","type":"text","marks":[{"type":"code_inline"}]}]}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Diff (unstaged)","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"git diff --stat","type":"text","marks":[{"type":"code_inline"}]}]}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Diff (staged)","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"git diff --cached --stat","type":"text","marks":[{"type":"code_inline"}]}]}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Diff (full)","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"git diff [file]","type":"text","marks":[{"type":"code_inline"}]},{"text":" or ","type":"text"},{"text":"git diff --cached [file]","type":"text","marks":[{"type":"code_inline"}]}]}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Branch list","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"git branch -v","type":"text","marks":[{"type":"code_inline"}]}]}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Remote branches","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"git branch -rv","type":"text","marks":[{"type":"code_inline"}]}]}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Stash list","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"git stash list","type":"text","marks":[{"type":"code_inline"}]}]}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Blame","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"git blame [file]","type":"text","marks":[{"type":"code_inline"}]}]}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Show commit","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"git show [hash] --stat","type":"text","marks":[{"type":"code_inline"}]}]}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Reflog","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"git reflog --oneline -20","type":"text","marks":[{"type":"code_inline"}]}]}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Tags","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"git tag --list --sort=-v:refname","type":"text","marks":[{"type":"code_inline"}]}]}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Worktree list","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"git worktree list","type":"text","marks":[{"type":"code_inline"}]}]}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"PR list","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"gh pr list","type":"text","marks":[{"type":"code_inline"}]}]}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"PR status","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"gh pr view [N]","type":"text","marks":[{"type":"code_inline"}]}]}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Issue list","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"gh issue list","type":"text","marks":[{"type":"code_inline"}]}]}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"CI checks","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"gh pr checks [N]","type":"text","marks":[{"type":"code_inline"}]}]}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Run status","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"gh run list --limit 5","type":"text","marks":[{"type":"code_inline"}]}]}]}]}]},{"type":"paragraph","content":[{"text":"For T1 operations, format results cleanly and present directly. Use ","type":"text"},{"text":"delta","type":"text","marks":[{"type":"code_inline"}]},{"text":" for diffs when available.","type":"text"}]},{"type":"paragraph","content":[{"text":"When to reach for the bundled scripts:","type":"text","marks":[{"type":"strong"}]}]},{"type":"bullet_list","content":[{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"User asks \"status\", \"where are we\", \"anything to commit\", \"anything to push\" → ","type":"text"},{"text":"status.sh","type":"text","marks":[{"type":"code_inline"}]}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"User asks about worktrees, prunable branches, drift, \"what can we clean up\" → ","type":"text"},{"text":"worktree-survey.sh","type":"text","marks":[{"type":"code_inline"}]}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Both scripts exit 0 if clean, 1 if attention needed, 2 if not-a-repo — composable.","type":"text"}]}]}]},{"type":"heading","attrs":{"level":2},"content":[{"text":"Hygiene Checks (Proactive — Run During Every T1 Status)","type":"text"}]},{"type":"paragraph","content":[{"text":"When running any status check, scan for these anti-patterns and surface them ","type":"text"},{"text":"before","type":"text","marks":[{"type":"strong"}]},{"text":" the status output. Don't wait for the user to notice. The ","type":"text"},{"text":"status.sh","type":"text","marks":[{"type":"code_inline"}]},{"text":" script handles checks 1 and 2 automatically; checks 3 and 4 are Claude's responsibility.","type":"text"}]},{"type":"heading","attrs":{"level":3},"content":[{"text":"Anti-pattern 1: Main checkout on a feature branch 🔴","type":"text"}]},{"type":"paragraph","content":[{"text":"Signal:","type":"text","marks":[{"type":"strong"}]},{"text":" In the main checkout (not a worktree) and ","type":"text"},{"text":"git branch --show-current","type":"text","marks":[{"type":"code_inline"}]},{"text":" ≠ the repo's default branch (","type":"text"},{"text":"main","type":"text","marks":[{"type":"code_inline"}]},{"text":"/","type":"text"},{"text":"master","type":"text","marks":[{"type":"code_inline"}]},{"text":"/","type":"text"},{"text":"trunk","type":"text","marks":[{"type":"code_inline"}]},{"text":").","type":"text"}]},{"type":"paragraph","content":[{"text":"Why it's bad:","type":"text","marks":[{"type":"strong"}]},{"text":" The main checkout is the fallback workspace. Feature branches sitting there block clean status reads, confuse worktree operations, and make it unclear what \"current\" state is. Feature work belongs in dedicated worktrees.","type":"text"}]},{"type":"paragraph","content":[{"text":"Flag it:","type":"text","marks":[{"type":"strong"}]},{"text":" Emit a prominent warning before the status output.","type":"text"}]},{"type":"paragraph","content":[{"text":"Fix:","type":"text","marks":[{"type":"strong"}]}]},{"type":"code_block","attrs":{"wrap":false,"language":"bash"},"content":[{"text":"git checkout main # return main to trunk\ngit worktree add .claude/worktrees/\u003cname> \u003cfeature-branch> # move work to worktree","type":"text"}]},{"type":"paragraph","content":[{"text":"Detecting main checkout vs worktree:","type":"text","marks":[{"type":"strong"}]}]},{"type":"code_block","attrs":{"wrap":false,"language":"bash"},"content":[{"text":"GIT_DIR=$(git rev-parse --git-dir 2>/dev/null)\n# \".git\" → main checkout → check applies\n# contains \"worktrees\" → inside a worktree → skip this check","type":"text"}]},{"type":"heading","attrs":{"level":3},"content":[{"text":"Anti-pattern 2: Stale merged branches 🟡","type":"text"}]},{"type":"paragraph","content":[{"text":"Signal:","type":"text","marks":[{"type":"strong"}]},{"text":" ","type":"text"},{"text":"git branch --merged \u003cdefault>","type":"text","marks":[{"type":"code_inline"}]},{"text":" returns branches other than the trunk.","type":"text"}]},{"type":"paragraph","content":[{"text":"Why it's bad:","type":"text","marks":[{"type":"strong"}]},{"text":" Merged-but-undeleted branches are noise that obscures what's actually in flight.","type":"text"}]},{"type":"paragraph","content":[{"text":"Flag it:","type":"text","marks":[{"type":"strong"}]},{"text":" Report the count. Suggest ","type":"text"},{"text":"git branch cleanup","type":"text","marks":[{"type":"code_inline"}]},{"text":" to review and delete.","type":"text"}]},{"type":"heading","attrs":{"level":3},"content":[{"text":"Anti-pattern 3: WIP commits on a pushed branch 🟡","type":"text"}]},{"type":"paragraph","content":[{"text":"Signal:","type":"text","marks":[{"type":"strong"}]},{"text":" ","type":"text"},{"text":"git log --oneline @{u}..HEAD","type":"text","marks":[{"type":"code_inline"}]},{"text":" contains subject lines matching ","type":"text"},{"text":"wip|WIP|todo|TODO|fixme|FIXME|temp|TEMP|hack|HACK","type":"text","marks":[{"type":"code_inline"}]},{"text":".","type":"text"}]},{"type":"paragraph","content":[{"text":"Why it's bad:","type":"text","marks":[{"type":"strong"}]},{"text":" WIP markers in pushed history signal unfinished work that shouldn't have left the local machine. Creates confusing history and blocks clean PRs.","type":"text"}]},{"type":"paragraph","content":[{"text":"Flag it:","type":"text","marks":[{"type":"strong"}]},{"text":" List the offending commits and suggest an interactive rebase to squash or rename.","type":"text"}]},{"type":"heading","attrs":{"level":3},"content":[{"text":"Anti-pattern 4: Large uncommitted pile 🟡","type":"text"}]},{"type":"paragraph","content":[{"text":"Signal:","type":"text","marks":[{"type":"strong"}]},{"text":" staged + unstaged + untracked > 20 files.","type":"text"}]},{"type":"paragraph","content":[{"text":"Why it's bad:","type":"text","marks":[{"type":"strong"}]},{"text":" Large uncommitted diffs are hard to review, easy to lose, and signal a broken \"commit as you go\" habit.","type":"text"}]},{"type":"paragraph","content":[{"text":"Flag it:","type":"text","marks":[{"type":"strong"}]},{"text":" Note the total and suggest committing incrementally by logical unit.","type":"text"}]},{"type":"hr","attrs":{"markup":"---"}},{"type":"heading","attrs":{"level":3},"content":[{"text":"Tier 2: Safe Writes - Dispatch to Agent","type":"text"}]},{"type":"paragraph","content":[{"text":"Gather relevant context, then dispatch to ","type":"text"},{"text":"git-agent","type":"text","marks":[{"type":"code_inline"}]},{"text":" (background, Sonnet).","type":"text"}]},{"type":"paragraph","content":[{"text":"Context gathering before dispatch:","type":"text","marks":[{"type":"strong"}]}]},{"type":"table","attrs":{"layout":null},"content":[{"type":"tr","content":[{"type":"th","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Operation","type":"text"}]}]},{"type":"th","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Context to Gather","type":"text"}]}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Commit","type":"text","marks":[{"type":"strong"}]}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"What the user has been working on (from conversation), staged files, recent commit style","type":"text"}]}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Push","type":"text","marks":[{"type":"strong"}]}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Current branch, tracking info, commits ahead of remote","type":"text"}]}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"PR create","type":"text","marks":[{"type":"strong"}]}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"All commits on branch vs main, conversation context for description","type":"text"}]}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Tag/release","type":"text","marks":[{"type":"strong"}]}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Commits since last tag, version pattern in use","type":"text"}]}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Stash","type":"text","marks":[{"type":"strong"}]}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Current changes, user's stash message if provided","type":"text"}]}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Cherry-pick","type":"text","marks":[{"type":"strong"}]}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Target commit details, current branch","type":"text"}]}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Branch create","type":"text","marks":[{"type":"strong"}]}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Base branch, naming convention from recent branches","type":"text"}]}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"gh issue create","type":"text","marks":[{"type":"strong"}]}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"User description, labels if mentioned","type":"text"}]}]}]}]},{"type":"paragraph","content":[{"text":"Dispatch template:","type":"text","marks":[{"type":"strong"}]}]},{"type":"code_block","attrs":{"wrap":false,"language":""},"content":[{"text":"You are the git-agent handling a Tier 2 (safe write) operation.\n\n## Domain Knowledge\nFor release or PR operations, read CI context first:\n- Read: skills/ci-cd-ops/SKILL.md (release workflows, PR conventions)\n\n## Context\n- Current branch: {branch}\n- Repository: {repo info}\n- User intent: {what the user asked for}\n- Conversation context: {relevant summary of what was being worked on}\n\n## Operation\n{specific operation details}\n\n## Project Conventions\n{commit style, branch naming, PR template if detected}\n\nExecute the operation following your T2 protocol (verify state, execute, confirm, report).","type":"text"}]},{"type":"heading","attrs":{"level":3},"content":[{"text":"Tier 3: Destructive - Preflight Required","type":"text"}]},{"type":"paragraph","content":[{"text":"Dispatch to ","type":"text"},{"text":"git-agent","type":"text","marks":[{"type":"code_inline"}]},{"text":" with explicit instruction to produce a preflight report ONLY.","type":"text"}]},{"type":"paragraph","content":[{"text":"Dispatch template (preflight):","type":"text","marks":[{"type":"strong"}]}]},{"type":"code_block","attrs":{"wrap":false,"language":""},"content":[{"text":"You are the git-agent handling a Tier 3 (destructive) operation.\n\n## Context\n- Current branch: {branch}\n- Repository: {repo info}\n- User intent: {what the user asked for}\n\n## Operation\n{specific operation details}\n\nIMPORTANT: Do NOT execute this operation. Produce a T3 Preflight Report only.\nShow exactly what will happen, what the risks are, and how to recover.","type":"text"}]},{"type":"paragraph","content":[{"text":"After user confirms:","type":"text","marks":[{"type":"strong"}]},{"text":" Re-dispatch with execute authority:","type":"text"}]},{"type":"code_block","attrs":{"wrap":false,"language":""},"content":[{"text":"User has confirmed the Tier 3 operation after reviewing the preflight.\n\n## Approved Operation\n{exact operation from preflight}\n\n## Confirmation\nProceed with execution. Follow T3 execution protocol:\n1. Create a safety bookmark: note the current HEAD hash\n2. Execute the operation\n3. Verify the result\n4. Report with the safety bookmark for recovery","type":"text"}]},{"type":"heading","attrs":{"level":2},"content":[{"text":"Dispatch Mechanics","type":"text"}]},{"type":"heading","attrs":{"level":3},"content":[{"text":"Background Agent (Default for T2/T3)","type":"text"}]},{"type":"code_block","attrs":{"wrap":false,"language":"python"},"content":[{"text":"# Dispatch to git-agent, runs in background, Sonnet model\nAgent(\n subagent_type=\"git-agent\",\n model=\"sonnet\",\n run_in_background=True, # Frees main session\n prompt=\"...\" # From dispatch templates above\n)","type":"text"}]},{"type":"paragraph","content":[{"text":"The main session continues working while the agent handles git operations. Results arrive asynchronously.","type":"text"}]},{"type":"heading","attrs":{"level":3},"content":[{"text":"Foreground Agent (When Result Needed Immediately)","type":"text"}]},{"type":"paragraph","content":[{"text":"For operations where the user is waiting on the result (e.g., \"commit this then let's move on\"):","type":"text"}]},{"type":"code_block","attrs":{"wrap":false,"language":"python"},"content":[{"text":"Agent(\n subagent_type=\"git-agent\",\n model=\"sonnet\",\n run_in_background=False, # Wait for result\n prompt=\"...\"\n)","type":"text"}]},{"type":"heading","attrs":{"level":3},"content":[{"text":"Worktree Isolation (Only When Requested)","type":"text"}]},{"type":"paragraph","content":[{"text":"When the user explicitly asks for worktree isolation (e.g., \"do this in a separate worktree\", \"prepare a branch without touching my working tree\"):","type":"text"}]},{"type":"code_block","attrs":{"wrap":false,"language":"python"},"content":[{"text":"Agent(\n subagent_type=\"git-agent\",\n model=\"sonnet\",\n isolation=\"worktree\", # Isolated repo copy\n run_in_background=True,\n prompt=\"...\"\n)","type":"text"}]},{"type":"heading","attrs":{"level":2},"content":[{"text":"Fallback: When git-agent Is Unavailable","type":"text"}]},{"type":"paragraph","content":[{"text":"If ","type":"text"},{"text":"git-agent","type":"text","marks":[{"type":"code_inline"}]},{"text":" is not registered as a subagent type (e.g., plugin not installed, agent files missing), fall back to ","type":"text"},{"text":"general-purpose","type":"text","marks":[{"type":"code_inline"}]},{"text":" with the git-agent identity inlined in the prompt.","type":"text"}]},{"type":"paragraph","content":[{"text":"Detection:","type":"text","marks":[{"type":"strong"}]},{"text":" If dispatching to ","type":"text"},{"text":"git-agent","type":"text","marks":[{"type":"code_inline"}]},{"text":" fails or the subagent type is not listed in available agents, switch to fallback mode automatically.","type":"text"}]},{"type":"paragraph","content":[{"text":"Fallback dispatch template:","type":"text","marks":[{"type":"strong"}]}]},{"type":"code_block","attrs":{"wrap":false,"language":"python"},"content":[{"text":"Agent(\n subagent_type=\"general-purpose\", # Fallback\n model=\"sonnet\",\n run_in_background=True,\n prompt=\"\"\"You are acting as a git operations agent. You are precise, safety-conscious,\nand follow the three-tier safety system:\n- T1 (read-only): execute freely\n- T2 (safe writes): execute on instruction, verify before and after\n- T3 (destructive): preflight report only unless explicitly told to execute\n\n{original dispatch prompt here}\n\"\"\"\n)","type":"text"}]},{"type":"paragraph","content":[{"text":"Key differences from primary dispatch:","type":"text","marks":[{"type":"strong"}]}]},{"type":"bullet_list","content":[{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Uses ","type":"text"},{"text":"general-purpose","type":"text","marks":[{"type":"code_inline"}]},{"text":" instead of ","type":"text"},{"text":"git-agent","type":"text","marks":[{"type":"code_inline"}]},{"text":" subagent type","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Inlines the safety tier protocol directly in the prompt (the agent won't have git-agent's system prompt)","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Everything else stays the same - context gathering, templates, foreground/background choice","type":"text"}]}]}]},{"type":"paragraph","content":[{"text":"When to use each:","type":"text","marks":[{"type":"strong"}]}]},{"type":"table","attrs":{"layout":null},"content":[{"type":"tr","content":[{"type":"th","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Condition","type":"text"}]}]},{"type":"th","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Dispatch Method","type":"text"}]}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"git-agent","type":"text","marks":[{"type":"code_inline"}]},{"text":" available","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Primary: ","type":"text"},{"text":"subagent_type=\"git-agent\"","type":"text","marks":[{"type":"code_inline"}]}]}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"git-agent","type":"text","marks":[{"type":"code_inline"}]},{"text":" unavailable","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Fallback: ","type":"text"},{"text":"subagent_type=\"general-purpose\"","type":"text","marks":[{"type":"code_inline"}]},{"text":" with inlined protocol","type":"text"}]}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"No agent dispatch possible","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Last resort: execute T2 operations inline (main context)","type":"text"}]}]}]}]},{"type":"paragraph","content":[{"text":"The last-resort inline path should only be used for simple T2 operations (single commit, simple push). Complex workflows (PR creation, release, changelog) should always use an agent.","type":"text"}]},{"type":"heading","attrs":{"level":2},"content":[{"text":"Extended Operations","type":"text"}]},{"type":"heading","attrs":{"level":3},"content":[{"text":"Release Workflow","type":"text"}]},{"type":"paragraph","content":[{"text":"git-ops","type":"text","marks":[{"type":"code_inline"}]},{"text":" owns the ","type":"text"},{"text":"local","type":"text","marks":[{"type":"strong"}]},{"text":" half of releases only — analysing commits, generating CHANGELOG content, creating the local tag. The ","type":"text"},{"text":"remote","type":"text","marks":[{"type":"strong"}]},{"text":" half (push, ","type":"text"},{"text":"gh release create","type":"text","marks":[{"type":"code_inline"}]},{"text":", repo metadata) belongs to the ","type":"text"},{"text":"github-ops","type":"text","marks":[{"type":"code_inline"}]},{"text":" skill.","type":"text"}]},{"type":"paragraph","content":[{"text":"When user asks to \"create a release\", \"bump version\", or \"tag a release\":","type":"text"}]},{"type":"ordered_list","attrs":{"order":1,"listStyle":"number"},"content":[{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Inline (T1):","type":"text","marks":[{"type":"strong"}]},{"text":" Check current version and commits since last tag","type":"text"}]},{"type":"code_block","attrs":{"wrap":false,"language":"bash"},"content":[{"text":"git describe --tags --abbrev=0 2>/dev/null\ngit log --oneline $(git describe --tags --abbrev=0 2>/dev/null)..HEAD","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Determine version bump:","type":"text","marks":[{"type":"strong"}]}]},{"type":"bullet_list","content":[{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"feat:","type":"text","marks":[{"type":"code_inline"}]},{"text":" commits -> minor bump","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"fix:","type":"text","marks":[{"type":"code_inline"}]},{"text":" commits -> patch bump","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"BREAKING CHANGE:","type":"text","marks":[{"type":"code_inline"}]},{"text":" or ","type":"text"},{"text":"!:","type":"text","marks":[{"type":"code_inline"}]},{"text":" -> requires explicit user approval (never auto-major)","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Or use version specified by user","type":"text"}]}]}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Dispatch to git-agent (T2):","type":"text","marks":[{"type":"strong"}]},{"text":" Generate CHANGELOG content + create local tag.","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Hand off to ","type":"text","marks":[{"type":"strong"}]},{"text":"github-ops","type":"text","marks":[{"type":"code_inline"},{"type":"strong"}]},{"text":" for the remote half: push commits, push tag, create the GitHub release with notes, update repo metadata if warranted. Do not call ","type":"text"},{"text":"gh release create","type":"text","marks":[{"type":"code_inline"}]},{"text":" from git-ops — that crosses the local/remote boundary. See ","type":"text"},{"text":"skills/github-ops/SKILL.md","type":"text","marks":[{"type":"code_inline"}]},{"text":" mode ","type":"text"},{"text":"update","type":"text","marks":[{"type":"code_inline"}]},{"text":".","type":"text"}]}]}]},{"type":"heading","attrs":{"level":3},"content":[{"text":"Changelog Generation","type":"text"}]},{"type":"paragraph","content":[{"text":"When user asks to \"generate changelog\" or \"update CHANGELOG.md\":","type":"text"}]},{"type":"ordered_list","attrs":{"order":1,"listStyle":"number"},"content":[{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Inline (T1):","type":"text","marks":[{"type":"strong"}]},{"text":" Gather commit history for the range","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Dispatch to git-agent (T2):","type":"text","marks":[{"type":"strong"}]},{"text":" Categorise commits, format as Keep a Changelog, write file","type":"text"}]}]}]},{"type":"heading","attrs":{"level":3},"content":[{"text":"PR Workflow (Full Cycle)","type":"text"}]},{"type":"paragraph","content":[{"text":"When user says \"create a PR\" or \"open a PR\":","type":"text"}]},{"type":"ordered_list","attrs":{"order":1,"listStyle":"number"},"content":[{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Inline (T1):","type":"text","marks":[{"type":"strong"}]},{"text":" Check branch state, diff against main","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Gather context:","type":"text","marks":[{"type":"strong"}]},{"text":" What was the user working on? What does the conversation tell us about the goal?","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Dispatch to git-agent (T2):","type":"text","marks":[{"type":"strong"}]},{"text":" Create PR with contextual title and body","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Report:","type":"text","marks":[{"type":"strong"}]},{"text":" PR number, URL, summary","type":"text"}]}]}]},{"type":"heading","attrs":{"level":3},"content":[{"text":"Branch Cleanup","type":"text"}]},{"type":"paragraph","content":[{"text":"When user asks to \"clean up branches\" or \"delete merged branches\":","type":"text"}]},{"type":"ordered_list","attrs":{"order":1,"listStyle":"number"},"content":[{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Inline (T1):","type":"text","marks":[{"type":"strong"}]},{"text":" List merged branches","type":"text"}]},{"type":"code_block","attrs":{"wrap":false,"language":"bash"},"content":[{"text":"git branch --merged main | grep -v \"main\\|master\\|\\*\"","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Show list to user","type":"text","marks":[{"type":"strong"}]},{"text":" - this is a T3 preflight (deletion)","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"On confirmation:","type":"text","marks":[{"type":"strong"}]},{"text":" Dispatch to git-agent to delete them","type":"text"}]}]}]},{"type":"heading","attrs":{"level":3},"content":[{"text":"Semantic Versioning Analysis","type":"text"}]},{"type":"paragraph","content":[{"text":"When user asks \"what should the next version be\":","type":"text"}]},{"type":"ordered_list","attrs":{"order":1,"listStyle":"number"},"content":[{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Inline (T1):","type":"text","marks":[{"type":"strong"}]},{"text":" Analyse commits since last tag","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Categorise by Conventional Commits","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Report recommended bump with reasoning","type":"text"}]}]}]},{"type":"heading","attrs":{"level":3},"content":[{"text":"Conflict Resolution Support","type":"text"}]},{"type":"paragraph","content":[{"text":"When user encounters merge conflicts:","type":"text"}]},{"type":"ordered_list","attrs":{"order":1,"listStyle":"number"},"content":[{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Inline (T1):","type":"text","marks":[{"type":"strong"}]},{"text":" ","type":"text"},{"text":"git status","type":"text","marks":[{"type":"code_inline"}]},{"text":" to show conflicted files","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Inline (T1):","type":"text","marks":[{"type":"strong"}]},{"text":" Read conflict markers in each file","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Present options:","type":"text","marks":[{"type":"strong"}]},{"text":" ours, theirs, manual resolution","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"After resolution:","type":"text","marks":[{"type":"strong"}]},{"text":" Dispatch to git-agent (T2) for staging and continue","type":"text"}]}]}]},{"type":"heading","attrs":{"level":2},"content":[{"text":"Worktree Operations","type":"text"}]},{"type":"paragraph","content":[{"text":"Worktrees are first-class in this skill. The classification is:","type":"text"}]},{"type":"table","attrs":{"layout":null},"content":[{"type":"tr","content":[{"type":"th","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Op","type":"text"}]}]},{"type":"th","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Tier","type":"text"}]}]},{"type":"th","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"How","type":"text"}]}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Survey","type":"text","marks":[{"type":"strong"}]}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"T1","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"bash scripts/worktree-survey.sh","type":"text","marks":[{"type":"code_inline"}]},{"text":" — read-only, reports per-worktree state + drift","type":"text"}]}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Create","type":"text","marks":[{"type":"strong"}]}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"T2","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"git worktree add .claude/worktrees/\u003cname> -b \u003cbranch>","type":"text","marks":[{"type":"code_inline"}]},{"text":" via agent (respects project conventions)","type":"text"}]}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Land","type":"text","marks":[{"type":"strong"}]}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"T2","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Rebase worktree branch onto trunk + test + fast-forward. Multi-step procedure — see \"Worktree Land Procedure\" below","type":"text"}]}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Prune (clean)","type":"text","marks":[{"type":"strong"}]}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"T2","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"git worktree prune","type":"text","marks":[{"type":"code_inline"}]},{"text":" for ghost entries (registered but FS-missing). Always safe, no data loss possible","type":"text"}]}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Remove","type":"text","marks":[{"type":"strong"}]}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"T3","type":"text","marks":[{"type":"strong"}]}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"git worktree remove \u003cpath>","type":"text","marks":[{"type":"code_inline"}]},{"text":" — destroys filesystem state. Requires preflight + explicit confirm per worktree","type":"text"}]}]}]}]},{"type":"heading","attrs":{"level":3},"content":[{"text":"Survey-first discipline","type":"text"}]},{"type":"paragraph","content":[{"text":"Never recommend prune/remove without first running ","type":"text"},{"text":"scripts/worktree-survey.sh","type":"text","marks":[{"type":"code_inline"}]},{"text":" and presenting the output to the user. The survey categorises each worktree as:","type":"text"}]},{"type":"bullet_list","content":[{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"(trunk)","type":"text","marks":[{"type":"code_inline"}]},{"text":" — the main repo itself, never prune","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"PRUNABLE","type":"text","marks":[{"type":"code_inline"}]},{"text":" — merged into trunk, no uncommitted work, no unpushed commits → safe to remove","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"has WIP","type":"text","marks":[{"type":"code_inline"}]},{"text":" — uncommitted changes → commit or stash first, never auto-remove","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"unpushed","type":"text","marks":[{"type":"code_inline"}]},{"text":" — commits ahead of upstream → push or cherry-pick before remove","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"in-flight","type":"text","marks":[{"type":"code_inline"}]},{"text":" — not merged, not dirty → probably still in active use","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"GHOST","type":"text","marks":[{"type":"code_inline"}]},{"text":" — registered but filesystem gone → ","type":"text"},{"text":"git worktree prune","type":"text","marks":[{"type":"code_inline"}]},{"text":" fixes","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"UNREGISTERED","type":"text","marks":[{"type":"code_inline"}]},{"text":" / orphan — filesystem dir with no git entry → ","type":"text"},{"text":"DO NOT touch without explicit review","type":"text","marks":[{"type":"strong"}]}]}]}]},{"type":"heading","attrs":{"level":3},"content":[{"text":"Worktree Land Procedure (T2)","type":"text"}]},{"type":"paragraph","content":[{"text":"For landing a branch from a worktree onto the trunk (rebase + test + ff):","type":"text"}]},{"type":"ordered_list","attrs":{"order":1,"listStyle":"number"},"content":[{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Verify preconditions: worktree clean, branch ahead of trunk, not already merged","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Fetch trunk, rebase worktree branch onto it","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Run project test command (detect from ","type":"text"},{"text":"package.json","type":"text","marks":[{"type":"code_inline"}]},{"text":" / ","type":"text"},{"text":"pyproject.toml","type":"text","marks":[{"type":"code_inline"}]},{"text":" / ","type":"text"},{"text":"justfile","type":"text","marks":[{"type":"code_inline"}]},{"text":")","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"On test pass: fast-forward trunk to the rebased tip","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Do NOT push — that's a separate explicit step (and should go through ","type":"text"},{"text":"push-gate","type":"text","marks":[{"type":"code_inline"}]},{"text":")","type":"text"}]}]}]},{"type":"paragraph","content":[{"text":"Dispatch this to ","type":"text"},{"text":"git-agent","type":"text","marks":[{"type":"code_inline"}]},{"text":" as a T2 operation with the worktree path + trunk name.","type":"text"}]},{"type":"heading","attrs":{"level":3},"content":[{"text":"Boundaries (HARD RULE)","type":"text"}]},{"type":"paragraph","content":[{"text":"See ","type":"text"},{"text":"rules/worktree-boundaries.md","type":"text","marks":[{"type":"code_inline"}]},{"text":". Summary:","type":"text"}]},{"type":"bullet_list","content":[{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Never","type":"text","marks":[{"type":"strong"}]},{"text":" ","type":"text"},{"text":"rm -rf .claude/worktrees/","type":"text","marks":[{"type":"code_inline"}]},{"text":" — the orphan count in survey is informational, never a cleanup cue","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Never","type":"text","marks":[{"type":"strong"}]},{"text":" ","type":"text"},{"text":"git add -A","type":"text","marks":[{"type":"code_inline"}]},{"text":" when ","type":"text"},{"text":".claude/worktrees/","type":"text","marks":[{"type":"code_inline"}]},{"text":" has untracked entries (sweeps gitlinks into commits)","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Never","type":"text","marks":[{"type":"strong"}]},{"text":" decide another session's worktree is \"orphaned\" — ask first","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Cross-project work stays cross-project; a worktree in repo X is never our concern when we're operating on repo Y","type":"text"}]}]}]},{"type":"heading","attrs":{"level":2},"content":[{"text":"Decision Logic","type":"text"}]},{"type":"paragraph","content":[{"text":"When a git-related request arrives, follow this flow:","type":"text"}]},{"type":"code_block","attrs":{"wrap":false,"language":""},"content":[{"text":"1. Classify the operation tier (T1/T2/T3)\n\n2. If T1:\n - Execute inline via Bash\n - Format and present results\n - DONE\n\n3. If T2:\n - Gather context (conversation, git state, conventions)\n - Decide foreground vs background:\n * User waiting on result? -> foreground\n * User continuing other work? -> background\n - Dispatch to git-agent with context\n - Relay result when received\n\n4. If T3:\n - Gather context\n - Dispatch to git-agent for PREFLIGHT ONLY\n - Present preflight report to user\n - Wait for explicit confirmation\n - Re-dispatch with execute authority\n - Relay result","type":"text"}]},{"type":"heading","attrs":{"level":2},"content":[{"text":"Quick Reference","type":"text"}]},{"type":"table","attrs":{"layout":null},"content":[{"type":"tr","content":[{"type":"th","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Task","type":"text"}]}]},{"type":"th","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Tier","type":"text"}]}]},{"type":"th","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Inline/Agent","type":"text"}]}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Check status (rich)","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"T1","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Inline (","type":"text"},{"text":"scripts/status.sh","type":"text","marks":[{"type":"code_inline"}]},{"text":")","type":"text"}]}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Worktree survey","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"T1","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Inline (","type":"text"},{"text":"scripts/worktree-survey.sh","type":"text","marks":[{"type":"code_inline"}]},{"text":")","type":"text"}]}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"View diff","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"T1","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Inline","type":"text"}]}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"View log","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"T1","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Inline","type":"text"}]}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"List PRs","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"T1","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Inline","type":"text"}]}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Commit","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"T2","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Agent","type":"text"}]}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Push","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"T2","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Agent","type":"text"}]}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Create PR","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"T2","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Agent","type":"text"}]}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Create tag","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"T2","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Agent","type":"text"}]}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Create release","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"T2","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Agent","type":"text"}]}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Stash push/pop","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"T2","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Agent","type":"text"}]}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Cherry-pick","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"T2","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Agent","type":"text"}]}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Create branch","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"T2","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Agent","type":"text"}]}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Create worktree","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"T2","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Agent","type":"text"}]}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Land worktree","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"T2","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Agent (rebase + test + ff)","type":"text"}]}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Prune ghost worktrees","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"T2","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Agent (","type":"text"},{"text":"git worktree prune","type":"text","marks":[{"type":"code_inline"}]},{"text":")","type":"text"}]}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Rebase","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"T3","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Agent (preflight)","type":"text"}]}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Force push","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"T3","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Agent (preflight)","type":"text"}]}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Reset --hard","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"T3","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Agent (preflight)","type":"text"}]}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Delete branch","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"T3","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Agent (preflight)","type":"text"}]}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Discard changes","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"T3","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Agent (preflight)","type":"text"}]}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Merge to main","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"T3","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Agent (preflight)","type":"text"}]}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Remove worktree","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"T3","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Agent (preflight per worktree)","type":"text"}]}]}]}]},{"type":"heading","attrs":{"level":2},"content":[{"text":"Tools","type":"text"}]},{"type":"table","attrs":{"layout":null},"content":[{"type":"tr","content":[{"type":"th","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Tool","type":"text"}]}]},{"type":"th","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Purpose","type":"text"}]}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"git","type":"text","marks":[{"type":"code_inline"}]}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"All git operations","type":"text"}]}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"gh","type":"text","marks":[{"type":"code_inline"}]}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"GitHub CLI - PRs, issues, releases, actions","type":"text"}]}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"delta","type":"text","marks":[{"type":"code_inline"}]}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Syntax-highlighted diffs (if available)","type":"text"}]}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"lazygit","type":"text","marks":[{"type":"code_inline"}]}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Interactive TUI (suggest to user, not for agent)","type":"text"}]}]}]}]},{"type":"heading","attrs":{"level":2},"content":[{"text":"Additional Resources","type":"text"}]},{"type":"paragraph","content":[{"text":"For detailed patterns, load:","type":"text"}]},{"type":"bullet_list","content":[{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"./references/rebase-patterns.md","type":"text","marks":[{"type":"code_inline"}]},{"text":" - Interactive rebase workflows and safety","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"./references/stash-patterns.md","type":"text","marks":[{"type":"code_inline"}]},{"text":" - Stash operations and workflows","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"./references/advanced-git.md","type":"text","marks":[{"type":"code_inline"}]},{"text":" - Bisect, cherry-pick, worktrees, reflog, conflicts","type":"text"}]}]}]},{"type":"hr","attrs":{"markup":"---"}}]},"metadata":{"date":"2026-06-05","name":"git-ops","author":"@skillopedia","source":{"stars":21,"repo_name":"claude-mods","origin_url":"https://github.com/0xdarkmatter/claude-mods/blob/HEAD/skills/git-ops/SKILL.md","repo_owner":"0xdarkmatter","body_sha256":"185d1664060ecc564cbef78e8c4a3a3ba65d8189bb1d59e7d044885d07e24842","cluster_key":"3c18e2f65340709e8576e71130e9511f16117caa691e0ffedcd632fd67b4c788","clean_bundle":{"format":"clean-skill-bundle-v1","source":"0xdarkmatter/claude-mods/skills/git-ops/SKILL.md","attachments":[{"id":"3d780d13-eea5-5e6a-81d0-43e0115d6b8b","key":"uploads/10433ee7-ad12-4ae0-b34e-97553e46c6c8/3d780d13-eea5-5e6a-81d0-43e0115d6b8b/attachment","path":"assets/.gitkeep","size":0,"sha256":"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855","contentType":"text/plain; charset=utf-8"},{"id":"cdc1f220-22bb-5856-8fdc-af0f8fcc0857","key":"uploads/10433ee7-ad12-4ae0-b34e-97553e46c6c8/cdc1f220-22bb-5856-8fdc-af0f8fcc0857/attachment.md","path":"references/advanced-git.md","size":4509,"sha256":"5e9cd3161daee8be7520fcff787749d9e6ec196543e71dfb2c94c3955df1fbeb","contentType":"text/markdown; charset=utf-8"},{"id":"bce77a49-1b75-50a1-88fa-e79cb5b51107","key":"uploads/10433ee7-ad12-4ae0-b34e-97553e46c6c8/bce77a49-1b75-50a1-88fa-e79cb5b51107/attachment.md","path":"references/rebase-patterns.md","size":2551,"sha256":"8a1b8bb593b6ba8838941bf8cbcaef0ccaa9939ab1292492713144bb8c5bf4fd","contentType":"text/markdown; charset=utf-8"},{"id":"edb4b5ff-f1d4-5985-b6ea-d87aca1dc436","key":"uploads/10433ee7-ad12-4ae0-b34e-97553e46c6c8/edb4b5ff-f1d4-5985-b6ea-d87aca1dc436/attachment.md","path":"references/stash-patterns.md","size":2389,"sha256":"aa0ba0ae0f195d5391fce07bc23fa3a83f6ebfd79e45048ae46d8d9e56fd01df","contentType":"text/markdown; charset=utf-8"},{"id":"06d330b3-a25c-53e5-a026-d795ad92bf26","key":"uploads/10433ee7-ad12-4ae0-b34e-97553e46c6c8/06d330b3-a25c-53e5-a026-d795ad92bf26/attachment","path":"scripts/.gitkeep","size":0,"sha256":"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855","contentType":"text/plain; charset=utf-8"},{"id":"06cc983f-5574-5d66-998e-81529ad0f68e","key":"uploads/10433ee7-ad12-4ae0-b34e-97553e46c6c8/06cc983f-5574-5d66-998e-81529ad0f68e/attachment.sh","path":"scripts/status.sh","size":6361,"sha256":"38cf370da522548f7da3c461b2e7e725f5ce22405ec1598bda31c86fda538053","contentType":"application/x-sh; charset=utf-8"},{"id":"5f08ed82-664d-5eaa-a527-d9338ccb14cd","key":"uploads/10433ee7-ad12-4ae0-b34e-97553e46c6c8/5f08ed82-664d-5eaa-a527-d9338ccb14cd/attachment.sh","path":"scripts/worktree-survey.sh","size":6234,"sha256":"d12d2344e1f76199015c42165447919aae3e7ceaed6e956d68bffa16c407ff39","contentType":"application/x-sh; charset=utf-8"}],"bundle_sha256":"a104229ceb306ca94ca0d3092aff913fc7c35fa79fb96547cce54e996f3cb980","attachment_count":7,"text_attachments":5,"attachment_storage":"skillopedia-attachments-v1","binary_attachments":2,"excluded_attachments":[]},"cluster_size":1,"skill_md_path":"skills/git-ops/SKILL.md","import_metadata":{"date":"2026-06-05","author":"@skillopedia","version":"v1","category":"software-engineering","category_label":"Engineering"},"exact_dupes_collapsed_into_this":0},"license":"MIT","version":"v1","category":"software-engineering","metadata":{"author":"claude-mods","related-skills":"review, ci-cd-ops, push-gate"},"import_tag":"clean-skills-v1","description":"Full git + worktree orchestrator. Rich status survey, per-worktree triage (prunable/WIP/ghost/orphan), commits, PRs, branches, releases, rebases — reads run inline, writes dispatch to a background Sonnet agent. Triggers on: status, state, where are we, git status, anything to commit, anything to push, commit, push, pull request, create PR, git diff, rebase, stash, branch, merge, release, tag, changelog, semver, cherry-pick, bisect, worktree, worktree survey, prunable worktrees, land worktree.","allowed-tools":"Read Bash Glob Grep Agent TaskCreate TaskUpdate"}},"renderedAt":1782979298298}

Git Ops Intelligent git operations orchestrator. Routes read-only queries inline for speed, dispatches write operations to a background Sonnet agent ( ) to free the main session. Architecture Safety Tiers Tier 1: Read-Only - Run Inline No subagent needed. Execute directly via Bash for instant results. | Operation | Command | |-----------|---------| | Status (rich) | — one-shot HEAD + sync + tree + worktrees + branches + PR | | Worktree survey | — per-worktree state, drift detection, prunable/WIP/ghost/orphan triage | | Status (bare) | | | Log | | | Diff (unstaged) | | | Diff (staged) | | | Di…