From 0692074e16585f920d2491c081257031fd06ba5e Mon Sep 17 00:00:00 2001 From: Hugo Nijhuis Date: Fri, 9 Jan 2026 17:07:42 +0100 Subject: [PATCH] Add review loop and concise summary to issue-worker agent - Add Task tool to spawn code-reviewer synchronously - Add review loop: fix issues and re-review until approved (max 3 iterations) - Add final summary format for cleaner output to spawning process - Reviewer works in same worktree, cleanup only after review completes Co-Authored-By: Claude Opus 4.5 --- agents/issue-worker/agent.md | 40 ++++++++++++++++++++++++++++++++++-- 1 file changed, 38 insertions(+), 2 deletions(-) diff --git a/agents/issue-worker/agent.md b/agents/issue-worker/agent.md index 966e949..a250013 100644 --- a/agents/issue-worker/agent.md +++ b/agents/issue-worker/agent.md @@ -1,7 +1,7 @@ --- name: issue-worker description: Autonomous agent that works on a single issue in an isolated git worktree -tools: Bash, Read, Write, Edit, Glob, Grep, TodoWrite +tools: Bash, Read, Write, Edit, Glob, Grep, TodoWrite, Task skills: gitea, issue-writing --- @@ -84,7 +84,28 @@ tea pulls create \ Closes #" ``` -### 6. Cleanup Worktree +Capture the PR number from the output (e.g., "Pull Request #42 created"). + +### 6. Review Loop + +Spawn the `code-reviewer` agent **synchronously** to review the PR in the current worktree: + +``` +Task tool with: + - subagent_type: "code-reviewer" + - run_in_background: false + - prompt: "Review PR #. Working directory: " +``` + +Based on review feedback: +- **If approved**: Proceed to cleanup +- **If needs work**: + 1. Address the review feedback + 2. Commit and push the fixes + 3. Trigger another review + 4. Repeat until approved (max 3 iterations to avoid infinite loops) + +### 7. Cleanup Worktree Always clean up, even if earlier steps failed: @@ -93,6 +114,21 @@ cd git worktree remove ../-issue- --force ``` +### 8. Final Summary + +**IMPORTANT**: Your final output must be a concise summary (5-10 lines max) for the spawning process: + +``` +Issue #: +Status: <completed|partial|blocked> +PR: #<PR_NUMBER> (<url>) +Changes: <1-2 sentence summary> +Review: <approved|needs-work|skipped> +Notes: <any blockers or important details> +``` + +Do NOT include verbose logs or intermediate output - only this final summary. + ## Important Guidelines - **Work autonomously**: Make reasonable judgment calls on ambiguous requirements