@lifeaitools/rdc-skills 0.24.38 → 0.24.39
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/settings.json +15 -15
- package/.claude-plugin/marketplace.json +21 -21
- package/.claude-plugin/plugin.json +1371 -1371
- package/.github/workflows/publish.yml +34 -34
- package/.github/workflows/self-test.yml +58 -58
- package/CHANGELOG.md +310 -310
- package/LICENSE +21 -21
- package/MANIFEST.md +221 -221
- package/README.md +377 -377
- package/README.sandbox.md +3 -3
- package/assets/watcher/viewer.html +164 -164
- package/bin/rdc-skills-mcp.mjs +316 -316
- package/commands/build.md +183 -183
- package/commands/collab.md +180 -180
- package/commands/deploy.md +152 -152
- package/commands/design.md +31 -31
- package/commands/edit.md +28 -28
- package/commands/fixit.md +124 -124
- package/commands/handoff.md +173 -173
- package/commands/help.md +95 -95
- package/commands/overnight.md +220 -220
- package/commands/plan.md +158 -158
- package/commands/preplan.md +131 -131
- package/commands/prototype.md +145 -145
- package/commands/release.md +49 -49
- package/commands/report.md +99 -99
- package/commands/review.md +120 -120
- package/commands/self-test.md +113 -113
- package/commands/status.md +86 -86
- package/commands/watch.md +98 -98
- package/commands/workitems.md +137 -137
- package/git-sha.json +1 -1
- package/guides/agent-bootstrap.md +295 -295
- package/guides/agents/backend.md +104 -104
- package/guides/agents/content.md +94 -94
- package/guides/agents/cs2.md +56 -56
- package/guides/agents/data.md +87 -87
- package/guides/agents/design.md +77 -77
- package/guides/agents/frontend.md +92 -92
- package/guides/agents/infrastructure.md +81 -81
- package/guides/agents/setup.md +281 -281
- package/guides/agents/verify.md +151 -151
- package/guides/agents/viz.md +106 -106
- package/guides/backend.md +146 -146
- package/guides/content.md +147 -147
- package/guides/cs2.md +190 -190
- package/guides/data.md +123 -123
- package/guides/design.md +116 -116
- package/guides/engineering-behavior.md +43 -43
- package/guides/escalation-protocol.md +125 -125
- package/guides/frontend.md +151 -151
- package/guides/history-md-spec.md +297 -297
- package/guides/infrastructure.md +179 -179
- package/guides/lessons-learned-spec.md +153 -153
- package/guides/output-contract.md +108 -108
- package/guides/publish-md-spec.md +289 -289
- package/guides/rdc-skills-startup.md +30 -30
- package/guides/verify.md +11 -11
- package/hooks/check-cwd.js +31 -31
- package/hooks/check-rdc-environment.js +164 -164
- package/hooks/check-services.js +6 -6
- package/hooks/check-stale-work-items.js +19 -19
- package/hooks/foreground-process-gate.js +128 -128
- package/hooks/gate-watchdog-selfcheck.js +257 -257
- package/hooks/hook-logger.js +25 -25
- package/hooks/lib/run-evidence-gate.mjs +241 -241
- package/hooks/no-stop-open-epics.js +127 -127
- package/hooks/post-tool-batch-gate.js +203 -203
- package/hooks/post-work-check.js +21 -21
- package/hooks/postcompact-log.js +13 -13
- package/hooks/precompact-log.js +13 -13
- package/hooks/rate-limit-retry.js +46 -46
- package/hooks/rdc-invocation-marker.js +157 -157
- package/hooks/rdc-output-contract-gate.js +94 -94
- package/hooks/require-work-item-on-commit.js +294 -294
- package/hooks/restart-brief.js +19 -19
- package/hooks/run-hidden-hook.ps1 +47 -47
- package/hooks/task-completed-gate.js +274 -274
- package/hooks/work-item-exit-gate.js +944 -944
- package/lib/catalog.mjs +236 -236
- package/lib/cloud-rewrite.mjs +155 -155
- package/package.json +56 -56
- package/rules/work-items-rpc.md +520 -520
- package/scaffold/templates/HISTORY.md.template +39 -39
- package/scaffold/templates/PUBLISH.md.template +21 -21
- package/scaffold/templates/brochure-studio-default.html +70 -70
- package/scripts/acceptance.mjs +502 -502
- package/scripts/fixtures/guides/bad-guide.md +15 -15
- package/scripts/fixtures/guides-clean/good-guide.md +16 -16
- package/scripts/install-rdc-skills.js +1289 -1289
- package/scripts/install.ps1 +202 -202
- package/scripts/install.sh +132 -132
- package/scripts/lib/assertions.mjs +287 -287
- package/scripts/lib/manifest-schema.mjs +754 -754
- package/scripts/lib/runner.mjs +465 -465
- package/scripts/lib/sandbox.mjs +435 -435
- package/scripts/prepack.mjs +32 -32
- package/scripts/rdc-brochure.mjs +464 -464
- package/scripts/rdc-design-cli.mjs +134 -134
- package/scripts/rebuild-mcp.mjs +107 -107
- package/scripts/self-test.mjs +1460 -1460
- package/scripts/stamp-git-sha.mjs +29 -29
- package/scripts/test-guide-validator.mjs +196 -196
- package/scripts/test-rdc-hooks.mjs +145 -145
- package/scripts/uninstall.ps1 +77 -77
- package/scripts/uninstall.sh +69 -69
- package/scripts/update.ps1 +43 -43
- package/scripts/update.sh +43 -43
- package/scripts/validate-place-histories.js +461 -461
- package/scripts/validate-publish-manifests.js +424 -424
- package/scripts/watch-init.mjs +100 -100
- package/skills/brochure/SKILL.md +107 -107
- package/skills/build/SKILL.md +563 -563
- package/skills/channel-formatter/SKILL.md +533 -533
- package/skills/co-develop/SKILL.md +196 -196
- package/skills/collab/SKILL.md +239 -239
- package/skills/convert/SKILL.md +140 -140
- package/skills/deploy/SKILL.md +541 -541
- package/skills/design/SKILL.md +211 -211
- package/skills/design/reference/ownership.md +16 -16
- package/skills/design/reference/rampa.md +92 -92
- package/skills/design/reference/studio-model.md +153 -153
- package/skills/edit/SKILL.md +98 -98
- package/skills/fixit/SKILL.md +165 -165
- package/skills/fs-mcp/SKILL.md +148 -148
- package/skills/handoff/SKILL.md +236 -200
- package/skills/help/SKILL.md +143 -143
- package/skills/housekeeping/SKILL.md +189 -189
- package/skills/lifeai-brochure-author/SKILL.md +340 -340
- package/skills/overnight/SKILL.md +251 -251
- package/skills/plan/SKILL.md +345 -345
- package/skills/preplan/SKILL.md +90 -90
- package/skills/prototype/SKILL.md +150 -150
- package/skills/rdc-brochurify/SKILL.md +245 -245
- package/skills/rdc-extract-verifier-rules/SKILL.md +191 -191
- package/skills/release/SKILL.md +140 -140
- package/skills/report/SKILL.md +100 -100
- package/skills/review/SKILL.md +152 -152
- package/skills/rpms-filemap/SKILL.cloud.md +111 -111
- package/skills/rpms-filemap/SKILL.md +111 -111
- package/skills/self-test/SKILL.md +132 -132
- package/skills/status/SKILL.md +99 -99
- package/skills/terminal-config/SKILL.md +62 -62
- package/skills/tests/MATRIX.md +54 -54
- package/skills/tests/README.md +47 -47
- package/skills/tests/rdc-brochure.test.json +34 -34
- package/skills/tests/rdc-build.test.json +36 -36
- package/skills/tests/rdc-channel-formatter.test.json +45 -45
- package/skills/tests/rdc-co-develop.test.json +29 -29
- package/skills/tests/rdc-collab.test.json +29 -29
- package/skills/tests/rdc-convert.test.json +35 -35
- package/skills/tests/rdc-deploy.test.json +30 -30
- package/skills/tests/rdc-design.test.json +27 -27
- package/skills/tests/rdc-edit.test.json +29 -29
- package/skills/tests/rdc-fixit.test.json +36 -36
- package/skills/tests/rdc-fs-mcp.test.json +36 -36
- package/skills/tests/rdc-handoff.test.json +28 -28
- package/skills/tests/rdc-help.test.json +29 -29
- package/skills/tests/rdc-housekeeping.test.json +31 -31
- package/skills/tests/rdc-lifeai-brochure-author.test.json +35 -35
- package/skills/tests/rdc-overnight.test.json +37 -37
- package/skills/tests/rdc-plan.test.json +27 -27
- package/skills/tests/rdc-preplan.test.json +31 -31
- package/skills/tests/rdc-prototype.test.json +28 -28
- package/skills/tests/rdc-rdc-brochurify.test.json +23 -23
- package/skills/tests/rdc-rdc-extract-verifier-rules.test.json +34 -34
- package/skills/tests/rdc-release.test.json +29 -29
- package/skills/tests/rdc-report.test.json +28 -28
- package/skills/tests/rdc-review.test.json +29 -29
- package/skills/tests/rdc-rpms-filemap.test.json +28 -28
- package/skills/tests/rdc-self-test.test.json +24 -24
- package/skills/tests/rdc-status.test.json +29 -29
- package/skills/tests/rdc-terminal-config.test.json +29 -29
- package/skills/tests/rdc-watch.test.json +24 -24
- package/skills/tests/rdc-workitems.test.json +27 -27
- package/skills/watch/SKILL.md +97 -97
- package/skills/workitems/SKILL.md +151 -151
- package/tests/acceptance.test.mjs +59 -59
- package/tests/channel-formatter.contract.test.mjs +251 -251
- package/tests/curl-surface.test.mjs +289 -289
- package/tests/harness-gates.test.mjs +325 -325
- package/tests/help-surface.test.mjs +61 -61
- package/tests/install-rdc-skills.test.mjs +49 -49
- package/tests/manifest-contract-fields.test.mjs +78 -78
- package/tests/mcp.test.mjs +271 -271
- package/tests/require-work-item-on-commit.test.mjs +162 -162
- package/tests/run-evidence-gate.test.mjs +82 -82
- package/tests/skill-test-matrix.test.mjs +66 -66
- package/tests/validate-skills.js +27 -27
- package/tests/work-item-exit-gate-l2.test.mjs +368 -368
- package/tests/work-item-exit-gate-l3.test.mjs +197 -197
package/skills/build/SKILL.md
CHANGED
|
@@ -1,563 +1,563 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: rdc:build
|
|
3
|
-
description: "Usage `rdc:build <epic-id>` — You have a planned epic with tasks ready to execute. Dispatches parallel typed agents, each commits atomically to develop, runs a mandatory per-wave code-review gate (pr-review-toolkit:code-reviewer), closes work items, and runs the validator gate. Call after rdc:plan or when told to build."
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
> **⚠️ OUTPUT CONTRACT (READ FIRST):** `guides/output-contract.md`
|
|
7
|
-
> Checklist-only output. No tool-call narration. No raw MCP/JSON/log dumps.
|
|
8
|
-
> One checklist upfront, updated in place, shown again at end with a 1-line verdict.
|
|
9
|
-
|
|
10
|
-
> **Sandbox contract:** This skill honors `RDC_TEST=1` per `guides/agent-bootstrap.md` § RDC_TEST Sandbox Contract. Destructive external calls short-circuit under the flag.
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
# rdc:build — Typed Agent Dispatch Engine
|
|
14
|
-
|
|
15
|
-
## When to Use
|
|
16
|
-
- Plan is approved and ready to execute
|
|
17
|
-
- Project lead says "build it", "go", "execute", "do not stop"
|
|
18
|
-
- An epic exists with child tasks ready for implementation
|
|
19
|
-
- Called by `rdc:overnight` as part of the automated build loop
|
|
20
|
-
|
|
21
|
-
## Arguments
|
|
22
|
-
- `rdc:build <epic-id>` — build from a specific Supabase epic
|
|
23
|
-
- `rdc:build <topic>` — find the epic by label/title match
|
|
24
|
-
- `rdc:build` (no args) — show open epics and ask which to build (interactive only)
|
|
25
|
-
- `rdc:build <epic-id> --unattended` — silent mode for overnight builds
|
|
26
|
-
|
|
27
|
-
## Agent Types & Guide Files
|
|
28
|
-
|
|
29
|
-
Every dispatched agent MUST read two files before starting — in this order:
|
|
30
|
-
1. `{PROJECT_ROOT}/.rdc/guides/agent-bootstrap.md` — credentials, git rules, completion report format
|
|
31
|
-
(fallback: `.rdc/guides/agent-bootstrap.md` relative to cwd if `{PROJECT_ROOT}` is not substituted)
|
|
32
|
-
2. `{PROJECT_ROOT}/.rdc/guides/engineering-behavior.md` — assumptions, minimal changes, surgical scope, verification evidence
|
|
33
|
-
(fallback: `.rdc/guides/engineering-behavior.md` relative to cwd if `{PROJECT_ROOT}` is not substituted)
|
|
34
|
-
3. `{PROJECT_ROOT}/.rdc/guides/<type>.md` — role-specific guide
|
|
35
|
-
(fallback: `.rdc/guides/<type>.md` relative to cwd if `{PROJECT_ROOT}` is not substituted)
|
|
36
|
-
|
|
37
|
-
Include both lines in every agent prompt:
|
|
38
|
-
```
|
|
39
|
-
"Read {PROJECT_ROOT}/.rdc/guides/agent-bootstrap.md first (fallback: .rdc/guides/agent-bootstrap.md), then {PROJECT_ROOT}/.rdc/guides/engineering-behavior.md (fallback: .rdc/guides/engineering-behavior.md), then {PROJECT_ROOT}/.rdc/guides/<type>.md (fallback: .rdc/guides/<type>.md) before starting."
|
|
40
|
-
```
|
|
41
|
-
|
|
42
|
-
| Agent Type | Guide File | When to dispatch |
|
|
43
|
-
|-----------|-----------|-----------------|
|
|
44
|
-
| `frontend` | `.rdc/guides/frontend.md` | React components, pages, UI, Tailwind, animation |
|
|
45
|
-
| `backend` | `.rdc/guides/backend.md` | API routes, server components, database queries, auth |
|
|
46
|
-
| `data` | `.rdc/guides/data.md` | Migrations, schema changes, RPC functions |
|
|
47
|
-
| `design` | `.rdc/guides/design.md` | Visual design, brand palettes, OG images, token work |
|
|
48
|
-
| `infra` | `.rdc/guides/infrastructure.md` | CI/CD, deployment, DNS, SSL |
|
|
49
|
-
| `content` | `.rdc/guides/content.md` | Marketing copy, messaging, tone |
|
|
50
|
-
| `cs2` | `.rdc/guides/cs2.md` | CS 2.0 paradigm work (generic) |
|
|
51
|
-
| `hail` | `.rdc/guides/cs2.md` + `packages/hail/CLAUDE.md` | Grammar, DSL compiler, evolution |
|
|
52
|
-
| `pal` | `.rdc/guides/cs2.md` + `packages/pal/CLAUDE.md` | Sessions, moment windows, graph memory |
|
|
53
|
-
| `bpmn` | `.rdc/guides/cs2.md` + `docs/systems/<domain>/flowable-bpmn-architecture.md` | BPMN flows, governance |
|
|
54
|
-
| `virtue` | `.rdc/guides/cs2.md` + `packages/virtue-engine/CLAUDE.md` | Virtue weights, coherence, certification |
|
|
55
|
-
| `viz` | `.rdc/guides/frontend.md` + `.rdc/guides/design.md` | Custom viz components, charts, diagrams |
|
|
56
|
-
|
|
57
|
-
### How to classify a task → agent type
|
|
58
|
-
|
|
59
|
-
Read the task title and description, then:
|
|
60
|
-
- Mentions React, component, page, UI, Tailwind → `frontend`
|
|
61
|
-
- Mentions API route, server, database query, auth → `backend`
|
|
62
|
-
- Mentions migration, schema, table, RPC → `data`
|
|
63
|
-
- Mentions brand, palette, typography, OG image → `design`
|
|
64
|
-
- Mentions deploy, infrastructure, CI, DNS → `infra`
|
|
65
|
-
- Mentions copy, messaging, email template → `content`
|
|
66
|
-
- Mentions grammar, DSL, compiler → `hail`
|
|
67
|
-
- Mentions session, moment, memory graph → `pal`
|
|
68
|
-
- Mentions BPMN, flow, governance → `bpmn`
|
|
69
|
-
- Mentions virtue, coherence, certification → `virtue`
|
|
70
|
-
- Mentions visualization, chart, diagram, SVG → `viz`
|
|
71
|
-
- Multiple types? Dispatch multiple agents, each with its guide.
|
|
72
|
-
|
|
73
|
-
## Procedure
|
|
74
|
-
|
|
75
|
-
1. **Load the epic and run pre-flight gate:**
|
|
76
|
-
```sql
|
|
77
|
-
SELECT get_work_items_by_epic('<epic-id>', 'todo');
|
|
78
|
-
```
|
|
79
|
-
|
|
80
|
-
**Session lock — claim the epic immediately (before any agent dispatch):**
|
|
81
|
-
|
|
82
|
-
After loading the epic, check its status:
|
|
83
|
-
- If `status = 'in_progress'` → **ABORT** with:
|
|
84
|
-
```
|
|
85
|
-
SKIP: epic <id> is already in_progress — claimed by another session. Pick a different epic.
|
|
86
|
-
```
|
|
87
|
-
Do NOT proceed. Do NOT dispatch any agents.
|
|
88
|
-
- If `status = 'todo'` or `status = 'blocked'` → immediately claim it:
|
|
89
|
-
```sql
|
|
90
|
-
SELECT update_work_item_status('<epic-id>'::uuid, 'in_progress',
|
|
91
|
-
'["Claimed by build session — dispatching agents"]'::jsonb
|
|
92
|
-
);
|
|
93
|
-
```
|
|
94
|
-
This is an atomic Supabase write. A concurrent session that loads the same epic after this point will see `in_progress` and abort. **Do this before any classification, planning, or agent dispatch.**
|
|
95
|
-
|
|
96
|
-
**Pre-flight gate — run after claiming:**
|
|
97
|
-
|
|
98
|
-
| Condition | Action |
|
|
99
|
-
|-----------|--------|
|
|
100
|
-
| No child tasks returned | → Invoke `rdc:plan` on this epic. Do NOT proceed with build. |
|
|
101
|
-
| Tasks exist but all have empty `description` fields | → Invoke `rdc:plan` on this epic. Tasks without descriptions cannot be safely dispatched. |
|
|
102
|
-
| Plan doc missing `## Checklist Decomposition Matrix` | → Invoke `rdc:plan` on this epic. Do NOT dispatch agents. |
|
|
103
|
-
| Plan doc missing `## Checklist Quality Gate` with `verdict: PASS` | → Invoke `rdc:plan` on this epic. Do NOT dispatch agents. |
|
|
104
|
-
| Any implementation task lacks `decomp-*` items, has < 10 attested rows, or leaves a declared surface (screen/api/db/tool) uncovered | → Invoke `rdc:plan` on this epic. Coarse/under-decomposed checklists cannot be safely dispatched. |
|
|
105
|
-
| Any `decomp-*` item lacks route/file, action, expected result, or evidence artifact | → Invoke `rdc:plan` on this epic. Do NOT dispatch agents. |
|
|
106
|
-
| Tasks exist and have descriptions | → Continue with build. |
|
|
107
|
-
|
|
108
|
-
**Re-planning is not a failure — it is correct behavior.** The build skill is the last gate before agent dispatch; catching an under-specified epic here is cheaper than a wasted agent run.
|
|
109
|
-
|
|
110
|
-
**How to re-plan:**
|
|
111
|
-
- Interactive: tell the user — "Epic has no tasks / tasks lack descriptions — invoking rdc:plan first." Then invoke `rdc:plan <epic-id>`.
|
|
112
|
-
- Unattended: invoke `rdc:plan <epic-id> --unattended` inline, wait for it to complete, then reload tasks and re-run this gate once. If tasks still missing after re-plan, escalate via advisor.
|
|
113
|
-
|
|
114
|
-
**Interactive (no args):** show open epics, ask which to build.
|
|
115
|
-
|
|
116
|
-
2. **CHECK FOR EXISTING WORK (mandatory — never skip):**
|
|
117
|
-
```sql
|
|
118
|
-
-- Check if prototypes exist from earlier sessions
|
|
119
|
-
SELECT name, component, source_path, status, notes
|
|
120
|
-
FROM prototype_registry
|
|
121
|
-
WHERE status IN ('prototype', 'converting')
|
|
122
|
-
ORDER BY created_at DESC;
|
|
123
|
-
|
|
124
|
-
-- Check for design decisions on this topic
|
|
125
|
-
SELECT topic, context_type, summary, source
|
|
126
|
-
FROM design_context
|
|
127
|
-
WHERE topic ILIKE '%<epic-topic>%'
|
|
128
|
-
ORDER BY created_at DESC;
|
|
129
|
-
```
|
|
130
|
-
**If a prototype exists: ADAPT IT. Do not build from scratch.**
|
|
131
|
-
Tell the agent: "Read <source_path> first and convert it to the production contract."
|
|
132
|
-
|
|
133
|
-
**If design decisions exist: follow them.** Include the summary in the agent prompt.
|
|
134
|
-
|
|
135
|
-
3. **Load the plan** (mandatory): check `.rdc/plans/` for matching topic (fallback: `.rdc/plans/`).
|
|
136
|
-
|
|
137
|
-
3b. **Checklist decomposition quality gate (mandatory before code):**
|
|
138
|
-
|
|
139
|
-
`rdc:build` is the final gate before implementation. It MUST reject any plan or work item that is too coarse for an agent to execute and verify independently.
|
|
140
|
-
|
|
141
|
-
Required plan sections:
|
|
142
|
-
- `## Checklist Decomposition Matrix`
|
|
143
|
-
- `## Checklist Quality Gate`
|
|
144
|
-
- `verdict: PASS`
|
|
145
|
-
|
|
146
|
-
Required task checklist shape:
|
|
147
|
-
- Every implementation work item has >= 10 attested `decomp-*`/`test-*` rows and meets the
|
|
148
|
-
per-surface completeness floors from rdc:plan (each declared surface covered; a multi-surface
|
|
149
|
-
WP carries the SUM of its surface floors, typically 12-20). A flat 5-6-row checklist for a
|
|
150
|
-
feature WP is REJECTED — reopen the epic to rdc:plan for full surface-area decomposition.
|
|
151
|
-
- Every implementation work item has at least one `decomp-*` checklist row and one `test-*` checklist row.
|
|
152
|
-
- Every `decomp-*` row names a concrete route or file path.
|
|
153
|
-
- Every `decomp-*` row names one user/agent action.
|
|
154
|
-
- Every `decomp-*` row names one expected UI/API/DB result.
|
|
155
|
-
- Every `decomp-*` row names one verification artifact: test name, route probe, Playwright screenshot, SQL query, API response, type-check, migration proof, or CLI transcript.
|
|
156
|
-
|
|
157
|
-
Atomicity rubric:
|
|
158
|
-
- One observable behavior per `decomp-*` row.
|
|
159
|
-
- The row can pass or fail without reading hidden intent from the plan narrative.
|
|
160
|
-
- The row is small enough for a worker to implement, tick, and cite evidence for directly.
|
|
161
|
-
- Vague rows such as "theme management works", "UI implemented", "verified", "all screens", or "integration complete" are failures.
|
|
162
|
-
|
|
163
|
-
Minimum decomposition heuristics:
|
|
164
|
-
- UI route: at least empty/loading/loaded/error or the documented reason a state does not apply.
|
|
165
|
-
- CRUD surface: at least list, create, edit, detail, duplicate/delete/archive where applicable, and validation failure.
|
|
166
|
-
- API route: at least successful read/write, validation failure, and unauthorized/forbidden or documented auth bypass.
|
|
167
|
-
- DB/migration task: at least schema object, relationship/guard, policy/permission, seed/fixture or backfill, and smoke query.
|
|
168
|
-
- Editor/sidebar/CLI workflow: at least start, attach/open, enqueue action, observe result, timeout/error, and live refresh where applicable.
|
|
169
|
-
|
|
170
|
-
HARD FLOOR (mirrors rdc:plan): every implementation task carries >= 10 attested rows; a
|
|
171
|
-
multi-surface WP carries the SUM of its per-surface floors (typically 12-20). A flat 5-6-row
|
|
172
|
-
feature checklist, or any declared surface (screen/api/db/tool) left uncovered, is a REJECT —
|
|
173
|
-
reopen to rdc:plan. Every row must name its surface + one verification artifact (attested).
|
|
174
|
-
|
|
175
|
-
### ⛔ Deliverable / acceptance check-off table — show BEFORE any implementation
|
|
176
|
-
Before dispatching the first wave, render a deliverable/acceptance table and
|
|
177
|
-
keep it visible through the build (lesson 2026-06-16-build-poor-goal-execution-mdk-brain:
|
|
178
|
-
a build satisfied generic checklist rows — tsc clean, route 200 — while never
|
|
179
|
-
touching the surface the user actually named, because no row anchored the
|
|
180
|
-
user's TARGET SURFACE). The table MUST contain:
|
|
181
|
-
- **One mandatory row for the user-named TARGET SURFACE** — the exact screen,
|
|
182
|
-
endpoint, file, or behavior the user asked for, by name. Its acceptance check
|
|
183
|
-
is what proves THAT surface renders/works, not a proxy.
|
|
184
|
-
- **At least one NEGATIVE verifier row** — a check that proves the WRONG thing
|
|
185
|
-
does NOT happen (e.g. "mock data is NOT rendered", "old route returns 404",
|
|
186
|
-
"stub component is absent from the bundle"). A positive-only suite passes
|
|
187
|
-
even when the deliverable is wired to the wrong source.
|
|
188
|
-
|
|
189
|
-
| Deliverable | Target surface? | Acceptance check | Negative verifier | Status |
|
|
190
|
-
|---|---|---|---|---|
|
|
191
|
-
|
|
192
|
-
**Gating rule:** any work item whose deliverable maps to the TARGET SURFACE row
|
|
193
|
-
stays in `review` (never `done`) until that target-surface acceptance check
|
|
194
|
-
passes. Generic gates (tsc, route 200) clearing is NOT sufficient to advance
|
|
195
|
-
the target-surface item.
|
|
196
|
-
|
|
197
|
-
If the gate fails:
|
|
198
|
-
- Interactive: show the failing rows and invoke `rdc:plan <epic-id>` to repair the matrix before dispatch.
|
|
199
|
-
- Unattended: invoke `rdc:plan <epic-id> --unattended`, reload tasks, and run this gate once more.
|
|
200
|
-
- If the second gate fails, abort the build and return the failure list. Do not dispatch implementation agents.
|
|
201
|
-
|
|
202
|
-
**Plan verifier escalation:** A separate verifier agent is optional, not default. Dispatch one only when the plan touches 5+ UI routes, 3+ data/API boundaries, auth/security, production deployment, or when this rubric fails twice. The verifier reads the plan and work-item checklists only; it does not write code.
|
|
203
|
-
|
|
204
|
-
4. **Read CLAUDE.md files** for all affected packages.
|
|
205
|
-
|
|
206
|
-
5. **Classify each task** → assign agent type from the table above.
|
|
207
|
-
|
|
208
|
-
5b. **Write or refresh the checklist into every work item before dispatching:**
|
|
209
|
-
For each task, append the exact `decomp-*` and `test-*` checklist rows to its notes BEFORE setting to `in_progress`:
|
|
210
|
-
```sql
|
|
211
|
-
SELECT update_work_item_status('<id>'::uuid, 'in_progress',
|
|
212
|
-
'["CHECKLIST: [ ] decomp-ui-route-state: <route/file> | action=<action> | expect=<result> | evidence=<artifact>, [ ] test-smoke-route: <route probe>, [ ] committed"]'::jsonb
|
|
213
|
-
);
|
|
214
|
-
```
|
|
215
|
-
The agent must complete every item on this checklist and return it checked off in AGENT_COMPLETE.
|
|
216
|
-
A checklist with unchecked items = incomplete work. Do not proceed to next wave with unchecked items.
|
|
217
|
-
|
|
218
|
-
6. **Group tasks into waves** — parallelize tasks with no file overlap:
|
|
219
|
-
- Wave 1: independent tasks (different packages/files)
|
|
220
|
-
- Wave 2: tasks that depend on Wave 1 outputs
|
|
221
|
-
- Wave 3: integration tasks
|
|
222
|
-
|
|
223
|
-
7. **For each wave — dispatch typed agents in parallel:**
|
|
224
|
-
|
|
225
|
-
### ⛔ Agent Dispatch Non-Negotiable Defaults
|
|
226
|
-
Every `Agent()` call MUST include these parameters:
|
|
227
|
-
```
|
|
228
|
-
model: <chosen per the routing table below>
|
|
229
|
-
max_turns: 70
|
|
230
|
-
```
|
|
231
|
-
`isolation` is chosen per the dispatch-mode rule below — it is NOT a blanket
|
|
232
|
-
default. Worktree isolation is reserved for true parallel MULTI-committer waves
|
|
233
|
-
in the same repo; doc-only and single-committer waves default to NON-isolated.
|
|
234
|
-
|
|
235
|
-
### ⛔ Dispatch mode — non-isolated is the default for single-committer / doc-only waves
|
|
236
|
-
Worktree isolation exists to protect a SHARED working tree from a git-index race
|
|
237
|
-
between MULTIPLE agents committing in parallel. When there is only ONE committer,
|
|
238
|
-
that race cannot occur, and the stale-base hazard of worktrees (see the HARD GATE
|
|
239
|
-
below — recurring across 2026-06-10/11/15/16/17/23) is pure downside. Pick the
|
|
240
|
-
dispatch mode by committer count, not by reflex:
|
|
241
|
-
|
|
242
|
-
| Wave shape | Dispatch mode | isolation |
|
|
243
|
-
|---|---|---|
|
|
244
|
-
| **Doc-only wave** (markdown/docs/plans, no code build) | NON-isolated, one committer on `develop` | omit `isolation` |
|
|
245
|
-
| **Single-committer wave** (only one agent commits, or work serializes to the supervisor) | NON-isolated, one committer on `develop` | omit `isolation` |
|
|
246
|
-
| **True parallel MULTI-committer wave** (2+ agents committing concurrently in the same repo, disjoint files) | worktree-isolated, supervisor merges | `isolation: "worktree"` |
|
|
247
|
-
|
|
248
|
-
- **Default = NON-isolated.** Only escalate to `isolation: "worktree"` when the
|
|
249
|
-
wave genuinely has 2+ concurrent committers in the same repo.
|
|
250
|
-
- A pure docs wave is single-committer by default: either dispatch ONE doc agent,
|
|
251
|
-
or have parallel doc agents return diffs/patches that the supervisor commits
|
|
252
|
-
serially. Do NOT fan out 2+ concurrent committers onto one shared `develop`
|
|
253
|
-
tree (lesson 2026-06-13-build-concurrent-agents-same-branch-git-race: three
|
|
254
|
-
parallel doc agents on one `develop` tree raced on the git index/stash — one
|
|
255
|
-
commit swept in another agent's staged-but-uncommitted files under the wrong
|
|
256
|
-
message, two agents reported the SAME SHA, a pre-commit `sync:docs` ref-lock
|
|
257
|
-
race misattributed authorship). The fix for that race is single-committer
|
|
258
|
-
serialization, NOT blanket worktree isolation.
|
|
259
|
-
- When you DO need a true MULTI-committer parallel wave, worktree isolation is
|
|
260
|
-
mandatory AND the HARD GATE below (base == develop HEAD) MUST pass before
|
|
261
|
-
dispatch — a stale-base worktree wave is a build failure, not a warning.
|
|
262
|
-
|
|
263
|
-
### ⛔ Foreign concurrent session guard — `git status` BEFORE the build
|
|
264
|
-
Worktree isolation protects against THIS build's own agents, not against a
|
|
265
|
-
DIFFERENT session (another cell, a Codex run, a human) already committing on
|
|
266
|
-
the same shared tree (lesson 2026-06-16-build-concurrent-session-shared-tree-commit-corruption:
|
|
267
|
-
a foreign session's staged-but-uncommitted files were swept into this build's
|
|
268
|
-
commit under the wrong message). Before dispatching any wave, run `git status`
|
|
269
|
-
to detect foreign-dirty files you did not create. If foreign-dirty files are
|
|
270
|
-
present: do NOT fan out concurrent committers — **serialize ALL committers to
|
|
271
|
-
the supervisor** (agents return diffs/patches; the supervisor stages and
|
|
272
|
-
commits each one alone). After every supervisor commit, assert the exact file
|
|
273
|
-
set landed and nothing foreign leaked in:
|
|
274
|
-
```bash
|
|
275
|
-
git show --stat <sha> # confirm ONLY the files this commit owns are listed
|
|
276
|
-
```
|
|
277
|
-
A `git show --stat` that lists a file the agent did not touch = a foreign file
|
|
278
|
-
leaked into the commit; reset and re-stage by explicit path.
|
|
279
|
-
|
|
280
|
-
**Agent model routing — pick per task, not per wave.** The supervisor session model does NOT cascade to agents; you must set `model` explicitly on every dispatch.
|
|
281
|
-
|
|
282
|
-
| Task character | Model | When to pick it |
|
|
283
|
-
|---|---|---|
|
|
284
|
-
| Updates, edits, mechanical refactors, small fixes, content tweaks, config patches, doc/copy edits, straightforward API wiring | `claude-sonnet-4-6` | Default for `frontend.md`/`content.md`/`infrastructure.md` work whose checklist is mostly "change X to Y" or "wire up endpoint Z". Budget-safe for parallel dispatch. |
|
|
285
|
-
| Harder coding tasks — non-trivial algorithm, migration with backfill, schema reshape, multi-file refactor with subtle invariants, performance-sensitive code, anything where correctness is the bar | `claude-opus-4-6` | Default for `backend.md`/`data.md` work and any `frontend.md` task that involves state machines, race conditions, or cross-package contracts. |
|
|
286
|
-
| Design or innovative thought — new component design, brand/UX work, CS 2.0 paradigm work (HAIL/Quad Pixel/AEMG/Virtue), grammar evolution, architecture-first design, anything where the *shape* of the solution is the deliverable rather than the implementation | `claude-opus-4-8` | Default for `design.md`/`cs2.md` work. Also use for `backend.md`/`data.md` tasks tagged with `architecture` or `design-decision` in work item labels. |
|
|
287
|
-
|
|
288
|
-
**How to choose when the task straddles categories:**
|
|
289
|
-
- If the task's checklist contains the word "design", "decide", "propose", "evaluate alternatives", "novel", or any CS 2.0 primitive → **Opus 4.8**.
|
|
290
|
-
- If the task touches `packages/cs2*`, `packages/hail`, `packages/quad-pixel`, `packages/virtue-engine`, `packages/aemg`, `packages/planetary-ontology`, or `packages/being-state-processor` → **Opus 4.8** (CS 2.0 paradigm requires innovative thought, not transcription).
|
|
291
|
-
- If the task is a Supabase migration that drops/renames/reshapes anything, or a refactor across ≥5 files → **Opus 4.6**.
|
|
292
|
-
- Otherwise → **Sonnet 4.6**.
|
|
293
|
-
|
|
294
|
-
**State the choice in the wave plan.** Before dispatching a wave, the supervisor must log one line per agent in the form `[wave-N agent-K] role=<role> task=<id> model=<chosen> reason=<one phrase>`. This keeps routing decisions reviewable in the transcript and lets `rdc:report` summarize the fleet mix.
|
|
295
|
-
|
|
296
|
-
**Cost guardrail.** If a single wave would dispatch more than 3 Opus 4.8 agents in parallel, downshift the lowest-priority Opus-4.8 tasks to Opus 4.6 unless their work items are tagged `priority=urgent`. Opus 4.8 fast-mode is cheap individually but still ~5× a Sonnet agent at scale.
|
|
297
|
-
Without `max_turns: 70`, agents hit the default turn cap mid-task and stop.
|
|
298
|
-
`isolation: "worktree"` gives each agent its own git worktree and branch — eliminates push race conditions and index lock contention when multiple agents commit in parallel. The supervisor merges worktree branches after each wave (Step 9).
|
|
299
|
-
|
|
300
|
-
### ✅ PREVENTION FIRST — create worktrees fresh off origin/develop (kills stale-base by construction)
|
|
301
|
-
The repeated stale-base failures below come from creating worktrees off a
|
|
302
|
-
local/old ref. Eliminate the failure mode at the source: ALWAYS create agent
|
|
303
|
-
worktrees with a fresh fetch + `origin/develop` base, e.g.
|
|
304
|
-
`git fetch origin develop && git worktree add <dir> -b <branch> origin/develop`
|
|
305
|
-
— or use the canonical launcher `node scripts/wt.mjs add <name>`, which does
|
|
306
|
-
exactly that. A worktree cut from `origin/develop` HEAD **cannot** be stale.
|
|
307
|
-
The HARD GATE below remains as the blocking backstop (detection), but
|
|
308
|
-
construction-from-`origin/develop` is the primary defense.
|
|
309
|
-
|
|
310
|
-
### ⛔ HARD GATE — Worktree base MUST equal develop HEAD (blocking, not advisory)
|
|
311
|
-
The worktree-isolation harness has shipped worktrees pinned to a STALE base
|
|
312
|
-
commit (lessons 2026-06-10-build-worktree-stale-base, 2026-06-11-build-worktree-stale-base,
|
|
313
|
-
2026-06-15-build-worktree-stale-base, 2026-06-16-build-worktree-stale-base,
|
|
314
|
-
2026-06-17-build-worktree-stale-base, 2026-06-23-build-worktree-stale-base:
|
|
315
|
-
agents branched hundreds of commits / multiple days behind develop HEAD, on a
|
|
316
|
-
tree where the target app did not yet exist — their diffs would have silently
|
|
317
|
-
reverted merged work or operated on a deleted structure). This is a recurring
|
|
318
|
-
harness defect, so the check is a **HARD BLOCKING GATE, not a suggestion.**
|
|
319
|
-
|
|
320
|
-
**Before dispatching ANY `isolation:"worktree"` wave**, the supervisor MUST run
|
|
321
|
-
the base==HEAD assertion and MUST abort isolation on any mismatch — there is no
|
|
322
|
-
"proceed anyway" path:
|
|
323
|
-
```bash
|
|
324
|
-
DEV_HEAD=$(git rev-parse develop)
|
|
325
|
-
# After worktrees are created, for each agent worktree:
|
|
326
|
-
git worktree list # compare each agent worktree's SHA to $DEV_HEAD
|
|
327
|
-
# If ANY worktree base != $DEV_HEAD (it is behind), the wave is UNSAFE — ABORT.
|
|
328
|
-
```
|
|
329
|
-
- **MANDATORY ABORT:** if ANY worktree base != `$DEV_HEAD`, you MUST abort
|
|
330
|
-
isolation for this wave. Do NOT merge stale worktree output. Do NOT "fast-forward
|
|
331
|
-
and continue". Do NOT proceed with the isolated wave under any circumstance.
|
|
332
|
-
Pivot to **sequential, non-isolated dispatch on a real `develop` checkout**
|
|
333
|
-
(one disjoint WP at a time to avoid `.git/index` races; the supervisor pushes) —
|
|
334
|
-
the same reason the validator runs non-isolated (it must see merged develop).
|
|
335
|
-
- This gate is blocking by design: an isolated wave dispatched on a stale base
|
|
336
|
-
is treated as a build failure, not a warning. Skipping or downgrading this
|
|
337
|
-
assertion to advisory is a contract violation.
|
|
338
|
-
- Also at every merge: `git show <branch>:<key-file> | grep -c <symbol-a-prior-wave-introduced>`
|
|
339
|
-
— a 0 where there should be ≥1 means the branch is stale or deleted a shared
|
|
340
|
-
export; resolve to `--ours` and re-apply that wave's real delta on current HEAD.
|
|
341
|
-
esbuild/tsc PASS is necessary, not sufficient — pair it with a grep gate on
|
|
342
|
-
the symbols a refactor must preserve.
|
|
343
|
-
|
|
344
|
-
### Forked agents vs. standalone agents
|
|
345
|
-
|
|
346
|
-
**When the supervisor has already read the plan** (via a prior `Read` tool call in the same session),
|
|
347
|
-
dispatch **forked agents** with short prompts. Forked agents inherit the full conversation context —
|
|
348
|
-
including every file the supervisor has read — so you do NOT need to copy plan sections, file specs,
|
|
349
|
-
or architecture details into the prompt. The agent already sees them.
|
|
350
|
-
|
|
351
|
-
Short forked prompt template:
|
|
352
|
-
```
|
|
353
|
-
You are a frontend agent building <WP name>. Work item: <uuid>.
|
|
354
|
-
Scope: <one sentence>. Files: <list>. Verification: tsc --noEmit.
|
|
355
|
-
Set item to review when done, return AGENT_COMPLETE with verification evidence.
|
|
356
|
-
Read .rdc/guides/agent-bootstrap.md + .rdc/guides/engineering-behavior.md + .rdc/guides/frontend.md before starting.
|
|
357
|
-
```
|
|
358
|
-
|
|
359
|
-
**When the supervisor has NOT read the plan** (e.g. dispatching from a fresh `rdc:build` call with
|
|
360
|
-
only an epic ID), the agent has no plan context — write a full briefing prompt with all specs.
|
|
361
|
-
|
|
362
|
-
### ⛔ Reuse contract — when a WP builds on an existing subsystem
|
|
363
|
-
When a work package extends an existing subsystem, "compose adapter + X"
|
|
364
|
-
under-specifies reuse and lets an agent legitimately re-author markup/logic the
|
|
365
|
-
subsystem already exposes (lesson 2026-06-11-build-reuse-existing-engine-prompt:
|
|
366
|
-
an agent set up to reinvent a grid when the card engine already shipped four
|
|
367
|
-
`CardLayout` display types + a full `parseCommand → CardSpec → adapter → CardModel[]`
|
|
368
|
-
calling sequence). The dispatch prompt MUST:
|
|
369
|
-
1. **Enumerate the existing public API the agent must reuse, BY FILE** — types/enums
|
|
370
|
-
(`packages/.../types.ts:NN`), calling-sequence functions, AND the existing
|
|
371
|
-
display/render components — not just the data adapter.
|
|
372
|
-
2. **Mark which seams are extend/delegate-only.** State explicitly: "thread a
|
|
373
|
-
pass-through prop (e.g. `layout`) to the existing components; do NOT
|
|
374
|
-
reimplement layout/render." Verify at WP review that the agent reused the
|
|
375
|
-
named parser/adapter/components and did not hand-roll a parallel implementation.
|
|
376
|
-
|
|
377
|
-
---
|
|
378
|
-
|
|
379
|
-
### Required agent prompt contents
|
|
380
|
-
- Set work item to `in_progress` before dispatching
|
|
381
|
-
- Each agent prompt MUST include:
|
|
382
|
-
- `"Read {PROJECT_ROOT}/.rdc/guides/agent-bootstrap.md first (fallback: .rdc/guides/agent-bootstrap.md), then {PROJECT_ROOT}/.rdc/guides/<type>.md (fallback: .rdc/guides/<type>.md) before starting."`
|
|
383
|
-
- `"Read {PROJECT_ROOT}/.rdc/guides/engineering-behavior.md (fallback: .rdc/guides/engineering-behavior.md) before editing; follow it for assumptions, minimal changes, surgical scope, evidence, and escalation."`
|
|
384
|
-
- Specific files to create/modify (or omit if forked agent inherits plan context)
|
|
385
|
-
- Exact deliverables and commit message
|
|
386
|
-
- `"NEVER run pnpm build/test. NEVER modify files outside your scope."`
|
|
387
|
-
- **`"You are running in an isolated git worktree. Commit your work normally. Do NOT push to origin — the supervisor merges your branch after the wave completes."`**
|
|
388
|
-
- **`"When done, set your work item to 'review' (NOT 'done') and return AGENT_COMPLETE with a verification field. The validator closes work items — you do not."`**
|
|
389
|
-
- **`"COMPLETION PROOF REQUIRED in AGENT_COMPLETE: list every file written, the exact commit hash, and paste the vitest/tsc output. A report without this evidence will be rejected."`**
|
|
390
|
-
- **`"If you find that a file or feature already exists: you MUST still verify it satisfies the full task spec before marking review. Finding a file is not completion. Run verification, check every requirement, and report what you found vs. what was required."`**
|
|
391
|
-
- **The decomposition items from the work item's checklist** (all `decomp-*` prefixed items). Include them verbatim in the prompt and instruct the agent:
|
|
392
|
-
```
|
|
393
|
-
DECOMPOSITION CHECKLIST — you MUST implement/verify each row and tick it immediately via update_checklist_item(..., p_actor_session_id := '<your-session-id>', p_actor_role := 'agent'):
|
|
394
|
-
- decomp-ui-xxx: <route/file> | action=<action> | expect=<result> | evidence=<artifact>
|
|
395
|
-
- decomp-api-xxx: <route/file> | action=<action> | expect=<result> | evidence=<artifact>
|
|
396
|
-
Tick each item as soon as that specific behavior is implemented and proven. Do NOT batch.
|
|
397
|
-
```
|
|
398
|
-
- **The test plan items from the work item's checklist** (all `test-*` prefixed items). Include them verbatim in the prompt and instruct the agent:
|
|
399
|
-
```
|
|
400
|
-
TEST PLAN — you MUST implement/verify each of these and tick them off via update_checklist_item(..., p_actor_session_id := '<your-session-id>', p_actor_role := 'agent'):
|
|
401
|
-
- test-assert-xxx: <description> → write a vitest test that proves this
|
|
402
|
-
- test-smoke-xxx: <description> → run the command and confirm the result
|
|
403
|
-
- test-visual-xxx: <description> → note: delegate to UI audit (you cannot verify this yourself)
|
|
404
|
-
- test-contract-xxx: <description> → verify the export/type/shape exists
|
|
405
|
-
Tick each item as you complete it. Do NOT batch — tick immediately after each verification.
|
|
406
|
-
```
|
|
407
|
-
- Use `run_in_background: true` for parallel execution
|
|
408
|
-
- NEVER let agents overlap on the same files
|
|
409
|
-
|
|
410
|
-
### ⛔ Agent Definition-of-Done additions (include in every prompt)
|
|
411
|
-
- **Declare every import in the package's OWN package.json.** Every import an
|
|
412
|
-
agent adds MUST be present in that package's own `package.json`
|
|
413
|
-
dependencies/devDependencies — never rely on monorepo-hoisted deps. A pnpm
|
|
414
|
-
worktree can import a root-hoisted dep (e.g. `vitest`,
|
|
415
|
-
`@supabase/supabase-js`) so `tsc`/`vitest` PASS in the worktree, then `tsc`
|
|
416
|
-
FAILS on a clean develop checkout after merge (lesson
|
|
417
|
-
2026-06-10-build-card-engine-agent-deps). Agent prompt line: *"Verify that
|
|
418
|
-
every import you add is declared in this package's own package.json — do not
|
|
419
|
-
rely on hoisted monorepo deps."*
|
|
420
|
-
- **A server/MCP/API task is NOT done without a committed automated test that
|
|
421
|
-
ships in the SAME commit and exercises EVERY surface.** Manual curl / a single
|
|
422
|
-
`/health` 200 is a proxy, not coverage (lesson 2026-06-10-build-weak-dod-no-tests).
|
|
423
|
-
For a collection (MCP skills, API routes, CLI commands): loop over ALL items
|
|
424
|
-
and assert `output == source` — never a single spot check. Wire an npm script
|
|
425
|
-
and run it green before the item leaves `review`. Agent prompt line: *"This
|
|
426
|
-
task is not done until a committed test in the same commit exercises every
|
|
427
|
-
surface; for collections, loop all items and assert output == source."*
|
|
428
|
-
|
|
429
|
-
8. **Post-wave test gate (mandatory):**
|
|
430
|
-
After all agents in a wave complete, before proceeding:
|
|
431
|
-
```bash
|
|
432
|
-
# For each package modified in this wave:
|
|
433
|
-
cd packages/<name> && npx vitest run 2>&1 | tail -20
|
|
434
|
-
```
|
|
435
|
-
- All tests must pass before proceeding to next wave
|
|
436
|
-
- If tests fail: fix before proceeding
|
|
437
|
-
- NEVER use `pnpm build` or `pnpm turbo test` — vitest only per package
|
|
438
|
-
- New code must have tests: if a modified package shows 0 new test files, flag it
|
|
439
|
-
|
|
440
|
-
9. **After all wave agents complete — merge worktrees and push:**
|
|
441
|
-
|
|
442
|
-
Each completed agent returns a worktree branch (e.g. `claude/agent-frontend-abc123`). Merge them all to develop before running the test gate:
|
|
443
|
-
|
|
444
|
-
```bash
|
|
445
|
-
# For each worktree branch returned by agents in this wave:
|
|
446
|
-
git merge --no-ff <worktree-branch> -m "merge(<agent-type>): <task-title>"
|
|
447
|
-
```
|
|
448
|
-
|
|
449
|
-
- Resolve any conflicts before proceeding — do not skip
|
|
450
|
-
- Worker agents set items to `review` — **do NOT close to `done` yet**
|
|
451
|
-
- After all branches merged, push once:
|
|
452
|
-
```bash
|
|
453
|
-
if [ "$RDC_TEST" != "1" ]; then
|
|
454
|
-
git push origin develop
|
|
455
|
-
else
|
|
456
|
-
echo "[RDC_TEST] skipping git push"
|
|
457
|
-
fi
|
|
458
|
-
```
|
|
459
|
-
- Then run the post-wave test gate (Step 8) on the merged state
|
|
460
|
-
- Then run the code-review gate (Step 9b) before the next wave dispatches
|
|
461
|
-
- Continue to next wave
|
|
462
|
-
|
|
463
|
-
**If an agent fails (returns no worktree branch):**
|
|
464
|
-
- Interactive: diagnose before retrying
|
|
465
|
-
- Unattended: retry once; on second failure escalate via advisor
|
|
466
|
-
```
|
|
467
|
-
BUILD_STATUS: { wave, tasks_done, tasks_failed, commits, escalated: true }
|
|
468
|
-
```
|
|
469
|
-
|
|
470
|
-
9b. **Mandatory per-wave code-review gate (runs after merge + test gate, BEFORE next wave dispatches):**
|
|
471
|
-
|
|
472
|
-
⛔ **NO wave may dispatch until the previous wave's code-review pass clears.** Memory `feedback_code_review_per_wave.md` — Davesend 2026-05-24 incident.
|
|
473
|
-
|
|
474
|
-
Dispatch ONE `pr-review-toolkit:code-reviewer` agent with the wave's merged diff:
|
|
475
|
-
|
|
476
|
-
```
|
|
477
|
-
Agent({
|
|
478
|
-
subagent_type: "pr-review-toolkit:code-reviewer",
|
|
479
|
-
description: "Wave <N> code review",
|
|
480
|
-
prompt: "Review the diff `git diff <wave-base-sha>..HEAD` on develop.
|
|
481
|
-
Focus on: bugs, logic errors, security vulnerabilities, project-convention adherence
|
|
482
|
-
(.claude/rules/*, CLAUDE.md). Apply confidence-based filtering — high-confidence
|
|
483
|
-
findings only. Report severity per finding: critical | high | medium | low.
|
|
484
|
-
Return CODE_REVIEW_COMPLETE with: { critical_count, high_count, medium_count,
|
|
485
|
-
low_count, findings: [{severity, file:line, issue, suggested_fix}] }."
|
|
486
|
-
})
|
|
487
|
-
```
|
|
488
|
-
|
|
489
|
-
**Severity gate (default — high+ blocks):**
|
|
490
|
-
- `critical` or `high` findings → reopen affected work items to `todo` with finding text in notes; fix in a new wave before continuing
|
|
491
|
-
- `medium` or `low` findings → append to each work item's `implementation_report.flags`; do NOT reopen; validator sees them
|
|
492
|
-
- Zero findings → log `CODE_REVIEW: CLEAN` and proceed to next wave
|
|
493
|
-
|
|
494
|
-
Under `RDC_TEST=1`: echo `[RDC_TEST] skipping code-review dispatch` and proceed.
|
|
495
|
-
|
|
496
|
-
10. **Mandatory validator gate (runs after ALL waves complete — before any work item closes):**
|
|
497
|
-
|
|
498
|
-
⛔ **NO work item may be set to `done` without the validator passing it.**
|
|
499
|
-
|
|
500
|
-
Dispatch ONE validator agent with the complete list of `review` work items and the full git diff.
|
|
501
|
-
⚠️ The validator does NOT use `isolation: "worktree"` — it must read the fully merged develop branch. Omit the isolation parameter for this dispatch only.
|
|
502
|
-
|
|
503
|
-
```
|
|
504
|
-
"Read {PROJECT_ROOT}/.rdc/guides/agent-bootstrap.md then {PROJECT_ROOT}/.rdc/guides/verify.md.
|
|
505
|
-
Read {PROJECT_ROOT}/.rdc/guides/engineering-behavior.md before validating scope, deviations, and evidence.
|
|
506
|
-
Validate these work items: [list of IDs and titles].
|
|
507
|
-
Apps touched: [list].
|
|
508
|
-
Git diff since build start: [attach or reference].
|
|
509
|
-
You are the ONLY agent that closes work items to done.
|
|
510
|
-
Follow verify.md procedure exactly: tsc → vitest → dev server route probes → record result per item."
|
|
511
|
-
```
|
|
512
|
-
|
|
513
|
-
The validator:
|
|
514
|
-
- Runs `npx tsc --noEmit` for every touched app/package
|
|
515
|
-
- Starts the dev server and probes every modified route (expects HTTP 200, not 500)
|
|
516
|
-
- Runs vitest for every touched package
|
|
517
|
-
- **Verifies checklist decomposition quality per work item before functional validation:**
|
|
518
|
-
- Every implementation work item has >= 10 attested `decomp-*`/`test-*` items, meets the per-surface completeness floors (each declared surface covered), and no feature WP ships a 5-6-row checklist
|
|
519
|
-
- Every `decomp-*` item includes route/file, action, expected result, and evidence artifact
|
|
520
|
-
- Any unchecked `decomp-*` item with `required: true` = work item CANNOT be set to `done`
|
|
521
|
-
- Any coarse or non-falsifiable `decomp-*` item = reopen to `todo` with the specific failure
|
|
522
|
-
- **Verifies test plan completion per work item:**
|
|
523
|
-
- For each `test-assert-*` checklist item: confirm a corresponding vitest test exists and passes
|
|
524
|
-
- For each `test-smoke-*` checklist item: run the command and confirm exit code / HTTP status
|
|
525
|
-
- For each `test-visual-*` checklist item: note as "delegated to UI audit" (validator cannot verify visuals)
|
|
526
|
-
- For each `test-contract-*` checklist item: verify the export/type/shape exists in the built code
|
|
527
|
-
- Any unchecked `test-*` item with `required: true` = work item CANNOT be set to `done` (DB enforces this)
|
|
528
|
-
- Sets passing items to `done`, failing items back to `todo` with failure detail
|
|
529
|
-
- Returns `VALIDATOR_COMPLETE` report with test plan status per item
|
|
530
|
-
|
|
531
|
-
**If the validator finds failures:** fix them in a new wave, then re-run the validator. Do not skip.
|
|
532
|
-
**File existence alone is NOT verification.** A route returning 500 is a failure regardless of tsc passing.
|
|
533
|
-
**Unchecked test plan items are a hard gate** — `update_work_item_status('done', ..., p_actor_role := 'validator')` will raise an exception if any `required: true` checklist item is unchecked, missing agent-session tick evidence, or re-ticked by a supervisor/validator.
|
|
534
|
-
|
|
535
|
-
11. **After verification passes:**
|
|
536
|
-
- All wave commits are already on develop and pushed (Step 9 pushes after each wave merge).
|
|
537
|
-
- Update epic version: `bump_epic_version()`
|
|
538
|
-
- Report summary with verification evidence quoted
|
|
539
|
-
|
|
540
|
-
## Agent TDD Requirements
|
|
541
|
-
|
|
542
|
-
When dispatching agents, include in every prompt:
|
|
543
|
-
```
|
|
544
|
-
TDD REQUIREMENT: Write tests FIRST for new functions/modules.
|
|
545
|
-
Run: npx vitest run packages/<name> to verify red → implement → verify green.
|
|
546
|
-
NEVER run pnpm build or pnpm turbo. Use npx vitest run only.
|
|
547
|
-
```
|
|
548
|
-
|
|
549
|
-
## Rules
|
|
550
|
-
- Branch: development branch only (auto-commit, no confirmation needed)
|
|
551
|
-
- NEVER let two agents edit the same file
|
|
552
|
-
- NEVER run `pnpm build` (crashes system) — code only
|
|
553
|
-
- Every agent reads its guide file — no exceptions
|
|
554
|
-
- Update Supabase work items IN REAL TIME — not batch at end
|
|
555
|
-
- Push after each wave, not just at the end
|
|
556
|
-
- Unattended: NEVER pause — continue automatically
|
|
557
|
-
- Unattended: max 2 retries per task before escalating to advisor
|
|
558
|
-
- Every Agent() dispatch: `model: <routed>` + `max_turns: 70` — non-negotiable. `isolation` is per the dispatch-mode rule in Step 7: NON-isolated (omit `isolation`) for doc-only and single-committer waves; `isolation: "worktree"` ONLY for true parallel MULTI-committer waves, and only after the HARD GATE (worktree base == develop HEAD) passes — a stale-base isolated wave is a build failure. Model is chosen per task per the routing table in Step 7: Sonnet 4.6 for updates/edits, Opus 4.6 for harder coding, Opus 4.8 for design/innovative thought (CS 2.0, brand/UX, architecture). Supervisor logs `model=<chosen> reason=<phrase>` per agent. Exception: validator agent in Step 10 always omits isolation; validator model stays `claude-sonnet-4-6` (verification, not generation).
|
|
559
|
-
- Finding an existing file is NOT task completion — verify it satisfies the spec
|
|
560
|
-
|
|
561
|
-
## Capture lessons (exit step)
|
|
562
|
-
|
|
563
|
-
Before the final verdict line, follow `.rdc/guides/lessons-learned-spec.md` § Capture procedure. If this run taught something non-obvious — a first root-cause theory that turned out wrong, the documented/standard path not working, a missing gate or check that cost a round, or a surprising tool/infra behavior — write one `.rdc/lessons/<YYYY-MM-DD>-build-<short-slug>.md` per lesson using the schema in that spec. Set `scope` (`simple` | `architectural`) and `status` (`open`, or `applied` if you shipped the fix in this same run, with the commit linked). Commit the lesson file(s) on `develop` alongside the run's other commits, and note "N lessons captured" in your verdict/summary. A run that taught nothing writes nothing — absence is the default.
|
|
1
|
+
---
|
|
2
|
+
name: rdc:build
|
|
3
|
+
description: "Usage `rdc:build <epic-id>` — You have a planned epic with tasks ready to execute. Dispatches parallel typed agents, each commits atomically to develop, runs a mandatory per-wave code-review gate (pr-review-toolkit:code-reviewer), closes work items, and runs the validator gate. Call after rdc:plan or when told to build."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
> **⚠️ OUTPUT CONTRACT (READ FIRST):** `guides/output-contract.md`
|
|
7
|
+
> Checklist-only output. No tool-call narration. No raw MCP/JSON/log dumps.
|
|
8
|
+
> One checklist upfront, updated in place, shown again at end with a 1-line verdict.
|
|
9
|
+
|
|
10
|
+
> **Sandbox contract:** This skill honors `RDC_TEST=1` per `guides/agent-bootstrap.md` § RDC_TEST Sandbox Contract. Destructive external calls short-circuit under the flag.
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
# rdc:build — Typed Agent Dispatch Engine
|
|
14
|
+
|
|
15
|
+
## When to Use
|
|
16
|
+
- Plan is approved and ready to execute
|
|
17
|
+
- Project lead says "build it", "go", "execute", "do not stop"
|
|
18
|
+
- An epic exists with child tasks ready for implementation
|
|
19
|
+
- Called by `rdc:overnight` as part of the automated build loop
|
|
20
|
+
|
|
21
|
+
## Arguments
|
|
22
|
+
- `rdc:build <epic-id>` — build from a specific Supabase epic
|
|
23
|
+
- `rdc:build <topic>` — find the epic by label/title match
|
|
24
|
+
- `rdc:build` (no args) — show open epics and ask which to build (interactive only)
|
|
25
|
+
- `rdc:build <epic-id> --unattended` — silent mode for overnight builds
|
|
26
|
+
|
|
27
|
+
## Agent Types & Guide Files
|
|
28
|
+
|
|
29
|
+
Every dispatched agent MUST read two files before starting — in this order:
|
|
30
|
+
1. `{PROJECT_ROOT}/.rdc/guides/agent-bootstrap.md` — credentials, git rules, completion report format
|
|
31
|
+
(fallback: `.rdc/guides/agent-bootstrap.md` relative to cwd if `{PROJECT_ROOT}` is not substituted)
|
|
32
|
+
2. `{PROJECT_ROOT}/.rdc/guides/engineering-behavior.md` — assumptions, minimal changes, surgical scope, verification evidence
|
|
33
|
+
(fallback: `.rdc/guides/engineering-behavior.md` relative to cwd if `{PROJECT_ROOT}` is not substituted)
|
|
34
|
+
3. `{PROJECT_ROOT}/.rdc/guides/<type>.md` — role-specific guide
|
|
35
|
+
(fallback: `.rdc/guides/<type>.md` relative to cwd if `{PROJECT_ROOT}` is not substituted)
|
|
36
|
+
|
|
37
|
+
Include both lines in every agent prompt:
|
|
38
|
+
```
|
|
39
|
+
"Read {PROJECT_ROOT}/.rdc/guides/agent-bootstrap.md first (fallback: .rdc/guides/agent-bootstrap.md), then {PROJECT_ROOT}/.rdc/guides/engineering-behavior.md (fallback: .rdc/guides/engineering-behavior.md), then {PROJECT_ROOT}/.rdc/guides/<type>.md (fallback: .rdc/guides/<type>.md) before starting."
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
| Agent Type | Guide File | When to dispatch |
|
|
43
|
+
|-----------|-----------|-----------------|
|
|
44
|
+
| `frontend` | `.rdc/guides/frontend.md` | React components, pages, UI, Tailwind, animation |
|
|
45
|
+
| `backend` | `.rdc/guides/backend.md` | API routes, server components, database queries, auth |
|
|
46
|
+
| `data` | `.rdc/guides/data.md` | Migrations, schema changes, RPC functions |
|
|
47
|
+
| `design` | `.rdc/guides/design.md` | Visual design, brand palettes, OG images, token work |
|
|
48
|
+
| `infra` | `.rdc/guides/infrastructure.md` | CI/CD, deployment, DNS, SSL |
|
|
49
|
+
| `content` | `.rdc/guides/content.md` | Marketing copy, messaging, tone |
|
|
50
|
+
| `cs2` | `.rdc/guides/cs2.md` | CS 2.0 paradigm work (generic) |
|
|
51
|
+
| `hail` | `.rdc/guides/cs2.md` + `packages/hail/CLAUDE.md` | Grammar, DSL compiler, evolution |
|
|
52
|
+
| `pal` | `.rdc/guides/cs2.md` + `packages/pal/CLAUDE.md` | Sessions, moment windows, graph memory |
|
|
53
|
+
| `bpmn` | `.rdc/guides/cs2.md` + `docs/systems/<domain>/flowable-bpmn-architecture.md` | BPMN flows, governance |
|
|
54
|
+
| `virtue` | `.rdc/guides/cs2.md` + `packages/virtue-engine/CLAUDE.md` | Virtue weights, coherence, certification |
|
|
55
|
+
| `viz` | `.rdc/guides/frontend.md` + `.rdc/guides/design.md` | Custom viz components, charts, diagrams |
|
|
56
|
+
|
|
57
|
+
### How to classify a task → agent type
|
|
58
|
+
|
|
59
|
+
Read the task title and description, then:
|
|
60
|
+
- Mentions React, component, page, UI, Tailwind → `frontend`
|
|
61
|
+
- Mentions API route, server, database query, auth → `backend`
|
|
62
|
+
- Mentions migration, schema, table, RPC → `data`
|
|
63
|
+
- Mentions brand, palette, typography, OG image → `design`
|
|
64
|
+
- Mentions deploy, infrastructure, CI, DNS → `infra`
|
|
65
|
+
- Mentions copy, messaging, email template → `content`
|
|
66
|
+
- Mentions grammar, DSL, compiler → `hail`
|
|
67
|
+
- Mentions session, moment, memory graph → `pal`
|
|
68
|
+
- Mentions BPMN, flow, governance → `bpmn`
|
|
69
|
+
- Mentions virtue, coherence, certification → `virtue`
|
|
70
|
+
- Mentions visualization, chart, diagram, SVG → `viz`
|
|
71
|
+
- Multiple types? Dispatch multiple agents, each with its guide.
|
|
72
|
+
|
|
73
|
+
## Procedure
|
|
74
|
+
|
|
75
|
+
1. **Load the epic and run pre-flight gate:**
|
|
76
|
+
```sql
|
|
77
|
+
SELECT get_work_items_by_epic('<epic-id>', 'todo');
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
**Session lock — claim the epic immediately (before any agent dispatch):**
|
|
81
|
+
|
|
82
|
+
After loading the epic, check its status:
|
|
83
|
+
- If `status = 'in_progress'` → **ABORT** with:
|
|
84
|
+
```
|
|
85
|
+
SKIP: epic <id> is already in_progress — claimed by another session. Pick a different epic.
|
|
86
|
+
```
|
|
87
|
+
Do NOT proceed. Do NOT dispatch any agents.
|
|
88
|
+
- If `status = 'todo'` or `status = 'blocked'` → immediately claim it:
|
|
89
|
+
```sql
|
|
90
|
+
SELECT update_work_item_status('<epic-id>'::uuid, 'in_progress',
|
|
91
|
+
'["Claimed by build session — dispatching agents"]'::jsonb
|
|
92
|
+
);
|
|
93
|
+
```
|
|
94
|
+
This is an atomic Supabase write. A concurrent session that loads the same epic after this point will see `in_progress` and abort. **Do this before any classification, planning, or agent dispatch.**
|
|
95
|
+
|
|
96
|
+
**Pre-flight gate — run after claiming:**
|
|
97
|
+
|
|
98
|
+
| Condition | Action |
|
|
99
|
+
|-----------|--------|
|
|
100
|
+
| No child tasks returned | → Invoke `rdc:plan` on this epic. Do NOT proceed with build. |
|
|
101
|
+
| Tasks exist but all have empty `description` fields | → Invoke `rdc:plan` on this epic. Tasks without descriptions cannot be safely dispatched. |
|
|
102
|
+
| Plan doc missing `## Checklist Decomposition Matrix` | → Invoke `rdc:plan` on this epic. Do NOT dispatch agents. |
|
|
103
|
+
| Plan doc missing `## Checklist Quality Gate` with `verdict: PASS` | → Invoke `rdc:plan` on this epic. Do NOT dispatch agents. |
|
|
104
|
+
| Any implementation task lacks `decomp-*` items, has < 10 attested rows, or leaves a declared surface (screen/api/db/tool) uncovered | → Invoke `rdc:plan` on this epic. Coarse/under-decomposed checklists cannot be safely dispatched. |
|
|
105
|
+
| Any `decomp-*` item lacks route/file, action, expected result, or evidence artifact | → Invoke `rdc:plan` on this epic. Do NOT dispatch agents. |
|
|
106
|
+
| Tasks exist and have descriptions | → Continue with build. |
|
|
107
|
+
|
|
108
|
+
**Re-planning is not a failure — it is correct behavior.** The build skill is the last gate before agent dispatch; catching an under-specified epic here is cheaper than a wasted agent run.
|
|
109
|
+
|
|
110
|
+
**How to re-plan:**
|
|
111
|
+
- Interactive: tell the user — "Epic has no tasks / tasks lack descriptions — invoking rdc:plan first." Then invoke `rdc:plan <epic-id>`.
|
|
112
|
+
- Unattended: invoke `rdc:plan <epic-id> --unattended` inline, wait for it to complete, then reload tasks and re-run this gate once. If tasks still missing after re-plan, escalate via advisor.
|
|
113
|
+
|
|
114
|
+
**Interactive (no args):** show open epics, ask which to build.
|
|
115
|
+
|
|
116
|
+
2. **CHECK FOR EXISTING WORK (mandatory — never skip):**
|
|
117
|
+
```sql
|
|
118
|
+
-- Check if prototypes exist from earlier sessions
|
|
119
|
+
SELECT name, component, source_path, status, notes
|
|
120
|
+
FROM prototype_registry
|
|
121
|
+
WHERE status IN ('prototype', 'converting')
|
|
122
|
+
ORDER BY created_at DESC;
|
|
123
|
+
|
|
124
|
+
-- Check for design decisions on this topic
|
|
125
|
+
SELECT topic, context_type, summary, source
|
|
126
|
+
FROM design_context
|
|
127
|
+
WHERE topic ILIKE '%<epic-topic>%'
|
|
128
|
+
ORDER BY created_at DESC;
|
|
129
|
+
```
|
|
130
|
+
**If a prototype exists: ADAPT IT. Do not build from scratch.**
|
|
131
|
+
Tell the agent: "Read <source_path> first and convert it to the production contract."
|
|
132
|
+
|
|
133
|
+
**If design decisions exist: follow them.** Include the summary in the agent prompt.
|
|
134
|
+
|
|
135
|
+
3. **Load the plan** (mandatory): check `.rdc/plans/` for matching topic (fallback: `.rdc/plans/`).
|
|
136
|
+
|
|
137
|
+
3b. **Checklist decomposition quality gate (mandatory before code):**
|
|
138
|
+
|
|
139
|
+
`rdc:build` is the final gate before implementation. It MUST reject any plan or work item that is too coarse for an agent to execute and verify independently.
|
|
140
|
+
|
|
141
|
+
Required plan sections:
|
|
142
|
+
- `## Checklist Decomposition Matrix`
|
|
143
|
+
- `## Checklist Quality Gate`
|
|
144
|
+
- `verdict: PASS`
|
|
145
|
+
|
|
146
|
+
Required task checklist shape:
|
|
147
|
+
- Every implementation work item has >= 10 attested `decomp-*`/`test-*` rows and meets the
|
|
148
|
+
per-surface completeness floors from rdc:plan (each declared surface covered; a multi-surface
|
|
149
|
+
WP carries the SUM of its surface floors, typically 12-20). A flat 5-6-row checklist for a
|
|
150
|
+
feature WP is REJECTED — reopen the epic to rdc:plan for full surface-area decomposition.
|
|
151
|
+
- Every implementation work item has at least one `decomp-*` checklist row and one `test-*` checklist row.
|
|
152
|
+
- Every `decomp-*` row names a concrete route or file path.
|
|
153
|
+
- Every `decomp-*` row names one user/agent action.
|
|
154
|
+
- Every `decomp-*` row names one expected UI/API/DB result.
|
|
155
|
+
- Every `decomp-*` row names one verification artifact: test name, route probe, Playwright screenshot, SQL query, API response, type-check, migration proof, or CLI transcript.
|
|
156
|
+
|
|
157
|
+
Atomicity rubric:
|
|
158
|
+
- One observable behavior per `decomp-*` row.
|
|
159
|
+
- The row can pass or fail without reading hidden intent from the plan narrative.
|
|
160
|
+
- The row is small enough for a worker to implement, tick, and cite evidence for directly.
|
|
161
|
+
- Vague rows such as "theme management works", "UI implemented", "verified", "all screens", or "integration complete" are failures.
|
|
162
|
+
|
|
163
|
+
Minimum decomposition heuristics:
|
|
164
|
+
- UI route: at least empty/loading/loaded/error or the documented reason a state does not apply.
|
|
165
|
+
- CRUD surface: at least list, create, edit, detail, duplicate/delete/archive where applicable, and validation failure.
|
|
166
|
+
- API route: at least successful read/write, validation failure, and unauthorized/forbidden or documented auth bypass.
|
|
167
|
+
- DB/migration task: at least schema object, relationship/guard, policy/permission, seed/fixture or backfill, and smoke query.
|
|
168
|
+
- Editor/sidebar/CLI workflow: at least start, attach/open, enqueue action, observe result, timeout/error, and live refresh where applicable.
|
|
169
|
+
|
|
170
|
+
HARD FLOOR (mirrors rdc:plan): every implementation task carries >= 10 attested rows; a
|
|
171
|
+
multi-surface WP carries the SUM of its per-surface floors (typically 12-20). A flat 5-6-row
|
|
172
|
+
feature checklist, or any declared surface (screen/api/db/tool) left uncovered, is a REJECT —
|
|
173
|
+
reopen to rdc:plan. Every row must name its surface + one verification artifact (attested).
|
|
174
|
+
|
|
175
|
+
### ⛔ Deliverable / acceptance check-off table — show BEFORE any implementation
|
|
176
|
+
Before dispatching the first wave, render a deliverable/acceptance table and
|
|
177
|
+
keep it visible through the build (lesson 2026-06-16-build-poor-goal-execution-mdk-brain:
|
|
178
|
+
a build satisfied generic checklist rows — tsc clean, route 200 — while never
|
|
179
|
+
touching the surface the user actually named, because no row anchored the
|
|
180
|
+
user's TARGET SURFACE). The table MUST contain:
|
|
181
|
+
- **One mandatory row for the user-named TARGET SURFACE** — the exact screen,
|
|
182
|
+
endpoint, file, or behavior the user asked for, by name. Its acceptance check
|
|
183
|
+
is what proves THAT surface renders/works, not a proxy.
|
|
184
|
+
- **At least one NEGATIVE verifier row** — a check that proves the WRONG thing
|
|
185
|
+
does NOT happen (e.g. "mock data is NOT rendered", "old route returns 404",
|
|
186
|
+
"stub component is absent from the bundle"). A positive-only suite passes
|
|
187
|
+
even when the deliverable is wired to the wrong source.
|
|
188
|
+
|
|
189
|
+
| Deliverable | Target surface? | Acceptance check | Negative verifier | Status |
|
|
190
|
+
|---|---|---|---|---|
|
|
191
|
+
|
|
192
|
+
**Gating rule:** any work item whose deliverable maps to the TARGET SURFACE row
|
|
193
|
+
stays in `review` (never `done`) until that target-surface acceptance check
|
|
194
|
+
passes. Generic gates (tsc, route 200) clearing is NOT sufficient to advance
|
|
195
|
+
the target-surface item.
|
|
196
|
+
|
|
197
|
+
If the gate fails:
|
|
198
|
+
- Interactive: show the failing rows and invoke `rdc:plan <epic-id>` to repair the matrix before dispatch.
|
|
199
|
+
- Unattended: invoke `rdc:plan <epic-id> --unattended`, reload tasks, and run this gate once more.
|
|
200
|
+
- If the second gate fails, abort the build and return the failure list. Do not dispatch implementation agents.
|
|
201
|
+
|
|
202
|
+
**Plan verifier escalation:** A separate verifier agent is optional, not default. Dispatch one only when the plan touches 5+ UI routes, 3+ data/API boundaries, auth/security, production deployment, or when this rubric fails twice. The verifier reads the plan and work-item checklists only; it does not write code.
|
|
203
|
+
|
|
204
|
+
4. **Read CLAUDE.md files** for all affected packages.
|
|
205
|
+
|
|
206
|
+
5. **Classify each task** → assign agent type from the table above.
|
|
207
|
+
|
|
208
|
+
5b. **Write or refresh the checklist into every work item before dispatching:**
|
|
209
|
+
For each task, append the exact `decomp-*` and `test-*` checklist rows to its notes BEFORE setting to `in_progress`:
|
|
210
|
+
```sql
|
|
211
|
+
SELECT update_work_item_status('<id>'::uuid, 'in_progress',
|
|
212
|
+
'["CHECKLIST: [ ] decomp-ui-route-state: <route/file> | action=<action> | expect=<result> | evidence=<artifact>, [ ] test-smoke-route: <route probe>, [ ] committed"]'::jsonb
|
|
213
|
+
);
|
|
214
|
+
```
|
|
215
|
+
The agent must complete every item on this checklist and return it checked off in AGENT_COMPLETE.
|
|
216
|
+
A checklist with unchecked items = incomplete work. Do not proceed to next wave with unchecked items.
|
|
217
|
+
|
|
218
|
+
6. **Group tasks into waves** — parallelize tasks with no file overlap:
|
|
219
|
+
- Wave 1: independent tasks (different packages/files)
|
|
220
|
+
- Wave 2: tasks that depend on Wave 1 outputs
|
|
221
|
+
- Wave 3: integration tasks
|
|
222
|
+
|
|
223
|
+
7. **For each wave — dispatch typed agents in parallel:**
|
|
224
|
+
|
|
225
|
+
### ⛔ Agent Dispatch Non-Negotiable Defaults
|
|
226
|
+
Every `Agent()` call MUST include these parameters:
|
|
227
|
+
```
|
|
228
|
+
model: <chosen per the routing table below>
|
|
229
|
+
max_turns: 70
|
|
230
|
+
```
|
|
231
|
+
`isolation` is chosen per the dispatch-mode rule below — it is NOT a blanket
|
|
232
|
+
default. Worktree isolation is reserved for true parallel MULTI-committer waves
|
|
233
|
+
in the same repo; doc-only and single-committer waves default to NON-isolated.
|
|
234
|
+
|
|
235
|
+
### ⛔ Dispatch mode — non-isolated is the default for single-committer / doc-only waves
|
|
236
|
+
Worktree isolation exists to protect a SHARED working tree from a git-index race
|
|
237
|
+
between MULTIPLE agents committing in parallel. When there is only ONE committer,
|
|
238
|
+
that race cannot occur, and the stale-base hazard of worktrees (see the HARD GATE
|
|
239
|
+
below — recurring across 2026-06-10/11/15/16/17/23) is pure downside. Pick the
|
|
240
|
+
dispatch mode by committer count, not by reflex:
|
|
241
|
+
|
|
242
|
+
| Wave shape | Dispatch mode | isolation |
|
|
243
|
+
|---|---|---|
|
|
244
|
+
| **Doc-only wave** (markdown/docs/plans, no code build) | NON-isolated, one committer on `develop` | omit `isolation` |
|
|
245
|
+
| **Single-committer wave** (only one agent commits, or work serializes to the supervisor) | NON-isolated, one committer on `develop` | omit `isolation` |
|
|
246
|
+
| **True parallel MULTI-committer wave** (2+ agents committing concurrently in the same repo, disjoint files) | worktree-isolated, supervisor merges | `isolation: "worktree"` |
|
|
247
|
+
|
|
248
|
+
- **Default = NON-isolated.** Only escalate to `isolation: "worktree"` when the
|
|
249
|
+
wave genuinely has 2+ concurrent committers in the same repo.
|
|
250
|
+
- A pure docs wave is single-committer by default: either dispatch ONE doc agent,
|
|
251
|
+
or have parallel doc agents return diffs/patches that the supervisor commits
|
|
252
|
+
serially. Do NOT fan out 2+ concurrent committers onto one shared `develop`
|
|
253
|
+
tree (lesson 2026-06-13-build-concurrent-agents-same-branch-git-race: three
|
|
254
|
+
parallel doc agents on one `develop` tree raced on the git index/stash — one
|
|
255
|
+
commit swept in another agent's staged-but-uncommitted files under the wrong
|
|
256
|
+
message, two agents reported the SAME SHA, a pre-commit `sync:docs` ref-lock
|
|
257
|
+
race misattributed authorship). The fix for that race is single-committer
|
|
258
|
+
serialization, NOT blanket worktree isolation.
|
|
259
|
+
- When you DO need a true MULTI-committer parallel wave, worktree isolation is
|
|
260
|
+
mandatory AND the HARD GATE below (base == develop HEAD) MUST pass before
|
|
261
|
+
dispatch — a stale-base worktree wave is a build failure, not a warning.
|
|
262
|
+
|
|
263
|
+
### ⛔ Foreign concurrent session guard — `git status` BEFORE the build
|
|
264
|
+
Worktree isolation protects against THIS build's own agents, not against a
|
|
265
|
+
DIFFERENT session (another cell, a Codex run, a human) already committing on
|
|
266
|
+
the same shared tree (lesson 2026-06-16-build-concurrent-session-shared-tree-commit-corruption:
|
|
267
|
+
a foreign session's staged-but-uncommitted files were swept into this build's
|
|
268
|
+
commit under the wrong message). Before dispatching any wave, run `git status`
|
|
269
|
+
to detect foreign-dirty files you did not create. If foreign-dirty files are
|
|
270
|
+
present: do NOT fan out concurrent committers — **serialize ALL committers to
|
|
271
|
+
the supervisor** (agents return diffs/patches; the supervisor stages and
|
|
272
|
+
commits each one alone). After every supervisor commit, assert the exact file
|
|
273
|
+
set landed and nothing foreign leaked in:
|
|
274
|
+
```bash
|
|
275
|
+
git show --stat <sha> # confirm ONLY the files this commit owns are listed
|
|
276
|
+
```
|
|
277
|
+
A `git show --stat` that lists a file the agent did not touch = a foreign file
|
|
278
|
+
leaked into the commit; reset and re-stage by explicit path.
|
|
279
|
+
|
|
280
|
+
**Agent model routing — pick per task, not per wave.** The supervisor session model does NOT cascade to agents; you must set `model` explicitly on every dispatch.
|
|
281
|
+
|
|
282
|
+
| Task character | Model | When to pick it |
|
|
283
|
+
|---|---|---|
|
|
284
|
+
| Updates, edits, mechanical refactors, small fixes, content tweaks, config patches, doc/copy edits, straightforward API wiring | `claude-sonnet-4-6` | Default for `frontend.md`/`content.md`/`infrastructure.md` work whose checklist is mostly "change X to Y" or "wire up endpoint Z". Budget-safe for parallel dispatch. |
|
|
285
|
+
| Harder coding tasks — non-trivial algorithm, migration with backfill, schema reshape, multi-file refactor with subtle invariants, performance-sensitive code, anything where correctness is the bar | `claude-opus-4-6` | Default for `backend.md`/`data.md` work and any `frontend.md` task that involves state machines, race conditions, or cross-package contracts. |
|
|
286
|
+
| Design or innovative thought — new component design, brand/UX work, CS 2.0 paradigm work (HAIL/Quad Pixel/AEMG/Virtue), grammar evolution, architecture-first design, anything where the *shape* of the solution is the deliverable rather than the implementation | `claude-opus-4-8` | Default for `design.md`/`cs2.md` work. Also use for `backend.md`/`data.md` tasks tagged with `architecture` or `design-decision` in work item labels. |
|
|
287
|
+
|
|
288
|
+
**How to choose when the task straddles categories:**
|
|
289
|
+
- If the task's checklist contains the word "design", "decide", "propose", "evaluate alternatives", "novel", or any CS 2.0 primitive → **Opus 4.8**.
|
|
290
|
+
- If the task touches `packages/cs2*`, `packages/hail`, `packages/quad-pixel`, `packages/virtue-engine`, `packages/aemg`, `packages/planetary-ontology`, or `packages/being-state-processor` → **Opus 4.8** (CS 2.0 paradigm requires innovative thought, not transcription).
|
|
291
|
+
- If the task is a Supabase migration that drops/renames/reshapes anything, or a refactor across ≥5 files → **Opus 4.6**.
|
|
292
|
+
- Otherwise → **Sonnet 4.6**.
|
|
293
|
+
|
|
294
|
+
**State the choice in the wave plan.** Before dispatching a wave, the supervisor must log one line per agent in the form `[wave-N agent-K] role=<role> task=<id> model=<chosen> reason=<one phrase>`. This keeps routing decisions reviewable in the transcript and lets `rdc:report` summarize the fleet mix.
|
|
295
|
+
|
|
296
|
+
**Cost guardrail.** If a single wave would dispatch more than 3 Opus 4.8 agents in parallel, downshift the lowest-priority Opus-4.8 tasks to Opus 4.6 unless their work items are tagged `priority=urgent`. Opus 4.8 fast-mode is cheap individually but still ~5× a Sonnet agent at scale.
|
|
297
|
+
Without `max_turns: 70`, agents hit the default turn cap mid-task and stop.
|
|
298
|
+
`isolation: "worktree"` gives each agent its own git worktree and branch — eliminates push race conditions and index lock contention when multiple agents commit in parallel. The supervisor merges worktree branches after each wave (Step 9).
|
|
299
|
+
|
|
300
|
+
### ✅ PREVENTION FIRST — create worktrees fresh off origin/develop (kills stale-base by construction)
|
|
301
|
+
The repeated stale-base failures below come from creating worktrees off a
|
|
302
|
+
local/old ref. Eliminate the failure mode at the source: ALWAYS create agent
|
|
303
|
+
worktrees with a fresh fetch + `origin/develop` base, e.g.
|
|
304
|
+
`git fetch origin develop && git worktree add <dir> -b <branch> origin/develop`
|
|
305
|
+
— or use the canonical launcher `node scripts/wt.mjs add <name>`, which does
|
|
306
|
+
exactly that. A worktree cut from `origin/develop` HEAD **cannot** be stale.
|
|
307
|
+
The HARD GATE below remains as the blocking backstop (detection), but
|
|
308
|
+
construction-from-`origin/develop` is the primary defense.
|
|
309
|
+
|
|
310
|
+
### ⛔ HARD GATE — Worktree base MUST equal develop HEAD (blocking, not advisory)
|
|
311
|
+
The worktree-isolation harness has shipped worktrees pinned to a STALE base
|
|
312
|
+
commit (lessons 2026-06-10-build-worktree-stale-base, 2026-06-11-build-worktree-stale-base,
|
|
313
|
+
2026-06-15-build-worktree-stale-base, 2026-06-16-build-worktree-stale-base,
|
|
314
|
+
2026-06-17-build-worktree-stale-base, 2026-06-23-build-worktree-stale-base:
|
|
315
|
+
agents branched hundreds of commits / multiple days behind develop HEAD, on a
|
|
316
|
+
tree where the target app did not yet exist — their diffs would have silently
|
|
317
|
+
reverted merged work or operated on a deleted structure). This is a recurring
|
|
318
|
+
harness defect, so the check is a **HARD BLOCKING GATE, not a suggestion.**
|
|
319
|
+
|
|
320
|
+
**Before dispatching ANY `isolation:"worktree"` wave**, the supervisor MUST run
|
|
321
|
+
the base==HEAD assertion and MUST abort isolation on any mismatch — there is no
|
|
322
|
+
"proceed anyway" path:
|
|
323
|
+
```bash
|
|
324
|
+
DEV_HEAD=$(git rev-parse develop)
|
|
325
|
+
# After worktrees are created, for each agent worktree:
|
|
326
|
+
git worktree list # compare each agent worktree's SHA to $DEV_HEAD
|
|
327
|
+
# If ANY worktree base != $DEV_HEAD (it is behind), the wave is UNSAFE — ABORT.
|
|
328
|
+
```
|
|
329
|
+
- **MANDATORY ABORT:** if ANY worktree base != `$DEV_HEAD`, you MUST abort
|
|
330
|
+
isolation for this wave. Do NOT merge stale worktree output. Do NOT "fast-forward
|
|
331
|
+
and continue". Do NOT proceed with the isolated wave under any circumstance.
|
|
332
|
+
Pivot to **sequential, non-isolated dispatch on a real `develop` checkout**
|
|
333
|
+
(one disjoint WP at a time to avoid `.git/index` races; the supervisor pushes) —
|
|
334
|
+
the same reason the validator runs non-isolated (it must see merged develop).
|
|
335
|
+
- This gate is blocking by design: an isolated wave dispatched on a stale base
|
|
336
|
+
is treated as a build failure, not a warning. Skipping or downgrading this
|
|
337
|
+
assertion to advisory is a contract violation.
|
|
338
|
+
- Also at every merge: `git show <branch>:<key-file> | grep -c <symbol-a-prior-wave-introduced>`
|
|
339
|
+
— a 0 where there should be ≥1 means the branch is stale or deleted a shared
|
|
340
|
+
export; resolve to `--ours` and re-apply that wave's real delta on current HEAD.
|
|
341
|
+
esbuild/tsc PASS is necessary, not sufficient — pair it with a grep gate on
|
|
342
|
+
the symbols a refactor must preserve.
|
|
343
|
+
|
|
344
|
+
### Forked agents vs. standalone agents
|
|
345
|
+
|
|
346
|
+
**When the supervisor has already read the plan** (via a prior `Read` tool call in the same session),
|
|
347
|
+
dispatch **forked agents** with short prompts. Forked agents inherit the full conversation context —
|
|
348
|
+
including every file the supervisor has read — so you do NOT need to copy plan sections, file specs,
|
|
349
|
+
or architecture details into the prompt. The agent already sees them.
|
|
350
|
+
|
|
351
|
+
Short forked prompt template:
|
|
352
|
+
```
|
|
353
|
+
You are a frontend agent building <WP name>. Work item: <uuid>.
|
|
354
|
+
Scope: <one sentence>. Files: <list>. Verification: tsc --noEmit.
|
|
355
|
+
Set item to review when done, return AGENT_COMPLETE with verification evidence.
|
|
356
|
+
Read .rdc/guides/agent-bootstrap.md + .rdc/guides/engineering-behavior.md + .rdc/guides/frontend.md before starting.
|
|
357
|
+
```
|
|
358
|
+
|
|
359
|
+
**When the supervisor has NOT read the plan** (e.g. dispatching from a fresh `rdc:build` call with
|
|
360
|
+
only an epic ID), the agent has no plan context — write a full briefing prompt with all specs.
|
|
361
|
+
|
|
362
|
+
### ⛔ Reuse contract — when a WP builds on an existing subsystem
|
|
363
|
+
When a work package extends an existing subsystem, "compose adapter + X"
|
|
364
|
+
under-specifies reuse and lets an agent legitimately re-author markup/logic the
|
|
365
|
+
subsystem already exposes (lesson 2026-06-11-build-reuse-existing-engine-prompt:
|
|
366
|
+
an agent set up to reinvent a grid when the card engine already shipped four
|
|
367
|
+
`CardLayout` display types + a full `parseCommand → CardSpec → adapter → CardModel[]`
|
|
368
|
+
calling sequence). The dispatch prompt MUST:
|
|
369
|
+
1. **Enumerate the existing public API the agent must reuse, BY FILE** — types/enums
|
|
370
|
+
(`packages/.../types.ts:NN`), calling-sequence functions, AND the existing
|
|
371
|
+
display/render components — not just the data adapter.
|
|
372
|
+
2. **Mark which seams are extend/delegate-only.** State explicitly: "thread a
|
|
373
|
+
pass-through prop (e.g. `layout`) to the existing components; do NOT
|
|
374
|
+
reimplement layout/render." Verify at WP review that the agent reused the
|
|
375
|
+
named parser/adapter/components and did not hand-roll a parallel implementation.
|
|
376
|
+
|
|
377
|
+
---
|
|
378
|
+
|
|
379
|
+
### Required agent prompt contents
|
|
380
|
+
- Set work item to `in_progress` before dispatching
|
|
381
|
+
- Each agent prompt MUST include:
|
|
382
|
+
- `"Read {PROJECT_ROOT}/.rdc/guides/agent-bootstrap.md first (fallback: .rdc/guides/agent-bootstrap.md), then {PROJECT_ROOT}/.rdc/guides/<type>.md (fallback: .rdc/guides/<type>.md) before starting."`
|
|
383
|
+
- `"Read {PROJECT_ROOT}/.rdc/guides/engineering-behavior.md (fallback: .rdc/guides/engineering-behavior.md) before editing; follow it for assumptions, minimal changes, surgical scope, evidence, and escalation."`
|
|
384
|
+
- Specific files to create/modify (or omit if forked agent inherits plan context)
|
|
385
|
+
- Exact deliverables and commit message
|
|
386
|
+
- `"NEVER run pnpm build/test. NEVER modify files outside your scope."`
|
|
387
|
+
- **`"You are running in an isolated git worktree. Commit your work normally. Do NOT push to origin — the supervisor merges your branch after the wave completes."`**
|
|
388
|
+
- **`"When done, set your work item to 'review' (NOT 'done') and return AGENT_COMPLETE with a verification field. The validator closes work items — you do not."`**
|
|
389
|
+
- **`"COMPLETION PROOF REQUIRED in AGENT_COMPLETE: list every file written, the exact commit hash, and paste the vitest/tsc output. A report without this evidence will be rejected."`**
|
|
390
|
+
- **`"If you find that a file or feature already exists: you MUST still verify it satisfies the full task spec before marking review. Finding a file is not completion. Run verification, check every requirement, and report what you found vs. what was required."`**
|
|
391
|
+
- **The decomposition items from the work item's checklist** (all `decomp-*` prefixed items). Include them verbatim in the prompt and instruct the agent:
|
|
392
|
+
```
|
|
393
|
+
DECOMPOSITION CHECKLIST — you MUST implement/verify each row and tick it immediately via update_checklist_item(..., p_actor_session_id := '<your-session-id>', p_actor_role := 'agent'):
|
|
394
|
+
- decomp-ui-xxx: <route/file> | action=<action> | expect=<result> | evidence=<artifact>
|
|
395
|
+
- decomp-api-xxx: <route/file> | action=<action> | expect=<result> | evidence=<artifact>
|
|
396
|
+
Tick each item as soon as that specific behavior is implemented and proven. Do NOT batch.
|
|
397
|
+
```
|
|
398
|
+
- **The test plan items from the work item's checklist** (all `test-*` prefixed items). Include them verbatim in the prompt and instruct the agent:
|
|
399
|
+
```
|
|
400
|
+
TEST PLAN — you MUST implement/verify each of these and tick them off via update_checklist_item(..., p_actor_session_id := '<your-session-id>', p_actor_role := 'agent'):
|
|
401
|
+
- test-assert-xxx: <description> → write a vitest test that proves this
|
|
402
|
+
- test-smoke-xxx: <description> → run the command and confirm the result
|
|
403
|
+
- test-visual-xxx: <description> → note: delegate to UI audit (you cannot verify this yourself)
|
|
404
|
+
- test-contract-xxx: <description> → verify the export/type/shape exists
|
|
405
|
+
Tick each item as you complete it. Do NOT batch — tick immediately after each verification.
|
|
406
|
+
```
|
|
407
|
+
- Use `run_in_background: true` for parallel execution
|
|
408
|
+
- NEVER let agents overlap on the same files
|
|
409
|
+
|
|
410
|
+
### ⛔ Agent Definition-of-Done additions (include in every prompt)
|
|
411
|
+
- **Declare every import in the package's OWN package.json.** Every import an
|
|
412
|
+
agent adds MUST be present in that package's own `package.json`
|
|
413
|
+
dependencies/devDependencies — never rely on monorepo-hoisted deps. A pnpm
|
|
414
|
+
worktree can import a root-hoisted dep (e.g. `vitest`,
|
|
415
|
+
`@supabase/supabase-js`) so `tsc`/`vitest` PASS in the worktree, then `tsc`
|
|
416
|
+
FAILS on a clean develop checkout after merge (lesson
|
|
417
|
+
2026-06-10-build-card-engine-agent-deps). Agent prompt line: *"Verify that
|
|
418
|
+
every import you add is declared in this package's own package.json — do not
|
|
419
|
+
rely on hoisted monorepo deps."*
|
|
420
|
+
- **A server/MCP/API task is NOT done without a committed automated test that
|
|
421
|
+
ships in the SAME commit and exercises EVERY surface.** Manual curl / a single
|
|
422
|
+
`/health` 200 is a proxy, not coverage (lesson 2026-06-10-build-weak-dod-no-tests).
|
|
423
|
+
For a collection (MCP skills, API routes, CLI commands): loop over ALL items
|
|
424
|
+
and assert `output == source` — never a single spot check. Wire an npm script
|
|
425
|
+
and run it green before the item leaves `review`. Agent prompt line: *"This
|
|
426
|
+
task is not done until a committed test in the same commit exercises every
|
|
427
|
+
surface; for collections, loop all items and assert output == source."*
|
|
428
|
+
|
|
429
|
+
8. **Post-wave test gate (mandatory):**
|
|
430
|
+
After all agents in a wave complete, before proceeding:
|
|
431
|
+
```bash
|
|
432
|
+
# For each package modified in this wave:
|
|
433
|
+
cd packages/<name> && npx vitest run 2>&1 | tail -20
|
|
434
|
+
```
|
|
435
|
+
- All tests must pass before proceeding to next wave
|
|
436
|
+
- If tests fail: fix before proceeding
|
|
437
|
+
- NEVER use `pnpm build` or `pnpm turbo test` — vitest only per package
|
|
438
|
+
- New code must have tests: if a modified package shows 0 new test files, flag it
|
|
439
|
+
|
|
440
|
+
9. **After all wave agents complete — merge worktrees and push:**
|
|
441
|
+
|
|
442
|
+
Each completed agent returns a worktree branch (e.g. `claude/agent-frontend-abc123`). Merge them all to develop before running the test gate:
|
|
443
|
+
|
|
444
|
+
```bash
|
|
445
|
+
# For each worktree branch returned by agents in this wave:
|
|
446
|
+
git merge --no-ff <worktree-branch> -m "merge(<agent-type>): <task-title>"
|
|
447
|
+
```
|
|
448
|
+
|
|
449
|
+
- Resolve any conflicts before proceeding — do not skip
|
|
450
|
+
- Worker agents set items to `review` — **do NOT close to `done` yet**
|
|
451
|
+
- After all branches merged, push once:
|
|
452
|
+
```bash
|
|
453
|
+
if [ "$RDC_TEST" != "1" ]; then
|
|
454
|
+
git push origin develop
|
|
455
|
+
else
|
|
456
|
+
echo "[RDC_TEST] skipping git push"
|
|
457
|
+
fi
|
|
458
|
+
```
|
|
459
|
+
- Then run the post-wave test gate (Step 8) on the merged state
|
|
460
|
+
- Then run the code-review gate (Step 9b) before the next wave dispatches
|
|
461
|
+
- Continue to next wave
|
|
462
|
+
|
|
463
|
+
**If an agent fails (returns no worktree branch):**
|
|
464
|
+
- Interactive: diagnose before retrying
|
|
465
|
+
- Unattended: retry once; on second failure escalate via advisor
|
|
466
|
+
```
|
|
467
|
+
BUILD_STATUS: { wave, tasks_done, tasks_failed, commits, escalated: true }
|
|
468
|
+
```
|
|
469
|
+
|
|
470
|
+
9b. **Mandatory per-wave code-review gate (runs after merge + test gate, BEFORE next wave dispatches):**
|
|
471
|
+
|
|
472
|
+
⛔ **NO wave may dispatch until the previous wave's code-review pass clears.** Memory `feedback_code_review_per_wave.md` — Davesend 2026-05-24 incident.
|
|
473
|
+
|
|
474
|
+
Dispatch ONE `pr-review-toolkit:code-reviewer` agent with the wave's merged diff:
|
|
475
|
+
|
|
476
|
+
```
|
|
477
|
+
Agent({
|
|
478
|
+
subagent_type: "pr-review-toolkit:code-reviewer",
|
|
479
|
+
description: "Wave <N> code review",
|
|
480
|
+
prompt: "Review the diff `git diff <wave-base-sha>..HEAD` on develop.
|
|
481
|
+
Focus on: bugs, logic errors, security vulnerabilities, project-convention adherence
|
|
482
|
+
(.claude/rules/*, CLAUDE.md). Apply confidence-based filtering — high-confidence
|
|
483
|
+
findings only. Report severity per finding: critical | high | medium | low.
|
|
484
|
+
Return CODE_REVIEW_COMPLETE with: { critical_count, high_count, medium_count,
|
|
485
|
+
low_count, findings: [{severity, file:line, issue, suggested_fix}] }."
|
|
486
|
+
})
|
|
487
|
+
```
|
|
488
|
+
|
|
489
|
+
**Severity gate (default — high+ blocks):**
|
|
490
|
+
- `critical` or `high` findings → reopen affected work items to `todo` with finding text in notes; fix in a new wave before continuing
|
|
491
|
+
- `medium` or `low` findings → append to each work item's `implementation_report.flags`; do NOT reopen; validator sees them
|
|
492
|
+
- Zero findings → log `CODE_REVIEW: CLEAN` and proceed to next wave
|
|
493
|
+
|
|
494
|
+
Under `RDC_TEST=1`: echo `[RDC_TEST] skipping code-review dispatch` and proceed.
|
|
495
|
+
|
|
496
|
+
10. **Mandatory validator gate (runs after ALL waves complete — before any work item closes):**
|
|
497
|
+
|
|
498
|
+
⛔ **NO work item may be set to `done` without the validator passing it.**
|
|
499
|
+
|
|
500
|
+
Dispatch ONE validator agent with the complete list of `review` work items and the full git diff.
|
|
501
|
+
⚠️ The validator does NOT use `isolation: "worktree"` — it must read the fully merged develop branch. Omit the isolation parameter for this dispatch only.
|
|
502
|
+
|
|
503
|
+
```
|
|
504
|
+
"Read {PROJECT_ROOT}/.rdc/guides/agent-bootstrap.md then {PROJECT_ROOT}/.rdc/guides/verify.md.
|
|
505
|
+
Read {PROJECT_ROOT}/.rdc/guides/engineering-behavior.md before validating scope, deviations, and evidence.
|
|
506
|
+
Validate these work items: [list of IDs and titles].
|
|
507
|
+
Apps touched: [list].
|
|
508
|
+
Git diff since build start: [attach or reference].
|
|
509
|
+
You are the ONLY agent that closes work items to done.
|
|
510
|
+
Follow verify.md procedure exactly: tsc → vitest → dev server route probes → record result per item."
|
|
511
|
+
```
|
|
512
|
+
|
|
513
|
+
The validator:
|
|
514
|
+
- Runs `npx tsc --noEmit` for every touched app/package
|
|
515
|
+
- Starts the dev server and probes every modified route (expects HTTP 200, not 500)
|
|
516
|
+
- Runs vitest for every touched package
|
|
517
|
+
- **Verifies checklist decomposition quality per work item before functional validation:**
|
|
518
|
+
- Every implementation work item has >= 10 attested `decomp-*`/`test-*` items, meets the per-surface completeness floors (each declared surface covered), and no feature WP ships a 5-6-row checklist
|
|
519
|
+
- Every `decomp-*` item includes route/file, action, expected result, and evidence artifact
|
|
520
|
+
- Any unchecked `decomp-*` item with `required: true` = work item CANNOT be set to `done`
|
|
521
|
+
- Any coarse or non-falsifiable `decomp-*` item = reopen to `todo` with the specific failure
|
|
522
|
+
- **Verifies test plan completion per work item:**
|
|
523
|
+
- For each `test-assert-*` checklist item: confirm a corresponding vitest test exists and passes
|
|
524
|
+
- For each `test-smoke-*` checklist item: run the command and confirm exit code / HTTP status
|
|
525
|
+
- For each `test-visual-*` checklist item: note as "delegated to UI audit" (validator cannot verify visuals)
|
|
526
|
+
- For each `test-contract-*` checklist item: verify the export/type/shape exists in the built code
|
|
527
|
+
- Any unchecked `test-*` item with `required: true` = work item CANNOT be set to `done` (DB enforces this)
|
|
528
|
+
- Sets passing items to `done`, failing items back to `todo` with failure detail
|
|
529
|
+
- Returns `VALIDATOR_COMPLETE` report with test plan status per item
|
|
530
|
+
|
|
531
|
+
**If the validator finds failures:** fix them in a new wave, then re-run the validator. Do not skip.
|
|
532
|
+
**File existence alone is NOT verification.** A route returning 500 is a failure regardless of tsc passing.
|
|
533
|
+
**Unchecked test plan items are a hard gate** — `update_work_item_status('done', ..., p_actor_role := 'validator')` will raise an exception if any `required: true` checklist item is unchecked, missing agent-session tick evidence, or re-ticked by a supervisor/validator.
|
|
534
|
+
|
|
535
|
+
11. **After verification passes:**
|
|
536
|
+
- All wave commits are already on develop and pushed (Step 9 pushes after each wave merge).
|
|
537
|
+
- Update epic version: `bump_epic_version()`
|
|
538
|
+
- Report summary with verification evidence quoted
|
|
539
|
+
|
|
540
|
+
## Agent TDD Requirements
|
|
541
|
+
|
|
542
|
+
When dispatching agents, include in every prompt:
|
|
543
|
+
```
|
|
544
|
+
TDD REQUIREMENT: Write tests FIRST for new functions/modules.
|
|
545
|
+
Run: npx vitest run packages/<name> to verify red → implement → verify green.
|
|
546
|
+
NEVER run pnpm build or pnpm turbo. Use npx vitest run only.
|
|
547
|
+
```
|
|
548
|
+
|
|
549
|
+
## Rules
|
|
550
|
+
- Branch: development branch only (auto-commit, no confirmation needed)
|
|
551
|
+
- NEVER let two agents edit the same file
|
|
552
|
+
- NEVER run `pnpm build` (crashes system) — code only
|
|
553
|
+
- Every agent reads its guide file — no exceptions
|
|
554
|
+
- Update Supabase work items IN REAL TIME — not batch at end
|
|
555
|
+
- Push after each wave, not just at the end
|
|
556
|
+
- Unattended: NEVER pause — continue automatically
|
|
557
|
+
- Unattended: max 2 retries per task before escalating to advisor
|
|
558
|
+
- Every Agent() dispatch: `model: <routed>` + `max_turns: 70` — non-negotiable. `isolation` is per the dispatch-mode rule in Step 7: NON-isolated (omit `isolation`) for doc-only and single-committer waves; `isolation: "worktree"` ONLY for true parallel MULTI-committer waves, and only after the HARD GATE (worktree base == develop HEAD) passes — a stale-base isolated wave is a build failure. Model is chosen per task per the routing table in Step 7: Sonnet 4.6 for updates/edits, Opus 4.6 for harder coding, Opus 4.8 for design/innovative thought (CS 2.0, brand/UX, architecture). Supervisor logs `model=<chosen> reason=<phrase>` per agent. Exception: validator agent in Step 10 always omits isolation; validator model stays `claude-sonnet-4-6` (verification, not generation).
|
|
559
|
+
- Finding an existing file is NOT task completion — verify it satisfies the spec
|
|
560
|
+
|
|
561
|
+
## Capture lessons (exit step)
|
|
562
|
+
|
|
563
|
+
Before the final verdict line, follow `.rdc/guides/lessons-learned-spec.md` § Capture procedure. If this run taught something non-obvious — a first root-cause theory that turned out wrong, the documented/standard path not working, a missing gate or check that cost a round, or a surprising tool/infra behavior — write one `.rdc/lessons/<YYYY-MM-DD>-build-<short-slug>.md` per lesson using the schema in that spec. Set `scope` (`simple` | `architectural`) and `status` (`open`, or `applied` if you shipped the fix in this same run, with the commit linked). Commit the lesson file(s) on `develop` alongside the run's other commits, and note "N lessons captured" in your verdict/summary. A run that taught nothing writes nothing — absence is the default.
|