@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,220 @@
1
+ ---
2
+ name: rdc:overnight
3
+ description: >-
4
+ Usage `rdc:overnight [epic-id|label=X]` — unattended overnight supervisor, chains preplan → plan → build → review → report across all high-priority epics in --unattended mode. Use for "run overnight", "build while I sleep".
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
+ > If dispatching subagents or running as a subagent: read `{PROJECT_ROOT}/.rdc/guides/agent-bootstrap.md` first (fallback: `{PROJECT_ROOT}/.rdc/guides/agent-bootstrap.md`).
12
+
13
+ > **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.
14
+
15
+
16
+ # rdc:overnight — Overnight Build Supervisor
17
+
18
+ ## When to Use
19
+ - Starting an unattended multi-hour build session
20
+ - Project lead says "run overnight", "build everything", "go while I sleep"
21
+ - Kicking off a full epic queue after scoping is agreed
22
+
23
+ ## Arguments
24
+ - `/rdc:overnight` — work all urgent/high priority todo epics
25
+ - `/rdc:overnight <epic-id>` — work a specific epic only
26
+ - `/rdc:overnight label=<label>` — work epics matching label
27
+
28
+ ## Phase 1 — Pre-flight
29
+
30
+ **First action — set the overnight sentinel** so the `no-stop-open-epics` Stop hook engages (interactive sessions are not gated by it):
31
+
32
+ ```bash
33
+ mkdir -p C:/Dev/regen-root/.rdc && touch C:/Dev/regen-root/.rdc/overnight.lock
34
+ ```
35
+
36
+ **Last action at end of run (success OR failure) — remove the sentinel:**
37
+
38
+ ```bash
39
+ rm -f C:/Dev/regen-root/.rdc/overnight.lock
40
+ ```
41
+
42
+ If the sentinel file does not exist, the Stop hook will NOT block — which means interactive sessions stop freely and only `rdc:overnight` is held to the "drain the queue" contract.
43
+
44
+ Before touching any code, verify the environment is safe:
45
+
46
+ 1. **Clauth daemon alive:**
47
+ ```bash
48
+ curl -s http://127.0.0.1:52437/ping
49
+ ```
50
+ If not responding: report `BLOCKED: credential daemon offline` and exit. Do not proceed.
51
+
52
+ 2. **Git state clean:**
53
+ ```bash
54
+ git status --short
55
+ ```
56
+ Must be on the development branch with no uncommitted changes. If dirty: commit or stash first.
57
+
58
+ 3. **Baseline review:**
59
+ Run `rdc:review --unattended`. If `REVIEW_STATUS.verdict = "HAS_ISSUES"` and
60
+ issues cannot be auto-fixed: report `BLOCKED: codebase has pre-existing issues` and exit.
61
+ A dirty baseline overnight compounds into a disaster by morning.
62
+
63
+ If all three pass: proceed to Phase 2.
64
+
65
+ ## Phase 2 — Load Scope
66
+
67
+ Determine which epics to work:
68
+
69
+ - **Specific epic arg:** load that one epic via `get_work_items_by_epic()`
70
+ - **Label filter:** `SELECT get_open_epics(p_label_filter := '<label>')`
71
+ - **No arg (default):** `SELECT get_open_epics()` filtered to:
72
+ - `priority IN ('urgent', 'high')`
73
+ - `status IN ('todo', 'in_progress')`
74
+ - Order: urgent first, then high, then by `created_at`
75
+
76
+ Log the epic queue at the start of `.rdc/reports/overnight-<YYYY-MM-DD>.md` (fallback: `.rdc/reports/overnight-<YYYY-MM-DD>.md` if `.rdc/` does not exist).
77
+
78
+ ## Phase 3 — Epic Loop
79
+
80
+ For each epic in the queue, run this sequence:
81
+
82
+ ### 3a. Research (if needed)
83
+ Condition: epic has 0 child tasks AND no matching doc in `.rdc/plans/` (or `.rdc/plans/` as fallback)
84
+
85
+ ```
86
+ rdc:preplan <topic> --unattended
87
+ ```
88
+
89
+ Check `PREPLAN_STATUS.recommendation_confidence`:
90
+ - `"high"` or `"medium"`: proceed
91
+ - `"low"`: escalate via advisor tool (see Escalation Protocol below)
92
+ - If advisor gives direction: proceed with that direction
93
+ - If advisor cannot resolve: skip this epic, log reason, move to next
94
+
95
+ ### 3b. Plan (if no tasks exist)
96
+ Condition: epic has 0 child tasks after preplan
97
+
98
+ ```
99
+ rdc:plan <epic-id> --unattended
100
+ ```
101
+
102
+ Check `PLAN_STATUS.task_count > 0` before continuing.
103
+ If 0 tasks created: escalate via advisor, then skip if still unresolved.
104
+
105
+ ### 3c. Build
106
+
107
+ This skill delegates to rdc:build which uses typed agent dispatch. See rdc:build for agent type classification.
108
+
109
+ ```
110
+ rdc:build <epic-id> --unattended
111
+ ```
112
+
113
+ Agents receive the relevant guide file from `.rdc/guides/` (fallback: `.rdc/guides/`) based on their work package type.
114
+
115
+ After each wave: check `BUILD_STATUS`. If `escalated: true`, log the escalation
116
+ in the overnight doc and continue — don't stop the loop.
117
+
118
+ ### 3d. Review
119
+
120
+ ```
121
+ rdc:review --unattended
122
+ ```
123
+
124
+ Check `REVIEW_STATUS.verdict`:
125
+ - `"CLEAN"`: mark epic `done` in work_items, push, continue to next epic
126
+ - `"HAS_ISSUES"` with `escalations > 0`: log issues, push what's clean, continue
127
+ - `"HAS_ISSUES"` with `escalations = 0` (all auto-fixed): push, continue
128
+
129
+ ### 3e. Commit checkpoint
130
+
131
+ After each epic (pass or fail):
132
+ ```bash
133
+ if [ "$RDC_TEST" != "1" ]; then
134
+ git push origin {development-branch}
135
+ else
136
+ echo "[RDC_TEST] skipping git push origin {development-branch}"
137
+ fi
138
+ ```
139
+
140
+ This ensures every epic's work is saved regardless of what comes next.
141
+
142
+ ## Phase 4 — Exit
143
+
144
+ After all epics are processed:
145
+
146
+ 1. Run `rdc:report --unattended`
147
+
148
+ 2. Write session summary to `.rdc/reports/overnight-<YYYY-MM-DD>.md` (fallback: `.rdc/reports/overnight-<YYYY-MM-DD>.md`):
149
+ ```markdown
150
+ # Overnight Session — YYYY-MM-DD
151
+
152
+ ## Started
153
+ <timestamp>
154
+
155
+ ## Epics Attempted
156
+ | Epic | Status | Tasks Done | Commits |
157
+
158
+ ## Epics Completed
159
+ <list with epic IDs>
160
+
161
+ ## Escalations
162
+ N advisor calls — details:
163
+ - <epic>: <what was escalated> → <advisor response>
164
+
165
+ ## Blockers Remaining
166
+ <any epics skipped or partially done>
167
+
168
+ ## Git Summary
169
+ - Total commits: N
170
+ - Push status: ✅
171
+
172
+ ## Completed
173
+ <timestamp>
174
+ ```
175
+
176
+ 3. Final push:
177
+ ```bash
178
+ if [ "$RDC_TEST" != "1" ]; then
179
+ git push origin {development-branch}
180
+ else
181
+ echo "[RDC_TEST] skipping final git push origin {development-branch}"
182
+ fi
183
+ ```
184
+
185
+ ## Escalation Protocol
186
+
187
+ The advisor tool pairs this executor with a high-level model for high-stakes decisions.
188
+ Use it when genuinely stuck — not for every small uncertainty.
189
+
190
+ **Escalation triggers:**
191
+ - `PREPLAN_STATUS.recommendation_confidence = "low"` (too many unknowns)
192
+ - `PLAN_STATUS.task_count = 0` after planning (nothing actionable)
193
+ - Build agent fails twice on the same task
194
+ - `REVIEW_STATUS` has unfixable issues requiring architectural judgment
195
+ - Credential daemon goes down mid-session (escalate before exiting)
196
+
197
+ **How to escalate:**
198
+ Provide the advisor with:
199
+ 1. What was attempted and what failed
200
+ 2. The error or ambiguity in detail
201
+ 3. Two most likely paths forward with tradeoffs
202
+ 4. Which epic/task is blocked
203
+
204
+ **After advisor responds:**
205
+ - Log the guidance in the overnight doc
206
+ - Resume the loop from where it stopped
207
+ - If advisor cannot resolve: mark task/epic `blocked`, log reason, skip to next
208
+
209
+ **Max escalations:** 3 per epic. After 3, skip the epic and log.
210
+
211
+ ## Safety Rules
212
+
213
+ - Branch: development branch always — NEVER touch main/production
214
+ - NEVER run `pnpm build` — use `npx tsc --noEmit` for typecheck, vitest for tests only on modified packages
215
+ - NEVER let agents overlap on the same files
216
+ - Push after every epic, not just at the end
217
+ - Update Supabase work items in real time throughout
218
+ - Max 2 hours per epic — if exceeded, skip and log `TIMEOUT`
219
+ - If credential daemon goes down mid-session: write current state to overnight doc, push, exit gracefully
220
+ - If git push fails: log the failure, attempt rebase, retry once — do not force push
@@ -0,0 +1,158 @@
1
+ ---
2
+ name: rdc:plan
3
+ description: >-
4
+ Usage `rdc:plan <topic> [--unattended]` — architecture doc with design decisions, tradeoffs, work packages. Creates Supabase epics/tasks. Use after rdc:preplan or when given clear architectural direction.
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
+ > If dispatching subagents or running as a subagent: read `{PROJECT_ROOT}/.rdc/guides/agent-bootstrap.md` first (fallback: `{PROJECT_ROOT}/.rdc/guides/agent-bootstrap.md`).
12
+
13
+
14
+ # rdc:plan — Architecture & Work Packages
15
+
16
+ ## When to Use
17
+ - After `/rdc:preplan` produced research findings
18
+ - Project lead gives architectural direction ("build X with Y approach")
19
+ - An epic exists but needs breakdown into implementable tasks
20
+ - Before any large build session
21
+ - Called by `rdc:overnight` when an epic has no child tasks
22
+
23
+ ## Arguments
24
+ - `rdc:plan <topic>` — interactive planning session
25
+ - `rdc:plan <epic-id> --unattended` — silent mode for overnight builds
26
+
27
+ ## Procedure
28
+
29
+ 1. **Load source documents — MANDATORY before any planning decisions.**
30
+
31
+ **Step 1a — Always load these regardless of topic:**
32
+ ```
33
+ .claude/rules/infrastructure-contract.md — hard deployment + registry rules
34
+ .claude/rules/work-items-rpc.md — work item schema, RPC, status enums
35
+ .claude/rules/system-quick-links.md — routing map to all system architecture docs
36
+ .claude/rules/version-numbering.md — version bump rules for affected packages
37
+ ```
38
+
39
+ **Step 1b — Identify affected domains, then load the matching architecture doc:**
40
+
41
+ | Domain keywords in topic | Architecture doc to read |
42
+ |--------------------------|---------------------------|
43
+ | PRT, trust, capital, NAV, investor, land, DST | `docs/systems/prt/ARCHITECTURE.md` |
44
+ | CS 2.0, HAIL, PAL, virtue, quad-pixel, ontology, BPMN, cognitive | `docs/systems/cs2/ARCHITECTURE.md` |
45
+ | marketing, CRM, campaign, contact, outreach, RDC app | `docs/systems/rdc/ARCHITECTURE.md` |
46
+ | Claude workflow, skills, agents, dispatch, rdc:build | `docs/systems/claude-workflow/ARCHITECTURE.md` |
47
+ | Life AI, LIFEAI platform, life.ai | `docs/systems/lifeai/ARCHITECTURE.md` |
48
+ | media, R2, images, regen-media, MCP image | `docs/systems/media/ARCHITECTURE.md` |
49
+ | UI, component, brand, design token, shared, OG image | `docs/systems/shared/ARCHITECTURE.md` |
50
+
51
+ If the topic spans multiple domains: read ALL matching architecture docs before proceeding.
52
+ A plan that contradicts an existing architecture doc is invalid — load them first.
53
+
54
+ **Step 1c — Load domain-specific rules and context files:**
55
+
56
+ | Domain | Additional files to read |
57
+ |--------|---------------------------|
58
+ | CS 2.0 / any CS2 paradigm work | `.claude/rules/cs2-architecture-first.md` |
59
+ | Database, schema, migrations, RPC | `.claude/context/supabase-schema.md` |
60
+ | UI, components, brand, tokens | `.claude/context/design-system-global.md` |
61
+ | Deploy, infrastructure, DNS, SSL | `.claude/context/coolify-deployment.md` |
62
+ | Credentials, MCP, clauth, subagents | `.claude/context/clauth.md` |
63
+ | OG images, social meta, brand assets | `.claude/context/brand-gate.md` |
64
+ | Cross-platform, Cowork, subagent MCP | `.claude/context/platform-cross-ref.md` |
65
+ | MCP server development | `.claude/context/mcp-server-auth.md` |
66
+
67
+ **Step 1d — Load CLAUDE.md for every affected package:**
68
+ - Identify which packages in `packages/` will be created or modified
69
+ - Read `packages/<name>/CLAUDE.md` for each one that has one
70
+ - Mandatory: `packages/supabase/CLAUDE.md` if any DB work is involved
71
+ - Mandatory: `packages/ui/CLAUDE.md` if any UI work is involved
72
+ - Read `packages/<name>/package.json` to understand current exports and dependencies
73
+
74
+ 2. **Gather additional inputs:**
75
+ - Research doc from preplan (if exists): `.rdc/research/<topic>.md` (fallback: `.rdc/research/<topic>.md`)
76
+ - Project lead's architectural direction from conversation
77
+ - Existing Supabase epics: `SELECT get_open_epics()`
78
+ - Check `prototype_registry` for any existing prototypes on this topic:
79
+ ```sql
80
+ SELECT name, component, source_path, status FROM prototype_registry
81
+ WHERE status IN ('prototype', 'converting') ORDER BY created_at DESC;
82
+ ```
83
+ - Check `design_context` for prior design decisions:
84
+ ```sql
85
+ SELECT topic, context_type, summary FROM design_context
86
+ WHERE topic ILIKE '%<topic>%' ORDER BY created_at DESC;
87
+ ```
88
+
89
+ 3. **Read the codebase** — understand current state:
90
+ - What packages are affected?
91
+ - What types/interfaces already exist?
92
+ - What tests exist?
93
+ - What's the dependency graph?
94
+
95
+ 4. **Make design decisions** — for each major choice:
96
+ - State the decision clearly
97
+ - Document what was chosen and what was rejected
98
+ - Explain WHY (tradeoff rationale)
99
+ - Note consequences and reversibility
100
+ - **Verify the decision does not contradict any loaded architecture doc** — if it does, flag the conflict before proceeding
101
+
102
+ 5. **Define work packages** — break into agent-dispatchable units:
103
+ - Each work package = one agent assignment
104
+ - No file overlap between packages
105
+ - Each package has: scope, files to create/modify, test requirements
106
+ - Assign an agent type to each work package from the typed dispatch table in rdc:build
107
+ - Include the guide file path (from `.rdc/guides/`, fallback `.rdc/guides/`) in each work package description
108
+ - Include any relevant architecture doc, context file, or package CLAUDE.md the agent must read
109
+ - Estimate: small (1 agent, <500 LOC), medium (1 agent, 500-1500 LOC), large (needs splitting)
110
+
111
+ 6. **Write plan doc** to `.rdc/plans/<topic-slug>.md` (fallback: `.rdc/plans/<topic-slug>.md` if `.rdc/` does not exist):
112
+ ```markdown
113
+ # Plan: <Topic>
114
+ > Generated: <date> | Epic: <id if exists>
115
+
116
+ ## Source Documents Read
117
+ (list every architecture doc, rules file, context file, and package CLAUDE.md loaded in Step 1)
118
+
119
+ ## Goal
120
+ ## Design Decisions
121
+ ## Work Packages
122
+ (each package must include: agent type, guide file, architecture docs agent must read, files to create/modify, test requirements)
123
+ ## Sequencing (what can parallelize, what depends on what)
124
+ ## Risks & Mitigations
125
+ ## Architecture Doc Conflicts (if any)
126
+ ```
127
+
128
+ 7. **Create Supabase epic + child tasks:**
129
+ - Epic via `insert_work_item(p_item_type := 'epic', ...)`
130
+ - One task per work package via `insert_work_item(p_parent_id := <epic_id>, ...)`
131
+ - Set priorities: urgent/high/normal based on sequencing
132
+
133
+ 8. **Report results:**
134
+ - Interactive: present the plan for approval before building
135
+ - Unattended: skip approval, proceed immediately, emit status block:
136
+ ```
137
+ PLAN_STATUS: { epic_id, task_count, doc_path, waves, source_docs_read: [list], architecture_conflicts: [] }
138
+ ```
139
+
140
+ ## Unattended Escalation
141
+
142
+ When `--unattended` and genuine architectural ambiguity is detected — meaning multiple
143
+ valid approaches exist with significantly different tradeoffs (not just minor style choices)
144
+ — escalate via the advisor tool. Provide: the decision point, the options with tradeoffs,
145
+ and the project context. Resume with advisor's recommendation. If advisor is unavailable,
146
+ choose the most conservative/reversible approach and document the decision.
147
+
148
+ ## Rules
149
+ - **Source documents in Step 1 are MANDATORY — a plan that hasn't read the architecture docs is invalid**
150
+ - Interactive: ALWAYS get approval before proceeding to build
151
+ - Unattended: proceed immediately without approval
152
+ - Plan doc goes in `.rdc/plans/` (fallback: `.rdc/plans/` if `.rdc/` does not exist) — not `.planning/`
153
+ - Each work package must be independently executable by an agent
154
+ - No file overlap between work packages
155
+ - Include test requirements in every work package
156
+ - Reference affected CLAUDE.md files and architecture docs in each work package description
157
+ - Reference the relevant guide file from `.rdc/guides/` (fallback: `.rdc/guides/`) for agent context
158
+ - Always list source docs read in the output doc header and status block
@@ -0,0 +1,131 @@
1
+ ---
2
+ name: rdc:preplan
3
+ description: >-
4
+ Usage `rdc:preplan <topic> [--unattended]` — research best practices, analyze codebase, compare approaches, surface unknowns before committing to a plan. Produces a research doc. No decisions, no code.
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
+ > If dispatching subagents or running as a subagent: read `{PROJECT_ROOT}/.rdc/guides/agent-bootstrap.md` first (fallback: `{PROJECT_ROOT}/.rdc/guides/agent-bootstrap.md`).
12
+
13
+
14
+ # rdc:preplan — Research Before Planning
15
+
16
+ ## When to Use
17
+ - Starting a new feature area you haven't built before
18
+ - Need to understand how best-in-class projects solve a problem
19
+ - Codebase has unknowns that need mapping before planning
20
+ - Project lead says "research", "look into", "what's the best way to", "how do others do"
21
+ - Called by `rdc:overnight` before planning an epic with no existing tasks
22
+
23
+ ## Arguments
24
+ - `rdc:preplan <topic>` — interactive research session
25
+ - `rdc:preplan <topic> --unattended` — silent mode for overnight builds
26
+
27
+ ## Procedure
28
+
29
+ 1. **Parse the topic** from user input or epic title/description.
30
+ - Interactive: if vague, ask ONE clarifying question before proceeding
31
+ - Unattended: infer from the epic title + description — never pause to ask
32
+
33
+ 2. **Load source documents — MANDATORY before any analysis.**
34
+
35
+ **Step 2a — Always load these regardless of topic:**
36
+ ```
37
+ .claude/rules/infrastructure-contract.md — hard deployment + registry rules
38
+ .claude/rules/work-items-rpc.md — work item schema and RPC patterns
39
+ .claude/rules/system-quick-links.md — routing map to system architecture docs
40
+ ```
41
+
42
+ **Step 2b — Identify affected domains, then load the matching architecture doc:**
43
+
44
+ | Domain keywords in topic | Architecture doc to read |
45
+ |--------------------------|---------------------------|
46
+ | PRT, trust, capital, NAV, investor, land, DST | `docs/systems/prt/ARCHITECTURE.md` |
47
+ | CS 2.0, HAIL, PAL, virtue, quad-pixel, ontology, BPMN, cognitive | `docs/systems/cs2/ARCHITECTURE.md` |
48
+ | marketing, CRM, campaign, contact, outreach, RDC app | `docs/systems/rdc/ARCHITECTURE.md` |
49
+ | Claude workflow, skills, agents, dispatch, rdc:build | `docs/systems/claude-workflow/ARCHITECTURE.md` |
50
+ | Life AI, LIFEAI platform, life.ai | `docs/systems/lifeai/ARCHITECTURE.md` |
51
+ | media, R2, images, regen-media, MCP image | `docs/systems/media/ARCHITECTURE.md` |
52
+ | UI, component, brand, design token, shared, OG image | `docs/systems/shared/ARCHITECTURE.md` |
53
+
54
+ If topic spans multiple domains, read ALL matching architecture docs.
55
+ If unsure which domain applies, read `docs/systems/claude-workflow/ARCHITECTURE.md` as the fallback.
56
+
57
+ **Step 2c — Load domain-specific rules and context files:**
58
+
59
+ | Domain | Additional files to read |
60
+ |--------|---------------------------|
61
+ | CS 2.0 / any CS2 paradigm work | `.claude/rules/cs2-architecture-first.md` |
62
+ | Database, schema, migrations, RPC | `.claude/context/supabase-schema.md` |
63
+ | UI, components, brand, tokens | `.claude/context/design-system-global.md` |
64
+ | Deploy, infrastructure, DNS, SSL | `.claude/context/coolify-deployment.md` |
65
+ | Credentials, MCP, clauth, subagents | `.claude/context/clauth.md` |
66
+ | OG images, social meta, brand assets | `.claude/context/brand-gate.md` |
67
+ | Cross-platform, Cowork, subagent MCP | `.claude/context/platform-cross-ref.md` |
68
+
69
+ **Step 2d — Load CLAUDE.md for every affected package:**
70
+ - Identify which packages in `packages/` are relevant to the topic
71
+ - Read `packages/<name>/CLAUDE.md` for each one
72
+ - At minimum read `packages/supabase/CLAUDE.md` if any DB work is involved
73
+ - At minimum read `packages/ui/CLAUDE.md` if any UI work is involved
74
+
75
+ 3. **Web research** — search for current (2025-2026) best practices:
76
+ - How do major projects solve this?
77
+ - What tools/libraries exist?
78
+ - What are the common tradeoffs?
79
+
80
+ 4. **Codebase analysis** — what do we already have?
81
+ - Search relevant packages for existing code
82
+ - Check `.rdc/research/` for prior research on this topic (fallback: `.rdc/research/`)
83
+ - Check `docs/archive/` for historical work
84
+ - Research agents should read relevant guides from `.rdc/guides/` (fallback: `.rdc/guides/`)
85
+ - Check work items for related epics
86
+
87
+ 5. **Best-in-class comparison** — create a comparison table:
88
+ | Approach | Pros | Cons | Fit for Us |
89
+
90
+ 6. **Surface unknowns** — what questions remain unanswered?
91
+
92
+ 7. **Write research doc** to `.rdc/research/<topic-slug>.md` (fallback: `.rdc/research/<topic-slug>.md` if `.rdc/` does not exist):
93
+ ```markdown
94
+ # Research: <Topic>
95
+ > Generated: <date> | Requested by: Project Lead
96
+
97
+ ## Source Documents Read
98
+ (list every architecture doc, rules file, context file, and package CLAUDE.md loaded in Step 2)
99
+
100
+ ## Question
101
+ ## What We Already Have
102
+ ## Best-in-Class Analysis
103
+ ## Comparison Table
104
+ ## Unknowns & Open Questions
105
+ ## Recommendation (preliminary — not a decision)
106
+ ```
107
+
108
+ 8. **Report results:**
109
+ - Interactive: summarize findings. Do NOT create epics or write code.
110
+ - Unattended: skip summary, emit status block only:
111
+ ```
112
+ PREPLAN_STATUS: { topic, doc_path, unknowns_count, recommendation_confidence: "high|medium|low", source_docs_read: [list] }
113
+ ```
114
+
115
+ ## Unattended Escalation
116
+
117
+ When `--unattended` and `recommendation_confidence` is `"low"` (≥5 unresolved unknowns,
118
+ or no clear best-fit approach exists), escalate via the advisor tool rather than stopping.
119
+ Provide the advisor with: topic, unknowns list, comparison table. Resume with advisor's
120
+ direction if given. If advisor cannot resolve, log and skip to next step.
121
+
122
+ ## Rules
123
+ - **Source documents in Step 2 are MANDATORY — research without them is blind**
124
+ - Output is a RESEARCH DOC, not a plan
125
+ - Do not make architectural decisions — surface options with tradeoffs
126
+ - Do not create work items
127
+ - Do not write code
128
+ - Web search is mandatory — don't just analyze the codebase
129
+ - Keep the doc under 200 lines — concise, not exhaustive
130
+ - Unattended: NEVER pause for input; infer and proceed
131
+ - Always list source docs read in the output doc header
@@ -0,0 +1,145 @@
1
+ ---
2
+ name: rdc:prototype
3
+ description: >-
4
+ Usage `rdc:prototype <description>` — build JSX/TSX prototype for review before CLI handoff. Saves to docs/source/, registers in prototype_registry. Use for "mock this up", "show me what it looks like". Reference material only, not production.
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
+ > If dispatching subagents or running as a subagent: read `{PROJECT_ROOT}/.rdc/guides/agent-bootstrap.md` first (fallback: `{PROJECT_ROOT}/.rdc/guides/agent-bootstrap.md`).
12
+
13
+
14
+ # rdc:prototype — Prototype Builder
15
+
16
+ ## When to Use
17
+
18
+ - Project lead wants to see a design before committing to implementation
19
+ - A new component or page needs visual review before wiring to database
20
+ - Testing a data layout or interaction pattern
21
+ - Building a visual mockup for approval
22
+
23
+ ## What This Produces
24
+
25
+ - JSX/TSX prototype file → `docs/source/<ComponentName>.jsx`
26
+ - prototype_registry entry in database
27
+ - design_context entries for key decisions
28
+
29
+ ## Prototype Rules
30
+
31
+ 1. **Self-contained** — no real database calls. Mock data arrays only.
32
+ 2. **Realistic data** — mock data must reflect actual schema field names
33
+ 3. **Full fidelity** — looks exactly like the final product should look
34
+ 4. **Annotated** — key design decisions commented at the top of the file
35
+ 5. **Handoff-ready** — includes the spec block at the bottom
36
+
37
+ ## Standard Mock Data Pattern
38
+
39
+ Use realistic field names from the actual database schema:
40
+
41
+ ```tsx
42
+ // Mock data — mirrors your_table
43
+ const MOCK_DATA = [
44
+ {
45
+ id: "uuid-1",
46
+ slug: "example-slug",
47
+ name: "Example Name",
48
+ description: "...",
49
+ location_city: "City",
50
+ location_state: "State",
51
+ status: "active",
52
+ category: "example-category",
53
+ total_capital: 1000000,
54
+ total_area: 2400,
55
+ deploy_url: "https://...",
56
+ tags: ["tag1", "tag2"],
57
+ alignment: ["value1", "value2"],
58
+ web_visible: true,
59
+ ticker_label: "LABEL",
60
+ ticker_capital: "$1M",
61
+ scores: { field1: 82, field2: 71, field3: 68 },
62
+ },
63
+ ];
64
+ ```
65
+
66
+ ## File Header Template
67
+
68
+ ```tsx
69
+ /**
70
+ * <ComponentName>.jsx — PROTOTYPE
71
+ * ─────────────────────────────────────────────
72
+ * Status: Prototype — reference only, not production code
73
+ * Created: <date>
74
+ * Route (production target): <app-route>
75
+ *
76
+ * Key design decisions:
77
+ * 1. <Decision and rationale>
78
+ * 2. <Decision and rationale>
79
+ *
80
+ * What to preserve in production:
81
+ * - <Design element>
82
+ * - <Interaction pattern>
83
+ *
84
+ * What production implementation must do differently:
85
+ * - Replace mock data with database query
86
+ * - Import <Component> from @regen/ui instead of inline implementation
87
+ * - Extract <Part> into shared component at src/components/<name>
88
+ *
89
+ * Production agent type: frontend | backend | data | viz
90
+ * Production guide: .rdc/guides/<type>.md (fallback: .rdc/guides/<type>.md)
91
+ */
92
+ ```
93
+
94
+ ## File Footer Template
95
+
96
+ ```tsx
97
+ // ─── HANDOFF SPEC ─────────────────────────────
98
+ // Production files:
99
+ // apps/<app>/src/app/<route>/page.tsx (server component)
100
+ // apps/<app>/src/app/<route>/<Name>Client.tsx (client component)
101
+ // apps/<app>/src/app/<route>/<Name>Wrapper.tsx (modal/state shell, if needed)
102
+ //
103
+ // Design system components to use (do not re-implement):
104
+ // <ComponentName> — <what it does>
105
+ //
106
+ // Database tables:
107
+ // <table> — <what to query>
108
+ //
109
+ // Form field schema additions needed:
110
+ // <table>.<column> — <input_type> — <label>
111
+ ```
112
+
113
+ ## After Building — Register and Record
114
+
115
+ ```sql
116
+ -- Register prototype
117
+ INSERT INTO prototype_registry (name, component, source_path, notes, created_by)
118
+ VALUES (
119
+ '<Name> Prototype v1',
120
+ '<ComponentName>',
121
+ 'docs/source/<ComponentName>.jsx',
122
+ '<One-line description of key design: layout, data shape, interactions>',
123
+ 'planning'
124
+ );
125
+
126
+ -- Record design decisions
127
+ INSERT INTO design_context (topic, context_type, summary, source, created_by)
128
+ VALUES
129
+ ('<Topic>', 'prototype', 'Prototype built with <X> layout and <Y> interaction pattern', 'planning', 'planning'),
130
+ ('<Topic>', 'decision', '<Key decision made during prototyping and why>', 'planning', 'planning');
131
+ ```
132
+
133
+ ## Handoff
134
+
135
+ After prototype is approved, use `rdc:handoff` to create the plan doc and database work items.
136
+
137
+ Or tell the project lead:
138
+ ```
139
+ Prototype complete.
140
+ File: docs/source/<ComponentName>.jsx
141
+ Registered: prototype_registry
142
+
143
+ To hand off to CLI build: use /rdc:handoff
144
+ To build immediately: use /rdc:build
145
+ ```