Ray's Knowledge Base
Unlock

Run reviews with claude -p, triggered by a bot account and a Cloudflare Worker

DecisionVerified 30 Sep 2026Holds project: rsrobo
Decision. The context, the choice, why, and the options that were turned down.

Context#

rsrobo is a personal PR review bot for repos I own and for llnl-asr/*, where I cannot install workflows or apps. The first design had a custom engine: file filtering, grouping, a per-group pass, a cross-file pass, a verification pass, an LLM provider layer and a budget module.

Decision#

  • The engine is claude -p in a GitHub Actions job on a public hub repo. It gets --tools "Read,Grep,Glob,Agent", --effort high, --max-budget-usd, --json-schema for the findings, and a verify subagent defined with --agents. Auth is CLAUDE_CODE_OAUTH_TOKEN from claude setup-token, so runs bill the Max subscription.
  • The trigger is a mention of a machine account (@rsrobo) on the PR. A Cloudflare Worker cron (1 minute, free plan) polls that account's notifications with a classic PAT, checks an allowlist, parses the command with a regex, dedupes by comment id in KV, and dispatches the workflow.
  • Per-repo context lives in a private rsrobo-notes repo, not in the target repos and not in the personal kb. The job deletes the PR's own CLAUDE.md, AGENTS.md and .claude/ before it copies the overlay in.
  • Output goes to a pending review under my account by default; every run also writes an inbox issue and a markdown plus JSON file into rsrobo-notes.

Why#

  • Claude Code already has read-only tools, subagents, a cost cap, structured output and cost reporting. The custom engine would have re-implemented all of it.
  • The subscription token is allowed in Actions for Pro and Max plans, so the marginal cost per review is zero.
  • The notifications API works only with a classic PAT; a machine account is allowed (one free per person); the mention arrives about 20 s after the comment; the bot could comment on llnl-asr repos without being a collaborator. All checked live on 2026-09-30.
  • The kb holds internal content and must not land on a public runner; a separate notes repo keeps the blast radius small.

Rejected options#

  • Custom map-reduce engine with an OpenAI-compatible provider layer: more code than the rest of the bot, and no better than claude -p with a verify subagent.
  • Hub-issue comment as the only trigger (no bot account): simpler, but the command would not live on the PR.
  • Storing notes in the personal kb: internal lessons would reach the runner and the model.

Also found by searching

  • PR review bot for repos where I cannot install GitHub apps or workflows, llnl-asr org
  • I want automated code reviews with Claude on repositories I don't administer
  • how do I run claude -p as a PR reviewer from a hub repo triggered by a bot account
  • Cloudflare Worker webhook, CLAUDE_CODE_OAUTH_TOKEN setup-token, --json-schema findings, verify agent
  • how do I run an automated PR review on repos where I can't install github apps or workflows
  • claude -p review in GitHub Actions with CLAUDE_CODE_OAUTH_TOKEN from claude setup-token, trigger from cloudflare worker
  • design of rsrobo review bot, why not a custom engine with grouping and verification passes
  • claude -p --tools Read,Grep,Glob,Agent --max-budget-usd --json-schema --agents verify for code review