@hailer/mcp 1.1.12 → 1.1.13

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 (271) hide show
  1. package/CHANGELOG.md +0 -7
  2. package/{.claude → dist}/CLAUDE.md +2 -2
  3. package/dist/app.js +18 -5
  4. package/dist/bot/bot-config.d.ts +10 -1
  5. package/dist/bot/bot-config.js +64 -3
  6. package/dist/bot/bot-manager.d.ts +2 -0
  7. package/dist/bot/bot-manager.js +9 -2
  8. package/dist/bot/bot.d.ts +33 -0
  9. package/dist/bot/bot.js +461 -160
  10. package/dist/bot/services/message-classifier.js +17 -0
  11. package/dist/bot/services/permission-guard.d.ts +52 -0
  12. package/dist/bot/services/permission-guard.js +149 -0
  13. package/dist/bot/services/types.d.ts +5 -0
  14. package/dist/bot/services/typing-indicator.d.ts +6 -1
  15. package/dist/bot/services/typing-indicator.js +19 -3
  16. package/dist/cli.js +0 -0
  17. package/dist/config.d.ts +6 -1
  18. package/dist/config.js +43 -0
  19. package/dist/core.js +3 -6
  20. package/dist/lib/discussion-lock.d.ts +42 -0
  21. package/dist/lib/discussion-lock.js +110 -0
  22. package/dist/mcp/UserContextCache.d.ts +5 -0
  23. package/dist/mcp/UserContextCache.js +51 -19
  24. package/dist/mcp/hailer-clients.d.ts +19 -1
  25. package/dist/mcp/hailer-clients.js +158 -24
  26. package/dist/mcp/session-store.d.ts +68 -0
  27. package/dist/mcp/session-store.js +169 -0
  28. package/dist/mcp/signal-handler.js +2 -0
  29. package/dist/mcp/tool-registry.d.ts +17 -4
  30. package/dist/mcp/tool-registry.js +37 -7
  31. package/dist/mcp/tools/activity.js +99 -7
  32. package/dist/mcp/tools/app-scaffold.js +304 -336
  33. package/dist/mcp/tools/bot-config/constants.d.ts +23 -0
  34. package/dist/mcp/tools/bot-config/constants.js +94 -0
  35. package/dist/mcp/tools/bot-config/core.d.ts +253 -0
  36. package/dist/mcp/tools/bot-config/core.js +2456 -0
  37. package/dist/mcp/tools/bot-config/index.d.ts +10 -0
  38. package/dist/mcp/tools/bot-config/index.js +59 -0
  39. package/dist/mcp/tools/bot-config/tools.d.ts +7 -0
  40. package/dist/mcp/tools/bot-config/tools.js +15 -0
  41. package/dist/mcp/tools/bot-config/types.d.ts +50 -0
  42. package/dist/mcp/tools/bot-config/types.js +6 -0
  43. package/dist/mcp/tools/bug-fixer-tools.d.ts +45 -0
  44. package/dist/mcp/tools/bug-fixer-tools.js +1096 -0
  45. package/dist/mcp/tools/company.d.ts +9 -0
  46. package/dist/mcp/tools/company.js +88 -0
  47. package/dist/mcp/tools/discussion.js +68 -0
  48. package/dist/mcp/tools/document.d.ts +11 -0
  49. package/dist/mcp/tools/document.js +741 -0
  50. package/dist/mcp/tools/investigate.d.ts +9 -0
  51. package/dist/mcp/tools/investigate.js +254 -0
  52. package/dist/mcp/tools/workflow-permissions.d.ts +15 -0
  53. package/dist/mcp/tools/workflow-permissions.js +204 -0
  54. package/dist/mcp/tools/workflow.js +57 -18
  55. package/dist/mcp/utils/index.d.ts +2 -0
  56. package/dist/mcp/utils/index.js +12 -1
  57. package/dist/mcp/utils/role-utils.d.ts +74 -0
  58. package/dist/mcp/utils/role-utils.js +151 -0
  59. package/dist/mcp/utils/types.d.ts +43 -1
  60. package/dist/mcp/utils/types.js +14 -0
  61. package/dist/mcp/webhook-handler.d.ts +4 -0
  62. package/dist/mcp/webhook-handler.js +8 -0
  63. package/dist/mcp-server.d.ts +23 -2
  64. package/dist/mcp-server.js +639 -127
  65. package/dist/plugins/vipunen/client.d.ts +150 -0
  66. package/dist/plugins/vipunen/client.js +535 -0
  67. package/dist/plugins/vipunen/config/schema-config.json +19 -0
  68. package/dist/plugins/vipunen/config/schema-doc.json +22 -0
  69. package/dist/plugins/vipunen/index.d.ts +41 -0
  70. package/dist/plugins/vipunen/index.js +88 -0
  71. package/dist/plugins/vipunen/tools.d.ts +26 -0
  72. package/dist/plugins/vipunen/tools.js +501 -0
  73. package/dist/stdio-server.d.ts +14 -0
  74. package/dist/stdio-server.js +101 -0
  75. package/package.json +2 -1
  76. package/.claude/agents/agent-ada-skill-builder.md +0 -94
  77. package/.claude/agents/agent-alejandro-function-fields.md +0 -342
  78. package/.claude/agents/agent-bjorn-config-audit.md +0 -103
  79. package/.claude/agents/agent-builder-agent-creator.md +0 -130
  80. package/.claude/agents/agent-code-simplifier.md +0 -53
  81. package/.claude/agents/agent-dmitri-activity-crud.md +0 -159
  82. package/.claude/agents/agent-giuseppe-app-builder.md +0 -247
  83. package/.claude/agents/agent-gunther-mcp-tools.md +0 -39
  84. package/.claude/agents/agent-helga-workflow-config.md +0 -204
  85. package/.claude/agents/agent-igor-activity-mover-automation.md +0 -125
  86. package/.claude/agents/agent-ingrid-doc-templates.md +0 -261
  87. package/.claude/agents/agent-ivan-monolith.md +0 -154
  88. package/.claude/agents/agent-kenji-data-reader.md +0 -86
  89. package/.claude/agents/agent-lars-code-inspector.md +0 -102
  90. package/.claude/agents/agent-marco-mockup-builder.md +0 -110
  91. package/.claude/agents/agent-marcus-api-documenter.md +0 -323
  92. package/.claude/agents/agent-marketplace-publisher.md +0 -280
  93. package/.claude/agents/agent-marketplace-reviewer.md +0 -309
  94. package/.claude/agents/agent-permissions-handler.md +0 -208
  95. package/.claude/agents/agent-simple-writer.md +0 -48
  96. package/.claude/agents/agent-svetlana-code-review.md +0 -171
  97. package/.claude/agents/agent-tanya-test-runner.md +0 -333
  98. package/.claude/agents/agent-ui-designer.md +0 -100
  99. package/.claude/agents/agent-viktor-sql-insights.md +0 -212
  100. package/.claude/agents/agent-web-search.md +0 -55
  101. package/.claude/agents/agent-yevgeni-discussions.md +0 -45
  102. package/.claude/agents/agent-zara-zapier.md +0 -159
  103. package/.claude/commands/app-squad.md +0 -135
  104. package/.claude/commands/audit-squad.md +0 -158
  105. package/.claude/commands/autoplan.md +0 -563
  106. package/.claude/commands/cleanup-squad.md +0 -98
  107. package/.claude/commands/config-squad.md +0 -106
  108. package/.claude/commands/crud-squad.md +0 -87
  109. package/.claude/commands/data-squad.md +0 -97
  110. package/.claude/commands/debug-squad.md +0 -303
  111. package/.claude/commands/doc-squad.md +0 -65
  112. package/.claude/commands/handoff.md +0 -137
  113. package/.claude/commands/health.md +0 -49
  114. package/.claude/commands/help.md +0 -29
  115. package/.claude/commands/help:agents.md +0 -151
  116. package/.claude/commands/help:commands.md +0 -78
  117. package/.claude/commands/help:faq.md +0 -79
  118. package/.claude/commands/help:plugins.md +0 -50
  119. package/.claude/commands/help:skills.md +0 -93
  120. package/.claude/commands/help:tools.md +0 -75
  121. package/.claude/commands/hotfix-squad.md +0 -112
  122. package/.claude/commands/integration-squad.md +0 -82
  123. package/.claude/commands/janitor-squad.md +0 -167
  124. package/.claude/commands/learn-auto.md +0 -120
  125. package/.claude/commands/learn.md +0 -120
  126. package/.claude/commands/mcp-list.md +0 -27
  127. package/.claude/commands/onboard-squad.md +0 -140
  128. package/.claude/commands/plan-workspace.md +0 -732
  129. package/.claude/commands/prd.md +0 -130
  130. package/.claude/commands/project-status.md +0 -82
  131. package/.claude/commands/publish.md +0 -138
  132. package/.claude/commands/recap.md +0 -69
  133. package/.claude/commands/restore.md +0 -64
  134. package/.claude/commands/review-squad.md +0 -152
  135. package/.claude/commands/save.md +0 -24
  136. package/.claude/commands/stats.md +0 -19
  137. package/.claude/commands/swarm.md +0 -210
  138. package/.claude/commands/tool-builder.md +0 -39
  139. package/.claude/commands/ws-pull.md +0 -44
  140. package/.claude/hooks/_shared-memory.cjs +0 -305
  141. package/.claude/hooks/_utils.cjs +0 -108
  142. package/.claude/hooks/agent-failure-detector.cjs +0 -383
  143. package/.claude/hooks/agent-usage-logger.cjs +0 -204
  144. package/.claude/hooks/app-edit-guard.cjs +0 -494
  145. package/.claude/hooks/auto-learn.cjs +0 -304
  146. package/.claude/hooks/bash-guard.cjs +0 -272
  147. package/.claude/hooks/builder-mode-manager.cjs +0 -354
  148. package/.claude/hooks/bulk-activity-guard.cjs +0 -271
  149. package/.claude/hooks/context-watchdog.cjs +0 -230
  150. package/.claude/hooks/delegation-reminder.cjs +0 -465
  151. package/.claude/hooks/design-system-lint.cjs +0 -271
  152. package/.claude/hooks/post-scaffold-hook.cjs +0 -181
  153. package/.claude/hooks/prompt-guard.cjs +0 -354
  154. package/.claude/hooks/publish-template-guard.cjs +0 -147
  155. package/.claude/hooks/session-start.cjs +0 -35
  156. package/.claude/hooks/shared-memory-writer.cjs +0 -147
  157. package/.claude/hooks/skill-injector.cjs +0 -140
  158. package/.claude/hooks/skill-usage-logger.cjs +0 -258
  159. package/.claude/hooks/src-edit-guard.cjs +0 -240
  160. package/.claude/hooks/sync-marketplace-agents.cjs +0 -346
  161. package/.claude/settings.json +0 -257
  162. package/.claude/skills/SDK-activity-patterns/SKILL.md +0 -428
  163. package/.claude/skills/SDK-document-templates/SKILL.md +0 -1033
  164. package/.claude/skills/SDK-function-fields/SKILL.md +0 -542
  165. package/.claude/skills/SDK-generate-skill/SKILL.md +0 -92
  166. package/.claude/skills/SDK-init-skill/SKILL.md +0 -127
  167. package/.claude/skills/SDK-insight-queries/SKILL.md +0 -787
  168. package/.claude/skills/SDK-ws-config-skill/SKILL.md +0 -1139
  169. package/.claude/skills/agent-structure/SKILL.md +0 -98
  170. package/.claude/skills/api-documentation-patterns/SKILL.md +0 -474
  171. package/.claude/skills/chrome-mcp-reference/SKILL.md +0 -370
  172. package/.claude/skills/delegation-routing/SKILL.md +0 -202
  173. package/.claude/skills/frontend-design/SKILL.md +0 -254
  174. package/.claude/skills/hailer-activity-mover/SKILL.md +0 -213
  175. package/.claude/skills/hailer-api-client/SKILL.md +0 -518
  176. package/.claude/skills/hailer-app-builder/SKILL.md +0 -1434
  177. package/.claude/skills/hailer-apps-pictures/SKILL.md +0 -269
  178. package/.claude/skills/hailer-design-system/SKILL.md +0 -235
  179. package/.claude/skills/hailer-monolith-automations/SKILL.md +0 -686
  180. package/.claude/skills/hailer-permissions-system/SKILL.md +0 -121
  181. package/.claude/skills/hailer-project-protocol/SKILL.md +0 -488
  182. package/.claude/skills/hailer-rest-api/SKILL.md +0 -61
  183. package/.claude/skills/hailer-rest-api/hailer-activities.md +0 -184
  184. package/.claude/skills/hailer-rest-api/hailer-admin.md +0 -473
  185. package/.claude/skills/hailer-rest-api/hailer-calendar.md +0 -256
  186. package/.claude/skills/hailer-rest-api/hailer-feed.md +0 -249
  187. package/.claude/skills/hailer-rest-api/hailer-insights.md +0 -195
  188. package/.claude/skills/hailer-rest-api/hailer-messaging.md +0 -276
  189. package/.claude/skills/hailer-rest-api/hailer-workflows.md +0 -283
  190. package/.claude/skills/insight-join-patterns/SKILL.md +0 -174
  191. package/.claude/skills/integration-patterns/SKILL.md +0 -421
  192. package/.claude/skills/json-only-output/SKILL.md +0 -72
  193. package/.claude/skills/lsp-setup/SKILL.md +0 -160
  194. package/.claude/skills/mcp-direct-tools/SKILL.md +0 -153
  195. package/.claude/skills/optional-parameters/SKILL.md +0 -72
  196. package/.claude/skills/publish-hailer-app/SKILL.md +0 -244
  197. package/.claude/skills/testing-patterns/SKILL.md +0 -630
  198. package/.claude/skills/tool-builder/SKILL.md +0 -250
  199. package/.claude/skills/tool-parameter-usage/SKILL.md +0 -126
  200. package/.claude/skills/tool-response-verification/SKILL.md +0 -92
  201. package/.claude/skills/zapier-hailer-patterns/SKILL.md +0 -581
  202. package/.mcp.json +0 -13
  203. package/.opencode/agent/agent-ada-skill-builder.md +0 -35
  204. package/.opencode/agent/agent-alejandro-function-fields.md +0 -39
  205. package/.opencode/agent/agent-bjorn-config-audit.md +0 -36
  206. package/.opencode/agent/agent-builder-agent-creator.md +0 -39
  207. package/.opencode/agent/agent-code-simplifier.md +0 -31
  208. package/.opencode/agent/agent-dmitri-activity-crud.md +0 -40
  209. package/.opencode/agent/agent-giuseppe-app-builder.md +0 -37
  210. package/.opencode/agent/agent-gunther-mcp-tools.md +0 -39
  211. package/.opencode/agent/agent-helga-workflow-config.md +0 -203
  212. package/.opencode/agent/agent-igor-activity-mover-automation.md +0 -46
  213. package/.opencode/agent/agent-ingrid-doc-templates.md +0 -39
  214. package/.opencode/agent/agent-ivan-monolith.md +0 -46
  215. package/.opencode/agent/agent-kenji-data-reader.md +0 -53
  216. package/.opencode/agent/agent-lars-code-inspector.md +0 -28
  217. package/.opencode/agent/agent-marco-mockup-builder.md +0 -42
  218. package/.opencode/agent/agent-marcus-api-documenter.md +0 -53
  219. package/.opencode/agent/agent-marketplace-publisher.md +0 -44
  220. package/.opencode/agent/agent-marketplace-reviewer.md +0 -42
  221. package/.opencode/agent/agent-permissions-handler.md +0 -50
  222. package/.opencode/agent/agent-simple-writer.md +0 -45
  223. package/.opencode/agent/agent-svetlana-code-review.md +0 -39
  224. package/.opencode/agent/agent-tanya-test-runner.md +0 -57
  225. package/.opencode/agent/agent-ui-designer.md +0 -56
  226. package/.opencode/agent/agent-viktor-sql-insights.md +0 -34
  227. package/.opencode/agent/agent-web-search.md +0 -42
  228. package/.opencode/agent/agent-yevgeni-discussions.md +0 -37
  229. package/.opencode/agent/agent-zara-zapier.md +0 -53
  230. package/.opencode/commands/app-squad.md +0 -135
  231. package/.opencode/commands/audit-squad.md +0 -158
  232. package/.opencode/commands/autoplan.md +0 -563
  233. package/.opencode/commands/cleanup-squad.md +0 -98
  234. package/.opencode/commands/config-squad.md +0 -106
  235. package/.opencode/commands/crud-squad.md +0 -87
  236. package/.opencode/commands/data-squad.md +0 -97
  237. package/.opencode/commands/debug-squad.md +0 -303
  238. package/.opencode/commands/doc-squad.md +0 -65
  239. package/.opencode/commands/handoff.md +0 -137
  240. package/.opencode/commands/health.md +0 -49
  241. package/.opencode/commands/help-agents.md +0 -151
  242. package/.opencode/commands/help-commands.md +0 -32
  243. package/.opencode/commands/help-faq.md +0 -29
  244. package/.opencode/commands/help-plugins.md +0 -28
  245. package/.opencode/commands/help-skills.md +0 -7
  246. package/.opencode/commands/help-tools.md +0 -40
  247. package/.opencode/commands/help.md +0 -28
  248. package/.opencode/commands/hotfix-squad.md +0 -112
  249. package/.opencode/commands/integration-squad.md +0 -82
  250. package/.opencode/commands/janitor-squad.md +0 -167
  251. package/.opencode/commands/learn-auto.md +0 -120
  252. package/.opencode/commands/learn.md +0 -120
  253. package/.opencode/commands/mcp-list.md +0 -27
  254. package/.opencode/commands/onboard-squad.md +0 -140
  255. package/.opencode/commands/plan-workspace.md +0 -732
  256. package/.opencode/commands/prd.md +0 -131
  257. package/.opencode/commands/project-status.md +0 -82
  258. package/.opencode/commands/publish.md +0 -138
  259. package/.opencode/commands/recap.md +0 -69
  260. package/.opencode/commands/restore.md +0 -64
  261. package/.opencode/commands/review-squad.md +0 -152
  262. package/.opencode/commands/save.md +0 -24
  263. package/.opencode/commands/stats.md +0 -19
  264. package/.opencode/commands/swarm.md +0 -210
  265. package/.opencode/commands/tool-builder.md +0 -39
  266. package/.opencode/commands/ws-pull.md +0 -44
  267. package/.opencode/opencode.json +0 -28
  268. package/SESSION-HANDOFF.md +0 -68
  269. package/inbox/2026-03-04-bot-config-patterns.md +0 -24
  270. package/scripts/postinstall.cjs +0 -64
  271. package/scripts/test-hal-tools.ts +0 -154
@@ -1,210 +0,0 @@
1
- ---
2
- description: Orchestrator-driven parallel swarm for large-scale tasks
3
- argument-hint: "description of what to do across many items"
4
- allowed-tools: Task, Bash, Read, Glob
5
- ---
6
-
7
- # Swarm
8
-
9
- Orchestrator-driven parallel execution: analyze the task, discover work items, pick agents, split into chunks, dispatch workers, aggregate results.
10
-
11
- **Goal:** $ARGUMENTS
12
-
13
- ## Protocol
14
-
15
- ### Step 1: Analyze the Task
16
-
17
- Read `$ARGUMENTS` and determine:
18
-
19
- - **What needs to be done?** (review, edit, check, migrate, update, clean up)
20
- - **What are the work items?** (files, activities, workflows, agents, skills, configs)
21
- - **What scope?** (explicit path/glob from user, or infer from task description)
22
-
23
- If the scope is unclear, use Glob or Bash to discover items:
24
-
25
- ```
26
- # Files
27
- Glob("src/**/*.ts")
28
- Glob(".claude/agents/*.md")
29
- Glob("workspace/*/fields.ts")
30
-
31
- # Activities (use Kenji to count/list)
32
- Task(subagent_type="agent-kenji-data-reader", prompt="Count and list activity IDs for [workflow]")
33
- ```
34
-
35
- If fewer than 5 items are discovered, **abort swarm** and suggest running a regular squad or single agent instead. Swarm is for scale.
36
-
37
- ### Step 2: Pick Agent(s)
38
-
39
- Based on the task type, select the right agent(s):
40
-
41
- | Task Type | Agent | Examples |
42
- |-----------|-------|---------|
43
- | Code review, security audit | **Svetlana** | "review for bugs", "security check", "find vulnerabilities" |
44
- | Dead code, unused imports, type errors | **Lars** | "find dead code", "check types", "unused imports" |
45
- | Small edits, string replacements, rule additions | **Simple Writer** | "add header to each file", "replace X with Y", "update rule" |
46
- | Code cleanup, simplification | **Code Simplifier** | "clean up", "simplify", "refactor for clarity" |
47
- | Config audit, structure validation | **Bjorn** | "check config", "validate structure", "audit settings" |
48
- | Data state checks, field validation | **Kenji** | "check all activities", "verify field values", "find missing data" |
49
- | Query patterns, data analysis | **Viktor** | "analyze patterns", "find anomalies across workflows" |
50
- | Activity updates, bulk mutations | **Dmitri** | "update all activities", "move to phase", "set field values" |
51
-
52
- **Multi-agent swarms:** If the task spans multiple domains, assign different agent types to different items. For example, "clean up the project" might use Lars for `.ts` files, Bjorn for config files, and Code Simplifier for app components.
53
-
54
- ### Step 3: Calculate Workers
55
-
56
- ```
57
- items_count = total discovered items
58
- items_per_worker = 10 (default)
59
- max_workers = 5
60
-
61
- worker_count = min(ceil(items_count / items_per_worker), max_workers)
62
- ```
63
-
64
- Split items into `worker_count` chunks. Try to keep chunks roughly equal size.
65
-
66
- For multi-agent swarms, group items by agent type first, then chunk within each type.
67
-
68
- ### Step 4: Dispatch Workers
69
-
70
- Launch all workers in parallel using multiple Task tool calls in a single message. All workers run in background (`run_in_background: true`).
71
-
72
- Each worker gets:
73
-
74
- ```
75
- Task(subagent_type="[selected-agent]",
76
- run_in_background: true,
77
- prompt="SWARM WORKER [N] of [TOTAL]
78
-
79
- TASK: [User's description from $ARGUMENTS]
80
-
81
- YOUR ITEMS ([count]):
82
- - [item 1]
83
- - [item 2]
84
- - [item 3]
85
- ...
86
-
87
- Process each item and report results in this format:
88
-
89
- RESULTS:
90
- - [item]: [status] - [details]
91
- - [item]: [status] - [details]
92
-
93
- SUMMARY:
94
- - Processed: [count]
95
- - Passed: [count]
96
- - Issues found: [count]
97
- - Failed: [count]")
98
- ```
99
-
100
- Tell the user:
101
- ```
102
- Launched [worker_count] workers across [items_count] items.
103
- Running in background - what else do you want to work on?
104
- ```
105
-
106
- ### Step 5: Collect Results
107
-
108
- When workers complete (check via Read on output files or TaskOutput), aggregate all results.
109
-
110
- If any worker failed or timed out:
111
- - Report which items were in the failed worker's batch
112
- - Offer to retry just those items
113
-
114
- ### Step 6: Report
115
-
116
- ```markdown
117
- ## Swarm Report
118
-
119
- ### Task
120
- [User's description]
121
-
122
- ### Execution
123
- - **Items:** [total count]
124
- - **Workers:** [worker count] x [agent type(s)]
125
- - **Duration:** [time from dispatch to last worker completion]
126
-
127
- ---
128
-
129
- ### Results by Worker
130
-
131
- #### Worker 1 ([agent type]) - [X items]
132
- - [item]: [status] - [details]
133
- - [item]: [status] - [details]
134
- ...
135
-
136
- #### Worker 2 ([agent type]) - [X items]
137
- ...
138
-
139
- ---
140
-
141
- ### Aggregate Summary
142
-
143
- | Status | Count |
144
- |--------|-------|
145
- | Passed / Clean | X |
146
- | Issues Found | X |
147
- | Failed / Error | X |
148
-
149
- ### Issues Found
150
- [Grouped and deduplicated list of all issues across all workers]
151
-
152
- 1. **[item]**: [issue description]
153
- 2. **[item]**: [issue description]
154
- ...
155
-
156
- ### Failed Items
157
- [If any workers failed, list their items for retry]
158
-
159
- ### Next Steps
160
- - [Suggested follow-up based on results]
161
- - [If issues found: suggest /hotfix-squad or Simple Writer to fix]
162
- - [If edits made: suggest /review-squad to verify]
163
- ```
164
-
165
- ## Options
166
-
167
- | Flag | Effect |
168
- |------|--------|
169
- | `--workers=N` | Override worker count (default: auto-calculated, max 5) |
170
- | `--dry-run` | Show what would be dispatched without actually running |
171
- | `--no-bg` | Run workers in foreground (wait for all to complete) |
172
-
173
- ## Examples
174
-
175
- ```
176
- # Review all source files for security
177
- /swarm "review all TypeScript files in src/ for security vulnerabilities"
178
- → Discovers 47 .ts files, spawns 5 Svetlana workers
179
-
180
- # Bulk edit agent files
181
- /swarm "add a '## Version History' section to every agent file"
182
- → Discovers 27 agent .md files, spawns 3 Simple Writer workers
183
-
184
- # Validate workspace configs
185
- /swarm "check all workflow field definitions for missing descriptions"
186
- → Discovers 12 fields.ts files, spawns 2 Kenji workers
187
-
188
- # Multi-agent cleanup
189
- /swarm "clean up the entire apps/ directory"
190
- → Discovers 34 files: 20 .tsx → Code Simplifier, 8 .ts → Lars, 6 configs → Bjorn
191
- → Spawns 5 workers across 3 agent types
192
-
193
- # Data validation
194
- /swarm "verify all Customer activities have a valid email field"
195
- → Kenji counts 200 customers, spawns 5 Kenji workers (40 each)
196
-
197
- # Dry run to preview
198
- /swarm "update all skills to use consistent headers" --dry-run
199
- → Shows: "Would dispatch 4 Simple Writer workers across 32 skill files"
200
- ```
201
-
202
- ## Notes
203
-
204
- - Minimum 5 items to trigger swarm (below that, use a regular agent)
205
- - Default max 5 workers to avoid overwhelming the system
206
- - Workers run in background by default so user can keep working
207
- - Multi-agent swarms naturally emerge from the orchestrator's routing logic
208
- - For write operations (Dmitri, Simple Writer), consider running --dry-run first
209
- - Swarm vs Squad: Swarm is raw parallel execution without quality gates. Workers operate independently. Squads have convergence, synthesis, and loops. Use swarm for bulk independent items, squads for coordinated workflows.
210
- - Swarm + squad can combine: `/swarm "review src/"` finds issues, then user can run `/hotfix-squad` on results. This is a manual handoff - user confirms.
@@ -1,39 +0,0 @@
1
- ---
2
- description: Activate tool-builder mode to implement a new MCP tool
3
- ---
4
-
5
- # Tool Builder Mode
6
-
7
- Loading `tool-builder` skill for MCP tool patterns...
8
-
9
- **What tool should I build?**
10
-
11
- Please provide:
12
-
13
- - **Tool Name**: `tool_name` (snake_case)
14
- - **Purpose**: What does it do?
15
- - **API Endpoint**: `v3.endpoint.method`
16
- - **Request Format**: `[arg1, arg2]`
17
- - **Response Format**: What the API returns
18
- - **Target File**: Which file in `src/mcp/tools/`?
19
- - **Tool Group**: READ | WRITE | PLAYGROUND
20
-
21
- ---
22
-
23
- **Example:**
24
- ```
25
- Tool Name: list_insights
26
- Purpose: List all insights in workspace
27
- API Endpoint: v3.insight.list
28
- Request: [workspaceId]
29
- Response: { insights: [{_id, name, query, sources}] }
30
- Target File: insight.ts
31
- Tool Group: PLAYGROUND
32
- ```
33
-
34
- I'll:
35
- 1. Load tool-builder skill
36
- 2. Read existing patterns in target file
37
- 3. Implement the tool
38
- 4. Register in src/app.ts
39
- 5. Report what was created
@@ -1,44 +0,0 @@
1
- ---
2
- description: Pull workspace configuration from Hailer (READ-ONLY)
3
- ---
4
-
5
- Pull the current workspace configuration from Hailer and save it locally.
6
-
7
- **What this does:**
8
- - Downloads workflows, insights, teams, groups, and phases from Hailer workspace
9
- - Saves configuration as JSON files to the `WORKSPACE_CONFIG_PATH` directory
10
- - READ-ONLY operation - does not modify anything on Hailer
11
- - Safe to run anytime
12
-
13
- **Requirements:**
14
- - Must have `WORKSPACE_CONFIG_PATH` set in `.env.local`
15
- - Hailer credentials must be configured
16
-
17
- **Instructions for Claude:**
18
-
19
- 1. Read `.env.local` file to get `WORKSPACE_CONFIG_PATH`
20
- 2. Run: `cd "$WORKSPACE_CONFIG_PATH" && npm run pull`
21
- 3. **AUTOMATICALLY read the generated files to load context:**
22
- - Read `workspace/enums.ts` (complete file - contains ALL field and phase IDs)
23
- - List `workspace/` directory to see all workflow folders
24
- - Read 1-2 example workflow configs (main.ts, fields.ts, phases.ts) to understand structure
25
- 4. Provide summary of what workflows were pulled and confirm context is loaded
26
-
27
- **What gets downloaded:**
28
- - `workspace/enums.ts` - Type-safe field and phase ID enums for ALL workflows
29
- - `workspace/workflows.ts` - Main workflows export
30
- - `workspace/insights.ts` - SQL insight definitions
31
- - `workspace/teams.ts` - Team structures
32
- - `workspace/groups.ts` - User groups
33
- - `workspace/<workflow_name>/` - Individual workflow configs (main.ts, fields.ts, phases.ts)
34
-
35
- **Why automatic reading matters:**
36
- - Loads all field/phase IDs into conversation context immediately
37
- - Enables local-first strategy without manual file reads
38
- - Saves 75% of API calls and hundreds of tokens on subsequent operations
39
- - You'll know the workspace structure instantly
40
-
41
- **Common use cases:**
42
- - Backup current workspace configuration
43
- - Review workflow structures locally
44
- - Prepare for making configuration changes
@@ -1,305 +0,0 @@
1
- #!/usr/bin/env node
2
- /**
3
- * <hook-name>_shared-memory</hook-name>
4
- *
5
- * <purpose>
6
- * Shared memory utility for squad orchestration. Caches schema-level data
7
- * (workflow IDs, field definitions, phase lists) between squad runs to
8
- * eliminate redundant Kenji lookups.
9
- *
10
- * Orchestrator writes AND reads. Agents never touch shared memory directly.
11
- * </purpose>
12
- *
13
- * <usage>
14
- * As module:
15
- * const mem = require('./_shared-memory.cjs');
16
- * mem.set('workflow-schemas', data, 'agent-kenji-data-reader');
17
- * const cached = mem.get('workflow-schemas');
18
- *
19
- * As CLI:
20
- * node _shared-memory.cjs --get <key>
21
- * node _shared-memory.cjs --set <key> <json-file>
22
- * node _shared-memory.cjs --status
23
- * node _shared-memory.cjs --invalidate
24
- * node _shared-memory.cjs --help
25
- * </usage>
26
- */
27
-
28
- const fs = require('fs');
29
- const path = require('path');
30
- const crypto = require('crypto');
31
- const os = require('os');
32
-
33
- const DEFAULT_MAX_AGE_MS = 30 * 60 * 1000; // 30 minutes
34
- const STORE_VERSION = 1;
35
-
36
- function getProjectDir() {
37
- return process.env.CLAUDE_PROJECT_DIR || process.cwd();
38
- }
39
-
40
- function getStorePath() {
41
- return path.join(getProjectDir(), '.claude', '.shared-memory.json');
42
- }
43
-
44
- function getWorkspaceDir() {
45
- return path.join(getProjectDir(), 'workspace');
46
- }
47
-
48
- /**
49
- * MD5 hash of workspace/ directory listing for staleness detection.
50
- * Returns null if workspace/ doesn't exist.
51
- */
52
- function getWorkspaceHash() {
53
- const wsDir = getWorkspaceDir();
54
- if (!fs.existsSync(wsDir)) return null;
55
-
56
- try {
57
- const entries = [];
58
- collectEntries(wsDir, '', entries);
59
- entries.sort();
60
- return crypto.createHash('md5').update(entries.join('\n')).digest('hex');
61
- } catch {
62
- return null;
63
- }
64
- }
65
-
66
- function collectEntries(dir, prefix, entries, depth = 0) {
67
- if (depth > 10) return;
68
- const items = fs.readdirSync(dir, { withFileTypes: true });
69
- for (const item of items) {
70
- const rel = prefix ? `${prefix}/${item.name}` : item.name;
71
- if (item.isDirectory()) {
72
- entries.push(`d:${rel}`);
73
- collectEntries(path.join(dir, item.name), rel, entries, depth + 1);
74
- } else {
75
- const stat = fs.statSync(path.join(dir, item.name));
76
- entries.push(`f:${rel}:${stat.size}:${stat.mtimeMs}`);
77
- }
78
- }
79
- }
80
-
81
- /**
82
- * Validate store against current workspace hash and session.
83
- * Returns true if valid, false if invalidated.
84
- */
85
- function validateStore(store) {
86
- if (!store || store.version !== STORE_VERSION) return false;
87
-
88
- // Session check: invalidate if different session
89
- const currentSession = process.env.CLAUDE_SESSION_ID || '';
90
- if (currentSession && store.sessionId && store.sessionId !== currentSession) {
91
- return false;
92
- }
93
-
94
- // Workspace hash check
95
- const currentHash = getWorkspaceHash();
96
- if (currentHash && store.workspaceHash && store.workspaceHash !== currentHash) {
97
- return false;
98
- }
99
-
100
- return true;
101
- }
102
-
103
- /**
104
- * Load the shared memory store. Returns empty store if missing/invalid.
105
- */
106
- function load() {
107
- const storePath = getStorePath();
108
- try {
109
- if (fs.existsSync(storePath)) {
110
- const store = JSON.parse(fs.readFileSync(storePath, 'utf8'));
111
- if (validateStore(store)) return store;
112
- // Invalid store - return fresh
113
- }
114
- } catch {}
115
-
116
- return createEmptyStore();
117
- }
118
-
119
- function createEmptyStore() {
120
- return {
121
- version: STORE_VERSION,
122
- sessionId: process.env.CLAUDE_SESSION_ID || '',
123
- createdAt: new Date().toISOString(),
124
- workspaceHash: getWorkspaceHash(),
125
- entries: {}
126
- };
127
- }
128
-
129
- /**
130
- * Atomic save: write to temp file then rename.
131
- */
132
- function save(store) {
133
- const storePath = getStorePath();
134
- const dir = path.dirname(storePath);
135
-
136
- if (!fs.existsSync(dir)) {
137
- fs.mkdirSync(dir, { recursive: true });
138
- }
139
-
140
- const tmpPath = path.join(os.tmpdir(), `.shared-memory-${process.pid}-${Date.now()}.json`);
141
- fs.writeFileSync(tmpPath, JSON.stringify(store, null, 2));
142
- fs.renameSync(tmpPath, storePath);
143
- }
144
-
145
- /**
146
- * Get an entry by key. Returns null if missing or stale.
147
- */
148
- function get(key, maxAgeMs = DEFAULT_MAX_AGE_MS) {
149
- const store = load();
150
- const entry = store.entries[key];
151
- if (!entry) return null;
152
-
153
- if (isStale(key, maxAgeMs, store)) return null;
154
-
155
- return entry;
156
- }
157
-
158
- /**
159
- * Set an entry with metadata.
160
- */
161
- function set(key, data, writtenBy = 'orchestrator') {
162
- const store = load();
163
- store.entries[key] = {
164
- writtenAt: new Date().toISOString(),
165
- writtenBy,
166
- data
167
- };
168
- store.workspaceHash = getWorkspaceHash();
169
- save(store);
170
- }
171
-
172
- /**
173
- * Check if an entry is older than maxAge.
174
- */
175
- function isStale(key, maxAgeMs = DEFAULT_MAX_AGE_MS, store = null) {
176
- store = store || load();
177
- const entry = store.entries[key];
178
- if (!entry) return true;
179
-
180
- const age = Date.now() - new Date(entry.writtenAt).getTime();
181
- return age > maxAgeMs;
182
- }
183
-
184
- /**
185
- * Clear all entries.
186
- */
187
- function invalidate() {
188
- const storePath = getStorePath();
189
- try {
190
- if (fs.existsSync(storePath)) {
191
- fs.unlinkSync(storePath);
192
- }
193
- } catch {}
194
- }
195
-
196
- /**
197
- * Get status of all entries.
198
- */
199
- function status() {
200
- const store = load();
201
- const currentHash = getWorkspaceHash();
202
- const hashMatch = currentHash === store.workspaceHash;
203
-
204
- const entryStatus = {};
205
- for (const [key, entry] of Object.entries(store.entries)) {
206
- const age = Date.now() - new Date(entry.writtenAt).getTime();
207
- const ageMinutes = Math.round(age / 60000);
208
- entryStatus[key] = {
209
- writtenBy: entry.writtenBy,
210
- writtenAt: entry.writtenAt,
211
- ageMinutes,
212
- stale: age > DEFAULT_MAX_AGE_MS,
213
- dataKeys: entry.data ? Object.keys(entry.data) : []
214
- };
215
- }
216
-
217
- return {
218
- version: store.version,
219
- sessionId: store.sessionId,
220
- createdAt: store.createdAt,
221
- workspaceHash: store.workspaceHash,
222
- currentHash,
223
- hashMatch,
224
- entryCount: Object.keys(store.entries).length,
225
- entries: entryStatus
226
- };
227
- }
228
-
229
- // --- CLI interface ---
230
-
231
- if (require.main === module) {
232
- const args = process.argv.slice(2);
233
- const cmd = args[0];
234
-
235
- if (!cmd || cmd === '--help') {
236
- console.log(`Usage:
237
- node _shared-memory.cjs --get <key> Read entry (JSON to stdout)
238
- node _shared-memory.cjs --set <key> <file> Set entry from JSON file
239
- node _shared-memory.cjs --status Show all entries and ages
240
- node _shared-memory.cjs --invalidate Clear all entries
241
- node _shared-memory.cjs --help Show this help`);
242
- process.exit(0);
243
- }
244
-
245
- if (cmd === '--status') {
246
- console.log(JSON.stringify(status(), null, 2));
247
- process.exit(0);
248
- }
249
-
250
- if (cmd === '--invalidate') {
251
- invalidate();
252
- console.log('Shared memory invalidated.');
253
- process.exit(0);
254
- }
255
-
256
- if (cmd === '--get') {
257
- const key = args[1];
258
- if (!key) {
259
- console.error('Usage: --get <key>');
260
- process.exit(1);
261
- }
262
- const entry = get(key);
263
- if (entry) {
264
- console.log(JSON.stringify(entry, null, 2));
265
- } else {
266
- console.log('null');
267
- }
268
- process.exit(0);
269
- }
270
-
271
- if (cmd === '--set') {
272
- const key = args[1];
273
- const file = args[2];
274
- if (!key || !file) {
275
- console.error('Usage: --set <key> <json-file>');
276
- process.exit(1);
277
- }
278
- try {
279
- const data = JSON.parse(fs.readFileSync(file, 'utf8'));
280
- set(key, data, 'cli');
281
- console.log(`Set "${key}" from ${file}`);
282
- } catch (e) {
283
- console.error(`Error: ${e.message}`);
284
- process.exit(1);
285
- }
286
- process.exit(0);
287
- }
288
-
289
- console.error(`Unknown command: ${cmd}. Use --help for usage.`);
290
- process.exit(1);
291
- }
292
-
293
- // --- Exports ---
294
-
295
- module.exports = {
296
- load,
297
- save,
298
- get,
299
- set,
300
- isStale,
301
- invalidate,
302
- status,
303
- getWorkspaceHash,
304
- validateStore
305
- };
@@ -1,108 +0,0 @@
1
- #!/usr/bin/env node
2
- /**
3
- * Shared utilities for Claude Code hooks
4
- *
5
- * Usage:
6
- * const { readStdin, safeJsonParse, outputAllow } = require('./_utils.cjs');
7
- */
8
-
9
- const fs = require('fs');
10
-
11
- /**
12
- * Read stdin safely with TTY check (async)
13
- * @returns {Promise<string>} The stdin content or empty string if TTY
14
- */
15
- function readStdin() {
16
- return new Promise((resolve, reject) => {
17
- if (process.stdin.isTTY) {
18
- resolve('');
19
- return;
20
- }
21
- let data = '';
22
- process.stdin.setEncoding('utf8');
23
- process.stdin.on('data', chunk => data += chunk);
24
- process.stdin.on('end', () => resolve(data));
25
- process.stdin.on('error', reject);
26
- });
27
- }
28
-
29
- /**
30
- * Read stdin synchronously with TTY check
31
- * @returns {string} The stdin content or empty string if TTY
32
- */
33
- function readStdinSync() {
34
- if (process.stdin.isTTY) {
35
- return '';
36
- }
37
- return fs.readFileSync(0, 'utf8');
38
- }
39
-
40
- /**
41
- * Parse JSON safely, return null on failure
42
- * @param {string} str - JSON string to parse
43
- * @param {string} hookName - Hook name for error logging
44
- * @returns {object|null}
45
- */
46
- function safeJsonParse(str, hookName = 'hook') {
47
- try {
48
- return JSON.parse(str);
49
- } catch (e) {
50
- console.error(`[${hookName}] Failed to parse JSON: ${e.message}`);
51
- return null;
52
- }
53
- }
54
-
55
- /**
56
- * Output allow decision and exit
57
- * @param {string} [message] - Optional message to log to stderr
58
- */
59
- function outputAllow(message) {
60
- if (message) {
61
- console.error(message);
62
- }
63
- console.log(JSON.stringify({ decision: 'allow' }));
64
- process.exit(0);
65
- }
66
-
67
- /**
68
- * Output deny decision and exit
69
- * @param {string} reason - Reason for denial
70
- */
71
- function outputDeny(reason) {
72
- console.log(JSON.stringify({
73
- permissionDecision: 'deny',
74
- permissionDecisionReason: reason
75
- }));
76
- process.exit(0);
77
- }
78
-
79
- /**
80
- * Get project directory from environment
81
- * @returns {string}
82
- */
83
- function getProjectDir() {
84
- return process.env.CLAUDE_PROJECT_DIR || process.cwd();
85
- }
86
-
87
- /**
88
- * Check if a path exists
89
- * @param {string} filePath
90
- * @returns {boolean}
91
- */
92
- function fileExists(filePath) {
93
- try {
94
- return fs.existsSync(filePath);
95
- } catch {
96
- return false;
97
- }
98
- }
99
-
100
- module.exports = {
101
- readStdin,
102
- readStdinSync,
103
- safeJsonParse,
104
- outputAllow,
105
- outputDeny,
106
- getProjectDir,
107
- fileExists
108
- };