> **⚠️ OUTPUT CONTRACT (READ FIRST):** `guides/output-contract.md`
> Checklist-only output. No tool-call narration. No raw MCP/JSON/log dumps.
> One checklist upfront, updated in place, shown again at end with a 1-line verdict.


# rdc:verify — Verification Before Completion

> Adapted from obra/superpowers `verification-before-completion`.
> Stack-specific: uses `npx vitest run` + `npx tsc --noEmit`. NEVER `pnpm build` (crashes machine — 800MB/process).

## The Iron Law

**NO COMPLETION CLAIMS WITHOUT FRESH VERIFICATION EVIDENCE.**

You may not say "done", "complete", "working", "fixed", "passing", or imply success until you have:

1. **Identified** the exact commands that prove the claim
2. **Run** those commands fresh in the current state (not memory, not "earlier", not "should")
3. **Read** the full output
4. **Verified** the output matches the claim
5. Only THEN made the claim, quoting the evidence

If you cannot run the commands, say so explicitly. Do not substitute reasoning for evidence.

## Red Flags — Stop and Verify

If you're about to write any of these, STOP:

- "should work" / "should pass" / "should be fine"
- "probably" / "seems to" / "looks good"
- "I think the tests pass"
- "the types check out" (without running tsc)
- "everything compiles" (without fresh output)
- Expressing satisfaction or wrapping up before the gate ran

## The Gate — Commands for This Stack

Run these in order. All must pass. Capture output.

### 0. Checklist decomposition quality

Before code verification, inspect each work item checklist and the matching plan section.

Required plan evidence:
- `## Checklist Decomposition Matrix`
- `## Checklist Quality Gate`
- `verdict: PASS`

Required work item evidence:
- At least one `decomp-*` checklist item for every implementation work item
- At least one `test-*` checklist item for every implementation work item
- Each `decomp-*` item includes a route or file path, one action, one expected result, and one evidence artifact
- Each `decomp-*` item is independently pass/fail; vague rows like "UI complete", "theme management works", or "integration verified" are failures

If this check fails, stop validation for that item and reopen it. Do not mark a work item `done` when the checklist itself is not decomposed enough to prove completion.

### 1. Per-package vitest (every package touched)

```bash
cd <repo-root>
for pkg in <changed-packages>; do
  npx vitest run --dir packages/$pkg 2>&1 | tee /tmp/verify-$pkg.log
done
```

Or for a single package:
```bash
npx vitest run --dir packages/<pkg>
npx vitest run --dir apps/<app>
```

**NEVER** run `pnpm build` or `pnpm test` at the repo root — spawns 5-7 node processes at 800MB each and crashes the machine.

### 2. Typecheck per package

```bash
npx tsc --noEmit --project packages/<pkg>/tsconfig.json
npx tsc --noEmit --project apps/<app>/tsconfig.json
```

One package at a time. Read the full output — zero errors required.

### 3. Lint (if configured for the package)

```bash
npx eslint <paths> --max-warnings=0
```

### 4. Smoke check exports (if package adds public API)

```bash
node -e "const m = require('<pkg>'); console.log(Object.keys(m));"
```

Or for ESM:
```bash
node --input-type=module -e "import * as m from '<pkg>'; console.log(Object.keys(m));"
```

## Rationalization Prevention

| You're tempted to think... | Reality |
|---|---|
| "Tests passed earlier, should still pass" | Run them now. Code changed. |
| "TypeScript is strict, if it built it works" | You didn't build. Run tsc. |
| "Small change, no need to retest" | Small changes are where regressions hide. |
| "I'll note it as pending verification" | No. Verify now or mark incomplete. |
| "The test file looks right" | Reading ≠ running. Run it. |

## Output Format — Required

When reporting completion, use this structure:

```
## Verification Evidence

### vitest
$ npx vitest run --dir packages/hail
 Test Files  12 passed (12)
      Tests  147 passed (147)

### tsc
$ npx tsc --noEmit --project packages/hail/tsconfig.json
(no output — clean)

### Status
Checklist quality: PASS
PASS — safe to mark tasks done.
```

If any step fails: do NOT claim completion. Report the failure, fix it, re-run the entire gate.

## When to Invoke

- **End of `/rdc:build`** — mandatory final phase before marking epic done
- **During `/rdc:review`** — verification gate after fixes applied
- **Before any "done" declaration** — if an agent or supervisor is about to say work is complete
- **After merging waves** — when parallel agents finish and their work is combined

## Agent Delegation

When dispatching a verification agent, give them:
- Exact list of packages/apps to verify
- Explicit ban on `pnpm build` / `pnpm test` / `pnpm -r`
- Work item checklists and the matching plan doc so `decomp-*` quality can be verified first
- Required output format (above)
- Instruction: "If any command fails, STOP and report. Do not fix. Do not continue."

## The Bottom Line

Evidence before claims. Fresh evidence, not remembered evidence. Full output, not selective reading. If you skip the gate, you are lying about the work being done.
