From 13075ebeb204652390af524d627301f953c83594 Mon Sep 17 00:00:00 2001 From: Nathan Heskew Date: Fri, 17 Apr 2026 14:13:27 -0700 Subject: [PATCH] workflow: steer Claude to native Read/Grep/Glob tools, not Bash cat/grep MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fourth iteration on the review workflow. Now that show_full_output is on we can see what's happening: Claude reads the PR via `gh pr view` and `gh pr diff` (allowed), then pivots to `cat -n`, `grep`, and even `bun test` for deeper inspection — all denied. Root cause is prompt-level, not policy: Claude has `Read`, `Grep`, `Glob` in its allowlist but defaults to Bash equivalents once it sees Bash working for the gh commands. Not broadening Bash — a PR review shouldn't be executing PR code or reaching for shell utilities when native tools are available. Adding a "Tools" section to the prompt that: - Explicitly names Read/Grep/Glob for file inspection - Names the Bash commands NOT to use (cat, head, tail, grep, ls, find) - Forbids running PR code (bun test, npm test) - Lists the only allowed Bash commands (gh pr view/diff/comment) Co-Authored-By: Claude Opus 4.7 (1M context) --- .github/workflows/claude-review.yml | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/.github/workflows/claude-review.yml b/.github/workflows/claude-review.yml index d583ff8..c93dadb 100644 --- a/.github/workflows/claude-review.yml +++ b/.github/workflows/claude-review.yml @@ -44,6 +44,20 @@ jobs: The PR branch is already checked out in the current working directory. + ## Tools + + For file inspection use the `Read`, `Grep`, and `Glob` tools. + Do NOT use `cat`, `head`, `tail`, `grep`, `ls`, or `find` + via Bash — those commands are not allowed and waste turns. + Do NOT run `bun test`, `npm test`, or any other script + that executes PR code — the PR's tests are already checked + separately. + + The only allowed Bash commands are: + - `gh pr view` / `gh pr diff` — inspect the PR (already run + at start, you can re-invoke if needed) + - `gh pr comment` — post the final review comment + Read `CLAUDE.md` in the repo root first — it has the project overview, conventions, and (importantly) a "Non-Obvious Gotchas" section covering Resource API v2 patterns, GenericTrackedObject