OCR Review-to-Approval Loop
Skill388 starsChanged 9 months agoApache-2.0View on GitHub
Drive a PR to an approved code review by looping OCR's multi-agent review and address steps. Runs /ocr:review then /ocr:address repeatedly until the review verdict is APPROVE, then one final /ocr:address for leftover suggestions, posting every review and every address round to the GitHub PR as comments with machine-readable markers. This is the pre-review CONTRIBUTING.md requires before maintainer review (APPROVE verdict, at least 2 distinct personas, covering the PR head). Use when the user asks to 'review and address in a loop', 'iterate review until approved', 'auto review-and-fix this PR', 'loop /ocr:review and /ocr:address', or to take a changeset all the way to a clean APPROVE with the default reviewer team. Wraps the /ocr:review (.ocr/commands/review.md) and /ocr:address (.ocr/commands/address.md) skills; needs a feature branch with an open GitHub PR and the gh CLI for posting.
- Commits and pushes
In this repository34 other files it gives its agents.
- AGENTS.mdAGENTS.md
- .claude/commands/monitoring/agents.mdAGENTS.md
- openspec/AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- AgentDB Advanced FeaturesSkill
- AgentDB Learning PluginsSkill
- AgentDB Memory PatternsSkill
- AgentDB Performance OptimizationSkill
- AgentDB Vector SearchSkill
- browserSkill
- github-code-reviewSkill
- github-multi-repoSkill
- github-project-managementSkill
- github-release-managementSkill
- github-workflow-automationSkill
- Hooks AutomationSkill
- Pair ProgrammingSkill
- ReasoningBank with AgentDBSkill
- ReasoningBank IntelligenceSkill
- Skill BuilderSkill
- sparc-methodologySkill
- stream-chainSkill
- swarm-advancedSkill
- Swarm OrchestrationSkill
- V3 CLI ModernizationSkill
- V3 Core ImplementationSkill
- V3 DDD ArchitectureSkill
- V3 Deep IntegrationSkill
- V3 MCP OptimizationSkill
- V3 Memory UnificationSkill
- V3 Performance OptimizationSkill
- V3 Security OverhaulSkill
- V3 Swarm CoordinationSkill
- Verification & Quality AssuranceSkill
The file
We split this skill into the rules it gives an agent
5 rules. About 0 are common, 3 are distinctive, and 2 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.
2
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- could be automatic: a setting could enforce it
- Very specific: line 123
3. Stop conditions: If iteration exceeds max-rounds without APPROVE, stop and report the outstanding blockers — never loop indefinitely.
- Very specific: line 131
Markers are evidence: Never post a marker for a round that didn't run, never alter a verdict (the marker's verdict is exactly …
- Distinctive: line 137
Two-persona minimum: Stop in preconditions if the resolved team has fewer than 2 distinct personas.
- Distinctive: line 139
Reviewed SHA = PR SHA: Always push before reviewing.
- Distinctive: line 147
Never push red: Run the project's typecheck + lint + tests before every commit.
≈ “Common” is an estimate: at least 1 in 5 of the 408,460 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
OCR Review-to-Approval Loop
What This Skill Does
Orchestrates an autonomous review → address → re-review loop on a pull request, using OCR's existing multi-agent review pipeline, until the review reaches an APPROVE verdict — then runs one final address pass for leftover suggestions. Every review and every address round is posted to the GitHub PR as a comment, producing a transparent, reviewable audit trail.
In this repo the loop is required before maintainer review (CONTRIBUTING.md → "Required: OCR
review loop before maintainer review"). Each posted comment carries a hidden marker that the
ocr-review-gate workflow reads to decide whether the PR keeps its needs-ocr-review label. The
policy needs: the latest review verdict is APPROVE, the team had at least 2 distinct personas
(3+ encouraged), and the PR's current head commit is the one that APPROVE review covered, or
the one pushed by an address pass posted after it (normally the final pass, round=final).
It is a thin orchestrator over two skills it does not reimplement:
/ocr:review→.ocr/commands/review.md(the 8-phase multi-agent review that emits a verdict)/ocr:address→.ocr/commands/address.md(corroborate feedback against code, then implement)
When to Use
- "Review and address in a loop until it's approved."
- "Iterate /ocr:review and /ocr:address on this PR."
- "Auto review-and-fix PR #N to a clean approval."
- Getting a PR ready for maintainer review under the contribution policy.
When NOT to Use (use the underlying skills directly)
- A single review with no auto-fixing →
/ocr:review. - Addressing one existing review's feedback →
/ocr:address. - There is no PR / not on a feature branch (this skill commits and posts).
Prerequisites
- On a non-default git branch with an open GitHub PR (the loop commits + pushes each round).
ghCLI installed and authenticated (for posting; skip with--no-post).- OCR set up in the repo (
.ocr/exists,ocrCLI available). Run/ocr:doctorif unsure. - A clean working tree. If there are uncommitted or untracked changes, ask the user whether
they belong in the PR before committing anything; never
git add -Ablindly, since this skill pushes to a public PR.
Arguments
/ocr-review-loop [pr] [--team <spec>] [--max-rounds N] [--no-final-suggestions] [--no-post]pr(optional): PR number. Default: the open PR for the current branch.--team <spec>(optional): reviewer team override (reviewer-id:count,...), forwarded to/ocr:review. Default: the project's default team (ocr team resolve). Must contain at least 2 distinct personas; 3+ encouraged, e.g.principal:2,quality:2,security:1.--max-rounds N(optional): safety cap on review rounds. Default: 5. The loop never runs forever.--no-final-suggestions(optional): stop at APPROVE; skip the final suggestions pass.--no-post(optional): run locally; do not post to GitHub. Present the trail in-chat instead. This leaves no evidence on the PR, so it does not satisfy the contribution policy.
The Loop (core algorithm)
Execute this inline, to completion, in the conversation. Do not schedule across turns or background the work. Drive each review's phases 4→7 within one turn (OCR's "don't strand the pipeline" rule). See
reference/loop-mechanics.mdfor the exact CLI/session details, the marker formats, and the GitHub comment templates.
0. Preconditions. Resolve the PR and branch; refuse to run on the default branch. Confirm
gh (unless --no-post) and OCR setup. Resolve the reviewer team (default unless --team) with
ocr team resolve [--team "<spec>"] --json, which returns [{persona, instance_index, name, model}],
and count the distinct persona values. If there are fewer than 2, STOP before reviewing
and explain the policy: the loop needs at least 2 distinct personas (e.g. --team
principal:2,quality:2, which is the default), and 3 or more are encouraged (e.g. --team
principal:2,quality:2,security:1). Instance counts don't help (principal:3 is still one
persona), and ephemeral --reviewer personas don't count because they have no persona id.
1. Review-address loop. Count iterations with a local iteration (starting at 1, capped by
max-rounds). The round number used in file paths and markers is OCR's own (round-{n} in
the session), which continues across same-day re-runs, so never assume it equals iteration.
While the verdict is not APPROVE and iteration <= max-rounds:
- Push, then review the whole PR — make sure the tree is clean (ask before committing
anything the loop didn't produce),
git push, and confirm the PR's head SHA equals localHEAD(retry once if GitHub hasn't caught up), so the reviewed commit is the PR's commit. Record that full 40-hex SHA. Invoke/ocr:reviewwith the full PR range as the target: the PR's base commit (baseRefOid, fetched so it exists locally) toHEAD. Never the default staged changes, never only the commits since the last round, and never a possibly stale localmain(in a fork it would pull upstream commits into the review). Pass--teamif given. It runs the full pipeline and finalizesrounds/round-{n}/final.md+round-meta.jsonwith averdict. - Post the review to the PR, headed
OCR multi-agent review — Round {n}, with the review marker (<!-- ocr-review-loop:review round=… verdict=… personas=… sha=… -->) as its first line. Takepersonasfrom the reviewers that actually ran this round (the persona part of eachrounds/round-{n}/reviews/{persona}-{i}.md, excludingephemeral-*), not from the planned team. (skip if--no-post) - Gate on the verdict (read it from
round-meta.json/final.md):APPROVE→ exit the loop (proceed to step 2 below).NEEDS DISCUSSION→ STOP the loop. This is a human gate — surface the clarifying questions to the user and await direction. Do not fabricate a fix.REQUEST CHANGES→ continue.
- Address — invoke
/ocr:addressonrounds/round-{n}/final.md. Corroborate every item against the actual code; implement the blockers and should-fixes (these clear the gate); decline incorrect feedback with evidence; you MAY defer pure suggestions to the final pass. Verify (typecheck + lint + tests) until green, then commit (atomic, conventional) and push. - Post the address round to the PR: what was addressed, declined (with reasoning), and
deferred, with the address marker (
<!-- ocr-review-loop:address round=… sha=<pushed SHA> -->) as its first line. (skip if--no-post) iteration += 1; loop (OCR startsround-{n+1}).
2. Final suggestions pass (only after APPROVE, unless --no-final-suggestions):
invoke /ocr:address once more to clear remaining suggestions, verify, commit, push, and
post a final address comment (marker round=final, sha= the pushed commit) that includes a
loop-summary table (round → verdict → outcome). If this pass changes nothing, still post it,
with sha= the unchanged HEAD.
3. Stop conditions. If iteration exceeds max-rounds without APPROVE, stop and report
the outstanding blockers — never loop indefinitely. If APPROVE was reached on round 1, skip the
loop body and go straight to the final suggestions pass.
Guardrails (critical — do not skip)
- Markers are evidence. Never post a marker for a round that didn't run, never alter a
verdict (the marker's verdict is exactly
round-meta.json's, spaces → underscores), and never list a persona that didn't review.shais always the real full SHA (git rev-parse HEADafter the push). Exactly one marker per comment, on its own line, outside any code block. Fixing a typo in a posted marker so it records what actually ran is fine (the gate re-checks on edit); changing its verdict or SHA is not. - Two-persona minimum. Stop in preconditions if the resolved team has fewer than 2 distinct personas; don't run rounds that can't satisfy the policy.
- Reviewed SHA = PR SHA. Always push before reviewing. If new commits land after the loop finished, the loop has to run again.
- Bounded. Honor
--max-rounds(default 5). If not approved by then, stop and surface why. NEEDS DISCUSSIONis a human gate. Pause and ask; never invent a resolution for genuine ambiguity.- Corroborate, don't obey. Per
.ocr/commands/address.md: verify each finding against the code; implement valid items; decline wrong feedback with evidence. Don't gold-plate — fix only what the review actually raised. - Never push red. Run the project's typecheck + lint + tests before every commit; fix failures before pushing.
- Branch safety. Refuse to run on the default branch; this skill commits and pushes.
- Faithful reporting. Report verdicts and outcomes honestly. If a blocker genuinely can't be fixed (needs a product/architecture decision), stop and say so rather than forcing APPROVE.
- The human still owns the change. The loop is a pre-review. The contributor must read and understand every change it makes before asking for maintainer review.
- New round, same session. Each iteration is a new OCR review round in the same session
(a closed session starts
round-{n+1}), reusingdiscovered-standards.md/context.md.
Reference
- Detailed per-round mechanics, verdict gating, session/round handling, the marker formats, and
the GitHub comment templates →
reference/loop-mechanics.md - The contribution policy and how the gate reads markers →
CONTRIBUTING.md - Underlying skills:
/ocr:review,/ocr:address
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.

