Cross phase contract validator

From babyworm/rtl-agent-team · View interactive version

Cross phase contract validator is an AI agent skill from the GitHub repository babyworm/rtl-agent-team. Validate spec contracts across phase boundaries (P3 uarch to P4 RTL to P5 verify): port widths, memory class, REQ traceability. Use at P4/P5 entry.

How to use this skill

Skill file

<Purpose>

Validate spec consistency across phase boundaries. Catches mismatches between upstream

specifications and downstream implementations that individual phase gates cannot detect.

</Purpose>

<Use_When>

</Use_When>

<Do_Not_Use_When>

</Do_Not_Use_When>

Phase Boundary: P3→P4 Checks

1. Port Width Consistency

Compare across three sources — all must agree:

For each port: io_definition[width] == uarch_spec[width] == RTL_port_width.

Mismatch → CRITICAL.

2. Memory Classification Match

For each storage element in P3 uarch docs:

combinational read → CRITICAL (register array where SRAM required)

3. Pipeline Depth Match

For each module with pipeline specification in P3:

4. Bus Width Parameterization

For each FIFO/bus width defined in P3 with a derivation formula:

localparam L_FIFO_W = 672 → MAJOR

5. REQ→RTL Traceability

For each REQ-U-* in docs/phase-3-uarch/iron-requirements.json:

or in docs/phase-4-rtl/functional-completeness.md

Phase Boundary: P4→P5 Checks

6. Unit Test Existence

For each RTL module in rtl/*/:

7. Stream B Artifact Completeness

Verify Stream B artifacts from P4 are present for P5 consumption:

8. Coverage Infrastructure Readiness

Execution

Read all upstream artifacts, perform checks, generate report:

Glob("docs/phase-3-uarch/*.md")
Glob("docs/phase-3-uarch/iron-requirements.json")
Glob("docs/phase-1-research/io_definition.json")
Glob("rtl/*/*.sv")
Glob("sim/*/tb_*.sv")
Glob("sim/*/*_unit_results.json")

For each check: collect evidence (file:line citations), classify (CRITICAL/MAJOR/WARNING/INFO).

Output

Write reviews/cross-phase-contract-validation.md:

# Cross-Phase Contract Validation
- Date: YYYY-MM-DD
- Boundary: P3→P4 | P4→P5
- Verdict: PASS | FAIL

## Check Results
| # | Check | Status | Evidence |
|---|-------|--------|----------|
| 1 | Port width consistency | PASS/FAIL | file:line details |
| 2 | Memory classification | PASS/FAIL | ... |
| ... | ... | ... | ... |

## Critical Findings
[details with file:line citations]

## Recommendations
[actionable fix suggestions]

Gate Behavior

Completion: Spec Cascade Marker Lifecycle

The edit-tracker hook creates spec-cascade-stale-p{1,2,3} markers in the project

state dir (.rat/state/, or legacy .rtl-agent-team/state/ when .rat/ is absent)

whenever an upstream phase doc is modified while downstream artifacts exist. This

skill is the resolution path for those markers:

markers — rm -f .rat/state/spec-cascade-stale-p* (adjust the state dir for the

legacy layout). Downstream artifacts are re-validated against the changed spec.

re-run of this skill passes.

Note: writing reviews/cross-phase-contract-validation.md with a PASS verdict also

triggers hook-side auto-clear in rtl-edit-tracker.sh (PostToolUse). The explicit

rm -f above is the fallback when the report is written to a non-standard path.

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.