@bradygaster/squad-sdk 0.9.1 → 0.9.2-insider.2

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 (285) hide show
  1. package/README.md +340 -296
  2. package/dist/agents/history-shadow.d.ts +7 -5
  3. package/dist/agents/history-shadow.d.ts.map +1 -1
  4. package/dist/agents/history-shadow.js +69 -78
  5. package/dist/agents/history-shadow.js.map +1 -1
  6. package/dist/agents/index.d.ts +12 -1
  7. package/dist/agents/index.d.ts.map +1 -1
  8. package/dist/agents/index.js +62 -9
  9. package/dist/agents/index.js.map +1 -1
  10. package/dist/agents/lifecycle.d.ts +4 -0
  11. package/dist/agents/lifecycle.d.ts.map +1 -1
  12. package/dist/agents/lifecycle.js +6 -7
  13. package/dist/agents/lifecycle.js.map +1 -1
  14. package/dist/agents/onboarding.d.ts +4 -2
  15. package/dist/agents/onboarding.d.ts.map +1 -1
  16. package/dist/agents/onboarding.js +26 -16
  17. package/dist/agents/onboarding.js.map +1 -1
  18. package/dist/agents/personal.d.ts +2 -1
  19. package/dist/agents/personal.d.ts.map +1 -1
  20. package/dist/agents/personal.js +11 -12
  21. package/dist/agents/personal.js.map +1 -1
  22. package/dist/build/bundle.d.ts.map +1 -1
  23. package/dist/build/bundle.js +6 -6
  24. package/dist/build/bundle.js.map +1 -1
  25. package/dist/build/github-dist.js +42 -42
  26. package/dist/build/release.d.ts.map +1 -1
  27. package/dist/build/release.js +7 -5
  28. package/dist/build/release.js.map +1 -1
  29. package/dist/casting/index.d.ts.map +1 -1
  30. package/dist/casting/index.js +4 -3
  31. package/dist/casting/index.js.map +1 -1
  32. package/dist/config/agent-source.d.ts +5 -1
  33. package/dist/config/agent-source.d.ts.map +1 -1
  34. package/dist/config/agent-source.js +85 -41
  35. package/dist/config/agent-source.js.map +1 -1
  36. package/dist/config/init.d.ts +4 -3
  37. package/dist/config/init.d.ts.map +1 -1
  38. package/dist/config/init.js +257 -236
  39. package/dist/config/init.js.map +1 -1
  40. package/dist/config/legacy-fallback.d.ts +3 -2
  41. package/dist/config/legacy-fallback.d.ts.map +1 -1
  42. package/dist/config/legacy-fallback.js +16 -14
  43. package/dist/config/legacy-fallback.js.map +1 -1
  44. package/dist/config/models.d.ts +9 -6
  45. package/dist/config/models.d.ts.map +1 -1
  46. package/dist/config/models.js +35 -25
  47. package/dist/config/models.js.map +1 -1
  48. package/dist/index.d.ts +5 -1
  49. package/dist/index.d.ts.map +1 -1
  50. package/dist/index.js +14 -1
  51. package/dist/index.js.map +1 -1
  52. package/dist/marketplace/packaging.d.ts.map +1 -1
  53. package/dist/marketplace/packaging.js +18 -16
  54. package/dist/marketplace/packaging.js.map +1 -1
  55. package/dist/multi-squad.d.ts.map +1 -1
  56. package/dist/multi-squad.js +10 -9
  57. package/dist/multi-squad.js.map +1 -1
  58. package/dist/platform/comms-file-log.d.ts.map +1 -1
  59. package/dist/platform/comms-file-log.js +7 -6
  60. package/dist/platform/comms-file-log.js.map +1 -1
  61. package/dist/platform/comms.d.ts.map +1 -1
  62. package/dist/platform/comms.js +6 -5
  63. package/dist/platform/comms.js.map +1 -1
  64. package/dist/platform/index.d.ts.map +1 -1
  65. package/dist/platform/index.js +4 -3
  66. package/dist/platform/index.js.map +1 -1
  67. package/dist/ralph/capabilities.d.ts +30 -1
  68. package/dist/ralph/capabilities.d.ts.map +1 -1
  69. package/dist/ralph/capabilities.js +51 -6
  70. package/dist/ralph/capabilities.js.map +1 -1
  71. package/dist/ralph/index.d.ts +1 -1
  72. package/dist/ralph/index.d.ts.map +1 -1
  73. package/dist/ralph/index.js +4 -3
  74. package/dist/ralph/index.js.map +1 -1
  75. package/dist/ralph/rate-limiting.d.ts.map +1 -1
  76. package/dist/ralph/rate-limiting.js +4 -4
  77. package/dist/ralph/rate-limiting.js.map +1 -1
  78. package/dist/remote/bridge.d.ts.map +1 -1
  79. package/dist/remote/bridge.js +2 -2
  80. package/dist/remote/bridge.js.map +1 -1
  81. package/dist/resolution.d.ts +9 -0
  82. package/dist/resolution.d.ts.map +1 -1
  83. package/dist/resolution.js +39 -16
  84. package/dist/resolution.js.map +1 -1
  85. package/dist/roles/catalog.d.ts +1 -1
  86. package/dist/runtime/config.d.ts.map +1 -1
  87. package/dist/runtime/config.js +8 -7
  88. package/dist/runtime/config.js.map +1 -1
  89. package/dist/runtime/cross-squad.d.ts.map +1 -1
  90. package/dist/runtime/cross-squad.js +8 -7
  91. package/dist/runtime/cross-squad.js.map +1 -1
  92. package/dist/runtime/scheduler.d.ts.map +1 -1
  93. package/dist/runtime/scheduler.js +8 -8
  94. package/dist/runtime/scheduler.js.map +1 -1
  95. package/dist/runtime/squad-observer.d.ts.map +1 -1
  96. package/dist/runtime/squad-observer.js +7 -4
  97. package/dist/runtime/squad-observer.js.map +1 -1
  98. package/dist/sharing/consult.d.ts +1 -1
  99. package/dist/sharing/consult.d.ts.map +1 -1
  100. package/dist/sharing/consult.js +144 -142
  101. package/dist/sharing/consult.js.map +1 -1
  102. package/dist/sharing/export.d.ts.map +1 -1
  103. package/dist/sharing/export.js +16 -16
  104. package/dist/sharing/export.js.map +1 -1
  105. package/dist/sharing/import.d.ts.map +1 -1
  106. package/dist/sharing/import.js +13 -12
  107. package/dist/sharing/import.js.map +1 -1
  108. package/dist/skills/skill-loader.d.ts.map +1 -1
  109. package/dist/skills/skill-loader.js +10 -9
  110. package/dist/skills/skill-loader.js.map +1 -1
  111. package/dist/skills/skill-script-loader.d.ts.map +1 -1
  112. package/dist/skills/skill-script-loader.js +6 -4
  113. package/dist/skills/skill-script-loader.js.map +1 -1
  114. package/dist/skills/skill-source.d.ts +3 -1
  115. package/dist/skills/skill-source.d.ts.map +1 -1
  116. package/dist/skills/skill-source.js +18 -16
  117. package/dist/skills/skill-source.js.map +1 -1
  118. package/dist/state/collection-map.d.ts +43 -0
  119. package/dist/state/collection-map.d.ts.map +1 -0
  120. package/dist/state/collection-map.js +9 -0
  121. package/dist/state/collection-map.js.map +1 -0
  122. package/dist/state/collections.d.ts +102 -0
  123. package/dist/state/collections.d.ts.map +1 -0
  124. package/dist/state/collections.js +317 -0
  125. package/dist/state/collections.js.map +1 -0
  126. package/dist/state/domain-types.d.ts +122 -0
  127. package/dist/state/domain-types.d.ts.map +1 -0
  128. package/dist/state/domain-types.js +54 -0
  129. package/dist/state/domain-types.js.map +1 -0
  130. package/dist/state/handles.d.ts +16 -0
  131. package/dist/state/handles.d.ts.map +1 -0
  132. package/dist/state/handles.js +161 -0
  133. package/dist/state/handles.js.map +1 -0
  134. package/dist/state/index.d.ts +17 -0
  135. package/dist/state/index.d.ts.map +1 -0
  136. package/dist/state/index.js +15 -0
  137. package/dist/state/index.js.map +1 -0
  138. package/dist/state/io/charter-io.d.ts +28 -0
  139. package/dist/state/io/charter-io.d.ts.map +1 -0
  140. package/dist/state/io/charter-io.js +94 -0
  141. package/dist/state/io/charter-io.js.map +1 -0
  142. package/dist/state/io/decisions-io.d.ts +42 -0
  143. package/dist/state/io/decisions-io.d.ts.map +1 -0
  144. package/dist/state/io/decisions-io.js +66 -0
  145. package/dist/state/io/decisions-io.js.map +1 -0
  146. package/dist/state/io/history-io.d.ts +37 -0
  147. package/dist/state/io/history-io.d.ts.map +1 -0
  148. package/dist/state/io/history-io.js +102 -0
  149. package/dist/state/io/history-io.js.map +1 -0
  150. package/dist/state/io/index.d.ts +19 -0
  151. package/dist/state/io/index.d.ts.map +1 -0
  152. package/dist/state/io/index.js +19 -0
  153. package/dist/state/io/index.js.map +1 -0
  154. package/dist/state/io/routing-io.d.ts +37 -0
  155. package/dist/state/io/routing-io.d.ts.map +1 -0
  156. package/dist/state/io/routing-io.js +99 -0
  157. package/dist/state/io/routing-io.js.map +1 -0
  158. package/dist/state/io/team-io.d.ts +46 -0
  159. package/dist/state/io/team-io.d.ts.map +1 -0
  160. package/dist/state/io/team-io.js +82 -0
  161. package/dist/state/io/team-io.js.map +1 -0
  162. package/dist/state/schema.d.ts +24 -0
  163. package/dist/state/schema.d.ts.map +1 -0
  164. package/dist/state/schema.js +41 -0
  165. package/dist/state/schema.js.map +1 -0
  166. package/dist/state/squad-state.d.ts +42 -0
  167. package/dist/state/squad-state.d.ts.map +1 -0
  168. package/dist/state/squad-state.js +68 -0
  169. package/dist/state/squad-state.js.map +1 -0
  170. package/dist/storage/fs-storage-provider.d.ts +60 -0
  171. package/dist/storage/fs-storage-provider.d.ts.map +1 -0
  172. package/dist/storage/fs-storage-provider.js +377 -0
  173. package/dist/storage/fs-storage-provider.js.map +1 -0
  174. package/dist/storage/in-memory-storage-provider.d.ts +46 -0
  175. package/dist/storage/in-memory-storage-provider.d.ts.map +1 -0
  176. package/dist/storage/in-memory-storage-provider.js +264 -0
  177. package/dist/storage/in-memory-storage-provider.js.map +1 -0
  178. package/dist/storage/index.d.ts +6 -0
  179. package/dist/storage/index.d.ts.map +1 -0
  180. package/dist/storage/index.js +5 -0
  181. package/dist/storage/index.js.map +1 -0
  182. package/dist/storage/sqlite-storage-provider.d.ts +95 -0
  183. package/dist/storage/sqlite-storage-provider.d.ts.map +1 -0
  184. package/dist/storage/sqlite-storage-provider.js +383 -0
  185. package/dist/storage/sqlite-storage-provider.js.map +1 -0
  186. package/dist/storage/storage-error.d.ts +28 -0
  187. package/dist/storage/storage-error.d.ts.map +1 -0
  188. package/dist/storage/storage-error.js +35 -0
  189. package/dist/storage/storage-error.js.map +1 -0
  190. package/dist/storage/storage-provider.d.ts +161 -0
  191. package/dist/storage/storage-provider.d.ts.map +1 -0
  192. package/dist/storage/storage-provider.js +18 -0
  193. package/dist/storage/storage-provider.js.map +1 -0
  194. package/dist/streams/resolver.d.ts.map +1 -1
  195. package/dist/streams/resolver.js +6 -5
  196. package/dist/streams/resolver.js.map +1 -1
  197. package/dist/tools/index.d.ts +5 -1
  198. package/dist/tools/index.d.ts.map +1 -1
  199. package/dist/tools/index.js +54 -15
  200. package/dist/tools/index.js.map +1 -1
  201. package/dist/upstream/resolver.d.ts +3 -2
  202. package/dist/upstream/resolver.d.ts.map +1 -1
  203. package/dist/upstream/resolver.js +33 -32
  204. package/dist/upstream/resolver.js.map +1 -1
  205. package/package.json +33 -1
  206. package/templates/casting/Futurama.json +9 -9
  207. package/templates/casting-history.json +4 -4
  208. package/templates/casting-policy.json +37 -37
  209. package/templates/casting-reference.md +104 -104
  210. package/templates/casting-registry.json +3 -3
  211. package/templates/ceremonies.md +41 -41
  212. package/templates/charter.md +53 -53
  213. package/templates/constraint-tracking.md +38 -38
  214. package/templates/cooperative-rate-limiting.md +229 -229
  215. package/templates/copilot-instructions.md +46 -46
  216. package/templates/history.md +10 -10
  217. package/templates/identity/now.md +9 -9
  218. package/templates/identity/wisdom.md +15 -15
  219. package/templates/issue-lifecycle.md +412 -412
  220. package/templates/keda-scaler.md +164 -164
  221. package/templates/machine-capabilities.md +74 -74
  222. package/templates/mcp-config.md +90 -90
  223. package/templates/multi-agent-format.md +28 -28
  224. package/templates/plugin-marketplace.md +49 -49
  225. package/templates/ralph-circuit-breaker.md +313 -313
  226. package/templates/raw-agent-output.md +37 -37
  227. package/templates/roster.md +60 -60
  228. package/templates/routing.md +39 -39
  229. package/templates/run-output.md +50 -50
  230. package/templates/schedule.json +19 -19
  231. package/templates/scribe-charter.md +123 -119
  232. package/templates/skill.md +24 -24
  233. package/templates/skills/agent-collaboration/SKILL.md +42 -42
  234. package/templates/skills/agent-conduct/SKILL.md +24 -24
  235. package/templates/skills/architectural-proposals/SKILL.md +151 -151
  236. package/templates/skills/ci-validation-gates/SKILL.md +84 -84
  237. package/templates/skills/cli-wiring/SKILL.md +47 -47
  238. package/templates/skills/client-compatibility/SKILL.md +89 -89
  239. package/templates/skills/cross-machine-coordination/SKILL.md +434 -0
  240. package/templates/skills/cross-squad/SKILL.md +114 -114
  241. package/templates/skills/distributed-mesh/SKILL.md +287 -287
  242. package/templates/skills/distributed-mesh/mesh.json.example +30 -30
  243. package/templates/skills/distributed-mesh/sync-mesh.ps1 +111 -111
  244. package/templates/skills/distributed-mesh/sync-mesh.sh +104 -104
  245. package/templates/skills/docs-standards/SKILL.md +71 -71
  246. package/templates/skills/economy-mode/SKILL.md +114 -114
  247. package/templates/skills/error-recovery/SKILL.md +99 -0
  248. package/templates/skills/external-comms/SKILL.md +329 -329
  249. package/templates/skills/gh-auth-isolation/SKILL.md +183 -183
  250. package/templates/skills/git-workflow/SKILL.md +204 -204
  251. package/templates/skills/github-multi-account/SKILL.md +95 -95
  252. package/templates/skills/history-hygiene/SKILL.md +36 -36
  253. package/templates/skills/humanizer/SKILL.md +105 -105
  254. package/templates/skills/init-mode/SKILL.md +102 -102
  255. package/templates/skills/iterative-retrieval/SKILL.md +165 -0
  256. package/templates/skills/model-selection/SKILL.md +117 -117
  257. package/templates/skills/nap/SKILL.md +24 -24
  258. package/templates/skills/notification-routing/SKILL.md +105 -0
  259. package/templates/skills/personal-squad/SKILL.md +57 -57
  260. package/templates/skills/pr-screenshots/SKILL.md +149 -0
  261. package/templates/skills/project-conventions/SKILL.md +56 -56
  262. package/templates/skills/ralph-two-pass-scan/SKILL.md +35 -0
  263. package/templates/skills/reflect/SKILL.md +229 -0
  264. package/templates/skills/release-process/SKILL.md +131 -423
  265. package/templates/skills/reskill/SKILL.md +92 -92
  266. package/templates/skills/retro-enforcement/SKILL.md +148 -0
  267. package/templates/skills/reviewer-protocol/SKILL.md +79 -79
  268. package/templates/skills/secret-handling/SKILL.md +200 -200
  269. package/templates/skills/session-recovery/SKILL.md +155 -155
  270. package/templates/skills/squad-conventions/SKILL.md +69 -69
  271. package/templates/skills/test-discipline/SKILL.md +37 -37
  272. package/templates/skills/tiered-memory/SKILL.md +234 -0
  273. package/templates/skills/windows-compatibility/SKILL.md +98 -74
  274. package/templates/{squad.agent.md → squad.agent.md.template} +57 -28
  275. package/templates/workflows/squad-ci.yml +24 -24
  276. package/templates/workflows/squad-docs.yml +54 -54
  277. package/templates/workflows/squad-heartbeat.yml +167 -171
  278. package/templates/workflows/squad-insider-release.yml +61 -61
  279. package/templates/workflows/squad-issue-assign.yml +161 -161
  280. package/templates/workflows/squad-label-enforce.yml +181 -181
  281. package/templates/workflows/squad-preview.yml +55 -55
  282. package/templates/workflows/squad-promote.yml +120 -120
  283. package/templates/workflows/squad-release.yml +77 -77
  284. package/templates/workflows/squad-triage.yml +260 -260
  285. package/templates/workflows/sync-squad-labels.yml +169 -169
@@ -1,89 +1,89 @@
1
- ---
2
- name: "client-compatibility"
3
- description: "Platform detection and adaptive spawning for CLI vs VS Code vs other surfaces"
4
- domain: "orchestration"
5
- confidence: "high"
6
- source: "extracted"
7
- ---
8
-
9
- ## Context
10
-
11
- Squad runs on multiple Copilot surfaces (CLI, VS Code, JetBrains, GitHub.com). The coordinator must detect its platform and adapt spawning behavior accordingly. Different tools are available on different platforms, requiring conditional logic for agent spawning, SQL usage, and response timing.
12
-
13
- ## Patterns
14
-
15
- ### Platform Detection
16
-
17
- Before spawning agents, determine the platform by checking available tools:
18
-
19
- 1. **CLI mode** — `task` tool is available → full spawning control. Use `task` with `agent_type`, `mode`, `model`, `description`, `prompt` parameters. Collect results via `read_agent`.
20
-
21
- 2. **VS Code mode** — `runSubagent` or `agent` tool is available → conditional behavior. Use `runSubagent` with the task prompt. Drop `agent_type`, `mode`, and `model` parameters. Multiple subagents in one turn run concurrently (equivalent to background mode). Results return automatically — no `read_agent` needed.
22
-
23
- 3. **Fallback mode** — neither `task` nor `runSubagent`/`agent` available → work inline. Do not apologize or explain the limitation. Execute the task directly.
24
-
25
- If both `task` and `runSubagent` are available, prefer `task` (richer parameter surface).
26
-
27
- ### VS Code Spawn Adaptations
28
-
29
- When in VS Code mode, the coordinator changes behavior in these ways:
30
-
31
- - **Spawning tool:** Use `runSubagent` instead of `task`. The prompt is the only required parameter — pass the full agent prompt (charter, identity, task, hygiene, response order) exactly as you would on CLI.
32
- - **Parallelism:** Spawn ALL concurrent agents in a SINGLE turn. They run in parallel automatically. This replaces `mode: "background"` + `read_agent` polling.
33
- - **Model selection:** Accept the session model. Do NOT attempt per-spawn model selection or fallback chains — they only work on CLI. In Phase 1, all subagents use whatever model the user selected in VS Code's model picker.
34
- - **Scribe:** Cannot fire-and-forget. Batch Scribe as the LAST subagent in any parallel group. Scribe is light work (file ops only), so the blocking is tolerable.
35
- - **Launch table:** Skip it. Results arrive with the response, not separately. By the time the coordinator speaks, the work is already done.
36
- - **`read_agent`:** Skip entirely. Results return automatically when subagents complete.
37
- - **`agent_type`:** Drop it. All VS Code subagents have full tool access by default. Subagents inherit the parent's tools.
38
- - **`description`:** Drop it. The agent name is already in the prompt.
39
- - **Prompt content:** Keep ALL prompt structure — charter, identity, task, hygiene, response order blocks are surface-independent.
40
-
41
- ### Feature Degradation Table
42
-
43
- | Feature | CLI | VS Code | Degradation |
44
- |---------|-----|---------|-------------|
45
- | Parallel fan-out | `mode: "background"` + `read_agent` | Multiple subagents in one turn | None — equivalent concurrency |
46
- | Model selection | Per-spawn `model` param (4-layer hierarchy) | Session model only (Phase 1) | Accept session model, log intent |
47
- | Scribe fire-and-forget | Background, never read | Sync, must wait | Batch with last parallel group |
48
- | Launch table UX | Show table → results later | Skip table → results with response | UX only — results are correct |
49
- | SQL tool | Available | Not available | Avoid SQL in cross-platform code paths |
50
- | Response order bug | Critical workaround | Possibly necessary (unverified) | Keep the block — harmless if unnecessary |
51
-
52
- ### SQL Tool Caveat
53
-
54
- The `sql` tool is **CLI-only**. It does not exist on VS Code, JetBrains, or GitHub.com. Any coordinator logic or agent workflow that depends on SQL (todo tracking, batch processing, session state) will silently fail on non-CLI surfaces. Cross-platform code paths must not depend on SQL. Use filesystem-based state (`.squad/` files) for anything that must work everywhere.
55
-
56
- ## Examples
57
-
58
- **Example 1: CLI parallel spawn**
59
- ```typescript
60
- // Coordinator detects task tool available → CLI mode
61
- task({ agent_type: "general-purpose", mode: "background", model: "claude-sonnet-4.5", ... })
62
- task({ agent_type: "general-purpose", mode: "background", model: "claude-haiku-4.5", ... })
63
- // Later: read_agent for both
64
- ```
65
-
66
- **Example 2: VS Code parallel spawn**
67
- ```typescript
68
- // Coordinator detects runSubagent available → VS Code mode
69
- runSubagent({ prompt: "...Fenster charter + task..." })
70
- runSubagent({ prompt: "...Hockney charter + task..." })
71
- runSubagent({ prompt: "...Scribe charter + task..." }) // Last in group
72
- // Results return automatically, no read_agent
73
- ```
74
-
75
- **Example 3: Fallback mode**
76
- ```typescript
77
- // Neither task nor runSubagent available → work inline
78
- // Coordinator executes the task directly without spawning
79
- ```
80
-
81
- ## Anti-Patterns
82
-
83
- - ❌ Using SQL tool in cross-platform workflows (breaks on VS Code/JetBrains/GitHub.com)
84
- - ❌ Attempting per-spawn model selection on VS Code (Phase 1 — only session model works)
85
- - ❌ Fire-and-forget Scribe on VS Code (must batch as last subagent)
86
- - ❌ Showing launch table on VS Code (results already inline)
87
- - ❌ Apologizing or explaining platform limitations to the user
88
- - ❌ Using `task` when only `runSubagent` is available
89
- - ❌ Dropping prompt structure (charter/identity/task) on non-CLI platforms
1
+ ---
2
+ name: "client-compatibility"
3
+ description: "Platform detection and adaptive spawning for CLI vs VS Code vs other surfaces"
4
+ domain: "orchestration"
5
+ confidence: "high"
6
+ source: "extracted"
7
+ ---
8
+
9
+ ## Context
10
+
11
+ Squad runs on multiple Copilot surfaces (CLI, VS Code, JetBrains, GitHub.com). The coordinator must detect its platform and adapt spawning behavior accordingly. Different tools are available on different platforms, requiring conditional logic for agent spawning, SQL usage, and response timing.
12
+
13
+ ## Patterns
14
+
15
+ ### Platform Detection
16
+
17
+ Before spawning agents, determine the platform by checking available tools:
18
+
19
+ 1. **CLI mode** — `task` tool is available → full spawning control. Use `task` with `agent_type`, `mode`, `model`, `description`, `prompt` parameters. Collect results via `read_agent`.
20
+
21
+ 2. **VS Code mode** — `runSubagent` or `agent` tool is available → conditional behavior. Use `runSubagent` with the task prompt. Drop `agent_type`, `mode`, and `model` parameters. Multiple subagents in one turn run concurrently (equivalent to background mode). Results return automatically — no `read_agent` needed.
22
+
23
+ 3. **Fallback mode** — neither `task` nor `runSubagent`/`agent` available → work inline. Do not apologize or explain the limitation. Execute the task directly.
24
+
25
+ If both `task` and `runSubagent` are available, prefer `task` (richer parameter surface).
26
+
27
+ ### VS Code Spawn Adaptations
28
+
29
+ When in VS Code mode, the coordinator changes behavior in these ways:
30
+
31
+ - **Spawning tool:** Use `runSubagent` instead of `task`. The prompt is the only required parameter — pass the full agent prompt (charter, identity, task, hygiene, response order) exactly as you would on CLI.
32
+ - **Parallelism:** Spawn ALL concurrent agents in a SINGLE turn. They run in parallel automatically. This replaces `mode: "background"` + `read_agent` polling.
33
+ - **Model selection:** Accept the session model. Do NOT attempt per-spawn model selection or fallback chains — they only work on CLI. In Phase 1, all subagents use whatever model the user selected in VS Code's model picker.
34
+ - **Scribe:** Cannot fire-and-forget. Batch Scribe as the LAST subagent in any parallel group. Scribe is light work (file ops only), so the blocking is tolerable.
35
+ - **Launch table:** Skip it. Results arrive with the response, not separately. By the time the coordinator speaks, the work is already done.
36
+ - **`read_agent`:** Skip entirely. Results return automatically when subagents complete.
37
+ - **`agent_type`:** Drop it. All VS Code subagents have full tool access by default. Subagents inherit the parent's tools.
38
+ - **`description`:** Drop it. The agent name is already in the prompt.
39
+ - **Prompt content:** Keep ALL prompt structure — charter, identity, task, hygiene, response order blocks are surface-independent.
40
+
41
+ ### Feature Degradation Table
42
+
43
+ | Feature | CLI | VS Code | Degradation |
44
+ |---------|-----|---------|-------------|
45
+ | Parallel fan-out | `mode: "background"` + `read_agent` | Multiple subagents in one turn | None — equivalent concurrency |
46
+ | Model selection | Per-spawn `model` param (4-layer hierarchy) | Session model only (Phase 1) | Accept session model, log intent |
47
+ | Scribe fire-and-forget | Background, never read | Sync, must wait | Batch with last parallel group |
48
+ | Launch table UX | Show table → results later | Skip table → results with response | UX only — results are correct |
49
+ | SQL tool | Available | Not available | Avoid SQL in cross-platform code paths |
50
+ | Response order bug | Critical workaround | Possibly necessary (unverified) | Keep the block — harmless if unnecessary |
51
+
52
+ ### SQL Tool Caveat
53
+
54
+ The `sql` tool is **CLI-only**. It does not exist on VS Code, JetBrains, or GitHub.com. Any coordinator logic or agent workflow that depends on SQL (todo tracking, batch processing, session state) will silently fail on non-CLI surfaces. Cross-platform code paths must not depend on SQL. Use filesystem-based state (`.squad/` files) for anything that must work everywhere.
55
+
56
+ ## Examples
57
+
58
+ **Example 1: CLI parallel spawn**
59
+ ```typescript
60
+ // Coordinator detects task tool available → CLI mode
61
+ task({ agent_type: "general-purpose", mode: "background", model: "claude-sonnet-4.5", ... })
62
+ task({ agent_type: "general-purpose", mode: "background", model: "claude-haiku-4.5", ... })
63
+ // Later: read_agent for both
64
+ ```
65
+
66
+ **Example 2: VS Code parallel spawn**
67
+ ```typescript
68
+ // Coordinator detects runSubagent available → VS Code mode
69
+ runSubagent({ prompt: "...Fenster charter + task..." })
70
+ runSubagent({ prompt: "...Hockney charter + task..." })
71
+ runSubagent({ prompt: "...Scribe charter + task..." }) // Last in group
72
+ // Results return automatically, no read_agent
73
+ ```
74
+
75
+ **Example 3: Fallback mode**
76
+ ```typescript
77
+ // Neither task nor runSubagent available → work inline
78
+ // Coordinator executes the task directly without spawning
79
+ ```
80
+
81
+ ## Anti-Patterns
82
+
83
+ - ❌ Using SQL tool in cross-platform workflows (breaks on VS Code/JetBrains/GitHub.com)
84
+ - ❌ Attempting per-spawn model selection on VS Code (Phase 1 — only session model works)
85
+ - ❌ Fire-and-forget Scribe on VS Code (must batch as last subagent)
86
+ - ❌ Showing launch table on VS Code (results already inline)
87
+ - ❌ Apologizing or explaining platform limitations to the user
88
+ - ❌ Using `task` when only `runSubagent` is available
89
+ - ❌ Dropping prompt structure (charter/identity/task) on non-CLI platforms
@@ -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)