Take a tracked issue from wherever it lives — Linear, GitHub Issues, or an in-repo document — through implementation, a pull request, and a self-driving review-and-rectify loop, stopping at a verified ready-to-merge state. It merges only under --merge, and only a clean PR. The reviewer is local, Cursor, OpenCode, or Codex. Use when the user asks to ship, land, or implement an issue end to end, to shepherd or babysit a pull request through review, to keep resolving review comments until a PR is clean, or invokes "/forge" or "/ship-issue". With --hitl, the run splits the work into an approved plan. Each tranche waits uncommitted for the user's review, and the run fixes what they flag before asking to commit. Review findings get the same gate: the user agrees each proposed resolution before any edit, then signs off the fixes before any commit.
Ships in forge. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them; scripts run unread.
Own one issue from its tracker to a pull request that a fresh review reports as
clean, then hand it back — or, under --merge, merge it. One invocation covers
every cycle; the user should not have to re-prompt between review rounds. Under --hitl the opposite is the
contract: the run pauses at every checkpoint and waits for feedback, in the
review rounds as much as in the build.
These hold for the whole run. Breaking one is a failure, not a judgement call.
--merge. The terminal state is a clean PR reported
as ready to merge. Merging is the user's decision, even when every gate is
green. --merge is that decision made in advance: it permits one merge, of
a clean PR, through phase 7. No other verdict or stop condition may end
in a merge. Report ready to merge only on a clean verdict — never infer it
from an absence of findings, which an unreviewed pull request also has.--hitl, a checkpoint stop is this invariant working, not
breaking it: the stop is scheduled, announced, and hands back on purpose.--hitl, never cross a checkpoint. The checkpoints are the
plan, before any code; each tranche, before its commit and push and before
the next tranche begins; and two stops in every review round. Those two are
the proposed resolutions, before any edit, and the finished fixes, before
any commit, push, reply, or resolved thread. The gate does not lift when the
PR leaves draft. Silence is never confirmation./forge <issue-ref> [--reviewer local|cursor|opencode|codex] [--pr <number>] [--cycles <n>] [--hitl] [--merge]
issue-ref — a Linear key, GitHub issue number, document path, or plain
description. Omit it when resuming an existing PR.
--reviewer — who reads the diff:
| Mode | Reviewer |
|---|---|
local (default) | the mizcode-reviewer skill, run by a subagent started with fresh context |
cursor | cursor-agent running the same method, out of process |
opencode | opencode running the same method on DeepSeek V4.1 Flash (free, OpenCode Zen), out of process |
codex | @codex on GitHub |
One reviewer per run. Every posted review from local, cursor, or opencode opens
with a note naming who read the diff, as harness/model — Claude/Opus-5,
Cursor/Grok-4.7 — so the PR's history says which model said what. These
three post as mizcode-reviewer[bot] through the mizcode-reviewer plugin's
submit_review tool, with a narrow fallback to gh as the user (phase 4,
Posting).
--pr — resume the loop on an existing PR and skip implementation.
--cycles — hard cap on rectification rounds. Unset by default: the loop runs
until it converges or stalls, not until a counter expires.
--hitl — human in the loop. Plan first, then gate: split the work into
tranches, get the plan approved before any code, and keep each tranche
uncommitted until the user reviews and confirms it. Once the PR is under
review, every round stops twice more: the proposed resolutions before any
edit, and the fixes before any commit. See phases 2a and 6.
--merge — off by default. When the loop ends on clean, merge the PR
instead of handing it back. Every other ending stops exactly as it would
without the flag. With --hitl, the merge is one more checkpoint: ask
before merging. See phase 7.
In the commands below, <skill> is the directory containing this file, and
<mizcode-reviewer> is <plugin root>/skills/mizcode-reviewer, the skill
from the mizcode-reviewer plugin. The plugin also gives this session the
check_repo and submit_review tools. Find the plugin root:
Claude Code: the installPath that
~/.claude/plugins/installed_plugins.json records for the installed
version. The cache keeps earlier versions beside it, and an update can
touch an old folder after the new one, so never pick a folder by name or
date:
python3 -c 'import json,os; print(json.load(open(os.path.expanduser("~/.claude/plugins/installed_plugins.json")))["plugins"]["mizcode-reviewer@mizcode-reviewer"][0]["installPath"])'
Codex: the one folder in
~/.codex/plugins/cache/mizcode-reviewer/mizcode-reviewer/, named for the
installed version. Codex keeps no other.
If there is no plugin root, stop the local, cursor and opencode
reviewers and tell the user to install the plugin, as the README of
Mizanic/mizcode-reviewer says.
If --pr is given, or the current branch already has an open PR, announce that
you are resuming. A tranche checklist on the issue or in the PR body, ticked or
not, means the run is under --hitl even if the flag was not passed
again; say so. When that checklist has an unchecked tranche (phase 2a), continue
there; otherwise skip to phase 4, still gated.
Otherwise detect where the issue lives and read it. Follow references/issue-sources.md — the source is a property of the repository, and guessing wrong means implementing the wrong thing.
Open the run by stating: the issue, its source, the acceptance criteria, the scope boundary, and the reviewer mode. This is the contract the rest of the run is judged against.
Create a semantic branch from the current checkout, named for the issue
(feat/NAV-123-tenant-scoped-lookup). Under --hitl the branch must live in
the user's own checkout: do not create a git worktree, and decline any harness
offer to move the run into one. Phase 2a says why.
Build only what the acceptance criteria require. Read the authority documents
the issue defers to, plus AGENTS.md and CLAUDE.md, before writing code.
Follow existing patterns in the files you touch.
Then, using the repository's own commands:
Do not proceed to a PR with a failing gate. Fix it, or stop and report it.
--hitl only)Without the flag, skip this section.
Work in the user's checkout, on a local branch. Every tranche waits
uncommitted for the user to read it in their editor and run it in their
environment. That only works when the files are in the working tree they
already have open. Create the branch in the current checkout and stay there.
Never run git worktree add, never use a worktree tool the harness offers, and
if the run has already been placed in a worktree, leave it and switch the
user's checkout to the branch before writing any code. Say which checkout and
branch the tranche is sitting in when you hand it back.
Plan first. Before writing any code, derive the tranches from the acceptance criteria: each tranche independently implementable, testable, and committable, naming the criteria it covers. Post the plan as a Markdown checklist comment on the issue — move it into the PR body once the PR exists — so it survives a lost session, then stop and ask for approval. Never implement an unapproved plan.
One tranche at a time. Implement and test the tranche, but do not commit or push it. End the turn with:
Feedback is binding. A correction becomes a standing constraint for every remaining tranche. Fix it in the current uncommitted tranche, re-check earlier work for the same problem, rerun the affected checks, and present the updated result. Then wait for confirmation again. Silence is not confirmation, and an open correction blocks the commit.
Commit only on confirmation. Once the user confirms the tranche, commit and push it, then tick its checkbox. Report the commit hash and wait before starting the next tranche. Confirming one tranche approves that tranche and nothing after it.
The PR stays a draft from its first push until the final tranche is approved — the one exception to phase 3. External reviewers ignoring drafts is exactly what a half-finished plan wants. When the last tranche is approved, mark the PR ready for review and run phases 4–7. The review runs on its own; what it finds does not. Every rectification round has the two checkpoints in phase 6, and the final tranche's approval does not pre-approve any of them.
Push the branch and open a PR that is ready for review, not a draft —
external reviewers ignore drafts, which stalls the loop silently. (Under
--hitl the PR is deliberately a draft until the final tranche is
approved — phase 2a.)
The body carries the issue reference, a summary of the implementation, each
acceptance criterion mapped to where it is satisfied, the validation performed,
and any known limitation. Use Closes #<n> only when the merge should close a
GitHub issue.
The body also carries the review boundary. Add a ## Scope section with
two lists:
## Scope
In scope:
- <each acceptance criterion, one line>
Out of scope:
- <exclusions the issue names>
- <behaviour in the touched files that this change does not alter>
It is the one thing every reviewer reads: gather stages it for local,
cursor, and opencode, and Codex reads the PR description. A comment that asks for
work outside it is answered from it (phase 6), so write it as the contract
you are prepared to hold the review to. It never excuses a defect the
diff introduces: a bug in an "out of scope" file that this change caused or
newly exposed is in scope by definition.
local — start a subagent with fresh context and have it run the
mizcode-reviewer skill against this PR. Use the Agent tool with a
general-purpose agent, never a fork: a fork inherits this conversation, and the
reviewer must begin with no memory of writing the code. Do not read the diff in
this context, and do not review it here if the subagent fails; start another
subagent.
Give the subagent:
mizcode-reviewer skill, to follow end to end including the
post;Claude/<model> with the model the subagent
itself is running on, Claude/Opus-5 for example, never a label handed
down from here;submit_review returns, or the error it returned (or the exit code and the
JSON error from stderr of the command that failed) when the review did not
land;check_repo returns not_installed, it must not
stop as the skill says: it finishes the review, writes findings.json and
suspicions.json in the workdir, does not call submit_review, and returns
the workdir and not_installed, so Posting below can use the gh fallback.The skill posts by rendering the review with post --dry-run and passing that
JSON, unchanged, to submit_review. The subagent posts its outcome to GitHub,
which is what the next phase reads.
A return without a review URL is no review at all, unless Posting below sends
it to the fallback.
cursor — the same method through cursor-agent, out of process and
read-only. mizcode-reviewer does every step: gather stages the pull
request, agent cursor has Cursor read it with mizcode-reviewer's
SKILL.md as the method, post --dry-run renders the review, and you pass
that JSON unchanged to submit_review. It uses automatic model selection
(--model auto) unless agent's --model says otherwise. The default
signed_by label is Cursor/Auto, which names the selection mode rather
than claiming a specific underlying model. An explicit model override changes
the label. Driven directly:
node <mizcode-reviewer>/scripts/review.js gather <number> --repo <owner/name>
# then call check_repo with {"repo": "<owner/name>"}; see below
node <mizcode-reviewer>/scripts/review.js agent cursor --workdir <workdir>
node <mizcode-reviewer>/scripts/review.js post --workdir <workdir> \
--findings-file <workdir>/findings.json \
--suspicions-file <workdir>/suspicions.json \
--signed-by '<the signed_by value agent printed, e.g. Cursor/Auto>' \
--dry-run
# then call submit_review with the printed JSON as its arguments
Omit --suspicions-file when suspicions.json is an empty array. If gather
exits 4 with not_signed_in, sign the user in as step 1 of
<mizcode-reviewer>/SKILL.md says, then run gather again. On check_repo's
{"ok": true}, start the agent. On no_access or github_error, stop before
starting it and report the message. On not_installed, or if the tool is not
available, review anyway: Posting below sends the findings to the gh
fallback.
agent exits non-zero when no review happened: 5, review_incomplete, when
the tool reports it could not finish, and 1, agent_error, when the tool
failed or its reply was not a review. agent cursor also exits 1 without
starting Cursor when the pull request's head has project config Cursor would
load and obey: .claude/settings.json, or anything in .cursor/ but rules
and mcp.json. Review such a pull request with local. Either way it leaves no findings.json
in the workdir. Treat that as no review at all — re-run it, or fall back
to local. Never post an empty findings.json that came from a run which
exited non-zero: that publishes the all-clear sentence over a review that
never happened.
opencode — the same as cursor, with agent opencode. It runs
DeepSeek V4.1 Flash, free tier, on OpenCode Zen
(opencode/deepseek-v4.1-flash-free) at reasoning effort max
(--variant max) unless agent's --model or --variant says otherwise,
under a permission config that allows only its read, grep, glob and list
tools: no shell, no gh, no network. So it reads the code only from
gather's head/:
run gather from a clone of the repository, or agent opencode refuses with
exit 2. The default signed_by label is OpenCode/Deepseek-V4.1-Flash. Any
other non-zero exit means the same as for cursor.
--signed-by is the visible label, not the machine signature. post
renders it as a note at the top of the review (🤖 Reviewed by Claude/Opus-5)
and always adds the hidden marker pr_watch.py keys on as an HTML comment, so
no label can leave the loop stuck. Name the harness and the model that actually
read the diff; a review signed as a model that did not run is a false record.
Keep the review URL (html_url) that submit_review returns on success —
phase 5 uses it to prove this specific review landed.
gh fallbacksubmit_review posts only as mizcode-reviewer[bot], never as the user.
forge owns the one fallback, and keeps it narrow so a review never lands under
the user's name by accident:
submit_review returns | What forge does |
|---|---|
review_id and html_url | Use it. |
| the tool is not available in this session: the plugin's MCP server is not set up | Post the same findings with gh as the user, below, and say in one line why. |
"error": "not_installed", from check_repo before the review or from submit_review: the App isn't installed on this repository | The same fallback, and say why. |
"error": "unauthorized", or HTTP 403 | No fallback. Sign the user in as step 1 of <mizcode-reviewer>/SKILL.md says, then call submit_review again. |
"error": "head_moved" | No fallback. Review the new head, below. |
any other error, including no_access, github_error, or a post --dry-run that exits non-zero | No fallback. Stop and report the error verbatim. |
The fallback reuses the workdir gather made:
python3 <skill>/scripts/gh_post.py --workdir <workdir> \
--findings-file <findings file> [--suspicions-file <suspicions file>] \
--signed-by '<the same label>'
It carries the same all-clear sentence and hidden marker, so phase 5 reads it the same way.
If submit_review returns head_moved, whether the subagent reports it or
cursor or opencode hits it, the head moved while the review was being written. Do not retry the
post — review the new head from the beginning. After two consecutive head
moves, stop and tell the user something keeps pushing to the branch.
codex — post the trigger comment and hand off:
gh pr comment <number> --repo <owner/name> --body '@codex review'
Never trigger a review against a head that has uncommitted or unpushed changes. The review would describe code that no longer exists.
For codex, block until the reviewer responds to the current head. The
response channel varies by outcome: findings arrive as a real PR review, but a
clean round arrives as an issue comment (Codex Review: Didn't find any major issues … Reviewed commit \`) or as only a 👍 reaction on the trigger comment. The wait ends on any of the three; an unrelated human comment does not end it. Pass the trigger-comment URL that gh pr commentprinted so the reaction channel is watched (auto-detected from the newest@… review` comment
when omitted):
python3 <skill>/scripts/pr_watch.py wait <number> --repo <owner/name> \
--expect-review-of head --allow-unsigned --trigger-comment '<comment url>' \
--timeout 1800 --interval 30
wake_reason in the output says which channel ended the wait.
Reviewers other than Codex: known bots (coderabbit, gemini, copilot) and any
[bot] account also wake the wait but never grade clean on their own; extend
recognition with --reviewer-bot or a full --attest-profile.
For local, cursor, and opencode, the review is already posted, so read the state —
passing the URL from phase 4, so that a silently failed review cannot read as
clean:
python3 <skill>/scripts/pr_watch.py state <number> --repo <owner/name> \
--require-review '<html_url from submit_review>'
The signature is required by default, so nothing extra to pass here. An
external reviewer that answers in text signs its own way, which is why the
codex command above carries --allow-unsigned; never add that flag on the
local, cursor, or opencode paths, as it removes the only thing separating
an automated review from a typed comment. All three render through post, or
gh_post.py on the fallback, so all three are already signed — the marker is a hidden HTML comment, so its absence from
the rendered page means nothing.
Both print one JSON object. The fields that drive the decision:
| Field | Meaning |
|---|---|
verdict | see the table below |
unresolved_count | unresolved conversations — the primary signal |
unresolved_threads | the threads to judge, with thread_id, comment_id, path, line, body |
needs_reply (per thread) | the reviewer spoke last — you have not answered yet |
last_comment (per thread) | the newest message, so you do not answer twice |
required_review_present | whether the review you commissioned actually landed |
latest_review_at_head | the newest review of the current commit, or null |
head_moved | whether someone pushed while you were waiting |
new_since_baseline | what arrived during the wait |
Unresolved conversations decide on their own. The newest review body is read only when there are none — it is a tiebreaker, never an override.
findings. A thread marked outdated still
counts: outdated means the anchor line moved, not that the concern was
addressed.post writes —
Reviewed \` — no new issues found.— for this same commit. A recognized external reviewer's attestation counts the same way: its no-findings comment naming this commit, or its 👍 on the trigger comment, accepted only under--allow-unsigned (external_attestations` in the
output shows each one and its grade).| Verdict | Meaning | What to do |
|---|---|---|
findings | unresolved conversations exist | Rectify — phase 6 |
clean | every reviewer of this exact commit posted the all-clear | Ready to merge — phase 7, which merges under --merge |
unreviewed | no review exists at all | Go back to phase 4 and get one |
stale | every review is of an older commit | Re-review the current head |
unclear | reviewed at head, but some reviewer gave no all-clear | Read reviews_at_head_without_marker; never assume clean |
unclear + "Unverified —" in the body | the reviewer found something severe it could not prove | Settle it: run the stated check, then re-review. Escalate if you cannot run it |
unreviewed + a failed attestation | the external reviewer could not run | Read its detail; re-trigger once, then stop and report |
blocked | changes requested with nothing to rectify | Only the reviewer can clear it — escalate |
unknown | a GitHub fetch failed, so counts may be short | Never treat as clean; retry or escalate |
draft | the PR is a draft, so reviewers will skip it | Mark it ready for review |
timeout / closed | see phase 7 |
Matching is deliberately strict and anchored to the first line. Prose such as "no major issues, but the retry loop needs a rethink" is an objection, and substring matching cannot tell it apart from an all-clear.
The distinction that matters: a pull request nobody reviewed also has zero
findings. Silence is not approval. Only clean may be reported as ready to
merge — unreviewed, stale, and unclear never may, however green the PR
looks.
Read latest_review_at_head.body even on findings: a reviewer can describe a
real problem in the summary without leaving an inline comment. Trust the prose
over the field when they disagree.
On timeout, do not loop blindly. Report that the review has not arrived and
tell the user the exact command to resume:
/forge --pr <number> --reviewer codex.
On closed, stop and report.
If verdict is findings, or the review body describes a real problem, work
through references/rectify.md: judge each comment
against the requirements, fix what is justified, refuse what is not, test, reply
to every thread, resolve the ones genuinely addressed, commit, and push.
Under --hitl, the round stops twice. The section of the same name in
rectify.md says what each stop contains. First,
before touching a file: one row per finding with the proposed decision, the
proposed change, and the reason, then one question. Edit nothing until the
user agrees each row. A correction rewrites the row before any work starts.
Second, after the agreed fixes and their checks: what changed, the checks with
their results, and one question. Do not commit, push, reply, or resolve until
the user signs off. A round that edits before the first stop, or commits
before the second, has broken invariant 6, however small the finding.
Then return to phase 4 with the new head. A new head needs a new review — a review of the previous commit says nothing about the current one.
Stop and report when any of these fires:
| Condition | Outcome |
|---|---|
verdict is clean | Ready to merge — or, under --merge, merge it as below |
verdict is blocked, unknown, or draft | Stop — say which, and what the user must do |
verdict is unreviewed, stale, or unclear after a cycle | Say which, and that the PR is not confirmed clean |
| Stalled — a round ends with the same unresolved threads it started with, or a finding you already rectified comes back unchanged twice | Repeating the round will not help. Hand back with what is stuck and why |
--cycles given and reached | Only when the user asked for a cap |
A --hitl checkpoint is reached | Report the tranche, the proposed resolutions, or the uncommitted fixes, then wait — a scheduled stop, not a failure |
| A finding needs a decision about intended behaviour | Escalate with the specific question |
| Requirements ambiguous, credentials missing, or required validation impossible | Escalate before guessing |
| A destructive or irreversible operation is needed | Ask first |
timeout or closed | Report the state and the resume command |
On the ready-to-merge path, state it plainly and stop:
PR #42 is ready to merge — reviewed
31ded9d53a, no findings, 0 unresolved threads, all checks green. Merge when you are ready.
Without --merge, do not merge it, and do not offer to merge it as the obvious
next step.
--mergeOnly on clean, and only for the commit that verdict names:
Under --hitl, stop first: report the clean verdict, the commit, and the
merge method, and ask one question. Merge only on an explicit yes.
Pick the method from what the repository allows:
gh repo view --json squashMergeAllowed,mergeCommitAllowed,rebaseMergeAllowed
If exactly one is allowed, use it. Otherwise squash.
Merge, pinned to the reviewed commit so a push that lands after the review cannot slip in:
gh pr merge <number> --<squash|merge|rebase> --match-head-commit <sha> --delete-branch
Never pass --admin, --auto, or anything else that bypasses branch
protection, required checks, or required reviews. If the merge is refused
— protection, a conflict, a moved head, a failed check — stop and report
the refusal verbatim. Do not rebase, force-push, or retry around it.
Do not close the issue. Closes #<n> in the PR body closes it on merge;
otherwise its status stays where phase 1 left it.
Then report it plainly:
PR #42 merged — reviewed
31ded9d53a, squash, branch deleted.
Every run ends with:
--hitl: the approved plan, per tranche the feedback received
and what it changed, and per review round the resolutions as agreed and
the sign-off that released the commit.What SKILL.md sets; muted values are Claude Code's defaults
Other plugins' skills for the same job
/forge:forgefrom forge
npx claudepluginhub rehanhaider/aiman --plugin forge