@lifeaitools/rdc-skills 0.25.5 → 0.25.9

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 (66) hide show
  1. package/.claude-plugin/plugin.json +1550 -1550
  2. package/.github/workflows/self-test.yml +34 -34
  3. package/CHANGELOG.md +319 -319
  4. package/MANIFEST.md +224 -224
  5. package/README.md +367 -367
  6. package/commands/build.md +181 -181
  7. package/commands/collab.md +180 -180
  8. package/commands/deploy.md +148 -148
  9. package/commands/fixit.md +150 -150
  10. package/commands/handoff.md +173 -173
  11. package/commands/overnight.md +220 -220
  12. package/commands/plan.md +158 -158
  13. package/commands/preplan.md +131 -131
  14. package/commands/prototype.md +145 -145
  15. package/commands/report.md +99 -99
  16. package/commands/review.md +120 -120
  17. package/commands/status.md +86 -86
  18. package/commands/workitems.md +127 -127
  19. package/git-sha.json +1 -1
  20. package/guides/agent-bootstrap.md +195 -195
  21. package/guides/agents/backend.md +102 -102
  22. package/guides/agents/content.md +94 -94
  23. package/guides/agents/cs2.md +56 -56
  24. package/guides/agents/data.md +86 -86
  25. package/guides/agents/design.md +77 -77
  26. package/guides/agents/frontend.md +91 -91
  27. package/guides/agents/infrastructure.md +81 -81
  28. package/guides/agents/setup.md +272 -272
  29. package/guides/agents/verify.md +119 -119
  30. package/guides/agents/viz.md +106 -106
  31. package/hooks/check-rdc-environment.js +318 -164
  32. package/hooks/lib/box-lock.js +186 -0
  33. package/package.json +1 -1
  34. package/scripts/install-rdc-skills.js +1474 -1400
  35. package/scripts/local-install-with-stop.sh +41 -0
  36. package/scripts/probe-box-lock.mjs +179 -0
  37. package/scripts/probe-installed-hooks.mjs +60 -0
  38. package/scripts/probe-lock-holders.mjs +36 -0
  39. package/scripts/self-test.mjs +1459 -1459
  40. package/scripts/validate-publish-manifests.js +502 -502
  41. package/skills/build/SKILL.md +578 -578
  42. package/skills/channel-formatter/SKILL.md +538 -538
  43. package/skills/collab/SKILL.md +239 -239
  44. package/skills/convert/SKILL.md +138 -138
  45. package/skills/deploy/SKILL.md +541 -541
  46. package/skills/design/SKILL.md +205 -205
  47. package/skills/env/SKILL.md +139 -139
  48. package/skills/fixit/SKILL.md +203 -203
  49. package/skills/handoff/SKILL.md +236 -236
  50. package/skills/housekeeping/SKILL.md +189 -189
  51. package/skills/onramp/SKILL.md +1459 -1459
  52. package/skills/overnight/SKILL.md +251 -251
  53. package/skills/plan/SKILL.md +345 -345
  54. package/skills/preplan/SKILL.md +90 -90
  55. package/skills/prototype/SKILL.md +150 -150
  56. package/skills/regen-media/SKILL.md +94 -94
  57. package/skills/release/SKILL.md +140 -140
  58. package/skills/report/SKILL.md +100 -100
  59. package/skills/review/SKILL.md +151 -151
  60. package/skills/self-test/SKILL.md +108 -108
  61. package/skills/status/SKILL.md +99 -99
  62. package/skills/tests/MATRIX.md +55 -55
  63. package/skills/tests/onramp.test.json +87 -87
  64. package/skills/tests/rdc-regen-media.test.json +29 -29
  65. package/skills/watch/SKILL.md +84 -84
  66. package/skills/workitems/SKILL.md +151 -151
@@ -1,11 +1,11 @@
1
- # Agent Bootstrap — Read This First
2
- > Every dispatched agent reads this before their role-specific guide.
3
- > Base guide for rdc-skills — provides credential, git, and reporting patterns across projects.
4
-
5
- ---
6
-
7
- ## Who You Are
8
-
1
+ # Agent Bootstrap — Read This First
2
+ > Every dispatched agent reads this before their role-specific guide.
3
+ > Base guide for rdc-skills — provides credential, git, and reporting patterns across projects.
4
+
5
+ ---
6
+
7
+ ## Who You Are
8
+
9
9
  You are a subagent dispatched by the rdc:build supervisor. You have a specific
10
10
  scope (files, package, feature) that will be in your prompt. Stay in that scope.
11
11
  NEVER modify files outside it.
@@ -15,75 +15,75 @@ RDC implementation posture for assumptions, minimal changes, surgical scope,
15
15
  verification evidence, and escalation.
16
16
 
17
17
  ---
18
-
19
- ## Credentials — Daemon Access Pattern
20
-
21
- You do NOT have access to cloud MCP connectors. Instead, all credentials
22
- come from a daemon running locally (typically on localhost:52437).
23
-
24
- **Ping first to confirm availability:**
25
- ```bash
26
- curl -s http://127.0.0.1:52437/ping
27
- ```
28
- If it doesn't respond — report BLOCKED, do not proceed.
29
-
30
- **Get a credential:**
31
- ```bash
32
- curl -s http://127.0.0.1:52437/get/<service>
33
- ```
34
-
35
- **Pattern for extracting key/value without printing:**
36
- ```bash
37
- # Correct pattern — never echo the key
38
- KEY=$(curl -s http://127.0.0.1:52437/get/<service> | python3 -c "import sys,json; print(json.load(sys.stdin)['key'])")
39
- curl -s -H "Authorization: Bearer $KEY" https://api.example.com/...
40
- ```
41
-
42
- **Never print credentials to stdout.** Capture to a variable, use inline, discard.
43
-
44
- ---
45
-
46
- ## Project Directory Convention
47
-
48
- This plugin uses the `.rdc/` directory convention. Check for it first:
49
-
50
- ```bash
51
- # Check if .rdc/ exists at project root
52
- ls {PROJECT_ROOT}/.rdc/config.json 2>/dev/null && echo "using .rdc/" || echo "using docs/ fallback"
53
- ```
54
-
55
- **Path resolution rule:**
56
- - Guides: `{PROJECT_ROOT}/.rdc/guides/` → fallback: `{PROJECT_ROOT}/docs/guides/`
57
- - Plans: `{PROJECT_ROOT}/.rdc/plans/` → fallback: `{PROJECT_ROOT}/docs/plans/`
58
- - Reports: `{PROJECT_ROOT}/.rdc/reports/` → fallback: `{PROJECT_ROOT}/docs/reports/`
59
- - Research: `{PROJECT_ROOT}/.rdc/research/` → fallback: `{PROJECT_ROOT}/docs/research/`
60
-
61
- If `.rdc/config.json` exists, read it for project metadata (name, description, conventions).
62
-
63
- ---
64
-
65
- ## Database Access — Check Project Overlay
66
-
67
- The project overlay guide will specify:
68
- - Database project reference / instance name
69
- - Whether to use MCP connectors or daemon
70
- - Available RPC functions
71
- - Work item management patterns
72
-
73
- Read the project-specific agent-bootstrap.md overlay for exact connection details.
74
-
75
- ---
76
-
77
- ## Git Rules
78
-
79
- - Branch: Always use the project's primary development branch (typically `develop` or `main`)
80
- - Auto-commit after completing your scope — no confirmation needed
81
- - Commit message must use conventional format: `feat/fix/chore/refactor(<scope>): description`
82
- - Push to origin after committing
83
- - NEVER force-push
84
-
85
- ---
86
-
18
+
19
+ ## Credentials — Daemon Access Pattern
20
+
21
+ You do NOT have access to cloud MCP connectors. Instead, all credentials
22
+ come from a daemon running locally (typically on localhost:52437).
23
+
24
+ **Ping first to confirm availability:**
25
+ ```bash
26
+ curl -s http://127.0.0.1:52437/ping
27
+ ```
28
+ If it doesn't respond — report BLOCKED, do not proceed.
29
+
30
+ **Get a credential:**
31
+ ```bash
32
+ curl -s http://127.0.0.1:52437/get/<service>
33
+ ```
34
+
35
+ **Pattern for extracting key/value without printing:**
36
+ ```bash
37
+ # Correct pattern — never echo the key
38
+ KEY=$(curl -s http://127.0.0.1:52437/get/<service> | python3 -c "import sys,json; print(json.load(sys.stdin)['key'])")
39
+ curl -s -H "Authorization: Bearer $KEY" https://api.example.com/...
40
+ ```
41
+
42
+ **Never print credentials to stdout.** Capture to a variable, use inline, discard.
43
+
44
+ ---
45
+
46
+ ## Project Directory Convention
47
+
48
+ This plugin uses the `.rdc/` directory convention. Check for it first:
49
+
50
+ ```bash
51
+ # Check if .rdc/ exists at project root
52
+ ls {PROJECT_ROOT}/.rdc/config.json 2>/dev/null && echo "using .rdc/" || echo "using docs/ fallback"
53
+ ```
54
+
55
+ **Path resolution rule:**
56
+ - Guides: `{PROJECT_ROOT}/.rdc/guides/` → fallback: `{PROJECT_ROOT}/docs/guides/`
57
+ - Plans: `{PROJECT_ROOT}/.rdc/plans/` → fallback: `{PROJECT_ROOT}/docs/plans/`
58
+ - Reports: `{PROJECT_ROOT}/.rdc/reports/` → fallback: `{PROJECT_ROOT}/docs/reports/`
59
+ - Research: `{PROJECT_ROOT}/.rdc/research/` → fallback: `{PROJECT_ROOT}/docs/research/`
60
+
61
+ If `.rdc/config.json` exists, read it for project metadata (name, description, conventions).
62
+
63
+ ---
64
+
65
+ ## Database Access — Check Project Overlay
66
+
67
+ The project overlay guide will specify:
68
+ - Database project reference / instance name
69
+ - Whether to use MCP connectors or daemon
70
+ - Available RPC functions
71
+ - Work item management patterns
72
+
73
+ Read the project-specific agent-bootstrap.md overlay for exact connection details.
74
+
75
+ ---
76
+
77
+ ## Git Rules
78
+
79
+ - Branch: Always use the project's primary development branch (typically `develop` or `main`)
80
+ - Auto-commit after completing your scope — no confirmation needed
81
+ - Commit message must use conventional format: `feat/fix/chore/refactor(<scope>): description`
82
+ - Push to origin after committing
83
+ - NEVER force-push
84
+
85
+ ---
86
+
87
87
  ## Build Rules
88
88
 
89
89
  Never run `pnpm build` or equivalent full builds locally — they consume excessive memory.
@@ -103,110 +103,110 @@ rule, not a preference.
103
103
  - Node/cmd/ps1 helpers launched by hooks must go through the RDC hidden hook runner.
104
104
 
105
105
  Check the project overlay for specific language, package manager, and build constraints.
106
-
107
- ---
108
-
109
- ## RDC_TEST Sandbox Contract
110
-
111
- When `RDC_TEST=1` is set, the skill is running inside the Tier 2 sandbox harness. Short-circuit all destructive external side effects.
112
-
113
- **How to detect:** `process.env.RDC_TEST === '1'` (Node/JS) or `[ "$RDC_TEST" = "1" ]` (bash). The Tier 2 runner sets this before invoking `claude --print`.
114
-
115
- **Allowed under RDC_TEST** — run normally, no guard:
116
-
117
- | Operation | Why |
118
- |-----------|-----|
119
- | Local git commits | Commit to the worktree branch; never pushed |
120
- | Local filesystem writes | Inside the sandbox worktree |
121
- | Supabase reads | Assertions read prod DB; no writes |
122
- | Service reads | Coolify status, CF DNS lookup, GitHub read — all safe |
123
- | `clauth` credential reads | Read-only against the daemon |
124
-
125
- **Short-circuit under RDC_TEST** — must be wrapped in a guard:
126
-
127
- - Supabase INSERT/UPDATE/DELETE (work items, prototype_registry, design_context, etc.) — runner uses main-db mode, no test branch
128
- - Coolify app deploys / restarts / config writes
129
- - Cloudflare DNS writes / cache purges
130
- - R2 object writes / deletes
131
- - `git push` to any remote
132
- - `gh pr create`, `gh release create`, tag pushes
133
- - `npm publish`
134
- - Any webhook fire, email send, Slack post
135
- - MCP connector tools that mutate external state (e.g. `mcp__coolify__deploy`)
136
-
137
- **Bash pattern:**
138
- ```bash
139
- if [ "$RDC_TEST" != "1" ]; then
106
+
107
+ ---
108
+
109
+ ## RDC_TEST Sandbox Contract
110
+
111
+ When `RDC_TEST=1` is set, the skill is running inside the Tier 2 sandbox harness. Short-circuit all destructive external side effects.
112
+
113
+ **How to detect:** `process.env.RDC_TEST === '1'` (Node/JS) or `[ "$RDC_TEST" = "1" ]` (bash). The Tier 2 runner sets this before invoking `claude --print`.
114
+
115
+ **Allowed under RDC_TEST** — run normally, no guard:
116
+
117
+ | Operation | Why |
118
+ |-----------|-----|
119
+ | Local git commits | Commit to the worktree branch; never pushed |
120
+ | Local filesystem writes | Inside the sandbox worktree |
121
+ | Supabase reads | Assertions read prod DB; no writes |
122
+ | Service reads | Coolify status, CF DNS lookup, GitHub read — all safe |
123
+ | `clauth` credential reads | Read-only against the daemon |
124
+
125
+ **Short-circuit under RDC_TEST** — must be wrapped in a guard:
126
+
127
+ - Supabase INSERT/UPDATE/DELETE (work items, prototype_registry, design_context, etc.) — runner uses main-db mode, no test branch
128
+ - Coolify app deploys / restarts / config writes
129
+ - Cloudflare DNS writes / cache purges
130
+ - R2 object writes / deletes
131
+ - `git push` to any remote
132
+ - `gh pr create`, `gh release create`, tag pushes
133
+ - `npm publish`
134
+ - Any webhook fire, email send, Slack post
135
+ - MCP connector tools that mutate external state (e.g. `mcp__coolify__deploy`)
136
+
137
+ **Bash pattern:**
138
+ ```bash
139
+ if [ "$RDC_TEST" != "1" ]; then
140
140
  curl -X POST "$DEPLOY_API_BASE/api/v1/applications/$UUID/deploy" ...
141
- else
142
- echo "[RDC_TEST] skipping Coolify deploy"
143
- fi
144
- ```
145
-
146
- **Node/JS pattern:**
147
- ```js
148
- if (process.env.RDC_TEST !== '1') {
149
- await deployToCoolify(...);
150
- } else {
151
- console.log('[RDC_TEST] skipping Coolify deploy');
152
- }
153
- ```
154
-
155
- **Why this matters:** Tier 2 runs every skill in a throwaway sandbox. If your skill fires a real deploy or DNS change under `RDC_TEST`, the test isn't a test — it's a production incident.
156
-
157
- **New-skill contract:** every new `rdc:*` skill MUST honor `RDC_TEST` before shipping. Tier 2 manifests will fail any skill that writes to external state under the flag.
158
-
141
+ else
142
+ echo "[RDC_TEST] skipping Coolify deploy"
143
+ fi
144
+ ```
145
+
146
+ **Node/JS pattern:**
147
+ ```js
148
+ if (process.env.RDC_TEST !== '1') {
149
+ await deployToCoolify(...);
150
+ } else {
151
+ console.log('[RDC_TEST] skipping Coolify deploy');
152
+ }
153
+ ```
154
+
155
+ **Why this matters:** Tier 2 runs every skill in a throwaway sandbox. If your skill fires a real deploy or DNS change under `RDC_TEST`, the test isn't a test — it's a production incident.
156
+
157
+ **New-skill contract:** every new `rdc:*` skill MUST honor `RDC_TEST` before shipping. Tier 2 manifests will fail any skill that writes to external state under the flag.
158
+
159
159
  **Known blocker:** Project-specific cwd hooks must check `process.env.RDC_TEST === '1'` and call `process.exit(0)` early to allow Tier 2 sandbox runs. Without this bypass, headless self-test invocations can fail before the skill loads. File: `~/.claude/hooks/check-cwd.js`.
160
-
161
- ---
162
-
163
- ## Completion Report
164
-
165
- When your scope is done, return a structured report to the supervisor:
166
-
167
- ```
168
- AGENT_COMPLETE: {
169
- scope: "<what you were assigned>",
170
- files_changed: ["path/to/file", ...],
171
- work_item_id: "<id if you had one>",
172
- commits: ["<hash> <message>"],
173
- blockers: ["<anything that needs supervisor attention>"]
174
- }
175
- ```
176
-
177
- If you hit a blocker mid-task: stop, report it, do not guess or work around it.
178
-
179
- ---
180
-
181
- ## Self-Check Rules — Prevent Getting Lost
182
-
183
- ### 10-Minute Rule
184
- If you have been working on a **single step** for more than 10 minutes without measurable progress (no new files changed, no successful tool calls, no forward movement), **stop immediately**. Do not keep trying variations. Report it as a blocker.
185
-
186
- ### 2-Retry Rule
187
- If the **same command or approach fails twice**, stop. Do not attempt a third variation or creative workaround. Report the failure with the exact error output.
188
-
189
- ### Scope Drift Rule
190
- If you discover that fixing your assigned task would also require changing files **outside your scope**, stop. Do not fix them. Add them to `blockers` in your AGENT_COMPLETE report. The supervisor assigns them separately.
191
-
192
- ### What "measurable progress" means
193
- - A file was created or modified ✅
194
- - A tool call succeeded and returned useful data ✅
195
- - A command ran without error ✅
196
- - Trying the same thing with slightly different parameters ❌
197
- - Reading the same file again hoping for different insight ❌
198
- - Rephrasing a failing query ❌
199
-
200
- ---
201
-
160
+
161
+ ---
162
+
163
+ ## Completion Report
164
+
165
+ When your scope is done, return a structured report to the supervisor:
166
+
167
+ ```
168
+ AGENT_COMPLETE: {
169
+ scope: "<what you were assigned>",
170
+ files_changed: ["path/to/file", ...],
171
+ work_item_id: "<id if you had one>",
172
+ commits: ["<hash> <message>"],
173
+ blockers: ["<anything that needs supervisor attention>"]
174
+ }
175
+ ```
176
+
177
+ If you hit a blocker mid-task: stop, report it, do not guess or work around it.
178
+
179
+ ---
180
+
181
+ ## Self-Check Rules — Prevent Getting Lost
182
+
183
+ ### 10-Minute Rule
184
+ If you have been working on a **single step** for more than 10 minutes without measurable progress (no new files changed, no successful tool calls, no forward movement), **stop immediately**. Do not keep trying variations. Report it as a blocker.
185
+
186
+ ### 2-Retry Rule
187
+ If the **same command or approach fails twice**, stop. Do not attempt a third variation or creative workaround. Report the failure with the exact error output.
188
+
189
+ ### Scope Drift Rule
190
+ If you discover that fixing your assigned task would also require changing files **outside your scope**, stop. Do not fix them. Add them to `blockers` in your AGENT_COMPLETE report. The supervisor assigns them separately.
191
+
192
+ ### What "measurable progress" means
193
+ - A file was created or modified ✅
194
+ - A tool call succeeded and returned useful data ✅
195
+ - A command ran without error ✅
196
+ - Trying the same thing with slightly different parameters ❌
197
+ - Reading the same file again hoping for different insight ❌
198
+ - Rephrasing a failing query ❌
199
+
200
+ ---
201
+
202
202
  ## ⛔ Implementation Report + CodeFlow Exit Contract
203
203
 
204
204
  Every implementation agent MUST follow this protocol before moving a work item
205
205
  to `review`. Agents do not close non-epic work as `done`; validators close it
206
206
  after fresh verification.
207
-
208
- ### Step 1 — Tick checklist items as you complete them
209
-
207
+
208
+ ### Step 1 — Tick checklist items as you complete them
209
+
210
210
  ```sql
211
211
  SELECT update_checklist_item(
212
212
  '<work-item-id>'::uuid,
@@ -221,10 +221,10 @@ SELECT update_checklist_item(
221
221
  Call this for each item AS you complete it — not all at once at the end. The
222
222
  database records every tick in `work_item_checklist_events`. Supervisor and
223
223
  validator re-ticks are rejected by the exit gate.
224
-
225
- ### Step 2 — Submit implementation report BEFORE marking done
226
-
227
- ```sql
224
+
225
+ ### Step 2 — Submit implementation report BEFORE marking done
226
+
227
+ ```sql
228
228
  SELECT submit_implementation_report(
229
229
  '<work-item-id>'::uuid,
230
230
  '{
@@ -276,20 +276,20 @@ SELECT update_work_item_status(
276
276
  If any `required: true` checklist item is still unchecked, was re-ticked by a
277
277
  supervisor/validator, or was ticked by a different session than the originating
278
278
  agent, the DB and PreToolUse hook reject the close.
279
-
280
- ### Supervisor workflow
281
-
282
- - All zeros → clean run, proceed
283
- - `flags_count > 0` or `deviations_count > 0` → pull full report:
284
- ```sql
285
- SELECT implementation_report FROM work_items WHERE id = '<id>';
286
- ```
287
-
288
- ---
289
-
290
- ## Now read your role-specific guide
291
-
292
- Path: `{PROJECT_ROOT}/.rdc/guides/<type>.md` (e.g., `frontend.md`, `backend.md`, `data.md`)
293
- Fallback: `{PROJECT_ROOT}/docs/guides/<type>.md` if `.rdc/` does not exist.
294
-
295
- The project overlay will specify the exact location if it differs from the convention above.
279
+
280
+ ### Supervisor workflow
281
+
282
+ - All zeros → clean run, proceed
283
+ - `flags_count > 0` or `deviations_count > 0` → pull full report:
284
+ ```sql
285
+ SELECT implementation_report FROM work_items WHERE id = '<id>';
286
+ ```
287
+
288
+ ---
289
+
290
+ ## Now read your role-specific guide
291
+
292
+ Path: `{PROJECT_ROOT}/.rdc/guides/<type>.md` (e.g., `frontend.md`, `backend.md`, `data.md`)
293
+ Fallback: `{PROJECT_ROOT}/docs/guides/<type>.md` if `.rdc/` does not exist.
294
+
295
+ The project overlay will specify the exact location if it differs from the convention above.
@@ -1,104 +1,104 @@
1
- > **⚠️ OUTPUT CONTRACT (READ FIRST):** `guides/output-contract.md`
2
- > Checklist-only output. No tool-call narration. No raw MCP/JSON/log dumps.
3
- > One checklist upfront, updated in place, shown again at end with a 1-line verdict.
4
-
5
- > 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`).
6
-
7
- > **Sandbox contract:** This guide honors `RDC_TEST=1` per `guides/agent-bootstrap.md` § RDC_TEST Sandbox Contract. Destructive external calls short-circuit under the flag.
8
-
9
-
10
- # rdc:backend — Backend Agent
11
-
12
- ## Mandatory First Step
13
-
14
- Read the guide before ANY code:
15
- ```
16
- {PROJECT_ROOT}/.rdc/guides/backend.md
17
- (fallback: {PROJECT_ROOT}/.rdc/guides/backend.md)
18
- ```
19
-
20
- ## Database Client — One Pattern Per Context
21
-
22
- ```ts
23
- // Server component / API route
24
- import { createServerClient } from "@regen/supabase";
25
- const supabase = await createServerClient();
26
-
27
- // Client component
28
- import { createBrowserClient } from "@regen/supabase";
29
- const supabase = createBrowserClient();
30
- ```
31
-
32
- Non-public schemas:
33
- ```ts
34
- const { data } = await supabase.schema("custom").from("table_name").select("*");
35
- ```
36
-
37
- ## Credentials — Daemon First
38
-
39
- ```bash
40
- curl -s http://127.0.0.1:52437/get/<service>
41
- ```
42
- - Never hardcode credentials
43
- - Never print keys to stdout
44
- - If daemon is down: report BLOCKED — do not work around it
45
-
46
- ## Work Items — RPC Only
47
-
48
- ```sql
49
- -- Read epics
50
- SELECT get_open_epics();
51
-
52
- -- Create
53
- SELECT insert_work_item(
54
- p_title := 'Task title',
55
- p_priority := 'high',
56
- p_parent_id := '<epic-uuid>'::uuid,
57
- p_source := 'agent'
58
- );
59
-
1
+ > **⚠️ OUTPUT CONTRACT (READ FIRST):** `guides/output-contract.md`
2
+ > Checklist-only output. No tool-call narration. No raw MCP/JSON/log dumps.
3
+ > One checklist upfront, updated in place, shown again at end with a 1-line verdict.
4
+
5
+ > 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`).
6
+
7
+ > **Sandbox contract:** This guide honors `RDC_TEST=1` per `guides/agent-bootstrap.md` § RDC_TEST Sandbox Contract. Destructive external calls short-circuit under the flag.
8
+
9
+
10
+ # rdc:backend — Backend Agent
11
+
12
+ ## Mandatory First Step
13
+
14
+ Read the guide before ANY code:
15
+ ```
16
+ {PROJECT_ROOT}/.rdc/guides/backend.md
17
+ (fallback: {PROJECT_ROOT}/.rdc/guides/backend.md)
18
+ ```
19
+
20
+ ## Database Client — One Pattern Per Context
21
+
22
+ ```ts
23
+ // Server component / API route
24
+ import { createServerClient } from "@regen/supabase";
25
+ const supabase = await createServerClient();
26
+
27
+ // Client component
28
+ import { createBrowserClient } from "@regen/supabase";
29
+ const supabase = createBrowserClient();
30
+ ```
31
+
32
+ Non-public schemas:
33
+ ```ts
34
+ const { data } = await supabase.schema("custom").from("table_name").select("*");
35
+ ```
36
+
37
+ ## Credentials — Daemon First
38
+
39
+ ```bash
40
+ curl -s http://127.0.0.1:52437/get/<service>
41
+ ```
42
+ - Never hardcode credentials
43
+ - Never print keys to stdout
44
+ - If daemon is down: report BLOCKED — do not work around it
45
+
46
+ ## Work Items — RPC Only
47
+
48
+ ```sql
49
+ -- Read epics
50
+ SELECT get_open_epics();
51
+
52
+ -- Create
53
+ SELECT insert_work_item(
54
+ p_title := 'Task title',
55
+ p_priority := 'high',
56
+ p_parent_id := '<epic-uuid>'::uuid,
57
+ p_source := 'agent'
58
+ );
59
+
60
60
  -- Implementation agents submit report + CodeFlow post, then move to review
61
61
  SELECT update_work_item_status('<uuid>'::uuid, 'review', '["Implementation complete; ready for validator"]'::jsonb, '<agent-session-id>', 'agent');
62
- ```
63
-
64
- **NEVER write raw INSERT/UPDATE against work items.**
65
-
66
- ## API Route Pattern
67
-
68
- ```ts
69
- import { createServerClient } from "@regen/supabase";
70
- import { NextResponse } from "next/server";
71
-
72
- export async function GET() {
73
- const supabase = await createServerClient();
74
- const { data, error } = await supabase.from("table").select("*");
75
- if (error) return NextResponse.json({ error: error.message }, { status: 500 });
76
- return NextResponse.json(data);
77
- }
78
-
79
- export async function POST(request: Request) {
80
- const body = await request.json();
81
- const supabase = await createServerClient();
82
- const { data, error } = await supabase.from("table").insert(body).select().single();
83
- if (error) return NextResponse.json({ error: error.message }, { status: 400 });
84
- return NextResponse.json(data, { status: 201 });
85
- }
86
- ```
87
-
88
- ## Auth
89
-
90
- Use the auth helpers from your project's auth package for protected apps.
91
-
92
- ## Schema-Driven Forms
93
-
94
- When working with schema-driven forms (common in dynamic CRUD), never hardcode columns.
95
- Use the schema table to drive form rendering instead.
96
-
97
- ## Safety Rules
98
-
99
- - Branch: development branch — auto-commit after logical blocks
100
- - NEVER run `pnpm build`
101
- - NEVER overlap with other agents on the same files
102
- - Update work items in real time — not batch at end
103
- - Push after each logical block *(skip if `$RDC_TEST=1` — echo `[RDC_TEST] skipping git push` instead)*
104
- - Write tests FIRST — red → implement → green
62
+ ```
63
+
64
+ **NEVER write raw INSERT/UPDATE against work items.**
65
+
66
+ ## API Route Pattern
67
+
68
+ ```ts
69
+ import { createServerClient } from "@regen/supabase";
70
+ import { NextResponse } from "next/server";
71
+
72
+ export async function GET() {
73
+ const supabase = await createServerClient();
74
+ const { data, error } = await supabase.from("table").select("*");
75
+ if (error) return NextResponse.json({ error: error.message }, { status: 500 });
76
+ return NextResponse.json(data);
77
+ }
78
+
79
+ export async function POST(request: Request) {
80
+ const body = await request.json();
81
+ const supabase = await createServerClient();
82
+ const { data, error } = await supabase.from("table").insert(body).select().single();
83
+ if (error) return NextResponse.json({ error: error.message }, { status: 400 });
84
+ return NextResponse.json(data, { status: 201 });
85
+ }
86
+ ```
87
+
88
+ ## Auth
89
+
90
+ Use the auth helpers from your project's auth package for protected apps.
91
+
92
+ ## Schema-Driven Forms
93
+
94
+ When working with schema-driven forms (common in dynamic CRUD), never hardcode columns.
95
+ Use the schema table to drive form rendering instead.
96
+
97
+ ## Safety Rules
98
+
99
+ - Branch: development branch — auto-commit after logical blocks
100
+ - NEVER run `pnpm build`
101
+ - NEVER overlap with other agents on the same files
102
+ - Update work items in real time — not batch at end
103
+ - Push after each logical block *(skip if `$RDC_TEST=1` — echo `[RDC_TEST] skipping git push` instead)*
104
+ - Write tests FIRST — red → implement → green