S evaluate

From xg-gh-25/SwarmAI · View interactive version

S evaluate is an AI agent skill from the GitHub repository xg-gh-25/SwarmAI. Evaluate a request against the project's DDD: GO/DEFER/REJECT/ESCALATE with ROI, scope and acceptance criteria. TRIGGER: \"evaluate this request\", \"should we build this\", \"triage this\", \"值不值得做\". NOT FOR: open research (deep-research).

How to use this skill

Skill file

Requirement Evaluation

The "should we?" gate for the lifecycle pipeline. Evaluates any incoming

requirement, feature request, or task against the 4 DDD questions before

committing pipeline resources.

Works at L0 (structures any request with effort/impact). Gets autonomous

judgment at L2 (DDD docs provide strategic alignment, feasibility, and history).

The 4 Questions

Every evaluation answers these, in order:

| # | Question | Source | Without DDD |

|---|----------|--------|-------------|

| 1 | Should we do this? | PRODUCT.md (strategic alignment) | Ask the user |

| 2 | Can we do this? | TECH.md (feasibility, constraints) | Estimate from request |

| 3 | Have we tried this? | IMPROVEMENT.md (past lessons) | No historical context |

| 4 | Should we do it now? | PROJECT.md (current priorities) | Assume yes |

Workflow

Step 1: Parse the Request

From the user's message, extract:

If the request is too vague to parse (e.g., "improve things"), ESCALATE immediately:

"I need more specifics to evaluate this. What specifically should improve, and what would success look like?"

Step 2: Score (L2 with DDD docs)

Read the DDD docs and score each dimension 1-5:

Strategic Alignment (PRODUCT.md):

Feasibility (TECH.md):

Historical Lessons (IMPROVEMENT.md):

Current Priority (PROJECT.md):

ROI Formula:

ROI = (Strategic * 0.35) + (Current_Priority * 0.25) + (Historical * 0.15) + (Feasibility * 0.25)

Range: [1.0, 5.0]. Higher feasibility = easier = higher ROI. All dimensions on 1-5 scale.

Step 2.5: Thesis Alignment

Read Knowledge/Learned/THESIS.md and scan the Thesis Health Summary table for all Active theses.

For each thesis, ask one question: Does this requirement align with, contradict, or have no connection to this thesis?

Most requirements hit 1-2 theses, rarely all. Only report ALIGNS and CONTRADICTS — don't list every N/A.

If a thesis tension applies (see "Known Tensions Between Theses" section in THESIS.md), surface it: "This sits at the T3 vs T6 tension — building understanding tools that are also infrastructure. Resolution principle: [quote from Tensions table]."

Output (add to evaluation):

### Thesis Alignment
- T1 (memory moat): ALIGNS — adds persistent skill-level memory
- T3 (understanding > execution): ALIGNS — helps user see patterns, not just run tasks

Skip when: No DDD docs (L0 evaluation) — thesis alignment requires enough context to judge.

Step 3.5: Pre-mortem (Mandatory for GO candidates)

If the initial ROI >= 3.2 (GO candidate), run a pre-mortem before confirming:

"It's 2 weeks later. This feature shipped but is considered a failure.

What are the 3 most likely reasons it failed?"

Rules:

Output:

| # | Failure Reason | Likelihood | Mitigation |

|---|---------------|-----------|------------|

| 1 | <specific scenario> | high/med/low | <how to prevent or detect> |

| 2 | <specific scenario> | high/med/low | <how to prevent or detect> |

| 3 | <specific scenario> | high/med/low | <how to prevent or detect> |

Decision impact:

Why this exists: EVALUATE has happy-path bias, seen three times. Pre-mortem (Gary Klein) generates 30% more specific failure reasons than "argue against" because "imagine it failed" is concrete, "argue why not" is abstract. Same agent, same pass, one extra section — zero architecture change.

Skip when: ROI < 3.2 (already DEFER/REJECT — no need to argue against a NO).

Step 3: At L0 (No DDD Docs)

Skip scoring. Instead, structure the request:

## Evaluation: <requirement title>

### What
<one-sentence description>

### Effort Estimate
<T-shirt size: S/M/L/XL based on request complexity>

### Impact Estimate
<T-shirt size: S/M/L/XL based on stated motivation>

### Questions Before Proceeding
1. <what's unclear>
2. <what could go wrong>
3. <what's the success criteria>

### Recommendation
<GO / DEFER / ESCALATE with reasoning>

Step 4: Produce Recommendation

Based on ROI score (L2) or structured analysis (L0):

| Recommendation | When | Action |

|---------------|------|--------|

| GO | ROI >= 3.2, no blockers | Define scope + acceptance criteria. Advance pipeline to THINK. |

| DEFER | ROI 2.0-3.1, or blocked by current priorities | Add to PROJECT.md backlog with reasoning. |

| REJECT | ROI < 2.0, or conflicts with non-goals | Explain why. Suggest alternative if one exists. |

| ESCALATE | Ambiguous scope, conflicting signals, or confidence < 0.6 | Surface specific questions to user. Don't guess. |

Step 5: Output

Present to user:

## Evaluation: <requirement title>

### Scores (L2 only)
| Dimension | Score | Rationale |
|-----------|-------|-----------|
| Strategic Alignment | 4/5 | Serves priority #2 (self-evolution) |
| Feasibility | 3/5 | Moderate — needs new pattern, ~3 sessions |
| Historical | +1 | Similar approach worked for context loading |
| Current Priority | 3/5 | Important but not blocking current focus |
| **ROI** | **3.5** | |

### Thesis Alignment
- T1 (memory moat): YES — <why>
- T3 (understanding > execution): N/A

### Recommendation: GO

### Pre-mortem (GO candidates only)
| # | Failure Reason | Likelihood | Mitigation |
|---|---------------|-----------|------------|
| 1 | <specific scenario> | med | <mitigation> |
| 2 | <specific scenario> | low | <mitigation> |
| 3 | <specific scenario> | low | <mitigation> |

Score adjustment: none (no HIGH without mitigation)

### Scope
<what's included and what's excluded>

### Acceptance Criteria
1. <criterion 1>
2. <criterion 2>
3. <criterion 3>

### Suggested Pipeline
Think: research <topic>
Plan: design with 3 alternatives
Build: implement chosen approach
Test: QA against acceptance criteria

Structured form (L1+, shown with the evaluation):

{
  "requirement": "...",
  "scores": {
    "strategic": 4,
    "feasibility": 3,
    "historical": 1,
    "priority": 3,
    "roi": 3.4
  },
  "recommendation": "GO",
  "thesis_alignment": {"T1": "YES — adds persistent memory", "T3": "N/A"},
  "pre_mortem": [
    {"reason": "...", "likelihood": "med", "mitigation": "..."},
    {"reason": "...", "likelihood": "low", "mitigation": "..."},
    {"reason": "...", "likelihood": "low", "mitigation": "..."}
  ],
  "scope": "...",
  "acceptance_criteria": ["...", "..."],
  "escalation_questions": [],
  "suggested_pipeline": ["think", "plan", "build", "test"]
}

Escalation Protocol Integration

Use the escalation protocol (backend/core/escalation.py) for transparent

decision-making at every evaluation. Three levels, three outcomes:

L0 INFORM — "Clear call, FYI"

When: ROI >= 3.2 AND confidence is high AND no blockers.

Emit an INFORM annotation and continue the pipeline:

from core.escalation import inform, build_sse_event, save_escalation
esc = inform(
    title="GO: Build payment retry",
    situation="ROI 4.1, directly serves priority #1, proven pattern from IMPROVEMENT.md.",
    trigger="CLEAR_EVALUATION",
    pipeline_stage="evaluate",
    project="<PROJECT>",
    evidence=["PRODUCT.md: checkout reliability is #1", "IMPROVEMENT.md: saga pattern worked"],
)
save_escalation(WORKSPACE_ROOT, esc)

Triggers: CLEAR_EVALUATION

L1 CONSULT — "I think X, override within 24h"

When: ROI 2.5-3.1 (borderline) OR confidence medium OR non-obvious tradeoff.

Swarm proceeds with its recommendation. Human has 24h to override via Radar todo.

from core.escalation import consult, Option, build_sse_event, save_escalation
esc = consult(
    title="DEFER recommended: UI performance investigation",
    situation="ROI 2.8 — aligned with priorities but effort is high (architectural). Historical: no prior attempt. Proceeding with DEFER unless overridden.",
    options=[
        Option(label="DEFER (recommended)", description="Add to backlog, revisit next sprint", risk="low", is_recommendation=True),
        Option(label="GO", description="Start research phase now", risk="medium"),
        Option(label="Discuss", description="I need more context from you"),
    ],
    trigger="LOW_CONFIDENCE_ROI",
    recommendation="DEFER — effort-to-impact ratio doesn't justify immediate action",
    pipeline_stage="evaluate",
    project="<PROJECT>",
    evidence=["PRODUCT.md: priority #3", "TECH.md: requires new pattern"],
    timeout_hours=24,
)
save_escalation(WORKSPACE_ROOT, esc)
# NOTE (2026-08-08 unified Need You): do NOT create_radar_todo — a saved escalation
# surfaces in the unified Need You channel (GET /api/attention, L1→tier=REVIEW)
# automatically. A ToDo too would double-surface the same item; escalation goes to
# Need You ONLY, no longer to ToDo (design §2 / R27 migration).

Triggers: LOW_CONFIDENCE_ROI, CONFLICTING_PRIORITIES

L2 BLOCK — "I'm stuck, need your input"

When: ANY of these are true:

Pipeline PAUSES. Surfaces as a high-priority BLOCKING item in the unified Need You channel.

from core.escalation import block, Option, build_sse_event, save_escalation
esc = block(
    title="Cannot evaluate: ambiguous scope",
    situation="'Improve performance' — of what? API latency, UI render, or build speed? Each leads to a different recommendation.",
    options=[
        Option(label="Focus on API latency", description="Proven pattern, 2 sessions", risk="low", is_recommendation=True),
        Option(label="Focus on UI render", description="Needs research first, 4+ sessions", risk="medium"),
        Option(label="Research both first", description="1-session investigation, then decide"),
        Option(label="Discuss", description="Let me explain more context"),
    ],
    trigger="AMBIGUOUS_SCOPE",
    recommendation="API latency — if forced to choose",
    pipeline_stage="evaluate",
    project="<PROJECT>",
    evidence=["PRODUCT.md: 'performance' listed but not specified"],
)
save_escalation(WORKSPACE_ROOT, esc)
# NOTE (2026-08-08 unified Need You): do NOT create_radar_todo — a saved L2 escalation
# surfaces as a BLOCKING item in Need You (GET /api/attention) automatically. Escalation
# goes to Need You ONLY, no longer to ToDo (design §2 / R27 migration).

Triggers: AMBIGUOUS_SCOPE, CONFLICTING_PRIORITIES, MISSING_INFORMATION

Rules

Inside a pipeline run

Stage progress is recorded by "$SWARM_BACKEND_BIN" pipeline-v1

(stage-complete --project <PROJECT> --run-id <RUN_ID>), never by this skill. Standalone,

the evaluation shown to the user is the whole hand-off.

⏭️ Continuation contract — advance is not the end of your turn. advance only records the state transition; it is NOT a

handoff point. Immediately Read the next stage's doc (the advance output prints its

absolute path as next_stage_doc) and execute that stage in this same turn. The ONLY

legal reasons to hand control back are: a stage-boundary L2 Judgment routed through the

Escalation Routing Protocol, a true checkpoint trigger (should_checkpoint=true,

retries exhausted, or a mid-stage L2), a pending question awaiting the user, or an abandon

verdict. Absent one of those, ending your turn here is the stall this contract exists to

prevent.

next_action is AUTHORITATIVE — this sentence defers to it. The payload is measured at

the moment you advance; this prose was written long before. When advance reports a due

checkpoint (or that it could not measure the budget), it withholds the continue instruction

ON PURPOSE — follow the payload, not this paragraph. Prose cannot see the run's state; the

payload can.

Verification

Before marking this task complete, show evidence for each:

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.