architecture-review
Use only within an active harness lifecycle when pre-stories feasibility review, a pipeline batch drift check, or the SHIP as-built review is current. Do not invoke for ordinary implementation, code review, or general architecture questions.
- License 许可
- Apache-2.0
- 最近更新
- 2026-11-14
- Stars
- ★ 7
- Forks
- 2
01 前言 Front Matter
- name
- architecture-review
- model
- opus
- phase
- decide
- requires
- [ "verify-claims" ]
- standalone
- true
- description
- Use only within an active harness lifecycle when pre-stories feasibility review, a pipeline batch drift check, or the SHIP as-built review is current. Do not invoke for ordinary implementation, code review, or general architecture questions.
- enforcement
- gating
- implicit_invocation
- required
02 资源文件 1
03 SKILL.md 正文
Purpose
Reviews the design through an architectural lens BEFORE stories are written and before any code. Catches technical infeasibility, hidden complexity, architectural drift, and domain violations early — when they're cheap to fix. This is where the how is resolved (so the PRD stays product-only) and captured as APPROVED ADRs.
Read the Scope boundary: from .docs/track/<slug>.md as binding; preserve the confirmed narrow/comprehensive breadth outcome; do not permit a materially broader expansion beyond it unless the operator confirms before it enters the artifact.
Run after /prd (product track) or /explore (technical track), and BEFORE /stories (adr-2026-06-29-architecture-before-stories-convergent-kickback).
The review's input is the PRD's functional requirements (product) or the explore output + technical
intent (technical) — stories and the plan do not exist yet at this point.
Also invocable at pipeline batch boundaries to verify implementation stays architecturally sound.
Correctness gate: an ADR is the most load-bearing artifact in the flow — everything downstream
builds on it. Apply the /verify-claims protocol before writing any APPROVED ADR: state each
technical claim with a grounded confidence % and its basis (verified vs inferred), surface every
assumption the design rests on, and HARD-BLOCK (operator approval interactive, HALT if autonomous)
on any unconfirmed assumption that would change the decision. Do not record a decision as APPROVED
while it rests on an unconfirmed load-bearing assumption.
Provider-native delegation
When this review delegates exploration or analysis, use the selected host's available subagent facility. Preserve the scope limits, evidence, ADR output, and veto/gate behavior regardless of host. Claude delegation: Claude uses the Agent tool; any Claude model choice is confined to that facility. A Codex-selected run uses its available subagent facility and configured Codex provider policy, without translating Claude model names.
Full vs amendment mode (convergence — adr-2026-06-29-architecture-before-stories-convergent-kickback)
- Full pass — the pre-stories run above: full feasibility/alignment, produces APPROVED ADRs.
- Amendment pass — when a later step (
storiesorconflict-check) re-opens architecture with a specific structural gap, address ONLY that gap; do not re-derive the design from scratch. This is what makes the loop converge instead of oscillate.
Only a genuine structural gap (a missing component/seam/boundary) may re-open architecture — never a story-phrasing nit or a coverage gap. The conductor caps re-openings and HALTs for a human on excess.
Accepted-artifact amendment: When this review concludes that an accepted DECIDE assertion is falsified, amend that non-story artifact during the DECIDE pass; do not instruct a later phase to make the change. If it is already on the base branch, add this note beside the original assertion:
> **Amended YYYY-MM-DD by #NNN:** <what the assertion now says, and why>
For every non-story artifact, the note is additive only when the artifact is already on the base
branch: add the note; the original assertion remains preserved; never rewrite or delete it, and
create no separate record. Story artifacts under .docs/stories/ are the exception: replace
superseded assertions in place without an amendment record. The amended artifact is then part of
the spec-branch baseline before BUILD begins.
An accepted DECIDE artifact absent from the base branch is a draft: revise it in place, remove superseded text, and add no amendment note or revision log.
Lightweight Mode (Medium Complexity Tier)
When the feature is classified as Medium by /conduct's complexity assessment, run only:
- Section 2: Technical Feasibility — full check
- Section 4: Architectural Alignment — full check
Skip:
- Section 3 (Complexity Assessment) — already done by
/conduct - Section 5 (Domain Integrity Pre-Check) — handled by TDD domain reviewer per-cycle
- Section 7 (mandatory ADR creation) — only create ADRs for genuinely novel architectural decisions
Explore agent limits for Medium tier: Max 2 agents with non-overlapping scopes:
- Agent 1: the PRD/spec (
.docs/specs/) — its FRs are the review input (stories/plan don't exist yet) - Agent 2: relevant source files for the feature area
- Do NOT dispatch agents solely to read
.memory/; this active workflow reads relevant entries directly when it needs them - Do NOT dispatch a third agent for decisions/ADRs (read
.docs/decisions/directly if needed)
For Small features, the DECIDE-time architecture review is skipped by /conduct. This does
not skip the §12 as-built compliance gate at SHIP.
For Large features, run the full review (all sections).
Practices
1. Load Architecture Context
Read in order of authority (higher overrides lower):
.docs/decisions/— ADRs are the authoritative architecture reference.docs/architecture/— C4 diagrams (system context, containers, components, ERD, sequences)CLAUDE.md— Project conventions and constraints.memory/decisions/— Prior architectural decisions- Existing code structure —
config/routes.rb, model relationships, directory layout
Approved decisions first; convention over precedent: Applicable APPROVED decisions override observed patterns. Existing code that conflicts with a documented decision is tech debt and must be rejected as precedent. Never downgrade a finding because "the codebase already does it this way."
Focused local pattern basis (when applicable): When a concrete local precedent matters to a feature concern that approved decisions do not already settle, record it in the review's ordinary prose. Keep the basis bounded to that concern and include:
- the precedent's role;
- the material semantic traits the new work should preserve;
- why that precedent applies to this concern;
- the variation that remains allowed; and
- path and stable-symbol hints that help BUILD rediscover an equivalent on its current HEAD.
Hints are rediscovery seeds, not authoring-time snapshots: never anchor this basis to line numbers
or require the original exemplar to remain at a fixed coordinate. BUILD must resolve the traits
against its checkout at implementation time. A selected pattern does not establish a project-wide
convention or configuration rule, and it does not replace the separate exact-replication
Pattern-source / Rename-map contract.
When no suitable precedent can be verified, record that verified no-fit in the ordinary review prose rather than inventing an exemplar. When the in-scope approach requires departing from an otherwise applicable pattern, record the operator-authorized bounded departure, its reason, and its boundary before handing the approach to BUILD. Do not add this optional basis when no local precedent affects the approach.
2. Technical Feasibility
For each PRD functional requirement (product track) or each part of the explore output's technical intent (technical track), assess the proposed design:
| Check | Question | Flag If |
|---|---|---|
| Stack compatibility | Can this be built with the current stack? | Requires new gems/packages, external services, or infrastructure changes |
| Prerequisites | What must exist before this can start? | Migrations, config changes, external account setup needed |
| Integration surface | What other systems/modules does this touch? | Crosses 3+ module boundaries or hits external APIs |
| Data implications | Schema changes, migrations, data backfills? | Large table migrations, breaking schema changes, data loss risk |
| Performance risk | Will this create N+1s, unbounded queries, heavy computation? | List endpoints without pagination, missing indexes on query paths |
| Worktree isolation | Can this run in parallel worktrees without conflicts? | New Docker services, ports, databases, or shared state without .env boundary pattern |
3. Complexity Assessment
| Level | Criteria | Action |
|---|---|---|
| Low | 1 model, 1 endpoint, no external deps | Proceed |
| Medium | 2–3 models, cross-model logic, background jobs | Proceed with boundary attention |
| High | 4+ models, external APIs, complex state machines | Consider splitting |
| Spike | Unknown tech, unclear requirements, novel patterns | Time-box spike before planning |
3a. Split a Large Design Before Stories
Estimate the plan's task count here, from the approved design, before /stories runs. When the
estimate approaches the plan's scope ceiling (20+ tasks; /plan §6 refuses 30+ at land without a
scope exception), propose splitting the design into sequential specs and get the operator's
decision now. Splitting after stories and plan exist forces a full restructuring pass: stories,
plan, coverage, coherence mapping, and waivers all have to be re-cut.
A proposed split states:
- The specs, in order. The first ships the foundation; each later spec is blocked by the one before it, and every spec inherits the original intake's blocking edges.
- A default-off flag that keeps the partially delivered behavior dark. Only the last spec turns it on, so no intermediate merge changes production behavior.
- Reachability per spec. Each spec ships only primitives that have a production caller inside that same spec; otherwise the as-built review (§12) blocks them as unreachable. Move a constructor, writer, or helper to the spec that first calls it.
- Where deferred outcomes live. Outcomes delivered by a later spec are waived in the coherence
mapping, each naming the later spec as its home. Leave the counterpart empty; do not invent a
placeholder id such as
none. The draft stories and plan slices for later specs travel with their follow-up intakes.
The ADR records the whole design once, with the split and the flag among its decisions; each spec
then plans only its own slice. If the operator declines the split, record that decision. A plan
above the ceiling then needs a **Scope-exception:** with that decision as its rationale.
4. Architectural Alignment
Check the proposed design against documented architecture:
Domain boundaries:
- Does the design respect existing module/domain boundaries?
- Does it introduce coupling between domains that should be independent?
- Are database queries staying within their domain, or reaching across to other domains' tables?
Pattern consistency:
- Does the implementation approach match existing patterns (service objects, concerns, etc.)?
- If it establishes a new structural pattern, is there an ADR justifying the departure?
State management:
- Can invalid states be represented in the proposed data model?
- Are state transitions explicit (enum/state machine) or implicit (boolean flags)?
- Does the proposal use
is_*boolean flags where an enum would prevent invalid combinations?
Diagram accuracy:
- Do architecture diagrams in
.docs/architecture/reflect the current architecture? - If new containers, services, or external integrations have been added, are diagrams updated?
- Reference diagrams when assessing domain boundaries and coupling.
Worktree isolation:
- Does the new infrastructure use the
.env/.env.localboundary pattern? - Are new services added to shared infrastructure (Docker) or per-worktree?
- If new ports or databases are introduced, are they parameterized via environment variables?
- Would two worktrees running simultaneously conflict on any resource (port, DB name, file path, queue name)?
Security boundaries:
- Are new endpoints authenticated and authorized?
- Does the data model expose sensitive fields that should be filtered?
- Are there new user inputs that need validation at the boundary?
Production DI defaults:
- Verify that production dependency injection defaults use persistent stores (PostgreSQL, Redis, filesystem) — not in-memory implementations
- Flag any
InMemory*,Fake*, orStub*class registered as a production default - BLOCKED if production DI defaults use in-memory stores for stateful data — this means data loss on restart and test/prod divergence when acceptance tests override DI
5. Domain Integrity Pre-Check
Before stories and the plan are written, check the proposed design for domain modeling issues:
| Principle | Check | Veto If |
|---|---|---|
| No primitive obsession | Design uses domain types, not raw strings/ints | IDs, statuses, money, or email stored as primitives |
| Parse, don't validate | Validation at construction, trusted types throughout | Design validates same field in multiple places |
| Invalid states unrepresentable | Type system prevents impossible combinations | Booleans where enums should exist, nullable fields that must be present |
| Semantic types | Types answer "what IS this?" not "what is this LIKE?" | NonEmptyString instead of UserName |
| Exhaustive matching | No catch-all defaults for domain states | else / default on status/type switches |
6. Risk Register
| Risk | Type | Likelihood | Impact | Mitigation |
|---|---|---|---|---|
| Concurrent moves corrupt positions | Data | Medium | High | Row-level locking in transaction |
Risk types: Technical, Integration, Data, Performance, Security, Knowledge
7. ADR Creation — Structural Prerequisite and Decision Categories
A new ADR is warranted only for a real structural decision. Structural change is a necessary prerequisite: decision categories never independently require an ADR. First determine whether the proposal establishes or revises one of these durable architectural shapes:
- a system boundary, including a bounded context or deployment boundary;
- component or service decomposition, including merging services or assigning cross-module ownership;
- an integration pattern, including an external API seam, anti-corruption layer, or asynchronous callback boundary;
- state or data architecture, including a persistence model, event-store boundary, or durable state-transition design; or
- foundational technology, including a runtime, framework, database, messaging, queuing, or caching platform.
Use the categories only after that structural prerequisite is met, to make the decision explicit and reviewable. Importance, breadth, workflow policy, prompt wording, and ordinary implementation detail are not sufficient ADR triggers. A small change may still warrant an ADR when it makes one of the structural decisions above; a broad or important change does not when it does not.
Before drafting, read .docs/decisions/ for an APPROVED ADR that already governs the structural
decision. Reuse an existing governing ADR rather than duplicate it. Cite and apply it when it
covers the proposal; draft a new ADR only for an uncovered structural decision, or supersede the
existing ADR when the structural decision itself changes.
ADR format: Use templates/adr.md.template (relative to this skill's own directory). Name each ADR
.docs/decisions/adr-YYYY-MM-DD-<kebab-slug>.md — date plus a short descriptive slug — and title it
# ADR: <title> (the heading carries no number). Never use a sequential number, in the
filename or the heading:
- ❌ WRONG:
adr-0001-ci-fix.mdwith heading# ADR-0001: … - ✅ RIGHT:
adr-2026-07-20-ci-fix.mdwith heading# ADR: …
Sequential numbers collide when parallel worktrees each grab "the next number"; the date+slug never collides and IS the ADR's identifier — cite the filename stem (never a number) when superseding or referencing one. If two ADRs land on the same date, the slug disambiguates. This applies to newly created ADRs only — existing numbered ADRs keep their names (append-only). (A deterministic gate to reject number-named ADRs is tracked in intake #705.) ADRs are append-only — supersede, don't delete. Every claim about external dependency behavior must cite specific evidence (documentation, tested behavior, or source code).
The template's ## Assumptions ledger table is required in every new ADR. This requirement is
enforced at land and by the architecture_review gate. For each load-bearing assumption whose
Basis is not verified, record the approval exactly as APPROVED by operator YYYY-MM-DD.
Lightweight mode (Medium tier): Apply the same structural prerequisite and reuse check. Do not skip an ADR merely because the feature is medium-sized, but do not create one merely because a category label, feature size, or importance is present.
GATE: If a proposed change makes an uncovered structural decision above, architecture-review MUST create an ADR before implementation proceeds. An architecture review that creates or omits an ADR without first applying the structural prerequisite and governing-ADR reuse check is incomplete.
7b. ADR Approval Lifecycle
ADRs follow a three-phase lifecycle. No ADR becomes authoritative without human approval.
Terminal ADR declarations use only Status: APPROVED or Status: SUPERSEDED by <adr-filename-stem>.
Phase 1: DRAFT
- Architecture-review creates the ADR with
Status: DRAFTin the frontmatter - DRAFT ADRs are written to
.docs/decisions/asadr-YYYY-MM-DD-<kebab-slug>.md(see §7) - DRAFT ADRs cannot be cited as justification in
build_review, as-built review, or implementation decisions — they are proposals, not decisions
Phase 2: REVIEW
- All DRAFT ADRs created during architecture-review are presented to the user for approval
via
review_artifacts(clear screen, one at a time) - When an ADR contains a Mermaid diagram and a
mermaid_rendereris configured (~/.ai-conductor/config.yml),review_artifactsrenders it to a visual so the user approves what they can see; with no renderer it falls back to the raw Markdown (never blocks) - The user approves, rejects (launches interactive Claude to revise), or requests changes
- On approval, status is updated to
Status: APPROVEDand the ADR becomes authoritative - On rejection, the ADR is revised in-place and re-presented until approved
Phase 3: AUTHORITATIVE
- Only
Status: APPROVEDADRs are binding on downstream work build_review, the as-built review, and/finishmay cite APPROVED ADRs- If a subsequent feature conflicts with an APPROVED ADR, the conflict must be resolved by
either superseding the ADR (new ADR with
Supersedes: <old>) or changing the implementation - Superseded ADRs get
Status: SUPERSEDEDand aSuperseded by:reference
HARD GATE: No feature proceeds past architecture-review with DRAFT ADRs. All ADRs created
during the review must reach APPROVED status before /stories can begin.
8. Output
Write the review to .docs/decisions/architecture-review-YYYY-MM-DD-<feature>.md:
# Architecture Review: [Feature Name]
**Date:** YYYY-MM-DD
**Inputs reviewed:** [PRD functional requirements, or explore output for the technical track]
**Verdict:** APPROVED | APPROVED WITH CONDITIONS | BLOCKED
## Feasibility
## Complexity
## Alignment
## Domain Integrity
## Wiring Surface (required for Medium/Large tier — see below; omit for Small)
## Risks
## ADRs Created
## Conditions (if APPROVED WITH CONDITIONS)
## Blocking Issues (if BLOCKED)
Wiring Surface (design-time, Medium/Large tier only): For each new production surface
the feature introduces (exported function/module, hook script, config key, emitted event,
scheduled job, CLI subcommand, etc.), state at design time where/how it will be called from
in production — e.g. "handled by the existing POST /orders route," "registered in the
CLI's command table," "consumed by the existing event subscriber in src/x.ts." This is a design-time commitment, not a code citation — no file:line is
required yet since the code doesn't exist. It informs the review's feasibility and overlap
analysis; it is not a per-task plan contract.
This is DESIGN-TIME ONLY. It does not affect, duplicate, or substitute for the §12
As-Built Compliance Gate's production reachability sweep, which independently verifies the
shipped code against real file:line callers after implementation. Leave §12 untouched —
the two checks run at different phases against different evidence (a stated intent here vs.
an observed caller there).
Not required for Small tier features (the DECIDE-time review is skipped for Small per the Lightweight Mode section above; §12 still runs at SHIP).
Early overlap scan (Medium/Large tier): Before /plan runs, run ai-conductor overlap-scan --files <Wiring Surface candidate paths> over the paths named in ## Wiring Surface above.
Surface the rendered report to the author alongside the review output. This is advisory
only — it never blocks the verdict or the review — it exists to flag unmerged dependent
work touching the same files before /plan locks in a task breakdown that could collide
with it.
9. Verdict Enforcement
APPROVED — Proceed to /stories.
APPROVED WITH CONDITIONS — Proceed; conditions tracked in the plan. build_review and as-built review check conditions. Unmet conditions at /finish are blocking.
BLOCKED — Pipeline HALTS. Present to the user: what is violated, resolution options with trade-offs, and which ADRs are in conflict. The user must explicitly approve a resolution. Do not auto-resolve. Capture the resolution as a new ADR only when resolving it makes or changes a structural decision; resolve non-structural blockers without an ADR. Re-run the review.
10. Recurring Review (Pipeline Batch Boundaries)
At pipeline batch boundaries, perform a lightweight architecture check:
- Has the implementation drifted from the approved plan?
- Have new structural patterns been introduced without an ADR?
- Are domain boundaries being respected in the actual code?
- Are architecture diagrams still accurate after this batch's changes?
- Escalation: non-blocking findings that appear in 2+ consecutive reviews become blocking
If drift is detected at a batch boundary:
- For drift that makes or changes a structural decision, write a new ADR documenting what changed and why (or that it was unintentional); otherwise record the drift without creating an ADR
- If the drift violates a prior ADR: BLOCK — human must decide whether to update the ADR or revert the code
11. Signal Review Requirement
Before exiting, decide whether the conductor should prompt the user to review the architecture report and ADRs. Review mode for this step is conditional — auto-approved unless you write a marker file.
Write .pipeline/review-required-architecture_review (any content; the file's
existence is the signal) if ANY of the following is true:
- Verdict is APPROVED WITH CONDITIONS or BLOCKED
- Any new ADR was drafted (DRAFT ADRs must be approved before they become authoritative)
- Any existing ADR was superseded
- Any risk with Impact=High was entered in the Risk Register
- Batch-boundary review found drift from the approved plan
If the verdict is a clean APPROVED with zero new/superseded ADRs and no High-impact risks, do NOT write the marker — the conductor auto-approves and moves to the next step.
# Example: write the marker when review flagged issues
mkdir -p .pipeline
echo "verdict: APPROVED_WITH_CONDITIONS, new ADRs: 2" > .pipeline/review-required-architecture_review
12. As-Built Compliance Gate (--as-built mode)
Invoked at SHIP as /architecture-review --as-built. It runs for every feature, including
Small features and features whose DECIDE-time review was skipped. It does no new design or
feasibility/complexity assessment.
Managed as-built review. When the engine dispatches --as-built, it supplies the bounded,
versioned input projection, check policy, and terminal native structured-result shape. Treat those
as the complete machine contract: judge the supplied evidence and return one terminal structured
verdict that conforms to the supplied shape. Do not recreate engine input collection, substitute a
Markdown report for that verdict, write a managed verdict artifact, alter ADRs or decisions, or
choose a gate route. The engine validates, persists, renders, and routes the result.
Standalone as-built review. When a human invokes --as-built outside the managed engine step,
present a human-readable advisory judgment from the available architecture, source, and history
evidence. It is not current managed gate evidence. Do not write managed verdict artifacts,
operator-decision stores, or routing state; the human or engine owns any follow-up action.
Per-check policy: Read the supplied AS-BUILT CHECK POLICY before reviewing. Apply every
check marked on, do not infer obligations from a check marked off, and record each off check
with its supplied reason. By default, reachability and planGap apply at every tier;
adrCompliance applies only when APPROVED ADRs exist; and diagramDrift applies only when
diagrams exist. Operator configuration can disable any check for a tier. Missing ADRs or diagrams
therefore disable only their respective check — never this SHIP gate.
Relationship to BUILD-time judgement: BUILD no longer judges reachability (ADR); this SHIP sweep is unchanged and never relies on BUILD proof as authority.
Scope (only this):
- For
adrCompliance, load only the APPROVED ADRs (.docs/decisions/,Status: APPROVED). DRAFT/SUPERSEDED ADRs are not authoritative and are not gated against (per §7b). FordiagramDrift, compare the shipped code with the approved architecture diagrams (.docs/architecture/). - For each enabled check, compare the shipped source with its governing evidence: new structural patterns without an ADR, domain-boundary violations, or diagram drift are relevant only when the corresponding check is on.
- Production reachability sweep (green-but-unwired guard). For each primitive this
feature's diff introduces or materially changes — exported functions/modules, hook scripts,
config keys, emitted events, ADR-promised log lines — trace ONE invocation path from a real
production entry point (a public API or route, CLI command dispatch, a job or worker, an event
consumer, a framework hook, or the project's equivalent) and cite the caller as
file:line. Test files, fixtures, and the primitive's own module do not count as callers, except for the narrow same-file composition case below.- Narrow same-file composition exception. Independently verify the complete root-to-caller-to-export chain in the current shipped source: a configured production
entry point reaches the defining module through non-test edges; an actual production caller in
that module references the exact changed export. Derive that caller from current source rather
than from a plan declaration. Cite the root/module chain and caller-to-export reference as
file:line. A same-file exception passes only with an exact caller-to-export reference and a production-entry-point root chain. An own-module caller alone, module reachability alone, or a name/text match alone does not count. This exception never permits a dead helper, a test-only path, a shadowed binding, or an unavailable/ambiguous reachability analysis to pass. - Current-source authority. A persisted BUILD
same-file-compositionproof is corroborating context only, never authority for this SHIP review. Re-resolve the root-to-caller-to-export chain against current shipped source at the reviewed HEAD. A stale BUILD proof does not count or pass the exception; neither does a missing current-source hop or changed caller/export. - No production caller exists → this is a BLOCKED violation ("unreachable rung"), same
severity as an ADR violation: shipped-tested-green code nothing invokes is not shipped
behavior. Name the primitive and what was searched.
In the structured verdict, record it as a
reachabilityentry with an emptycallerChain([]); the engine admits an empty chain only under aBLOCKEDverdict. Classify it per the table under Verdict meanings. Never cite this section as the governing reference. - Statically reachable but not yet observed running (e.g. a new log line no production log
shows yet) → record it under Drift Notes as
UNEXERCISED: <primitive> — signature: <the greppable line/event that will prove it live>. Not blocking; the signature tells a later observer exactly what proves the behavior live in production.
- Narrow same-file composition exception. Independently verify the complete root-to-caller-to-export chain in the current shipped source: a configured production
entry point reaches the defining module through non-test edges; an actual production caller in
that module references the exact changed export. Derive that caller from current source rather
than from a plan declaration. Cite the root/module chain and caller-to-export reference as
- Plan-gap check. When the shipped code faithfully implements the approved design but that
design is itself the limit that prevents an outcome the sealed story criteria require, issue
PLAN_GAP. Record the affected outcome and whether it was delivered; do not send unplanned work back to BUILD.- Story criteria belong to
/prd-audit./prd-audit, in the same validation group, grades every story criterion and owns criterion-level findings. IssuePLAN_GAPhere only when an APPROVED ADR or approved diagram is the limit; a shortfall that names only a story or a desired outcome is not an as-built finding. Never record a story, criterion, or desired outcome as a BLOCKED finding's governing reference. - Outcome authority: the sealed story criteria. The approved, sealed acceptance criteria under
.docs/stories/are this feature's acceptance contract and the only authority for what outcome was stated..docs/intake/is an idea capture that is superseded once stories are approved; never grade the shipped code against it. Where intake and the stories disagree, the stories win: a deliberate narrowing recorded in an amended, resealed story is the decision, not a plan gap.
- Story criteria belong to
- Exhaustive sweep per judged decision (one pass, every site). For each ADR decision, diagram
element, or reachability primitive you judge, enumerate EVERY violating site in the reviewed diff
in this verdict — one BLOCKED finding per site, or one finding whose summary lists every site as
file:line. Never stop at the first violation of a decision: a decision with nine violating sites reported one per lap costs nine laps. Brief each delegated subagent to return all sites, not an example.- Re-review laps. When the supplied context shows prior as-built findings, judge (a) whether each prior finding is resolved, and (b) the code changed since the judged lap. Do not raise a first-time finding against code unchanged since a prior lap unless that lap could not have seen it (for example, the check was off or the evidence did not exist then); say why in the finding.
- Delegated evidence gathering. The window that matters is the reviewer's own: it holds the
verdict. Keep it for judgement and push the reading into subagents through the host's facility
(Claude Code: the Agent tool; Codex:
collaboration.spawn_agent/collaboration.wait_agent), the same way §"Provider-native delegation" already allows:- One subagent per enabled check cluster: the APPROVED-ADR set (one per ADR when several apply), the diagram set, the changed-primitive reachability sweep (split by module when the diff is wide), and the plan-gap check against the sealed stories.
- Each subagent returns a digest, not a transcript: the governing clause quoted verbatim with
its path, the shipped code quoted verbatim with
file:line, the caller chain for reachability, and a candidate disposition with confidence. Cap a digest at roughly two thousand words; anything larger is the subagent forwarding its reads instead of doing them. - The reviewer grades from the digests, re-reads only the lines it needs to settle a disagreement, and owns every verdict. A subagent never writes the report, the verdict, or an ADR.
- Model tiers. The reviewer stays on this skill's pinned tier; do not trade it down to pay for
fan-out. Reading and extraction subagents run on the host's mid tier
(Claude Code
model="sonnet"; Codex uses its configured default). Step a subagent up to the reviewer's tier only when its task is adjudication — an adversarial re-check of one candidate BLOCKED finding before it is recorded. - Subagents inherit the context budget above. A subagent that cannot finish within it reports what it covered and what it did not; the reviewer records the uncovered surface as unverified rather than silently passing it.
- Validator discipline (MUST — copy verbatim into every subagent brief). Both rules below are
operator rules on the reviewer and on every subagent it delegates to. Include them verbatim in
each subagent brief; a subagent that never received them is not bound by them.
- Read-only evidence. The validator and every subagent it delegates to MUST NOT execute
tests, typecheck, lint, build, the integrity script, or any command that runs project code —
including
vitest,npm test/npm run,npx,node -eprobes over project modules, and bash test scripts. Evidence is what the source and committed artifacts say:file:line, test names read from test source, source-control evidence, andScope:trailers. Reachability is proved by citing the caller chain in the source, never by running it. If a check cannot be judged without running code, grade it from the evidence available and say so in the rationale; never run it. Nothing is written, staged, or committed. - Never yield with delegated work outstanding. The validator MUST NOT end its turn while any subagent it spawned has not returned. Collect every digest before grading; if a subagent is slow, wait for it — do not summarize partial results and do not report progress in place of a verdict.
- Read-only evidence. The validator and every subagent it delegates to MUST NOT execute
tests, typecheck, lint, build, the integrity script, or any command that runs project code —
including
- Do NOT re-run §2/§3/§5 (feasibility/complexity/domain pre-checks) — those belong to the DECIDE pass. This is a code-vs-approved-design pattern match plus the reachability sweep above, deliberately cheap.
Verdict meanings
- APPROVED — shipped code matches the approved architecture. Proceed to finish.
- APPROVED WITH DRIFT NOTES — minor, non-violating drift (e.g. a diagram is now slightly stale, a pattern was extended consistently). Record the drift; proceed. Note it for a follow-up ADR only when it makes or changes a structural decision; otherwise no ADR is needed, and it does not block.
- PLAN_GAP — the shipped code faithfully implements the approved design, but the design is the limit preventing an outcome the sealed story criteria require. Record whether the outcome was delivered; an undelivered outcome HALTs for a human. Never turn this finding into unplanned BUILD work.
- BLOCKED — an enabled check found an architectural violation, such as an APPROVED-ADR
violation or an unreachable production rung. Each finding's class decides who resolves it:
REMEDIABLEfindings route back to BUILD as bounded repairs against their cited plan task or ADR decision;DESIGNfindings HALT for a human, who must fix the code to comply, or for an ADR violation supersede the ADR with a new, human-APPROVED ADR (Supersedes: <old>, old →Status: SUPERSEDED). Never silently downgrade an APPROVED ADR or auto-resolve the violation. After resolution, re-run the as-built gate.
Classify each BLOCKED finding — REMEDIABLE (the approved design already requires bounded BUILD
work) or DESIGN (a human architectural decision is required) — with its typed governing reference:
| Finding | Class | Governing reference |
|---|---|---|
| Unreachable rung; a plan task introduced the primitive | REMEDIABLE |
task <id> of that plan task |
| Unreachable rung; no plan task or approved entry point covers it | DESIGN |
the APPROVED ADR decision it conflicts with |
| Code diverges from an APPROVED ADR decision the plan already requires | REMEDIABLE |
<adr-stem> D<n> |
| Complying needs a changed or new architectural decision | DESIGN |
<adr-stem> D<n> |
| Story criterion or desired outcome unmet | none | out of scope; /prd-audit owns it |
Write a plan-task reference as task <id> exactly, not plan task <id> or Task <id>.
Verification
- [ ] Every PRD functional requirement (product) or technical-intent item (technical) assessed for feasibility
- [ ] Complexity rated for the proposed design
- [ ] Alignment checked against .docs/decisions/ and CLAUDE.md
- [ ] Domain integrity pre-checked
- [ ] Risk register populated
- [ ] Medium/Large tier:
## Wiring Surfacesection present, naming where each new production surface will be called from — BLOCKS approval if missing (not required for Small; design-time only, does not affect §12 as-built reachability sweep) - [ ] ADR created only for each uncovered structural decision; existing governing ADRs cited and reused
- [ ] Review written to .docs/decisions/
- [ ] Verdict issued (APPROVED / CONDITIONS / BLOCKED)
- [ ] Architecture diagrams reviewed for accuracy against current implementation
- [ ] BLOCKED verdicts halt pipeline and require human resolution
- [ ]
.pipeline/review-required-architecture_reviewmarker written IF verdict ≠ clean APPROVED, or any ADR was drafted/superseded, or any High-impact risk was registered (skip only on truly clean APPROVED) - [ ] As-built mode: BLOCKED on any enabled APPROVED-ADR violation; resolved by code fix or human-approved superseding ADR (never silent downgrade)
04 同仓库更多 Skills
build-review-dependency-hygiene
Judge whether a feature diff adds unnecessary, insufficiently pinned, or license-incompatible dependencies.
writing-system-tests
Use BEFORE implementing any feature that has stories in .docs/stories/ — generates failing acceptance specs from acceptance criteria as the RED phase of TDD. Generates HTTP/request-level acceptance tests for headless/API projects, end-to-end UI tests for projects with a frontend, using the project's own test framework and directory conventions.
verify-claims
Use only when an active workflow is about to rely on a nontrivial factual claim or assumption for a spec, plan, ADR, finding, or code decision. Do not invoke for casual questions, status reports, restatements, or trivially verifiable mechanics.
tdd
Use when implementing any feature or bugfix. Five-step cycle: RED → DOMAIN → GREEN → DOMAIN → COMMIT. Enforces test-first development with domain integrity review at every phase boundary.
stories
Use only within active engineer/conduct DECIDE after architecture approval, when a committed `.docs/stories` acceptance artifact is required. Do not invoke for general user-story examples, requirements discussion, or direct implementation requests.
stack-land
Use when an operator needs to land reviewed manual changes on the correct closed child of a stacked feature. Operator-invoked only: inspect ownership, propose the safe child with evidence, and require confirmation before opening the landing.