Rat p1p3 spec uarch policy

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

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

How to use this skill

Skill file

Spec-to-μArch Policy

Core Principles

Hierarchical Spec Compliance

Lower phases MUST NOT violate upper phase specifications:

Spec → Architecture → μArch

Each phase strictly adheres to decisions made in all preceding phases.

Deletion, reduction, or modification of features for convenience is FORBIDDEN.

If a change is needed, control returns to the upper phase for approval.

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)

Cascading Quality

Higher abstraction levels demand MORE iterative refinement.

Dynamic convergence with graduated minimums:

Phase 1 (Research): min 3 rounds (chief-coordinated, fixed — P1 is the quality foundation)

Phase 2 (Architecture): min 2, max 5 rounds — memory, performance, ref model consistency

Phase 3 (μArch): min 2, max 5 rounds — performance, interface, memory optimization

P2/P3 use convergence criteria (finding_delta < 0.1, critical resolved, wonder stable).

Principle: refine thoroughly at the top, execute efficiently at the bottom.

Document-as-Memory

Design artifacts serve as persistent memory. Each phase reads upstream documents and writes

downstream documents. State at .rat/state/rat-p1p3-spec-uarch-state.json.

Execution Rules

Dual-Layer Phase Gates

Every phase transition requires BOTH:

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

Gate Retry Policy

Context Preload

Before each phase, verify required upstream files exist (specific file lists defined inline in orchestrator steps).

Scratchpad Convention

During iterative review rounds:

.rat/scratch/phase-{N}/round-{R}-{agent}.md

Coordinator reads all round files to aggregate feedback.

On phase gate PASS: consolidated review saved to reviews/, scratch cleaned.

Termination

After Phase 3 Quality Gate PASS, generate summary + ADR, then STOP.

Do NOT proceed to Phase 4.

Phase Gate Definitions

Phase 1→2 (Research → Architecture)

Artifact Gate: iron-requirements.json (required; open-requirements.json optional) + io_definition.json + timing_constraints.json + domain-analysis.md exist

Quality Gate:

Summary Validation: docs/phase-1-research/phase-1-summary.md

Phase 2→3 (Architecture → μArch)

Artifact Gate: architecture.md (with D2 block diagram) + refc//.c exist

Quality Gate:

Phase 2 Iterative Review (dynamic convergence, coordinated by rtl-architect):

Summary + ADR: phase-2-summary.md + 3-5 ADRs in docs/decisions/

Phase 3 Completion (μArch → Human Review)

Artifact Gate: docs/phase-3-uarch/*.md + bfm/ directory exist

Quality Gate:

Phase 3 Iterative Review (dynamic convergence, coordinated by rtl-architect):

Summary + ADR: phase-3-summary.md + 3-5 ADRs in docs/decisions/

Phase Feedback Loop Protocol

Forward Flow (Normal)

P1 → P2 → P3: Each phase reads upstream artifacts, writes downstream.

Backward Flow (Coherence Failure)

When P3 discovers P1 requirement gaps:

  1. P3 generates requirement-delta.md (Step 4.5 of spec-to-uarch-orchestrator)
  2. If delta contains MODIFY, ADD, or DROP actions:

a. Orchestrator sets upper_spec_blocking: true

b. User is consulted via AskUserQuestion

c. If user approves revision: P1 re-runs with delta as input

d. P2 re-runs reading updated P1 artifacts

e. P3 re-runs reading updated P2 artifacts

  1. Maximum feedback iterations: 2 (then escalate to user regardless)
  2. Each iteration records generation number for traceability

Requirement Similarity Convergence

After feedback loop iteration:

Review Convergence Criteria

Review rounds within P2 and P3 use dynamic convergence instead of fixed 3 rounds:

| Parameter | Value | Rationale |

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

| min_rounds | 2 | Minimum for meaningful review |

| max_rounds | 5 | Prevent infinite loops |

| finding_delta_threshold | 0.1 | < 10% new findings = stable |

| critical_resolution | ALL | All Critical/High must be resolved |

| wonder_stability | true | No new High-risk assumptions |

Handoff Checklist (to rat-p4p5-impl-verify)

Escalation & Stop Conditions

Coding Convention Summary

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.