@orchestrator-claude/cli 3.25.1 → 3.26.0

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 (37) hide show
  1. package/dist/index.d.ts +1 -1
  2. package/dist/index.js +1 -1
  3. package/dist/templates/base/claude/agents/debug-sidecar.md +133 -0
  4. package/dist/templates/base/claude/agents/doc-sidecar.md +60 -0
  5. package/dist/templates/base/claude/agents/implementer.md +162 -31
  6. package/dist/templates/base/claude/agents/test-sidecar.md +106 -0
  7. package/dist/templates/base/claude/hooks/mailbox-listener.ts +246 -0
  8. package/dist/templates/base/claude/hooks/sprint-registry.ts +85 -0
  9. package/dist/templates/base/claude/settings.json +19 -0
  10. package/dist/templates/base/claude/skills/sprint-launch/SKILL.md +176 -0
  11. package/dist/templates/base/claude/skills/sprint-teammate/sprint-teammate.md +79 -0
  12. package/dist/templates/base/scripts/lib/SprintLauncher.ts +325 -0
  13. package/dist/templates/base/scripts/lib/TmuxManager.ts +296 -0
  14. package/dist/templates/base/scripts/lib/WorktreeIsolator.ts +165 -0
  15. package/dist/templates/base/scripts/lib/WorktreeManager.ts +106 -0
  16. package/dist/templates/base/scripts/lib/mailbox/types.ts +175 -0
  17. package/dist/templates/base/scripts/lib/sidecar/SidecarWatcher.ts +249 -0
  18. package/dist/templates/base/scripts/lib/sidecar/run.ts +90 -0
  19. package/dist/templates/base/scripts/sprint-launch.ts +285 -0
  20. package/package.json +1 -1
  21. package/templates/base/claude/agents/debug-sidecar.md +133 -0
  22. package/templates/base/claude/agents/doc-sidecar.md +60 -0
  23. package/templates/base/claude/agents/implementer.md +162 -31
  24. package/templates/base/claude/agents/test-sidecar.md +106 -0
  25. package/templates/base/claude/hooks/mailbox-listener.ts +246 -0
  26. package/templates/base/claude/hooks/sprint-registry.ts +85 -0
  27. package/templates/base/claude/settings.json +19 -0
  28. package/templates/base/claude/skills/sprint-launch/SKILL.md +176 -0
  29. package/templates/base/claude/skills/sprint-teammate/sprint-teammate.md +79 -0
  30. package/templates/base/scripts/lib/SprintLauncher.ts +325 -0
  31. package/templates/base/scripts/lib/TmuxManager.ts +296 -0
  32. package/templates/base/scripts/lib/WorktreeIsolator.ts +165 -0
  33. package/templates/base/scripts/lib/WorktreeManager.ts +106 -0
  34. package/templates/base/scripts/lib/mailbox/types.ts +175 -0
  35. package/templates/base/scripts/lib/sidecar/SidecarWatcher.ts +249 -0
  36. package/templates/base/scripts/lib/sidecar/run.ts +90 -0
  37. package/templates/base/scripts/sprint-launch.ts +285 -0
@@ -0,0 +1,246 @@
1
+ /**
2
+ * mailbox-listener.ts — PostToolUse + SessionStart hook (RFC-025 v3.1)
3
+ *
4
+ * PostToolUse: Checks the agent's mailbox inbox after every tool call.
5
+ * SessionStart: Consumes inbox at session boot so agents start with context.
6
+ *
7
+ * Environment variables (set by WorktreeIsolator in sprint worktrees):
8
+ * SPRINT_ID — tmux session name (e.g., "sprint-cd213cab")
9
+ * PANE_ROLE — agent's mailbox address (e.g., "implementer-0")
10
+ *
11
+ * When NOT in a sprint (no env vars), exits silently with zero overhead.
12
+ *
13
+ * Message format: RFC-025 MessageEnvelope (Zod-validated JSON files).
14
+ * Consume semantics: read → validate → delete (FIFO order).
15
+ * Invalid files are moved to quarantine/ (not lost, not injected).
16
+ *
17
+ * SessionStart branch:
18
+ * - Reads hook payload from stdin (JSON with hook_event_name)
19
+ * - If hook_event_name === "SessionStart" → consume inbox and outputContext("SessionStart", ...)
20
+ * - Backward compat: if process.stdin.isTTY → skip stdin read (PostToolUse path)
21
+ */
22
+
23
+ import { readdirSync, readFileSync, unlinkSync, renameSync, existsSync, mkdirSync } from "node:fs";
24
+ import { join } from "node:path";
25
+ import { log, outputContext } from "./lib/api-client.js";
26
+
27
+ const HOOK = "MAILBOX-LISTENER";
28
+
29
+ // --- Types (minimal, no Zod dependency in hooks) ---
30
+
31
+ interface MailboxMessage {
32
+ id: string;
33
+ from: { role: string; index: number };
34
+ to: { role: string; index: number };
35
+ timestamp: string;
36
+ body: {
37
+ type: string;
38
+ taskId?: string;
39
+ title?: string;
40
+ description?: string;
41
+ summary?: string;
42
+ progress?: number;
43
+ message?: string;
44
+ errorCode?: string;
45
+ acceptanceCriteria?: string[];
46
+ };
47
+ }
48
+
49
+ // --- Stdin reader (same pattern as sprint-registry.ts) ---
50
+
51
+ async function readStdinPayload(): Promise<Record<string, unknown>> {
52
+ const chunks: Buffer[] = [];
53
+ for await (const chunk of process.stdin) {
54
+ chunks.push(chunk as Buffer);
55
+ }
56
+ const raw = Buffer.concat(chunks).toString("utf-8").trim();
57
+ if (!raw) return {};
58
+ try {
59
+ return JSON.parse(raw) as Record<string, unknown>;
60
+ } catch {
61
+ return {};
62
+ }
63
+ }
64
+
65
+ // --- Core inbox consumption logic (shared between SessionStart and PostToolUse) ---
66
+
67
+ function consumeInbox(
68
+ inboxPath: string,
69
+ quarantinePath: string,
70
+ paneRole: string,
71
+ ): { consumed: MailboxMessage[]; errors: string[] } {
72
+ // List .json files (exclude .tmp- in-flight writes)
73
+ let files: string[];
74
+ try {
75
+ files = readdirSync(inboxPath)
76
+ .filter((f) => f.endsWith(".json") && !f.startsWith(".tmp-"))
77
+ .sort(); // FIFO by filename (UUID-based, but sorted for determinism)
78
+ } catch {
79
+ return { consumed: [], errors: [] }; // Directory read error — fail silently
80
+ }
81
+
82
+ if (files.length === 0) {
83
+ return { consumed: [], errors: [] };
84
+ }
85
+
86
+ log(HOOK, `${files.length} message(s) in ${paneRole} inbox`);
87
+
88
+ const consumed: MailboxMessage[] = [];
89
+ const errors: string[] = [];
90
+
91
+ for (const file of files) {
92
+ const filePath = join(inboxPath, file);
93
+ try {
94
+ const raw = readFileSync(filePath, "utf-8");
95
+ const parsed = JSON.parse(raw) as MailboxMessage;
96
+
97
+ // Basic validation (no Zod in hooks — keep deps minimal)
98
+ if (!parsed.id || !parsed.from || !parsed.to || !parsed.body?.type) {
99
+ throw new Error(`Invalid envelope: missing required fields`);
100
+ }
101
+
102
+ // Consume: delete after successful parse
103
+ unlinkSync(filePath);
104
+ consumed.push(parsed);
105
+ log(HOOK, `Consumed: ${parsed.id} (${parsed.body.type} from ${parsed.from.role}-${parsed.from.index})`);
106
+ } catch (err) {
107
+ // Quarantine malformed message
108
+ const errMsg = err instanceof Error ? err.message : String(err);
109
+ errors.push(`${file}: ${errMsg}`);
110
+ log(HOOK, `Quarantine: ${file} — ${errMsg}`);
111
+ try {
112
+ mkdirSync(quarantinePath, { recursive: true });
113
+ renameSync(filePath, join(quarantinePath, file));
114
+ } catch {
115
+ // Best-effort quarantine
116
+ }
117
+ }
118
+ }
119
+
120
+ return { consumed, errors };
121
+ }
122
+
123
+ // --- Context builder (shared between SessionStart and PostToolUse) ---
124
+
125
+ function buildContext(
126
+ consumed: MailboxMessage[],
127
+ errors: string[],
128
+ paneRole: string,
129
+ ): string | null {
130
+ if (consumed.length === 0 && errors.length === 0) {
131
+ return null;
132
+ }
133
+
134
+ const parts: string[] = [
135
+ `[MAILBOX] ${consumed.length} new message(s) for ${paneRole}:`,
136
+ ];
137
+
138
+ for (const msg of consumed) {
139
+ const from = `${msg.from.role}-${msg.from.index}`;
140
+ parts.push("");
141
+ parts.push(`--- Message from ${from} (${msg.body.type}) ---`);
142
+
143
+ switch (msg.body.type) {
144
+ case "task_assignment":
145
+ parts.push(`Task: ${msg.body.taskId}`);
146
+ parts.push(`Title: ${msg.body.title}`);
147
+ if (msg.body.description) parts.push(`Description: ${msg.body.description}`);
148
+ if (msg.body.acceptanceCriteria?.length) {
149
+ parts.push(`Acceptance Criteria:`);
150
+ for (const ac of msg.body.acceptanceCriteria) {
151
+ parts.push(` - ${ac}`);
152
+ }
153
+ }
154
+ break;
155
+
156
+ case "task_complete":
157
+ parts.push(`Task: ${msg.body.taskId}`);
158
+ parts.push(`Summary: ${msg.body.summary}`);
159
+ break;
160
+
161
+ case "status_update":
162
+ parts.push(`Task: ${msg.body.taskId}`);
163
+ parts.push(`Progress: ${msg.body.progress}%`);
164
+ parts.push(`Status: ${msg.body.message}`);
165
+ break;
166
+
167
+ case "error_report":
168
+ parts.push(`Error: ${msg.body.errorCode}`);
169
+ parts.push(`Message: ${msg.body.message}`);
170
+ if (msg.body.taskId) parts.push(`Task: ${msg.body.taskId}`);
171
+ break;
172
+
173
+ case "ping":
174
+ parts.push(`Ping received — respond with pong if appropriate.`);
175
+ break;
176
+
177
+ case "pong":
178
+ parts.push(`Pong received — heartbeat confirmed.`);
179
+ break;
180
+
181
+ default:
182
+ parts.push(`Type: ${msg.body.type}`);
183
+ parts.push(`Raw: ${JSON.stringify(msg.body)}`);
184
+ }
185
+ }
186
+
187
+ if (errors.length > 0) {
188
+ parts.push("");
189
+ parts.push(`[MAILBOX-WARN] ${errors.length} malformed message(s) quarantined:`);
190
+ for (const e of errors) {
191
+ parts.push(` - ${e}`);
192
+ }
193
+ }
194
+
195
+ return parts.join("\n");
196
+ }
197
+
198
+ // --- Main ---
199
+
200
+ async function main(): Promise<void> {
201
+ const sprintId = process.env.SPRINT_ID;
202
+ const paneRole = process.env.PANE_ROLE;
203
+
204
+ // Not in a sprint — exit silently (zero overhead path)
205
+ if (!sprintId || !paneRole) {
206
+ return;
207
+ }
208
+
209
+ const inboxPath = `/tmp/${sprintId}/mailbox/${paneRole}/inbox`;
210
+ const quarantinePath = `/tmp/${sprintId}/mailbox/${paneRole}/quarantine`;
211
+
212
+ // No inbox directory — sprint may not have mailbox enabled
213
+ if (!existsSync(inboxPath)) {
214
+ return;
215
+ }
216
+
217
+ // Determine hook event: read stdin unless this is an interactive TTY (PostToolUse path)
218
+ let hookEventName: string | undefined;
219
+ if (!process.stdin.isTTY) {
220
+ try {
221
+ const payload = await readStdinPayload();
222
+ hookEventName = payload.hook_event_name as string | undefined;
223
+ } catch {
224
+ // Stdin read failure — fall through to PostToolUse behaviour
225
+ }
226
+ }
227
+
228
+ // Consume inbox
229
+ const { consumed, errors } = consumeInbox(inboxPath, quarantinePath, paneRole);
230
+
231
+ if (consumed.length === 0 && errors.length === 0) {
232
+ return;
233
+ }
234
+
235
+ // Build context string
236
+ const context = buildContext(consumed, errors, paneRole);
237
+ if (!context) {
238
+ return;
239
+ }
240
+
241
+ // Emit context with the appropriate hook event name
242
+ const effectiveEvent = hookEventName === "SessionStart" ? "SessionStart" : "PostToolUse";
243
+ outputContext(effectiveEvent, context);
244
+ }
245
+
246
+ void main();
@@ -0,0 +1,85 @@
1
+ /**
2
+ * sprint-registry.ts — SessionStart self-registration hook (RFC-025 M4)
3
+ *
4
+ * Reads SPRINT_ID and PANE_ROLE from environment, then writes a registry
5
+ * entry to /tmp/sprint-<SPRINT_ID>/registry/<PANE_ROLE>.json.
6
+ *
7
+ * IMPORTANT: No imports from scripts/lib/ — uses raw Node.js fs only.
8
+ * This hook runs in isolated worktree environments where scripts/lib may
9
+ * not be available on the module resolution path.
10
+ *
11
+ * Hook input (stdin): Claude Code SessionStart JSON payload (ignored).
12
+ * Exit 0 always — registration failure must not block the session.
13
+ */
14
+
15
+ import { mkdirSync, writeFileSync } from 'node:fs';
16
+ import { join } from 'node:path';
17
+
18
+ function log(msg: string): void {
19
+ process.stderr.write(`[sprint-registry] ${msg}\n`);
20
+ }
21
+
22
+ /** Read hook JSON payload from stdin (async, same pattern as api-client.ts). */
23
+ async function readStdin(): Promise<Record<string, unknown>> {
24
+ const chunks: Buffer[] = [];
25
+ for await (const chunk of process.stdin) {
26
+ chunks.push(chunk as Buffer);
27
+ }
28
+ const raw = Buffer.concat(chunks).toString('utf-8').trim();
29
+ if (!raw) return {};
30
+ try {
31
+ return JSON.parse(raw) as Record<string, unknown>;
32
+ } catch {
33
+ return {};
34
+ }
35
+ }
36
+
37
+ async function main(): Promise<void> {
38
+ // Read SessionStart payload from stdin — contains session_id
39
+ const stdin = await readStdin();
40
+ const sessionId = (stdin.session_id as string) ?? undefined;
41
+
42
+
43
+ // Read required env vars
44
+ const sprintId = process.env['SPRINT_ID'];
45
+ const paneRole = process.env['PANE_ROLE'];
46
+
47
+ if (!sprintId || !paneRole) {
48
+ log(`Skipping: SPRINT_ID=${sprintId ?? 'unset'} PANE_ROLE=${paneRole ?? 'unset'}`);
49
+ process.exit(0);
50
+ }
51
+
52
+ const registryDir = `/tmp/${sprintId}/registry`;
53
+ const entryPath = join(registryDir, `${paneRole}.json`);
54
+
55
+ const workflowId = process.env['WORKFLOW_ID'];
56
+
57
+ const entry: Record<string, unknown> = {
58
+ role: paneRole,
59
+ sprintId,
60
+ pid: process.pid,
61
+ registeredAt: new Date().toISOString(),
62
+ worktreePath: process.cwd(),
63
+ };
64
+
65
+ if (sessionId) {
66
+ entry.sessionId = sessionId;
67
+ }
68
+
69
+ if (workflowId) {
70
+ entry.workflowId = workflowId;
71
+ }
72
+
73
+ try {
74
+ mkdirSync(registryDir, { recursive: true });
75
+ writeFileSync(entryPath, JSON.stringify(entry, null, 2), 'utf-8');
76
+ log(`Registered ${paneRole} for sprint ${sprintId} (pid=${process.pid}, session=${sessionId ?? 'unknown'})`);
77
+ } catch (err) {
78
+ // Log but do not fail — registration is best-effort
79
+ log(`Registration failed: ${err}`);
80
+ }
81
+
82
+ process.exit(0);
83
+ }
84
+
85
+ main().catch(() => process.exit(0));
@@ -46,6 +46,12 @@
46
46
  "command": "npx tsx .claude/hooks/session-start.ts",
47
47
  "timeout": 10000,
48
48
  "on_failure": "ignore"
49
+ },
50
+ {
51
+ "type": "command",
52
+ "command": "npx tsx .claude/hooks/sprint-registry.ts",
53
+ "timeout": 5000,
54
+ "on_failure": "ignore"
49
55
  }
50
56
  ]
51
57
  }
@@ -126,6 +132,19 @@
126
132
  ]
127
133
  }
128
134
  ],
135
+ "PostToolUse": [
136
+ {
137
+ "matcher": "",
138
+ "hooks": [
139
+ {
140
+ "type": "command",
141
+ "command": "npx tsx .claude/hooks/mailbox-listener.ts",
142
+ "timeout": 5000,
143
+ "on_failure": "ignore"
144
+ }
145
+ ]
146
+ }
147
+ ],
129
148
  "PostCompact": [
130
149
  {
131
150
  "matcher": "",
@@ -0,0 +1,176 @@
1
+ ---
2
+ name: sprint-launch
3
+ description: >
4
+ Launch parallel Claude sessions in tmux for sprint execution.
5
+ Use when starting a sprint with independent tasks that benefit from parallel panes.
6
+ Supports duo, duo-doc, squad, squad-review, platoon, and platoon-full presets
7
+ covering 2 to 5+ pane configurations.
8
+ argument-hint: <preset> [workflow-id]
9
+ ---
10
+
11
+ # Sprint Launcher — RFC-025 v2
12
+
13
+ Launch parallel Claude sessions in tmux panes, each isolated in a git worktree, to execute sprint tasks concurrently.
14
+
15
+ ## When to Use
16
+
17
+ - Starting a sprint with 1-5 independent task tracks
18
+ - You want parallel agent sessions with worktree isolation
19
+ - RFC-021 Sprints, ADR-017 phases, or any feature work with clear task separation
20
+
21
+ ## Prerequisites
22
+
23
+ Before launching, verify:
24
+ 1. **tmux** is installed and on PATH (`tmux -V`)
25
+ 2. **claude** CLI is on PATH (`claude --version`)
26
+ 3. **git** repo is clean (no uncommitted changes that could conflict with worktrees)
27
+ 4. An active workflow exists (or you have a workflowId)
28
+
29
+ ## Presets
30
+
31
+ | Preset | Panes | Composition | Use When |
32
+ |--------|-------|-------------|----------|
33
+ | `duo` | 1 | 1 implementer | Simple sprint, 1 task track |
34
+ | `duo-doc` | 2 | 1 implementer + 1 doc-sidecar | Documentation-heavy work |
35
+ | `squad` | 3 | 2 implementers + 1 debug-sidecar | 2 parallel tracks with review |
36
+ | `squad-review` | 3 | 1 implementer + 1 debug-sidecar + 1 doc-sidecar | Quality-critical single track |
37
+ | `platoon` | 5 | 3 implementers + 1 reviewer + 1 debug-sidecar | 3 parallel tracks with review |
38
+ | `platoon-full` | 7 | 2 implementers + 2 doc-sidecars + 1 debug-sidecar + 1 test-sidecar + 1 reviewer | Complex sprint with full observability |
39
+
40
+ ## Protocol
41
+
42
+ **IMPORTANT: Always confirm with the user before launching.**
43
+
44
+ ### Step 1: Gather Parameters
45
+
46
+ Parse from user input or active workflow context:
47
+ - **preset**: one of the 6 presets above (required)
48
+ - **workflowId**: from active workflow or user input (optional — script generates one if missing)
49
+
50
+ ### Step 2: Confirm via AskUserQuestion
51
+
52
+ Before executing anything, present the launch plan:
53
+
54
+ ```
55
+ AskUserQuestion({
56
+ question: "Sprint Launch: {preset} preset\n\nSession: sprint-{wfId:0:8}\nPanes: {pane descriptions}\nWorktrees: ../wt-sprint-{wfId:0:8}-{0,1,...}\n\nProceed?",
57
+ options: ["Launch", "Change preset", "Cancel"]
58
+ })
59
+ ```
60
+
61
+ ### Step 3: Execute
62
+
63
+ On user approval, run via TypeScript launcher:
64
+
65
+ ```bash
66
+ npx tsx scripts/sprint-launch.ts {preset} {workflowId}
67
+
68
+ # With task distribution (--task is repeatable, round-robin to implementer panes):
69
+ npx tsx scripts/sprint-launch.ts {preset} {workflowId} --mailbox \
70
+ --task "TASK-001: Implement auth endpoint" \
71
+ --task "TASK-002: Write integration tests"
72
+
73
+ # With tasks fetched from REST API (graceful fallback if API unavailable):
74
+ npx tsx scripts/sprint-launch.ts {preset} {workflowId} --mailbox --fetch-tasks
75
+ ```
76
+
77
+ ### Step 4: Auto-attach
78
+
79
+ The script automatically attaches after launching panes and injecting startup prompts:
80
+
81
+ - **Inside tmux**: opens a horizontal split pointing at the new session — zero user action required
82
+ - **Outside tmux**: prints the attach command to console, e.g. `tmux attach -t sprint-{prefix}`
83
+
84
+ Startup prompts are injected into each pane automatically. If a pane fails to receive its prompt, auto-attach still proceeds.
85
+
86
+ ## Task Distribution
87
+
88
+ When launching with tasks, the launcher distributes them **round-robin to implementer panes only**.
89
+ Sidecar agents (doc-sidecar, debug-sidecar, test-sidecar) react to implementer progress via mailbox
90
+ and do not receive direct task_assignment messages from the launcher.
91
+
92
+ ### --task flag (repeatable)
93
+
94
+ ```bash
95
+ --task "TASK-001: Title"
96
+ ```
97
+
98
+ - Parses `TASK-001` as `taskId` and `Title` as `title`
99
+ - Produces a `task_assignment` mailbox message with `description: ''` and `acceptanceCriteria: []`
100
+ - Tasks are distributed round-robin: task[0] → implementer[0], task[1] → implementer[1], task[2] → implementer[0], etc.
101
+ - The task title is also injected into the pane's CLAUDE.md as a hint (via WorktreeIsolator)
102
+
103
+ ### --fetch-tasks flag
104
+
105
+ ```bash
106
+ --fetch-tasks
107
+ ```
108
+
109
+ - Calls `GET /api/workflows/{workflowId}/tasks` on the configured REST API (`ORCHESTRATOR_API_URL` env var, default `http://localhost:3000`)
110
+ - Appends fetched tasks to any `--task` CLI tasks
111
+ - Graceful fallback: if the API is unreachable or returns an error, prints a warning and continues with CLI tasks only
112
+
113
+ ### Agent Protocol
114
+
115
+ Agents receive tasks via the sprint-teammate skill. See `.claude/skills/sprint-teammate/sprint-teammate.md`.
116
+
117
+ ## Critical Rules
118
+
119
+ 1. **NEVER use `--bare` for implementer panes** — `--bare` suppresses hooks, skills, and MCP tools. Implementers MUST have access to these. The script uses `claude -p` (without `--bare`).
120
+ 2. **Always confirm before launching** — never auto-launch panes.
121
+ 3. **Worktrees are cleaned up on exit** — the script traps EXIT/SIGINT/SIGTERM and removes worktrees if interrupted.
122
+ 4. **ANTHROPIC_API_KEY warning** — if unset, script warns but continues (Max OAuth mode assumed).
123
+
124
+ ## Monitoring
125
+
126
+ After launch, check pane health:
127
+
128
+ ```bash
129
+ # Single check
130
+ ./scripts/sprint-status.sh sprint-{prefix} --once
131
+
132
+ # Continuous monitoring (10s interval)
133
+ ./scripts/sprint-status.sh sprint-{prefix}
134
+
135
+ # Custom interval
136
+ POLL_INTERVAL=5 ./scripts/sprint-status.sh sprint-{prefix}
137
+ ```
138
+
139
+ Output shows ALIVE (green) or DEAD (red) per pane.
140
+
141
+ ## Cleanup
142
+
143
+ Worktrees are auto-cleaned on script exit. If a crash leaves orphans:
144
+
145
+ ```bash
146
+ git worktree prune
147
+ git worktree list # verify no wt-sprint-* remain
148
+ ```
149
+
150
+ To kill a running sprint session:
151
+
152
+ ```bash
153
+ tmux kill-session -t sprint-{prefix}
154
+ ```
155
+
156
+ ## Examples
157
+
158
+ ```bash
159
+ # Simple sprint with 1 implementer (auto-attaches)
160
+ /sprint-launch duo
161
+
162
+ # Documentation-heavy sprint
163
+ /sprint-launch duo-doc adaaa9a4-ef49-4e26-af14-2b239f62b40c
164
+
165
+ # 2 parallel tracks
166
+ /sprint-launch squad
167
+
168
+ # 2 tracks with reviewer sidecar
169
+ /sprint-launch squad-review adaaa9a4-ef49-4e26-af14-2b239f62b40c
170
+
171
+ # 3 parallel tracks
172
+ /sprint-launch platoon
173
+
174
+ # 3 tracks with reviewer sidecar
175
+ /sprint-launch platoon-full adaaa9a4-ef49-4e26-af14-2b239f62b40c
176
+ ```
@@ -0,0 +1,79 @@
1
+ # Sprint Teammate Protocol
2
+
3
+ You are a focused sprint agent. Read this protocol at session start.
4
+
5
+ ## Identity Guard
6
+
7
+ Check `process.env.SPRINT_ID`. If set, you are in a sprint session.
8
+ Your role is `process.env.PANE_ROLE`. Your inbox is:
9
+ `/tmp/{SPRINT_ID}/mailbox/{PANE_ROLE}/inbox/`
10
+
11
+ ## On Session Start
12
+
13
+ 1. Read your CLAUDE.md for sprint context (session, workflow, task hint).
14
+ 2. Check your inbox for any `task_assignment` messages.
15
+ 3. If a task is assigned: **execute immediately** — no greeting, no questions.
16
+ 4. If inbox is empty: wait. The mailbox-listener hook will inject messages as they arrive.
17
+
18
+ ## Message Types
19
+
20
+ ### Receiving: task_assignment
21
+ ```json
22
+ {
23
+ "type": "task_assignment",
24
+ "taskId": "TASK-001",
25
+ "title": "Short title",
26
+ "description": "Full description",
27
+ "acceptanceCriteria": ["criterion 1", "criterion 2"]
28
+ }
29
+ ```
30
+ On receipt: start implementation immediately. No acknowledgement needed.
31
+
32
+ ### Sending: task_complete
33
+ ```json
34
+ {
35
+ "type": "task_complete",
36
+ "taskId": "TASK-001",
37
+ "summary": "What was done and where"
38
+ }
39
+ ```
40
+ Write to: `/tmp/{SPRINT_ID}/mailbox/orchestrator-0/inbox/{uuid}.json`
41
+
42
+ ### Sending: status_update
43
+ ```json
44
+ {
45
+ "type": "status_update",
46
+ "taskId": "TASK-001",
47
+ "progress": 50,
48
+ "message": "Tests written, implementing..."
49
+ }
50
+ ```
51
+
52
+ ### Sending: error_report
53
+ ```json
54
+ {
55
+ "type": "error_report",
56
+ "errorCode": "BLOCKER",
57
+ "message": "Cannot proceed because...",
58
+ "taskId": "TASK-001"
59
+ }
60
+ ```
61
+
62
+ ## Mailbox Paths
63
+
64
+ | Direction | Path |
65
+ |-----------|------|
66
+ | Your inbox | `/tmp/{SPRINT_ID}/mailbox/{PANE_ROLE}/inbox/` |
67
+ | Orchestrator | `/tmp/{SPRINT_ID}/mailbox/orchestrator-0/inbox/` |
68
+ | Other pane | `/tmp/{SPRINT_ID}/mailbox/{role}-{index}/inbox/` |
69
+
70
+ Envelope format: `{ "id": "<uuid>", "from": {"role": "...", "index": N}, "to": {"role": "...", "index": N}, "timestamp": "<ISO>", "body": {...} }`
71
+
72
+ ## Self-Guarding Rules
73
+
74
+ - MUST NOT greet users or ask "What would you like to do?"
75
+ - MUST NOT invoke workflow MCP tools (advancePhase, completeWorkflow)
76
+ - MUST NOT spawn sub-agents
77
+ - MUST execute task_assignment immediately upon receipt
78
+ - MUST send task_complete when done
79
+ - MUST send error_report if blocked (do not silently stall)