requirement-alignment Β· git:20260810.84c9c1e Β· 2026-08-10 Β· sha256 57adeae2af28b590

requirement-alignment git:20260810.84c9c1eA

Immutable. This exact content never changes and is served at /api/v1/blob/57adeae2af28b590.

---
name: requirement-alignment
description: Use when analyzing a requirement/PRD, building state machines, sequence diagrams, decision tables or DDL from a spec, or resuming an interrupted requirement analysis - drives the three-level intent-alignment funnel (code evidence, registered inference, structured escalation) through the intent-gate MCP tools
---

# Requirement Intent Alignment

## Overview

Ambiguity in a requirement is resolved through a funnel that gets cheaper per level,
never by silent assumption. The MCP tools are the enforcement: they reject malformed
questions, refuse to settle answers without a landing point, and gate delivery on
mechanical lint.

**The full law is the MCP prompt `doc_analysis_playbook` β€” read it in full before
starting Step 0. This skill is the map; the playbook is the territory.**

## The Funnel

Resolve each gap at the cheapest level that can close it:

1. **Code evidence (πŸ”§ technical gaps first)** β€” search the codebase
   (codegraph `search_graph` / `trace_path`, or grep). If the code has a single
   ground truth, inject it and settle with `resolve_question(source="code")`.
   Zero human cost.
2. **Registered inference** β€” no direct ground truth but a strong analogy?
   `record_inference` with an explicit evidence chain, batch-confirm with the
   human at session end via `confirm_inferences`. πŸ”΄ Forbidden on core
   money flows and red-line rules β€” those need a human decision.
3. **Group escalation (optional, sister intent-gate-service MCP)** β€” judgment calls whose
   rightful answerer sits in a DingTalk group: intent-gate-service's `group_dispatch`
   with category πŸ“‹ business / πŸ”§ technical, @ the right role. One question in
   flight at a time. Core-flow questions carry your inference as recommended
   option 1, so the human nods instead of drafting. Skip this level when
   intent-gate-service is not mounted.
4. **Dialog fallback (default)** β€” the host asks the user directly,
   3+1 options per question.

## Question Format (strictly enforced)

```
🟑 ζ„ε›Ύε―Ήι½οΌš{specific gap, citing the position on the diagram}

  1. {option 1: concrete state/action/result}
  2. {option 2}
  3. {option 3}
  4. ε…Άδ»–οΌˆθ―·θΎ“ε…₯οΌ‰
```

- At least 3 mutually exclusive options + "other" β€” the tool mechanically rejects fewer.
- One ambiguity per question β€” never batch.
- Options must be concrete (state values, actions, results); "handle normally" is banned.

## The Loop (turn-based, non-blocking)

```
record_judgment (your formal verdict: patterns / complexity / light / gaps)
  β†’ dispatch_question per gap (persist BEFORE sending)
  β†’ end turn freely β€” nothing blocks on humans
  β†’ on resume: rebroadcast_pending β†’ collect_answers
  β†’ inject each answer into the diagrams, resolve_question to settle
     (every settled answer appends a standard alignment-log entry)
  β†’ re-assess confidence β†’ 🟒 proceed to artifact generation; else loop
```

## Hard Gates

- πŸ”΄ πŸ”΄ lights unresolved β†’ report `status: blocked`, first task is `[BLOCKER]`.
- πŸ”΄ Every injected intent needs a precise landing point (diagram edge / step /
  rule id / field). Anchors come from `draft_mapping` (script-located), never
  hand-written. No landing point β†’ ask the human again on the spot.
- πŸ”΄ Downgrading an item to `[πŸŸ‘εΎ…ζΎ„ζΈ…]` requires explicit human confirmation,
  recorded per item. Self-downgraded = alignment incomplete.
- πŸ”΄ Before delivery: `lint_summary` must report zero CRITICAL.
- πŸ”΄ New-coined terminology must be confirmed via a dispatched question, with or
  without a terminology wiki β€” "no baseline" is not an exemption.

## After Delivery: Optional Red-Blue ReviewοΌˆε―ι€‰ι‘ΉοΌ‰

When a **complex** requirement's summary.md is delivered (`status: pending_review`),
offer the human the optional adversarial review: skill `red-blue-review` runs a
blue army in an INDEPENDENT session against the artifacts (R1-R9), and its PASS
is one of the two legitimate paths to `status: approved` (the other is a direct
human decision). The red army files the review request
(`_review/review-request.md`, template in that skill) when the human opts in.
Never auto-start it, and never review your own session's work.

## Working Files

All state lives under `.harness/requests/{feature}/_review/`:
`pending-questions.md` (checklist), `alignment-log.md` (settled answers, verbatim
human wording), `inference-pending.md`, `inbox/`. Resume works from files alone β€”
never rely on session memory.