@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
@@ -0,0 +1,77 @@
1
+ # Uninstall rdc-skills plugin from Claude Code
2
+ # Windows PowerShell script
3
+
4
+ param(
5
+ [string]$claudeHome = $env:CLAUDE_HOME,
6
+ [switch]$confirm = $false
7
+ )
8
+
9
+ # Detect CLAUDE_HOME if not provided
10
+ if (-not $claudeHome) {
11
+ $claudeHome = Join-Path $env:USERPROFILE ".claude"
12
+ }
13
+
14
+ Write-Host "rdc-skills Uninstaller" -ForegroundColor Red
15
+ Write-Host "======================" -ForegroundColor Red
16
+ Write-Host ""
17
+
18
+ # Check CLAUDE_HOME exists
19
+ if (-not (Test-Path $claudeHome)) {
20
+ Write-Host "CLAUDE_HOME does not exist or is empty: $claudeHome" -ForegroundColor Yellow
21
+ exit 0
22
+ }
23
+
24
+ Write-Host "CLAUDE_HOME: $claudeHome" -ForegroundColor Cyan
25
+ Write-Host ""
26
+
27
+ # List what will be removed
28
+ $skillsDir = Join-Path $claudeHome "skills" "user"
29
+ $hooksDir = Join-Path $claudeHome "hooks"
30
+
31
+ $toDelete = @()
32
+
33
+ if (Test-Path $skillsDir) {
34
+ $skills = Get-ChildItem -Path $skillsDir -Filter "rdc*.md" -ErrorAction SilentlyContinue
35
+ foreach ($skill in $skills) {
36
+ $toDelete += $skill.FullName
37
+ }
38
+ }
39
+
40
+ if (Test-Path $hooksDir) {
41
+ $hooks = Get-ChildItem -Path $hooksDir -Filter "*open-epics*" -ErrorAction SilentlyContinue
42
+ foreach ($hook in $hooks) {
43
+ $toDelete += $hook.FullName
44
+ }
45
+ }
46
+
47
+ if ($toDelete.Count -eq 0) {
48
+ Write-Host "No rdc-skills files found to remove." -ForegroundColor Yellow
49
+ exit 0
50
+ }
51
+
52
+ Write-Host "Will remove the following files:" -ForegroundColor Yellow
53
+ foreach ($file in $toDelete) {
54
+ Write-Host " - $(Split-Path -Leaf $file)" -ForegroundColor DarkRed
55
+ }
56
+ Write-Host ""
57
+
58
+ # Confirm
59
+ if (-not $confirm) {
60
+ $response = Read-Host "Continue? (y/N)"
61
+ if ($response -ne 'y' -and $response -ne 'Y') {
62
+ Write-Host "Cancelled." -ForegroundColor Yellow
63
+ exit 0
64
+ }
65
+ }
66
+
67
+ # Remove files
68
+ foreach ($file in $toDelete) {
69
+ Remove-Item -Path $file -Force -ErrorAction SilentlyContinue
70
+ Write-Host "✓ Removed: $(Split-Path -Leaf $file)" -ForegroundColor Green
71
+ }
72
+
73
+ Write-Host ""
74
+ Write-Host "Uninstall Complete" -ForegroundColor Green
75
+ Write-Host ""
76
+ Write-Host "Remaining guides and project overlays in docs/guides/ were NOT removed." -ForegroundColor Cyan
77
+ Write-Host "Delete them manually if desired." -ForegroundColor Cyan
@@ -0,0 +1,69 @@
1
+ #!/bin/bash
2
+ # Uninstall rdc-skills plugin from Claude Code
3
+ # Unix/macOS bash script
4
+
5
+ set -e
6
+
7
+ CLAUDE_HOME="${CLAUDE_HOME:-$HOME/.claude}"
8
+
9
+ echo "rdc-skills Uninstaller"
10
+ echo "======================"
11
+ echo ""
12
+
13
+ # Check CLAUDE_HOME exists
14
+ if [ ! -d "$CLAUDE_HOME" ]; then
15
+ echo "CLAUDE_HOME does not exist: $CLAUDE_HOME"
16
+ exit 0
17
+ fi
18
+
19
+ echo "CLAUDE_HOME: $CLAUDE_HOME"
20
+ echo ""
21
+
22
+ # Find files to remove
23
+ SKILLS_DIR="$CLAUDE_HOME/skills/user"
24
+ HOOKS_DIR="$CLAUDE_HOME/hooks"
25
+
26
+ TO_DELETE=()
27
+
28
+ if [ -d "$SKILLS_DIR" ]; then
29
+ while IFS= read -r -d '' file; do
30
+ TO_DELETE+=("$file")
31
+ done < <(find "$SKILLS_DIR" -maxdepth 1 -name "rdc*.md" -print0 2>/dev/null)
32
+ fi
33
+
34
+ if [ -d "$HOOKS_DIR" ]; then
35
+ while IFS= read -r -d '' file; do
36
+ TO_DELETE+=("$file")
37
+ done < <(find "$HOOKS_DIR" -maxdepth 1 -name "*open-epics*" -print0 2>/dev/null)
38
+ fi
39
+
40
+ if [ ${#TO_DELETE[@]} -eq 0 ]; then
41
+ echo "No rdc-skills files found to remove."
42
+ exit 0
43
+ fi
44
+
45
+ echo "Will remove the following files:"
46
+ for file in "${TO_DELETE[@]}"; do
47
+ echo " - $(basename "$file")"
48
+ done
49
+ echo ""
50
+
51
+ # Confirm
52
+ read -p "Continue? (y/N) " -n 1 -r
53
+ echo
54
+ if [[ ! $REPLY =~ ^[Yy]$ ]]; then
55
+ echo "Cancelled."
56
+ exit 0
57
+ fi
58
+
59
+ # Remove files
60
+ for file in "${TO_DELETE[@]}"; do
61
+ rm -f "$file"
62
+ echo "✓ Removed: $(basename "$file")"
63
+ done
64
+
65
+ echo ""
66
+ echo "Uninstall Complete"
67
+ echo ""
68
+ echo "Remaining guides and project overlays in docs/guides/ were NOT removed."
69
+ echo "Delete them manually if desired."
@@ -0,0 +1,43 @@
1
+ # Update rdc-skills plugin to latest version
2
+ # Windows PowerShell script
3
+
4
+ Write-Host "rdc-skills Updater" -ForegroundColor Cyan
5
+ Write-Host "=================" -ForegroundColor Cyan
6
+ Write-Host ""
7
+
8
+ $repoRoot = Split-Path -Parent (Split-Path -Parent $MyInvocation.MyCommand.Path)
9
+
10
+ # Get current version before pulling
11
+ $oldVersion = "unknown"
12
+ $pkgFile = Join-Path $repoRoot "package.json"
13
+ if (Test-Path $pkgFile) {
14
+ $pkg = Get-Content $pkgFile | ConvertFrom-Json
15
+ $oldVersion = $pkg.version
16
+ }
17
+
18
+ Write-Host "Current version: $oldVersion" -ForegroundColor Yellow
19
+
20
+ # Pull latest from git
21
+ Write-Host "Pulling latest from git..." -ForegroundColor Cyan
22
+ Push-Location $repoRoot
23
+ git fetch origin | Out-Null
24
+ git pull origin main --ff-only 2>&1 | ForEach-Object { Write-Host " $_" }
25
+ Pop-Location
26
+
27
+ # Get new version after pulling
28
+ $newVersion = "unknown"
29
+ if (Test-Path $pkgFile) {
30
+ $pkg = Get-Content $pkgFile | ConvertFrom-Json
31
+ $newVersion = $pkg.version
32
+ }
33
+
34
+ Write-Host "New version: $newVersion" -ForegroundColor Green
35
+
36
+ if ($oldVersion -eq $newVersion) {
37
+ Write-Host ""
38
+ Write-Host "Already up to date." -ForegroundColor Yellow
39
+ } else {
40
+ Write-Host ""
41
+ Write-Host "Reinstalling..." -ForegroundColor Cyan
42
+ & (Join-Path $repoRoot "scripts" "install.ps1")
43
+ }
@@ -0,0 +1,43 @@
1
+ #!/bin/bash
2
+ # Update rdc-skills plugin to latest version
3
+ # Unix/macOS bash script
4
+
5
+ set -e
6
+
7
+ SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
8
+ REPO_ROOT="$(dirname "$SCRIPT_DIR")"
9
+
10
+ echo "rdc-skills Updater"
11
+ echo "=================="
12
+ echo ""
13
+
14
+ # Get current version before pulling
15
+ OLD_VERSION="unknown"
16
+ if [ -f "$REPO_ROOT/package.json" ]; then
17
+ OLD_VERSION=$(grep '"version"' "$REPO_ROOT/package.json" | head -1 | sed 's/.*"version": "\(.*\)".*/\1/')
18
+ fi
19
+
20
+ echo "Current version: $OLD_VERSION"
21
+
22
+ # Pull latest from git
23
+ echo "Pulling latest from git..."
24
+ cd "$REPO_ROOT"
25
+ git fetch origin
26
+ git pull origin main --ff-only || true
27
+
28
+ # Get new version after pulling
29
+ NEW_VERSION="unknown"
30
+ if [ -f "$REPO_ROOT/package.json" ]; then
31
+ NEW_VERSION=$(grep '"version"' "$REPO_ROOT/package.json" | head -1 | sed 's/.*"version": "\(.*\)".*/\1/')
32
+ fi
33
+
34
+ echo "New version: $NEW_VERSION"
35
+
36
+ if [ "$OLD_VERSION" = "$NEW_VERSION" ]; then
37
+ echo ""
38
+ echo "Already up to date."
39
+ else
40
+ echo ""
41
+ echo "Reinstalling..."
42
+ bash "$REPO_ROOT/scripts/install.sh"
43
+ fi
@@ -0,0 +1,100 @@
1
+ #!/usr/bin/env node
2
+ // watch-init.mjs — initialize a session log + viewer for rdc:watch.
3
+ //
4
+ // Usage:
5
+ // node scripts/watch-init.mjs [--project-root <path>]
6
+ //
7
+ // Creates:
8
+ // <projectRoot>/.rdc/session-log/<runId>.log (with banner line)
9
+ // <projectRoot>/.rdc/session-log/current.log (copy of the new log)
10
+ // <projectRoot>/.rdc/session-log/viewer.html (copied from plugin assets)
11
+ //
12
+ // Exits 0 on success, 1 on error.
13
+
14
+ import { mkdirSync, writeFileSync, copyFileSync, existsSync, statSync, readFileSync } from "node:fs";
15
+ import { join, resolve, dirname } from "node:path";
16
+ import { fileURLToPath } from "node:url";
17
+ import { platform } from "node:os";
18
+
19
+ function parseArgs(argv) {
20
+ const out = { projectRoot: process.cwd() };
21
+ for (let i = 0; i < argv.length; i++) {
22
+ if (argv[i] === "--project-root" && argv[i + 1]) {
23
+ out.projectRoot = resolve(argv[++i]);
24
+ }
25
+ }
26
+ return out;
27
+ }
28
+
29
+ function randId(n) {
30
+ const chars = "abcdefghijklmnopqrstuvwxyz0123456789";
31
+ let s = "";
32
+ for (let i = 0; i < n; i++) s += chars[Math.floor(Math.random() * chars.length)];
33
+ return s;
34
+ }
35
+
36
+ function makeRunId() {
37
+ const d = new Date();
38
+ const pad = (x) => String(x).padStart(2, "0");
39
+ const stamp =
40
+ d.getFullYear() + "-" + pad(d.getMonth() + 1) + "-" + pad(d.getDate()) +
41
+ "-" + pad(d.getHours()) + pad(d.getMinutes()) + pad(d.getSeconds());
42
+ return stamp + "-" + randId(6);
43
+ }
44
+
45
+ function openHint(viewerPath) {
46
+ const p = platform();
47
+ if (p === "win32") return `start "" "${viewerPath}"`;
48
+ if (p === "darwin") return `open "${viewerPath}"`;
49
+ return `xdg-open "${viewerPath}"`;
50
+ }
51
+
52
+ function main() {
53
+ const { projectRoot } = parseArgs(process.argv.slice(2));
54
+ const here = dirname(fileURLToPath(import.meta.url)); // .../rdc-skills/scripts
55
+ const pluginRoot = resolve(here, ".."); // .../rdc-skills
56
+ const assetViewer = join(pluginRoot, "assets", "watcher", "viewer.html");
57
+
58
+ if (!existsSync(assetViewer)) {
59
+ console.error(`watch-init: viewer asset missing at ${assetViewer}`);
60
+ process.exit(1);
61
+ }
62
+
63
+ const logDir = join(projectRoot, ".rdc", "session-log");
64
+ mkdirSync(logDir, { recursive: true });
65
+
66
+ const runId = makeRunId();
67
+ const logPath = join(logDir, `${runId}.log`);
68
+ const currentPath = join(logDir, "current.log");
69
+ const viewerPath = join(logDir, "viewer.html");
70
+
71
+ const iso = new Date().toISOString();
72
+ const banner = `[${iso}] [banner] Session started: ${runId}\n`;
73
+ writeFileSync(logPath, banner, "utf8");
74
+ writeFileSync(currentPath, banner, "utf8");
75
+
76
+ // Copy viewer.html if missing or stale (source newer than dest).
77
+ let needsCopy = !existsSync(viewerPath);
78
+ if (!needsCopy) {
79
+ try {
80
+ const srcM = statSync(assetViewer).mtimeMs;
81
+ const dstM = statSync(viewerPath).mtimeMs;
82
+ if (srcM > dstM) needsCopy = true;
83
+ } catch { needsCopy = true; }
84
+ }
85
+ if (needsCopy) copyFileSync(assetViewer, viewerPath);
86
+
87
+ console.log("run_id: " + runId);
88
+ console.log("log_path: " + logPath);
89
+ console.log("current: " + currentPath);
90
+ console.log("viewer: " + viewerPath);
91
+ console.log("open_hint: " + openHint(viewerPath));
92
+ process.exit(0);
93
+ }
94
+
95
+ try {
96
+ main();
97
+ } catch (err) {
98
+ console.error("watch-init: " + (err && err.message ? err.message : String(err)));
99
+ process.exit(1);
100
+ }
File without changes
@@ -0,0 +1,238 @@
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
+ 5b. **Write a checklist into every work item before dispatching:**
107
+ For each task, append a checklist to its notes BEFORE setting to `in_progress`:
108
+ ```sql
109
+ SELECT update_work_item_status('<id>'::uuid, 'in_progress',
110
+ '["CHECKLIST: [ ] <deliverable 1>, [ ] <deliverable 2>, [ ] tsc clean, [ ] route 200, [ ] committed"]'::jsonb
111
+ );
112
+ ```
113
+ The agent must complete every item on this checklist and return it checked off in AGENT_COMPLETE.
114
+ A checklist with unchecked items = incomplete work. Do not proceed to next wave with unchecked items.
115
+
116
+ 6. **Group tasks into waves** — parallelize tasks with no file overlap:
117
+ - Wave 1: independent tasks (different packages/files)
118
+ - Wave 2: tasks that depend on Wave 1 outputs
119
+ - Wave 3: integration tasks
120
+
121
+ 7. **For each wave — dispatch typed agents in parallel:**
122
+
123
+ ### ⛔ Agent Dispatch Non-Negotiable Defaults
124
+ Every `Agent()` call MUST include these parameters — no exceptions:
125
+ ```
126
+ model: "sonnet"
127
+ max_turns: 70
128
+ isolation: "worktree"
129
+ ```
130
+ Agents run Sonnet 4.6 — capable for implementation work, budget-safe for parallel dispatch. The supervisor session model does NOT cascade to agents; you must set it explicitly.
131
+ Without `max_turns: 70`, agents hit the default turn cap mid-task and stop.
132
+ `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).
133
+
134
+ ### Required agent prompt contents
135
+ - Set work item to `in_progress` before dispatching
136
+ - Each agent prompt MUST include:
137
+ - `"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."`
138
+ - Specific files to create/modify
139
+ - Exact deliverables and commit message
140
+ - `"NEVER run pnpm build/test. NEVER modify files outside your scope."`
141
+ - **`"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."`**
142
+ - **`"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."`**
143
+ - **`"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."`**
144
+ - **`"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."`**
145
+ - Use `run_in_background: true` for parallel execution
146
+ - NEVER let agents overlap on the same files
147
+
148
+ 8. **Post-wave test gate (mandatory):**
149
+ After all agents in a wave complete, before proceeding:
150
+ ```bash
151
+ # For each package modified in this wave:
152
+ cd packages/<name> && npx vitest run 2>&1 | tail -20
153
+ ```
154
+ - All tests must pass before proceeding to next wave
155
+ - If tests fail: fix before proceeding
156
+ - NEVER use `pnpm build` or `pnpm turbo test` — vitest only per package
157
+ - New code must have tests: if a modified package shows 0 new test files, flag it
158
+
159
+ 9. **After all wave agents complete — merge worktrees and push:**
160
+
161
+ Each completed agent returns a worktree branch (e.g. `claude/agent-frontend-abc123`). Merge them all to develop before running the test gate:
162
+
163
+ ```bash
164
+ # For each worktree branch returned by agents in this wave:
165
+ git merge --no-ff <worktree-branch> -m "merge(<agent-type>): <task-title>"
166
+ ```
167
+
168
+ - Resolve any conflicts before proceeding — do not skip
169
+ - Worker agents set items to `review` — **do NOT close to `done` yet**
170
+ - After all branches merged, push once:
171
+ ```bash
172
+ if [ "$RDC_TEST" != "1" ]; then
173
+ git push origin develop
174
+ else
175
+ echo "[RDC_TEST] skipping git push"
176
+ fi
177
+ ```
178
+ - Then run the post-wave test gate (Step 8) on the merged state
179
+ - Continue to next wave
180
+
181
+ **If an agent fails (returns no worktree branch):**
182
+ - Interactive: diagnose before retrying
183
+ - Unattended: retry once; on second failure escalate via advisor
184
+ ```
185
+ BUILD_STATUS: { wave, tasks_done, tasks_failed, commits, escalated: true }
186
+ ```
187
+
188
+ 10. **Mandatory validator gate (runs after ALL waves complete — before any work item closes):**
189
+
190
+ ⛔ **NO work item may be set to `done` without the validator passing it.**
191
+
192
+ Dispatch ONE validator agent with the complete list of `review` work items and the full git diff.
193
+ ⚠️ The validator does NOT use `isolation: "worktree"` — it must read the fully merged develop branch. Omit the isolation parameter for this dispatch only.
194
+
195
+ ```
196
+ "Read C:/Dev/regen-root/.rdc/guides/agent-bootstrap.md then C:/Dev/regen-root/.rdc/guides/verify.md.
197
+ Validate these work items: [list of IDs and titles].
198
+ Apps touched: [list].
199
+ Git diff since build start: [attach or reference].
200
+ You are the ONLY agent that closes work items to done.
201
+ Follow verify.md procedure exactly: tsc → vitest → dev server route probes → record result per item."
202
+ ```
203
+
204
+ The validator:
205
+ - Runs `npx tsc --noEmit` for every touched app/package
206
+ - Starts the dev server and probes every modified route (expects HTTP 200, not 500)
207
+ - Runs vitest for every touched package
208
+ - Sets passing items to `done`, failing items back to `todo` with failure detail
209
+ - Returns `VALIDATOR_COMPLETE` report
210
+
211
+ **If the validator finds failures:** fix them in a new wave, then re-run the validator. Do not skip.
212
+ **File existence alone is NOT verification.** A route returning 500 is a failure regardless of tsc passing.
213
+
214
+ 11. **After verification passes:**
215
+ - All wave commits are already on develop and pushed (Step 9 pushes after each wave merge).
216
+ - Update epic version: `bump_epic_version()`
217
+ - Report summary with verification evidence quoted
218
+
219
+ ## Agent TDD Requirements
220
+
221
+ When dispatching agents, include in every prompt:
222
+ ```
223
+ TDD REQUIREMENT: Write tests FIRST for new functions/modules.
224
+ Run: npx vitest run packages/<name> to verify red → implement → verify green.
225
+ NEVER run pnpm build or pnpm turbo. Use npx vitest run only.
226
+ ```
227
+
228
+ ## Rules
229
+ - Branch: development branch only (auto-commit, no confirmation needed)
230
+ - NEVER let two agents edit the same file
231
+ - NEVER run `pnpm build` (crashes system) — code only
232
+ - Every agent reads its guide file — no exceptions
233
+ - Update Supabase work items IN REAL TIME — not batch at end
234
+ - Push after each wave, not just at the end
235
+ - Unattended: NEVER pause — continue automatically
236
+ - Unattended: max 2 retries per task before escalating to advisor
237
+ - Every Agent() dispatch: `model: "sonnet"` + `max_turns: 70` + `isolation: "worktree"` — non-negotiable (Sonnet agents, Opus supervisor). Exception: validator agent in Step 10 omits isolation.
238
+ - Finding an existing file is NOT task completion — verify it satisfies the spec