Review story alignment

From Fr-e-d/GAAI-framework · View interactive version

Review story alignment is an AI agent skill from the GitHub repository Fr-e-d/GAAI-framework. Adversarial review of generated stories against the Discovery Session Brief, referenced DECs, and Epic DoR. Detects contradictions, omissions, and intent drift BEFORE stories reach Delivery. Produces a structured verdict (PASS/FAIL) with specific findings per story. Triggers after generate-stories,

How to use this skill

Skill file

Review Story Alignment (SKILL-RSA-001)

Purpose

Stories generated by Discovery may contradict, omit, or drift from what was discussed during the human ↔ agent conversation. This skill acts as an adversarial reviewer — a separate agent that checks stories against the Discovery Session Brief BEFORE they reach Delivery.

This skill does NOT check format (that is validate-artefacts). It checks alignment — does the story faithfully represent what was decided, observed, and agreed during the Discovery session?


When to Activate

Do NOT activate:

Reduced-Scope Mode (no Session Brief)

When no Discovery Session Brief is provided, the gate runs in reduced-scope mode:

Reduced-scope mode ensures that DEC cross-referencing and DoR enforcement are never bypassed, even for single-story amendments or bug-triage stories created outside a full Discovery session.


Architecture — Isolated Reviewer

This skill is executed by the Review Sub-Agent (SUB-AGENT-REVIEW-001) during Tier 2 review. The Review Sub-Agent already runs in an isolated context window with an adversarial prompt — this skill defines the 3-pass process it follows for story alignment specifically.

If invoked standalone (outside the Review Sub-Agent context), this skill MUST still run as a sub-agent in an isolated context window (via the Agent tool). The reviewer must NOT be the same agent instance that wrote the stories.

Why isolation matters: The author of the stories has confirmation bias — it wrote the stories believing they were correct. A separate agent with fresh context is more likely to detect contradictions.

The reviewer receives ONLY:

  1. The Discovery Session Brief (full 7-category block)
  2. The story files to review
  3. The parent Epic (for DoR categories)
  4. The referenced DEC files (full content, not just IDs)

The reviewer does NOT receive:

Invocation Template

The Discovery Agent MUST invoke the reviewer using this prompt structure (via the Agent tool):

You are an adversarial story reviewer. Your job is to find contradictions,
omissions, and drift — not to confirm correctness. Assume stories contain
errors until proven otherwise.

DISCOVERY SESSION BRIEF (human-validated):
══════════════════════════════════════════
{paste the full structured Brief with D-N, O-N, H-N, T-N, S-N, C-N, Q-N items}

EPIC (for DoR categories):
{paste Epic frontmatter including mandatory_ac_categories}

STORIES TO REVIEW:
{paste each story file content}

REFERENCED DECs:
{paste full content of each DEC listed in related_decs}

Execute the review-story-alignment process: 3 passes per story
(Session Brief contradictions, DEC constraints, DoR coverage).

For each finding, reference the Brief item by ID (e.g., "contradicts D-1")
and the story element by AC number (e.g., "AC3 in {story_id}").

Produce a structured verdict per story.

If a Session Brief exists, it MUST be included verbatim in the prompt — with all item IDs (D-N, O-N, etc.). The Brief is the source of truth for Pass A.

If no Session Brief exists (single-story amendment, bug-triage, DEC amendment): replace the Brief block with DISCOVERY SESSION BRIEF: NONE — reduced-scope mode (Passes B+C only). The reviewer skips Pass A and produces "SKIPPED — no Session Brief provided" in the verdict. Passes B and C run normally.


Process

Step 1 — Load Review Context

Load all inputs:

Step 2 — Per-Story Alignment Check (3 passes)

For EACH story, run three passes:

Pass A: Session Brief Contradiction Check

Compare every item in the Session Brief against every AC and Context section in the story.

For each Session Brief item, ask:

Contradiction = any statement in the story that implies the OPPOSITE of a Session Brief item.

Examples:

Classification:

Pass B: DEC Constraint Check

For each DEC in the story's related_decs:

  1. Read the DEC's decision statement
  2. Check: does any AC in the story violate the DEC's constraint?
  3. Check: should additional ACs exist to enforce the DEC?

Also perform a DEC coverage scan:

Classification:

Pass C: Definition of Ready (DoR) Check

Read the Epic's mandatory_ac_categories. For each category:

Classification:

Step 3 — Produce Verdict

For each story, produce a structured verdict:

## Review: {story_id}

**Verdict: PASS | FAIL**

### Findings

| # | Type | Severity | Brief Item | Story Element | Finding |
|---|------|----------|-----------|---------------|---------|
| 1 | CONTRADICTION | CRITICAL | **D-1** (Dashboard = admin-first) | AC1 | Story says "end-user-facing" — contradicts D-1 |
| 2 | DEC_MISSING | HIGH | **C-1** (<DEC-id>: EN only) | related_decs | The EN-only DEC should be referenced — story has URL routing implications |
| 3 | DOR_MISSING | HIGH | DoR: `error-handling` | No AC | No AC addresses error handling |
| 4 | DRIFT | HIGH | **Q-2** (actionable errors) | AC5 | AC says "return error code" — Q-2 requires actionable guidance, not just codes |

### Refinement Guidance

For each FAIL finding, state:
- What needs to change in the story
- Whether the Discovery Agent has enough information (from the Session Brief) to make the fix autonomously
- If NOT enough information → what question to ask the human

Step 4 — Aggregate Verdict

## Batch Review Summary

Stories reviewed: N
PASS: X
FAIL: Y

Critical findings: Z (must be resolved before any story reaches backlog)

Reviewer Stance

The reviewer is adversarial by design. Its instruction set:

"You are a reviewer, not a validator. Your job is to find problems, not confirm correctness. Assume the stories contain errors until proven otherwise. For every Session Brief item, actively look for the contradiction — don't look for confirmation. When in doubt, it's a FAIL, not a PASS. A false positive (flagging something that's actually fine) costs 5 minutes to dismiss. A false negative (missing a real problem) costs hours of wrong implementation."

Calibration: The reviewer should err on the side of strictness. 1-2 false positives per batch is acceptable. Zero false negatives is the target.

Severity calibration (founder-confirmed): MEDIUM (and lower) findings are advisory and non-blocking for a PASS verdict: a story may PASS with open MEDIUM findings provided they are recorded in the finding table. The adversarial "when in doubt, FAIL" stance applies to CRITICAL/HIGH judgments only — i.e. when uncertain whether something is CRITICAL/HIGH, treat it as such; do not inflate a genuine MEDIUM into a blocker.


Quality Checks


Non-Goals

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.