P1 spec research policy

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

P1 spec research policy is an AI agent skill from the GitHub repository babyworm/rtl-agent-team. Internal reference: p1 spec research policy (agent-loaded; do not invoke).

How to use this skill

Skill file

Phase 1 Research Policy

Core Principles

AskUserQuestion BEFORE proceeding. Never assume — a wrong assumption cascades to all later phases.

message covering goal, scope, constraints, priority trade-offs, verification strategy, and

dependencies (full interview protocol owned by the goal-clarifier agent). Record answers in

docs/phase-1-research/design-intent.md; resolve ambiguous spec language with the user's

stated intent, never agent assumptions.

present a per-OPEN comparison table (Approach | Pros | Cons | Area Est. | Latency Est. |

Recommendation) and let the user select via AskUserQuestion. Record choice + rationale in

open-requirements.json resolution_rationale.

(per block) → performance → open items — so users correct misinterpretations before they

propagate. Finalize iron-requirements.json only after all stages are approved.

HW trade-offs — never research in isolation. Experts provide knowledge; spec-analyst captures

it as structured artifacts.

final selections. Architecture-level decisions (pipeline, partitioning, memory hierarchy)

belong to Phase 2 — Phase 1 surveys and recommends.

solution path before committing. Skip ONLY if the user specifies exact algorithm +

architecture (even then, explore at least 2 variants for validation).

Spec Refinement Criteria

AskUserQuestion MUST cover these areas (skip items already provided by user):

3-Round Chief Review Protocol

Mandatory 3 rounds, coordinated by rtl-architect (domain-agnostic default).

If a domain chief exists (e.g., vcodec-chief-standard-expert for video-codec domain),

invoke both rtl-architect AND domain chief for domain-specific validation:

fixed-point constraints, cross-block issues, [AMBIGUITY]/[CONFLICT] status

Save: reviews/phase-1-research/research-review-r1.md

Save: reviews/phase-1-research/research-review-r2.md

Save: reviews/phase-1-research/research-review-r3.md

Review criteria per round:

  1. Data flow: inputs/outputs defined at every block boundary
  2. Dependencies: which block produces/consumes what data
  3. Performance: throughput, latency, bandwidth as specific numbers
  4. Fixed-point: bit widths, rounding modes per block
  5. Cross-block issues: RDOQ↔Entropy dependency, ME↔MC pipeline, etc.
  6. Ambiguities: all resolved or promoted to [ARCHITECTURE_DECISION]

User may override round count: "set iterations to N" → N rounds (minimum 1).

Iron/Open Requirement Taxonomy

Phase 1 produces TWO requirement files instead of a single requirements.json:

performance (REQ-P-NNN) requirements, authority = 1, binding for ALL downstream phases.

Phase 2 must investigate and resolve into architecture decisions.

Per-item field schemas for both files are owned by the spec-analyst agent prompt.

This policy owns only the classification and verification rules below.

Classification Rules

Iron/Open Classification Verification

After iron/open files are produced, verify:

FAIL conditions (must fix before exit):

WARN conditions (log and proceed):

Port Naming Conventions (io_definition.json)

Self-Verification Format

Save to reviews/phase-1-research/research-review.md:

# Phase 1 Review: Research Completeness
- Date: YYYY-MM-DD
- Reviewer: spec-analyst
- Upper Spec: specs/
- Verdict: PASS | FAIL

## Feature Coverage Checklist
| Spec Section | Requirement ID | Status |

## Findings
### [severity] Finding-N: ...

## Verdict
PASS | FAIL: [reason]

Spec Feature Completeness Audit (MANDATORY — Step 7.5c / team T12b-T12c)

The extractor MUST NOT grade its own completeness: an extraction blind spot also biases

the self-counted denominator (5-of-10 modes self-reports 5/5). The completeness verdict

comes from an independent census + mechanical diff:

  1. Independent feature census (clean context): spawn spec-analyst in FEATURE CENSUS

MODE. It reads ONLY original spec sources (specs/**, docs/phase-1-research/goal.md,

domain knowledge files) and MUST NOT read iron-requirements.json, open-requirements.json,

or any prior Phase 1 analysis. Enumerate EVERY spec-defined item — expand mode/format

tables item-by-item (e.g., each intra prediction mode, encoding mode, color format,

block size is one entry). Write docs/phase-1-research/spec-feature-inventory.json:

```json

{ "features": [ { "feature_id": "FEAT-001", "name": "...", "kind": "mode|format|algorithm|capability|constraint",

"source": { "document": "...", "section": "..." } } ] }

```

  1. Mechanical diff (different agent): spawn rtl-architect to map every FEAT-* to

REQ/OPEN IDs in iron ∪ open requirements. Per-feature status:

  1. Gap escalation: any MISSING feature → MUST ask user via AskUserQuestion:

[quality metric]. Approve omission?"

  1. Documentation: save docs/phase-1-research/feature-coverage.md:

```

| Feature | Spec Source | REQ/OPEN IDs | Status |

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

| Intra mode DC | §8.3.1 | REQ-F-012 | EXTRACTED |

| Intra mode planar | §8.3.2 | — (ADR-007) | EXCLUDED_BY_SCOPE |

```

plus totals: features / extracted / excluded_by_scope / missing.

  1. Gate: PASS iff missing == 0 (every feature EXTRACTED or EXCLUDED_BY_SCOPE).

FAIL blocks Phase 1 completion (feature-coverage-audited completion criterion).

  1. Downstream contract: spec-feature-inventory.json is the authoritative spec-item

denominator for later phases; EXCLUDED_BY_SCOPE records let downstream gates

distinguish user-approved scope reduction from silent extraction loss.

  1. Reference model cross-check (Phase 2+, when refC or an external golden exists):

compare the inventory against model implementation — "enum declared but function not

implemented" → COVERAGE_GAP warning.

Escalation & Stop Conditions

Ambiguity Score Protocol

Every Phase 1 completion MUST include an ambiguity assessment:

  1. spec-analyst produces Ambiguity_Assessment with per-axis scores
  2. Ambiguity Gate enforced by both orchestrators:
  1. Score is recorded in docs/phase-1-research/ambiguity-assessment.md
  2. Phase 2 entry reads this score — if > 0.3, phase 2 reviewers prioritize clarifying those axes

This is inspired by Ouroboros's AmbiguityScorer pattern:

Scoring: ambiguity_score = weighted_average(goal, constraint, ac) — higher = worse

Adversarial Interpretation Gate (Steps 7.6-7.9)

After ambiguity gate (Step 7.5a) and iron/open verification (Step 7.5b) pass,

run adversarial reinterpretation to surface ambiguities the initial analysis missed.

Protocol (summary — Task-level orchestration owned by p1-research-orchestrator Steps 7.6-7.9)

  1. 7.6 Challenge: adversarial spec-analyst (clean context) challenges iron-requirements.json

by source.section (not REQ ID); types: REINTERPRETATION (alternative reading) and

OMISSION (zero-REQ spec feature vs spec-feature-inventory.json →

original_interpretation="NOT_EXTRACTED", severity HIGH). Output

.rat/scratch/stability/phase-1/challenge-report.json

(schema: skills/p1-spec-research/templates/challenge-report-schema.json; max 30 per pass).

  1. 7.7 User resolution: HIGH individually via AskUserQuestion; MEDIUM batched if >10;

LOW auto-documented. User may mark challenges NOT_GENUINE.

  1. 7.8 Re-run: spec-analyst re-analyzes with accumulated clarifications → all 4 canonical

artifacts (iron/open requirements, io_definition, timing_constraints) + self-validation.

  1. 7.9 Gate check: compute Gate Metric below + save reviews/phase-1-research/stability-report.md.

Gate Metric

genuine = (HIGH + MEDIUM challenges) - NOT_GENUINE
resolved = RESOLVED + DOCUMENTED
resolution_ratio = resolved / genuine   (if genuine == 0: pass)
gate_pass = (all HIGH resolved) AND (resolution_ratio ≥ 0.8)

Gate failure: list unresolved HIGH challenges, loop back to Step 7.7 (max 1 re-loop).

After 2nd failure: escalate to user with full divergence report.

Dual Gate Arbitration (Ambiguity Score + Adversarial Gate)

| Ambiguity Score | Adversarial Gate | Decision |

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

| PASS (≤0.3) | PASS | Proceed |

| PASS (≤0.3) | FAIL | BLOCK |

| CONDITIONAL (0.3-0.5) | PASS | Proceed with WARNING |

| CONDITIONAL (0.3-0.5) | FAIL | BLOCK |

| BLOCK (>0.5) | PASS | BLOCK |

| BLOCK (>0.5) | FAIL | BLOCK |

Rule: Either gate can block; neither can unblock the other.

Severity Classification

| Severity | Criterion | Example |

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

| HIGH | Missing item (OMISSION) | Spec defines 10 encoding modes, only 5 extracted |

| HIGH | Different RTL behavior | Signed vs unsigned arithmetic |

| HIGH | Different interface | 32-bit vs 64-bit datapath |

| MEDIUM | Different parameterization | Fixed depth vs configurable |

| MEDIUM | Different timing | 3-stage vs 4-stage pipeline |

| LOW | Cosmetic only | Block naming differences |

Boundary rule: alternative interpretation would cause different RTL module → HIGH.

Same module but different parameters → MEDIUM. Same module, same parameters → LOW.

Pathological Patterns

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.