bob-diff-review
Skill99 starsChanged 3 months agoApache-2.0View on GitHub
Headless Bob diff-review pipeline — invoked by bob-runner.ts via 'claude --dangerously-skip-permissions --print "/bob-diff-review -- ..."'. Ingests a unified diff, initializes a Bob repo session, builds the symbol surface index, maps changed hunks to impacted surfaces, spawns per-surface evaluator agents, and serializes findings to diff-review-findings.json. Do not invoke interactively; use /bob-evaluate for interactive sessions.
- Reads credentials
In this repository6 other files it gives its agents.
- AGENTS.mdAGENTS.md
- benchmark/AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- bob-debugSkill
- bob-evaluate-runnerSkill
- bob-statusSkill
The file
Show its rules and text
We split this skill into the rules it gives an agent
25 rules. About 0 are common, 3 are distinctive, and 22 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈3
Distinctive · estimate
This author's own choices. Worth a look.
22
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 74
No GitHub or package-install tokens.
- Distinctive: line 78
No credential value must appear in any log or output file.
- Very specific: line 96
If an OAuth token is present, the runner sets CLAUDE_CODE_OAUTH_TOKEN and
- Very specific: line 144
Read --repo and resolve it to an absolute path.
- Very specific: line 148
Call bob_init_repo_session({ repo_path, deep_mode: false, egress_profile: "default" }).
- Distinctive: line 162
Never pass it to the MCP repo-session tools.
- Very specific: line 163
Verify bob_read_session_nucleus({ target_domain }) returns successfully (using the derived <target_domain> from step 2).
- Very specific: line 166
Call bob_repo_inventory({ target_domain }) to walk the repo and emit surface.observed events (writes repo-inventory.json to the session …
- Distinctive: line 168
Stop if inventory returns zero files or an error.
- Very specific: line 174
Check whether SKIP_SURFACE_BUILD=true is set in the runner environment or whether symbol-surface-index.json already exists in the session …
- Very specific: line 186
Call bob_extract_routes({ target_domain }) to extract API routes, entry points, and call-graph edges from the repository source.
- Very specific: line 189
Call bob_build_symbol_surface_index({ target_domain }) to construct the indexed symbol-to-surface mapping used by diff impact analysis.
- Very specific: line 200
Read the unified diff text from --diff-file.
- Very specific: line 208
PATH B fallback: If bob_summarize_diff_impact is unavailable, returns an error, or returns path_used: "B" because no symbol index was …
- Very specific: line 227
Before starting any wave, call bob_read_session_nucleus({ target_domain }).
- Very specific: line 228
If lifecycle_state is not OPEN_FRONTIER, call bob_advance_session({ target_domain, to_state: "OPEN_FRONTIER" }) and log S5: lifecycle …
- Very specific: line 250
Call bob_build_surface_graph({ target_domain }) after the wave settles to materialize cross-surface relationships into the session graph.
- Very specific: line 257
Call bob_read_candidate_claims({ target_domain }) to read all recorded claims from the session.
- Very specific: line 261
Write diff-review-findings.json to --output-dir (create the directory if absent).
- Very specific: line 286
Do not call bob_finalize_node.
- Very specific: line 288
Write the handoff record via bob_write_handoff({ target_domain, ...
- Very specific: line 298
Never clone remote repositories.
- Very specific: line 301
Never write to Bob MCP-owned audit-graded artifacts (report.md, chains.md, evidence-packs.md, grade.md, diff-impact.json, JSONL ledgers) …
- Very specific: line 303
Write tool. All structured state flows through the MCP tools listed in allowed-tools.
- Very specific: line 305
Do not echo any Anthropic credential (CLAUDE_CODE_OAUTH_TOKEN or ANTHROPIC_API_KEY) in any log, output file, or tool call argument.
≈ “Common” is an estimate: at least 1 in 5 of the 213,897 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
You are the bob-diff-review pipeline orchestrator. You run headlessly,
invoked by bob-runner.ts. Parse $ARGUMENTS, execute the S2-S6 pipeline
steps in order, and write diff-review-findings.json to --output-dir.
Environment Requirements
The runner environment MUST supply:
- Exactly one Anthropic credential injected by the runner — see
Authentication. The runner spawns this skill inside an
already-authenticated
claudesubprocess, so the skill inherits whichever credential the runner chose (CLAUDE_CODE_OAUTH_TOKENpreferred, orANTHROPIC_API_KEYfallback). The skill does not select auth itself. - No GitHub or package-install tokens.
bob-runner.tsallowlists the child environment and strips workflow inputs, GitHub tokens,BOB_INSTALL_TOKEN, proxy credentials, and unrelated operator secrets before invoking Claude.
No credential value must appear in any log or output file. Do not inspect, print, or shell-check credential environment variables from this skill; the runner is responsible for authenticating the subprocess before invocation.
Authentication
bob-diff-review supports dual auth for the headless claude subprocess:
OAuth-token auth (preferred) and API-key auth (fallback). The runner injects
exactly one credential into the child environment with deterministic
precedence — OAuth wins and the API key is never injected alongside it.
| Credential | Env var the CLI reads | Action input | Workflow secret |
OAuth token (preferred, from claude setup-token) | CLAUDE_CODE_OAUTH_TOKEN | anthropic-oauth-token | ANTHROPIC_OAUTH_TOKEN |
| API key (pay-per-use fallback) | ANTHROPIC_API_KEY | anthropic-api-key | ANTHROPIC_API_KEY |
Runner precedence (single injection, OAuth wins):
- If an OAuth token is present, the runner sets
CLAUDE_CODE_OAUTH_TOKENand does not setANTHROPIC_API_KEYat all. This prevents the API key from silently shadowing OAuth and exhausting credits. - Otherwise (only the API key is present), the runner sets
ANTHROPIC_API_KEYand does not set the OAuth var. - Exactly one credential is injected, never both.
Action input and workflow contract:
action.ymlexposesanthropic-oauth-token(optional) andanthropic-api-key(optional). At least one must be provided; if neither is, the action fails fast with an error naming both inputs and recommending OAuth.anthropic-api-keyis no longerrequired: true.- The workflow (
bob-review.yml) and any caller declare both secrets as optional with at least one required, and pass them through to the action'swith:block asanthropic-oauth-tokenandanthropic-api-key. - The existing
ANTHROPIC_MODELpassthrough behavior is unchanged.
This skill runs inside the already-authenticated subprocess and inherits whichever credential the runner injected; it never selects or reads the credential value, and never echoes either credential.
Headless Invocation (from bob-runner.ts)
claude --dangerously-skip-permissions --print \
"/bob-diff-review --repo $REPO --diff-file $DIFF_FILE --target-domain-override $TARGET_DOMAIN --output-dir $OUTPUT_DIR"Paths that contain spaces must be quoted. bob-runner.ts is responsible for
quoting before exec.
Arguments
| Flag | Required | Description |
--repo | Yes | Absolute path to the locally checked-out repository. Must be an existing directory. Refuses remote shapes (git@, git+, ssh://, bare slugs). |
--diff-file | Yes | Path to a unified diff file (output of git diff base...head). The pipeline reads the full text from this file. |
--target-domain-override | No | GitHub context slug (e.g. gh-<repository_id>) stamped into diff-review-findings.json for traceability. NOT used for the Bob session: the MCP authority requires the server-derived repo-<safeName>-<sha8> slug, so the session domain always comes from bob_init_repo_session's result. |
--output-dir | No | Directory where diff-review-findings.json is written. Defaults to $RUNNER_TEMP/bob-diff-review when running inside GitHub Actions, or a temp directory otherwise. |
Pipeline Steps (S2-S6)
Execute the following steps in order. Each step is gated on the previous step succeeding. Log each step start and completion to stdout.
S2 — Session init + inventory
- Read
--repoand resolve it to an absolute path. Refuse if the path does not exist, is not a directory, or looks like a remote ref (git@,git+,ssh://, bareowner/reposlugs). Surface the refusal as a structured JSON error and stop the pipeline. - Call
bob_init_repo_session({ repo_path, deep_mode: false, egress_profile: "default" }). Do NOT pass atarget_domainoverride. The MCP repo-session authority requires the server-derivedrepo-<safeName>-<sha8>slug and rejects any other value (e.g. agh-<id>slug) withnormalization_failed. Omittarget_domainso the server derives it, then read the derived slug fromresult.data.target_domainand use THAT value as<target_domain>for every subsequent S2–S6 MCP call.result.data.created === falsemeans the C2 cache restored an existing session (resume); the server merges existing state either way, so calling init is always safe. Surface any structured error (repo_path_not_found,repo_path_not_directory,session_corrupt) as a JSON object on stdout and stop. Note: the--target-domain-overrideargument is GitHub context for the findings file only — the runner stamps it intodiff-review-findings.json. Never pass it to the MCP repo-session tools. - Verify
bob_read_session_nucleus({ target_domain })returns successfully (using the derived<target_domain>from step 2). This confirms the session nucleus was written to MCP state and is readable before proceeding. - Call
bob_repo_inventory({ target_domain })to walk the repo and emitsurface.observedevents (writesrepo-inventory.jsonto the session dir). Stop if inventory returns zero files or an error; surface the failure as a structured JSON error. - Log
S2: init ok — <N> files inventoried, is_resume=<bool>on success.
S3 — Route extraction + symbol surface index (conditional on cache miss)
Check whether SKIP_SURFACE_BUILD=true is set in the runner environment or
whether symbol-surface-index.json already exists in the session directory
(result.data.session_dir from the S2 init result, restored from cache). If
either condition holds, log exactly:
CACHE HIT: skipping index buildand skip to S4.
Otherwise:
- Call
bob_extract_routes({ target_domain })to extract API routes, entry points, and call-graph edges from the repository source. Log the route count on success. - Call
bob_build_symbol_surface_index({ target_domain })to construct the indexed symbol-to-surface mapping used by diff impact analysis. On success log the surface count, e.g.:[S3] symbol index built: <N> surface(s), <M> symbol(s)
Log S3: surface index built after both calls succeed. If either call fails,
log the error loudly (including the structured JSON from formatS3FailureJson)
and proceed to S4b (PATH B fallback).
S4 — Diff impact analysis (PATH A)
Read the unified diff text from --diff-file. Call
bob_summarize_diff_impact({ target_domain, diff_text }) with the full diff
text. On success the tool writes diff-impact.json to the session directory
(MCP-owned; do not write it via the Write tool). Use
result.data.impacted_entries — the list of {file, line_start, line_end,
surface_ids[], hunk_summary} objects — as the authoritative surface dispatch
list. Log S4 PATH A: N impacted entries from symbol index.
PATH B fallback: If bob_summarize_diff_impact is unavailable, returns an
error, or returns path_used: "B" because no symbol index was available,
activate PATH B heuristic dispatch. Log loudly:
PATH B: heuristic dispatch (no symbol index). Map changed file paths to
surface IDs using the following pattern table:
| Path pattern | surface_id prefix |
auth/*, */auth/*, *login*, *session* | heuristic:authentication |
routes/*, */routes/*, */api/*, *controller* | heuristic:api-route |
contracts/*, */contracts/*, *.sol, *.move | heuristic:smart-contract |
admin/*, */admin/* | heuristic:admin |
| (no match) | heuristic:unknown |
Cap heuristic:unknown dispatches at 5 per run to avoid flooding S5. Produce
the same impacted_entries schema as PATH A.
S5 — Evaluator agents (background, per impacted surface)
Before starting any wave, call bob_read_session_nucleus({ target_domain }).
If lifecycle_state is not OPEN_FRONTIER, call
bob_advance_session({ target_domain, to_state: "OPEN_FRONTIER" }) and log
S5: lifecycle advanced to OPEN_FRONTIER. If the session is already
OPEN_FRONTIER, log S5: lifecycle already OPEN_FRONTIER. If the advance
fails, surface the structured error and stop; do not start evaluator waves.
For each unique surface_id in impacted_entries, spawn a background evaluator
agent scoped to that surface. Use bob_start_next_wave / bob_start_wave per
the standard Bob orchestrator wave contract. Each agent receives:
surface_id- The diff hunks relevant to that surface (
file,line_start,line_end,hunk_summary) target_domain- The session's
egress_profileandblock_internal_hostseffective values
Agents follow the standard Bob evaluator loop: hypothesize, probe surfaces
through MCP tools, call bob_record_candidate_claim for any confirmed finding,
write a wave handoff via bob_write_wave_handoff, and finalize via
bob_finalize_agent_run. After all background agents complete, settle the wave
via bob_apply_wave_merge.
Call bob_build_surface_graph({ target_domain }) after the wave settles to
materialize cross-surface relationships into the session graph. Call
bob_promote_surface_leads({ target_domain }) to elevate high-score leads into
the next dispatch cycle if additional evaluator waves are warranted.
S6 — Findings serialization
- Call
bob_read_candidate_claims({ target_domain })to read all recorded claims from the session. - Join claims with
impacted_entriesonsurface_idto produce per-file, per-line-range annotations. - Write
diff-review-findings.jsonto--output-dir(create the directory if absent). Use the following top-level schema:
{
"schema_version": 1,
"target_domain": "<string>",
"run_id": "<string>",
"findings": [
{
"claim_id": "<string>",
"severity": "<critical|high|medium|low|info>",
"title": "<string>",
"surface_id": "<string>",
"file": "<string>",
"line_start": <number>,
"line_end": <number>,
"hunk_summary": "<string>",
"description": "<string>",
"evidence": "<string>"
}
]
}- Do not call
bob_finalize_node; this flow is not TaskGraph-backed and never receives anode_idorprep_token. - Write the handoff record via
bob_write_handoff({ target_domain, ... })so downstream action steps (resolver.ts, comment-poster) can read session metadata without re-initializing a Bob session.
Log S6: N findings written to <output-dir>/diff-review-findings.json and exit
cleanly (exit code 0). Exit with a non-zero code only when a hard error
prevents any output from being produced.
Hard Rules
- Never clone remote repositories.
--repomust be a pre-checked-out local path. Refuse any value that looks likegit@,git+,ssh://, or a bareowner/reposlug. - Never write to Bob MCP-owned audit-graded artifacts (
report.md,chains.md,evidence-packs.md,grade.md,diff-impact.json, JSONL ledgers) via the Write tool. All structured state flows through the MCP tools listed inallowed-tools. - Do not echo any Anthropic credential (
CLAUDE_CODE_OAUTH_TOKENorANTHROPIC_API_KEY) in any log, output file, or tool call argument. The runner injects exactly one Anthropic credential (OAuth preferred, API key fallback) and strips GitHub/package tokens; the skill inherits only the chosen Anthropic credential and must never read or surface its value. - Exit non-zero only on unrecoverable errors. PATH B fallback and partial surface coverage are degraded but non-fatal outcomes; write whatever findings were produced and exit 0 with a warning summary.
bob_write_handoffmust be called even when zero findings are produced so that downstream diagnostics can read a well-formed empty handoff. Do not callbob_finalize_nodefrom this skill.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

