Rat p4p5 impl verify policy

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

Rat p4p5 impl verify policy is an AI agent skill from the GitHub repository babyworm/rtl-agent-team. Internal reference: rat p4p5 impl verify policy (agent-loaded; do not invoke).

How to use this skill

Skill file

μArch-to-Verify Policy

Core Principles

Hierarchical Spec Compliance

Lower phases MUST NOT violate upper phase specifications:

Spec → Architecture → μArch → RTL → Verification

RTL must faithfully implement the μArch design. Verification must validate against the original Spec.

Design Priority Order

  1. Functional Correctness (highest) — Every required feature works exactly
  2. Interface Compliance — Ports, protocols, timing match Architecture
  3. Timing/Performance — Throughput, latency targets met
  4. Area/Power (lowest)

Document-as-Memory

Phase 4 reads Phase 1-3 documents as input context. Phase 5 reads Phase 4 artifacts.

No agent needs to "remember" another agent's output — it reads the document.

State is persisted at .rat/state/rat-p4p5-impl-verify-state.json for resumability.

Execution Rules

Dual-Layer Phase Gates

Phase 4→5 transition requires BOTH:

  1. Artifact Gate: Required files exist (fast check)
  2. Quality Gate: Reviewer agent(s) verify quality AND hierarchical spec compliance

Quality Gate verdicts: PASS or FAIL + findings[]

Gate Retry Policy

Context Preload

Before each phase, verify required upstream files exist:

Specific file lists are defined inline in each orchestrator's phase steps.

Termination

After Phase 5 Final Compliance Gate PASS, generate summary, then STOP.

Do NOT proceed to Phase 6.

Prerequisite Requirements

| Artifact | Required Check |

|----------|---------------|

| docs/phase-3-uarch/*.md | At least one μArch module spec exists |

| reviews/phase-3-uarch/uarch-review.md | File exists AND contains Verdict: PASS |

| docs/phase-1-research/iron-requirements.json | File exists (needed for traceability) |

| docs/phase-1-research/io_definition.json | File exists (needed for port verification) |

| refc/*/*.c | At least one C reference model source exists |

| docs/phase-3-uarch/phase-3-summary.md | File exists (Phase 3 summary for context) |

Intake Checklist (from rat-p1p3-spec-uarch)

Phase Gate Definitions

Phase 4→5 (RTL → Verification)

Artifact Gate:

Quality Gate:

Summary Validation: docs/phase-4-rtl/phase-4-summary.md must exist

Phase 5 Completion

Artifact Gate: all verification sub-phases (5a-5e) pass

Quality Gate:

Summary Validation: docs/phase-5-verify/phase-5-summary.md must exist

Stream B Rules (Phase 4)

Stream B artifacts generated concurrently with Stream A (RTL implementation):

Traceability Convention:

Merge Point: Stream A (lint-clean + unit PASS) + Stream B artifacts ready → Phase 4→5 Gate.

Feedback Loop Classification (Phase 5→4)

| Type | Scope | Handling | Re-verify |

|------|-------|----------|-----------|

| UNIT_FIX | Single module (SVA fail, assertion error) | rtl-p4s-bugfix (parallel across modules) | Only failed sub-phases |

| INTEGRATION_FIX | Cross-module interface | rtl-p4s-bugfix (sequential) | 5b + 5c |

| DESIGN_FIX | Architecture-level | IMMEDIATE STOP → user approval | All (5a-5e) after upper phase fix |

Batch UNIT_FIX across sub-phases:

Max 2 feedback loops per sub-phase. After loop 2 fails → escalate to user.

Sub-phase Re-entry Criteria

| Fix Type | Re-run Sub-phases | Condition |

|----------|------------------|-----------|

| UNIT_FIX (SVA fail) | 5a only (formal) | SVA property affected |

| UNIT_FIX (sim fail) | 5c only (integration) | Testbench affected |

| INTEGRATION_FIX | 5b + 5c (CDC + integration) | Interface modified |

| DESIGN_FIX | All (5a-5e) after upper phase approval | Architecture changed |

Feedback Loop State Schema

{
  "loop_count": 1,
  "max_loops": 2,
  "failures": [{
    "sub_phase": "5a",
    "type": "UNIT_FIX",
    "module": "example_module",
    "description": "SVA counterexample at cycle 42",
    "fix_applied": "Added pipeline register",
    "re_run_phases": ["5a"]
  }],
  "status": "in_progress"
}

Lesson Learned Recording

After each successful feedback fix:

Escalation & Stop Conditions

Coding Convention Summary

All phases must enforce:

Final Checklist

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.