Repository navigation
Correct the two Claude Code hooks to the worktree flow (closes #3724) - #3736
Conversation
Pragmatic Code Review: PR #3736Review Type: Initial Review (no prior reviews or comments on the PR). Reviewed commit SummaryTwo files changed, both hook text: The change is a clear net improvement: both hooks stopped giving instructions the guide forbids. I checked the new text line by line against Requirements Check
Code Review Findings1. 🟡 Important: the branch check states a permission the guide does not state
I searched
The issue describes this as "a change the guide allows on This is the drift the issue set out to remove: a hook asserting process the guide does not contain. Either:
The header comment at lines 8-9 ("A docs-only or mechanical change is committed straight to 2. 🟢 Suggestion: check that exit-0 stderr reaches the agent (pre-existing, not introduced here) Both header comments say Claude Code surfaces the stderr text "as a message to the agent". As I understand Claude Code's hook contract, a 3. 🟢 Suggestion: "of the primary checkout" is inferred, and the hook fires for files outside the repository (pre-existing) The hook reads the branch of its working directory, not the edited file's path. On Nit: 📁 Other checks
RecommendationAPPROVE, with finding 1 to address before merge (a one-sentence wording change, plus the header comment). Findings 2 and 3 are pre-existing and need no change in this PR. |
malibio
left a comment
There was a problem hiding this comment.
Automated pragmatic-code-review: APPROVE (posted as a comment — GitHub blocks self-approval). One Important finding to address before merge: the branch check tells the agent a "docs-only or mechanical change may be committed straight to main", a rule AGENTS.md does not state. Full findings in the review comment above.
Review addressedAddressed
Skipped
Re-Review DecisionDecision: NO RE-REVIEW NEEDED Rationale: the follow-up commit changes three sentences of message text and one comment, each the wording the review asked for. No logic changed. |
The branch check and the plan-mode reminder now describe the agent guide's process: EnterWorktree in the guide's order, test:changed, the explicit-refspec push, gh pr create --head, and bun run merge after approval. The branch check no longer tells the agent to stop a docs-only or mechanical change on main. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- The branch check said a docs-only or mechanical change may be committed straight to main; the guide states no such rule. It now says to ignore the reminder when the edit is not issue work. - The plan-mode reminder's first line names the final steps as well as Step 0. Skipped: whether exit-0 stderr reaches the agent (pre-existing, unverified, and the issue keeps stderr and exit 0), and the hook reading the working directory's branch rather than the edited file's path (pre-existing). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
fa0f47c to
6594e9c
Compare
Summary
Both
PreToolUsehooks described a process the agent guide replaced. They now summarise the guide's worktree flow and point at its sections..claude/hooks/check-feature-branch.ts(beforeEdit/Write): onmainit prints the startup sequence in the guide's order, withEnterWorktree({name: "issue-<N>-brief-desc"})in place of agit checkout -bbranch. It says a docs-only or mechanical change may be committed straight tomain, and no longer says STOP. It stays silent inside a worktree, where the branch is nevermain..claude/hooks/remind-plan-startup-sequence.ts(beforeEnterPlanMode): Step 0 is the same worktree sequence. The final steps arebun run test:changed,bun run quality:fixand commit,git push origin HEAD:issue-<N>-brief-desc,gh pr create --head issue-<N>-brief-desc, andbun run merge <PR#>after the user approves. It names the guide asAGENTS.md.Both still print to stderr and exit 0.
.claude/settings.jsonis unchanged.Testing
mainoutput was not run on amaincheckout; the condition (branch === 'main') is unchanged.bun run test:changed: no change reaches a test tier.bun run quality:fix: no further changes.🤖 Generated with Claude Code