Open-source skills for designing and reviewing software with AI agents
Python agent-skillsai-agentsantigravityclaude-codeclaude-code-pluginclaude-skillscodexcodex-plugincoding-agentscontext-engineeringdeveloper-toolsgeminillmmulti-agentprompt-engineeringspec-driven-development
feat(review-loop): stop on convergence, not zero findings (#168)
Mohab Fekry9162c4e7f83a
diff --git a/agents/synthesizer.md b/agents/synthesizer.mdindex d14e5a6..7fb8d9a 100644--- a/agents/synthesizer.md+++ b/agents/synthesizer.md@@ -37,6 +37,7 @@ Inspect the `Mode` parameter specified by the caller (`Mode: BRAINSTORM` vs `Mod* **Document Standards Directory**: `resources/document_standards/{standard_name}.md`1. **Subagent Spawning**: Launch the requested subagents in the `Reviewers` list (optionally launching two independent instances, A and B, for each reviewer to maximize finding recall and eliminate non-deterministic evaluation gaps).+ * **Failed Reviewers**: A reviewer that times out, fails, or returns no report did not review. Retry it once. If it fails again, its status is `not run`. Never count it as a reviewer with zero findings.2. **Aggregate & Triage**: Group reported findings from all subagent instances into π΄ **Blocker**, π‘ **Major**, and π’ **Nit**. Deduplicate overlapping findings and normalize file references.3. **Format Review Report**: Format the consolidated findings according to this Markdown layout:@@ -45,6 +46,12 @@ Inspect the `Mode` parameter specified by the caller (`Mode: BRAINSTORM` vs `Mod**Target:** `[TargetFile]` (`[LineRange]`)+ ## Reviewer Status++ | Reviewer | Status |+ | --- | --- |+ | `[agent-shortname]` | [completed \| not run] |+## Prioritized Findings (Blockers -> Major -> Nits)### [Issue Name] - Severity: [Blocker | Major | Nit]@@ -55,7 +62,7 @@ Inspect the `Mode` parameter specified by the caller (`Mode: BRAINSTORM` vs `Mod```4. **Write Artifact**: Write findings to `goldfish_review_report.md` using your file-writing tool.-5. **Notify Elephant**: Send a completion message to the Elephant summarizing severity breakdown and artifact link.+5. **Notify Elephant**: Send a completion message to the Elephant with the status (`completed` or `not run`) of each requested reviewer, the severity breakdown, and the artifact link.---diff --git a/distributions/claude/agents/synthesizer.md b/distributions/claude/agents/synthesizer.mdindex d14e5a6..7fb8d9a 100644--- a/distributions/claude/agents/synthesizer.md+++ b/distributions/claude/agents/synthesizer.md@@ -37,6 +37,7 @@ Inspect the `Mode` parameter specified by the caller (`Mode: BRAINSTORM` vs `Mod* **Document Standards Directory**: `resources/document_standards/{standard_name}.md`1. **Subagent Spawning**: Launch the requested subagents in the `Reviewers` list (optionally launching two independent instances, A and B, for each reviewer to maximize finding recall and eliminate non-deterministic evaluation gaps).+ * **Failed Reviewers**: A reviewer that times out, fails, or returns no report did not review. Retry it once. If it fails again, its status is `not run`. Never count it as a reviewer with zero findings.2. **Aggregate & Triage**: Group reported findings from all subagent instances into π΄ **Blocker**, π‘ **Major**, and π’ **Nit**. Deduplicate overlapping findings and normalize file references.3. **Format Review Report**: Format the consolidated findings according to this Markdown layout:@@ -45,6 +46,12 @@ Inspect the `Mode` parameter specified by the caller (`Mode: BRAINSTORM` vs `Mod**Target:** `[TargetFile]` (`[LineRange]`)+ ## Reviewer Status++ | Reviewer | Status |+ | --- | --- |+ | `[agent-shortname]` | [completed \| not run] |+## Prioritized Findings (Blockers -> Major -> Nits)### [Issue Name] - Severity: [Blocker | Major | Nit]@@ -55,7 +62,7 @@ Inspect the `Mode` parameter specified by the caller (`Mode: BRAINSTORM` vs `Mod```4. **Write Artifact**: Write findings to `goldfish_review_report.md` using your file-writing tool.-5. **Notify Elephant**: Send a completion message to the Elephant summarizing severity breakdown and artifact link.+5. **Notify Elephant**: Send a completion message to the Elephant with the status (`completed` or `not run`) of each requested reviewer, the severity breakdown, and the artifact link.---diff --git a/distributions/claude/skills/egm-review-loop/SKILL.md b/distributions/claude/skills/egm-review-loop/SKILL.mdindex 5a060a0..c08cbfe 100644--- a/distributions/claude/skills/egm-review-loop/SKILL.md+++ b/distributions/claude/skills/egm-review-loop/SKILL.md@@ -115,7 +115,8 @@ file` mode is specified, confirm full-file line bounds).The synthesizer spawns the Goldfish review swarm inparallel, deduplicates findings, writes the report artifact, andreturns a single summary message to avoid context pollution in the root- conversation.+ conversation. Pass it the Failed Reviewers rule below. Its summary must+ give a status, `completed` or `not run`, for each requested reviewer.* **Direct Dispatch (Flat Swarm)**: Alternatively, spawn each requestedreviewer subagent in `Reviewers` directly.Instruct each subagent to first read its persona definition in@@ -125,7 +126,14 @@ file` mode is specified, confirm full-file line bounds).* Each reviewer produces findings with severity (π΄ Blocker, π‘ Major, π’Nit), line numbers, discrepancy descriptions, and rationales.2. **Consolidate Findings**: Collect all findings across reviewers into a single- flat `FindingsList`.+ flat `FindingsList`. Give each finding a stable id+ (`<reviewer>-<round>-<n>`) and record its reviewer, severity, and affected+ scope.+3. **Failed Reviewers**: A reviewer that times out, fails, or returns no report+ did not review. Retry it once. If it fails again, record it as **not run**+ in the report. Never count it as a reviewer with zero findings. If the+ synthesizer summary has no status for a requested reviewer, record that+ reviewer as not run.#### 2.3 Aggregated Resolution Hand-off@@ -140,8 +148,29 @@ file` mode is specified, confirm full-file line bounds).#### 2.4 Iteration Check & Turn Boundary-The cycle repeats until reviewers report zero remaining findings or the user-explicitly halts it.+Fresh reviewers sample differently each round, so a round with zero findings+is rare even when the document improves. Use these rules instead:++* **Settled findings**: A finding is settled when it is contested or+ recorded without a fix (accepted risk). Keep the settled list across+ rounds. If a new reviewer raises a settled finding again (same affected+ scope, same issue), do not re-open it.+* **Fixed findings**: An applied fix does not settle a finding. If a later+ reviewer raises the same issue at the same scope, the fix failed or a+ later edit reintroduced the issue. Re-open the finding.+* **Clean round**: A round is clean when no reviewer raises a Blocker or+ Major finding that is not settled. Nits do not block. A reviewer recorded+ as not run makes the round not clean. Decide this from the review results,+ before you apply the fixes of that round.+* **Converged**: Two consecutive clean rounds. One clean round is not enough,+ because the next fresh reviewer can find a different gap in the same text.+* **Cap**: 5 rounds.+* **Churn**: A new finding is at the scope of an applied fix, and reverting+ that fix would resolve it.++On converged, go to Step 3. On cap or churn, write a short list of the open+findings by severity, then ask the user one question: accept and proceed,+continue past the cap, or return the document to drafting.**Crucial Turn-Taking Requirement**: After the resolution phase finishes for agiven round, the loop driver **MUST respect the turn-taking checkpoint in@@ -151,10 +180,12 @@ another round of review.### Step 3: Output Boundary & Final Checkpoint-Upon successful completion (e.g., zero findings remaining or manual halt):+Upon completion (converged, cap or churn accepted by the user, or manual+halt):* **Programmatic Callers**: If running as a subflow of `egm-review`, exitcleanly to hand execution back to the parent workflow.* **Manual Invocations**: Output a summary of completion in chat: *"The review- loop has completed with zero remaining issues. Would you like to proceed to+ loop has completed after [N] rounds ([converged | accepted at cap | halted]).+Open findings are in the report. Would you like to proceed tothe next stage, or do you have any final questions?"*diff --git a/docs/designs/review.md b/docs/designs/review.mdindex f569a55..ebe4961 100644--- a/docs/designs/review.md+++ b/docs/designs/review.md@@ -164,8 +164,14 @@ The engineer reviews `goldfish_review_report.md` via four interaction modes:### 3. Iteration & Checkpoint GatingAfter fixes are applied, the loop presents a mandatory checkpoint asking the-user whether to run another review pass or complete the workflow. The process-concludes when zero blocking findings remain or the engineer halts the loop.+user whether to run another review pass or complete the workflow. Findings that+were contested or recorded without a fix stay settled across rounds. A fixed+finding re-opens if a later review raises it again. A round is clean when its+review results contain no unsettled Blocker or Major finding. The process+concludes after two consecutive clean rounds, or when the engineer halts the+loop. At 5 rounds, or when a new finding would be resolved by reverting an+earlier fix, the loop asks the engineer to accept, continue, or return to+drafting.## Implementation Filesdiff --git a/skills/egm-review-loop/SKILL.md b/skills/egm-review-loop/SKILL.mdindex 5a060a0..c08cbfe 100644--- a/skills/egm-review-loop/SKILL.md+++ b/skills/egm-review-loop/SKILL.md@@ -115,7 +115,8 @@ file` mode is specified, confirm full-file line bounds).The synthesizer spawns the Goldfish review swarm inparallel, deduplicates findings, writes the report artifact, andreturns a single summary message to avoid context pollution in the root- conversation.+ conversation. Pass it the Failed Reviewers rule below. Its summary must+ give a status, `completed` or `not run`, for each requested reviewer.* **Direct Dispatch (Flat Swarm)**: Alternatively, spawn each requestedreviewer subagent in `Reviewers` directly.Instruct each subagent to first read its persona definition in@@ -125,7 +126,14 @@ file` mode is specified, confirm full-file line bounds).* Each reviewer produces findings with severity (π΄ Blocker, π‘ Major, π’Nit), line numbers, discrepancy descriptions, and rationales.2. **Consolidate Findings**: Collect all findings across reviewers into a single- flat `FindingsList`.+ flat `FindingsList`. Give each finding a stable id+ (`<reviewer>-<round>-<n>`) and record its reviewer, severity, and affected+ scope.+3. **Failed Reviewers**: A reviewer that times out, fails, or returns no report+ did not review. Retry it once. If it fails again, record it as **not run**+ in the report. Never count it as a reviewer with zero findings. If the+ synthesizer summary has no status for a requested reviewer, record that+ reviewer as not run.#### 2.3 Aggregated Resolution Hand-off@@ -140,8 +148,29 @@ file` mode is specified, confirm full-file line bounds).#### 2.4 Iteration Check & Turn Boundary-The cycle repeats until reviewers report zero remaining findings or the user-explicitly halts it.+Fresh reviewers sample differently each round, so a round with zero findings+is rare even when the document improves. Use these rules instead:++* **Settled findings**: A finding is settled when it is contested or+ recorded without a fix (accepted risk). Keep the settled list across+ rounds. If a new reviewer raises a settled finding again (same affected+ scope, same issue), do not re-open it.+* **Fixed findings**: An applied fix does not settle a finding. If a later+ reviewer raises the same issue at the same scope, the fix failed or a+ later edit reintroduced the issue. Re-open the finding.+* **Clean round**: A round is clean when no reviewer raises a Blocker or+ Major finding that is not settled. Nits do not block. A reviewer recorded+ as not run makes the round not clean. Decide this from the review results,+ before you apply the fixes of that round.+* **Converged**: Two consecutive clean rounds. One clean round is not enough,+ because the next fresh reviewer can find a different gap in the same text.+* **Cap**: 5 rounds.+* **Churn**: A new finding is at the scope of an applied fix, and reverting+ that fix would resolve it.++On converged, go to Step 3. On cap or churn, write a short list of the open+findings by severity, then ask the user one question: accept and proceed,+continue past the cap, or return the document to drafting.**Crucial Turn-Taking Requirement**: After the resolution phase finishes for agiven round, the loop driver **MUST respect the turn-taking checkpoint in@@ -151,10 +180,12 @@ another round of review.### Step 3: Output Boundary & Final Checkpoint-Upon successful completion (e.g., zero findings remaining or manual halt):+Upon completion (converged, cap or churn accepted by the user, or manual+halt):* **Programmatic Callers**: If running as a subflow of `egm-review`, exitcleanly to hand execution back to the parent workflow.* **Manual Invocations**: Output a summary of completion in chat: *"The review- loop has completed with zero remaining issues. Would you like to proceed to+ loop has completed after [N] rounds ([converged | accepted at cap | halted]).+Open findings are in the report. Would you like to proceed tothe next stage, or do you have any final questions?"*diff --git a/skills/egm-review-loop/TEST.md b/skills/egm-review-loop/TEST.mdindex 5f0643b..5732305 100644--- a/skills/egm-review-loop/TEST.md+++ b/skills/egm-review-loop/TEST.md@@ -10,3 +10,4 @@ When evaluating or exploring `egm-review-loop` interactively in chat, verify:- **Step 2.1 (Target Resolution):** Unconditionally re-scans line numbers before auditing.- **Step 2.2 (Review Swarm):** Spawns subagents (or sequentially iterates personas in degraded mode) across requested standards.- **Step 2.3 & 2.4 (Resolve Handoff & Turn Boundary):** Hands findings to `egm-resolve` and respects human decision gates.+- **Step 2.4 (Round Control):** Keeps contested and accepted findings settled, re-opens fixed findings that reviewers raise again, judges clean rounds before applying fixes, records failed reviewers (and reviewers with no status in the synthesizer summary) as not run, stops after two consecutive clean rounds, and asks the user at the 5-round cap or on churn.diff --git a/skills/egm-review-loop/test_scenarios.yaml b/skills/egm-review-loop/test_scenarios.yamlindex b50cc3f..56a441a 100644--- a/skills/egm-review-loop/test_scenarios.yaml+++ b/skills/egm-review-loop/test_scenarios.yaml@@ -27,3 +27,27 @@ scenarios:- type: "required_pattern"pattern: "(Review|Goldfish|findings|persona|comprehension|critic)"message: "Review loop orchestrator must acknowledge review personas and structured findings compilation."++ - scenario_id: "convergence_not_zero_findings"+ description: "Verifies the loop stops on consecutive clean rounds, not on zero findings, and does not re-open settled findings."+ eval_type: "deterministic"+ system_prompt:+ skill_file: "skills/egm-review-loop/SKILL.md"+ turns:+ - user_input: "Round 3 of the review loop on docs/design.md returned two Nits and one Major that was contested in round 1. Round 2 was clean. What happens next?"+ assertions:+ - type: "required_pattern"+ pattern: "(?i)(converged|two consecutive clean|settled)"+ message: "The loop must treat a re-raised settled finding and Nits as non-blocking and report convergence."++ - scenario_id: "missing_reviewer_status_not_clean"+ description: "Verifies a reviewer with no status in the synthesizer summary counts as not run, so a zero-findings round is not clean."+ eval_type: "deterministic"+ system_prompt:+ skill_file: "skills/egm-review-loop/SKILL.md"+ turns:+ - user_input: "The synthesizer summary for round 2 on docs/design.md says: 0 findings; egm-design completed, egm-structural completed. egm-style was also requested. Is round 2 clean?"+ assertions:+ - type: "required_pattern"+ pattern: "(?i)not run"+ message: "A requested reviewer with no status must count as not run, so the round is not clean."