@bradygaster/squad-sdk 0.9.0 → 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 (76) hide show
  1. package/README.md +296 -296
  2. package/dist/agents/history-shadow.js +30 -30
  3. package/dist/build/github-dist.js +42 -42
  4. package/dist/config/init.js +173 -173
  5. package/dist/sharing/consult.js +78 -78
  6. package/package.json +1 -1
  7. package/templates/casting/Futurama.json +9 -9
  8. package/templates/casting-history.json +4 -4
  9. package/templates/casting-policy.json +37 -37
  10. package/templates/casting-reference.md +104 -104
  11. package/templates/casting-registry.json +3 -3
  12. package/templates/ceremonies.md +41 -41
  13. package/templates/charter.md +53 -53
  14. package/templates/constraint-tracking.md +38 -38
  15. package/templates/cooperative-rate-limiting.md +229 -229
  16. package/templates/copilot-instructions.md +46 -46
  17. package/templates/history.md +10 -10
  18. package/templates/identity/now.md +9 -9
  19. package/templates/identity/wisdom.md +15 -15
  20. package/templates/issue-lifecycle.md +412 -412
  21. package/templates/keda-scaler.md +164 -164
  22. package/templates/machine-capabilities.md +74 -74
  23. package/templates/mcp-config.md +90 -90
  24. package/templates/multi-agent-format.md +28 -28
  25. package/templates/plugin-marketplace.md +49 -49
  26. package/templates/ralph-circuit-breaker.md +313 -313
  27. package/templates/raw-agent-output.md +37 -37
  28. package/templates/roster.md +60 -60
  29. package/templates/routing.md +39 -39
  30. package/templates/run-output.md +50 -50
  31. package/templates/schedule.json +19 -19
  32. package/templates/scribe-charter.md +119 -119
  33. package/templates/skill.md +24 -24
  34. package/templates/skills/agent-collaboration/SKILL.md +42 -42
  35. package/templates/skills/agent-conduct/SKILL.md +24 -24
  36. package/templates/skills/architectural-proposals/SKILL.md +151 -151
  37. package/templates/skills/ci-validation-gates/SKILL.md +84 -84
  38. package/templates/skills/cli-wiring/SKILL.md +47 -47
  39. package/templates/skills/client-compatibility/SKILL.md +89 -89
  40. package/templates/skills/cross-squad/SKILL.md +114 -114
  41. package/templates/skills/distributed-mesh/SKILL.md +287 -287
  42. package/templates/skills/distributed-mesh/mesh.json.example +30 -30
  43. package/templates/skills/distributed-mesh/sync-mesh.ps1 +111 -111
  44. package/templates/skills/distributed-mesh/sync-mesh.sh +104 -104
  45. package/templates/skills/docs-standards/SKILL.md +71 -71
  46. package/templates/skills/economy-mode/SKILL.md +114 -114
  47. package/templates/skills/external-comms/SKILL.md +329 -329
  48. package/templates/skills/gh-auth-isolation/SKILL.md +183 -183
  49. package/templates/skills/git-workflow/SKILL.md +204 -204
  50. package/templates/skills/github-multi-account/SKILL.md +95 -95
  51. package/templates/skills/history-hygiene/SKILL.md +36 -36
  52. package/templates/skills/humanizer/SKILL.md +105 -105
  53. package/templates/skills/init-mode/SKILL.md +102 -102
  54. package/templates/skills/model-selection/SKILL.md +117 -117
  55. package/templates/skills/nap/SKILL.md +24 -24
  56. package/templates/skills/personal-squad/SKILL.md +57 -57
  57. package/templates/skills/project-conventions/SKILL.md +56 -56
  58. package/templates/skills/release-process/SKILL.md +423 -423
  59. package/templates/skills/reskill/SKILL.md +92 -92
  60. package/templates/skills/reviewer-protocol/SKILL.md +79 -79
  61. package/templates/skills/secret-handling/SKILL.md +200 -200
  62. package/templates/skills/session-recovery/SKILL.md +155 -155
  63. package/templates/skills/squad-conventions/SKILL.md +69 -69
  64. package/templates/skills/test-discipline/SKILL.md +37 -37
  65. package/templates/skills/windows-compatibility/SKILL.md +74 -74
  66. package/templates/workflows/squad-ci.yml +24 -24
  67. package/templates/workflows/squad-docs.yml +54 -54
  68. package/templates/workflows/squad-heartbeat.yml +171 -171
  69. package/templates/workflows/squad-insider-release.yml +61 -61
  70. package/templates/workflows/squad-issue-assign.yml +161 -161
  71. package/templates/workflows/squad-label-enforce.yml +181 -181
  72. package/templates/workflows/squad-preview.yml +55 -55
  73. package/templates/workflows/squad-promote.yml +120 -120
  74. package/templates/workflows/squad-release.yml +77 -77
  75. package/templates/workflows/squad-triage.yml +260 -260
  76. package/templates/workflows/sync-squad-labels.yml +169 -169
package/README.md CHANGED
@@ -1,296 +1,296 @@
1
- # @bradygaster/squad-sdk
2
-
3
- **Programmable multi-agent runtime for GitHub Copilot.** Build AI teams that persist, learn, and coordinate — with real governance, not vibes.
4
-
5
- [![Status](https://img.shields.io/badge/status-production-brightgreen)](#requirements)
6
- [![Node](https://img.shields.io/badge/node-%E2%89%A520-green)](#requirements)
7
- [![ESM](https://img.shields.io/badge/module-ESM--only-blue)](#requirements)
8
-
9
- ---
10
-
11
- ## Install
12
-
13
- ```bash
14
- npm install @bradygaster/squad-sdk
15
- ```
16
-
17
- ---
18
-
19
- ## What Makes This Different
20
-
21
- Most multi-agent setups are prompt engineering. You write a wall of text describing who each agent is, what they can do, and hope the model follows the rules. It works — until it doesn't. Agents ignore routing. They write files they shouldn't. They leak data. There's no enforcement, just suggestions.
22
-
23
- Squad's SDK moves orchestration out of prompts and into code:
24
-
25
- **Prompt-only orchestration** stuffs everything into a single context window. The coordinator is text. Agents read it, interpret it, maybe follow it.
26
-
27
- ```
28
- Prompt says:
29
- "If the agent is Backend, route auth tasks to it."
30
- Agent reads it (consumes tokens), decides what to do (might ignore it).
31
- ```
32
-
33
- **SDK orchestration** compiles rules into typed functions. Sessions are objects. Routing is deterministic. Tools are validated before execution.
34
-
35
- ```typescript
36
- Router.matchRoute(message) → { agent: 'Backend', priority: 'high' }
37
- // TypeScript knows exactly which agent runs, with what permissions.
38
- // HookPipeline runs file-write guards BEFORE the tool executes.
39
- // No interpretation. No ambiguity. Just code.
40
- ```
41
-
42
- ---
43
-
44
- ## Architecture
45
-
46
- ```
47
- ┌─────────────────────────────────────────────┐
48
- │ Your Code (TypeScript) │
49
- │ - createSession(), spawnParallel() │
50
- │ - SquadClient, EventBus, HookPipeline │
51
- └─────────────────────────────────────────────┘
52
-
53
- ┌─────────────────────────────────────────────┐
54
- │ Agent Orchestration Runtime │
55
- │ - Router (matchRoute, compileRoutingRules) │
56
- │ - Charter Compiler (permissions, voice) │
57
- │ - Tool Registry (squad_route, etc.) │
58
- │ - Hook Pipeline (governance enforcement) │
59
- └─────────────────────────────────────────────┘
60
-
61
- ┌─────────────────────────────────────────────┐
62
- │ Session Pool + Event Bus │
63
- │ - Each agent gets a persistent session │
64
- │ - Cross-session event pub/sub │
65
- │ - Crash recovery via session state │
66
- └─────────────────────────────────────────────┘
67
-
68
- ┌─────────────────────────────────────────────┐
69
- │ @github/copilot-sdk │
70
- │ - Real-time agent streaming │
71
- │ - Tool execution │
72
- └─────────────────────────────────────────────┘
73
- ```
74
-
75
- Your code sits at the top. The runtime handles routing, permissions, and governance. Sessions are persistent and recoverable. Everything runs on top of the official Copilot SDK.
76
-
77
- ---
78
-
79
- ## Custom Tools
80
-
81
- Five tools let agents coordinate without calling you back. Here are the three you'll reach for first.
82
-
83
- ### `squad_route` — Hand off work between agents
84
-
85
- ```typescript
86
- const tool = toolRegistry.getTool('squad_route');
87
- await tool.handler({
88
- targetAgent: 'McManus',
89
- task: 'Write a blog post on the new casting system',
90
- priority: 'high',
91
- context: 'Feature launches next week',
92
- });
93
- ```
94
-
95
- The lead routes a task to DevRel. A new session is created, context is passed, and the task is queued with priority. No human in the loop.
96
-
97
- ### `squad_decide` — Record a team decision
98
-
99
- ```typescript
100
- await tool.handler({
101
- author: 'Keaton',
102
- summary: 'Use PostgreSQL, not MongoDB',
103
- body: 'Chose PostgreSQL for: (1) transactions, (2) team expertise, (3) JSONB flexibility.',
104
- references: ['architecture-spike'],
105
- });
106
- ```
107
-
108
- Writes to the shared decision log. Every agent reads decisions before working — one call propagates context to the entire team.
109
-
110
- ### `squad_memory` — Teach an agent something permanent
111
-
112
- ```typescript
113
- await tool.handler({
114
- agent: 'Frontend',
115
- section: 'learnings',
116
- content: 'Project uses Tailwind v4 with dark mode plugin. Config at .styles/theme.config.ts',
117
- });
118
- ```
119
-
120
- Agents learn as they work. Next session, Frontend reads this and knows immediately. No context hunting, no re-explaining.
121
-
122
- > Two more tools — `squad_status` (query the session pool) and `squad_skill` (read/write compressed learnings) — round out the coordination layer. See the [full docs](https://github.com/bradygaster/squad#the-custom-tools) for details.
123
-
124
- ---
125
-
126
- ## Hook Pipeline
127
-
128
- Rules don't live in prompts. They run as code, before tools execute.
129
-
130
- ### File-Write Guards
131
-
132
- ```typescript
133
- const pipeline = new HookPipeline({
134
- allowedWritePaths: ['src/**/*.ts', '.squad/**', 'docs/**'],
135
- });
136
-
137
- // An agent tries to write to /etc/passwd
138
- // → Blocked. "File write blocked: '/etc/passwd' does not match allowed paths"
139
- ```
140
-
141
- No agent — compromised or confused — can write outside your safe zones. Not because you asked nicely in the prompt. Because code won't let them.
142
-
143
- ### PII Scrubbing
144
-
145
- ```typescript
146
- const pipeline = new HookPipeline({
147
- scrubPii: true,
148
- });
149
-
150
- // Agent logs: "contact brady@example.com about deploy"
151
- // Output becomes: "contact [EMAIL_REDACTED] about deploy"
152
- ```
153
-
154
- Sensitive data never escapes. Automatic, invisible to the agent, applied to every tool output.
155
-
156
- ### Reviewer Lockout
157
-
158
- ```typescript
159
- const lockout = pipeline.getReviewerLockout();
160
- lockout.lockout('src/auth.ts', 'Backend');
161
-
162
- // Backend tries to re-write auth.ts after a review rejection
163
- // → Blocked. "Agent 'Backend' is locked out of artifact 'src/auth.ts'"
164
- ```
165
-
166
- When a reviewer says "no," it sticks. The original author can't sneak a fix in. Protocol enforced by code, not convention.
167
-
168
- ### Ask-User Rate Limiter
169
-
170
- ```typescript
171
- const pipeline = new HookPipeline({
172
- maxAskUserPerSession: 3,
173
- });
174
-
175
- // Fourth attempt to prompt the user → Blocked.
176
- // "ask_user rate limit exceeded: 3/3 calls used. Proceed without user input."
177
- ```
178
-
179
- Agents don't stall waiting for you. They decide or move on.
180
-
181
- ---
182
-
183
- ## Persistent Sessions & Crash Recovery
184
-
185
- Sessions aren't ephemeral. They're durable objects that survive failures.
186
-
187
- ```typescript
188
- const session = await client.createSession({
189
- agentName: 'Backend',
190
- task: 'Implement user auth endpoints',
191
- persistPath: '.squad/sessions/backend-auth-001.json',
192
- });
193
-
194
- // Agent dies mid-work — network hiccup, model timeout, anything.
195
- // Later:
196
-
197
- const resumed = await client.resumeSession(
198
- '.squad/sessions/backend-auth-001.json'
199
- );
200
-
201
- // Backend wakes up knowing:
202
- // - What the task was
203
- // - What it already wrote
204
- // - Where it left off
205
- // No repetition, no lost context.
206
- ```
207
-
208
- ---
209
-
210
- ## The Casting Engine
211
-
212
- Agents aren't `role-1`, `role-2`. They have names, personalities, and persistent identities across sessions. The casting engine assigns them automatically from a thematic universe.
213
-
214
- ```typescript
215
- const casting = new CastingEngine({
216
- universe: 'usual-suspects',
217
- agentCount: 5,
218
- });
219
-
220
- const cast = casting.castTeam({
221
- roles: ['lead', 'frontend', 'backend', 'tester', 'scribe'],
222
- });
223
- // → [
224
- // { role: 'lead', agentName: 'Keaton' },
225
- // { role: 'frontend', agentName: 'McManus' },
226
- // { role: 'backend', agentName: 'Verbal' },
227
- // { role: 'tester', agentName: 'Fenster' },
228
- // { role: 'scribe', agentName: 'Kobayashi' },
229
- // ]
230
- ```
231
-
232
- Names are memorable ("Keaton handles routing"), persistent (same name every session), and extensible (add a sixth agent — the casting engine picks the next name from the universe). You build a relationship with your agents over time.
233
-
234
- ---
235
-
236
- ## Event-Driven Monitoring
237
-
238
- Ralph is the built-in work monitor — a persistent agent session that subscribes to everything happening on the team.
239
-
240
- ```typescript
241
- const ralph = new RalphMonitor({
242
- teamRoot: '.squad',
243
- healthCheckInterval: 30000,
244
- statePath: '.squad/ralph-state.json',
245
- });
246
-
247
- ralph.subscribe('agent:task-complete', (event) => {
248
- console.log(`✅ ${event.agentName} finished: ${event.task}`);
249
- });
250
-
251
- ralph.subscribe('agent:error', (event) => {
252
- console.log(`❌ ${event.agentName} failed: ${event.error}`);
253
- });
254
-
255
- await ralph.start();
256
- ```
257
-
258
- When agents complete work, record decisions, or hit errors — Ralph knows. If an agent crashes, Ralph remembers where it left off.
259
-
260
- ---
261
-
262
- ## API Reference
263
-
264
- | Module | Key Exports | Purpose |
265
- |--------|------------|---------|
266
- | `resolution` | `resolveSquad()`, `resolveGlobalSquadPath()`, `ensureSquadPath()` | Find `.squad/` directory; platform-specific global path; path validation |
267
- | `config` | `loadConfig()`, `loadConfigSync()` | Load and parse squad configuration from disk |
268
- | `agents` | Agent onboarding utilities | Register and initialize agents; manage team discovery |
269
- | `casting` | `CastingEngine` | Universe selection, name allocation, persistent registry |
270
- | `skills` | Skills system | SKILL.md lifecycle, confidence levels |
271
- | `coordinator` | `selectResponseTier()`, `getTier()` | Route requests to Direct/Lightweight/Standard/Full tiers |
272
- | `runtime` | Streaming pipeline, cost tracker, telemetry | Core async execution, event streaming, i18n |
273
- | `cli` | `checkForUpdate()`, `performUpgrade()` | SDK version management and update checking |
274
- | `marketplace` | Plugin marketplace | Discover and manage plugins |
275
-
276
- ---
277
-
278
- ## Requirements
279
-
280
- - **Node.js** ≥ 20.0.0
281
- - **TypeScript** ≥ 5.0
282
- - **ESM-only** — no CommonJS. Set `"type": "module"` in your `package.json`.
283
-
284
- ---
285
-
286
- ## Links
287
-
288
- - **Repository:** [github.com/bradygaster/squad](https://github.com/bradygaster/squad)
289
- - **CLI package:** [@bradygaster/squad-cli](https://www.npmjs.com/package/@bradygaster/squad-cli)
290
- - **Issues:** [github.com/bradygaster/squad/issues](https://github.com/bradygaster/squad/issues)
291
-
292
- ---
293
-
294
- ## License
295
-
296
- MIT
1
+ # @bradygaster/squad-sdk
2
+
3
+ **Programmable multi-agent runtime for GitHub Copilot.** Build AI teams that persist, learn, and coordinate — with real governance, not vibes.
4
+
5
+ [![Status](https://img.shields.io/badge/status-production-brightgreen)](#requirements)
6
+ [![Node](https://img.shields.io/badge/node-%E2%89%A520-green)](#requirements)
7
+ [![ESM](https://img.shields.io/badge/module-ESM--only-blue)](#requirements)
8
+
9
+ ---
10
+
11
+ ## Install
12
+
13
+ ```bash
14
+ npm install @bradygaster/squad-sdk
15
+ ```
16
+
17
+ ---
18
+
19
+ ## What Makes This Different
20
+
21
+ Most multi-agent setups are prompt engineering. You write a wall of text describing who each agent is, what they can do, and hope the model follows the rules. It works — until it doesn't. Agents ignore routing. They write files they shouldn't. They leak data. There's no enforcement, just suggestions.
22
+
23
+ Squad's SDK moves orchestration out of prompts and into code:
24
+
25
+ **Prompt-only orchestration** stuffs everything into a single context window. The coordinator is text. Agents read it, interpret it, maybe follow it.
26
+
27
+ ```
28
+ Prompt says:
29
+ "If the agent is Backend, route auth tasks to it."
30
+ Agent reads it (consumes tokens), decides what to do (might ignore it).
31
+ ```
32
+
33
+ **SDK orchestration** compiles rules into typed functions. Sessions are objects. Routing is deterministic. Tools are validated before execution.
34
+
35
+ ```typescript
36
+ Router.matchRoute(message) → { agent: 'Backend', priority: 'high' }
37
+ // TypeScript knows exactly which agent runs, with what permissions.
38
+ // HookPipeline runs file-write guards BEFORE the tool executes.
39
+ // No interpretation. No ambiguity. Just code.
40
+ ```
41
+
42
+ ---
43
+
44
+ ## Architecture
45
+
46
+ ```
47
+ ┌─────────────────────────────────────────────┐
48
+ │ Your Code (TypeScript) │
49
+ │ - createSession(), spawnParallel() │
50
+ │ - SquadClient, EventBus, HookPipeline │
51
+ └─────────────────────────────────────────────┘
52
+
53
+ ┌─────────────────────────────────────────────┐
54
+ │ Agent Orchestration Runtime │
55
+ │ - Router (matchRoute, compileRoutingRules) │
56
+ │ - Charter Compiler (permissions, voice) │
57
+ │ - Tool Registry (squad_route, etc.) │
58
+ │ - Hook Pipeline (governance enforcement) │
59
+ └─────────────────────────────────────────────┘
60
+
61
+ ┌─────────────────────────────────────────────┐
62
+ │ Session Pool + Event Bus │
63
+ │ - Each agent gets a persistent session │
64
+ │ - Cross-session event pub/sub │
65
+ │ - Crash recovery via session state │
66
+ └─────────────────────────────────────────────┘
67
+
68
+ ┌─────────────────────────────────────────────┐
69
+ │ @github/copilot-sdk │
70
+ │ - Real-time agent streaming │
71
+ │ - Tool execution │
72
+ └─────────────────────────────────────────────┘
73
+ ```
74
+
75
+ Your code sits at the top. The runtime handles routing, permissions, and governance. Sessions are persistent and recoverable. Everything runs on top of the official Copilot SDK.
76
+
77
+ ---
78
+
79
+ ## Custom Tools
80
+
81
+ Five tools let agents coordinate without calling you back. Here are the three you'll reach for first.
82
+
83
+ ### `squad_route` — Hand off work between agents
84
+
85
+ ```typescript
86
+ const tool = toolRegistry.getTool('squad_route');
87
+ await tool.handler({
88
+ targetAgent: 'McManus',
89
+ task: 'Write a blog post on the new casting system',
90
+ priority: 'high',
91
+ context: 'Feature launches next week',
92
+ });
93
+ ```
94
+
95
+ The lead routes a task to DevRel. A new session is created, context is passed, and the task is queued with priority. No human in the loop.
96
+
97
+ ### `squad_decide` — Record a team decision
98
+
99
+ ```typescript
100
+ await tool.handler({
101
+ author: 'Keaton',
102
+ summary: 'Use PostgreSQL, not MongoDB',
103
+ body: 'Chose PostgreSQL for: (1) transactions, (2) team expertise, (3) JSONB flexibility.',
104
+ references: ['architecture-spike'],
105
+ });
106
+ ```
107
+
108
+ Writes to the shared decision log. Every agent reads decisions before working — one call propagates context to the entire team.
109
+
110
+ ### `squad_memory` — Teach an agent something permanent
111
+
112
+ ```typescript
113
+ await tool.handler({
114
+ agent: 'Frontend',
115
+ section: 'learnings',
116
+ content: 'Project uses Tailwind v4 with dark mode plugin. Config at .styles/theme.config.ts',
117
+ });
118
+ ```
119
+
120
+ Agents learn as they work. Next session, Frontend reads this and knows immediately. No context hunting, no re-explaining.
121
+
122
+ > Two more tools — `squad_status` (query the session pool) and `squad_skill` (read/write compressed learnings) — round out the coordination layer. See the [full docs](https://github.com/bradygaster/squad#the-custom-tools) for details.
123
+
124
+ ---
125
+
126
+ ## Hook Pipeline
127
+
128
+ Rules don't live in prompts. They run as code, before tools execute.
129
+
130
+ ### File-Write Guards
131
+
132
+ ```typescript
133
+ const pipeline = new HookPipeline({
134
+ allowedWritePaths: ['src/**/*.ts', '.squad/**', 'docs/**'],
135
+ });
136
+
137
+ // An agent tries to write to /etc/passwd
138
+ // → Blocked. "File write blocked: '/etc/passwd' does not match allowed paths"
139
+ ```
140
+
141
+ No agent — compromised or confused — can write outside your safe zones. Not because you asked nicely in the prompt. Because code won't let them.
142
+
143
+ ### PII Scrubbing
144
+
145
+ ```typescript
146
+ const pipeline = new HookPipeline({
147
+ scrubPii: true,
148
+ });
149
+
150
+ // Agent logs: "contact brady@example.com about deploy"
151
+ // Output becomes: "contact [EMAIL_REDACTED] about deploy"
152
+ ```
153
+
154
+ Sensitive data never escapes. Automatic, invisible to the agent, applied to every tool output.
155
+
156
+ ### Reviewer Lockout
157
+
158
+ ```typescript
159
+ const lockout = pipeline.getReviewerLockout();
160
+ lockout.lockout('src/auth.ts', 'Backend');
161
+
162
+ // Backend tries to re-write auth.ts after a review rejection
163
+ // → Blocked. "Agent 'Backend' is locked out of artifact 'src/auth.ts'"
164
+ ```
165
+
166
+ When a reviewer says "no," it sticks. The original author can't sneak a fix in. Protocol enforced by code, not convention.
167
+
168
+ ### Ask-User Rate Limiter
169
+
170
+ ```typescript
171
+ const pipeline = new HookPipeline({
172
+ maxAskUserPerSession: 3,
173
+ });
174
+
175
+ // Fourth attempt to prompt the user → Blocked.
176
+ // "ask_user rate limit exceeded: 3/3 calls used. Proceed without user input."
177
+ ```
178
+
179
+ Agents don't stall waiting for you. They decide or move on.
180
+
181
+ ---
182
+
183
+ ## Persistent Sessions & Crash Recovery
184
+
185
+ Sessions aren't ephemeral. They're durable objects that survive failures.
186
+
187
+ ```typescript
188
+ const session = await client.createSession({
189
+ agentName: 'Backend',
190
+ task: 'Implement user auth endpoints',
191
+ persistPath: '.squad/sessions/backend-auth-001.json',
192
+ });
193
+
194
+ // Agent dies mid-work — network hiccup, model timeout, anything.
195
+ // Later:
196
+
197
+ const resumed = await client.resumeSession(
198
+ '.squad/sessions/backend-auth-001.json'
199
+ );
200
+
201
+ // Backend wakes up knowing:
202
+ // - What the task was
203
+ // - What it already wrote
204
+ // - Where it left off
205
+ // No repetition, no lost context.
206
+ ```
207
+
208
+ ---
209
+
210
+ ## The Casting Engine
211
+
212
+ Agents aren't `role-1`, `role-2`. They have names, personalities, and persistent identities across sessions. The casting engine assigns them automatically from a thematic universe.
213
+
214
+ ```typescript
215
+ const casting = new CastingEngine({
216
+ universe: 'usual-suspects',
217
+ agentCount: 5,
218
+ });
219
+
220
+ const cast = casting.castTeam({
221
+ roles: ['lead', 'frontend', 'backend', 'tester', 'scribe'],
222
+ });
223
+ // → [
224
+ // { role: 'lead', agentName: 'Keaton' },
225
+ // { role: 'frontend', agentName: 'McManus' },
226
+ // { role: 'backend', agentName: 'Verbal' },
227
+ // { role: 'tester', agentName: 'Fenster' },
228
+ // { role: 'scribe', agentName: 'Kobayashi' },
229
+ // ]
230
+ ```
231
+
232
+ Names are memorable ("Keaton handles routing"), persistent (same name every session), and extensible (add a sixth agent — the casting engine picks the next name from the universe). You build a relationship with your agents over time.
233
+
234
+ ---
235
+
236
+ ## Event-Driven Monitoring
237
+
238
+ Ralph is the built-in work monitor — a persistent agent session that subscribes to everything happening on the team.
239
+
240
+ ```typescript
241
+ const ralph = new RalphMonitor({
242
+ teamRoot: '.squad',
243
+ healthCheckInterval: 30000,
244
+ statePath: '.squad/ralph-state.json',
245
+ });
246
+
247
+ ralph.subscribe('agent:task-complete', (event) => {
248
+ console.log(`✅ ${event.agentName} finished: ${event.task}`);
249
+ });
250
+
251
+ ralph.subscribe('agent:error', (event) => {
252
+ console.log(`❌ ${event.agentName} failed: ${event.error}`);
253
+ });
254
+
255
+ await ralph.start();
256
+ ```
257
+
258
+ When agents complete work, record decisions, or hit errors — Ralph knows. If an agent crashes, Ralph remembers where it left off.
259
+
260
+ ---
261
+
262
+ ## API Reference
263
+
264
+ | Module | Key Exports | Purpose |
265
+ |--------|------------|---------|
266
+ | `resolution` | `resolveSquad()`, `resolveGlobalSquadPath()`, `ensureSquadPath()` | Find `.squad/` directory; platform-specific global path; path validation |
267
+ | `config` | `loadConfig()`, `loadConfigSync()` | Load and parse squad configuration from disk |
268
+ | `agents` | Agent onboarding utilities | Register and initialize agents; manage team discovery |
269
+ | `casting` | `CastingEngine` | Universe selection, name allocation, persistent registry |
270
+ | `skills` | Skills system | SKILL.md lifecycle, confidence levels |
271
+ | `coordinator` | `selectResponseTier()`, `getTier()` | Route requests to Direct/Lightweight/Standard/Full tiers |
272
+ | `runtime` | Streaming pipeline, cost tracker, telemetry | Core async execution, event streaming, i18n |
273
+ | `cli` | `checkForUpdate()`, `performUpgrade()` | SDK version management and update checking |
274
+ | `marketplace` | Plugin marketplace | Discover and manage plugins |
275
+
276
+ ---
277
+
278
+ ## Requirements
279
+
280
+ - **Node.js** ≥ 20.0.0
281
+ - **TypeScript** ≥ 5.0
282
+ - **ESM-only** — no CommonJS. Set `"type": "module"` in your `package.json`.
283
+
284
+ ---
285
+
286
+ ## Links
287
+
288
+ - **Repository:** [github.com/bradygaster/squad](https://github.com/bradygaster/squad)
289
+ - **CLI package:** [@bradygaster/squad-cli](https://www.npmjs.com/package/@bradygaster/squad-cli)
290
+ - **Issues:** [github.com/bradygaster/squad/issues](https://github.com/bradygaster/squad/issues)
291
+
292
+ ---
293
+
294
+ ## License
295
+
296
+ MIT
@@ -101,36 +101,36 @@ export async function createHistoryShadow(teamRoot, agentName, initialContext) {
101
101
  }
102
102
  // Create initial shadow content
103
103
  const timestamp = new Date().toISOString();
104
- const initialContent = `# ${capitalize(agentName)} — Session History
105
-
106
- > **Shadow History**: Project-specific learnings for ${agentName} in this repository.
107
- > This file is separate from the agent's portable charter and captures session context.
108
-
109
- **Created:** ${timestamp}
110
-
111
- ## Context
112
-
113
- ${initialContext || 'No initial context provided.'}
114
-
115
- ## Learnings
116
-
117
- <!-- Add project-specific learnings here -->
118
-
119
- ## Decisions
120
-
121
- <!-- Record key decisions made by this agent -->
122
-
123
- ## Patterns
124
-
125
- <!-- Note recurring patterns observed -->
126
-
127
- ## Issues
128
-
129
- <!-- Track problems encountered and resolutions -->
130
-
131
- ## References
132
-
133
- <!-- Important files, documentation, or external resources -->
104
+ const initialContent = `# ${capitalize(agentName)} — Session History
105
+
106
+ > **Shadow History**: Project-specific learnings for ${agentName} in this repository.
107
+ > This file is separate from the agent's portable charter and captures session context.
108
+
109
+ **Created:** ${timestamp}
110
+
111
+ ## Context
112
+
113
+ ${initialContext || 'No initial context provided.'}
114
+
115
+ ## Learnings
116
+
117
+ <!-- Add project-specific learnings here -->
118
+
119
+ ## Decisions
120
+
121
+ <!-- Record key decisions made by this agent -->
122
+
123
+ ## Patterns
124
+
125
+ <!-- Note recurring patterns observed -->
126
+
127
+ ## Issues
128
+
129
+ <!-- Track problems encountered and resolutions -->
130
+
131
+ ## References
132
+
133
+ <!-- Important files, documentation, or external resources -->
134
134
  `;
135
135
  await fs.writeFile(shadowPath, initialContent, 'utf-8');
136
136
  return shadowPath;