---
name: erp-kit-module-2-requirements-review
description: Review requirements quality and module boundary consistency. Use after creating requirements (step 1) to validate best practices and cross-module boundaries.
disable-model-invocation: true
metadata:
  erp-kit-version: "0.59.0"
---

# Requirements Review

Review **requirements quality** and **module boundary consistency** for a module.

## Version Check

Run `npx erp-kit internal measure versions` from the repo root. If `status` is `"violations"`, relay the findings (each states its own fix) and stop; otherwise proceed.

## When to Use

- After writing module requirements and feature documentation (step 1)
- When validating that features follow ERP best practices
- When checking module boundaries against existing modules

## Step 1: Setup

Define shared context for all agents:

- `MODULES_ROOT`: glob `**/modules/*/README.md` and derive the parent directory
- `MODULE_NAME`: from argument or detect from current working directory
- `MODULE_README`: `<MODULES_ROOT>/<MODULE_NAME>/README.md`
- `FEATURE_DOCS`: glob `<MODULES_ROOT>/<MODULE_NAME>/docs/feature/*.md`
- `OTHER_MODULES`: glob `<MODULES_ROOT>/*/README.md` (excluding current module)
- `OTHER_FEATURES`: glob `<MODULES_ROOT>/*/docs/feature/*.md` (excluding current module)

Verify at least `MODULE_README` exists. If not, stop with: "No module README found for module <MODULE_NAME>. Run erp-kit-module-1-requirements first."

## Step 2: Dispatch Agents (parallelize if possible)

Launch 2 Agent tool calls in parallel — one per review concern.
Each agent receives: MODULE_NAME, relevant doc file paths.
Each agent returns: structured markdown per [references/requirements-report-format.md](references/requirements-report-format.md).

| Agent | Prompt Template                                                                      | Inputs                                                     |
| ----- | ------------------------------------------------------------------------------------ | ---------------------------------------------------------- |
| 1     | [references/best-practices-check.md](references/best-practices-check.md)             | MODULE_README, FEATURE_DOCS                                |
| 2     | [references/boundary-consistency-check.md](references/boundary-consistency-check.md) | MODULE_README, FEATURE_DOCS, OTHER_MODULES, OTHER_FEATURES |

For each agent:

1. Read the prompt template file
2. Replace `{{MODULE_NAME}}` with the resolved module name
3. Replace `{{MODULE_README}}`, `{{FEATURE_DOCS}}`, `{{OTHER_MODULES}}`, `{{OTHER_FEATURES}}` with the actual file paths
4. Dispatch the agent with the filled prompt

## Step 3: Aggregate Results

After ALL agents return:

1. Collect the markdown results from each agent
2. Merge all `issues[]` arrays into a single list
3. Merge all `recommendations[]` arrays into a single list
4. Calculate totals across all summaries

## Step 4: Severity Validation

Subagents tend to over-classify. Before rendering the report, re-evaluate every non-pass finding:

- **"Is this even this module's responsibility?"** — If the concern belongs to another module or is out of scope, drop it from the report
- **"Does this block planning?"** → `critical`
- **"Will this force model/command/query rework?"** → `major`
- All no → `nit`, regardless of subagent label

## Step 5: Determine Verdict

- **APPROVED**: zero `critical` and zero `major`
- **NEEDS CHANGES**: one or more `critical` or `major`

## Step 6: Render Report

## Report Format

Render the aggregated results as markdown:

### Requirements Review Report

**Module:** <MODULE_NAME>

---

### 1. Summary

| Aspect               | Status | Details           |
| -------------------- | ------ | ----------------- |
| Best Practices       |        | X/Y checks passed |
| Boundary Consistency |        | X/Y checks passed |

### 2. Recommendations

Numbered list of actionable fixes, grouped by severity:

1. `critical` — boundary issues, fundamental design flaws (must fix)
2. `major` — best practice violations, missing capabilities (should fix)
3. `nit` — cosmetic, stylistic, minor improvements (informational only)

### 3. Verdict

**Verdict: APPROVED / NEEDS CHANGES**

- If APPROVED with nits: "Review passed. The following nits are informational and do not block progress:" followed by the nit list.
- If NEEDS CHANGES: "Review requires changes. Fix all critical and major issues, then re-run the review."

Severity counts: `critical: N, major: N, nit: N`

## References

- [Requirements report format](references/requirements-report-format.md)
- For requirements creation, see erp-kit-module-1-requirements
