| name | critique |
|---|---|
| description | Review a commit stack in nvim, rebase-i style — first a plan pass (review/pick/drop + reorder), then edit each chosen commit's diff inline while Claude amends it behind you. Use when the user wants to review a diff/stack in their editor, "critique" or "edit the patch", plan/reorder/drop commits before reviewing, give feedback by editing commits, or hand back review notes for Claude to apply. |
Local Google-Critique loop in two phases. Plan first (what to review, drop, reorder), then review the survivors one commit at a time while Claude amends each behind you.
Two principles:
- The edited file is a message, not a patch. Never
git applyit. The user rewrites+/-lines, mangles hunks, and adds notes freely; line counts and hunk headers need not stay honest. Read the orig→edited delta as intent and implement it cleanly. - Structure is settled before code review. Drops and reorders happen in the plan pass, so the per-commit review runs over a stack that won't shift under the reviewer — no throwaway edits to commits that later get dropped or moved.
/critique [base] [plan|no_plan] — both optional, in any order; parse them yourself:
- base — any commit/ref to review onto (
main,HEAD~5, a sha). Default:@{upstream}, thenmain/master. Pass it through to whicheverreview.shcommand you run. - mode —
plan(default) runs the two-phase flow below.no_planskips the plan pane: go straight tostart [base]and continue from step 4. Use it for a small stack you just want to read top to bottom.
-
(plan mode) Open the plan:
bash ~/.claude/skills/critique/review.sh plan [base]Opens a rebase-
-i-style todo in a tmux pane — one line per commit (oldest at top), eachreviewby default. The user sets verbs (review= open & edit inline,pick= keep as-is,drop= remove) and reorders by moving lines.basedefaults to@{upstream}, thenmain/master. Signalscritique-planon:wq. -
Wait for the plan as a background call:
tmux wait-for critique-plan. -
Read the plan yourself —
cat "$WORK/plan.txt"(diff againstplan.origto see just what changed). Nothing parses it; interpret it like any message:- verbs
review/pick/drop, line order, and deleted lines give you the kept set and its order. - free-form lines — notes, questions, "squash these two", "split this", "reword: …" — are intent too. Act on them, including ops that have no verb.
Restructure the stack to match by cherry-picking the kept commits onto base in plan order:
base=$(awk '/^base/{print $2}' "$WORK/manifest"); branch=$(git branch --show-current) git checkout -q --detach "$base" git cherry-pick <kept-sha-in-plan-order>... # drops omitted; squash/split by hand git branch -f "$branch" HEAD && git checkout -q "$branch"
Resolve any cherry-pick conflict (dependent commits reordered); if you can't,
git cherry-pick --abort, restore the branch, and tell the user. Verify intermediates still parse. Then open the commits markedreview:bash ~/.claude/skills/critique/review.sh open "$base" <review-sha-in-stack-order>...
(In
no_planmode you skip steps 1–3 and juststart [base].) - verbs
-
Pre-arm one background wait per review commit, all up front:
tmux wait-for critique-01…critique-NN. -
When
critique-NNfires, read that commit and apply it (see Applying):bash ~/.claude/skills/critique/review.sh diff NN- any line the user added that starts with
#(banner/headers aside) = a reviewer note. Act on it; answer questions rather than guessing. - changed/added
+/-lines = the code they want. Implement cleanly, don't paste diff text. - edits in the message block = rewrite that commit's message.
Apply in ascending order — amending NN rebases its descendants, so NN lands before NN+1.
- any line the user added that starts with
-
After the last commit, summarize per commit what changed and which notes you addressed.
Amend the commit the feedback targets — don't rebuild the branch:
branch=$(git branch --show-current)
C=$(bash ~/.claude/skills/critique/review.sh resolve NN) # current hash at position NN
git checkout -q --detach "$C"
# ...edit the working tree to that commit's desired content...
git add -A
git commit -q --amend -m "<message>" # --amend keeps the original author + author-date
Cnew=$(git rev-parse HEAD)
git checkout -q "$branch"
git rebase -q --onto "$Cnew" "$C" # replays descendants; their author-dates surviveresolve NN re-derives the hash each time because earlier amends shift it. If C is already the tip, just git commit --amend in place.
A note like "drop this" during review means remove the commit: tip → git reset --hard HEAD~1; otherwise git rebase -q --onto "$C^" "$C" "$branch".
Replay conflicts are expected when your edit and a descendant touch nearby lines. Resolve each file so the descendant's change sits on top of your amended version, git add, then git rebase --continue. Never leave a rebase in progress: if you can't resolve cleanly, git rebase --abort, leave the stack untouched, and tell the user which commit needs a manual call. Watch coupled changes — verify every intermediate commit still parses, not just the tip.
- Requires a tmuxified session (
$TMUXset) and a git repo. - Override the scratch dir with
CRITIQUE_DIR(default$TMPDIR/claude-critique). - One review at a time (fixed channels + scratch dir;
plan/startwipe it). - No
squash/split/rewordverbs — write them as free-form plan lines and Claude does the surgery by hand (combine, partition, or rewrite the message). The shell never parses the plan, so any wording works.