@bradygaster/squad-cli 0.9.0 → 0.9.2-insider.5

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 (213) hide show
  1. package/README.md +1 -1
  2. package/dist/cli/commands/build.d.ts.map +1 -1
  3. package/dist/cli/commands/build.js +10 -10
  4. package/dist/cli/commands/build.js.map +1 -1
  5. package/dist/cli/commands/config.d.ts +12 -0
  6. package/dist/cli/commands/config.d.ts.map +1 -0
  7. package/dist/cli/commands/config.js +157 -0
  8. package/dist/cli/commands/config.js.map +1 -0
  9. package/dist/cli/commands/consult.d.ts.map +1 -1
  10. package/dist/cli/commands/consult.js +9 -4
  11. package/dist/cli/commands/consult.js.map +1 -1
  12. package/dist/cli/commands/copilot.d.ts.map +1 -1
  13. package/dist/cli/commands/copilot.js +8 -7
  14. package/dist/cli/commands/copilot.js.map +1 -1
  15. package/dist/cli/commands/doctor.d.ts.map +1 -1
  16. package/dist/cli/commands/doctor.js +50 -17
  17. package/dist/cli/commands/doctor.js.map +1 -1
  18. package/dist/cli/commands/economy.d.ts.map +1 -1
  19. package/dist/cli/commands/economy.js +3 -2
  20. package/dist/cli/commands/economy.js.map +1 -1
  21. package/dist/cli/commands/export.d.ts.map +1 -1
  22. package/dist/cli/commands/export.js +22 -16
  23. package/dist/cli/commands/export.js.map +1 -1
  24. package/dist/cli/commands/extract.d.ts.map +1 -1
  25. package/dist/cli/commands/extract.js +14 -10
  26. package/dist/cli/commands/extract.js.map +1 -1
  27. package/dist/cli/commands/import.d.ts.map +1 -1
  28. package/dist/cli/commands/import.js +21 -18
  29. package/dist/cli/commands/import.js.map +1 -1
  30. package/dist/cli/commands/init-remote.d.ts.map +1 -1
  31. package/dist/cli/commands/init-remote.js +7 -6
  32. package/dist/cli/commands/init-remote.js.map +1 -1
  33. package/dist/cli/commands/link.d.ts.map +1 -1
  34. package/dist/cli/commands/link.js +11 -10
  35. package/dist/cli/commands/link.js.map +1 -1
  36. package/dist/cli/commands/migrate.d.ts.map +1 -1
  37. package/dist/cli/commands/migrate.js +19 -18
  38. package/dist/cli/commands/migrate.js.map +1 -1
  39. package/dist/cli/commands/personal.d.ts.map +1 -1
  40. package/dist/cli/commands/personal.js +12 -20
  41. package/dist/cli/commands/personal.js.map +1 -1
  42. package/dist/cli/commands/plugin.d.ts.map +1 -1
  43. package/dist/cli/commands/plugin.js +8 -7
  44. package/dist/cli/commands/plugin.js.map +1 -1
  45. package/dist/cli/commands/rc.d.ts.map +1 -1
  46. package/dist/cli/commands/rc.js +19 -12
  47. package/dist/cli/commands/rc.js.map +1 -1
  48. package/dist/cli/commands/schedule.d.ts.map +1 -1
  49. package/dist/cli/commands/schedule.js +6 -5
  50. package/dist/cli/commands/schedule.js.map +1 -1
  51. package/dist/cli/commands/start.d.ts.map +1 -1
  52. package/dist/cli/commands/start.js +18 -11
  53. package/dist/cli/commands/start.js.map +1 -1
  54. package/dist/cli/commands/streams.d.ts.map +1 -1
  55. package/dist/cli/commands/streams.js +3 -2
  56. package/dist/cli/commands/streams.js.map +1 -1
  57. package/dist/cli/commands/upstream.d.ts.map +1 -1
  58. package/dist/cli/commands/upstream.js +23 -19
  59. package/dist/cli/commands/upstream.js.map +1 -1
  60. package/dist/cli/commands/watch/capabilities/board.d.ts +22 -0
  61. package/dist/cli/commands/watch/capabilities/board.d.ts.map +1 -0
  62. package/dist/cli/commands/watch/capabilities/board.js +121 -0
  63. package/dist/cli/commands/watch/capabilities/board.js.map +1 -0
  64. package/dist/cli/commands/watch/capabilities/decision-hygiene.d.ts +14 -0
  65. package/dist/cli/commands/watch/capabilities/decision-hygiene.d.ts.map +1 -0
  66. package/dist/cli/commands/watch/capabilities/decision-hygiene.js +72 -0
  67. package/dist/cli/commands/watch/capabilities/decision-hygiene.js.map +1 -0
  68. package/dist/cli/commands/watch/capabilities/execute.d.ts +33 -0
  69. package/dist/cli/commands/watch/capabilities/execute.d.ts.map +1 -0
  70. package/dist/cli/commands/watch/capabilities/execute.js +119 -0
  71. package/dist/cli/commands/watch/capabilities/execute.js.map +1 -0
  72. package/dist/cli/commands/watch/capabilities/index.d.ts +7 -0
  73. package/dist/cli/commands/watch/capabilities/index.d.ts.map +1 -0
  74. package/dist/cli/commands/watch/capabilities/index.js +28 -0
  75. package/dist/cli/commands/watch/capabilities/index.js.map +1 -0
  76. package/dist/cli/commands/watch/capabilities/monitor-email.d.ts +14 -0
  77. package/dist/cli/commands/watch/capabilities/monitor-email.d.ts.map +1 -0
  78. package/dist/cli/commands/watch/capabilities/monitor-email.js +54 -0
  79. package/dist/cli/commands/watch/capabilities/monitor-email.js.map +1 -0
  80. package/dist/cli/commands/watch/capabilities/monitor-teams.d.ts +14 -0
  81. package/dist/cli/commands/watch/capabilities/monitor-teams.d.ts.map +1 -0
  82. package/dist/cli/commands/watch/capabilities/monitor-teams.js +55 -0
  83. package/dist/cli/commands/watch/capabilities/monitor-teams.js.map +1 -0
  84. package/dist/cli/commands/watch/capabilities/retro.d.ts +14 -0
  85. package/dist/cli/commands/watch/capabilities/retro.d.ts.map +1 -0
  86. package/dist/cli/commands/watch/capabilities/retro.js +81 -0
  87. package/dist/cli/commands/watch/capabilities/retro.js.map +1 -0
  88. package/dist/cli/commands/watch/capabilities/self-pull.d.ts +14 -0
  89. package/dist/cli/commands/watch/capabilities/self-pull.d.ts.map +1 -0
  90. package/dist/cli/commands/watch/capabilities/self-pull.js +33 -0
  91. package/dist/cli/commands/watch/capabilities/self-pull.js.map +1 -0
  92. package/dist/cli/commands/watch/capabilities/two-pass.d.ts +14 -0
  93. package/dist/cli/commands/watch/capabilities/two-pass.d.ts.map +1 -0
  94. package/dist/cli/commands/watch/capabilities/two-pass.js +66 -0
  95. package/dist/cli/commands/watch/capabilities/two-pass.js.map +1 -0
  96. package/dist/cli/commands/watch/capabilities/wave-dispatch.d.ts +14 -0
  97. package/dist/cli/commands/watch/capabilities/wave-dispatch.d.ts.map +1 -0
  98. package/dist/cli/commands/watch/capabilities/wave-dispatch.js +117 -0
  99. package/dist/cli/commands/watch/capabilities/wave-dispatch.js.map +1 -0
  100. package/dist/cli/commands/watch/config.d.ts +25 -0
  101. package/dist/cli/commands/watch/config.d.ts.map +1 -0
  102. package/dist/cli/commands/watch/config.js +82 -0
  103. package/dist/cli/commands/watch/config.js.map +1 -0
  104. package/dist/cli/commands/watch/index.d.ts +95 -0
  105. package/dist/cli/commands/watch/index.d.ts.map +1 -0
  106. package/dist/cli/commands/watch/index.js +704 -0
  107. package/dist/cli/commands/watch/index.js.map +1 -0
  108. package/dist/cli/commands/watch/registry.d.ts +19 -0
  109. package/dist/cli/commands/watch/registry.d.ts.map +1 -0
  110. package/dist/cli/commands/watch/registry.js +28 -0
  111. package/dist/cli/commands/watch/registry.js.map +1 -0
  112. package/dist/cli/commands/watch/types.d.ts +57 -0
  113. package/dist/cli/commands/watch/types.d.ts.map +1 -0
  114. package/dist/cli/commands/watch/types.js +8 -0
  115. package/dist/cli/commands/watch/types.js.map +1 -0
  116. package/dist/cli/core/cast.d.ts.map +1 -1
  117. package/dist/cli/core/cast.js +15 -19
  118. package/dist/cli/core/cast.js.map +1 -1
  119. package/dist/cli/core/detect-squad-dir.d.ts.map +1 -1
  120. package/dist/cli/core/detect-squad-dir.js +12 -10
  121. package/dist/cli/core/detect-squad-dir.js.map +1 -1
  122. package/dist/cli/core/email-scrub.d.ts.map +1 -1
  123. package/dist/cli/core/email-scrub.js +12 -11
  124. package/dist/cli/core/email-scrub.js.map +1 -1
  125. package/dist/cli/core/gh-cli.d.ts +13 -0
  126. package/dist/cli/core/gh-cli.d.ts.map +1 -1
  127. package/dist/cli/core/gh-cli.js +24 -0
  128. package/dist/cli/core/gh-cli.js.map +1 -1
  129. package/dist/cli/core/init.d.ts +2 -0
  130. package/dist/cli/core/init.d.ts.map +1 -1
  131. package/dist/cli/core/init.js +22 -5
  132. package/dist/cli/core/init.js.map +1 -1
  133. package/dist/cli/core/migrate-directory.d.ts.map +1 -1
  134. package/dist/cli/core/migrate-directory.js +14 -13
  135. package/dist/cli/core/migrate-directory.js.map +1 -1
  136. package/dist/cli/core/migrations.d.ts.map +1 -1
  137. package/dist/cli/core/migrations.js +22 -8
  138. package/dist/cli/core/migrations.js.map +1 -1
  139. package/dist/cli/core/nap.d.ts.map +1 -1
  140. package/dist/cli/core/nap.js +111 -49
  141. package/dist/cli/core/nap.js.map +1 -1
  142. package/dist/cli/core/project-type.d.ts.map +1 -1
  143. package/dist/cli/core/project-type.js +11 -10
  144. package/dist/cli/core/project-type.js.map +1 -1
  145. package/dist/cli/core/team-md.d.ts.map +1 -1
  146. package/dist/cli/core/team-md.js +9 -4
  147. package/dist/cli/core/team-md.js.map +1 -1
  148. package/dist/cli/core/templates.d.ts.map +1 -1
  149. package/dist/cli/core/templates.js +4 -3
  150. package/dist/cli/core/templates.js.map +1 -1
  151. package/dist/cli/core/upgrade.d.ts.map +1 -1
  152. package/dist/cli/core/upgrade.js +68 -55
  153. package/dist/cli/core/upgrade.js.map +1 -1
  154. package/dist/cli/core/version.d.ts.map +1 -1
  155. package/dist/cli/core/version.js +8 -7
  156. package/dist/cli/core/version.js.map +1 -1
  157. package/dist/cli/index.d.ts +1 -1
  158. package/dist/cli/index.d.ts.map +1 -1
  159. package/dist/cli/index.js +1 -1
  160. package/dist/cli/index.js.map +1 -1
  161. package/dist/cli/self-update.d.ts.map +1 -1
  162. package/dist/cli/self-update.js +7 -4
  163. package/dist/cli/self-update.js.map +1 -1
  164. package/dist/cli/shell/agent-name-parser.d.ts +16 -0
  165. package/dist/cli/shell/agent-name-parser.d.ts.map +1 -0
  166. package/dist/cli/shell/agent-name-parser.js +54 -0
  167. package/dist/cli/shell/agent-name-parser.js.map +1 -0
  168. package/dist/cli/shell/commands.d.ts.map +1 -1
  169. package/dist/cli/shell/commands.js +4 -3
  170. package/dist/cli/shell/commands.js.map +1 -1
  171. package/dist/cli/shell/coordinator.d.ts +4 -1
  172. package/dist/cli/shell/coordinator.d.ts.map +1 -1
  173. package/dist/cli/shell/coordinator.js +29 -26
  174. package/dist/cli/shell/coordinator.js.map +1 -1
  175. package/dist/cli/shell/index.d.ts.map +1 -1
  176. package/dist/cli/shell/index.js +33 -35
  177. package/dist/cli/shell/index.js.map +1 -1
  178. package/dist/cli/shell/lifecycle.d.ts +13 -2
  179. package/dist/cli/shell/lifecycle.d.ts.map +1 -1
  180. package/dist/cli/shell/lifecycle.js +26 -13
  181. package/dist/cli/shell/lifecycle.js.map +1 -1
  182. package/dist/cli/shell/session-store.d.ts.map +1 -1
  183. package/dist/cli/shell/session-store.js +16 -12
  184. package/dist/cli/shell/session-store.js.map +1 -1
  185. package/dist/cli/shell/spawn.d.ts +4 -1
  186. package/dist/cli/shell/spawn.d.ts.map +1 -1
  187. package/dist/cli/shell/spawn.js +28 -10
  188. package/dist/cli/shell/spawn.js.map +1 -1
  189. package/dist/cli-entry.js +83 -12
  190. package/dist/cli-entry.js.map +1 -1
  191. package/package.json +8 -4
  192. package/templates/scribe-charter.md +4 -0
  193. package/templates/skills/cross-machine-coordination/SKILL.md +434 -0
  194. package/templates/skills/error-recovery/SKILL.md +99 -0
  195. package/templates/skills/iterative-retrieval/SKILL.md +165 -0
  196. package/templates/skills/notification-routing/SKILL.md +105 -0
  197. package/templates/skills/pr-screenshots/SKILL.md +149 -0
  198. package/templates/skills/ralph-two-pass-scan/SKILL.md +35 -0
  199. package/templates/skills/reflect/SKILL.md +229 -0
  200. package/templates/skills/release-process/SKILL.md +84 -376
  201. package/templates/skills/retro-enforcement/SKILL.md +148 -0
  202. package/templates/skills/tiered-memory/SKILL.md +234 -0
  203. package/templates/skills/windows-compatibility/SKILL.md +24 -0
  204. package/templates/{squad.agent.md → squad.agent.md.template} +1316 -1287
  205. package/templates/workflows/squad-ci.yml +1 -1
  206. package/templates/workflows/squad-heartbeat.yml +0 -4
  207. package/templates/workflows/squad-insider-release.yml +1 -1
  208. package/templates/workflows/squad-preview.yml +1 -1
  209. package/templates/workflows/squad-release.yml +1 -1
  210. package/dist/cli/commands/watch.d.ts +0 -18
  211. package/dist/cli/commands/watch.d.ts.map +0 -1
  212. package/dist/cli/commands/watch.js +0 -306
  213. package/dist/cli/commands/watch.js.map +0 -1
@@ -0,0 +1,434 @@
1
+ # Skill: Cross-Machine Coordination Pattern
2
+
3
+ **Skill ID:** `cross-machine-coordination`
4
+ **Owner:** Ralph (Work Monitor)
5
+ **Squad Integration:** All agents
6
+ **Status:** Specification (ready for implementation)
7
+
8
+ ---
9
+
10
+ ## Overview
11
+
12
+ Enables squad agents running on different machines (laptop, DevBox, Azure VM) to securely share work, coordinate execution, and pass results without manual intervention.
13
+
14
+ **Pattern:** Git-based task queuing + GitHub Issues supplement
15
+
16
+ ---
17
+
18
+ ## Usage
19
+
20
+ ### For Task Sources (Orchestrating Machine)
21
+
22
+ **To assign work to DevBox:**
23
+
24
+ ```bash
25
+ # Create task file
26
+ cat > .squad/cross-machine/tasks/2026-03-14T1530Z-laptop-gpu-voice-clone.yaml << 'EOF'
27
+ id: gpu-voice-clone-001
28
+ source_machine: laptop-machine
29
+ target_machine: devbox
30
+ priority: high
31
+ created_at: 2026-03-14T15:30:00Z
32
+ task_type: gpu_workload
33
+ payload:
34
+ command: "python scripts/voice-clone.py --input voice.wav --output cloned.wav"
35
+ expected_duration_min: 15
36
+ resources:
37
+ gpu: true
38
+ memory_gb: 8
39
+ status: pending
40
+ EOF
41
+
42
+ # Commit & push
43
+ git add .squad/cross-machine/tasks/
44
+ git commit -m "Cross-machine task: GPU voice cloning [squad:machine-devbox]"
45
+ git push origin main
46
+ ```
47
+
48
+ Ralph on DevBox will:
49
+ 1. Pull the task on next cycle (5-10 min)
50
+ 2. Validate schema & command whitelist
51
+ 3. Execute the GPU workload
52
+ 4. Write result to `.squad/cross-machine/results/gpu-voice-clone-001.yaml`
53
+ 5. Commit & push the result
54
+
55
+ ---
56
+
57
+ ### For Task Executors (DevBox, Azure VMs)
58
+
59
+ Ralph automatically watches `.squad/cross-machine/tasks/` for work targeted at this machine.
60
+
61
+ **On each cycle (5-10 min):**
62
+
63
+ ```python
64
+ # Pseudo-code (Ralph implementation)
65
+ 1. git pull origin main
66
+ 2. Load all .yaml files in .squad/cross-machine/tasks/
67
+ 3. Filter for status=pending AND target_machine=HOSTNAME
68
+ 4. For each task:
69
+ a. Validate schema (must have: id, source_machine, target_machine, payload)
70
+ b. Validate command against whitelist
71
+ c. Execute task (with timeout)
72
+ d. Write result to .squad/cross-machine/results/{id}.yaml
73
+ e. Commit & push result
74
+ ```
75
+
76
+ ---
77
+
78
+ ### For Urgent/Ad-Hoc Tasks
79
+
80
+ **Use GitHub Issues with `squad:machine-{name}` label:**
81
+
82
+ ```bash
83
+ # Create issue
84
+ gh issue create \
85
+ --title "GPU: Clone voice profile from sample.wav" \
86
+ --body "Execute voice cloning on DevBox. Input: /path/to/voice-input.wav" \
87
+ --label "squad:machine-devbox" \
88
+ --label "urgent"
89
+ ```
90
+
91
+ Ralph on DevBox will:
92
+ 1. Detect issue with `squad:machine-devbox` label
93
+ 2. Parse task from issue body
94
+ 3. Execute task
95
+ 4. Comment with result
96
+ 5. Close issue
97
+
98
+ ---
99
+
100
+ ## File Formats
101
+
102
+ ### Task File (YAML)
103
+
104
+ **Location:** `.squad/cross-machine/tasks/{timestamp}-{machine}-{task-id}.yaml`
105
+
106
+ **Required Fields:**
107
+ ```yaml
108
+ id: {task-id} # Unique identifier (alphanumeric + dash)
109
+ source_machine: {hostname} # Where task was created
110
+ target_machine: {hostname} # Where task will execute
111
+ priority: high|normal|low # Execution priority
112
+ created_at: 2026-03-14T15:30:00Z # ISO 8601 timestamp
113
+ task_type: gpu_workload|script|... # Category
114
+ payload:
115
+ command: "..." # Shell command to execute
116
+ expected_duration_min: 15 # Timeout (minutes)
117
+ resources:
118
+ gpu: true|false
119
+ memory_gb: 8
120
+ cpu_cores: 4
121
+ status: pending|executing|completed|failed
122
+ ```
123
+
124
+ **Optional Fields:**
125
+ ```yaml
126
+ description: "Human-readable task description"
127
+ timeout_override_min: 120 # Override default timeout
128
+ retry_count: 3 # Retry failed tasks
129
+ ```
130
+
131
+ ### Result File (YAML)
132
+
133
+ **Location:** `.squad/cross-machine/results/{task-id}.yaml`
134
+
135
+ ```yaml
136
+ id: {task-id} # Links back to task
137
+ target_machine: devbox # Executed on
138
+ completed_at: 2026-03-14T15:45:00Z # When it finished
139
+ status: completed|failed|timeout # Outcome
140
+ exit_code: 0 # Shell exit code
141
+ stdout: "..." # Captured output
142
+ stderr: "..." # Captured errors
143
+ duration_seconds: 900 # How long it took
144
+ artifacts:
145
+ - path: "/path/to/artifacts/..." # Location of results
146
+ type: audio|text|model|...
147
+ size_mb: 2.5
148
+ ```
149
+
150
+ ---
151
+
152
+ ## Security Model
153
+
154
+ ### Validation Pipeline
155
+
156
+ All tasks go through:
157
+
158
+ 1. **Schema Validation**
159
+ - YAML structure matches spec
160
+ - Required fields present
161
+ - No unexpected fields (reject)
162
+
163
+ 2. **Command Whitelist**
164
+ - Only approved commands allowed
165
+ - Path validation (no `../../` escapes)
166
+ - Environment variable sanitization
167
+ - No inline shell operators (`&&`, `|`, `>`)
168
+
169
+ 3. **Resource Limits**
170
+ - Timeout enforced (default: 60 min)
171
+ - Memory cap: 16GB (adjustable)
172
+ - CPU threads: 4 (adjustable)
173
+ - Disk write: 100GB (adjustable)
174
+
175
+ 4. **Execution Isolation**
176
+ - Runs as unprivileged user
177
+ - Temp directory cleaned after execution
178
+ - Network access: read-only (no outbound writes)
179
+
180
+ 5. **Audit Trail**
181
+ - All executions logged to git
182
+ - Commit signed with Ralph's key
183
+ - Result stored immutably
184
+
185
+ ### Threat Mitigations
186
+
187
+ | Threat | Mitigation |
188
+ |--------|-----------|
189
+ | **Malicious task injection** | Branch protection + PR review before merge |
190
+ | **Credential leakage** | Pre-commit secret scan + environment scrubbing |
191
+ | **Resource exhaustion** | Timeout + memory limits |
192
+ | **Code injection** | Command whitelist + no shell evaluation |
193
+ | **Result tampering** | Git commit history is immutable |
194
+
195
+ ---
196
+
197
+ ## Configuration
198
+
199
+ Ralph reads config from `.squad/config.json`:
200
+
201
+ ```json
202
+ {
203
+ "cross_machine": {
204
+ "enabled": true,
205
+ "poll_interval_seconds": 300,
206
+ "this_machine": "devbox",
207
+ "max_concurrent_tasks": 2,
208
+ "task_timeout_minutes": 60,
209
+ "command_whitelist": [
210
+ "python scripts/voice-clone.py",
211
+ "python scripts/data-process.py",
212
+ "bash scripts/cleanup.sh"
213
+ ],
214
+ "result_ttl_days": 30
215
+ }
216
+ }
217
+ ```
218
+
219
+ ---
220
+
221
+ ## Examples
222
+
223
+ ### Example 1: GPU Voice Cloning (Laptop → DevBox)
224
+
225
+ **1. Laptop creates task:**
226
+
227
+ ```yaml
228
+ # .squad/cross-machine/tasks/2026-03-14T1530Z-laptop-gpu-001.yaml
229
+ id: gpu-voice-clone-001
230
+ source_machine: laptop-machine
231
+ target_machine: devbox
232
+ priority: high
233
+ created_at: 2026-03-14T15:30:00Z
234
+ task_type: gpu_workload
235
+ payload:
236
+ command: "python scripts/voice-clone.py --input voice.wav --output cloned.wav"
237
+ expected_duration_min: 15
238
+ resources:
239
+ gpu: true
240
+ memory_gb: 8
241
+ status: pending
242
+ ```
243
+
244
+ **2. Laptop commits & pushes:**
245
+
246
+ ```bash
247
+ git add .squad/cross-machine/tasks/
248
+ git commit -m "Task: GPU voice cloning [squad:machine-devbox]"
249
+ git push origin main
250
+ ```
251
+
252
+ **3. DevBox Ralph (5 min later):**
253
+
254
+ ```
255
+ [Ralph Watch Cycle]
256
+ - Pulled origin/main
257
+ - Detected: gpu-voice-clone-001 (status: pending, target: devbox)
258
+ - Validation: ✅ Schema OK, command whitelisted
259
+ - Executing: python scripts/voice-clone.py ...
260
+ - [15 minutes of processing]
261
+ - Completed: exit code 0
262
+ - Writing result...
263
+ - Committing & pushing...
264
+ ```
265
+
266
+ **4. Laptop Ralph (next cycle) sees result:**
267
+
268
+ ```yaml
269
+ # .squad/cross-machine/results/gpu-voice-clone-001.yaml
270
+ id: gpu-voice-clone-001
271
+ target_machine: devbox
272
+ completed_at: 2026-03-14T15:45:00Z
273
+ status: completed
274
+ exit_code: 0
275
+ stdout: "Voice cloning completed. Output written to /tmp/cloned.wav"
276
+ stderr: ""
277
+ duration_seconds: 900
278
+ artifacts:
279
+ - path: "/path/to/artifacts/voice-clone-001/output.wav"
280
+ type: audio
281
+ size_mb: 2.5
282
+ ```
283
+
284
+ ---
285
+
286
+ ### Example 2: Urgent Debug Request (Human → DevBox via Issue)
287
+
288
+ **Create issue:**
289
+
290
+ ```bash
291
+ gh issue create \
292
+ --title "DevBox: Debug voice model failure" \
293
+ --body "Error: Model failed to load on last run. Please check /tmp/model.log and report findings." \
294
+ --label "squad:machine-devbox" \
295
+ --label "urgent"
296
+ ```
297
+
298
+ **DevBox Ralph detects → executes → comments:**
299
+
300
+ ```
301
+ ✅ Executed on devbox at 2026-03-14 15:47:00
302
+ Command: python scripts/debug-model.py
303
+
304
+ Result:
305
+ ------
306
+ Model file: /tmp/model-v2.bin (OK)
307
+ Checksum: a1b2c3d4e5f6 (matches expected)
308
+ Memory available: 12 GB (sufficient)
309
+
310
+ ERROR FOUND: Config file permission issue
311
+ - File: ~/.config/voice/model.yaml
312
+ - Permissions: -rw------- (owner-only)
313
+ - Expected: -rw-r--r-- (world-readable for service)
314
+
315
+ FIX: Run: chmod 644 ~/.config/voice/model.yaml
316
+ ```
317
+
318
+ ---
319
+
320
+ ## Error Handling
321
+
322
+ ### Task Execution Failures
323
+
324
+ If a task fails (exit code != 0):
325
+
326
+ 1. Result written with `status: failed` + exit code
327
+ 2. stderr captured in result
328
+ 3. Committed to git for audit
329
+ 4. Source machine can retry by re-pushing task with `status: pending`
330
+
331
+ ### Stalled Tasks
332
+
333
+ If a task doesn't complete within timeout:
334
+
335
+ 1. Process killed
336
+ 2. Result written with `status: timeout`
337
+ 3. stderr: "Execution exceeded X minutes"
338
+ 4. Source can investigate or retry
339
+
340
+ ### Network Failures
341
+
342
+ If git push/pull fails:
343
+
344
+ - Ralph retries on next cycle
345
+ - Tasks queue locally until connectivity restored
346
+ - No tasks lost (stored in local repo)
347
+
348
+ ---
349
+
350
+ ## Monitoring & Debugging
351
+
352
+ ### Check Task Queue
353
+
354
+ ```bash
355
+ ls -la .squad/cross-machine/tasks/
356
+ cat .squad/cross-machine/tasks/*.yaml | grep -E "^(id|status|target_machine):"
357
+ ```
358
+
359
+ ### Check Results
360
+
361
+ ```bash
362
+ ls -la .squad/cross-machine/results/
363
+ cat .squad/cross-machine/results/{task-id}.yaml
364
+ ```
365
+
366
+ ### View Execution History
367
+
368
+ ```bash
369
+ git log --oneline .squad/cross-machine/ | head -20
370
+ ```
371
+
372
+ ### Monitor Ralph Cycles
373
+
374
+ ```bash
375
+ tail -f .squad/log/ralph-watch.log | grep "cross-machine"
376
+ ```
377
+
378
+ ---
379
+
380
+ ## Integration with Ralph Watch
381
+
382
+ Ralph automatically includes this pattern in its watch loop:
383
+
384
+ ```
385
+ Ralph Watch Cycle (every 5-10 min):
386
+ 1. Fetch GitHub issues with squad:machine-* labels
387
+ 2. Poll .squad/cross-machine/tasks/
388
+ 3. For each matching task:
389
+ - Validate
390
+ - Execute
391
+ - Write result
392
+ - Commit & push
393
+ 4. Update status in issue (if applicable)
394
+ 5. Sleep until next cycle
395
+ ```
396
+
397
+ No manual Ralph configuration needed — just create task files or issues with the right labels.
398
+
399
+ ---
400
+
401
+ ## Migration from Manual Handoff
402
+
403
+ **Before (today):**
404
+ - Laptop → user manually copies file to Teams chat
405
+ - user pastes into target terminal
406
+ - user copies output back
407
+ - user pastes result manually
408
+
409
+ **After (with this pattern):**
410
+ - Laptop Ralph writes task file → git push
411
+ - DevBox Ralph auto-executes → git push result
412
+ - Laptop Ralph auto-reads result
413
+ - 0 human intervention needed
414
+
415
+ ---
416
+
417
+ ## Future Enhancements
418
+
419
+ Potential expansions (Phase 2+):
420
+
421
+ 1. **Task Priorities:** Execution order based on priority field
422
+ 2. **Serial Pipelines:** Machine A → B → C task chains
423
+ 3. **GPU Availability Polling:** Query DevBox before submitting work
424
+ 4. **Cost Tracking:** Log resource usage per task
425
+ 5. **Notification Webhooks:** Alert on task completion
426
+ 6. **Web Dashboard:** Real-time task status visualization
427
+
428
+ ---
429
+
430
+ ## Questions?
431
+
432
+ Refer to research report: `research/active/cross-machine-agents/README.md`
433
+
434
+ Contact: Seven (Research & Docs) or Ralph (Work Monitor)
@@ -0,0 +1,99 @@
1
+ ---
2
+ name: "error-recovery"
3
+ description: "Standard recovery patterns for all squad agents. When something fails, adapt — don't just report the failure."
4
+ domain: "reliability, agent-coordination"
5
+ confidence: "high"
6
+ license: MIT
7
+ ---
8
+
9
+ # Error Recovery Patterns
10
+
11
+ Standard recovery patterns for all squad agents. When something fails, **adapt** — don't just report the failure.
12
+
13
+ ---
14
+
15
+ ## 1. Retry with Backoff
16
+
17
+ **When:** Transient failures — API timeouts, rate limits, network errors, temporary service unavailability.
18
+
19
+ **Pattern:**
20
+ 1. Wait briefly, then retry (start at 2s, double each attempt)
21
+ 2. Maximum 3 retries before escalating
22
+ 3. Log each attempt with the error received
23
+
24
+ **Example:** API call returns 429 Too Many Requests → wait 2s → retry → wait 4s → retry → wait 8s → retry → escalate if still failing.
25
+
26
+ ---
27
+
28
+ ## 2. Fallback Alternatives
29
+
30
+ **When:** Primary tool or approach fails and an alternative exists.
31
+
32
+ **Pattern:**
33
+ 1. Attempt primary approach
34
+ 2. On failure, identify alternative tool/method
35
+ 3. Try the alternative with the same intent
36
+ 4. Document which alternative was used and why
37
+
38
+ **Example:** Primary CLI tool fails → fall back to direct API call for the same operation.
39
+
40
+ ---
41
+
42
+ ## 3. Diagnose-and-Fix
43
+
44
+ **When:** Build failures, test failures, linting errors — structured errors with actionable output.
45
+
46
+ **Pattern:**
47
+ 1. Read the full error output carefully
48
+ 2. Identify the root cause from error messages
49
+ 3. Attempt a targeted fix
50
+ 4. Re-run to verify the fix
51
+ 5. Maximum 3 fix-retry cycles before escalating
52
+
53
+ **Example:** Build fails with a type error → check for missing import → add it → rebuild.
54
+
55
+ ---
56
+
57
+ ## 4. Escalate with Context
58
+
59
+ **When:** Recovery attempts have been exhausted, or the failure requires human judgment.
60
+
61
+ **Pattern:**
62
+ 1. Summarize what was attempted and what failed
63
+ 2. Include the exact error messages
64
+ 3. State what you believe the root cause is
65
+ 4. Suggest next steps or who might be able to help
66
+ 5. Hand off to the coordinator or the appropriate specialist
67
+
68
+ **Example:** After 3 failed build attempts → "Build fails on line 42 with null reference. Tried X, Y, Z. Likely a design issue in the Foo module. Recommend the code owner review."
69
+
70
+ ---
71
+
72
+ ## 5. Graceful Degradation
73
+
74
+ **When:** A non-critical step fails but the overall task can still deliver value.
75
+
76
+ **Pattern:**
77
+ 1. Determine if the failed step is critical to the task outcome
78
+ 2. If non-critical, log the failure and continue
79
+ 3. Deliver partial results with a clear note of what was skipped
80
+ 4. Offer to retry the skipped step separately
81
+
82
+ **Example:** Generating a report with 5 sections — section 3 data source is unavailable → produce the report with 4 sections, note that section 3 was skipped and why.
83
+
84
+ ---
85
+
86
+ ## Applying These Patterns
87
+
88
+ Each agent should reference these patterns in their charter's `## Error Recovery` section, tailored to their domain. The charter should list the agent's most common failure modes and map each to the appropriate pattern above.
89
+
90
+ **Selection guide:**
91
+
92
+ | Failure Type | Primary Pattern | Fallback Pattern |
93
+ |---|---|---|
94
+ | Network/API transient | Retry with Backoff | Escalate with Context |
95
+ | Tool/dependency missing | Fallback Alternatives | Escalate with Context |
96
+ | Build/test error | Diagnose-and-Fix | Escalate with Context |
97
+ | Auth/permissions | Retry with Backoff | Escalate with Context |
98
+ | Non-critical data missing | Graceful Degradation | — |
99
+ | Unknown/novel error | Escalate with Context | — |
@@ -0,0 +1,165 @@
1
+ ---
2
+ name: "iterative-retrieval"
3
+ description: "Max-3-cycle protocol for agent sub-tasks with WHY context and coordinator validation. Use when spawning sub-agents to complete scoped work."
4
+ domain: "agent-coordination"
5
+ confidence: "high"
6
+ license: MIT
7
+ ---
8
+
9
+ # Iterative Retrieval Skill
10
+
11
+ Squad agents frequently spawn sub-agents to complete scoped work. Without structure, these
12
+ handoffs become vague, cycles multiply, and outputs land without being checked. The
13
+ **Iterative Retrieval Pattern** caps cycles at 3, mandates WHY context in every spawn, and
14
+ requires the coordinator to validate agent output before closing an issue.
15
+
16
+ ---
17
+
18
+ ## Spawn Prompt Template
19
+
20
+ Every agent spawn must include the following four sections. Copy and fill in the template:
21
+
22
+ ```
23
+ ## Task
24
+ {What you need done — concrete and bounded}
25
+
26
+ ## WHY this matters
27
+ {The motivation and context. What system or user goal does this serve? What breaks if skipped?}
28
+
29
+ ## Success criteria
30
+ {How you will know the output is correct. Be explicit — list acceptance criteria, not vibes.}
31
+ Example:
32
+ - [ ] File X exists and contains Y
33
+ - [ ] No regressions in existing tests
34
+ - [ ] PR is open targeting main with description matching the issue
35
+
36
+ ## Escalation path
37
+ {What the agent should do if uncertain or stuck. "Stop and ask me" is valid.}
38
+ Example:
39
+ - If requirements are ambiguous → stop, comment on the issue, set label status:needs-decision
40
+ - If blocked by a dependency → label status:blocked, explain in a comment
41
+ - If 3 cycles exhausted without resolution → write a summary to inbox and surface to coordinator
42
+ ```
43
+
44
+ ---
45
+
46
+ ## 3-Cycle Protocol
47
+
48
+ | Cycle | Description | Exit condition |
49
+ |-------|-------------|----------------|
50
+ | **1** | Initial attempt | Done → coordinator validates. Incomplete → surface delta. |
51
+ | **2** | Targeted retry with specific corrections | Done → coordinator validates. Incomplete → one more. |
52
+ | **3** | Final attempt with all context from cycles 1–2 | Done or escalate — no cycle 4. |
53
+
54
+ ### Rules
55
+
56
+ 1. **After each cycle**, the coordinator evaluates the output against the success criteria
57
+ before accepting it or spawning the next cycle.
58
+ 2. **Objective context forward**: each subsequent spawn includes a summary of what was tried
59
+ and what is still missing — not just a repeat of the original task.
60
+ 3. **Cycle 3 exhausted** → escalate: write a summary to `.squad/decisions/inbox/`, label the
61
+ issue `status:needs-decision`, and notify the user.
62
+
63
+ ---
64
+
65
+ ## Coordinator Validation Checklist
66
+
67
+ Before accepting agent output and closing an issue, the coordinator must check:
68
+
69
+ - [ ] All success criteria from the spawn prompt are met
70
+ - [ ] PR exists and description matches the issue (if code work)
71
+ - [ ] No obvious regressions (grep for TODO/FIXME introduced, build passes)
72
+ - [ ] Agent did not silently skip parts of the task
73
+ - [ ] If the agent reported uncertainty — was it resolved or escalated?
74
+
75
+ If any item fails → do **not** accept. Spawn cycle N+1 (up to cycle 3) with specific deltas.
76
+
77
+ ---
78
+
79
+ ## When to Escalate vs Retry
80
+
81
+ **Retry (cycle N+1)** when:
82
+ - Output is structurally correct but missing specific items
83
+ - Agent misunderstood scope (provide more context and re-run)
84
+ - Partial success — clearly identified remaining delta
85
+
86
+ **Escalate** when:
87
+ - Requirements are fundamentally unclear (decision needed)
88
+ - 3 cycles complete without convergence
89
+ - Agent returned conflicting results across cycles
90
+ - Task requires elevated permissions or external action
91
+ - The work depends on another issue that isn't done yet
92
+
93
+ ---
94
+
95
+ ## Issue Dedup Check (Mandatory)
96
+
97
+ Before any agent creates a GitHub issue, it **must** search for existing open issues to avoid
98
+ duplicates.
99
+
100
+ ```bash
101
+ # Check for existing open issues before creating a new one
102
+ gh issue list --search "<keywords from your issue title>" --state open
103
+ ```
104
+
105
+ - If an open issue already covers the same problem → **comment on it** instead of creating a new one.
106
+ - If no duplicate → proceed to create the issue.
107
+ - Use 2–3 representative keywords from the planned issue title as the search query.
108
+
109
+ ---
110
+
111
+ ## Mandatory Output Requirement (Research-Then-Execute)
112
+
113
+ Every research or analysis task completed under this protocol **MUST** end with at least one
114
+ concrete action before the cycle is closed. Acceptable follow-up actions:
115
+
116
+ - GitHub issue created documenting the findings and next steps
117
+ - PR opened implementing a recommendation
118
+ - Decision recorded in `.squad/decisions/inbox/`
119
+ - Documented recommendation with a named assignee and due date
120
+
121
+ **Pure analysis reports without actionable follow-up will be rejected during triage.**
122
+ If no action is warranted, the agent must explicitly state why and get coordinator sign-off.
123
+
124
+ ---
125
+
126
+ ## Anti-Patterns
127
+
128
+ - **Spawning without WHY** — agents can't prioritise trade-offs without motivation context.
129
+ - **Accepting output without validating** — one failed check avoids merging broken work.
130
+ - **Cycle 4+** — if 3 cycles haven't converged, the problem is in the requirements, not the agent.
131
+ - **Vague success criteria** — "looks good" is not a criterion. Use checkboxes.
132
+ - **Forwarding WHAT without delta** — cycle 2+ prompts must include what cycle 1 got wrong.
133
+ - **Creating issues without dedup check** — always search before creating.
134
+ - **Research without action** — delivering analysis with no issue, PR, decision, or assignee is incomplete work.
135
+
136
+ ---
137
+
138
+ ## Examples
139
+
140
+ ### Good spawn prompt
141
+ ```
142
+ ## Task
143
+ Add an "Iterative Retrieval Protocol" section to `.squad/agents/coordinator/charter.md` explaining
144
+ the 3-cycle rule, WHY format, and validation checklist.
145
+
146
+ ## WHY this matters
147
+ The coordinator spawns sub-agents on every round. Without a documented protocol, agents run unbounded
148
+ cycles and outputs go unvalidated — leading to stale issues and silent failures.
149
+
150
+ ## Success criteria
151
+ - [ ] Section "Iterative Retrieval Protocol" exists in charter.md
152
+ - [ ] Section documents max-3-cycles rule
153
+ - [ ] Section documents WHY format requirement
154
+ - [ ] Section contains validation checklist (at least 4 items)
155
+ - [ ] No other sections of charter.md are modified
156
+
157
+ ## Escalation path
158
+ If the charter.md format is unclear, check another agent charter as a reference.
159
+ If uncertain about content, stop and surface to coordinator.
160
+ ```
161
+
162
+ ### Bad spawn prompt (don't do this)
163
+ ```
164
+ Update the coordinator charter with the iterative retrieval stuff.
165
+ ```