Skip to content

Open-source skills for designing and reviewing software with AI agents

feat(resolve): add ESCALATE and DECLINE

Mohab Fekry75d562cf0ff2
diff --git a/docs/designs/review.md b/docs/designs/review.md
index 8559c56..0fbf92b 100644
--- a/docs/designs/review.md
+++ b/docs/designs/review.md
@@ -140,6 +140,13 @@ For each finding, the Elephant determines:
strings or structural edits.
* **`CONTEST`**: The critique is invalid or based on a misunderstanding. Cites
concrete codebase evidence defending the current text.
+* **`ESCALATE`**: The critique is invalid, but only knowledge outside the
+ reviewed files refutes it. The user decides. The Elephant does not add
+ context that only a zero-context reviewer needs.
+* **`DECLINE`**: The finding is a Nit. It is recorded and not fixed.
+
+A contest must cite evidence the reviewer could read. Comprehension gaps cannot
+be contested, and severities cannot be changed without a contest.
### 2. User Triage Modes
diff --git a/skills/egm_resolve/SKILL.md b/skills/egm_resolve/SKILL.md
index 59b759f..f762263 100644
--- a/skills/egm_resolve/SKILL.md
+++ b/skills/egm_resolve/SKILL.md
@@ -53,13 +53,33 @@ The caller or orchestration driver provides exactly these parameters:
### Step 2: Evaluate & Categorize
-For each finding in the list, determine:
+Give each finding exactly one category:
* **CONTEST**: The critique is inaccurate or relies on a misunderstanding of
- the codebase. Provide exact code or design doc evidence defending current
- text.
+ the codebase. Cite evidence that the reviewer could read: a file and
+ symbol, or a decision recorded in the document.
+* **ESCALATE**: The critique is inaccurate, but the evidence is outside every
+ file the reviewer could read (for example, a team convention or a verbal
+ decision). State that fact. Do not fix the finding. Give it to the user.
* **PROPOSE FIX**: The critique is valid. Define precise textual replacements
or structural formatting adjustments to resolve the gap.
+* **DECLINE**: The finding is a Nit. Record it. Do not fix it. You can use
+ PROPOSE FIX for a Nit if the fix is worth it.
+
+Apply these rules:
+
+* **A contest must be checkable.** "This was intentional" is not evidence.
+ If you cannot cite evidence the reviewer could read, use ESCALATE or
+ PROPOSE FIX.
+* **Do not add context only to satisfy a reviewer.** Add context when a human
+ reader of the document needs it. If only a zero-context subagent needs it,
+ use ESCALATE.
+* **Do not contest a comprehension gap.** If a fresh reader could not follow
+ the document, the document is missing context.
+* **Do not change a severity.** If you think a Blocker is a Nit, CONTEST it
+ and state the reason.
+* You wrote the document under review. A wish to contest is not evidence
+ that the reviewer is wrong.
### Step 3: Report Fixes
@@ -79,7 +99,7 @@ using your file-writing tool. Use this layout:
* **Affected Scope:** [Lines Start-End]([RelativePath]#L[Start]-L[End]) ([Sub-header])
* **Discrepancy Description:** [copied from FindingsList]
* **Rationale:** [copied from FindingsList]
-* ***AI Suggestion:*** [CONTEST | PROPOSE FIX]
+* ***AI Suggestion:*** [CONTEST | ESCALATE | PROPOSE FIX | DECLINE]
* ***Justification:*** [Detailed reason]
* ***Proposed Edit:***
* Location: [Line/Header]
@@ -89,6 +109,9 @@ using your file-writing tool. Use this layout:
### Step 4: Interactive Resolution Gate
+If any finding is `ESCALATE`, list those findings first in the chat message.
+They need the user's knowledge, not only approval.
+
Before proceeding, output a visible chat message to the user: *"I have compiled
the audit findings into `goldfish_review_report.md`. Please review the findings there and choose how you would like to
proceed:
@@ -115,12 +138,12 @@ Interpret the user's action/response as follows:
- **"Auto accept" / "Accept all suggestions" / User clicks "Proceed" without
contesting**: Apply all fixes where the AI suggestion was `PROPOSE FIX`
directly to `TargetFile` at `LineRange` in a single batch using
- your file-editing tool. Any items categorized as `CONTEST` are explicitly
- bypassed. Then proceed to Step 5.
+ your file-editing tool. Any items categorized as `CONTEST`, `ESCALATE`, or
+ `DECLINE` are explicitly bypassed. Then proceed to Step 5.
- **"Continue to next phase" / "No changes"**: Do not apply any automated
fixes. Then proceed to Step 5.
- **"Interactive breakdown"**: Enter a sequential breakdown loop over ALL
- finding items (both `PROPOSE FIX` and `CONTEST`):
+ finding items (all categories except `DECLINE`):
1. For each item `i`, output a visible chat message formatting the full
finding details and explanation in rich markdown:
@@ -129,7 +152,7 @@ Interpret the user's action/response as follows:
### Breakdown Item [i]: [Issue Title] [`[ReviewerPersona]`]
* **Scope:** [Lines Start-End]([RelativePath]#L[Start]-L[End]) ([Sub-header])
* **Description:** [Description]
- * **AI Suggestion:** [CONTEST | PROPOSE FIX]
+ * **AI Suggestion:** [CONTEST | ESCALATE | PROPOSE FIX]
* **Explanation & Justification:** [Detailed reason and background explaining why the fix is proposed or why the finding is contested]
* **Proposed Edit:** [Precise replacement text or deletion note]
```
@@ -141,6 +164,8 @@ Interpret the user's action/response as follows:
fix**, **Skip / ignore**, or **Discuss**.
* If `CONTEST`: Ask the user to reply with **Skip / agree with
contest**, **Overrule contest (propose fix)**, or **Discuss**.
+ * If `ESCALATE`: Ask the user to reply with **Confirm (no change)**,
+ **Add the fact to the document**, or **Discuss**.
2. Record the user's decisions in an internal memory checklist (e.g., *Item
1: Accepted*, *Item 2: Ignored*, *Item 3: Overruled*). **Do NOT call any
@@ -158,5 +183,5 @@ Interpret the user's action/response as follows:
file remains structurally coherent and valid markdown.
2. Mark the report as resolved (add a `Status: resolved` line at the top).
3. **Handoff**: Exit cleanly back to the caller (such as `egm-review-loop`)
- with the count of accepted fixes, contested items, and remaining unaddressed
- issues.
+ with the count of accepted fixes, contested items, escalated items,
+ declined items, and remaining unaddressed issues.
diff --git a/skills/egm_resolve/TEST.md b/skills/egm_resolve/TEST.md
index 1cdcbe0..abb5d2c 100644
--- a/skills/egm_resolve/TEST.md
+++ b/skills/egm_resolve/TEST.md
@@ -7,6 +7,6 @@ Frontmatter and link checks run in `pytest tests/unit` (see [TESTING.md](../../T
When evaluating or exploring `egm_resolve` interactively in chat, verify:
- **Step 1 (Intake & Context):** Ingests `TargetFile`, `LineRange`, and `FindingsList`.
-- **Step 2 (Evaluate & Categorize):** Defends valid design choices (`CONTEST`) and drafts concrete repairs (`PROPOSE FIX`).
+- **Step 2 (Evaluate & Categorize):** Defends valid design choices with checkable evidence (`CONTEST`), gives the user refutations that no reviewed file supports (`ESCALATE`), drafts concrete repairs (`PROPOSE FIX`), and records Nits without a fix (`DECLINE`).
- **Step 3 (Report Fixes):** Generates `goldfish_review_report.md` artifact.
- **Step 4 (Resolution Gate):** Prompts the user with clear decision choices (Auto accept, Continue, Interactive breakdown) without modal popups, and executes approved file modifications.
diff --git a/skills/egm_resolve/test_scenarios.yaml b/skills/egm_resolve/test_scenarios.yaml
index 88a33ee..906dbe9 100644
--- a/skills/egm_resolve/test_scenarios.yaml
+++ b/skills/egm_resolve/test_scenarios.yaml
@@ -27,3 +27,15 @@ scenarios:
- type: "required_pattern"
pattern: "(report|findings|resolve|SLO|comment)"
message: "Review resolve skill must compile review findings report and prompt user resolution."
+
+ - scenario_id: "escalate_uncheckable_contest"
+ description: "Verifies a refutation based only on knowledge outside the reviewed files is escalated, not contested or fixed."
+ eval_type: "deterministic"
+ system_prompt:
+ skill_file: "skills/egm_resolve/SKILL.md"
+ turns:
+ - user_input: "Run egm-resolve with TargetFile: docs/design.md, Finding (Major): No retry policy for the export job. The team agreed verbally that exports are never retried; no file records this."
+ assertions:
+ - type: "required_pattern"
+ pattern: "ESCALATE"
+ message: "A refutation that no reviewed file supports must be escalated to the user."