buildanything 2.1.1 → 2.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude-plugin/marketplace.json +1 -1
- package/.claude-plugin/plugin.json +1 -1
- package/agents/a11y-architect.md +2 -2
- package/commands/build.md +166 -88
- package/package.json +1 -1
- package/protocols/ios-phase-branches.md +29 -29
- package/protocols/state-schema.json +23 -2
- package/protocols/state-schema.md +2 -0
- package/protocols/web-phase-branches.md +29 -39
- package/src/orchestrator/worktree-launcher.ts +20 -0
package/commands/build.md
CHANGED
|
@@ -24,6 +24,12 @@ Every Agent tool call MUST include a `subagent_type` field unless the dispatch i
|
|
|
24
24
|
Missing `subagent_type` on a non-INTERNAL dispatch is a HARD-GATE violation. The orchestrator rejects dispatches that don't name a specific agent. If you catch yourself typing `description: "..."` without a `subagent_type:` line alongside it, STOP and look up the right agent from the per-phase dispatch tables further down in this file.
|
|
25
25
|
</HARD-GATE>
|
|
26
26
|
|
|
27
|
+
<HARD-GATE>
|
|
28
|
+
MODEL ROUTING — DO NOT OVERRIDE.
|
|
29
|
+
|
|
30
|
+
NEVER pass a `model` parameter on Agent tool calls. Each agent `.md` file declares `model:` in its YAML frontmatter (opus, sonnet, or haiku). Claude Code reads the frontmatter and routes to the correct model automatically. Passing `model:` on the invocation overrides the frontmatter and breaks cost routing. The orchestrator's only job is to pass the correct `agent_type` — the plugin handles model selection.
|
|
31
|
+
</HARD-GATE>
|
|
32
|
+
|
|
27
33
|
<HARD-GATE>
|
|
28
34
|
ARTIFACT WRITER-OWNER RULE.
|
|
29
35
|
|
|
@@ -46,7 +52,6 @@ Live downstream docs (read across Phase 3+):
|
|
|
46
52
|
- `docs/plans/ux-architecture.md` — P3 writer (web)
|
|
47
53
|
- `docs/plans/ux-flow-validation.md` — design-ux-researcher writer (web, Step 3.3b)
|
|
48
54
|
- `docs/plans/inclusive-visuals-audit.md` — P3 writer (web)
|
|
49
|
-
- `docs/plans/a11y-design-review.md` — P3 writer, a11y-architect writer (web, Step 3.7)
|
|
50
55
|
- `docs/plans/page-specs/*.md` — P3 writer, design-ux-architect writer (web, Step 3.3 — per-screen wireframes + layout specs)
|
|
51
56
|
- `docs/plans/refs.json` — P2 writer, P3 writer (P3 extends after visual spec lands)
|
|
52
57
|
- `docs/plans/decisions.jsonl` — orchestrator-scribe ONLY via `scribe_decision` MCP tool (subagents return `deviation_row` objects; the orchestrator forwards each row through the MCP, which owns ID allocation and atomic append)
|
|
@@ -140,6 +145,41 @@ Increment after each agent returns (parallel dispatch of 6 agents = +6). Reset t
|
|
|
140
145
|
|
|
141
146
|
Phase 4 context pressure: With 20+ tasks, compact returns accumulate ~30-40K tokens in the orchestrator's context. The compaction checkpoint (dispatch_count >= 8) is the primary relief valve. If Phase 4 has more than 15 tasks, force a compaction checkpoint after every wave transition regardless of dispatch_count.
|
|
142
147
|
|
|
148
|
+
### Phase Boundary Eviction (Context Budget Protocol)
|
|
149
|
+
|
|
150
|
+
At every phase boundary (after gate approval, before starting the next phase):
|
|
151
|
+
|
|
152
|
+
1. **Write carry-forward summary.** Append to `.build-state.json.phase_summaries[]`:
|
|
153
|
+
```jsonc
|
|
154
|
+
{
|
|
155
|
+
"phase": <N>,
|
|
156
|
+
"completed_at": "<ISO timestamp>",
|
|
157
|
+
"artifacts": ["<paths of files this phase produced>"],
|
|
158
|
+
"decisions": "<1-2 sentences: key decisions made>",
|
|
159
|
+
"status": "<approved | approved_with_concerns | auto_approved>",
|
|
160
|
+
"carry_forward": "<1-2 sentences: user feedback or constraints that affect future phases>"
|
|
161
|
+
}
|
|
162
|
+
```
|
|
163
|
+
Budget: max 500 tokens for the entire entry. If you can't fit it, you're including too much.
|
|
164
|
+
|
|
165
|
+
2. **Save state.** Call `state_save`.
|
|
166
|
+
|
|
167
|
+
3. **Drop prior-phase context.** After saving, you do NOT need to retain in working memory:
|
|
168
|
+
- Agent dispatch prompts from the completed phase (already sent)
|
|
169
|
+
- Agent returns from the completed phase (already processed, summary in state)
|
|
170
|
+
- File contents read to compose prompts (still on disk, re-readable)
|
|
171
|
+
- Metric loop intermediate scores (final score in state)
|
|
172
|
+
- Gate presentation text (user already approved)
|
|
173
|
+
|
|
174
|
+
4. **Re-read for next phase.** Read `.build-state.json` fresh (contains `phase_summaries` — your structured memory of all prior phases). Then read only the input artifacts needed for the next phase:
|
|
175
|
+
- Entering Phase 3: `architecture.md`, `sprint-tasks.md`, `quality-targets.json`
|
|
176
|
+
- Entering Phase 4: `feature-delegation-plan.json`, current wave's feature briefs
|
|
177
|
+
- Entering Phase 5: `quality-targets.json`, feature list from state
|
|
178
|
+
- Entering Phase 6: Phase 5 findings paths from state, `decisions.jsonl`
|
|
179
|
+
- Entering Phase 7: LRR verdict from state
|
|
180
|
+
|
|
181
|
+
The `phase_summaries` array is your memory of prior phases. You do NOT need the raw conversation that produced them. If you need a specific fact from Phase 1 during Phase 5, read the artifact file — don't try to recall it.
|
|
182
|
+
|
|
143
183
|
**Cumulative-cost banner at phase boundaries:** When announcing a phase transition (e.g. "Phase N complete — proceeding to Phase N+1"), prefix the message with `[Cost so far: $X.XX • Y tokens]`. Source the values from the last-appended entry in `docs/plans/build-log.md`'s token-accounting lines (fields `cumulative_usd=...` plus the sum of `input_tokens=...` + `output_tokens=...`), written by `src/orchestrator/hooks/token-accounting.ts` (see module for exact schema). If the build-log has no token-accounting entries yet, omit the prefix rather than guessing.
|
|
144
184
|
|
|
145
185
|
Input: $ARGUMENTS
|
|
@@ -195,10 +235,6 @@ For Phase 3+ agents, the orchestrator passes REFS to live downstream docs (`desi
|
|
|
195
235
|
|
|
196
236
|
**refs.json mutation invalidates sprint-context hash (Stage 6 / task 6.3.2).** Any orchestrator update to `docs/plans/refs.json` (Phase 2 Refs Indexer initial write, Phase 3 extension after `DESIGN.md` lands, or any subsequent correction) MUST be IMMEDIATELY followed by a `state_save` call that sets `.build-state.json.current_sprint_context_hash = null`. This invalidates the cached Phase 4 sprint-scoped shared-context block so the next subagent dispatch re-renders with fresh references. See `src/orchestrator/phase4-shared-context.ts#shouldInvalidate` for how the hash is consulted at render time. Skipping this invalidation causes Phase 4 implementers to read stale anchor indices — a silent correctness failure.
|
|
197
237
|
|
|
198
|
-
### Complexity Routing (Advisory)
|
|
199
|
-
|
|
200
|
-
Tag agent prompts with `[COMPLEXITY: S/M/L]` based on task size from `docs/plans/sprint-tasks.md`. This is advisory — the tag documents intent for future model routing support.
|
|
201
|
-
|
|
202
238
|
### Mode-Specific Tool Stacks
|
|
203
239
|
|
|
204
240
|
Mode-specific tool stacks, per-phase branches, and persona rules live in separate files. Load ONE based on `project_type`:
|
|
@@ -240,6 +276,44 @@ The ⭐⭐ star rule: when the LRR Aggregator receives a BLOCK verdict, it reads
|
|
|
240
276
|
|
|
241
277
|
Phase 0 is thin. No agent dispatch. No human input. Instant. The orchestrator reads state files and applies universal checks.
|
|
242
278
|
|
|
279
|
+
### Step 0.0 — Dependency Pre-flight
|
|
280
|
+
|
|
281
|
+
Run **before anything else** — before resume detection, before state reads. No agent dispatch. Takes under 10 seconds.
|
|
282
|
+
|
|
283
|
+
**Check 1 — Orchestrator MCP** (HARD STOP if missing)
|
|
284
|
+
|
|
285
|
+
Attempt to call the `state_read` MCP tool (server: `orchestrator`). If the tool is absent or returns a connection error:
|
|
286
|
+
|
|
287
|
+
> **STOP. Do not proceed.**
|
|
288
|
+
> The orchestrator MCP server is not connected. It powers state saves, cycle-counter rails, and decision scribing — the pipeline cannot run without it.
|
|
289
|
+
> Fix: run `/buildanything:setup`, then **restart Claude Code** (MCP servers spawn on session start). After restarting, re-run your `/buildanything:build` command.
|
|
290
|
+
|
|
291
|
+
**Check 2 — Graph MCP** (HARD STOP if missing)
|
|
292
|
+
|
|
293
|
+
Attempt to call the `graph_list_features` MCP tool (server: `graph`). Apply the same HARD STOP as Check 1 if unavailable.
|
|
294
|
+
|
|
295
|
+
**Check 3 — CLI tools** (run via Bash)
|
|
296
|
+
|
|
297
|
+
| Tool | Command | On failure |
|
|
298
|
+
|------|---------|------------|
|
|
299
|
+
| `tsx` | `which tsx` | HARD STOP — run `/buildanything:setup` |
|
|
300
|
+
| `agent-browser` | `which agent-browser` | WARN only — Phase 5 browser automation degrades |
|
|
301
|
+
| `maestro` | `which maestro` | WARN only — iOS E2E flows will be skipped |
|
|
302
|
+
|
|
303
|
+
**Check 4 — iOS MCP servers** (WARN only)
|
|
304
|
+
|
|
305
|
+
Run `claude mcp list`. Check for `xcodebuildmcp` and `apple-docs`. If either is absent:
|
|
306
|
+
|
|
307
|
+
> ⚠ iOS MCP servers not configured. iOS builds will fail at Phase -1. Run `/buildanything:setup` (idempotent — safe to re-run) to install them, then restart Claude Code.
|
|
308
|
+
|
|
309
|
+
Do NOT stop for missing iOS MCPs. Log the warning and continue.
|
|
310
|
+
|
|
311
|
+
**On HARD STOP:** Print the diagnostic above. Do not write `.build-state.json`. Do not proceed.
|
|
312
|
+
|
|
313
|
+
**On WARN-only issues:** Append a `dependency_warning` entry to `docs/plans/build-log.md` (create it if it doesn't exist), then continue to the resume check.
|
|
314
|
+
|
|
315
|
+
---
|
|
316
|
+
|
|
243
317
|
**Resuming?** If the input contains `--resume` OR if context was just compacted (SessionStart hook fired with active state):
|
|
244
318
|
1. Read `docs/plans/.build-state.json` (source of truth) — verify it exists and has a `resume_point` field. Fall back to reading `docs/plans/.build-state.md` (rendered view) if the JSON file is missing but the markdown exists (graceful migration path from pre-W1-2 builds).
|
|
245
319
|
If neither exists, OR neither has a Resume Point, warn the user: 'No previous build state found. Starting fresh.' Then proceed to Step 0.1 as a new build.
|
|
@@ -366,13 +440,13 @@ Call the Agent tool 4 times in a single message. Each gets the build request + `
|
|
|
366
440
|
|
|
367
441
|
**CONTEXT header:** Render `rendered_context_header` for phase 1 per the canonical template (see CONTEXT HEADER HARD-GATE above). Prepend to every Phase 1 research prompt below.
|
|
368
442
|
|
|
369
|
-
1. Description: "Feature intel" — subagent_type: `feature-intel` — Prompt: "[CONTEXT header above] Extract competitor feature matrix for: [build request]. Idea draft: read docs/plans/phase1-scratch/idea-draft.md with your Read tool. Walk 5-10 rivals. Return must-haves (features present in >=80% of rivals — table stakes) + stand-outs (features unique to individual rivals — differentiation opportunities), sorted by competitor. Save to `docs/plans/phase1-scratch/feature-intel.md`."
|
|
443
|
+
1. Description: "Feature intel" — agent_type: `feature-intel` — subagent_type: `feature-intel` — Prompt: "[CONTEXT header above] Extract competitor feature matrix for: [build request]. Idea draft: read docs/plans/phase1-scratch/idea-draft.md with your Read tool. Walk 5-10 rivals. Return must-haves (features present in >=80% of rivals — table stakes) + stand-outs (features unique to individual rivals — differentiation opportunities), sorted by competitor. Save to `docs/plans/phase1-scratch/feature-intel.md`."
|
|
370
444
|
|
|
371
|
-
2. Description: "Tech feasibility" — subagent_type: `tech-feasibility` — Prompt: "[CONTEXT header above] Evaluate hard technical problems (Solved/Hard/Unsolved), build-vs-buy decisions, stack validation for: [build request]. Idea draft: read docs/plans/phase1-scratch/idea-draft.md with your Read tool. Verify APIs and libraries from the draft exist and are maintained. Save to `docs/plans/phase1-scratch/tech-feasibility.md`. Report with a Technical Verdict."
|
|
445
|
+
2. Description: "Tech feasibility" — agent_type: `tech-feasibility` — subagent_type: `tech-feasibility` — Prompt: "[CONTEXT header above] Evaluate hard technical problems (Solved/Hard/Unsolved), build-vs-buy decisions, stack validation for: [build request]. Idea draft: read docs/plans/phase1-scratch/idea-draft.md with your Read tool. Verify APIs and libraries from the draft exist and are maintained. Save to `docs/plans/phase1-scratch/tech-feasibility.md`. Report with a Technical Verdict."
|
|
372
446
|
|
|
373
|
-
3. Description: "UX research" — subagent_type: `design-ux-researcher` — Prompt: "[CONTEXT header above] Analyze target persona, jobs-to-be-done, current alternatives, and behavioral barriers for: [build request]. Idea draft: read docs/plans/phase1-scratch/idea-draft.md with your Read tool. Save to `docs/plans/phase1-scratch/ux-research.md`. Report with a User Verdict."
|
|
447
|
+
3. Description: "UX research" — agent_type: `design-ux-researcher` — subagent_type: `design-ux-researcher` — Prompt: "[CONTEXT header above] Analyze target persona, jobs-to-be-done, current alternatives, and behavioral barriers for: [build request]. Idea draft: read docs/plans/phase1-scratch/idea-draft.md with your Read tool. Save to `docs/plans/phase1-scratch/ux-research.md`. Report with a User Verdict."
|
|
374
448
|
|
|
375
|
-
4. Description: "Business model" — subagent_type: `business-model` — Prompt: "[CONTEXT header above] Light-touch revenue/channels/unit-economics analysis for: [build request]. Idea draft: read docs/plans/phase1-scratch/idea-draft.md with your Read tool. Surface product-impact conclusions only — which features the business model requires, which channels gate the feature set. Do not write full financial modeling. Save to `docs/plans/phase1-scratch/business-model.md`."
|
|
449
|
+
4. Description: "Business model" — agent_type: `business-model` — subagent_type: `business-model` — Prompt: "[CONTEXT header above] Light-touch revenue/channels/unit-economics analysis for: [build request]. Idea draft: read docs/plans/phase1-scratch/idea-draft.md with your Read tool. Surface product-impact conclusions only — which features the business model requires, which channels gate the feature set. Do not write full financial modeling. Save to `docs/plans/phase1-scratch/business-model.md`."
|
|
376
450
|
|
|
377
451
|
### Step 1.2 — RESEARCH DIGEST (context protection)
|
|
378
452
|
|
|
@@ -501,7 +575,7 @@ Output: `docs/plans/phase1-scratch/prereqs.json` with shape `{supabase_url, supa
|
|
|
501
575
|
|
|
502
576
|
### Step 1.6 — PRODUCT SPEC
|
|
503
577
|
|
|
504
|
-
Call the Agent tool — description: "Product spec" — subagent_type: `product-spec-writer` — prompt: "[CONTEXT header above] Write `docs/plans/product-spec.md` following the structure in `protocols/product-spec-schema.md`. Read ALL of these via your Read tool before writing (do NOT expect pasted content):
|
|
578
|
+
Call the Agent tool — description: "Product spec" — agent_type: `product-spec-writer` — subagent_type: `product-spec-writer` — prompt: "[CONTEXT header above] Write `docs/plans/product-spec.md` following the structure in `protocols/product-spec-schema.md`. Read ALL of these via your Read tool before writing (do NOT expect pasted content):
|
|
505
579
|
- `docs/plans/design-doc.md` — PRD: features, persona, JTBD, value prop, scope, tech stack
|
|
506
580
|
- `docs/plans/phase1-scratch/findings-digest.md` — research synthesis
|
|
507
581
|
- `docs/plans/phase1-scratch/ux-research.md` — behavioral patterns, pain points
|
|
@@ -525,7 +599,7 @@ Run via the Bash tool:
|
|
|
525
599
|
|
|
526
600
|
---
|
|
527
601
|
|
|
528
|
-
## Phase 2: Plan / Architect — TEAM of
|
|
602
|
+
## Phase 2: Plan / Architect — TEAM of 4 + sequence + security review
|
|
529
603
|
|
|
530
604
|
**Goal**: Convert the PRD into a concrete architecture and ordered task list with explicit dependencies. Every architect receives the PRD (design-doc.md) + the Research Digest + its domain's raw research file (hybrid routing).
|
|
531
605
|
|
|
@@ -539,21 +613,23 @@ If existing code, call the Agent tool — description: "Explore codebase" — IN
|
|
|
539
613
|
|
|
540
614
|
If greenfield, skip to Step 2.2.
|
|
541
615
|
|
|
542
|
-
### Step 2.2 — Architecture Design (TEAM of
|
|
616
|
+
### Step 2.2 — Architecture Design (TEAM of 4 architects coordinating via SendMessage)
|
|
543
617
|
|
|
544
|
-
The
|
|
618
|
+
The 4 architects design as a TEAM — not 4 isolated subagents. Cross-domain contract boundaries (Backend↔Frontend on API shape, Performance↔Backend+Data on query shapes, Frontend↔Performance on bundle budgets) are caught at design time via peer SendMessage, not absorbed silently by a downstream stitcher.
|
|
545
619
|
|
|
546
|
-
|
|
620
|
+
Security is NOT in the team — it runs as a separate review pass after synthesis (Step 2.4) to avoid the coordination overhead of its dense cross-check pairings.
|
|
621
|
+
|
|
622
|
+
**On re-entry from LRR backward routing:** If Phase 2 is being re-opened via the re-entry dispatch template (Step 6.3), skip team creation if the original `phase-2-architects` team is still live from this build; otherwise recreate it. Pass the re-entry payload (`{blocking_finding, prior_output: "docs/plans/architecture.md", decision_row}`) into the dispatch prompt of the architect(s) whose domain matches `decision_row.author` — only those architects re-run, not all 4. The re-dispatched architect revises its `docs/plans/phase-2-contracts/<name>.md` in place, SendMessages peers on any contract boundary it now changes, and the synthesizer re-runs once to re-stitch `architecture.md`. Do NOT redo unaffected domains.
|
|
547
623
|
|
|
548
624
|
After the synthesizer re-stitches `architecture.md`, re-run the Refs Indexer (Step 2.3 dispatch #4) to update `docs/plans/refs.json` with fresh anchors, and re-run the DAG Validator (Step 2.3 dispatch #3) to verify sprint-tasks.md still references valid architecture sections. Invalidate the sprint-context hash per the refs.json mutation rule.
|
|
549
625
|
|
|
550
626
|
**Step 2.2a — Create the team.**
|
|
551
627
|
|
|
552
|
-
Call `TeamCreate` with `team_name: "phase-2-architects"`. This team scopes the SendMessage channel for the
|
|
628
|
+
Call `TeamCreate` with `team_name: "phase-2-architects"`. This team scopes the SendMessage channel for the 4 architects below. Capture the team id in `.build-state.json` for teardown.
|
|
553
629
|
|
|
554
|
-
**Step 2.2b — Dispatch
|
|
630
|
+
**Step 2.2b — Dispatch 4 architects as teammates (ONE message).**
|
|
555
631
|
|
|
556
|
-
Call the Agent tool
|
|
632
|
+
Call the Agent tool 4 times in a single message. Each call passes `team_name: "phase-2-architects"` and a unique `name` (listed below). Each architect receives: `docs/plans/design-doc.md` (PRD) + `docs/plans/phase1-scratch/findings-digest.md` + ITS DOMAIN'S RAW RESEARCH FILE (hybrid routing) + the team roster + cross-check pairings + the per-architect output file path.
|
|
557
633
|
|
|
558
634
|
Shared brief appended to every architect prompt:
|
|
559
635
|
|
|
@@ -563,21 +639,18 @@ ROSTER:
|
|
|
563
639
|
- backend-architect (owns services, API contracts, DB schema)
|
|
564
640
|
- frontend-architect (owns component hierarchy, state mgmt, routing)
|
|
565
641
|
- data-engineer (owns ETL/ELT, schema versioning, query patterns)
|
|
566
|
-
- security-engineer (owns auth model, input validation, threat model)
|
|
567
|
-
- accessibility-auditor (owns WCAG 2.2 AA constraints on component/nav choice)
|
|
568
642
|
- performance-benchmarker (owns quality-targets.json, bundle + latency budgets)
|
|
569
643
|
|
|
570
644
|
CROSS-CHECK PAIRINGS (mandatory — if your design touches one of these boundaries, SendMessage the peer before you finalize):
|
|
571
645
|
- Backend ↔ Frontend on API contract shape (REST vs GraphQL, request/response schemas, error envelope)
|
|
572
|
-
- Security ↔ Backend on auth flow (token storage, refresh, session model, authz gates)
|
|
573
|
-
- Accessibility ↔ Frontend on component patterns (primitives, focus management, landmark structure)
|
|
574
646
|
- Performance ↔ Backend+Data on query shapes (N+1 risk, indexing strategy, bundle impact of data layer choices)
|
|
575
|
-
-
|
|
647
|
+
- Frontend ↔ Performance on bundle budgets (per-Scope classification, animation strategy, MapLibre/heavy-lib placement)
|
|
576
648
|
|
|
577
649
|
COORDINATION RULES:
|
|
578
650
|
- Plain text in your output file is INVISIBLE to teammates. If a contract boundary intersects another architect's domain, you MUST `SendMessage` to that peer using the exact `name` from the roster above. Do not assume they will read your file.
|
|
579
651
|
- If a peer SendMessage challenges a decision you have written, revise your output file and SendMessage back with the resolution — do not silently ignore.
|
|
580
|
-
-
|
|
652
|
+
- Max 2 rounds of cross-check per pairing. After round 2, document the disagreement in your output file under `### Unresolved Tensions` and idle. The synthesizer resolves remaining tensions.
|
|
653
|
+
- Idle (exit) only after: (1) your initial read + draft is complete, AND (2) all cross-check pairings touching your domain have either been resolved via SendMessage, confirmed non-intersecting, or hit the 2-round cap.
|
|
581
654
|
|
|
582
655
|
OUTPUT:
|
|
583
656
|
Write your findings to `docs/plans/phase-2-contracts/<your-name>.md` (e.g., `docs/plans/phase-2-contracts/backend-architect.md`). This file is the authoritative record of your post-debate position — include both your initial decisions AND any revisions driven by peer SendMessage.
|
|
@@ -587,22 +660,19 @@ Per-architect dispatches:
|
|
|
587
660
|
|
|
588
661
|
**CONTEXT header:** Render `rendered_context_header` for phase 2 per the canonical template (see CONTEXT HEADER HARD-GATE above). Prepend to every Phase 2 architect prompt below.
|
|
589
662
|
|
|
663
|
+
All architects use model: **sonnet**.
|
|
590
664
|
|
|
591
|
-
1. Description: "Backend architecture" — subagent_type: `engineering-backend-architect` — team_name: `phase-2-architects` — name: `backend-architect` — Prompt: "[CONTEXT header above] Design system architecture. Read these files via your Read tool before starting — do NOT expect pasted content:\n - PRD: `docs/plans/design-doc.md`\n - PRODUCT SPEC: `docs/plans/product-spec.md` (## App Overview, ## Screen Inventory, ## Permissions & Roles, per-feature behavioral sections — feature behaviors are the source of truth your architecture must support)\n - DIGEST: `docs/plans/phase1-scratch/findings-digest.md`\n - YOUR DOMAIN RAW: `docs/plans/phase1-scratch/tech-feasibility.md`, `docs/plans/phase1-scratch/feature-intel.md`\nInclude services, data models, API contracts, database schema, integration points. Respect stack choices from PRD. Map per-feature Business Rules and States to specific endpoints, persistence schemas, and validation logic — every State the product spec defines must have a backend behavior.\n\n[paste shared team brief above]"
|
|
592
|
-
|
|
593
|
-
2. Description: "Frontend architecture" — subagent_type: `engineering-frontend-developer` — team_name: `phase-2-architects` — name: `frontend-architect` — Prompt: "[CONTEXT header above] Design frontend architecture. Read these files via your Read tool before starting — do NOT expect pasted content:\n - PRD: `docs/plans/design-doc.md`\n - PRODUCT SPEC: `docs/plans/product-spec.md` (## App Overview, ## Screen Inventory, ## Permissions & Roles, per-feature behavioral sections — feature behaviors are the source of truth your architecture must support)\n - DIGEST: `docs/plans/phase1-scratch/findings-digest.md`\n - YOUR DOMAIN RAW: `docs/plans/phase1-scratch/ux-research.md`, `docs/plans/phase1-scratch/feature-intel.md`\nInclude component hierarchy, layout strategy, responsive approach, state management, routing. Align UX with the persona from research. Map the Screen Inventory to your component hierarchy — every screen the product spec lists must have a routable view, and per-feature States must drive the component-state matrix.\n\n[paste shared team brief above]"
|
|
665
|
+
1. Description: "Backend architecture" — agent_type: `engineering-backend-architect` — subagent_type: `engineering-backend-architect` — model: `sonnet` — team_name: `phase-2-architects` — name: `backend-architect` — Prompt: "[CONTEXT header above] Design system architecture. Read these files via your Read tool before starting — do NOT expect pasted content:\n - PRD: `docs/plans/design-doc.md`\n - PRODUCT SPEC: `docs/plans/product-spec.md` (## App Overview, ## Screen Inventory, ## Permissions & Roles, per-feature behavioral sections — feature behaviors are the source of truth your architecture must support)\n - DIGEST: `docs/plans/phase1-scratch/findings-digest.md`\n - YOUR DOMAIN RAW: `docs/plans/phase1-scratch/tech-feasibility.md`, `docs/plans/phase1-scratch/feature-intel.md`\nInclude services, data models, API contracts, database schema, integration points. Respect stack choices from PRD. Map per-feature Business Rules and States to specific endpoints, persistence schemas, and validation logic — every State the product spec defines must have a backend behavior.\n\n[paste shared team brief above]"
|
|
594
666
|
|
|
595
|
-
|
|
667
|
+
2. Description: "Frontend architecture" — agent_type: `engineering-frontend-developer` — subagent_type: `engineering-frontend-developer` — model: `sonnet` — team_name: `phase-2-architects` — name: `frontend-architect` — Prompt: "[CONTEXT header above] Design frontend architecture. Read these files via your Read tool before starting — do NOT expect pasted content:\n - PRD: `docs/plans/design-doc.md`\n - PRODUCT SPEC: `docs/plans/product-spec.md` (## App Overview, ## Screen Inventory, ## Permissions & Roles, per-feature behavioral sections — feature behaviors are the source of truth your architecture must support)\n - DIGEST: `docs/plans/phase1-scratch/findings-digest.md`\n - YOUR DOMAIN RAW: `docs/plans/phase1-scratch/ux-research.md`, `docs/plans/phase1-scratch/feature-intel.md`\nInclude component hierarchy, layout strategy, responsive approach, state management, routing. Align UX with the persona from research. Map the Screen Inventory to your component hierarchy — every screen the product spec lists must have a routable view, and per-feature States must drive the component-state matrix.\n\n[paste shared team brief above]"
|
|
596
668
|
|
|
597
|
-
|
|
669
|
+
3. Description: "Data engineering" — agent_type: `engineering-data-engineer` — subagent_type: `engineering-data-engineer` — model: `sonnet` — team_name: `phase-2-architects` — name: `data-engineer` — Prompt: "[CONTEXT header above] Design data architecture. Read these files via your Read tool before starting — do NOT expect pasted content:\n - PRD: `docs/plans/design-doc.md`\n - PRODUCT SPEC: `docs/plans/product-spec.md` (## App Overview, ## Screen Inventory, ## Permissions & Roles, per-feature behavioral sections — feature behaviors are the source of truth your architecture must support)\n - DIGEST: `docs/plans/phase1-scratch/findings-digest.md`\n - YOUR DOMAIN RAW: `docs/plans/phase1-scratch/tech-feasibility.md`\nInclude ETL/ELT patterns, schema versioning, query patterns, indexing strategy, data lineage, migration plan. Per-feature data requirements from the product spec drive your schema — derived fields, denormalizations, and access patterns must serve specific feature flows.\n\n[paste shared team brief above]"
|
|
598
670
|
|
|
599
|
-
|
|
671
|
+
4. Description: "Performance constraints" — agent_type: `testing-performance-benchmarker` — subagent_type: `testing-performance-benchmarker` — model: `sonnet` — team_name: `phase-2-architects` — name: `performance-benchmarker` — Prompt: "[CONTEXT header above] Define quality targets for this build. Read these files via your Read tool before starting — do NOT expect pasted content:\n - PRD: `docs/plans/design-doc.md`\n - PRODUCT SPEC: `docs/plans/product-spec.md` (## App Overview, ## Screen Inventory, ## Permissions & Roles, per-feature behavioral sections — feature behaviors are the source of truth your architecture must support)\n - DIGEST: `docs/plans/phase1-scratch/findings-digest.md`\n - YOUR DOMAIN RAW: `docs/plans/phase1-scratch/tech-feasibility.md`\nWrite `docs/plans/quality-targets.json` covering bundle budget, LCP, TTI, API p95, Lighthouse scores. Use per-Scope budgets: Marketing 500KB / Product 300KB / Dashboard 400KB / Internal 200KB gzipped. Per-feature critical-path performance derives from the product spec's Happy Path latency expectations.\n\n[paste shared team brief above]"
|
|
600
672
|
|
|
601
|
-
|
|
673
|
+
**Step 2.2c — Wait for all 4 teammates to idle**, then proceed to synthesis. The `docs/plans/phase-2-contracts/*.md` files now contain post-debate positions (initial draft plus any SendMessage-driven revisions). The orchestrator does NOT read these files — the synthesizer below does.
|
|
602
674
|
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
After all 6 teammates are idle, the 4 raw research files are **SPENT**. They sit on disk for audit but no downstream phase reads them — they are NOT in the `refs.json` index. The orchestrator MOVES them to `docs/plans/phase1-scratch/` if not already there, to make the distinction physically obvious.
|
|
675
|
+
After all 4 teammates are idle, the 4 raw research files are **SPENT**. They sit on disk for audit but no downstream phase reads them — they are NOT in the `refs.json` index. The orchestrator MOVES them to `docs/plans/phase1-scratch/` if not already there, to make the distinction physically obvious.
|
|
606
676
|
|
|
607
677
|
**Step 2.2d — Team teardown.** After the synthesizer dispatch at Step 2.3 returns, call `TeamDelete` on `phase-2-architects` to clean up the team channel.
|
|
608
678
|
|
|
@@ -612,9 +682,9 @@ Four sequential dispatches.
|
|
|
612
682
|
|
|
613
683
|
**CONTEXT header:** Reuse `rendered_context_header` from phase 2 (already rendered above). Prepend to Step 2.3 synthesizer + sprint-breakdown prompts.
|
|
614
684
|
|
|
615
|
-
1. Description: "Implementation blueprint" — subagent_type: `code-architect` — Prompt: "[CONTEXT header above] Implementation blueprint. Read the PRD via your Read tool: `docs/plans/design-doc.md`. Read the product spec: `docs/plans/product-spec.md` (Screen Inventory + per-feature behavioral sections — your blueprint's file-and-build-order list must cover every feature in the spec). Read all
|
|
685
|
+
1. Description: "Implementation blueprint" — agent_type: `code-architect` — subagent_type: `code-architect` — Prompt: "[CONTEXT header above] Implementation blueprint. Read the PRD via your Read tool: `docs/plans/design-doc.md`. Read the product spec: `docs/plans/product-spec.md` (Screen Inventory + per-feature behavioral sections — your blueprint's file-and-build-order list must cover every feature in the spec). Read all 4 post-debate architect positions via your own Read tool from `docs/plans/phase-2-contracts/`:\n - `backend-architect.md`\n - `frontend-architect.md`\n - `data-engineer.md`\n - `performance-benchmarker.md`\n\nThese files are the authoritative team positions AFTER any SendMessage-driven revisions — the architects already cross-checked each other's contract boundaries, so you can stitch without re-debating. Your job is to assemble the 4 positions into a coherent architecture. Where positions conflict OUTSIDE the 3 mandatory cross-check pairings, flag the contradiction explicitly in `architecture.md` under a `### Unresolved Tensions` section and pick the safer default. Do not silently absorb contradictions. Include specific files to create/modify, build sequence, dependency order. Write `docs/plans/architecture.md` with stable section anchors per `protocols/architecture-schema.md`. Required top-level sections: Overview, Frontend, Backend, Data Model, Security, Infrastructure, Scope, Out of Scope. Scope to the boundary from the PRD. Every API endpoint heading in the Backend section MUST include feature attribution annotations — e.g. `**POST /api/orders** (provides: order-placement)` — using the feature kebab names from `product-spec.md`. These annotations are required for the graph indexer to emit cross-feature dependency edges."
|
|
616
686
|
|
|
617
|
-
2. Description: "Sprint breakdown" — subagent_type: `planner` — Prompt: "[CONTEXT header above] Break this architecture into ordered, atomic tasks. Each task needs: description, acceptance criteria, **dependencies** (list of task IDs this depends on), size (S/M/L), **Behavioral Test** field for every UI task (concrete interaction: 'Navigate to [page], click [element], verify [outcome]') or curl-based acceptance test for API tasks, **Feature** — the exact feature name from product-spec.md (e.g. 'Order Placement', 'Auth') that must match a `## Feature: X` heading in product-spec.md (use '—' for infrastructure tasks that don't belong to a specific feature), **Screens** — comma-separated screen names from the product-spec Screen Inventory (e.g. 'Catalog, Product Detail') that must match screen names in product-spec.md (use '—' for backend-only tasks). Read these files via your Read tool before starting:\n - ARCHITECTURE: `docs/plans/architecture.md`\n - PRODUCT SPEC: `docs/plans/product-spec.md` (per-feature behavioral sections — every feature in the spec must have at least one task, and per-feature acceptance criteria become Behavioral Test field values)\n - PRD: `docs/plans/design-doc.md`\nSave to `docs/plans/sprint-tasks.md`. The table must have these columns in order: Task ID, Title, Size, Dependencies, Behavioral Test, Owns Files, Implementing Phase, Feature, Screens. Dependencies field is load-bearing — Phase 4 uses it to batch independent tasks in parallel. Each task's Behavioral Test field SHOULD reference a specific feature acceptance criterion from the product spec (e.g., \"User can submit form with valid email; submitted form appears in admin dashboard within 5s\" — derived from product-spec.md's Happy Path or per-state criteria)."
|
|
687
|
+
2. Description: "Sprint breakdown" — agent_type: `planner` — subagent_type: `planner` — Prompt: "[CONTEXT header above] Break this architecture into ordered, atomic tasks. Each task needs: description, acceptance criteria, **dependencies** (list of task IDs this depends on), size (S/M/L), **Behavioral Test** field for every UI task (concrete interaction: 'Navigate to [page], click [element], verify [outcome]') or curl-based acceptance test for API tasks, **Feature** — the exact feature name from product-spec.md (e.g. 'Order Placement', 'Auth') that must match a `## Feature: X` heading in product-spec.md (use '—' for infrastructure tasks that don't belong to a specific feature), **Screens** — comma-separated screen names from the product-spec Screen Inventory (e.g. 'Catalog, Product Detail') that must match screen names in product-spec.md (use '—' for backend-only tasks). Read these files via your Read tool before starting:\n - ARCHITECTURE: `docs/plans/architecture.md`\n - PRODUCT SPEC: `docs/plans/product-spec.md` (per-feature behavioral sections — every feature in the spec must have at least one task, and per-feature acceptance criteria become Behavioral Test field values)\n - PRD: `docs/plans/design-doc.md`\nSave to `docs/plans/sprint-tasks.md`. The table must have these columns in order: Task ID, Title, Size, Dependencies, Behavioral Test, Owns Files, Implementing Phase, Feature, Screens. Dependencies field is load-bearing — Phase 4 uses it to batch independent tasks in parallel. Each task's Behavioral Test field SHOULD reference a specific feature acceptance criterion from the product spec (e.g., \"User can submit form with valid email; submitted form appears in admin dashboard within 5s\" — derived from product-spec.md's Happy Path or per-state criteria)."
|
|
618
688
|
|
|
619
689
|
3. Description: "Task DAG validator" — INTERNAL inline role-string — Prompt: "You are the Task DAG Validator. Read `docs/plans/sprint-tasks.md`. Validate for DAG correctness:
|
|
620
690
|
- No circular dependencies
|
|
@@ -633,7 +703,7 @@ Report any violations. If clean, return PASS. If violations, return a list of fi
|
|
|
633
703
|
|
|
634
704
|
For each doc, extract section anchors into a flat index. Schema: `[{\"anchor\": \"design-doc.md#persona\", \"topic\": \"user persona\", \"file_path\": \"docs/plans/design-doc.md\"}, ...]`. This index is consumed by the Phase 4 Briefing Officer for per-task context maps. Do NOT include Phase 1 scratch files — they are SPENT."
|
|
635
705
|
|
|
636
|
-
**Architecture Metric Loop (callable service):** Run the Metric Loop Protocol (`protocols/metric-loop.md`) on `architecture.md`. Define a metric: coverage of PRD requirements, specificity, consistency across the
|
|
706
|
+
**Architecture Metric Loop (callable service):** Run the Metric Loop Protocol (`protocols/metric-loop.md`) on `architecture.md`. Define a metric: coverage of PRD requirements, specificity, consistency across the 4 architects, and **simplicity** — is this the simplest architecture that meets the requirements? Could any service, abstraction, or dependency be eliminated? Penalize over-engineering. Max 3 iterations.
|
|
637
707
|
|
|
638
708
|
#### Step 2.3.1.idx — Architecture graph index
|
|
639
709
|
|
|
@@ -667,6 +737,14 @@ Run via the Bash tool:
|
|
|
667
737
|
|
|
668
738
|
**Architecture decisions:** The Implementation Blueprint synthesizer returns 4 `deviation_row` objects (or a `phase_2_decisions` array of row objects) in its structured result — one per cross-cutting Phase 2 decision (API contract, persistence layer, auth model, framework choice). The orchestrator forwards each row through the `scribe_decision` MCP tool (see Phase 4 "Orchestrator-scribe dispatch"); the MCP allocates `D-2-<seq>` IDs and atomically appends to `docs/plans/decisions.jsonl`. Author = `architect`. Each row carries a `ref` anchor pointing into `architecture.md` per `protocols/decision-log.md`. Total: 4 rows.
|
|
669
739
|
|
|
740
|
+
### Step 2.4 — Security Review (post-synthesis, NOT in team)
|
|
741
|
+
|
|
742
|
+
Security runs as a standalone subagent AFTER the architecture is synthesized. It reviews the complete picture rather than debating piecemeal during the team phase. This eliminates the coordination overhead of security's dense cross-check pairings while preserving full security coverage.
|
|
743
|
+
|
|
744
|
+
Description: "Security architecture review" — agent_type: `engineering-security-engineer` — subagent_type: `engineering-security-engineer` — model: `sonnet` — Prompt: "[CONTEXT header above] Security review of the synthesized architecture. Read these files via your Read tool before starting — do NOT expect pasted content:\n - ARCHITECTURE: `docs/plans/architecture.md` (the synthesized output — this is your primary input)\n - PRD: `docs/plans/design-doc.md`\n - PRODUCT SPEC: `docs/plans/product-spec.md` (## Permissions & Roles is your auth model source of truth)\n - BACKEND CONTRACT: `docs/plans/phase-2-contracts/backend-architect.md`\n - FRONTEND CONTRACT: `docs/plans/phase-2-contracts/frontend-architect.md`\n\nReview the architecture for: auth model completeness, input validation coverage, secrets management, threat model, CSRF/XSS/injection surface, RLS policy design, dependency hygiene, client-side auth posture (token storage, secure cookies). Use the product spec's ## Permissions & Roles section to verify every role maps to enforceable permissions.\n\nWrite `docs/plans/phase-2-contracts/security-engineer.md` with your findings. Structure: auth model, RLS policies, threat model, input validation rules, secrets management, security headers, and a `### Required Revisions` section listing any changes needed to `architecture.md`. If no revisions needed, state 'No revisions required.'\n\nIf `### Required Revisions` is non-empty, the synthesizer will re-run once to incorporate your findings."
|
|
745
|
+
|
|
746
|
+
**Post-security revision (conditional):** If the security review's `### Required Revisions` section is non-empty, re-dispatch the Implementation Blueprint synthesizer (Step 2.3 dispatch #1) with an additional instruction: "Read `docs/plans/phase-2-contracts/security-engineer.md` § Required Revisions and incorporate into `architecture.md`. Do not re-read other contracts — only apply the security revisions." Then re-run the Refs Indexer. Max 1 revision cycle.
|
|
747
|
+
|
|
670
748
|
**Writes:** `docs/plans/architecture.md`, `docs/plans/sprint-tasks.md`, `docs/plans/quality-targets.json`, `docs/plans/refs.json`. Decision rows (4) flow through the orchestrator's `scribe_decision` MCP calls.
|
|
671
749
|
|
|
672
750
|
### Quality Gate 2
|
|
@@ -710,13 +788,13 @@ Phase 4 WILL NOT START without `DESIGN.md` (Pass 1 + Pass 2 complete). If the ar
|
|
|
710
788
|
- `project_type=web`: follow `protocols/web-phase-branches.md` §Phase 3 — this file contains the NEW structure with steps 3.0-3.7 covering Visual DNA Selection (Brand Guardian as DNA owner at 3.0), Visual Research, Component Library Mapping, UX Architecture, Visual Design Spec, Inclusive Visuals Check, Style Guide Implementation (wrapped in Design Critic metric loop), and A11y Design Review. See the Component Library Mapping step in that protocol for the component library strategy.
|
|
711
789
|
|
|
712
790
|
**Phase 3 branch-file dispatch table (subagent_type references for SSOT lint):**
|
|
713
|
-
- Step 3.0 Visual DNA Selection: subagent_type: `design-brand-guardian` (web)
|
|
714
|
-
- Step 3.1 Visual Research (2 parallel): subagent_type: `visual-research` (web, competitive-audit + inspiration-mining)
|
|
715
|
-
- Step 3.2 Component Library Mapping: subagent_type: `design-ui-designer` (web)
|
|
716
|
-
- Step 3.2b DNA Persona Check: subagent_type: `design-ux-researcher` (web, may route to 3.0)
|
|
717
|
-
- Step 3.3 UX Architecture: subagent_type: `design-ux-architect` (web)
|
|
718
|
-
- Step 3.5 Inclusive Visuals Check: subagent_type: `design-inclusive-visuals-specialist` (web)
|
|
719
|
-
- Step 3.2-ios iOS Design Board: subagent_type: `ios-swift-ui-design` (iOS)
|
|
791
|
+
- Step 3.0 Visual DNA Selection: agent_type: `design-brand-guardian` — subagent_type: `design-brand-guardian` (web)
|
|
792
|
+
- Step 3.1 Visual Research (2 parallel): agent_type: `visual-research` — subagent_type: `visual-research` (web, competitive-audit + inspiration-mining)
|
|
793
|
+
- Step 3.2 Component Library Mapping: agent_type: `design-ui-designer` — subagent_type: `design-ui-designer` (web)
|
|
794
|
+
- Step 3.2b DNA Persona Check: agent_type: `design-ux-researcher` — subagent_type: `design-ux-researcher` (web, may route to 3.0)
|
|
795
|
+
- Step 3.3 UX Architecture: agent_type: `design-ux-architect` — subagent_type: `design-ux-architect` (web)
|
|
796
|
+
- Step 3.5 Inclusive Visuals Check: agent_type: `design-inclusive-visuals-specialist` — subagent_type: `design-inclusive-visuals-specialist` (web)
|
|
797
|
+
- Step 3.2-ios iOS Design Board: agent_type: `ios-swift-ui-design` — subagent_type: `ios-swift-ui-design` (iOS)
|
|
720
798
|
|
|
721
799
|
**Phase 3 write discipline:** Phase 3 is the writer for `DESIGN.md` (web) and extends `docs/plans/refs.json` to cover the visual spec anchors once it lands. Phase 3 does NOT write to `architecture.md` or `sprint-tasks.md` — those are Phase 2's.
|
|
722
800
|
|
|
@@ -743,21 +821,21 @@ Before starting Phase 4: Phase 2 must be approved, Phase 3 must have produced th
|
|
|
743
821
|
- `project_type=web`: follow `protocols/web-phase-branches.md` §Phase 4 for scaffold details and execution agent prompts.
|
|
744
822
|
|
|
745
823
|
**Phase 4 dispatch table (subagent_type references for SSOT lint):**
|
|
746
|
-
- Product Owner (planning): subagent_type: `product-owner`
|
|
747
|
-
- Product Owner (acceptance): subagent_type: `product-owner`
|
|
748
|
-
- Briefing Officer (per feature): subagent_type: `briefing-officer`
|
|
749
|
-
- Web UI (S/M): subagent_type: `engineering-frontend-developer`
|
|
750
|
-
- Web UI (L): subagent_type: `engineering-senior-developer`
|
|
751
|
-
- Web backend: subagent_type: `engineering-backend-architect` OR `engineering-senior-developer`
|
|
752
|
-
- Web AI/ML: subagent_type: `engineering-ai-engineer`
|
|
753
|
-
- iOS UI planner: subagent_type: `ios-swift-ui-design`
|
|
754
|
-
- iOS UI impl: subagent_type: `engineering-senior-developer`, `engineering-mobile-app-builder`
|
|
755
|
-
- iOS Foundation Models: subagent_type: `ios-foundation-models-specialist`
|
|
756
|
-
- iOS StoreKit: subagent_type: `ios-storekit-specialist`
|
|
757
|
-
- iOS Swift review: subagent_type: `swift-reviewer`
|
|
758
|
-
- Security review: subagent_type: `security-reviewer`
|
|
759
|
-
- Cleanup: subagent_type: `code-simplifier`, `refactor-cleaner`
|
|
760
|
-
- Code review: subagent_type: `code-reviewer`, `silent-failure-hunter`
|
|
824
|
+
- Product Owner (planning): agent_type: `product-owner` — subagent_type: `product-owner`
|
|
825
|
+
- Product Owner (acceptance): agent_type: `product-owner` — subagent_type: `product-owner`
|
|
826
|
+
- Briefing Officer (per feature): agent_type: `briefing-officer` — subagent_type: `briefing-officer`
|
|
827
|
+
- Web UI (S/M): agent_type: `engineering-frontend-developer` — subagent_type: `engineering-frontend-developer`
|
|
828
|
+
- Web UI (L): agent_type: `engineering-senior-developer` — subagent_type: `engineering-senior-developer`
|
|
829
|
+
- Web backend: agent_type: `engineering-backend-architect` — subagent_type: `engineering-backend-architect` OR `engineering-senior-developer`
|
|
830
|
+
- Web AI/ML: agent_type: `engineering-ai-engineer` — subagent_type: `engineering-ai-engineer`
|
|
831
|
+
- iOS UI planner: agent_type: `ios-swift-ui-design` — subagent_type: `ios-swift-ui-design`
|
|
832
|
+
- iOS UI impl: agent_type: `engineering-senior-developer` — subagent_type: `engineering-senior-developer`, `engineering-mobile-app-builder`
|
|
833
|
+
- iOS Foundation Models: agent_type: `ios-foundation-models-specialist` — subagent_type: `ios-foundation-models-specialist`
|
|
834
|
+
- iOS StoreKit: agent_type: `ios-storekit-specialist` — subagent_type: `ios-storekit-specialist`
|
|
835
|
+
- iOS Swift review: agent_type: `swift-reviewer` — subagent_type: `swift-reviewer`
|
|
836
|
+
- Security review: agent_type: `security-reviewer` — subagent_type: `security-reviewer`
|
|
837
|
+
- Cleanup: agent_type: `code-simplifier` — subagent_type: `code-simplifier`, `refactor-cleaner`
|
|
838
|
+
- Code review: agent_type: `code-reviewer` — subagent_type: `code-reviewer`, `silent-failure-hunter`
|
|
761
839
|
|
|
762
840
|
### Step 4.0 — Scaffold (unchanged)
|
|
763
841
|
|
|
@@ -765,9 +843,9 @@ Scaffolding is project skeleton + design system + acceptance test stubs. Three s
|
|
|
765
843
|
|
|
766
844
|
**CONTEXT header:** Render `rendered_context_header` for phase 4 per the canonical template (see CONTEXT HEADER HARD-GATE above). Includes `dna` field for web projects. Prepend to every Phase 4 prompt below.
|
|
767
845
|
|
|
768
|
-
1. Description: "Project scaffolding" — subagent_type: `engineering-rapid-prototyper` — mode: "bypassPermissions" — prompt per branch file.
|
|
846
|
+
1. Description: "Project scaffolding" — agent_type: `engineering-rapid-prototyper` — subagent_type: `engineering-rapid-prototyper` — mode: "bypassPermissions" — prompt per branch file.
|
|
769
847
|
|
|
770
|
-
2. Description: "Design system setup" — subagent_type: `engineering-frontend-developer` — mode: "bypassPermissions" — prompt per branch file. Implements design tokens from `DESIGN.md`.
|
|
848
|
+
2. Description: "Design system setup" — agent_type: `engineering-frontend-developer` — subagent_type: `engineering-frontend-developer` — mode: "bypassPermissions" — prompt per branch file. Implements design tokens from `DESIGN.md`.
|
|
771
849
|
|
|
772
850
|
3. Description: "Scaffold acceptance tests" — INTERNAL inline role-string — mode: "bypassPermissions" — prompt: "[CONTEXT header above] Scaffold acceptance tests from sprint-tasks.md. Use Page Object Model. For every task with a Behavioral Test field, create a Playwright test stub (web) or Maestro flow stub (iOS). Stubs must FAIL right now. Commit: 'test: scaffold acceptance tests from sprint tasks'."
|
|
773
851
|
|
|
@@ -777,7 +855,7 @@ Scaffolding is project skeleton + design system + acceptance test stubs. Three s
|
|
|
777
855
|
|
|
778
856
|
Dispatch the Product Owner in planning mode. It reads the full artifact set via graph queries, groups tasks by feature, sequences features into dependency-ordered waves, and writes a delegation plan.
|
|
779
857
|
|
|
780
|
-
Call the Agent tool — description: "Product Owner: feature planning" — subagent_type: `product-owner` — prompt: "[CONTEXT header above] MODE: planning.
|
|
858
|
+
Call the Agent tool — description: "Product Owner: feature planning" — agent_type: `product-owner` — subagent_type: `product-owner` — prompt: "[CONTEXT header above] MODE: planning.
|
|
781
859
|
|
|
782
860
|
Read these artifacts via graph queries:
|
|
783
861
|
- `docs/plans/product-spec.md` — feature list, cross-feature interactions, screen inventory
|
|
@@ -798,7 +876,7 @@ Read `feature-delegation-plan.json`. For each wave, execute all features. Featur
|
|
|
798
876
|
|
|
799
877
|
For each feature in the current wave, dispatch a Briefing Officer. If the wave has multiple independent features, dispatch all BOs in ONE message (parallel).
|
|
800
878
|
|
|
801
|
-
Call the Agent tool — description: "Briefing Officer: [feature name]" — subagent_type: `briefing-officer` — mode: "bypassPermissions" — prompt: "[CONTEXT header above] FEATURE DELEGATION from Product Owner:
|
|
879
|
+
Call the Agent tool — description: "Briefing Officer: [feature name]" — agent_type: `briefing-officer` — subagent_type: `briefing-officer` — mode: "bypassPermissions" — prompt: "[CONTEXT header above] FEATURE DELEGATION from Product Owner:
|
|
802
880
|
|
|
803
881
|
Feature: [feature name]
|
|
804
882
|
Product context: [paste product_context from delegation plan]
|
|
@@ -820,7 +898,7 @@ After the Briefing Officer writes the feature brief, the orchestrator reads it a
|
|
|
820
898
|
|
|
821
899
|
**1. Implementer dispatch** — The orchestrator reads the task's execution spec from the feature brief and pastes the structured context directly into the execution agent's prompt. See mode-specific branch file (`protocols/web-phase-branches.md` §Phase 4 or `protocols/ios-phase-branches.md` §Phase 4) for the exact prompt template.
|
|
822
900
|
|
|
823
|
-
Call the Agent tool — description: "[task-id] [task name]" — subagent_type: [from BO brief] — mode: "bypassPermissions" — prompt: "[CONTEXT header above]
|
|
901
|
+
Call the Agent tool — description: "[task-id] [task name]" — agent_type: [from BO brief] — subagent_type: [from BO brief] — mode: "bypassPermissions" — prompt: "[CONTEXT header above].
|
|
824
902
|
|
|
825
903
|
[Paste the full structured context payload from the feature brief — TASK, FEATURE CONTEXT, PAGE LAYOUT, COMPONENTS, API CONTRACT, ERROR STATES, BUSINESS RULES, SKILLS ASSIGNED, ACCEPTANCE. See branch file for exact format.]
|
|
826
904
|
|
|
@@ -834,21 +912,21 @@ Implement fully with real code and tests. Commit: 'feat: [task]'. Report what yo
|
|
|
834
912
|
|
|
835
913
|
**2. Per-task security review (auth/PII tasks only)** — unchanged from prior design.
|
|
836
914
|
|
|
837
|
-
Call the Agent tool — description: "Security review for [task-id]" — subagent_type: `security-reviewer` — prompt: "[CONTEXT header above] Review changed files from [task-id] for security issues. Scope: auth logic, input validation, secrets handling, dependency hygiene, OWASP Top 10 for web (or iOS Keychain / ATS / data protection for iOS). Return blocking findings only — 80%+ confidence threshold. Files to review: [list from implementer's changeset]."
|
|
915
|
+
Call the Agent tool — description: "Security review for [task-id]" — agent_type: `security-reviewer` — subagent_type: `security-reviewer` — prompt: "[CONTEXT header above] Review changed files from [task-id] for security issues. Scope: auth logic, input validation, secrets handling, dependency hygiene, OWASP Top 10 for web (or iOS Keychain / ATS / data protection for iOS). Return blocking findings only — 80%+ confidence threshold. Files to review: [list from implementer's changeset]."
|
|
838
916
|
|
|
839
917
|
**3. Senior Dev cleanup** — unchanged. Two-pass, changeset-scoped.
|
|
840
918
|
|
|
841
|
-
1. Call the Agent tool — description: "Simplify [task-id]" — subagent_type: `code-simplifier` — mode: "bypassPermissions" — prompt: "[CONTEXT header above] Simplify changed files from [task-id]. Remove dead code, unused imports, redundant abstractions. Do NOT add features. Do NOT change architecture. Do NOT touch files outside the changeset. Files: [list]."
|
|
919
|
+
1. Call the Agent tool — description: "Simplify [task-id]" — agent_type: `code-simplifier` — subagent_type: `code-simplifier` — mode: "bypassPermissions" — prompt: "[CONTEXT header above] Simplify changed files from [task-id]. Remove dead code, unused imports, redundant abstractions. Do NOT add features. Do NOT change architecture. Do NOT touch files outside the changeset. Files: [list]."
|
|
842
920
|
|
|
843
|
-
2. If TS/JS task: Call the Agent tool — description: "Refactor [task-id]" — subagent_type: `refactor-cleaner` — mode: "bypassPermissions" — prompt: "[CONTEXT header above] Run knip/depcheck/ts-prune on changed files from [task-id]. Changeset only. Files: [list]."
|
|
921
|
+
2. If TS/JS task: Call the Agent tool — description: "Refactor [task-id]" — agent_type: `refactor-cleaner` — subagent_type: `refactor-cleaner` — mode: "bypassPermissions" — prompt: "[CONTEXT header above] Run knip/depcheck/ts-prune on changed files from [task-id]. Changeset only. Files: [list]."
|
|
844
922
|
|
|
845
923
|
**4. Per-task code review (parallel pair)** — unchanged.
|
|
846
924
|
|
|
847
925
|
Call the Agent tool 2 times in one message:
|
|
848
926
|
|
|
849
|
-
1. Description: "Code review for [task-id]" — subagent_type: `code-reviewer` — Prompt: "[CONTEXT header above] Review changed files from [task-id]. 80%+ confidence threshold. Changeset only. Files: [list]."
|
|
927
|
+
1. Description: "Code review for [task-id]" — agent_type: `code-reviewer` — subagent_type: `code-reviewer` — Prompt: "[CONTEXT header above] Review changed files from [task-id]. 80%+ confidence threshold. Changeset only. Files: [list]."
|
|
850
928
|
|
|
851
|
-
2. Description: "Silent failure hunt for [task-id]" — subagent_type: `silent-failure-hunter` — Prompt: "[CONTEXT header above] Hunt silent failures in changed files from [task-id]. Files: [list]."
|
|
929
|
+
2. Description: "Silent failure hunt for [task-id]" — agent_type: `silent-failure-hunter` — subagent_type: `silent-failure-hunter` — Prompt: "[CONTEXT header above] Hunt silent failures in changed files from [task-id]. Files: [list]."
|
|
852
930
|
|
|
853
931
|
**5. Metric Loop** — unchanged. Authoritative behavioral check per `protocols/metric-loop.md`. Max 5 iterations.
|
|
854
932
|
|
|
@@ -862,7 +940,7 @@ Call the Agent tool 2 times in one message:
|
|
|
862
940
|
|
|
863
941
|
After all tasks for a feature complete, dispatch the Product Owner in acceptance mode. It checks whether the built feature matches the product spec.
|
|
864
942
|
|
|
865
|
-
Call the Agent tool — description: "Product Owner: accept [feature name]" — subagent_type: `product-owner` — prompt: "[CONTEXT header above] MODE: acceptance. FEATURE: [feature name].
|
|
943
|
+
Call the Agent tool — description: "Product Owner: accept [feature name]" — agent_type: `product-owner` — subagent_type: `product-owner` — prompt: "[CONTEXT header above] MODE: acceptance. FEATURE: [feature name].
|
|
866
944
|
|
|
867
945
|
Read the feature's acceptance criteria and business rules via graph query. Read the feature's page spec(s) from `docs/plans/page-specs/`. Use agent-browser (web) or XcodeBuildMCP + Maestro (iOS) to verify the built feature.
|
|
868
946
|
|
|
@@ -940,15 +1018,15 @@ Read the NFRs from `docs/plans/quality-targets.json`. Pass the relevant targets
|
|
|
940
1018
|
|
|
941
1019
|
Call the Agent tool 5 times in one message:
|
|
942
1020
|
|
|
943
|
-
1. Description: "API testing" — subagent_type: `testing-api-tester` — Prompt: "[CONTEXT header above] Comprehensive API validation: all endpoints, edge cases, error responses, auth flows. NFR targets: Read `docs/plans/quality-targets.json` via your Read tool for performance and reliability thresholds. Report findings with severity counts."
|
|
1021
|
+
1. Description: "API testing" — agent_type: `testing-api-tester` — subagent_type: `testing-api-tester` — Prompt: "[CONTEXT header above] Comprehensive API validation: all endpoints, edge cases, error responses, auth flows. NFR targets: Read `docs/plans/quality-targets.json` via your Read tool for performance and reliability thresholds. Report findings with severity counts."
|
|
944
1022
|
|
|
945
|
-
2. Description: "Performance audit" — subagent_type: `testing-performance-benchmarker` — Prompt: "[CONTEXT header above] Measure response times, identify bottlenecks, flag performance issues. NFR targets: Read `docs/plans/quality-targets.json` via your Read tool for performance thresholds. Bundle size per-Scope budgets apply (Marketing 500KB / Product 300KB / Dashboard 400KB / Internal 200KB gzipped). Report benchmarks AGAINST these targets, not generic metrics."
|
|
1023
|
+
2. Description: "Performance audit" — agent_type: `testing-performance-benchmarker` — subagent_type: `testing-performance-benchmarker` — Prompt: "[CONTEXT header above] Measure response times, identify bottlenecks, flag performance issues. NFR targets: Read `docs/plans/quality-targets.json` via your Read tool for performance thresholds. Bundle size per-Scope budgets apply (Marketing 500KB / Product 300KB / Dashboard 400KB / Internal 200KB gzipped). Report benchmarks AGAINST these targets, not generic metrics."
|
|
946
1024
|
|
|
947
|
-
3. Description: "A11y audit" — subagent_type: `a11y-architect` — Prompt: "[CONTEXT header above] WCAG 2.2 AA runtime compliance audit on all interfaces. Check screen reader, keyboard nav, contrast, focus order, touch targets (>=44px), reduced-motion variants. Report issues with severity (Critical/Serious/Moderate/Minor)."
|
|
1025
|
+
3. Description: "A11y audit" — agent_type: `a11y-architect` — subagent_type: `a11y-architect` — Prompt: "[CONTEXT header above] Light-touch accessibility sweep — flag only Critical and Serious WCAG 2.2 AA violations (blatant ADA issues). Skip Moderate/Minor. Keep the report concise. WCAG 2.2 AA runtime compliance audit on all interfaces. Check screen reader, keyboard nav, contrast, focus order, touch targets (>=44px), reduced-motion variants. Report issues with severity (Critical/Serious/Moderate/Minor)."
|
|
948
1026
|
|
|
949
|
-
4. Description: "Security audit" — subagent_type: `engineering-security-engineer` — Prompt: "[CONTEXT header above] Security review at app level: auth, input validation, data exposure, dependency vulnerabilities. NFR targets: Read `docs/plans/quality-targets.json` via your Read tool for security thresholds. Report findings with severity."
|
|
1027
|
+
4. Description: "Security audit" — agent_type: `engineering-security-engineer` — subagent_type: `engineering-security-engineer` — Prompt: "[CONTEXT header above] Security review at app level: auth, input validation, data exposure, dependency vulnerabilities. NFR targets: Read `docs/plans/quality-targets.json` via your Read tool for security thresholds. Report findings with severity."
|
|
950
1028
|
|
|
951
|
-
5. Description: "Brand Guardian drift check" — subagent_type: `design-brand-guardian` — Prompt: "[CONTEXT header above] You are the Phase 5 drift check. Read DESIGN.md (the DNA card locked at Phase 3.0) + the actually-built pages via Playwright screenshots under docs/plans/evidence/. Score whether Phase 4 implementers stayed true to the DNA or drifted away from it. Specifically check: does the built Character axis match the DNA? Does Density match? Is Material consistent? Is Motion aligned? Report drift count and specific elements. Save findings to docs/plans/evidence/brand-drift.md. Note: this is a drift check only — the Phase 6 LRR Brand Guardian chapter does the verdict. You do NOT issue a pass/fail here, only surface findings."
|
|
1029
|
+
5. Description: "Brand Guardian drift check" — agent_type: `design-brand-guardian` — subagent_type: `design-brand-guardian` — Prompt: "[CONTEXT header above] You are the Phase 5 drift check. Read DESIGN.md (the DNA card locked at Phase 3.0) + the actually-built pages via Playwright screenshots under docs/plans/evidence/. Score whether Phase 4 implementers stayed true to the DNA or drifted away from it. Specifically check: does the built Character axis match the DNA? Does Density match? Is Material consistent? Is Motion aligned? Report drift count and specific elements. Save findings to docs/plans/evidence/brand-drift.md. Note: this is a drift check only — the Phase 6 LRR Brand Guardian chapter does the verdict. You do NOT issue a pass/fail here, only surface findings."
|
|
952
1030
|
|
|
953
1031
|
### Step 5.2 — Track B: Product Reality (parallel per-feature, ONE message)
|
|
954
1032
|
|
|
@@ -966,7 +1044,7 @@ Track B audits the built app against `product-spec.md` on a per-feature basis. E
|
|
|
966
1044
|
**Dispatch:** Call the Agent tool N times in ONE message — one per `feature_id`:
|
|
967
1045
|
|
|
968
1046
|
- Description: "Product Reality Audit: {feature_label}"
|
|
969
|
-
- subagent_type: product-reality-auditor
|
|
1047
|
+
- agent_type: product-reality-auditor — subagent_type: product-reality-auditor
|
|
970
1048
|
- Prompt: "[CONTEXT header above] Audit feature_id: {feature_id}. Follow your Cognitive Protocol (ABSORB → QUERY → SYNTHESIZE → EXECUTE → CLASSIFY → SCORE → WRITE). Write evidence to docs/plans/evidence/product-reality/{feature_id}/. Report manifest of evidence paths back."
|
|
971
1049
|
|
|
972
1050
|
**Post-dispatch verification:** After all Track B auditors return, verify each feature has the four evidence files (`tests-generated.md`, `results.json`, `findings.json`, `coverage.json`) AND that each JSON file parses as valid JSON. If any feature is missing a file or has a malformed JSON file, log `TRACK B EVIDENCE MISSING/MALFORMED: {feature_id}: {path}` to `docs/plans/build-log.md` and re-dispatch that feature's auditor once (this distinguishes the retry from the first attempt). If the second attempt still fails, emit a synthetic finding with `target_phase: 1, target_task_or_step: "1.6"` (the auditor failing twice on the same feature is a strong signal the spec for that feature is malformed) and let it route through the existing spec-gap path at Step 5.4.
|
|
@@ -979,9 +1057,9 @@ Call the Agent tool 3 times in one message:
|
|
|
979
1057
|
|
|
980
1058
|
1. Description: "E2E runner" — INTERNAL inline role-string — mode: "bypassPermissions" — Prompt: "Run Playwright E2E test generation, execution, and stability check per `protocols/web-phase-branches.md` Phase 5 E2E steps (generate and run E2E tests for User Journeys, 3 mandatory iterations for flakiness detection). Report results + artifact paths. Records results to `docs/plans/evidence/e2e/iter-3-results.json`. Scope: multi-feature User Journeys ONLY (login → browse → buy, signup → onboarding → first-action). Single-feature happy paths are covered by Track B per-feature auditors at Step 5.2 — do NOT duplicate. Additionally, read the `## Cross-Feature Interactions` section from `docs/plans/product-spec.md`. For each cross-feature rule (e.g., 'Auth → Checkout: user must be authenticated'), generate a targeted E2E test that verifies the rule holds. These are NOT user journeys — they are specific behavioral contracts between features."
|
|
981
1059
|
|
|
982
|
-
2. Description: "Dogfood the app" — subagent_type: `testing-evidence-collector`
|
|
1060
|
+
2. Description: "Dogfood the app" — agent_type: `testing-evidence-collector` — subagent_type: `testing-evidence-collector`
|
|
983
1061
|
|
|
984
|
-
3. Description: "Fake-data detector" — subagent_type: `silent-failure-hunter` — mode: "bypassPermissions" — Prompt: "Run the Fake Data Detector Protocol (`protocols/fake-data-detector.md`). Static analysis: grep for Math.random() in business data paths, hardcoded API responses, setTimeout faking async, placeholder text. Dynamic analysis: inspect HAR files from `docs/plans/evidence/` for missing real API calls, static responses, absent WebSocket traffic. Write findings to `docs/plans/evidence/fake-data-audit.md` with file:line refs and severity."
|
|
1062
|
+
3. Description: "Fake-data detector" — agent_type: `silent-failure-hunter` — subagent_type: `silent-failure-hunter` — mode: "bypassPermissions" — Prompt: "Run the Fake Data Detector Protocol (`protocols/fake-data-detector.md`). Static analysis: grep for Math.random() in business data paths, hardcoded API responses, setTimeout faking async, placeholder text. Dynamic analysis: inspect HAR files from `docs/plans/evidence/` for missing real API calls, static responses, absent WebSocket traffic. Write findings to `docs/plans/evidence/fake-data-audit.md` with file:line refs and severity."
|
|
985
1063
|
|
|
986
1064
|
### Step 5.4 — Feedback Synthesizer
|
|
987
1065
|
|
|
@@ -1001,7 +1079,7 @@ If total findings > 40: split into two sequential dispatches:
|
|
|
1001
1079
|
- **Pass 1 (mechanical routing):** Track B findings (pre-routed, validate only) + Track A findings (static routing) + E2E failures (route to phase 4) + fake-data findings (route to phase 4). These require minimal graph queries. Output: `docs/plans/evidence/dogfood/classified-findings-pass1.json`.
|
|
1002
1080
|
- **Pass 2 (graph-heavy classification):** Dogfood findings only (need full graph-based classification). Input includes pass-1 output for dedup. Output: merge pass-1 + pass-2 into final `docs/plans/evidence/dogfood/classified-findings.json`.
|
|
1003
1081
|
|
|
1004
|
-
Call the Agent tool — description: "Synthesize all findings" — subagent_type: `product-feedback-synthesizer` — Prompt: "[CONTEXT header above] Interpret findings from Track A, Track B, and Cross-cutting streams. Inputs:
|
|
1082
|
+
Call the Agent tool — description: "Synthesize all findings" — agent_type: `product-feedback-synthesizer` — subagent_type: `product-feedback-synthesizer` — Prompt: "[CONTEXT header above] Interpret findings from Track A, Track B, and Cross-cutting streams. Inputs:
|
|
1005
1083
|
|
|
1006
1084
|
- `docs/plans/evidence/dogfood/findings.md` — autonomous exploration findings, each requires classification + routing
|
|
1007
1085
|
- `docs/plans/evidence/product-reality/*/findings.json` — one per feature (web uses agent-browser evidence; iOS uses XcodeBuildMCP + Maestro evidence). Each Track B finding ALREADY CARRIES `target_phase` and `target_task_or_step` set by the product-reality-auditor. VALIDATE these against the graph (same `graph_query_dependencies` walk used for dogfood findings) and pass through if valid; only re-route if validation fails (e.g., the targeted task no longer exists in the task DAG).
|
|
@@ -1074,7 +1152,7 @@ If any required file does not exist or is empty, do NOT dispatch Reality Checker
|
|
|
1074
1152
|
|
|
1075
1153
|
**CONTEXT header:** Render `rendered_context_header` for phase 6 per the canonical template (see CONTEXT HEADER HARD-GATE above). Prepend to every Phase 6 prompt below (Reality Checker + the 5 LRR chapters).
|
|
1076
1154
|
|
|
1077
|
-
Call the Agent tool — description: "Evidence sweep" — subagent_type: `testing-reality-checker` — Prompt: "[CONTEXT header above] You are the Reality Checker — evidence-sweep role only. Default verdict: NONE. You receive evidence by FILE PATH only — never by paste. Use Read and Glob tools to verify each file exists, is non-empty, was modified within this build session, contains no placeholder strings ('TODO', 'PLACEHOLDER', 'TBD', 'FIXME', 'XXX').
|
|
1155
|
+
Call the Agent tool — description: "Evidence sweep" — agent_type: `testing-reality-checker` — subagent_type: `testing-reality-checker` — Prompt: "[CONTEXT header above] You are the Reality Checker — evidence-sweep role only. Default verdict: NONE. You receive evidence by FILE PATH only — never by paste. Use Read and Glob tools to verify each file exists, is non-empty, was modified within this build session, contains no placeholder strings ('TODO', 'PLACEHOLDER', 'TBD', 'FIXME', 'XXX').
|
|
1078
1156
|
|
|
1079
1157
|
Evidence paths to verify: [orchestrator pastes the precondition list per project_type].
|
|
1080
1158
|
|
|
@@ -1097,31 +1175,31 @@ Dispatch 5 chapter judges in parallel. Each receives fresh context, its own evid
|
|
|
1097
1175
|
|
|
1098
1176
|
Call the Agent tool 5 times in ONE message. Note: the Eng-Quality chapter dispatches `code-reviewer` as primary, with a parallel `pr-test-analyzer` sub-dispatch for test-coverage adequacy evidence that feeds into the Eng-Quality verdict file.
|
|
1099
1177
|
|
|
1100
|
-
1. Description: "LRR Eng-Quality chapter" — subagent_type: `code-reviewer` — Prompt: "[CONTEXT header above] You are the Eng-Quality chapter of the Launch Readiness Review. Your natural tendency is to be encouraging. Fight it. Default verdict: NEEDS WORK.
|
|
1178
|
+
1. Description: "LRR Eng-Quality chapter" — agent_type: `code-reviewer` — subagent_type: `code-reviewer` — Prompt: "[CONTEXT header above] You are the Eng-Quality chapter of the Launch Readiness Review. Your natural tendency is to be encouraging. Fight it. Default verdict: NEEDS WORK.
|
|
1101
1179
|
|
|
1102
1180
|
Read: `docs/plans/architecture.md`, `docs/plans/design-doc.md` (PRD), `docs/plans/sprint-tasks.md`, `docs/plans/.task-outputs/`, `protocols/verify.md` check outputs from `.build-state.json`, test results from Phase 4 and 5, `docs/plans/evidence/product-reality/*/coverage.json` (Track B per-feature coverage). Also read `docs/plans/decisions.jsonl` for cross-chapter context.
|
|
1103
1181
|
|
|
1104
1182
|
Requirements coverage is sourced from Phase 5 Track B evidence — do NOT recompute. Read every `docs/plans/evidence/product-reality/*/coverage.json` (one per feature). Aggregate the per-feature `coverage_pct` and `status` fields into a single `requirements_coverage[]` array on your verdict, one entry per feature with `{feature_id, feature_label, status, coverage_pct, blocker_summary}` where `blocker_summary` is a short string distilling `missing_states + broken_transitions + unenforced_rules + persona_constraint_violations` from coverage.json. Any `MISSING` status is a BLOCK finding. Any `PARTIAL` is CONCERNS at minimum. If a `coverage.json` file is missing for a feature listed in product-spec.md, that itself is a BLOCK finding (Track B did not run for that feature — pipeline integrity issue).
|
|
1105
1183
|
|
|
1106
|
-
Before writing the final verdict, spawn a parallel subagent dispatch: description: 'LRR test coverage adequacy' — subagent_type: `pr-test-analyzer` — prompt: 'You are a test-coverage auditor for the Eng-Quality LRR chapter. Read the test files under tests/, task-outputs/, and behavioral-test stub detector output. Evaluate: (1) do declared behavioral tests have non-stub bodies, (2) does coverage match the PR diff scope, (3) are edge cases covered, (4) are any tests flaky markers set. Return a JSON summary with test_coverage_score (0-100), stub_flagged_count, edge_case_gap_count, recommendations[]. Save to docs/plans/evidence/lrr/eng-quality-coverage.json.' Read the resulting eng-quality-coverage.json and fold its findings into your verdict.
|
|
1184
|
+
Before writing the final verdict, spawn a parallel subagent dispatch: description: 'LRR test coverage adequacy' — agent_type: `pr-test-analyzer` — subagent_type: `pr-test-analyzer` — prompt: 'You are a test-coverage auditor for the Eng-Quality LRR chapter. Read the test files under tests/, task-outputs/, and behavioral-test stub detector output. Evaluate: (1) do declared behavioral tests have non-stub bodies, (2) does coverage match the PR diff scope, (3) are edge cases covered, (4) are any tests flaky markers set. Return a JSON summary with test_coverage_score (0-100), stub_flagged_count, edge_case_gap_count, recommendations[]. Save to docs/plans/evidence/lrr/eng-quality-coverage.json.' Read the resulting eng-quality-coverage.json and fold its findings into your verdict.
|
|
1107
1185
|
|
|
1108
1186
|
Evaluate code quality + test coverage adequacy + architecture conformance + requirements coverage TOGETHER (single coherent view — merged from old Eng + QA chapters). Check: do declared behavioral tests actually exercise the features? Are there stub-flagged tests? Do tests match task acceptance criteria? Does the built code match architecture MUSTs? Are features all COVERED?
|
|
1109
1187
|
|
|
1110
1188
|
Write verdict to `docs/plans/evidence/lrr/eng-quality.json` per `protocols/launch-readiness.md` schema. Fields: `chapter=eng-quality`, `verdict` (PASS|CONCERNS|BLOCK), `override_blocks_launch` (false unless BLOCK), `evidence_files_read` (non-empty, MUST include eng-quality-coverage.json), `findings[]` (each with `severity`, `description`, `evidence_ref`, `related_decision_id` if blocker ties to a decisions.jsonl row), `requirements_coverage[]` (shape per the Track B aggregation paragraph above — `{feature_id, feature_label, status, coverage_pct, blocker_summary}`), `follow_up_spawned=false`, `follow_up_findings=null`. Eng-Quality CANNOT spawn follow-ups."
|
|
1111
1189
|
|
|
1112
|
-
2. Description: "LRR Security chapter" — subagent_type: `security-reviewer` — Prompt: "[CONTEXT header above] You are the Security chapter of the LRR. Read: `docs/plans/evidence/fake-data-audit.md`, Phase 5 security audit output (from Step 5.1). Also read `docs/plans/decisions.jsonl` for context.
|
|
1190
|
+
2. Description: "LRR Security chapter" — agent_type: `security-reviewer` — subagent_type: `security-reviewer` — Prompt: "[CONTEXT header above] You are the Security chapter of the LRR. Read: `docs/plans/evidence/fake-data-audit.md`, Phase 5 security audit output (from Step 5.1). Also read `docs/plans/decisions.jsonl` for context.
|
|
1113
1191
|
|
|
1114
1192
|
Evaluate auth model, input validation, secrets management, dependency vulnerabilities. Write verdict to `docs/plans/evidence/lrr/security.json` per schema. Fields: `chapter=security`, `verdict`, `override_blocks_launch`, `evidence_files_read` (non-empty), `findings[]` (with `related_decision_id` when applicable), `follow_up_spawned` (boolean), `follow_up_findings` (null or typed object).
|
|
1115
1193
|
|
|
1116
1194
|
Security MAY spawn ONE read-only follow-up investigation, but ONLY if verdict would be BLOCK — NOT on suspicion. This is tightened from current behavior. Follow-up: read-only, Read/Grep/Glob only, max 15 tool calls, self-report tool_calls_used. See `protocols/launch-readiness.md` for follow-up flow."
|
|
1117
1195
|
|
|
1118
|
-
3. Description: "LRR SRE chapter" — subagent_type: `engineering-sre` — Prompt: "[CONTEXT header above] You are the SRE chapter of the LRR. Read: performance-audit outputs from Phase 5 (Step 5.1 performance auditor), Performance Benchmarker evidence, NFRs from `docs/plans/quality-targets.json` and `docs/plans/sprint-tasks.md`, reliability checks. Also read `docs/plans/decisions.jsonl` for context.
|
|
1196
|
+
3. Description: "LRR SRE chapter" — agent_type: `engineering-sre` — subagent_type: `engineering-sre` — Prompt: "[CONTEXT header above] You are the SRE chapter of the LRR. Read: performance-audit outputs from Phase 5 (Step 5.1 performance auditor), Performance Benchmarker evidence, NFRs from `docs/plans/quality-targets.json` and `docs/plans/sprint-tasks.md`, reliability checks. Also read `docs/plans/decisions.jsonl` for context.
|
|
1119
1197
|
|
|
1120
1198
|
Evaluate whether the build meets NFR targets (response time, load handling, error rates) and is production-ready under load. Bundle-size budget violations (>25% over Scope budget) auto-block. Write verdict to `docs/plans/evidence/lrr/sre.json` per schema.
|
|
1121
1199
|
|
|
1122
1200
|
SRE MAY spawn ONE read-only follow-up investigation, but ONLY if verdict would be BLOCK. Same caps as Security."
|
|
1123
1201
|
|
|
1124
|
-
4. Description: "LRR A11y chapter" — subagent_type: `a11y-architect` — Prompt: "[CONTEXT header above] You are the A11y chapter of the LRR (NEW SEAT in this panel — closes the biggest coverage gap). Read: Phase 5 a11y audit output (from Step 5.1), WCAG 2.2 AA runtime check, per-page accessibility findings, `docs/plans/quality-targets.json` a11y section.
|
|
1202
|
+
4. Description: "LRR A11y chapter" — agent_type: `a11y-architect` — subagent_type: `a11y-architect` — Prompt: "[CONTEXT header above] Advisory only — BLOCK verdict requires Critical-severity violations only. Serious issues are CONCERNS, not BLOCK. You are the A11y chapter of the LRR (NEW SEAT in this panel — closes the biggest coverage gap). Read: Phase 5 a11y audit output (from Step 5.1), WCAG 2.2 AA runtime check, per-page accessibility findings, `docs/plans/quality-targets.json` a11y section.
|
|
1125
1203
|
|
|
1126
1204
|
Scoring rules:
|
|
1127
1205
|
- PASS if zero Serious + zero Critical findings
|
|
@@ -1130,7 +1208,7 @@ Scoring rules:
|
|
|
1130
1208
|
|
|
1131
1209
|
Write verdict to `docs/plans/evidence/lrr/a11y.json` per schema. A11y CANNOT spawn follow-ups."
|
|
1132
1210
|
|
|
1133
|
-
5. Description: "LRR Brand Guardian chapter" — subagent_type: `design-brand-guardian` — Prompt: "[CONTEXT header above] You are the Brand Guardian chapter of the LRR (REPLACES the old Design mechanical check — real taste judgment, not a 15-line mechanical gate). Your natural tendency is to be encouraging. Fight it. Default verdict: NEEDS WORK.
|
|
1211
|
+
5. Description: "LRR Brand Guardian chapter" — agent_type: `design-brand-guardian` — subagent_type: `design-brand-guardian` — Prompt: "[CONTEXT header above] You are the Brand Guardian chapter of the LRR (REPLACES the old Design mechanical check — real taste judgment, not a 15-line mechanical gate). Your natural tendency is to be encouraging. Fight it. Default verdict: NEEDS WORK.
|
|
1134
1212
|
|
|
1135
1213
|
Read: `DESIGN.md` (full file — `## Overview > ### Brand DNA` is the locked 7-axis card from Phase 3.0; YAML tokens are what Phase 4 was supposed to honor; `## Do's and Don'ts` are the explicit guardrails), `docs/plans/design-references.md`, Playwright screenshots under `docs/plans/evidence/` matching production pages, Phase 3.6 Design Critic final score from `.build-state.json`.
|
|
1136
1214
|
|
|
@@ -1242,13 +1320,13 @@ Do not loop forever.
|
|
|
1242
1320
|
|
|
1243
1321
|
**CONTEXT header:** Render `rendered_context_header` for phase 7 per the canonical template (see CONTEXT HEADER HARD-GATE above). Prepend to every Phase 7 prompt below.
|
|
1244
1322
|
|
|
1245
|
-
1. Description: "Technical Writer" — subagent_type: `engineering-technical-writer` — mode: "bypassPermissions" — Prompt: "[CONTEXT header above] Write project docs: README with setup/architecture/usage, API docs if applicable, deployment notes. The README is the first thing a new developer reads — optimize for that reader. Commit: 'docs: project documentation'. Deployment target per the PRD (Vercel/Netlify/Railway/Fly.io/etc.) — include the deploy flow specific to that target in the README."
|
|
1323
|
+
1. Description: "Technical Writer" — agent_type: `engineering-technical-writer` — subagent_type: `engineering-technical-writer` — mode: "bypassPermissions" — Prompt: "[CONTEXT header above] Write project docs: README with setup/architecture/usage, API docs if applicable, deployment notes. The README is the first thing a new developer reads — optimize for that reader. Commit: 'docs: project documentation'. Deployment target per the PRD (Vercel/Netlify/Railway/Fly.io/etc.) — include the deploy flow specific to that target in the README."
|
|
1246
1324
|
|
|
1247
1325
|
2. Documentation Metric Loop: Run the Metric Loop Protocol (callable service) on documentation. Define a metric based on completeness and whether a new developer could follow the README end-to-end. Max 3 iterations.
|
|
1248
1326
|
|
|
1249
|
-
3. Description: "App Store Optimizer" (iOS only, conditional on ship) — subagent_type: `marketing-app-store-optimizer` — Prompt per `protocols/ios-phase-branches.md` §Phase 7 (asc-* flow — app name, subtitle, keywords, description, screenshots, privacy labels). Prepend CONTEXT header above. Skip entirely for web.
|
|
1327
|
+
3. Description: "App Store Optimizer" (iOS only, conditional on ship) — agent_type: `marketing-app-store-optimizer` — subagent_type: `marketing-app-store-optimizer` — Prompt per `protocols/ios-phase-branches.md` §Phase 7 (asc-* flow — app name, subtitle, keywords, description, screenshots, privacy labels). Prepend CONTEXT header above. Skip entirely for web.
|
|
1250
1328
|
|
|
1251
|
-
4. Description: "Deploy" — subagent_type: `engineering-devops-automator` — mode: "bypassPermissions" — Prompt: "[CONTEXT header above] Deploy the app to the target from the PRD (`docs/plans/design-doc.md#tech-stack`). Run pre-deploy checks: build, env vars, secrets. Execute deploy. Verify the deployed URL returns 200 and serves the built app (not the placeholder). Report deploy URL and any smoke-test findings."
|
|
1329
|
+
4. Description: "Deploy" — agent_type: `engineering-devops-automator` — subagent_type: `engineering-devops-automator` — mode: "bypassPermissions" — Prompt: "[CONTEXT header above] Deploy the app to the target from the PRD (`docs/plans/design-doc.md#tech-stack`). Run pre-deploy checks: build, env vars, secrets. Execute deploy. Verify the deployed URL returns 200 and serves the built app (not the placeholder). Report deploy URL and any smoke-test findings."
|
|
1252
1330
|
|
|
1253
1331
|
5. Description: "Completion Report" — INTERNAL inline role-string — Prompt: "[CONTEXT header above] You are the Completion Report writer. Draw verification surface from THREE sources: the LRR Aggregator's structured output (`docs/plans/evidence/lrr-aggregate.json`), the Reality Checker evidence manifest (`docs/plans/evidence/reality-check-manifest.json`), and the build state (`docs/plans/.build-state.json` — for backward-routing counts and mode transitions per state-schema v2). Do NOT draw from orchestrator summary prose. Present:
|
|
1254
1332
|
|