| name | resolve |
| description | Use when resolving software issues, fixing bugs, or implementing fixes that need quality assurance — orchestrates automated patchgen, independent code review via subagent, and revision loop until approved or max rounds reached |
Issue Resolution with Review Loop
Resolve a software issue using an automated patchgen → review → revision loop. You generate the fix, an independent reviewer checks it, and you revise based on feedback. The loop runs until the reviewer approves or 3 rounds are reached.
Input
Raw arguments: $ARGUMENTS
Parse flags first, then treat the remainder as the issue description:
| Flag | Default | Meaning |
|---|
--no-review | (not set) | Skip the review-revision loop entirely; only run patchgen |
--max-rounds N | 3 | Maximum number of review-revision rounds |
Parsing rules:
- Scan
$ARGUMENTS for --no-review and --max-rounds N (where N is a positive integer)
- Strip matched flags from the arguments; the remaining text is the issue description
If the issue description is empty after parsing, ask the user to describe the issue or provide a GitHub issue URL.
Step 1: Setup Workspace
-
Parse the issue:
-
Derive instance name:
- From the issue: extract a short slug (lowercase, hyphens, max 40 chars)
- Examples:
login-timeout-bug, django__django-12345, session-refresh-fix
-
Create workspace directory:
WORKSPACE="./docs/swe-review/<instance_name>_$(date +%Y%m%d_%H%M%S)"
mkdir -p "$WORKSPACE"
-
Save the issue:
- Write the issue description to
$WORKSPACE/issue.md
-
Record base commit:
BASE_COMMIT=$(git rev-parse HEAD)
Remember this — all diffs will be against $BASE_COMMIT.
Step 2: Patchgen
You are now the developer fixing this issue.
-
Understand the problem: Read $WORKSPACE/issue.md carefully. Identify what's expected vs what's happening.
-
Explore the codebase: Use Grep, Glob, and Read to find relevant files. Trace the code path from the entry point to the root cause.
-
Generate the fix: Use the Edit tool to modify the necessary files. Make focused, minimal changes that address the root cause.
-
Commit your changes:
git add <changed files>
git commit -m "fix: <concise description of the fix>"
-
Save the initial diff:
Write the output of git diff $BASE_COMMIT..HEAD to $WORKSPACE/patch_round_0.diff
Step 3: Review-Revision Loop
If --no-review was set: Skip this entire step. Go directly to "Loop Exit (No Review)" below.
Otherwise, set round = 0 and max_rounds to the parsed value (default 3).
Loop Start
Increment round by 1. If round > max_rounds, go to "Loop Exit (Max Rounds Reached)".
3a: Launch Review Subagent
Use the Agent tool to launch a review subagent that invokes the swe-review:review skill. The subagent must be completely independent — it knows nothing about your patchgen process.
Agent tool parameters:
subagent_type: "general-purpose"
description: "swe-review round N"
prompt (fill in the actual absolute paths for WORKSPACE):
Invoke the swe-review:review skill to perform an independent code review.
Use the Skill tool:
skill: "swe-review:review"
args: the following JSON (as a single string):
{"issue_file": "<WORKSPACE_ABSOLUTE_PATH>/issue.md", "patch_file": "<WORKSPACE_ABSOLUTE_PATH>/patch_round_<N-1>.diff", "review_output_file": "<WORKSPACE_ABSOLUTE_PATH>/review_round_<N>.json"}
After the skill completes, verify the review report was written to the output file.
3b: Parse Review Result
After the subagent completes, read the review report from $WORKSPACE/review_round_<N>.json.
If recommendation is "approve":
- Report to the user: "Review round N: APPROVED (confidence: X.XX)"
- Print the summary
- Go to "Loop Exit (Approved)"
If recommendation is "request_changes":
- Report to the user: "Review round N: CHANGES REQUESTED (confidence: X.XX)"
- Print the summary and list of defects
- If
round >= max_rounds, go to "Loop Exit (Max Rounds Reached)"
- Otherwise, continue to step 3c
3c: Revision
You have full context from the patchgen phase. Read the defects from the review report and address them:
-
Process defects by severity (high → medium → low):
- Read each defect's
location, description, and suggestion
- Modify the code accordingly using the Edit tool
- If a defect suggestion is unclear or seems incorrect, use your judgment — you know the code better since you wrote the fix
-
Commit the revision:
git add <changed files>
git commit -m "fix: address review round N feedback"
-
Save the updated diff:
Write the output of git diff $BASE_COMMIT..HEAD to $WORKSPACE/patch_round_<N>.diff
-
Go back to "Loop Start"
Loop Exit (Approved)
-
Write $WORKSPACE/summary.md:
# Resolution Summary
## Issue
<issue description>
## Outcome: APPROVED
- Rounds: <N>
- Final confidence: <confidence>
## Final Review
<last review summary>
## Changes
Run `git diff <BASE_COMMIT>..HEAD` to see all changes.
-
Tell the user:
- Issue resolved and approved after N round(s)
- Remind them to review with
git diff <BASE_COMMIT>..HEAD
Loop Exit (Max Rounds Reached)
-
Write $WORKSPACE/summary.md:
# Resolution Summary
## Issue
<issue description>
## Outcome: MAX ROUNDS REACHED (3)
- Final decision: request_changes
- Final confidence: <confidence>
## Outstanding Defects
<list defects from last review>
## Review History
- Round 1: <decision> (confidence <X>)
- Round 2: <decision> (confidence <X>)
- Round 3: <decision> (confidence <X>)
## Changes
Run `git diff <BASE_COMMIT>..HEAD` to see all changes.
-
Tell the user:
- Max review rounds reached, some defects remain
- List the outstanding defects from the last review
- Suggest they can manually address remaining issues or run
/swe-review:review to get a fresh review
- Remind them to check changes with
git diff <BASE_COMMIT>..HEAD
Loop Exit (No Review)
When --no-review is set, skip the review loop entirely after patchgen.
-
Write $WORKSPACE/summary.md:
# Resolution Summary
## Issue
<issue description>
## Outcome: PATCHGEN ONLY (review disabled)
## Changes
Run `git diff <BASE_COMMIT>..HEAD` to see all changes.
-
Tell the user:
- Fix generated without review (--no-review mode)
- Suggest they can run
/swe-review:review separately to get a review
- Remind them to check changes with
git diff <BASE_COMMIT>..HEAD