@lifeaitools/rdc-skills 0.8.7

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.
Files changed (97) hide show
  1. package/.claude/settings.json +15 -0
  2. package/.claude-plugin/marketplace.json +21 -0
  3. package/.claude-plugin/plugin.json +11 -0
  4. package/.github/workflows/publish.yml +25 -0
  5. package/.github/workflows/self-test.yml +53 -0
  6. package/CHANGELOG.md +246 -0
  7. package/LICENSE +21 -0
  8. package/MANIFEST.md +190 -0
  9. package/README.md +188 -0
  10. package/README.sandbox.md +3 -0
  11. package/assets/watcher/viewer.html +164 -0
  12. package/commands/build.md +183 -0
  13. package/commands/collab.md +180 -0
  14. package/commands/deploy.md +138 -0
  15. package/commands/fixit.md +112 -0
  16. package/commands/handoff.md +173 -0
  17. package/commands/help.md +88 -0
  18. package/commands/overnight.md +220 -0
  19. package/commands/plan.md +158 -0
  20. package/commands/preplan.md +131 -0
  21. package/commands/prototype.md +145 -0
  22. package/commands/release.md +159 -0
  23. package/commands/report.md +99 -0
  24. package/commands/review.md +120 -0
  25. package/commands/self-test.md +107 -0
  26. package/commands/status.md +86 -0
  27. package/commands/watch.md +92 -0
  28. package/commands/workitems.md +132 -0
  29. package/guides/.gitkeep +0 -0
  30. package/guides/agent-bootstrap.md +191 -0
  31. package/guides/agents/backend.md +104 -0
  32. package/guides/agents/content.md +94 -0
  33. package/guides/agents/cs2.md +56 -0
  34. package/guides/agents/data.md +87 -0
  35. package/guides/agents/design.md +77 -0
  36. package/guides/agents/frontend.md +92 -0
  37. package/guides/agents/infrastructure.md +81 -0
  38. package/guides/agents/setup.md +279 -0
  39. package/guides/agents/verify.md +132 -0
  40. package/guides/agents/viz.md +106 -0
  41. package/guides/backend.md +146 -0
  42. package/guides/content.md +147 -0
  43. package/guides/cs2.md +190 -0
  44. package/guides/data.md +123 -0
  45. package/guides/design.md +116 -0
  46. package/guides/frontend.md +151 -0
  47. package/guides/infrastructure.md +179 -0
  48. package/guides/output-contract.md +98 -0
  49. package/hooks/no-stop-open-epics.js +125 -0
  50. package/package.json +31 -0
  51. package/rules/work-items-rpc.md +399 -0
  52. package/scripts/install-rdc-skills.js +559 -0
  53. package/scripts/install.ps1 +165 -0
  54. package/scripts/install.sh +132 -0
  55. package/scripts/lib/assertions.mjs +264 -0
  56. package/scripts/lib/manifest-schema.mjs +607 -0
  57. package/scripts/lib/runner.mjs +429 -0
  58. package/scripts/lib/sandbox.mjs +435 -0
  59. package/scripts/self-test.mjs +1108 -0
  60. package/scripts/uninstall.ps1 +77 -0
  61. package/scripts/uninstall.sh +69 -0
  62. package/scripts/update.ps1 +43 -0
  63. package/scripts/update.sh +43 -0
  64. package/scripts/watch-init.mjs +100 -0
  65. package/skills/.gitkeep +0 -0
  66. package/skills/build/SKILL.md +238 -0
  67. package/skills/collab/SKILL.md +218 -0
  68. package/skills/deploy/SKILL.md +144 -0
  69. package/skills/fixit/SKILL.md +112 -0
  70. package/skills/handoff/SKILL.md +175 -0
  71. package/skills/help/SKILL.md +101 -0
  72. package/skills/overnight/SKILL.md +220 -0
  73. package/skills/plan/SKILL.md +96 -0
  74. package/skills/preplan/SKILL.md +87 -0
  75. package/skills/prototype/SKILL.md +151 -0
  76. package/skills/release/SKILL.md +221 -0
  77. package/skills/report/SKILL.md +101 -0
  78. package/skills/review/SKILL.md +120 -0
  79. package/skills/self-test/SKILL.md +127 -0
  80. package/skills/status/SKILL.md +86 -0
  81. package/skills/tests/README.md +29 -0
  82. package/skills/tests/rdc-build.test.json +22 -0
  83. package/skills/tests/rdc-deploy.test.json +15 -0
  84. package/skills/tests/rdc-fixit.test.json +21 -0
  85. package/skills/tests/rdc-handoff.test.json +14 -0
  86. package/skills/tests/rdc-overnight.test.json +21 -0
  87. package/skills/tests/rdc-plan.test.json +14 -0
  88. package/skills/tests/rdc-preplan.test.json +15 -0
  89. package/skills/tests/rdc-prototype.test.json +14 -0
  90. package/skills/tests/rdc-release.test.json +15 -0
  91. package/skills/tests/rdc-report.test.json +14 -0
  92. package/skills/tests/rdc-review.test.json +14 -0
  93. package/skills/tests/rdc-status.test.json +16 -0
  94. package/skills/tests/rdc-workitems.test.json +15 -0
  95. package/skills/watch/SKILL.md +92 -0
  96. package/skills/workitems/SKILL.md +147 -0
  97. package/tests/validate-skills.js +183 -0
package/README.md ADDED
@@ -0,0 +1,188 @@
1
+ # RDC Skills Library — Generic Version
2
+
3
+ This directory contains a generic, project-agnostic version of the RDC (Research, Design, Code) skill suite. All skills have been extracted from a reference implementation and genericized for use in any monorepo project.
4
+
5
+ ## Install
6
+
7
+ ### Option A — Plugin marketplace (recommended for new installs)
8
+
9
+ From any Claude Code session:
10
+
11
+ ```
12
+ /plugin marketplace add LIFEAI/rdc-skills
13
+ /plugin install rdc-skills
14
+ ```
15
+
16
+ All 17 user-invocable skills become available as slash commands. Agent playbooks in `guides/agents/` are dispatched internally by `rdc:build` and are not user-invocable.
17
+
18
+ ### Option B — Directory plugin (LIFEAI dev machines)
19
+
20
+ If you have the source repo locally, point the plugin directly at the directory in `~/.claude/settings.json`. Skills load live from disk — no install step needed, changes take effect on next session start:
21
+
22
+ ```json
23
+ "extraKnownMarketplaces": {
24
+ "rdc-skills": {
25
+ "source": { "source": "directory", "path": "C:\\Dev\\rdc-skills" }
26
+ }
27
+ },
28
+ "enabledPlugins": {
29
+ "rdc-skills@rdc-skills": true
30
+ }
31
+ ```
32
+
33
+ ### ⚠️ DO NOT mix install methods — duplicates will occur
34
+
35
+ If `rdc-skills@rdc-skills` is enabled in your plugin settings AND you have manually installed files at `~/.claude/skills/user/rdc-*.md`, every skill loads twice (or more if stale plugin cache versions exist). Symptoms: each skill appears 2–3× in the skill list.
36
+
37
+ **Fix:**
38
+ ```bash
39
+ # Remove manual install
40
+ rm ~/.claude/skills/user/rdc-*.md
41
+
42
+ # Remove stale plugin cache (keep only the current version)
43
+ rm -rf ~/.claude/plugins/cache/rdc-skills/rdc-skills/0.7.*
44
+ ```
45
+
46
+ Use **one method only**: plugin (Option A or B) OR manual install — never both.
47
+
48
+ ### Legacy install scripts (deprecated since v0.6.0)
49
+
50
+ `scripts/install.sh` and `scripts/install.ps1` copy files into `~/.claude/skills/user/`. These exist only for environments that cannot use the plugin system. Running them alongside the plugin creates duplicates. Do not use them if you have the plugin installed.
51
+
52
+ ## Path Variables
53
+
54
+ Throughout the skills, the following substitutions have been made to make them portable:
55
+
56
+ | Original | Generic | Your Project |
57
+ |----------|---------|--------------|
58
+ | `/full/path/to/monorepo/` | `{PROJECT_ROOT}/` | Your monorepo root |
59
+ | `docs/guides/agent-bootstrap.md` | `{PROJECT_ROOT}/docs/guides/agent-bootstrap.md` | Your agent guide |
60
+ | `develop` branch | `{development-branch}` | Your development branch |
61
+ | `main` branch | `{production-branch}` | Your production branch |
62
+ | Specific apps | `your-app-name` | Your app names |
63
+
64
+ ## Skills Overview
65
+
66
+ 23 skills organized into 5 categories:
67
+
68
+ ### Orchestration Skills (workflow drivers)
69
+ - rdc:build, rdc:plan, rdc:preplan, rdc:review, rdc:overnight, rdc:fixit, rdc:status, rdc:report
70
+
71
+ ### Agent Guides (dispatched by rdc:build, not user-invocable)
72
+ Located in `guides/agents/` — plain markdown playbooks spawned as sub-agents:
73
+ - frontend, backend, data, design, infrastructure, content, cs2, viz, setup, verify
74
+
75
+ ### Bridge Skills (Planning → CLI)
76
+ - rdc:handoff, rdc:prototype, rdc:workitems
77
+
78
+ ### Utility Skills
79
+ - rdc:collab
80
+
81
+ ### Reference
82
+ - rdc:help
83
+
84
+ ## Key Features
85
+
86
+ ### TDD Enforcement (Built In)
87
+
88
+ - `rdc:build` includes mandatory post-wave test gate via vitest
89
+ - `rdc:review` reports test coverage delta
90
+ - All agents write tests FIRST: red → implement → green
91
+ - Packages with implementation but 0 new tests are flagged
92
+
93
+ ### Core Rules (Non-Negotiable)
94
+
95
+ 1. NEVER run `pnpm build` — crashes the system. Use `npx tsc --noEmit` + vitest only
96
+ 2. NEVER let agents overlap on the same files
97
+ 3. ALWAYS create work items BEFORE starting work
98
+ 4. ALWAYS read guide files before agent dispatch
99
+ 5. ALWAYS update work items in real time
100
+ 6. Tests FIRST, then implementation — red → green
101
+ 7. Push after every logical block
102
+
103
+ ## How to Adapt for Your Project
104
+
105
+ 1. Replace path variables in all skills:
106
+ - `{PROJECT_ROOT}` → your monorepo root
107
+ - `{development-branch}` → your dev branch
108
+ - `{production-branch}` → your production branch
109
+
110
+ 2. Create project guides in `{PROJECT_ROOT}/docs/guides/`:
111
+ - agent-bootstrap.md, frontend.md, backend.md, data.md, design.md, infrastructure.md, content.md
112
+
113
+ 3. Set up database (Supabase or equivalent):
114
+ - work_items table
115
+ - RPC functions: get_open_epics, insert_work_item, update_work_item_status, get_work_items_by_epic, bump_epic_version
116
+ - prototype_registry table
117
+ - design_context table
118
+
119
+ 4. Update database references from `work_items` to your actual table names
120
+
121
+ 5. Configure credential daemon or update `http://127.0.0.1:52437` references
122
+
123
+ ## File Structure
124
+
125
+ ```
126
+ skills/
127
+ build/SKILL.md (dispatch agents in waves — mandatory validator gate)
128
+ plan/SKILL.md (create architecture + tasks)
129
+ preplan/SKILL.md (research before planning)
130
+ review/SKILL.md (quality gate: tests, types, docs)
131
+ overnight/SKILL.md (unattended multi-epic supervisor)
132
+ fixit/SKILL.md (quick-fix bypass)
133
+ status/SKILL.md (project dashboard)
134
+ report/SKILL.md (nightly report)
135
+ collab/SKILL.md (bidirectional claude.ai ↔ Claude Code relay)
136
+ handoff/SKILL.md (planning → work items)
137
+ prototype/SKILL.md (build JSX prototype)
138
+ workitems/SKILL.md (work item management)
139
+ help/SKILL.md (skill index — shows current version)
140
+ deploy/SKILL.md (Coolify ops: deploy, new, diagnose, audit)
141
+ release/SKILL.md (atomic package/app release)
142
+ self-test/SKILL.md (skill suite health check)
143
+ watch/SKILL.md (session log watcher)
144
+
145
+ guides/agents/ (agent-only playbooks — dispatched by rdc:build, not user-invocable)
146
+ frontend.md (React, UI, Tailwind)
147
+ backend.md (API routes, database, auth)
148
+ data.md (migrations, schema, RPC)
149
+ design.md (brand, tokens, design)
150
+ infrastructure.md (deployment, CI/CD, DNS)
151
+ content.md (copy, messaging, tone)
152
+ cs2.md (paradigm-level work)
153
+ viz.md (visualizations, charts, SVG)
154
+ setup.md (project scan + .rdc/config.json generation)
155
+ verify.md (evidence-before-claims verification gate — tsc + vitest + HTTP)
156
+
157
+ scripts/
158
+ install.sh (legacy only — do not use with plugin install)
159
+ install.ps1 (legacy only — do not use with plugin install)
160
+ ```
161
+
162
+ ## Check installed version
163
+
164
+ ```bash
165
+ # See version in rdc:help skill
166
+ head -4 ~/.claude/skills/user/rdc-help.md # if using manual install
167
+
168
+ # Or check source directly
169
+ python3 -c "import json; print(json.load(open('package.json'))['version'])"
170
+
171
+ # Or invoke the skill
172
+ /rdc:help
173
+ ```
174
+
175
+ Current version: **v0.8.0**
176
+
177
+ ## Quick Start
178
+
179
+ 1. Copy this directory to your project
180
+ 2. Update `{PROJECT_ROOT}` paths in all skills
181
+ 3. Create the required project guides and database tables
182
+ 4. Invoke skills via your agent framework:
183
+ - `/rdc:build <epic-id>` — dispatch agents
184
+ - `/rdc:overnight` — unattended multi-epic build
185
+ - `/rdc:review` — quality gate
186
+ - etc.
187
+
188
+ All skills follow the same patterns: check before acting, update work items in real time, push often, test first.
@@ -0,0 +1,3 @@
1
+ # Sandbox
2
+
3
+ Hello world
@@ -0,0 +1,164 @@
1
+ <!doctype html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="utf-8" />
5
+ <title>rdc:watch — session log</title>
6
+ <style>
7
+ :root {
8
+ --bg: #0b0f0b;
9
+ --fg: #c8f0c8;
10
+ --dim: #6a7a6a;
11
+ --bar: #111a11;
12
+ --bar-stall: #3a2f00;
13
+ --dispatch: #6aa9ff;
14
+ --commit: #58d06a;
15
+ --test: #e6c84a;
16
+ --error: #ff6060;
17
+ --note: #8a8a8a;
18
+ --banner: #ffffff;
19
+ }
20
+ * { box-sizing: border-box; }
21
+ html, body { margin: 0; padding: 0; height: 100%; background: var(--bg); color: var(--fg); font-family: ui-monospace, "Cascadia Mono", Menlo, Consolas, monospace; font-size: 13px; }
22
+ body { display: flex; flex-direction: column; }
23
+ header {
24
+ background: var(--bar);
25
+ border-bottom: 1px solid #1d2a1d;
26
+ padding: 8px 14px;
27
+ display: flex;
28
+ gap: 18px;
29
+ flex-wrap: wrap;
30
+ font-size: 12px;
31
+ color: var(--dim);
32
+ }
33
+ header.stalled { background: var(--bar-stall); color: #ffe08a; }
34
+ header b { color: var(--fg); font-weight: 600; }
35
+ header.stalled b { color: #ffe08a; }
36
+ #log {
37
+ flex: 1;
38
+ overflow-y: auto;
39
+ padding: 10px 14px 40px;
40
+ white-space: pre-wrap;
41
+ word-break: break-word;
42
+ }
43
+ .line { padding: 1px 0; line-height: 1.45; }
44
+ .ts { color: var(--dim); margin-right: 8px; }
45
+ .kind {
46
+ display: inline-block;
47
+ min-width: 70px;
48
+ margin-right: 8px;
49
+ text-transform: uppercase;
50
+ font-size: 11px;
51
+ letter-spacing: 0.05em;
52
+ }
53
+ .dispatch .kind, .dispatch .msg { color: var(--dispatch); }
54
+ .commit .kind, .commit .msg { color: var(--commit); }
55
+ .test .kind, .test .msg { color: var(--test); }
56
+ .error .kind, .error .msg { color: var(--error); }
57
+ .note .kind, .note .msg { color: var(--note); }
58
+ .banner .kind, .banner .msg { color: var(--banner); font-weight: 700; }
59
+ </style>
60
+ </head>
61
+ <body>
62
+ <header id="bar">
63
+ <div>session <b id="sid">—</b></div>
64
+ <div>started <b id="started">—</b></div>
65
+ <div>events <b id="count">0</b></div>
66
+ <div>updated <b id="updated">—</b></div>
67
+ <div id="status"></div>
68
+ </header>
69
+ <div id="log"></div>
70
+ <script>
71
+ (function () {
72
+ const LOG_URL = "./current.log";
73
+ const POLL_MS = 2000;
74
+ const logEl = document.getElementById("log");
75
+ const bar = document.getElementById("bar");
76
+ const sidEl = document.getElementById("sid");
77
+ const startedEl = document.getElementById("started");
78
+ const countEl = document.getElementById("count");
79
+ const updatedEl = document.getElementById("updated");
80
+ const statusEl = document.getElementById("status");
81
+
82
+ let lastLen = 0;
83
+ let count = 0;
84
+ let sessionSet = false;
85
+
86
+ const LINE_RE = /^\[([^\]]+)\]\s*\[([^\]]+)\]\s*(.*)$/;
87
+ const KINDS = new Set(["dispatch", "commit", "test", "error", "note", "banner"]);
88
+
89
+ function isAtBottom() {
90
+ return logEl.scrollHeight - logEl.scrollTop - logEl.clientHeight < 40;
91
+ }
92
+
93
+ function renderLine(raw) {
94
+ const m = raw.match(LINE_RE);
95
+ let ts = "", kind = "note", msg = raw;
96
+ if (m) {
97
+ ts = m[1];
98
+ kind = KINDS.has(m[2].toLowerCase()) ? m[2].toLowerCase() : "note";
99
+ msg = m[3];
100
+ }
101
+ const div = document.createElement("div");
102
+ div.className = "line " + kind;
103
+ const tsSpan = document.createElement("span");
104
+ tsSpan.className = "ts";
105
+ tsSpan.textContent = ts;
106
+ const kSpan = document.createElement("span");
107
+ kSpan.className = "kind";
108
+ kSpan.textContent = kind;
109
+ const mSpan = document.createElement("span");
110
+ mSpan.className = "msg";
111
+ mSpan.textContent = msg;
112
+ div.appendChild(tsSpan);
113
+ div.appendChild(kSpan);
114
+ div.appendChild(mSpan);
115
+ logEl.appendChild(div);
116
+
117
+ if (kind === "banner" && !sessionSet) {
118
+ const idMatch = msg.match(/Session started:\s*(\S+)/);
119
+ if (idMatch) sidEl.textContent = idMatch[1];
120
+ if (ts) startedEl.textContent = ts;
121
+ sessionSet = true;
122
+ }
123
+ count += 1;
124
+ }
125
+
126
+ async function poll() {
127
+ try {
128
+ const res = await fetch(LOG_URL + "?t=" + Date.now(), { cache: "no-store" });
129
+ if (!res.ok) throw new Error("http " + res.status);
130
+ const text = await res.text();
131
+ if (text.length < lastLen) {
132
+ // File shrank — reset (new session).
133
+ logEl.innerHTML = "";
134
+ lastLen = 0;
135
+ count = 0;
136
+ sessionSet = false;
137
+ }
138
+ if (text.length > lastLen) {
139
+ const stick = isAtBottom();
140
+ const chunk = text.slice(lastLen);
141
+ lastLen = text.length;
142
+ const lines = chunk.split(/\r?\n/);
143
+ for (const line of lines) {
144
+ if (line.trim().length === 0) continue;
145
+ renderLine(line);
146
+ }
147
+ countEl.textContent = String(count);
148
+ updatedEl.textContent = new Date().toLocaleTimeString();
149
+ if (stick) logEl.scrollTop = logEl.scrollHeight;
150
+ }
151
+ bar.classList.remove("stalled");
152
+ statusEl.textContent = "";
153
+ } catch (e) {
154
+ bar.classList.add("stalled");
155
+ statusEl.textContent = "stalled — retrying";
156
+ }
157
+ }
158
+
159
+ poll();
160
+ setInterval(poll, POLL_MS);
161
+ })();
162
+ </script>
163
+ </body>
164
+ </html>
@@ -0,0 +1,183 @@
1
+ ---
2
+ name: rdc:build
3
+ description: >-
4
+ Usage `rdc:build <epic-id|topic> [--unattended]` — dispatch typed agents from an epic, commit, push, update work items. The build engine. Use after rdc:plan or when the project lead says "build it".
5
+ ---
6
+
7
+ > **⚠️ OUTPUT CONTRACT (READ FIRST):** `guides/output-contract.md`
8
+ > Checklist-only output. No tool-call narration. No raw MCP/JSON/log dumps.
9
+ > One checklist upfront, updated in place, shown again at end with a 1-line verdict.
10
+
11
+ > **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.
12
+
13
+
14
+ # rdc:build — Typed Agent Dispatch Engine
15
+
16
+ ## When to Use
17
+ - Plan is approved and ready to execute
18
+ - Project lead says "build it", "go", "execute", "do not stop"
19
+ - An epic exists with child tasks ready for implementation
20
+ - Called by `rdc:overnight` as part of the automated build loop
21
+
22
+ ## Arguments
23
+ - `rdc:build <epic-id>` — build from a specific Supabase epic
24
+ - `rdc:build <topic>` — find the epic by label/title match
25
+ - `rdc:build` (no args) — show open epics and ask which to build (interactive only)
26
+ - `rdc:build <epic-id> --unattended` — silent mode for overnight builds
27
+
28
+ ## Agent Types & Guide Files
29
+
30
+ Every dispatched agent MUST read two files before starting — in this order:
31
+ 1. `{PROJECT_ROOT}/.rdc/guides/agent-bootstrap.md` — credentials, git rules, completion report format
32
+ (fallback: `{PROJECT_ROOT}/.rdc/guides/agent-bootstrap.md` if `.rdc/` does not exist)
33
+ 2. `{PROJECT_ROOT}/.rdc/guides/<type>.md` — role-specific guide
34
+ (fallback: `{PROJECT_ROOT}/.rdc/guides/<type>.md`)
35
+
36
+ Include both lines in every agent prompt:
37
+ ```
38
+ "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."
39
+ ```
40
+
41
+ | Agent Type | Guide File | When to dispatch |
42
+ |-----------|-----------|-----------------|
43
+ | `frontend` | `.rdc/guides/frontend.md` | React components, pages, UI, Tailwind, animation |
44
+ | `backend` | `.rdc/guides/backend.md` | API routes, server components, database queries, auth |
45
+ | `data` | `.rdc/guides/data.md` | Migrations, schema changes, RPC functions |
46
+ | `design` | `.rdc/guides/design.md` | Visual design, brand palettes, OG images, token work |
47
+ | `infra` | `.rdc/guides/infrastructure.md` | CI/CD, deployment, DNS, SSL |
48
+ | `content` | `.rdc/guides/content.md` | Marketing copy, messaging, tone |
49
+ | `cs2` | `.rdc/guides/cs2.md` | CS 2.0 paradigm work (generic) |
50
+ | `hail` | `.rdc/guides/cs2.md` + `packages/hail/CLAUDE.md` | Grammar, DSL compiler, evolution |
51
+ | `pal` | `.rdc/guides/cs2.md` + `packages/pal/CLAUDE.md` | Sessions, moment windows, graph memory |
52
+ | `bpmn` | `.rdc/guides/cs2.md` + `docs/systems/<domain>/flowable-bpmn-architecture.md` | BPMN flows, governance |
53
+ | `virtue` | `.rdc/guides/cs2.md` + `packages/virtue-engine/CLAUDE.md` | Virtue weights, coherence, certification |
54
+ | `viz` | `.rdc/guides/frontend.md` + `.rdc/guides/design.md` | Custom viz components, charts, diagrams |
55
+
56
+ ### How to classify a task → agent type
57
+
58
+ Read the task title and description, then:
59
+ - Mentions React, component, page, UI, Tailwind → `frontend`
60
+ - Mentions API route, server, database query, auth → `backend`
61
+ - Mentions migration, schema, table, RPC → `data`
62
+ - Mentions brand, palette, typography, OG image → `design`
63
+ - Mentions deploy, infrastructure, CI, DNS → `infra`
64
+ - Mentions copy, messaging, email template → `content`
65
+ - Mentions grammar, DSL, compiler → `hail`
66
+ - Mentions session, moment, memory graph → `pal`
67
+ - Mentions BPMN, flow, governance → `bpmn`
68
+ - Mentions virtue, coherence, certification → `virtue`
69
+ - Mentions visualization, chart, diagram, SVG → `viz`
70
+ - Multiple types? Dispatch multiple agents, each with its guide.
71
+
72
+ ## Procedure
73
+
74
+ 1. **Load the epic:**
75
+ ```sql
76
+ SELECT get_work_items_by_epic('<epic-id>', 'todo');
77
+ ```
78
+ - Interactive (no args): show open epics, ask which to build
79
+ - Unattended (no tasks found): escalate via advisor tool
80
+
81
+ 2. **CHECK FOR EXISTING WORK (mandatory — never skip):**
82
+ ```sql
83
+ -- Check if prototypes exist from earlier sessions
84
+ SELECT name, component, source_path, status, notes
85
+ FROM prototype_registry
86
+ WHERE status IN ('prototype', 'converting')
87
+ ORDER BY created_at DESC;
88
+
89
+ -- Check for design decisions on this topic
90
+ SELECT topic, context_type, summary, source
91
+ FROM design_context
92
+ WHERE topic ILIKE '%<epic-topic>%'
93
+ ORDER BY created_at DESC;
94
+ ```
95
+ **If a prototype exists: ADAPT IT. Do not build from scratch.**
96
+ Tell the agent: "Read <source_path> first and convert it to the production contract."
97
+
98
+ **If design decisions exist: follow them.** Include the summary in the agent prompt.
99
+
100
+ 3. **Load the plan** (if exists): check `.rdc/plans/` for matching topic (fallback: `.rdc/plans/`).
101
+
102
+ 4. **Read CLAUDE.md files** for all affected packages.
103
+
104
+ 5. **Classify each task** → assign agent type from the table above.
105
+
106
+ 6. **Group tasks into waves** — parallelize tasks with no file overlap:
107
+ - Wave 1: independent tasks (different packages/files)
108
+ - Wave 2: tasks that depend on Wave 1 outputs
109
+ - Wave 3: integration tasks
110
+
111
+ 7. **For each wave — dispatch typed agents in parallel:**
112
+ - Set work item to `in_progress` before dispatching
113
+ - Each agent prompt MUST include:
114
+ - `"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."`
115
+ - Specific files to create/modify
116
+ - Exact deliverables and commit message
117
+ - `"NEVER run pnpm build/test. NEVER modify files outside your scope."`
118
+ - Use `run_in_background: true` for parallel execution
119
+ - NEVER let agents overlap on the same files
120
+
121
+ 8. **Post-wave test gate (mandatory):**
122
+ After all agents in a wave complete, before marking tasks done:
123
+ ```bash
124
+ # For each package modified in this wave:
125
+ cd packages/<name> && npx vitest run 2>&1 | tail -20
126
+ ```
127
+ - All tests must pass before proceeding to next wave
128
+ - If tests fail: fix before marking the wave done
129
+ - NEVER use `pnpm build` or `pnpm turbo test` — vitest only per package
130
+ - New code must have tests: if a modified package shows 0 new test files, flag it
131
+
132
+ 9. **As agents complete:**
133
+ - Verify commit landed on the development branch
134
+ - Push to origin *(skip if `$RDC_TEST=1` — echo `[RDC_TEST] skipping git push` instead)*
135
+ - Set work item to `done` with notes
136
+ - Continue to next wave
137
+
138
+ **If an agent fails:**
139
+ - Interactive: diagnose before retrying
140
+ - Unattended: retry once; on second failure escalate via advisor
141
+ ```
142
+ BUILD_STATUS: { wave, tasks_done, tasks_failed, commits, escalated: true }
143
+ ```
144
+
145
+ 10. **Final verification gate (mandatory — before marking epic done):**
146
+ Dispatch the verify agent (see `guides/agents/verify.md`) across every package/app touched in this build.
147
+ The Iron Law: **NO COMPLETION CLAIMS WITHOUT FRESH VERIFICATION EVIDENCE.**
148
+ - Run `npx vitest run --dir <pkg>` fresh for each touched package
149
+ - Run `npx tsc --noEmit --project <pkg>/tsconfig.json` for each
150
+ - Read the full output — zero failures, zero type errors
151
+ - If any step fails: fix and re-run the entire gate. Do not skip.
152
+ - NEVER `pnpm build` / `pnpm test` / `pnpm -r` (crashes machine)
153
+
154
+ 11. **After verification passes:**
155
+ - Push all commits:
156
+ ```bash
157
+ if [ "$RDC_TEST" != "1" ]; then
158
+ git push origin {development-branch}
159
+ else
160
+ echo "[RDC_TEST] skipping git push origin {development-branch}"
161
+ fi
162
+ ```
163
+ - Update epic version: `bump_epic_version()`
164
+ - Report summary with verification evidence quoted
165
+
166
+ ## Agent TDD Requirements
167
+
168
+ When dispatching agents, include in every prompt:
169
+ ```
170
+ TDD REQUIREMENT: Write tests FIRST for new functions/modules.
171
+ Run: npx vitest run packages/<name> to verify red → implement → verify green.
172
+ NEVER run pnpm build or pnpm turbo. Use npx vitest run only.
173
+ ```
174
+
175
+ ## Rules
176
+ - Branch: development branch only (auto-commit, no confirmation needed)
177
+ - NEVER let two agents edit the same file
178
+ - NEVER run `pnpm build` (crashes system) — code only
179
+ - Every agent reads its guide file — no exceptions
180
+ - Update Supabase work items IN REAL TIME — not batch at end
181
+ - Push after each wave, not just at the end
182
+ - Unattended: NEVER pause — continue automatically
183
+ - Unattended: max 2 retries per task before escalating to advisor