@lifeaitools/rdc-skills 0.9.32 → 0.9.33
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude-plugin/plugin.json +24 -2
- package/.github/workflows/self-test.yml +34 -34
- package/MANIFEST.md +4 -0
- package/commands/build.md +183 -183
- package/commands/collab.md +180 -180
- package/commands/deploy.md +152 -152
- package/commands/fixit.md +116 -104
- package/commands/handoff.md +173 -173
- package/commands/overnight.md +220 -220
- package/commands/plan.md +158 -158
- package/commands/preplan.md +131 -131
- package/commands/prototype.md +145 -145
- package/commands/report.md +99 -99
- package/commands/review.md +120 -120
- package/commands/status.md +86 -86
- package/commands/workitems.md +132 -127
- package/guides/agent-bootstrap.md +265 -206
- package/guides/agents/backend.md +104 -104
- package/guides/agents/content.md +94 -94
- package/guides/agents/cs2.md +56 -56
- package/guides/agents/data.md +87 -87
- package/guides/agents/design.md +77 -77
- package/guides/agents/frontend.md +92 -92
- package/guides/agents/infrastructure.md +81 -81
- package/guides/agents/setup.md +279 -279
- package/guides/agents/verify.md +119 -119
- package/guides/agents/viz.md +106 -106
- package/hooks/foreground-process-gate.js +109 -0
- package/hooks/hook-logger.js +25 -0
- package/hooks/run-hidden-hook.ps1 +47 -0
- package/hooks/work-item-exit-gate.js +297 -0
- package/package.json +3 -3
- package/rules/work-items-rpc.md +56 -7
- package/scripts/install-rdc-skills.js +53 -9
- package/scripts/install.ps1 +17 -11
- package/scripts/self-test.mjs +1323 -1323
- package/skills/build/SKILL.md +355 -355
- package/skills/co-develop/SKILL.md +182 -0
- package/skills/collab/SKILL.md +217 -217
- package/skills/deploy/SKILL.md +198 -198
- package/skills/design/SKILL.md +211 -211
- package/skills/fixit/SKILL.md +132 -122
- package/skills/handoff/SKILL.md +200 -200
- package/skills/help/SKILL.md +104 -102
- package/skills/overnight/SKILL.md +224 -224
- package/skills/plan/SKILL.md +252 -251
- package/skills/preplan/SKILL.md +86 -86
- package/skills/prototype/SKILL.md +150 -150
- package/skills/release/SKILL.md +342 -342
- package/skills/report/SKILL.md +100 -100
- package/skills/review/SKILL.md +121 -120
- package/skills/self-test/SKILL.md +126 -126
- package/skills/status/SKILL.md +99 -97
- package/skills/watch/SKILL.md +91 -91
- package/skills/workitems/SKILL.md +151 -146
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: rdc:co-develop
|
|
3
|
+
description: "Usage `rdc:co-develop <ask|reply|inbox|start|resume|status>` — peer-aware Claude/Codex co-development over clauth, with ask --wait as the default delegation pattern."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
> **⚠️ OUTPUT CONTRACT (READ FIRST):** `guides/output-contract.md`
|
|
7
|
+
> Checklist-only output. No tool-call narration. No raw MCP/JSON/log dumps.
|
|
8
|
+
> One checklist upfront, updated in place, shown again at end with a 1-line verdict.
|
|
9
|
+
|
|
10
|
+
# rdc:co-develop — Peer-Aware Co-Development
|
|
11
|
+
|
|
12
|
+
Use this skill when an RDC workflow needs Claude and Codex to work together in
|
|
13
|
+
one governed session. This skill uses the clauth `codevelop_*` route only. Do
|
|
14
|
+
not use `chitchat_*` for this workflow.
|
|
15
|
+
|
|
16
|
+
## Arguments
|
|
17
|
+
|
|
18
|
+
Use the high-level delegation commands by default:
|
|
19
|
+
|
|
20
|
+
- `rdc:co-develop ask <peer> "<task>"` — delegate to partner and wait for the reply
|
|
21
|
+
- `rdc:co-develop reply <turn-id> "<summary>"` — reply to a partner request with evidence
|
|
22
|
+
- `rdc:co-develop inbox` — drain your inbox when you are explicitly acting as the worker
|
|
23
|
+
|
|
24
|
+
- `rdc:co-develop start <name>` — create a session and return startup details
|
|
25
|
+
- `rdc:co-develop resume <session-id> --peer <peer-id>` — join as a peer
|
|
26
|
+
- `rdc:co-develop send --session <id> --from <peer> --to <peer> <task>` — send a turn
|
|
27
|
+
- `rdc:co-develop poll --session <id> --peer <peer>` — drain messages for a peer
|
|
28
|
+
- `rdc:co-develop status [session-id]` — show session status and queues
|
|
29
|
+
- `rdc:co-develop stop <session-id>` — stop the session
|
|
30
|
+
|
|
31
|
+
## Default Delegation Pattern
|
|
32
|
+
|
|
33
|
+
When you need partner help, do not hand-write `/codevelop/send` JSON unless the
|
|
34
|
+
CLI fails. Call the partner like a subagent:
|
|
35
|
+
|
|
36
|
+
```powershell
|
|
37
|
+
clauth codevelop ask --to codex --wait --task "Review this plan and identify blockers."
|
|
38
|
+
clauth codevelop ask --to claude --wait --task "Review this implementation and advise."
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
`ask --wait` sends the request, captures the `turn_id`, polls the sender inbox,
|
|
42
|
+
and returns the matching partner reply to the current live agent. This preserves
|
|
43
|
+
the sender's active conversation context.
|
|
44
|
+
|
|
45
|
+
When you receive a partner request, complete the bounded task and reply with:
|
|
46
|
+
|
|
47
|
+
```powershell
|
|
48
|
+
clauth codevelop reply --turn turn-0001 --verdict pass --summary "Reviewed plan." --evidence "Checked files X and Y" --files-changed ""
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
For manual worker intake:
|
|
52
|
+
|
|
53
|
+
```powershell
|
|
54
|
+
clauth codevelop inbox --peer codex
|
|
55
|
+
clauth codevelop inbox --peer claude
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
## Required Transport
|
|
59
|
+
|
|
60
|
+
HTTP routes:
|
|
61
|
+
|
|
62
|
+
```text
|
|
63
|
+
POST /codevelop/start
|
|
64
|
+
POST /codevelop/join
|
|
65
|
+
POST /codevelop/send
|
|
66
|
+
POST /codevelop/poll
|
|
67
|
+
GET /codevelop/<session-id>/<peer-id>/stream
|
|
68
|
+
GET /codevelop/<session-id>/status
|
|
69
|
+
GET /codevelop
|
|
70
|
+
POST /codevelop/stop
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
MCP tools:
|
|
74
|
+
|
|
75
|
+
```text
|
|
76
|
+
codevelop_start
|
|
77
|
+
codevelop_join
|
|
78
|
+
codevelop_send
|
|
79
|
+
codevelop_poll
|
|
80
|
+
codevelop_stream
|
|
81
|
+
codevelop_status
|
|
82
|
+
codevelop_stop
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
## Session Roles
|
|
86
|
+
|
|
87
|
+
Default peers:
|
|
88
|
+
|
|
89
|
+
| Peer | Role | Responsibility |
|
|
90
|
+
|---|---|---|
|
|
91
|
+
| `claude` | `supervisor` | RDC loop, work items, validation, integration |
|
|
92
|
+
| `codex` | `implementation_partner` | implementation, focused audit, repair, evidence |
|
|
93
|
+
|
|
94
|
+
Other valid turn roles: `planner`, `builder`, `reviewer`, `validator`,
|
|
95
|
+
`advisor`, `release_guard`, `infra_operator`.
|
|
96
|
+
|
|
97
|
+
## Message Envelope
|
|
98
|
+
|
|
99
|
+
Always send structured JSON. The receiving peer must treat the JSON object as
|
|
100
|
+
the source of truth.
|
|
101
|
+
|
|
102
|
+
```json
|
|
103
|
+
{
|
|
104
|
+
"session_id": "<session-id>",
|
|
105
|
+
"turn_id": "turn-0001",
|
|
106
|
+
"from": "claude",
|
|
107
|
+
"to": "codex",
|
|
108
|
+
"type": "audit_request",
|
|
109
|
+
"role": "reviewer",
|
|
110
|
+
"skill": "rdc:review",
|
|
111
|
+
"task": "Audit the current diff for regressions before merge.",
|
|
112
|
+
"context": {
|
|
113
|
+
"repo": "C:\\Dev\\regen-root",
|
|
114
|
+
"work_item_id": "<optional-uuid>",
|
|
115
|
+
"branch": "develop",
|
|
116
|
+
"owned_files": []
|
|
117
|
+
},
|
|
118
|
+
"expect": {
|
|
119
|
+
"response_format": "CO_DEVELOP_REPLY",
|
|
120
|
+
"evidence_required": true,
|
|
121
|
+
"commit_allowed": false
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
Required reply shape:
|
|
127
|
+
|
|
128
|
+
```json
|
|
129
|
+
{
|
|
130
|
+
"session_id": "<session-id>",
|
|
131
|
+
"turn_id": "turn-0001",
|
|
132
|
+
"from": "codex",
|
|
133
|
+
"to": "claude",
|
|
134
|
+
"type": "reply",
|
|
135
|
+
"verdict": "pass",
|
|
136
|
+
"summary": "One paragraph.",
|
|
137
|
+
"evidence": [],
|
|
138
|
+
"files_changed": [],
|
|
139
|
+
"commits": [],
|
|
140
|
+
"blockers": [],
|
|
141
|
+
"next": []
|
|
142
|
+
}
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
## Escalation Rules
|
|
146
|
+
|
|
147
|
+
Invoke co-development when:
|
|
148
|
+
|
|
149
|
+
- Dave asks for partner review, audit, second opinion, or co-development
|
|
150
|
+
- a task crosses multiple apps, packages, repos, APIs, database surfaces, or deployment surfaces
|
|
151
|
+
- `rdc:plan` creates 5 or more work packages, or 3 or more work packages with integration risk
|
|
152
|
+
- `rdc:build` has file overlap or integration risk
|
|
153
|
+
- `rdc:review` finds failures that need judgment
|
|
154
|
+
- the same implementation, test, build, deploy, or migration path fails twice
|
|
155
|
+
- architecture, auth, deployment, schema, source-of-truth, or bridge-mode interpretation is uncertain
|
|
156
|
+
- a production-facing release path is about to proceed
|
|
157
|
+
|
|
158
|
+
Do not invoke by default for simple read-only explanations, one-line command
|
|
159
|
+
output, one-file typo fixes, or already decomposed low-risk work.
|
|
160
|
+
|
|
161
|
+
## Workflow
|
|
162
|
+
|
|
163
|
+
1. Start or resume a session with `codevelop_start` / `codevelop_join`.
|
|
164
|
+
2. Join the local peer with a stable `peer_id`.
|
|
165
|
+
3. Delegate with `clauth codevelop ask --to <partner> --wait --task "<task>"`.
|
|
166
|
+
4. Treat the returned JSON as the partner result and continue your active work.
|
|
167
|
+
5. If acting as the worker, drain inbox with `clauth codevelop inbox --peer <you>`.
|
|
168
|
+
6. Reply with `clauth codevelop reply --turn <turn-id> ...`.
|
|
169
|
+
7. Record evidence in the calling RDC skill report or work-item implementation report.
|
|
170
|
+
8. Stop the session with `codevelop_stop` when the work is done.
|
|
171
|
+
|
|
172
|
+
## Completion Evidence
|
|
173
|
+
|
|
174
|
+
Every co-development turn must report:
|
|
175
|
+
|
|
176
|
+
- session ID and turn ID
|
|
177
|
+
- peer IDs
|
|
178
|
+
- files changed
|
|
179
|
+
- commands/tests/routes checked
|
|
180
|
+
- commits, if any
|
|
181
|
+
- blockers or decisions needed
|
|
182
|
+
- next action
|
package/skills/collab/SKILL.md
CHANGED
|
@@ -1,217 +1,217 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: rdc:collab
|
|
3
|
-
description: "Bidirectional relay with a claude.ai session — read inbox, do work, write outbox, loop. Use when coordinating with a parallel claude.ai conversation."
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
> **⚠️ OUTPUT CONTRACT (READ FIRST):** `guides/output-contract.md`
|
|
7
|
-
> Checklist-only output. No tool-call narration. No raw MCP/JSON/log dumps.
|
|
8
|
-
> One checklist upfront, updated in place, shown again at end with a 1-line verdict.
|
|
9
|
-
|
|
10
|
-
> **Sandbox contract:** This skill honors `RDC_TEST=1` per `guides/agent-bootstrap.md` § RDC_TEST Sandbox Contract. Destructive external calls short-circuit under the flag. Chitchat relay writes (`chitchat_reply`) and git push are skipped under `RDC_TEST=1`.
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
# /rdc:collab — Claude Code Collab Session Listener
|
|
14
|
-
> Invoked as: `/rdc:collab --session <session_id>`
|
|
15
|
-
> You are the build/execute half of a live collab session with claude.ai.
|
|
16
|
-
> Transport: chitchat MCP tools (`chitchat_poll` / `chitchat_reply`) + SSE stream
|
|
17
|
-
> Dave is watching this terminal and can interject at any time.
|
|
18
|
-
|
|
19
|
-
---
|
|
20
|
-
|
|
21
|
-
## When to Use
|
|
22
|
-
- Project lead wants to delegate a task to a claude.ai session
|
|
23
|
-
- You need bidirectional relay between this CLI agent and a claude.ai coworker
|
|
24
|
-
- An async work handoff is in progress via the chitchat relay
|
|
25
|
-
|
|
26
|
-
## Arguments
|
|
27
|
-
|
|
28
|
-
- `rdc:collab --session <id>` — start or resume a collab relay with the given session ID
|
|
29
|
-
|
|
30
|
-
## What This Is
|
|
31
|
-
|
|
32
|
-
claude.ai writes tasks into your inbox via `chitchat_send`. The clauth daemon
|
|
33
|
-
queues them and — if you are connected to the SSE stream — pushes the event
|
|
34
|
-
immediately (zero-latency). You read, act, commit, reply via `chitchat_reply`,
|
|
35
|
-
and loop. Dave can watch everything in this terminal and interject by typing —
|
|
36
|
-
treat anything Dave types as a high-priority override.
|
|
37
|
-
|
|
38
|
-
---
|
|
39
|
-
|
|
40
|
-
## Step 1 — Parse session ID
|
|
41
|
-
|
|
42
|
-
Extract `--session <uuid>` from args.
|
|
43
|
-
|
|
44
|
-
If no `--session`, call `chitchat_list` and show all active sessions.
|
|
45
|
-
|
|
46
|
-
---
|
|
47
|
-
|
|
48
|
-
## Step 2 — Initialize (chitchat-native)
|
|
49
|
-
|
|
50
|
-
Call `chitchat_list` to verify the session exists in the daemon.
|
|
51
|
-
|
|
52
|
-
If the session is not found:
|
|
53
|
-
```
|
|
54
|
-
Session <id> not found in clauth daemon.
|
|
55
|
-
Start a session from claude.ai first:
|
|
56
|
-
chitchat_start(name: "<session-slug>")
|
|
57
|
-
Then pass the returned session_id here.
|
|
58
|
-
```
|
|
59
|
-
|
|
60
|
-
Send the ready signal via MCP:
|
|
61
|
-
```
|
|
62
|
-
chitchat_reply(session_id, "Claude Code connected. Ready to receive tasks.\ncwd: <rootPath>")
|
|
63
|
-
```
|
|
64
|
-
|
|
65
|
-
Print to terminal:
|
|
66
|
-
```
|
|
67
|
-
[rdc:collab] Session <id> active (chitchat transport).
|
|
68
|
-
SSE stream: http://127.0.0.1:52437/chitchat/<id>/stream
|
|
69
|
-
Waiting for messages from claude.ai... (Ctrl+C to end)
|
|
70
|
-
```
|
|
71
|
-
|
|
72
|
-
Note: File relay at `.rdc/relay/sessions/` is kept for backwards compatibility
|
|
73
|
-
but is no longer the primary transport. Chitchat MCP + SSE is the default.
|
|
74
|
-
|
|
75
|
-
---
|
|
76
|
-
|
|
77
|
-
## Step 3 — Wait for message (SSE-first, poll-fallback)
|
|
78
|
-
|
|
79
|
-
### Primary path — SSE (zero-latency)
|
|
80
|
-
|
|
81
|
-
Connect to the SSE stream and wait for the daemon to push a message:
|
|
82
|
-
|
|
83
|
-
```bash
|
|
84
|
-
curl -s -N --max-time 30 http://127.0.0.1:52437/chitchat/<session_id>/stream
|
|
85
|
-
```
|
|
86
|
-
|
|
87
|
-
The stream emits:
|
|
88
|
-
- `event: message` lines with `data: <JSON>` when `chitchat_send` fires from claude.ai
|
|
89
|
-
- `: keepalive` comment lines every 15s (ignore these)
|
|
90
|
-
|
|
91
|
-
**When a `data:` event arrives:** parse the JSON directly — it contains the
|
|
92
|
-
message. The SSE stream drains the inbox as it delivers; do NOT call
|
|
93
|
-
`chitchat_poll` after receiving via SSE. Proceed directly to Step 4 with the
|
|
94
|
-
parsed message body.
|
|
95
|
-
|
|
96
|
-
**If 30s elapses with no message event (only keepalives or silence):**
|
|
97
|
-
Print `[rdc:collab] Still listening...` and retry SSE immediately. After 10
|
|
98
|
-
consecutive 30s timeouts (5 min idle), print a longer heartbeat but keep
|
|
99
|
-
looping.
|
|
100
|
-
|
|
101
|
-
**If curl fails (daemon restart, connection refused, non-200):** fall back to
|
|
102
|
-
polling path below.
|
|
103
|
-
|
|
104
|
-
### Fallback path — polling (2s interval)
|
|
105
|
-
|
|
106
|
-
Use this path only when SSE is unavailable:
|
|
107
|
-
|
|
108
|
-
```
|
|
109
|
-
loop:
|
|
110
|
-
result = chitchat_poll(session_id)
|
|
111
|
-
if result.status == "ready":
|
|
112
|
-
→ proceed to Step 4 with result.message
|
|
113
|
-
else (status == "idle"):
|
|
114
|
-
wait 2 seconds
|
|
115
|
-
continue loop
|
|
116
|
-
```
|
|
117
|
-
|
|
118
|
-
**`chitchat_poll` return shapes:**
|
|
119
|
-
- `{ status: "idle" }` — inbox empty, keep polling
|
|
120
|
-
- `{ status: "ready", message: "..." }` — message waiting, consume it
|
|
121
|
-
|
|
122
|
-
---
|
|
123
|
-
|
|
124
|
-
## Step 4 — Process message
|
|
125
|
-
|
|
126
|
-
You now have the message body (from SSE `data:` JSON or `chitchat_poll` result).
|
|
127
|
-
|
|
128
|
-
Check if the message begins with `type: stop` (literal prefix) or contains a
|
|
129
|
-
`type` field equal to `"stop"` in the JSON.
|
|
130
|
-
|
|
131
|
-
**`type: stop`** → go to Step 7.
|
|
132
|
-
|
|
133
|
-
**Anything else (default: task/message):**
|
|
134
|
-
|
|
135
|
-
Print to terminal:
|
|
136
|
-
```
|
|
137
|
-
[rdc:collab] Turn <N> from claude.ai:
|
|
138
|
-
──────────────────────────────────────
|
|
139
|
-
<message body>
|
|
140
|
-
──────────────────────────────────────
|
|
141
|
-
```
|
|
142
|
-
|
|
143
|
-
---
|
|
144
|
-
|
|
145
|
-
## Step 5 — Do the work
|
|
146
|
-
|
|
147
|
-
Act on the message. Full Claude Code capabilities:
|
|
148
|
-
- File edits, git commits to `develop`
|
|
149
|
-
- Supabase RPC queries
|
|
150
|
-
- Type-checks: `npx tsc --noEmit` (never `pnpm build`)
|
|
151
|
-
- Run skills: `/rdc:plan`, `/rdc:fixit`, etc.
|
|
152
|
-
- Answer questions directly
|
|
153
|
-
|
|
154
|
-
Follow `.rdc/guides/agent-bootstrap.md` rules throughout.
|
|
155
|
-
|
|
156
|
-
For long tasks, stream progress updates mid-work:
|
|
157
|
-
```
|
|
158
|
-
chitchat_reply(session_id, "Turn <N> in progress: <what you've done so far>...")
|
|
159
|
-
```
|
|
160
|
-
This lets claude.ai see progress immediately rather than waiting for the full
|
|
161
|
-
response.
|
|
162
|
-
|
|
163
|
-
---
|
|
164
|
-
|
|
165
|
-
## Step 6 — Send response
|
|
166
|
-
|
|
167
|
-
When work is done, send the response via MCP:
|
|
168
|
-
|
|
169
|
-
```
|
|
170
|
-
chitchat_reply(session_id, "<response body>")
|
|
171
|
-
```
|
|
172
|
-
|
|
173
|
-
Response body format:
|
|
174
|
-
```
|
|
175
|
-
Turn <N> complete.
|
|
176
|
-
Commits: <sha1, sha2 or none>
|
|
177
|
-
|
|
178
|
-
<what you did, what you found, any questions or decisions needed from claude.ai>
|
|
179
|
-
```
|
|
180
|
-
|
|
181
|
-
Print to terminal:
|
|
182
|
-
```
|
|
183
|
-
[rdc:collab] Turn <N> done. Response sent via chitchat_reply.
|
|
184
|
-
Waiting for next message...
|
|
185
|
-
```
|
|
186
|
-
|
|
187
|
-
Return to Step 3.
|
|
188
|
-
|
|
189
|
-
---
|
|
190
|
-
|
|
191
|
-
## Step 7 — End session
|
|
192
|
-
|
|
193
|
-
Received `type: stop` message, or Dave pressed Ctrl+C.
|
|
194
|
-
|
|
195
|
-
Send final summary via MCP:
|
|
196
|
-
```
|
|
197
|
-
chitchat_reply(session_id, "Session complete.\nTurns: <N>\nCommits: <list or none>\nOpen items: <anything unresolved>")
|
|
198
|
-
```
|
|
199
|
-
|
|
200
|
-
Then call:
|
|
201
|
-
```
|
|
202
|
-
chitchat_stop(session_id)
|
|
203
|
-
```
|
|
204
|
-
|
|
205
|
-
Print:
|
|
206
|
-
```
|
|
207
|
-
[rdc:collab] Session ended.
|
|
208
|
-
```
|
|
209
|
-
|
|
210
|
-
---
|
|
211
|
-
|
|
212
|
-
## Dave Interjections
|
|
213
|
-
|
|
214
|
-
If Dave types in this terminal during a turn:
|
|
215
|
-
- Treat it as an override injected into the current task
|
|
216
|
-
- Acknowledge it in your `chitchat_reply` response
|
|
217
|
-
- If it changes direction mid-task, note what you stopped and why
|
|
1
|
+
---
|
|
2
|
+
name: rdc:collab
|
|
3
|
+
description: "Usage `rdc:collab --session <session_id>` — Bidirectional relay with a claude.ai session — read inbox, do work, write outbox, loop. Use when coordinating with a parallel claude.ai conversation."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
> **⚠️ OUTPUT CONTRACT (READ FIRST):** `guides/output-contract.md`
|
|
7
|
+
> Checklist-only output. No tool-call narration. No raw MCP/JSON/log dumps.
|
|
8
|
+
> One checklist upfront, updated in place, shown again at end with a 1-line verdict.
|
|
9
|
+
|
|
10
|
+
> **Sandbox contract:** This skill honors `RDC_TEST=1` per `guides/agent-bootstrap.md` § RDC_TEST Sandbox Contract. Destructive external calls short-circuit under the flag. Chitchat relay writes (`chitchat_reply`) and git push are skipped under `RDC_TEST=1`.
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
# /rdc:collab — Claude Code Collab Session Listener
|
|
14
|
+
> Invoked as: `/rdc:collab --session <session_id>`
|
|
15
|
+
> You are the build/execute half of a live collab session with claude.ai.
|
|
16
|
+
> Transport: chitchat MCP tools (`chitchat_poll` / `chitchat_reply`) + SSE stream
|
|
17
|
+
> Dave is watching this terminal and can interject at any time.
|
|
18
|
+
|
|
19
|
+
---
|
|
20
|
+
|
|
21
|
+
## When to Use
|
|
22
|
+
- Project lead wants to delegate a task to a claude.ai session
|
|
23
|
+
- You need bidirectional relay between this CLI agent and a claude.ai coworker
|
|
24
|
+
- An async work handoff is in progress via the chitchat relay
|
|
25
|
+
|
|
26
|
+
## Arguments
|
|
27
|
+
|
|
28
|
+
- `rdc:collab --session <id>` — start or resume a collab relay with the given session ID
|
|
29
|
+
|
|
30
|
+
## What This Is
|
|
31
|
+
|
|
32
|
+
claude.ai writes tasks into your inbox via `chitchat_send`. The clauth daemon
|
|
33
|
+
queues them and — if you are connected to the SSE stream — pushes the event
|
|
34
|
+
immediately (zero-latency). You read, act, commit, reply via `chitchat_reply`,
|
|
35
|
+
and loop. Dave can watch everything in this terminal and interject by typing —
|
|
36
|
+
treat anything Dave types as a high-priority override.
|
|
37
|
+
|
|
38
|
+
---
|
|
39
|
+
|
|
40
|
+
## Step 1 — Parse session ID
|
|
41
|
+
|
|
42
|
+
Extract `--session <uuid>` from args.
|
|
43
|
+
|
|
44
|
+
If no `--session`, call `chitchat_list` and show all active sessions.
|
|
45
|
+
|
|
46
|
+
---
|
|
47
|
+
|
|
48
|
+
## Step 2 — Initialize (chitchat-native)
|
|
49
|
+
|
|
50
|
+
Call `chitchat_list` to verify the session exists in the daemon.
|
|
51
|
+
|
|
52
|
+
If the session is not found:
|
|
53
|
+
```
|
|
54
|
+
Session <id> not found in clauth daemon.
|
|
55
|
+
Start a session from claude.ai first:
|
|
56
|
+
chitchat_start(name: "<session-slug>")
|
|
57
|
+
Then pass the returned session_id here.
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
Send the ready signal via MCP:
|
|
61
|
+
```
|
|
62
|
+
chitchat_reply(session_id, "Claude Code connected. Ready to receive tasks.\ncwd: <rootPath>")
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
Print to terminal:
|
|
66
|
+
```
|
|
67
|
+
[rdc:collab] Session <id> active (chitchat transport).
|
|
68
|
+
SSE stream: http://127.0.0.1:52437/chitchat/<id>/stream
|
|
69
|
+
Waiting for messages from claude.ai... (Ctrl+C to end)
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
Note: File relay at `.rdc/relay/sessions/` is kept for backwards compatibility
|
|
73
|
+
but is no longer the primary transport. Chitchat MCP + SSE is the default.
|
|
74
|
+
|
|
75
|
+
---
|
|
76
|
+
|
|
77
|
+
## Step 3 — Wait for message (SSE-first, poll-fallback)
|
|
78
|
+
|
|
79
|
+
### Primary path — SSE (zero-latency)
|
|
80
|
+
|
|
81
|
+
Connect to the SSE stream and wait for the daemon to push a message:
|
|
82
|
+
|
|
83
|
+
```bash
|
|
84
|
+
curl -s -N --max-time 30 http://127.0.0.1:52437/chitchat/<session_id>/stream
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
The stream emits:
|
|
88
|
+
- `event: message` lines with `data: <JSON>` when `chitchat_send` fires from claude.ai
|
|
89
|
+
- `: keepalive` comment lines every 15s (ignore these)
|
|
90
|
+
|
|
91
|
+
**When a `data:` event arrives:** parse the JSON directly — it contains the
|
|
92
|
+
message. The SSE stream drains the inbox as it delivers; do NOT call
|
|
93
|
+
`chitchat_poll` after receiving via SSE. Proceed directly to Step 4 with the
|
|
94
|
+
parsed message body.
|
|
95
|
+
|
|
96
|
+
**If 30s elapses with no message event (only keepalives or silence):**
|
|
97
|
+
Print `[rdc:collab] Still listening...` and retry SSE immediately. After 10
|
|
98
|
+
consecutive 30s timeouts (5 min idle), print a longer heartbeat but keep
|
|
99
|
+
looping.
|
|
100
|
+
|
|
101
|
+
**If curl fails (daemon restart, connection refused, non-200):** fall back to
|
|
102
|
+
polling path below.
|
|
103
|
+
|
|
104
|
+
### Fallback path — polling (2s interval)
|
|
105
|
+
|
|
106
|
+
Use this path only when SSE is unavailable:
|
|
107
|
+
|
|
108
|
+
```
|
|
109
|
+
loop:
|
|
110
|
+
result = chitchat_poll(session_id)
|
|
111
|
+
if result.status == "ready":
|
|
112
|
+
→ proceed to Step 4 with result.message
|
|
113
|
+
else (status == "idle"):
|
|
114
|
+
wait 2 seconds
|
|
115
|
+
continue loop
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
**`chitchat_poll` return shapes:**
|
|
119
|
+
- `{ status: "idle" }` — inbox empty, keep polling
|
|
120
|
+
- `{ status: "ready", message: "..." }` — message waiting, consume it
|
|
121
|
+
|
|
122
|
+
---
|
|
123
|
+
|
|
124
|
+
## Step 4 — Process message
|
|
125
|
+
|
|
126
|
+
You now have the message body (from SSE `data:` JSON or `chitchat_poll` result).
|
|
127
|
+
|
|
128
|
+
Check if the message begins with `type: stop` (literal prefix) or contains a
|
|
129
|
+
`type` field equal to `"stop"` in the JSON.
|
|
130
|
+
|
|
131
|
+
**`type: stop`** → go to Step 7.
|
|
132
|
+
|
|
133
|
+
**Anything else (default: task/message):**
|
|
134
|
+
|
|
135
|
+
Print to terminal:
|
|
136
|
+
```
|
|
137
|
+
[rdc:collab] Turn <N> from claude.ai:
|
|
138
|
+
──────────────────────────────────────
|
|
139
|
+
<message body>
|
|
140
|
+
──────────────────────────────────────
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
---
|
|
144
|
+
|
|
145
|
+
## Step 5 — Do the work
|
|
146
|
+
|
|
147
|
+
Act on the message. Full Claude Code capabilities:
|
|
148
|
+
- File edits, git commits to `develop`
|
|
149
|
+
- Supabase RPC queries
|
|
150
|
+
- Type-checks: `npx tsc --noEmit` (never `pnpm build`)
|
|
151
|
+
- Run skills: `/rdc:plan`, `/rdc:fixit`, etc.
|
|
152
|
+
- Answer questions directly
|
|
153
|
+
|
|
154
|
+
Follow `.rdc/guides/agent-bootstrap.md` rules throughout.
|
|
155
|
+
|
|
156
|
+
For long tasks, stream progress updates mid-work:
|
|
157
|
+
```
|
|
158
|
+
chitchat_reply(session_id, "Turn <N> in progress: <what you've done so far>...")
|
|
159
|
+
```
|
|
160
|
+
This lets claude.ai see progress immediately rather than waiting for the full
|
|
161
|
+
response.
|
|
162
|
+
|
|
163
|
+
---
|
|
164
|
+
|
|
165
|
+
## Step 6 — Send response
|
|
166
|
+
|
|
167
|
+
When work is done, send the response via MCP:
|
|
168
|
+
|
|
169
|
+
```
|
|
170
|
+
chitchat_reply(session_id, "<response body>")
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
Response body format:
|
|
174
|
+
```
|
|
175
|
+
Turn <N> complete.
|
|
176
|
+
Commits: <sha1, sha2 or none>
|
|
177
|
+
|
|
178
|
+
<what you did, what you found, any questions or decisions needed from claude.ai>
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
Print to terminal:
|
|
182
|
+
```
|
|
183
|
+
[rdc:collab] Turn <N> done. Response sent via chitchat_reply.
|
|
184
|
+
Waiting for next message...
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
Return to Step 3.
|
|
188
|
+
|
|
189
|
+
---
|
|
190
|
+
|
|
191
|
+
## Step 7 — End session
|
|
192
|
+
|
|
193
|
+
Received `type: stop` message, or Dave pressed Ctrl+C.
|
|
194
|
+
|
|
195
|
+
Send final summary via MCP:
|
|
196
|
+
```
|
|
197
|
+
chitchat_reply(session_id, "Session complete.\nTurns: <N>\nCommits: <list or none>\nOpen items: <anything unresolved>")
|
|
198
|
+
```
|
|
199
|
+
|
|
200
|
+
Then call:
|
|
201
|
+
```
|
|
202
|
+
chitchat_stop(session_id)
|
|
203
|
+
```
|
|
204
|
+
|
|
205
|
+
Print:
|
|
206
|
+
```
|
|
207
|
+
[rdc:collab] Session ended.
|
|
208
|
+
```
|
|
209
|
+
|
|
210
|
+
---
|
|
211
|
+
|
|
212
|
+
## Dave Interjections
|
|
213
|
+
|
|
214
|
+
If Dave types in this terminal during a turn:
|
|
215
|
+
- Treat it as an override injected into the current task
|
|
216
|
+
- Acknowledge it in your `chitchat_reply` response
|
|
217
|
+
- If it changes direction mid-task, note what you stopped and why
|