@bradygaster/squad-cli 0.8.25 → 0.9.1

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 (199) hide show
  1. package/README.md +329 -77
  2. package/dist/cli/commands/aspire.d.ts.map +1 -1
  3. package/dist/cli/commands/aspire.js +3 -0
  4. package/dist/cli/commands/aspire.js.map +1 -1
  5. package/dist/cli/commands/build.js +3 -3
  6. package/dist/cli/commands/build.js.map +1 -1
  7. package/dist/cli/commands/cast.d.ts +13 -0
  8. package/dist/cli/commands/cast.d.ts.map +1 -0
  9. package/dist/cli/commands/cast.js +77 -0
  10. package/dist/cli/commands/cast.js.map +1 -0
  11. package/dist/cli/commands/cost.d.ts +2 -0
  12. package/dist/cli/commands/cost.d.ts.map +1 -0
  13. package/dist/cli/commands/cost.js +170 -0
  14. package/dist/cli/commands/cost.js.map +1 -0
  15. package/dist/cli/commands/cross-squad.d.ts +12 -0
  16. package/dist/cli/commands/cross-squad.d.ts.map +1 -0
  17. package/dist/cli/commands/cross-squad.js +80 -0
  18. package/dist/cli/commands/cross-squad.js.map +1 -0
  19. package/dist/cli/commands/doctor.d.ts +5 -0
  20. package/dist/cli/commands/doctor.d.ts.map +1 -1
  21. package/dist/cli/commands/doctor.js +156 -0
  22. package/dist/cli/commands/doctor.js.map +1 -1
  23. package/dist/cli/commands/economy.d.ts +10 -0
  24. package/dist/cli/commands/economy.d.ts.map +1 -0
  25. package/dist/cli/commands/economy.js +64 -0
  26. package/dist/cli/commands/economy.js.map +1 -0
  27. package/dist/cli/commands/export.d.ts.map +1 -1
  28. package/dist/cli/commands/export.js +11 -4
  29. package/dist/cli/commands/export.js.map +1 -1
  30. package/dist/cli/commands/import.js +2 -2
  31. package/dist/cli/commands/import.js.map +1 -1
  32. package/dist/cli/commands/personal.d.ts +16 -0
  33. package/dist/cli/commands/personal.d.ts.map +1 -0
  34. package/dist/cli/commands/personal.js +213 -0
  35. package/dist/cli/commands/personal.js.map +1 -0
  36. package/dist/cli/commands/roles.d.ts +2 -0
  37. package/dist/cli/commands/roles.d.ts.map +1 -0
  38. package/dist/cli/commands/roles.js +54 -0
  39. package/dist/cli/commands/roles.js.map +1 -0
  40. package/dist/cli/commands/schedule.d.ts +14 -0
  41. package/dist/cli/commands/schedule.d.ts.map +1 -0
  42. package/dist/cli/commands/schedule.js +208 -0
  43. package/dist/cli/commands/schedule.js.map +1 -0
  44. package/dist/cli/commands/watch.d.ts.map +1 -1
  45. package/dist/cli/commands/watch.js +17 -5
  46. package/dist/cli/commands/watch.js.map +1 -1
  47. package/dist/cli/core/cast.d.ts +9 -0
  48. package/dist/cli/core/cast.d.ts.map +1 -1
  49. package/dist/cli/core/cast.js +170 -60
  50. package/dist/cli/core/cast.js.map +1 -1
  51. package/dist/cli/core/detect-squad-dir.d.ts +10 -0
  52. package/dist/cli/core/detect-squad-dir.d.ts.map +1 -1
  53. package/dist/cli/core/detect-squad-dir.js +47 -0
  54. package/dist/cli/core/detect-squad-dir.js.map +1 -1
  55. package/dist/cli/core/init.d.ts +8 -0
  56. package/dist/cli/core/init.d.ts.map +1 -1
  57. package/dist/cli/core/init.js +115 -2
  58. package/dist/cli/core/init.js.map +1 -1
  59. package/dist/cli/core/migrations.d.ts.map +1 -1
  60. package/dist/cli/core/migrations.js +21 -0
  61. package/dist/cli/core/migrations.js.map +1 -1
  62. package/dist/cli/core/team-md.js +34 -34
  63. package/dist/cli/core/templates.d.ts.map +1 -1
  64. package/dist/cli/core/templates.js +8 -1
  65. package/dist/cli/core/templates.js.map +1 -1
  66. package/dist/cli/core/upgrade.d.ts +14 -0
  67. package/dist/cli/core/upgrade.d.ts.map +1 -1
  68. package/dist/cli/core/upgrade.js +182 -48
  69. package/dist/cli/core/upgrade.js.map +1 -1
  70. package/dist/cli/core/version.js +2 -2
  71. package/dist/cli/core/version.js.map +1 -1
  72. package/dist/cli/index.d.ts +2 -0
  73. package/dist/cli/index.d.ts.map +1 -1
  74. package/dist/cli/index.js +2 -0
  75. package/dist/cli/index.js.map +1 -1
  76. package/dist/cli/self-update.d.ts +21 -0
  77. package/dist/cli/self-update.d.ts.map +1 -0
  78. package/dist/cli/self-update.js +113 -0
  79. package/dist/cli/self-update.js.map +1 -0
  80. package/dist/cli/shell/autocomplete.d.ts.map +1 -1
  81. package/dist/cli/shell/autocomplete.js +5 -0
  82. package/dist/cli/shell/autocomplete.js.map +1 -1
  83. package/dist/cli/shell/commands.d.ts.map +1 -1
  84. package/dist/cli/shell/commands.js +55 -24
  85. package/dist/cli/shell/commands.js.map +1 -1
  86. package/dist/cli/shell/components/AgentPanel.d.ts.map +1 -1
  87. package/dist/cli/shell/components/AgentPanel.js +21 -6
  88. package/dist/cli/shell/components/AgentPanel.js.map +1 -1
  89. package/dist/cli/shell/components/App.d.ts.map +1 -1
  90. package/dist/cli/shell/components/App.js +33 -15
  91. package/dist/cli/shell/components/App.js.map +1 -1
  92. package/dist/cli/shell/components/InputPrompt.js +1 -1
  93. package/dist/cli/shell/components/InputPrompt.js.map +1 -1
  94. package/dist/cli/shell/components/MessageStream.d.ts +2 -0
  95. package/dist/cli/shell/components/MessageStream.d.ts.map +1 -1
  96. package/dist/cli/shell/components/MessageStream.js +20 -20
  97. package/dist/cli/shell/components/MessageStream.js.map +1 -1
  98. package/dist/cli/shell/components/ThinkingIndicator.d.ts +4 -0
  99. package/dist/cli/shell/components/ThinkingIndicator.d.ts.map +1 -1
  100. package/dist/cli/shell/components/ThinkingIndicator.js +23 -4
  101. package/dist/cli/shell/components/ThinkingIndicator.js.map +1 -1
  102. package/dist/cli/shell/coordinator.d.ts +7 -0
  103. package/dist/cli/shell/coordinator.d.ts.map +1 -1
  104. package/dist/cli/shell/coordinator.js +206 -88
  105. package/dist/cli/shell/coordinator.js.map +1 -1
  106. package/dist/cli/shell/error-messages.d.ts +14 -0
  107. package/dist/cli/shell/error-messages.d.ts.map +1 -1
  108. package/dist/cli/shell/error-messages.js +65 -1
  109. package/dist/cli/shell/error-messages.js.map +1 -1
  110. package/dist/cli/shell/index.d.ts +1 -1
  111. package/dist/cli/shell/index.d.ts.map +1 -1
  112. package/dist/cli/shell/index.js +83 -12
  113. package/dist/cli/shell/index.js.map +1 -1
  114. package/dist/cli/shell/router.d.ts.map +1 -1
  115. package/dist/cli/shell/router.js +21 -2
  116. package/dist/cli/shell/router.js.map +1 -1
  117. package/dist/cli/shell/stream-bridge.d.ts +2 -0
  118. package/dist/cli/shell/stream-bridge.d.ts.map +1 -1
  119. package/dist/cli/shell/stream-bridge.js +11 -2
  120. package/dist/cli/shell/stream-bridge.js.map +1 -1
  121. package/dist/cli/shell/terminal.d.ts +5 -5
  122. package/dist/cli/shell/terminal.d.ts.map +1 -1
  123. package/dist/cli/shell/terminal.js +35 -26
  124. package/dist/cli/shell/terminal.js.map +1 -1
  125. package/dist/cli-entry.js +124 -42
  126. package/dist/cli-entry.js.map +1 -1
  127. package/package.json +20 -4
  128. package/scripts/patch-esm-imports.mjs +106 -77
  129. package/scripts/patch-ink-rendering.mjs +115 -0
  130. package/templates/casting/Futurama.json +10 -0
  131. package/templates/casting-history.json +4 -4
  132. package/templates/casting-policy.json +37 -35
  133. package/templates/casting-reference.md +104 -0
  134. package/templates/casting-registry.json +3 -3
  135. package/templates/ceremonies.md +41 -41
  136. package/templates/charter.md +53 -53
  137. package/templates/constraint-tracking.md +38 -38
  138. package/templates/cooperative-rate-limiting.md +229 -0
  139. package/templates/copilot-instructions.md +46 -46
  140. package/templates/history.md +10 -10
  141. package/templates/identity/now.md +9 -9
  142. package/templates/identity/wisdom.md +15 -15
  143. package/templates/issue-lifecycle.md +412 -0
  144. package/templates/keda-scaler.md +164 -0
  145. package/templates/machine-capabilities.md +75 -0
  146. package/templates/mcp-config.md +90 -90
  147. package/templates/multi-agent-format.md +28 -28
  148. package/templates/orchestration-log.md +27 -27
  149. package/templates/plugin-marketplace.md +49 -49
  150. package/templates/ralph-circuit-breaker.md +313 -0
  151. package/templates/raw-agent-output.md +37 -37
  152. package/templates/roster.md +60 -60
  153. package/templates/routing.md +39 -54
  154. package/templates/run-output.md +50 -50
  155. package/templates/scribe-charter.md +119 -119
  156. package/templates/skill.md +24 -24
  157. package/templates/skills/agent-collaboration/SKILL.md +42 -0
  158. package/templates/skills/agent-conduct/SKILL.md +24 -0
  159. package/templates/skills/architectural-proposals/SKILL.md +151 -0
  160. package/templates/skills/ci-validation-gates/SKILL.md +84 -0
  161. package/templates/skills/cli-wiring/SKILL.md +47 -0
  162. package/templates/skills/client-compatibility/SKILL.md +89 -0
  163. package/templates/skills/cross-squad/SKILL.md +114 -0
  164. package/templates/skills/distributed-mesh/SKILL.md +287 -0
  165. package/templates/skills/distributed-mesh/mesh.json.example +30 -0
  166. package/templates/skills/distributed-mesh/sync-mesh.ps1 +111 -0
  167. package/templates/skills/distributed-mesh/sync-mesh.sh +104 -0
  168. package/templates/skills/docs-standards/SKILL.md +71 -0
  169. package/templates/skills/economy-mode/SKILL.md +114 -0
  170. package/templates/skills/external-comms/SKILL.md +329 -0
  171. package/templates/skills/gh-auth-isolation/SKILL.md +183 -0
  172. package/templates/skills/git-workflow/SKILL.md +204 -0
  173. package/templates/skills/github-multi-account/SKILL.md +95 -0
  174. package/templates/skills/history-hygiene/SKILL.md +36 -0
  175. package/templates/skills/humanizer/SKILL.md +105 -0
  176. package/templates/skills/init-mode/SKILL.md +102 -0
  177. package/templates/skills/model-selection/SKILL.md +117 -0
  178. package/templates/skills/nap/SKILL.md +24 -0
  179. package/templates/skills/personal-squad/SKILL.md +57 -0
  180. package/templates/skills/release-process/SKILL.md +423 -0
  181. package/templates/skills/reskill/SKILL.md +92 -0
  182. package/templates/skills/reviewer-protocol/SKILL.md +79 -0
  183. package/templates/skills/secret-handling/SKILL.md +200 -0
  184. package/templates/skills/session-recovery/SKILL.md +155 -0
  185. package/templates/skills/squad-conventions/SKILL.md +69 -69
  186. package/templates/skills/test-discipline/SKILL.md +37 -0
  187. package/templates/skills/windows-compatibility/SKILL.md +74 -0
  188. package/templates/squad.agent.md +1287 -1146
  189. package/templates/workflows/squad-ci.yml +24 -24
  190. package/templates/workflows/squad-docs.yml +54 -50
  191. package/templates/workflows/squad-heartbeat.yml +3 -4
  192. package/templates/workflows/squad-insider-release.yml +61 -61
  193. package/templates/workflows/squad-issue-assign.yml +161 -161
  194. package/templates/workflows/squad-label-enforce.yml +181 -181
  195. package/templates/workflows/squad-preview.yml +55 -55
  196. package/templates/workflows/squad-promote.yml +120 -120
  197. package/templates/workflows/squad-release.yml +77 -77
  198. package/templates/workflows/squad-triage.yml +260 -260
  199. package/templates/workflows/sync-squad-labels.yml +169 -169
@@ -0,0 +1,84 @@
1
+ ---
2
+ name: "ci-validation-gates"
3
+ description: "Defensive CI/CD patterns: semver validation, token checks, retry logic, draft detection — earned from v0.8.22"
4
+ domain: "ci-cd"
5
+ confidence: "high"
6
+ source: "extracted from Drucker and Trejo charters — earned knowledge from v0.8.22 release incident"
7
+ ---
8
+
9
+ ## Context
10
+
11
+ CI workflows must be defensive. These patterns were learned from the v0.8.22 release disaster where invalid semver, wrong token types, missing retry logic, and draft releases caused a multi-hour outage. Both Drucker (CI/CD) and Trejo (Release Manager) carried this knowledge in their charters — now centralized here.
12
+
13
+ ## Patterns
14
+
15
+ ### Semver Validation Gate
16
+ Every publish workflow MUST validate version format before `npm publish`. 4-part versions (e.g., 0.8.21.4) are NOT valid semver — npm mangles them.
17
+
18
+ ```yaml
19
+ - name: Validate semver
20
+ run: |
21
+ VERSION="${{ github.event.release.tag_name }}"
22
+ VERSION="${VERSION#v}"
23
+ if ! npx semver "$VERSION" > /dev/null 2>&1; then
24
+ echo "❌ Invalid semver: $VERSION"
25
+ echo "Only 3-part versions (X.Y.Z) or prerelease (X.Y.Z-tag.N) are valid."
26
+ exit 1
27
+ fi
28
+ echo "✅ Valid semver: $VERSION"
29
+ ```
30
+
31
+ ### NPM Token Type Verification
32
+ NPM_TOKEN MUST be an Automation token, not a User token with 2FA:
33
+ - User tokens require OTP — CI can't provide it → EOTP error
34
+ - Create Automation tokens at npmjs.com → Settings → Access Tokens → Automation
35
+ - Verify before first publish in any workflow
36
+
37
+ ### Retry Logic for npm Registry Propagation
38
+ npm registry uses eventual consistency. After `npm publish` succeeds, the package may not be immediately queryable.
39
+ - Propagation: typically 5-30s, up to 2min in rare cases
40
+ - All verify steps: 5 attempts, 15-second intervals
41
+ - Log each attempt: "Attempt 1/5: Checking package..."
42
+ - Exit loop on success, fail after max attempts
43
+
44
+ ```yaml
45
+ - name: Verify package (with retry)
46
+ run: |
47
+ MAX_ATTEMPTS=5
48
+ WAIT_SECONDS=15
49
+ for attempt in $(seq 1 $MAX_ATTEMPTS); do
50
+ echo "Attempt $attempt/$MAX_ATTEMPTS: Checking $PACKAGE@$VERSION..."
51
+ if npm view "$PACKAGE@$VERSION" version > /dev/null 2>&1; then
52
+ echo "✅ Package verified"
53
+ exit 0
54
+ fi
55
+ [ $attempt -lt $MAX_ATTEMPTS ] && sleep $WAIT_SECONDS
56
+ done
57
+ echo "❌ Failed to verify after $MAX_ATTEMPTS attempts"
58
+ exit 1
59
+ ```
60
+
61
+ ### Draft Release Detection
62
+ Draft releases don't emit `release: published` event. Workflows MUST:
63
+ - Trigger on `release: published` (NOT `created`)
64
+ - If using workflow_dispatch: verify release is published via GitHub API before proceeding
65
+
66
+ ### Build Script Protection
67
+ Set `SKIP_BUILD_BUMP=1` (or `$env:SKIP_BUILD_BUMP = "1"` on Windows) before ANY release build. bump-build.mjs is for dev builds ONLY — it silently mutates versions.
68
+
69
+ ## Known Failure Modes (v0.8.22 Incident)
70
+
71
+ | # | What Happened | Root Cause | Prevention |
72
+ |---|---------------|-----------|------------|
73
+ | 1 | 4-part version published, npm mangled it | No semver validation gate | `npx semver` check before every publish |
74
+ | 2 | CI failed 5+ times with EOTP | User token with 2FA | Automation token only |
75
+ | 3 | Verify returned false 404 | No retry logic for propagation | 5 attempts, 15s intervals |
76
+ | 4 | Workflow never triggered | Draft release doesn't emit event | Never create draft releases |
77
+ | 5 | Version mutated during release | bump-build.mjs ran in release | SKIP_BUILD_BUMP=1 |
78
+
79
+ ## Anti-Patterns
80
+ - ❌ Publishing without semver validation gate
81
+ - ❌ Single-shot verification without retry
82
+ - ❌ Hard-coded secrets in workflows
83
+ - ❌ Silent CI failures — every error needs actionable output with remediation
84
+ - ❌ Assuming npm publish is instantly queryable
@@ -0,0 +1,47 @@
1
+ # Skill: CLI Command Wiring
2
+
3
+ **Bug class:** Commands implemented in `packages/squad-cli/src/cli/commands/` but never routed in `cli-entry.ts`.
4
+
5
+ ## Checklist — Adding a New CLI Command
6
+
7
+ 1. **Create command file** in `packages/squad-cli/src/cli/commands/<name>.ts`
8
+ - Export a `run<Name>(cwd, options)` async function (or class with static methods for utility modules)
9
+
10
+ 2. **Add routing block** in `packages/squad-cli/src/cli-entry.ts` inside `main()`:
11
+ ```ts
12
+ if (cmd === '<name>') {
13
+ const { run<Name> } = await import('./cli/commands/<name>.js');
14
+ // parse args, call function
15
+ await run<Name>(process.cwd(), options);
16
+ return;
17
+ }
18
+ ```
19
+
20
+ 3. **Add help text** in the help section of `cli-entry.ts` (search for `Commands:`):
21
+ ```ts
22
+ console.log(` ${BOLD}<name>${RESET} <description>`);
23
+ console.log(` Usage: <name> [flags]`);
24
+ ```
25
+
26
+ 4. **Verify both exist** — the recurring bug is doing step 1 but missing steps 2-3.
27
+
28
+ ## Wiring Patterns by Command Type
29
+
30
+ | Type | Example | How to wire |
31
+ |------|---------|-------------|
32
+ | Standard command | `export.ts`, `build.ts` | `run*()` function, parse flags from `args` |
33
+ | Placeholder command | `loop`, `hire` | Inline in cli-entry.ts, prints pending message |
34
+ | Utility/check module | `rc-tunnel.ts`, `copilot-bridge.ts` | Wire as diagnostic check (e.g., `isDevtunnelAvailable()`) |
35
+ | Subcommand of another | `init-remote.ts` | Already used inside parent + standalone alias |
36
+
37
+ ## Common Import Pattern
38
+
39
+ ```ts
40
+ import { BOLD, RESET, DIM, RED, GREEN, YELLOW } from './cli/core/output.js';
41
+ ```
42
+
43
+ Use dynamic `await import()` for command modules to keep startup fast (lazy loading).
44
+
45
+ ## History
46
+
47
+ - **#237 / PR #244:** 4 commands wired (rc, copilot-bridge, init-remote, rc-tunnel). aspire, link, loop, hire were already present.
@@ -0,0 +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
@@ -0,0 +1,114 @@
1
+ ---
2
+ name: "cross-squad"
3
+ description: "Coordinating work across multiple Squad instances"
4
+ domain: "orchestration"
5
+ confidence: "medium"
6
+ source: "manual"
7
+ tools:
8
+ - name: "squad-discover"
9
+ description: "List known squads and their capabilities"
10
+ when: "When you need to find which squad can handle a task"
11
+ - name: "squad-delegate"
12
+ description: "Create work in another squad's repository"
13
+ when: "When a task belongs to another squad's domain"
14
+ ---
15
+
16
+ ## Context
17
+ When an organization runs multiple Squad instances (e.g., platform-squad, frontend-squad, data-squad), those squads need to discover each other, share context, and hand off work across repository boundaries. This skill teaches agents how to coordinate across squads without creating tight coupling.
18
+
19
+ Cross-squad orchestration applies when:
20
+ - A task requires capabilities owned by another squad
21
+ - An architectural decision affects multiple squads
22
+ - A feature spans multiple repositories with different squads
23
+ - A squad needs to request infrastructure, tooling, or support from another squad
24
+
25
+ ## Patterns
26
+
27
+ ### Discovery via Manifest
28
+ Each squad publishes a `.squad/manifest.json` declaring its name, capabilities, and contact information. Squads discover each other through:
29
+ 1. **Well-known paths**: Check `.squad/manifest.json` in known org repos
30
+ 2. **Upstream config**: Squads already listed in `.squad/upstream.json` are checked for manifests
31
+ 3. **Explicit registry**: A central `squad-registry.json` can list all squads in an org
32
+
33
+ ```json
34
+ {
35
+ "name": "platform-squad",
36
+ "version": "1.0.0",
37
+ "description": "Platform infrastructure team",
38
+ "capabilities": ["kubernetes", "helm", "monitoring", "ci-cd"],
39
+ "contact": {
40
+ "repo": "org/platform",
41
+ "labels": ["squad:platform"]
42
+ },
43
+ "accepts": ["issues", "prs"],
44
+ "skills": ["helm-developer", "operator-developer", "pipeline-engineer"]
45
+ }
46
+ ```
47
+
48
+ ### Context Sharing
49
+ When delegating work, share only what the target squad needs:
50
+ - **Capability list**: What this squad can do (from manifest)
51
+ - **Relevant decisions**: Only decisions that affect the target squad
52
+ - **Handoff context**: A concise description of why this work is being delegated
53
+
54
+ Do NOT share:
55
+ - Internal team state (casting history, session logs)
56
+ - Full decision archives (send only relevant excerpts)
57
+ - Authentication credentials or secrets
58
+
59
+ ### Work Handoff Protocol
60
+ 1. **Check manifest**: Verify the target squad accepts the work type (issues, PRs)
61
+ 2. **Create issue**: Use `gh issue create` in the target repo with:
62
+ - Title: `[cross-squad] <description>`
63
+ - Label: `squad:cross-squad` (or the squad's configured label)
64
+ - Body: Context, acceptance criteria, and link back to originating issue
65
+ 3. **Track**: Record the cross-squad issue URL in the originating squad's orchestration log
66
+ 4. **Poll**: Periodically check if the delegated issue is closed/completed
67
+
68
+ ### Feedback Loop
69
+ Track delegated work completion:
70
+ - Poll target issue status via `gh issue view`
71
+ - Update originating issue with status changes
72
+ - Close the feedback loop when delegated work merges
73
+
74
+ ## Examples
75
+
76
+ ### Discovering squads
77
+ ```bash
78
+ # List all squads discoverable from upstreams and known repos
79
+ squad discover
80
+
81
+ # Output:
82
+ # platform-squad → org/platform (kubernetes, helm, monitoring)
83
+ # frontend-squad → org/frontend (react, nextjs, storybook)
84
+ # data-squad → org/data (spark, airflow, dbt)
85
+ ```
86
+
87
+ ### Delegating work
88
+ ```bash
89
+ # Delegate a task to the platform squad
90
+ squad delegate platform-squad "Add Prometheus metrics endpoint for the auth service"
91
+
92
+ # Creates issue in org/platform with cross-squad label and context
93
+ ```
94
+
95
+ ### Manifest in squad.config.ts
96
+ ```typescript
97
+ export default defineSquad({
98
+ manifest: {
99
+ name: 'platform-squad',
100
+ capabilities: ['kubernetes', 'helm'],
101
+ contact: { repo: 'org/platform', labels: ['squad:platform'] },
102
+ accepts: ['issues', 'prs'],
103
+ skills: ['helm-developer', 'operator-developer'],
104
+ },
105
+ });
106
+ ```
107
+
108
+ ## Anti-Patterns
109
+ - **Direct file writes across repos** — Never modify another squad's `.squad/` directory. Use issues and PRs as the communication protocol.
110
+ - **Tight coupling** — Don't depend on another squad's internal structure. Use the manifest as the public API contract.
111
+ - **Unbounded delegation** — Always include acceptance criteria and a timeout. Don't create open-ended requests.
112
+ - **Skipping discovery** — Don't hardcode squad locations. Use manifests and the discovery protocol.
113
+ - **Sharing secrets** — Never include credentials, tokens, or internal URLs in cross-squad issues.
114
+ - **Circular delegation** — Track delegation chains. If squad A delegates to B which delegates back to A, something is wrong.
@@ -0,0 +1,287 @@
1
+ ---
2
+ name: "distributed-mesh"
3
+ description: "How to coordinate with squads on different machines using git as transport"
4
+ domain: "distributed-coordination"
5
+ confidence: "high"
6
+ source: "multi-model-consensus (Opus 4.6, Sonnet 4.5, GPT-5.4)"
7
+ ---
8
+
9
+ ## SCOPE
10
+
11
+ **✅ THIS SKILL PRODUCES (exactly these, nothing more):**
12
+
13
+ 1. **`mesh.json`** — Generated from user answers about zones and squads (which squads participate, what zone each is in, paths/URLs for each), using `mesh.json.example` in this skill's directory as the schema template
14
+ 2. **`sync-mesh.sh` and `sync-mesh.ps1`** — Copied from this skill's directory into the project root (these are bundled resources, NOT generated code)
15
+ 3. **Zone 2 state repo initialization** (if applicable) — If the user specified a Zone 2 shared state repo, run `sync-mesh.sh --init` to scaffold the state repo structure
16
+ 4. **A decision entry** in `.squad/decisions/inbox/` documenting the mesh configuration for team awareness
17
+
18
+ **❌ THIS SKILL DOES NOT PRODUCE:**
19
+
20
+ - **No application code** — No validators, libraries, or modules of any kind
21
+ - **No test files** — No test suites, test cases, or test scaffolding
22
+ - **No GENERATING sync scripts** — They are bundled with this skill as pre-built resources. COPY them, don't generate them.
23
+ - **No daemons or services** — No background processes, servers, or persistent runtimes
24
+ - **No modifications to existing squad files** beyond the decision entry (no changes to team.md, routing.md, agent charters, etc.)
25
+
26
+ **Your role:** Configure the mesh topology and install the bundled sync scripts. Nothing more.
27
+
28
+ ## Context
29
+
30
+ When squads are on different machines (developer laptops, CI runners, cloud VMs, partner orgs), the local file-reading convention still works — but remote files need to arrive on your disk first. This skill teaches the pattern for distributed squad communication.
31
+
32
+ **When this applies:**
33
+ - Squads span multiple machines, VMs, or CI runners
34
+ - Squads span organizations or companies
35
+ - An agent needs context from a squad whose files aren't on the local filesystem
36
+
37
+ **When this does NOT apply:**
38
+ - All squads are on the same machine (just read the files directly)
39
+
40
+ ## Patterns
41
+
42
+ ### The Core Principle
43
+
44
+ > "The filesystem is the mesh, and git is how the mesh crosses machine boundaries."
45
+
46
+ The agent interface never changes. Agents always read local files. The distributed layer's only job is to make remote files appear locally before the agent reads them.
47
+
48
+ ### Three Zones of Communication
49
+
50
+ **Zone 1 — Local:** Same filesystem. Read files directly. Zero transport.
51
+
52
+ **Zone 2 — Remote-Trusted:** Different host, same org, shared git auth. Transport: `git pull` from a shared repo. This collapses Zone 2 into Zone 1 — files materialize on disk, agent reads them normally.
53
+
54
+ **Zone 3 — Remote-Opaque:** Different org, no shared auth. Transport: `curl` to fetch published contracts (SUMMARY.md). One-way visibility — you see only what they publish.
55
+
56
+ ### Agent Lifecycle (Distributed)
57
+
58
+ ```
59
+ 1. SYNC: git pull (Zone 2) + curl (Zone 3) — materialize remote state
60
+ 2. READ: cat .mesh/**/state.md — all files are local now
61
+ 3. WORK: do their assigned work (the agent's normal task, NOT mesh-building)
62
+ 4. WRITE: update own billboard, log, drops
63
+ 5. PUBLISH: git add + commit + push — share state with remote peers
64
+ ```
65
+
66
+ Steps 2–4 are identical to local-only. Steps 1 and 5 are the entire distributed extension. **Note:** "WORK" means the agent performs its normal squad duties — it does NOT mean "build mesh infrastructure."
67
+
68
+ ### The mesh.json Config
69
+
70
+ ```json
71
+ {
72
+ "squads": {
73
+ "auth-squad": { "zone": "local", "path": "../auth-squad/.mesh" },
74
+ "ci-squad": {
75
+ "zone": "remote-trusted",
76
+ "source": "git@github.com:our-org/ci-squad.git",
77
+ "ref": "main",
78
+ "sync_to": ".mesh/remotes/ci-squad"
79
+ },
80
+ "partner-fraud": {
81
+ "zone": "remote-opaque",
82
+ "source": "https://partner.dev/squad-contracts/fraud/SUMMARY.md",
83
+ "sync_to": ".mesh/remotes/partner-fraud",
84
+ "auth": "bearer"
85
+ }
86
+ }
87
+ }
88
+ ```
89
+
90
+ Three zone types, one file. Local squads need only a path. Remote-trusted need a git URL. Remote-opaque need an HTTP URL.
91
+
92
+ ### Write Partitioning
93
+
94
+ Each squad writes only to its own directory (`boards/{self}.md`, `squads/{self}/*`, `drops/{date}-{self}-*.md`). No two squads write to the same file. Git push/pull never conflicts. If push fails ("branch is behind"), the fix is always `git pull --rebase && git push`.
95
+
96
+ ### Trust Boundaries
97
+
98
+ Trust maps to git permissions:
99
+ - **Same repo access** = full mesh visibility
100
+ - **Read-only access** = can observe, can't write
101
+ - **No access** = invisible (correct behavior)
102
+
103
+ For selective visibility, use separate repos per audience (internal, partner, public). Git permissions ARE the trust negotiation.
104
+
105
+ ### Phased Rollout
106
+
107
+ - **Phase 0:** Convention only — document zones, agree on mesh.json fields, manually run `git pull`/`git push`. Zero new code.
108
+ - **Phase 1:** Sync script (~30 lines bash or PowerShell) when manual sync gets tedious.
109
+ - **Phase 2:** Published contracts + curl fetch when a Zone 3 partner appears.
110
+ - **Phase 3:** Never. No MCP federation, A2A, service discovery, message queues.
111
+
112
+ **Important:** Phases are NOT auto-advanced. These are project-level decisions — you start at Phase 0 (manual sync) and only move forward when the team decides complexity is justified.
113
+
114
+ ### Mesh State Repo
115
+
116
+ The shared mesh state repo is a plain git repository — NOT a Squad project. It holds:
117
+ - One directory per participating squad
118
+ - Each directory contains at minimum a SUMMARY.md with the squad's current state
119
+ - A root README explaining what the repo is and who participates
120
+
121
+ No `.squad/` folder, no agents, no automation. Write partitioning means each squad only pushes to its own directory. The repo is a rendezvous point, not an intelligent system.
122
+
123
+ If you want a squad that *observes* mesh health, that's a separate Squad project that lists the state repo as a Zone 2 remote in its `mesh.json` — it does NOT live inside the state repo.
124
+
125
+ ## Examples
126
+
127
+ ### Developer Laptop + CI Squad (Zone 2)
128
+
129
+ Auth-squad agent wakes up. `git pull` brings ci-squad's latest results. Agent reads: "3 test failures in auth module." Adjusts work. Pushes results when done. **Overhead: one `git pull`, one `git push`.**
130
+
131
+ ### Two Orgs Collaborating (Zone 3)
132
+
133
+ Payment-squad fetches partner's published SUMMARY.md via curl. Reads: "Risk scoring v3 API deprecated April 15. New field `device_fingerprint` required." The consuming agent (in payment-squad's team) reads this information and uses it to inform its work — for example, updating payment integration code to include the new field. Partner can't see payment-squad's internals.
134
+
135
+ ### Same Org, Shared Mesh Repo (Zone 2)
136
+
137
+ Three squads on different machines. One shared git repo holds the mesh. Each squad: `git pull` before work, `git push` after. Write partitioning ensures zero merge conflicts.
138
+
139
+ ## AGENT WORKFLOW (Deterministic Setup)
140
+
141
+ When a user invokes this skill to set up a distributed mesh, follow these steps **exactly, in order:**
142
+
143
+ ### Step 1: ASK the user for mesh topology
144
+
145
+ Ask these questions (adapt phrasing naturally, but get these answers):
146
+
147
+ 1. **Which squads are participating?** (List of squad names)
148
+ 2. **For each squad, which zone is it in?**
149
+ - `local` — same filesystem (just need a path)
150
+ - `remote-trusted` — different machine, same org, shared git access (need git URL + ref)
151
+ - `remote-opaque` — different org, no shared auth (need HTTPS URL to published contract)
152
+ 3. **For each squad, what's the connection info?**
153
+ - Local: relative or absolute path to their `.mesh/` directory
154
+ - Remote-trusted: git URL (SSH or HTTPS), ref (branch/tag), and where to sync it to locally
155
+ - Remote-opaque: HTTPS URL to their SUMMARY.md, where to sync it, and auth type (none/bearer)
156
+ 4. **Where should the shared state live?** (For Zone 2 squads: git repo URL for the mesh state, or confirm each squad syncs independently)
157
+
158
+ ### Step 2: GENERATE `mesh.json`
159
+
160
+ Using the answers from Step 1, create a `mesh.json` file at the project root. Use `mesh.json.example` from THIS skill's directory (`.squad/skills/distributed-mesh/mesh.json.example`) as the schema template.
161
+
162
+ Structure:
163
+
164
+ ```json
165
+ {
166
+ "squads": {
167
+ "<squad-name>": { "zone": "local", "path": "<relative-or-absolute-path>" },
168
+ "<squad-name>": {
169
+ "zone": "remote-trusted",
170
+ "source": "<git-url>",
171
+ "ref": "<branch-or-tag>",
172
+ "sync_to": ".mesh/remotes/<squad-name>"
173
+ },
174
+ "<squad-name>": {
175
+ "zone": "remote-opaque",
176
+ "source": "<https-url-to-summary>",
177
+ "sync_to": ".mesh/remotes/<squad-name>",
178
+ "auth": "<none|bearer>"
179
+ }
180
+ }
181
+ }
182
+ ```
183
+
184
+ Write this file to the project root. Do NOT write any other code.
185
+
186
+ ### Step 3: COPY sync scripts
187
+
188
+ Copy the bundled sync scripts from THIS skill's directory into the project root:
189
+
190
+ - **Source:** `.squad/skills/distributed-mesh/sync-mesh.sh`
191
+ - **Destination:** `sync-mesh.sh` (project root)
192
+
193
+ - **Source:** `.squad/skills/distributed-mesh/sync-mesh.ps1`
194
+ - **Destination:** `sync-mesh.ps1` (project root)
195
+
196
+ These are bundled resources. Do NOT generate them — COPY them directly.
197
+
198
+ ### Step 4: RUN `--init` (if Zone 2 state repo exists)
199
+
200
+ If the user specified a Zone 2 shared state repo in Step 1, run the initialization:
201
+
202
+ **On Unix/Linux/macOS:**
203
+ ```bash
204
+ bash sync-mesh.sh --init
205
+ ```
206
+
207
+ **On Windows:**
208
+ ```powershell
209
+ .\sync-mesh.ps1 -Init
210
+ ```
211
+
212
+ This scaffolds the state repo structure (squad directories, placeholder SUMMARY.md files, root README).
213
+
214
+ **Skip this step if:**
215
+ - No Zone 2 squads are configured (local/opaque only)
216
+ - The state repo already exists and is initialized
217
+
218
+ ### Step 5: WRITE a decision entry
219
+
220
+ Create a decision file at `.squad/decisions/inbox/<your-agent-name>-mesh-setup.md` with this content:
221
+
222
+ ```markdown
223
+ ### <YYYY-MM-DD>: Mesh configuration
224
+
225
+ **By:** <your-agent-name> (via distributed-mesh skill)
226
+
227
+ **What:** Configured distributed mesh with <N> squads across zones <list-zones-used>
228
+
229
+ **Squads:**
230
+ - `<squad-name>` — Zone <X> — <brief-connection-info>
231
+ - `<squad-name>` — Zone <X> — <brief-connection-info>
232
+ - ...
233
+
234
+ **State repo:** <git-url-if-zone-2-used, or "N/A (local/opaque only)">
235
+
236
+ **Why:** <user's stated reason for setting up the mesh, or "Enable cross-machine squad coordination">
237
+ ```
238
+
239
+ Write this file. The Scribe will merge it into the main decisions file later.
240
+
241
+ ### Step 6: STOP
242
+
243
+ **You are done.** Do not:
244
+ - Generate sync scripts (they're bundled with this skill — COPY them)
245
+ - Write validator code
246
+ - Write test files
247
+ - Create any other modules, libraries, or application code
248
+ - Modify existing squad files (team.md, routing.md, charters)
249
+ - Auto-advance to Phase 2 or Phase 3
250
+
251
+ Output a simple completion message:
252
+
253
+ ```
254
+ ✅ Mesh configured. Created:
255
+ - mesh.json (<N> squads)
256
+ - sync-mesh.sh and sync-mesh.ps1 (copied from skill bundle)
257
+ - Decision entry: .squad/decisions/inbox/<filename>
258
+
259
+ Run `bash sync-mesh.sh` (or `.\sync-mesh.ps1` on Windows) before agents start to materialize remote state.
260
+ ```
261
+
262
+ ---
263
+
264
+ ## Anti-Patterns
265
+
266
+ **❌ Code generation anti-patterns:**
267
+ - Writing `mesh-config-validator.js` or any validator module
268
+ - Writing test files for mesh configuration
269
+ - Generating sync scripts instead of copying the bundled ones from this skill's directory
270
+ - Creating library modules or utilities
271
+ - Building any code that "runs the mesh" — the mesh is read by agents, not executed
272
+
273
+ **❌ Architectural anti-patterns:**
274
+ - Building a federation protocol — Git push/pull IS federation
275
+ - Running a sync daemon or server — Agents are not persistent. Sync at startup, publish at shutdown
276
+ - Real-time notifications — Agents don't need real-time. They need "recent enough." `git pull` is recent enough
277
+ - Schema validation for markdown — The LLM reads markdown. If the format changes, it adapts
278
+ - Service discovery protocol — mesh.json is a file with 10 entries. Not a "discovery problem"
279
+ - Auth framework — Git SSH keys and HTTPS tokens. Not a framework. Already configured
280
+ - Message queues / event buses — Agents wake, read, work, write, sleep. Nobody's home to receive events
281
+ - Any component requiring a running process — That's the line. Don't cross it
282
+
283
+ **❌ Scope creep anti-patterns:**
284
+ - Auto-advancing phases without user decision
285
+ - Modifying agent charters or routing rules
286
+ - Setting up CI/CD pipelines for mesh sync
287
+ - Creating dashboards or monitoring tools
@@ -0,0 +1,30 @@
1
+ {
2
+ "squads": {
3
+ "auth-squad": {
4
+ "zone": "local",
5
+ "path": "../auth-squad/.mesh"
6
+ },
7
+ "api-squad": {
8
+ "zone": "local",
9
+ "path": "../api-squad/.mesh"
10
+ },
11
+ "ci-squad": {
12
+ "zone": "remote-trusted",
13
+ "source": "git@github.com:our-org/ci-squad.git",
14
+ "ref": "main",
15
+ "sync_to": ".mesh/remotes/ci-squad"
16
+ },
17
+ "data-squad": {
18
+ "zone": "remote-trusted",
19
+ "source": "git@github.com:our-org/data-pipeline.git",
20
+ "ref": "main",
21
+ "sync_to": ".mesh/remotes/data-squad"
22
+ },
23
+ "partner-fraud": {
24
+ "zone": "remote-opaque",
25
+ "source": "https://partner.example.com/squad-contracts/fraud/SUMMARY.md",
26
+ "sync_to": ".mesh/remotes/partner-fraud",
27
+ "auth": "bearer"
28
+ }
29
+ }
30
+ }