@bradygaster/squad-cli 0.9.6-insider.2 → 0.10.0-insider.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 (188) hide show
  1. package/CHANGELOG.md +555 -0
  2. package/README.md +5 -5
  3. package/dist/cli/commands/build.js +3 -3
  4. package/dist/cli/commands/build.js.map +1 -1
  5. package/dist/cli/commands/copilot-bridge.d.ts.map +1 -1
  6. package/dist/cli/commands/copilot-bridge.js +5 -1
  7. package/dist/cli/commands/copilot-bridge.js.map +1 -1
  8. package/dist/cli/commands/cross-squad.d.ts +15 -2
  9. package/dist/cli/commands/cross-squad.d.ts.map +1 -1
  10. package/dist/cli/commands/cross-squad.js +78 -4
  11. package/dist/cli/commands/cross-squad.js.map +1 -1
  12. package/dist/cli/commands/doctor.d.ts +6 -0
  13. package/dist/cli/commands/doctor.d.ts.map +1 -1
  14. package/dist/cli/commands/doctor.js +120 -5
  15. package/dist/cli/commands/doctor.js.map +1 -1
  16. package/dist/cli/commands/export.d.ts +7 -3
  17. package/dist/cli/commands/export.d.ts.map +1 -1
  18. package/dist/cli/commands/export.js +68 -16
  19. package/dist/cli/commands/export.js.map +1 -1
  20. package/dist/cli/commands/import.d.ts +7 -3
  21. package/dist/cli/commands/import.d.ts.map +1 -1
  22. package/dist/cli/commands/import.js +140 -42
  23. package/dist/cli/commands/import.js.map +1 -1
  24. package/dist/cli/commands/install-hooks.d.ts.map +1 -1
  25. package/dist/cli/commands/install-hooks.js +50 -5
  26. package/dist/cli/commands/install-hooks.js.map +1 -1
  27. package/dist/cli/commands/link.d.ts.map +1 -1
  28. package/dist/cli/commands/link.js +7 -1
  29. package/dist/cli/commands/link.js.map +1 -1
  30. package/dist/cli/commands/loop.d.ts.map +1 -1
  31. package/dist/cli/commands/loop.js +7 -5
  32. package/dist/cli/commands/loop.js.map +1 -1
  33. package/dist/cli/commands/memory.d.ts +2 -0
  34. package/dist/cli/commands/memory.d.ts.map +1 -0
  35. package/dist/cli/commands/memory.js +304 -0
  36. package/dist/cli/commands/memory.js.map +1 -0
  37. package/dist/cli/commands/migrate-backend.d.ts +36 -5
  38. package/dist/cli/commands/migrate-backend.d.ts.map +1 -1
  39. package/dist/cli/commands/migrate-backend.js +250 -40
  40. package/dist/cli/commands/migrate-backend.js.map +1 -1
  41. package/dist/cli/commands/notes.d.ts +27 -0
  42. package/dist/cli/commands/notes.d.ts.map +1 -0
  43. package/dist/cli/commands/notes.js +222 -0
  44. package/dist/cli/commands/notes.js.map +1 -0
  45. package/dist/cli/commands/plugin.d.ts.map +1 -1
  46. package/dist/cli/commands/plugin.js +423 -8
  47. package/dist/cli/commands/plugin.js.map +1 -1
  48. package/dist/cli/commands/skill.d.ts +31 -0
  49. package/dist/cli/commands/skill.d.ts.map +1 -0
  50. package/dist/cli/commands/skill.js +498 -0
  51. package/dist/cli/commands/skill.js.map +1 -0
  52. package/dist/cli/commands/start.d.ts.map +1 -1
  53. package/dist/cli/commands/start.js +9 -1
  54. package/dist/cli/commands/start.js.map +1 -1
  55. package/dist/cli/commands/state-mcp.d.ts +25 -0
  56. package/dist/cli/commands/state-mcp.d.ts.map +1 -0
  57. package/dist/cli/commands/state-mcp.js +174 -0
  58. package/dist/cli/commands/state-mcp.js.map +1 -0
  59. package/dist/cli/commands/watch/agent-spawn.d.ts +62 -0
  60. package/dist/cli/commands/watch/agent-spawn.d.ts.map +1 -0
  61. package/dist/cli/commands/watch/agent-spawn.js +127 -0
  62. package/dist/cli/commands/watch/agent-spawn.js.map +1 -0
  63. package/dist/cli/commands/watch/capabilities/board.d.ts.map +1 -1
  64. package/dist/cli/commands/watch/capabilities/board.js +2 -1
  65. package/dist/cli/commands/watch/capabilities/board.js.map +1 -1
  66. package/dist/cli/commands/watch/capabilities/decision-hygiene.d.ts.map +1 -1
  67. package/dist/cli/commands/watch/capabilities/decision-hygiene.js +3 -2
  68. package/dist/cli/commands/watch/capabilities/decision-hygiene.js.map +1 -1
  69. package/dist/cli/commands/watch/capabilities/execute.d.ts.map +1 -1
  70. package/dist/cli/commands/watch/capabilities/execute.js +14 -2
  71. package/dist/cli/commands/watch/capabilities/execute.js.map +1 -1
  72. package/dist/cli/commands/watch/capabilities/index.d.ts.map +1 -1
  73. package/dist/cli/commands/watch/capabilities/index.js +2 -0
  74. package/dist/cli/commands/watch/capabilities/index.js.map +1 -1
  75. package/dist/cli/commands/watch/capabilities/monitor-email.d.ts +1 -1
  76. package/dist/cli/commands/watch/capabilities/monitor-email.d.ts.map +1 -1
  77. package/dist/cli/commands/watch/capabilities/monitor-email.js +21 -4
  78. package/dist/cli/commands/watch/capabilities/monitor-email.js.map +1 -1
  79. package/dist/cli/commands/watch/capabilities/monitor-teams.d.ts +1 -1
  80. package/dist/cli/commands/watch/capabilities/monitor-teams.d.ts.map +1 -1
  81. package/dist/cli/commands/watch/capabilities/monitor-teams.js +21 -5
  82. package/dist/cli/commands/watch/capabilities/monitor-teams.js.map +1 -1
  83. package/dist/cli/commands/watch/capabilities/notes-promote.d.ts +11 -0
  84. package/dist/cli/commands/watch/capabilities/notes-promote.d.ts.map +1 -0
  85. package/dist/cli/commands/watch/capabilities/notes-promote.js +124 -0
  86. package/dist/cli/commands/watch/capabilities/notes-promote.js.map +1 -0
  87. package/dist/cli/commands/watch/capabilities/retro.d.ts.map +1 -1
  88. package/dist/cli/commands/watch/capabilities/retro.js +3 -2
  89. package/dist/cli/commands/watch/capabilities/retro.js.map +1 -1
  90. package/dist/cli/commands/watch/capabilities/wave-dispatch.d.ts.map +1 -1
  91. package/dist/cli/commands/watch/capabilities/wave-dispatch.js +2 -1
  92. package/dist/cli/commands/watch/capabilities/wave-dispatch.js.map +1 -1
  93. package/dist/cli/commands/watch/index.d.ts.map +1 -1
  94. package/dist/cli/commands/watch/index.js +16 -12
  95. package/dist/cli/commands/watch/index.js.map +1 -1
  96. package/dist/cli/core/cast.d.ts.map +1 -1
  97. package/dist/cli/core/cast.js +216 -1
  98. package/dist/cli/core/cast.js.map +1 -1
  99. package/dist/cli/core/command-help.d.ts +44 -0
  100. package/dist/cli/core/command-help.d.ts.map +1 -0
  101. package/dist/cli/core/command-help.js +401 -0
  102. package/dist/cli/core/command-help.js.map +1 -0
  103. package/dist/cli/core/copilot-invocation.d.ts +57 -0
  104. package/dist/cli/core/copilot-invocation.d.ts.map +1 -0
  105. package/dist/cli/core/copilot-invocation.js +84 -0
  106. package/dist/cli/core/copilot-invocation.js.map +1 -0
  107. package/dist/cli/core/effective-squad-dir.d.ts +33 -0
  108. package/dist/cli/core/effective-squad-dir.d.ts.map +1 -0
  109. package/dist/cli/core/effective-squad-dir.js +37 -0
  110. package/dist/cli/core/effective-squad-dir.js.map +1 -0
  111. package/dist/cli/core/init.d.ts +2 -0
  112. package/dist/cli/core/init.d.ts.map +1 -1
  113. package/dist/cli/core/init.js +130 -1
  114. package/dist/cli/core/init.js.map +1 -1
  115. package/dist/cli/core/mcp-root.d.ts +73 -0
  116. package/dist/cli/core/mcp-root.d.ts.map +1 -0
  117. package/dist/cli/core/mcp-root.js +195 -0
  118. package/dist/cli/core/mcp-root.js.map +1 -0
  119. package/dist/cli/core/mcp-spec.d.ts +48 -0
  120. package/dist/cli/core/mcp-spec.d.ts.map +1 -0
  121. package/dist/cli/core/mcp-spec.js +62 -0
  122. package/dist/cli/core/mcp-spec.js.map +1 -0
  123. package/dist/cli/core/npm-registry.d.ts +25 -0
  124. package/dist/cli/core/npm-registry.d.ts.map +1 -0
  125. package/dist/cli/core/npm-registry.js +65 -0
  126. package/dist/cli/core/npm-registry.js.map +1 -0
  127. package/dist/cli/core/templates.d.ts.map +1 -1
  128. package/dist/cli/core/templates.js +102 -24
  129. package/dist/cli/core/templates.js.map +1 -1
  130. package/dist/cli/core/upgrade.d.ts +29 -0
  131. package/dist/cli/core/upgrade.d.ts.map +1 -1
  132. package/dist/cli/core/upgrade.js +413 -15
  133. package/dist/cli/core/upgrade.js.map +1 -1
  134. package/dist/cli/index.d.ts +1 -0
  135. package/dist/cli/index.d.ts.map +1 -1
  136. package/dist/cli/index.js +1 -0
  137. package/dist/cli/index.js.map +1 -1
  138. package/dist/cli/shell/components/App.js +1 -1
  139. package/dist/cli/shell/components/App.js.map +1 -1
  140. package/dist/cli/shell/components/MessageStream.js +2 -2
  141. package/dist/cli/shell/components/MessageStream.js.map +1 -1
  142. package/dist/cli/shell/coordinator.d.ts.map +1 -1
  143. package/dist/cli/shell/coordinator.js +11 -5
  144. package/dist/cli/shell/coordinator.js.map +1 -1
  145. package/dist/cli/shell/index.d.ts.map +1 -1
  146. package/dist/cli/shell/index.js +14 -7
  147. package/dist/cli/shell/index.js.map +1 -1
  148. package/dist/cli/shell/lifecycle.d.ts.map +1 -1
  149. package/dist/cli/shell/lifecycle.js +12 -7
  150. package/dist/cli/shell/lifecycle.js.map +1 -1
  151. package/dist/cli/shell/session-store.d.ts +4 -4
  152. package/dist/cli/shell/session-store.d.ts.map +1 -1
  153. package/dist/cli/shell/session-store.js +11 -11
  154. package/dist/cli/shell/session-store.js.map +1 -1
  155. package/dist/cli-entry.js +171 -50
  156. package/dist/cli-entry.js.map +1 -1
  157. package/package.json +9 -4
  158. package/scripts/patch-esm-imports.mjs +3 -1
  159. package/templates/after-agent-reference.md +64 -0
  160. package/templates/ceremony-reference.md +82 -0
  161. package/templates/client-compatibility-reference.md +46 -0
  162. package/templates/copilot-agent.md +96 -0
  163. package/templates/copilot-instructions.md +14 -0
  164. package/templates/fact-checker-policy.md +104 -0
  165. package/templates/model-selection-reference.md +101 -0
  166. package/templates/prd-intake.md +105 -0
  167. package/templates/rai-charter.md +110 -0
  168. package/templates/rai-policy.md +103 -0
  169. package/templates/ralph-reference.md +141 -0
  170. package/templates/routing.md +1 -0
  171. package/templates/scribe-charter.md +18 -151
  172. package/templates/session-init-reference.md +199 -0
  173. package/templates/skills/cross-squad/SKILL.md +66 -6
  174. package/templates/skills/cross-squad-communication/SKILL.md +399 -0
  175. package/templates/skills/e2e-template-testing/SKILL.md +557 -0
  176. package/templates/skills/fact-checking/SKILL.md +61 -0
  177. package/templates/skills/release-process/SKILL.md +2 -2
  178. package/templates/skills/squad/SKILL.md +299 -0
  179. package/templates/skills/squad-help/SKILL.md +97 -0
  180. package/templates/skills/squad-version-check/SKILL.md +169 -0
  181. package/templates/skills/tiered-memory/SKILL.md +31 -44
  182. package/templates/spawn-reference.md +131 -0
  183. package/templates/squad.agent.md.template +306 -618
  184. package/templates/workflow-wiring-appendix-a-code-reviewer.md +131 -0
  185. package/templates/workflow-wiring-appendix-b-documenter.md +140 -0
  186. package/templates/workflow-wiring-guide.md +276 -0
  187. package/templates/workflows/squad-heartbeat.yml +167 -167
  188. package/templates/worktree-reference.md +126 -0
@@ -0,0 +1,399 @@
1
+ ---
2
+ name: "cross-squad-communication"
3
+ description: "Protocol for sending queries, delegating tasks, and sharing context between independent Squad instances across different repositories"
4
+ domain: "multi-repo coordination"
5
+ confidence: "medium"
6
+ source: "Ported from tamirdresher/squad-skills (plugins/cross-squad-communication). Companion to the registry-aware cross-squad skill — this one teaches the actual communication protocols once a peer is discovered. Pattern 0 (synchronous CLI) is the only end-to-end-validated pattern; Patterns 1, 2, 3 are documented from design but require live validation against your own setup before relying on them in production. See the Validation Status section at the bottom of this skill."
7
+ ---
8
+
9
+ ## Context
10
+
11
+ When multiple repositories each have their own Squad (AI team), they need to exchange information: knowledge queries, PR reviews, task delegation, and dependency analysis. Each squad has its own agents, MCP tools, and issue tracker — there is no shared runtime.
12
+
13
+ > **Companion skill — read first:** `cross-squad/SKILL.md` covers **discovery** of peer squads via `squad registry add/list/remove`. This skill picks up after a peer is known and covers the **communication protocols** themselves — the four numbered patterns below: Pattern 0 (synchronous CLI), Pattern 1 (read-only knowledge query), Pattern 2 (git-based async), and Pattern 3 (GitHub-issue-based delegation). A separate non-numbered appendix (Cross-Repo Dependency Scan) is provided as a related analysis tool, not a communication pattern. The two skills are designed to be used together.
14
+
15
+ **When this skill applies:**
16
+ - A squad agent needs information from another squad-enabled repo
17
+ - A task needs to be delegated to another squad
18
+ - Cross-repo dependency analysis is needed
19
+ - PR review requests span repo boundaries
20
+
21
+ **Key constraint:** Each squad has its own runtime, MCP tools, and issue tracker. Cross-squad communication can be **synchronous** (via CLI session targeting the other repo) or **asynchronous** (file-based or issue-based). The coordinator decides which approach fits.
22
+
23
+ ---
24
+
25
+ ## Patterns
26
+
27
+ ### Decision Tree: Choosing the Right Pattern
28
+
29
+ ```
30
+ Is the target repo cloned locally?
31
+ ├─ NO → Use Pattern 3 (Issue-Based) or Pattern 2 (Git-Based Async)
32
+ └─ YES
33
+ ├─ Is this a quick query / knowledge lookup?
34
+ │ └─ YES → Use Pattern 0 (Synchronous CLI) — fastest
35
+ ├─ Does the work need to persist as artifacts?
36
+ │ └─ YES → Use Pattern 2 (Git-Based Async)
37
+ ├─ Is it a long-running analysis or multi-cycle task?
38
+ │ └─ YES → Use Pattern 2 (Git-Based Async)
39
+ └─ Is the target squad's Ralph running?
40
+ ├─ YES → Pattern 2 or 3 (async processing available)
41
+ └─ NO → Pattern 0 (Synchronous CLI) or Pattern 1 (Read-Only)
42
+ ```
43
+
44
+ ---
45
+
46
+ ## Universal rule: every `copilot` spawn into a peer squad MUST pass `--agent squad`
47
+
48
+ The `copilot` CLI accepts `--agent <name>` to select a custom agent (see `copilot --help`). Squad installs ship `.github/agents/squad.agent.md`, which is loaded **only when `--agent squad` is specified**. Without it the spawned session runs as a generic Copilot CLI session that does NOT load the peer's `team.md`, routing, MCP tools, casting, or coordinator behaviour — so you get an off-the-shelf model answering, not the peer's Squad. **Every command example in this skill that spawns `copilot` into a peer repo includes `--agent squad`; do not strip it.**
49
+
50
+ This rule also applies anywhere else you spawn `copilot` into a Squad-initialised repo (not just cross-squad protocols) — e.g., `squad init`'s post-init tip and any automation that invokes the CLI on a squadified folder. The only case where you may omit `--agent` is when resuming an existing session (`copilot --resume <sessionId>`) — the resumed session preserves its original agent context.
51
+
52
+ ---
53
+
54
+ ### Pattern 0: Synchronous CLI Session (Fastest for Interactive Queries)
55
+
56
+ For quick knowledge queries, decision lookups, or short analyses — spawn a Copilot CLI session with the working directory set to the target squad's repo. This lets you send a prompt and get a response within the same session, using the target repo's full context.
57
+
58
+ This is the same technique used by `ralph-watch.ps1`: write the prompt to a temp file, then invoke the CLI with that file as input. The key insight is that setting the working directory to the target repo gives the CLI session access to that squad's `.squad/` metadata, codebase, and conventions.
59
+
60
+ **Protocol:**
61
+ 1. Write prompt to a temp file (avoids argument-splitting issues, as learned in `ralph-watch.ps1`)
62
+ 2. Read the file into a string and invoke `copilot -p <text>` with `-C <directory>` set to the target repo (`-p` takes prompt text, NOT a file path) AND `--agent squad` so the spawned session uses the peer squad's coordinator (without `--agent` you get a generic Copilot CLI session that doesn't load the peer's `team.md`, MCP tools, or skills)
63
+ 3. Receive response in the same session
64
+
65
+ **Invocation:**
66
+ ```powershell
67
+ # Spawn a Copilot CLI session targeting another squad's repo
68
+ $targetRepo = "C:\repos\platform-squad-repo"
69
+ $promptFile = New-TemporaryFile
70
+ @"
71
+ You are working in a Squad-enabled repository.
72
+ Read .squad/team.md and .squad/decisions.md first.
73
+
74
+ [CROSS-SQUAD REQUEST]
75
+ From: research-squad
76
+ Request Type: knowledge_query
77
+ Query: What is the current architecture of the platform? What services does it expose?
78
+ Response Format: Brief structured summary
79
+ "@ | Out-File $promptFile -Encoding utf8
80
+
81
+ # Option A: copilot with prompt file (read file into string; -p takes text, not a path)
82
+ # --agent squad is REQUIRED: the target is another Squad install, so the spawned
83
+ # session must use that squad's coordinator (not a generic Copilot CLI session).
84
+ copilot -C $targetRepo --agent squad -p (Get-Content $promptFile -Raw) --allow-all-tools
85
+
86
+ # Option B: Start-Process for non-blocking (ralph-watch.ps1 style)
87
+ Start-Process pwsh -ArgumentList "-NoProfile -Command `"copilot -C '$targetRepo' --agent squad -p (Get-Content '$promptFile' -Raw) --allow-all-tools`"" -Wait
88
+
89
+ # Option C: Pipe directly (stdin is the prompt text)
90
+ "What is the platform architecture?" | copilot -C $targetRepo --agent squad --allow-all-tools
91
+ ```
92
+
93
+ **When to use synchronous vs async:**
94
+
95
+ | Scenario | Pattern | Why |
96
+ |----------|---------|-----|
97
+ | Quick knowledge query | Synchronous CLI (Pattern 0) | Fast answer, no overhead |
98
+ | "What did you decide about X?" | Synchronous CLI (Pattern 0) | Read decisions.md via the target squad's context |
99
+ | PR review request | Either (Pattern 0 or 2/3) | Sync for quick feedback, async for thorough review |
100
+ | Task delegation (do work in their repo) | Async (Pattern 2 or 3) | Work needs to persist beyond the session |
101
+ | Long-running analysis | Async (Pattern 2) | May take multiple cycles |
102
+ | Target repo not locally cloned | Async (Pattern 3) | Can't set working directory to a remote repo |
103
+
104
+ **The coordinator decides which pattern to use based on:**
105
+ 1. Is the target repo cloned locally? → If yes, sync CLI is available
106
+ 2. Is this a quick query or a long task? → Quick = sync, long = async
107
+ 3. Does the work need to persist? → If yes, use async (creates artifacts)
108
+ 4. Is the target squad's Ralph running? → Needed for async processing
109
+
110
+ **Requirements:**
111
+ - Target repo must be cloned locally (for `copilot -C <directory>`)
112
+ - Target repo must be Squad-initialised (`.squad/config.json` + `.github/agents/squad.agent.md` present), so `--agent squad` resolves to the peer's coordinator
113
+ - Prompt file avoids argument-splitting bugs (see `ralph-watch.ps1` lines 2166-2184)
114
+
115
+ **Response quality:** ⭐⭐⭐⭐⭐ — the CLI session has full context of the target repo, including code, squad metadata, and MCP tools.
116
+
117
+ ### Liveness Protocol for Pattern 0
118
+
119
+ The synchronous CLI session requires monitoring to avoid false timeouts. With 7+ MCP servers initializing and `.squad/` metadata being read, startup can take 30-60 seconds. A hard timeout kills valid sessions before they complete. Instead, monitor the agency session's activity log directory.
120
+
121
+ **Health Check Approach:**
122
+
123
+ Instead of a fixed wall-clock timeout, monitor the agency session log directory for activity:
124
+
125
+ ```powershell
126
+ # The Copilot CLI creates a session log directory at ~/.copilot/logs/.
127
+ # Older `agency` runtimes wrote to ~/.agency/logs/; fall back to that
128
+ # location if the new path doesn't exist yet on the user's machine.
129
+ # e.g., ~/.copilot/logs/session_20260325_071211_57824
130
+ $copilotLogs = "$env:USERPROFILE\.copilot\logs"
131
+ $agencyLogs = "$env:USERPROFILE\.agency\logs"
132
+ $logRoot = if (Test-Path $copilotLogs) { $copilotLogs } elseif (Test-Path $agencyLogs) { $agencyLogs } else { $null }
133
+ if ($logRoot) {
134
+ $logDir = Get-ChildItem $logRoot -Directory | Sort-Object LastWriteTime -Descending | Select-Object -First 1
135
+ }
136
+ $lastSize = 0
137
+ $stallCount = 0
138
+
139
+ while ($proc -and -not $proc.HasExited) {
140
+ Start-Sleep -Seconds 15
141
+ $currentSize = (Get-ChildItem $logDir -Recurse -File | Measure-Object -Property Length -Sum).Sum
142
+
143
+ if ($currentSize -eq $lastSize) {
144
+ $stallCount++
145
+ if ($stallCount -ge 4) { # 60s with no progress
146
+ Write-Warning "Session stalled — no log activity for 60s"
147
+ break
148
+ }
149
+ } else {
150
+ $stallCount = 0
151
+ $lastSize = $currentSize
152
+ }
153
+ }
154
+ ```
155
+
156
+ **Progress Indicators (What Counts as "Alive"):**
157
+
158
+ - New files appearing in the session log directory (e.g., `transcript.log`, `mcp-server-logs/`)
159
+ - Log file size increasing (indicates active processing)
160
+ - New or modified `.squad/` files in the target repo (e.g., `decisions/inbox.md`, `identity/history.md`)
161
+ - Process still running and consuming non-idle CPU time
162
+
163
+ **Stall Detection (When to Intervene):**
164
+
165
+ - **No log activity for 60s** → Issue a warning; session may be slow but not hung
166
+ - **No log activity for 120s** → Likely stuck; consider terminating and checking logs
167
+ - **Process exited with non-zero exit code** → Failed; examine `transcript.log` and `stderr` for errors
168
+ - **MCP server connection timeout** → Session blocked waiting for an MCP server response
169
+
170
+ **Recovery Actions When Stalled:**
171
+
172
+ 1. **Check for user input waiting:** Inspect logs for prompts or dialogs (shouldn't happen with `--autopilot`)
173
+ 2. **Check MCP server health:** Review `mcp-server-logs/` for connection errors or timeouts
174
+ 3. **Retry with `--disable-builtin-mcps` flag:** For lightweight queries that don't require MCP tools
175
+ ```powershell
176
+ # Retry without MCP servers — faster startup, limited capability
177
+ copilot -C $targetRepo --agent squad -p (Get-Content $promptFile -Raw) --disable-builtin-mcps --allow-all-tools
178
+ ```
179
+ 4. **Increase timeout threshold:** If MCP server initialization is consistently slow (>90s), raise threshold before declaring stall
180
+
181
+ ---
182
+
183
+ ### Pattern 1: Read-Only Knowledge Query (No CLI Needed)
184
+
185
+ For questions about another squad's architecture, decisions, or current state — read their `.squad/` metadata directly.
186
+
187
+ **Protocol:**
188
+ 1. Read target repo's `.squad/team.md` → get stack, members, issue source
189
+ 2. Read `.squad/decisions.md` → get architectural decisions
190
+ 3. Read `.squad/routing.md` → understand who handles what
191
+ 4. Read `.squad/identity/now.md` → get current focus
192
+ 5. Scan code structure if needed (csproj files, directory layout)
193
+
194
+ **Requirements:**
195
+ - Target repo must be cloned locally or accessible via git
196
+ - No authentication needed beyond git read access
197
+
198
+ **Example:**
199
+ ```powershell
200
+ # Query another squad's architecture
201
+ $targetRepo = "C:\repos\platform-squad-repo"
202
+ Get-Content "$targetRepo\.squad\team.md"
203
+ Get-Content "$targetRepo\.squad\decisions.md"
204
+ Get-Content "$targetRepo\.squad\identity\now.md"
205
+ ```
206
+
207
+ **Response quality:** ⭐⭐⭐⭐ — excellent for structural/architectural questions.
208
+
209
+ ---
210
+
211
+ ### Pattern 2: Async Task Request (Git-Based)
212
+
213
+ For work that needs the target squad to execute (PR reviews, issue analysis, code changes).
214
+
215
+ **Protocol:**
216
+ 1. Create request file in YOUR repo: `.squad/cross-squad/requests/{timestamp}-{target}-{id}.yaml`
217
+ 2. Commit and push
218
+ 3. Target squad's Ralph detects on next cycle
219
+ 4. Target squad processes and writes response to their `.squad/cross-squad/responses/`
220
+ 5. Your Ralph picks up the response
221
+
222
+ **Request File Format:**
223
+ ```yaml
224
+ id: req-2026-06-13-001
225
+ source_squad: research-squad
226
+ source_repo: your-org/research-squad-repo
227
+ target_squad: platform-squad
228
+ target_repo: your-org/platform-squad-repo
229
+ request_type: knowledge_query | pr_review | task_delegation | dependency_check
230
+ priority: high | normal | low
231
+ created_at: 2026-06-13T10:00:00Z
232
+ query: "What is the current architecture of the platform?"
233
+ routing_hint: "lead" # optional — which agent should handle this
234
+ status: pending
235
+ ```
236
+
237
+ **Response File Format:**
238
+ ```yaml
239
+ id: req-2026-06-13-001
240
+ responding_squad: platform-squad
241
+ responding_agent: lead
242
+ responded_at: 2026-06-13T10:15:00Z
243
+ status: completed | partial | rejected
244
+ response: |
245
+ The platform architecture consists of...
246
+ artifacts: [] # optional file paths
247
+ ```
248
+
249
+ ---
250
+
251
+ ### Pattern 3: Issue-Based Delegation (For GitHub-Hosted Repos)
252
+
253
+ For repos on GitHub, use issues with labels as the message bus.
254
+
255
+ **Protocol:**
256
+ 1. Create issue in target repo with label `squad:cross-squad`
257
+ 2. Include source squad identifier and routing hint in issue body
258
+ 3. Target squad's Ralph picks up and routes to appropriate agent
259
+ 4. Response posted as issue comment
260
+ 5. Issue closed when complete
261
+
262
+ **Example:**
263
+ ```bash
264
+ gh issue create \
265
+ --repo your-org/platform-squad-repo \
266
+ --title "[Cross-Squad] Architecture query from research-squad" \
267
+ --body "Source: research-squad\nQuery: What services does the platform expose?\nRouting: lead" \
268
+ --label "squad:cross-squad"
269
+ ```
270
+
271
+ **Limitation:** Only works for repos on GitHub. Other platforms (Azure DevOps, GitLab, etc.) need different approach.
272
+
273
+ ---
274
+
275
+ ### Appendix: Cross-Repo Dependency Scan (Related Analysis Tool — Not a Communication Pattern)
276
+
277
+ > This section is intentionally listed as an appendix rather than "Pattern 4" — it is a one-off analysis utility for discovering how two repos relate, not a protocol the coordinator picks from the decision tree above. The four numbered communication patterns are 0–3.
278
+
279
+ For discovering how two repos relate to each other.
280
+
281
+ **Protocol:**
282
+ 1. Search both repos for mutual references:
283
+ ```powershell
284
+ Select-String -Path (Get-ChildItem $repoA -Recurse -Include "*.md","*.cs","*.json","*.csproj") `
285
+ -Pattern $repoB_name
286
+ Select-String -Path (Get-ChildItem $repoB -Recurse -Include "*.md","*.cs","*.json","*.csproj") `
287
+ -Pattern $repoA_name
288
+ ```
289
+ 2. Check shared NuGet packages / npm packages
290
+ 3. Check shared ADO project or GitHub org
291
+ 4. Document relationship type: code dependency, operational coupling, shared infra
292
+
293
+ ---
294
+
295
+ ## Discovery Protocol
296
+
297
+ Before sending any cross-squad request, verify the target:
298
+
299
+ ```
300
+ 1. Does .squad/team.md exist? → Squad is installed
301
+ 2. What is the issue_source? → GitHub Issues | ADO | Planner
302
+ 3. What agents are active? → Check member status column
303
+ 4. What is the routing table? → Read routing.md
304
+ 5. What is the current focus? → Read identity/now.md
305
+ 6. Is Ralph running? → Check for recent commits by Ralph
306
+ ```
307
+
308
+ If `.squad/team.md` doesn't exist, the repo is not squad-enabled. Fall back to standard human communication.
309
+
310
+ ---
311
+
312
+ ## Platform Compatibility Matrix
313
+
314
+ | Source Issue Tracker | Target Issue Tracker | Mechanism |
315
+ |---------------------|---------------------|-----------|
316
+ | GitHub Issues | GitHub Issues | Issue-based (Pattern 3) |
317
+ | GitHub Issues | ADO Work Items | Git-based (Pattern 2) |
318
+ | GitHub Issues | Planner | Git-based (Pattern 2) |
319
+ | ADO Work Items | GitHub Issues | Issue-based (Pattern 3) via `gh` CLI |
320
+ | ADO Work Items | ADO Work Items | ADO cross-project work items |
321
+ | Any | Any | Git-based (Pattern 2) — universal fallback |
322
+
323
+ ---
324
+
325
+ ## Examples
326
+
327
+ ### Example 1: research-squad queries platform-squad architecture
328
+
329
+ ```powershell
330
+ # Step 1: Read metadata (Pattern 1)
331
+ $target = "C:\repos\platform-squad-repo"
332
+ $team = Get-Content "$target\.squad\team.md" -Raw
333
+ $decisions = Get-Content "$target\.squad\decisions.md" -Raw
334
+
335
+ # Step 2: Extract answer from metadata
336
+ # team.md reveals tech stack and member roles
337
+ # decisions.md reveals architectural choices
338
+
339
+ # Step 3: If deeper analysis needed, create async request (Pattern 2)
340
+ ```
341
+
342
+ ### Example 2: Request PR review from another squad
343
+
344
+ ```yaml
345
+ # .squad/cross-squad/requests/2026-06-13-platform-squad-pr-review.yaml
346
+ id: pr-review-001
347
+ source_squad: research-squad
348
+ target_squad: platform-squad
349
+ request_type: pr_review
350
+ priority: normal
351
+ query: "Review PR #54 — package version fix. Check for correctness."
352
+ routing_hint: "lead"
353
+ status: pending
354
+ ```
355
+
356
+ ---
357
+
358
+ ## Anti-Patterns
359
+
360
+ ### ⚠️ Know when synchronous CLI is NOT the right choice
361
+ ```powershell
362
+ # WRONG — don't use sync CLI for long-running tasks that need artifacts
363
+ copilot -C $targetRepo --agent squad -p (Get-Content $promptFile -Raw) --allow-all-tools
364
+ # If the task creates files, PRs, or takes multiple cycles → use async (Pattern 2 or 3)
365
+
366
+ # WRONG — don't use sync CLI when the target repo isn't cloned locally
367
+ copilot -C "C:\not\cloned\yet" --agent squad --allow-all-tools
368
+ # If the repo isn't available locally → use issue-based delegation (Pattern 3)
369
+ ```
370
+ Synchronous CLI sessions (Pattern 0) are valid for quick queries and knowledge lookups. Use async patterns for work that needs to persist or where the target repo isn't available locally.
371
+
372
+ ### ❌ Don't assume shared MCP tools
373
+ Each squad has its own MCP server instances. You cannot invoke another squad's ADO tools or GitHub tools from your session.
374
+
375
+ ### ❌ Don't skip the discovery step
376
+ Always read `team.md` first. The target squad may use a different issue tracker, have different agents, or be in a different state than expected.
377
+
378
+ ### ❌ Don't send requests to squads without Ralph
379
+ If the target squad doesn't have Ralph (Work Monitor) running, async requests will never be processed. Check for recent Ralph activity first.
380
+
381
+ ### ❌ Don't mix up repo platforms
382
+ Different repos may use GitHub Issues vs Azure DevOps Work Items vs Jira. Check `team.md` / repository metadata for the right tooling before sending requests.
383
+
384
+ ---
385
+
386
+ ## Validation Status
387
+
388
+ This skill was originally drafted against two prototype squad setups (a GitHub-hosted platform squad with ~10 agents and an Azure DevOps-hosted automation squad with ~4 agents). The protocols are platform-agnostic; the examples in this document use generic names so you can substitute your own repos. Patterns 0 and 1 have been exercised end-to-end in those prototypes; Patterns 2 and 3 are documented from design but have not been end-to-end-validated against a live target repo.
389
+
390
+ | Scenario | Result |
391
+ |----------|--------|
392
+ | Knowledge query (read-only) | ✅ Works via Pattern 1 |
393
+ | Step handler discovery | ✅ Works via file scan |
394
+ | PR review (basic) | ⚠️ Partial — git log only, no API |
395
+ | Backlog enumeration | ⚠️ Partial — depends on issue platform |
396
+ | Dependency analysis | ✅ Works via cross-reference scan |
397
+ | CLI invocation (sync) + Liveness Protocol | ✅ Works — session launches successfully; log monitoring prevents false timeouts |
398
+
399
+ **Confidence: MEDIUM** — Synchronous CLI pattern (Pattern 0) validated end-to-end. Liveness protocol provides operational robustness against slow MCP initialization. Git-based async (Pattern 2) and issue-based (Pattern 3) untested end-to-end. Production readiness requires Ralph integration on both sides.