@hailer/mcp 1.1.11 → 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 (252) hide show
  1. package/dist/app.js +18 -5
  2. package/dist/bot/bot-config.d.ts +12 -1
  3. package/dist/bot/bot-config.js +98 -14
  4. package/dist/bot/bot-manager.d.ts +13 -3
  5. package/dist/bot/bot-manager.js +80 -25
  6. package/dist/bot/bot.d.ts +46 -0
  7. package/dist/bot/bot.js +542 -166
  8. package/dist/bot/services/message-classifier.js +17 -0
  9. package/dist/bot/services/permission-guard.d.ts +52 -0
  10. package/dist/bot/services/permission-guard.js +149 -0
  11. package/dist/bot/services/types.d.ts +5 -0
  12. package/dist/bot/services/typing-indicator.d.ts +6 -1
  13. package/dist/bot/services/typing-indicator.js +19 -3
  14. package/dist/config.d.ts +6 -1
  15. package/dist/config.js +43 -0
  16. package/dist/core.js +3 -6
  17. package/dist/mcp/UserContextCache.d.ts +5 -0
  18. package/dist/mcp/UserContextCache.js +51 -19
  19. package/dist/mcp/hailer-clients.d.ts +19 -1
  20. package/dist/mcp/hailer-clients.js +157 -20
  21. package/dist/mcp/session-store.d.ts +68 -0
  22. package/dist/mcp/session-store.js +169 -0
  23. package/dist/mcp/signal-handler.js +12 -12
  24. package/dist/mcp/tool-registry.d.ts +17 -4
  25. package/dist/mcp/tool-registry.js +37 -7
  26. package/dist/mcp/tools/activity.js +99 -7
  27. package/dist/mcp/tools/app-scaffold.js +304 -336
  28. package/dist/mcp/tools/company.d.ts +9 -0
  29. package/dist/mcp/tools/company.js +88 -0
  30. package/dist/mcp/tools/discussion.js +68 -0
  31. package/dist/mcp/tools/workflow-permissions.d.ts +15 -0
  32. package/dist/mcp/tools/workflow-permissions.js +204 -0
  33. package/dist/mcp/tools/workflow.js +57 -18
  34. package/dist/mcp/utils/index.d.ts +2 -0
  35. package/dist/mcp/utils/index.js +12 -1
  36. package/dist/mcp/utils/role-utils.d.ts +74 -0
  37. package/dist/mcp/utils/role-utils.js +151 -0
  38. package/dist/mcp/utils/types.d.ts +43 -1
  39. package/dist/mcp/utils/types.js +14 -0
  40. package/dist/mcp/webhook-handler.d.ts +6 -0
  41. package/dist/mcp/webhook-handler.js +11 -0
  42. package/dist/mcp-server.d.ts +23 -2
  43. package/dist/mcp-server.js +639 -111
  44. package/dist/plugins/vipunen/client.d.ts +150 -0
  45. package/dist/plugins/vipunen/client.js +535 -0
  46. package/dist/plugins/vipunen/config/schema-config.json +19 -0
  47. package/dist/plugins/vipunen/config/schema-doc.json +22 -0
  48. package/dist/plugins/vipunen/index.d.ts +41 -0
  49. package/dist/plugins/vipunen/index.js +88 -0
  50. package/dist/plugins/vipunen/tools.d.ts +26 -0
  51. package/dist/plugins/vipunen/tools.js +501 -0
  52. package/package.json +2 -1
  53. package/.claude/.context-watchdog.json +0 -1
  54. package/.claude/.session-checked +0 -1
  55. package/.claude/CLAUDE.md +0 -370
  56. package/.claude/agents/agent-ada-skill-builder.md +0 -94
  57. package/.claude/agents/agent-alejandro-function-fields.md +0 -342
  58. package/.claude/agents/agent-bjorn-config-audit.md +0 -103
  59. package/.claude/agents/agent-builder-agent-creator.md +0 -130
  60. package/.claude/agents/agent-code-simplifier.md +0 -53
  61. package/.claude/agents/agent-dmitri-activity-crud.md +0 -159
  62. package/.claude/agents/agent-giuseppe-app-builder.md +0 -247
  63. package/.claude/agents/agent-gunther-mcp-tools.md +0 -39
  64. package/.claude/agents/agent-helga-workflow-config.md +0 -204
  65. package/.claude/agents/agent-igor-activity-mover-automation.md +0 -125
  66. package/.claude/agents/agent-ingrid-doc-templates.md +0 -261
  67. package/.claude/agents/agent-ivan-monolith.md +0 -154
  68. package/.claude/agents/agent-kenji-data-reader.md +0 -86
  69. package/.claude/agents/agent-lars-code-inspector.md +0 -102
  70. package/.claude/agents/agent-marco-mockup-builder.md +0 -110
  71. package/.claude/agents/agent-marcus-api-documenter.md +0 -323
  72. package/.claude/agents/agent-marketplace-publisher.md +0 -280
  73. package/.claude/agents/agent-marketplace-reviewer.md +0 -309
  74. package/.claude/agents/agent-permissions-handler.md +0 -208
  75. package/.claude/agents/agent-simple-writer.md +0 -48
  76. package/.claude/agents/agent-svetlana-code-review.md +0 -171
  77. package/.claude/agents/agent-tanya-test-runner.md +0 -333
  78. package/.claude/agents/agent-ui-designer.md +0 -100
  79. package/.claude/agents/agent-viktor-sql-insights.md +0 -212
  80. package/.claude/agents/agent-web-search.md +0 -55
  81. package/.claude/agents/agent-yevgeni-discussions.md +0 -45
  82. package/.claude/agents/agent-zara-zapier.md +0 -159
  83. package/.claude/commands/app-squad.md +0 -135
  84. package/.claude/commands/audit-squad.md +0 -158
  85. package/.claude/commands/autoplan.md +0 -563
  86. package/.claude/commands/cleanup-squad.md +0 -98
  87. package/.claude/commands/config-squad.md +0 -106
  88. package/.claude/commands/crud-squad.md +0 -87
  89. package/.claude/commands/data-squad.md +0 -97
  90. package/.claude/commands/debug-squad.md +0 -303
  91. package/.claude/commands/doc-squad.md +0 -65
  92. package/.claude/commands/handoff.md +0 -137
  93. package/.claude/commands/health.md +0 -49
  94. package/.claude/commands/help.md +0 -29
  95. package/.claude/commands/help:agents.md +0 -151
  96. package/.claude/commands/help:commands.md +0 -78
  97. package/.claude/commands/help:faq.md +0 -79
  98. package/.claude/commands/help:plugins.md +0 -50
  99. package/.claude/commands/help:skills.md +0 -93
  100. package/.claude/commands/help:tools.md +0 -75
  101. package/.claude/commands/hotfix-squad.md +0 -112
  102. package/.claude/commands/integration-squad.md +0 -82
  103. package/.claude/commands/janitor-squad.md +0 -167
  104. package/.claude/commands/learn-auto.md +0 -120
  105. package/.claude/commands/learn.md +0 -120
  106. package/.claude/commands/mcp-list.md +0 -27
  107. package/.claude/commands/onboard-squad.md +0 -140
  108. package/.claude/commands/plan-workspace.md +0 -732
  109. package/.claude/commands/prd.md +0 -130
  110. package/.claude/commands/project-status.md +0 -82
  111. package/.claude/commands/publish.md +0 -138
  112. package/.claude/commands/recap.md +0 -69
  113. package/.claude/commands/restore.md +0 -64
  114. package/.claude/commands/review-squad.md +0 -152
  115. package/.claude/commands/save.md +0 -24
  116. package/.claude/commands/stats.md +0 -19
  117. package/.claude/commands/swarm.md +0 -210
  118. package/.claude/commands/tool-builder.md +0 -39
  119. package/.claude/commands/ws-pull.md +0 -44
  120. package/.claude/hooks/_shared-memory.cjs +0 -305
  121. package/.claude/hooks/_utils.cjs +0 -108
  122. package/.claude/hooks/agent-failure-detector.cjs +0 -383
  123. package/.claude/hooks/agent-usage-logger.cjs +0 -204
  124. package/.claude/hooks/app-edit-guard.cjs +0 -494
  125. package/.claude/hooks/auto-learn.cjs +0 -304
  126. package/.claude/hooks/bash-guard.cjs +0 -272
  127. package/.claude/hooks/builder-mode-manager.cjs +0 -354
  128. package/.claude/hooks/bulk-activity-guard.cjs +0 -271
  129. package/.claude/hooks/context-watchdog.cjs +0 -230
  130. package/.claude/hooks/delegation-reminder.cjs +0 -465
  131. package/.claude/hooks/design-system-lint.cjs +0 -271
  132. package/.claude/hooks/post-scaffold-hook.cjs +0 -181
  133. package/.claude/hooks/prompt-guard.cjs +0 -354
  134. package/.claude/hooks/publish-template-guard.cjs +0 -147
  135. package/.claude/hooks/session-start.cjs +0 -35
  136. package/.claude/hooks/shared-memory-writer.cjs +0 -147
  137. package/.claude/hooks/skill-injector.cjs +0 -140
  138. package/.claude/hooks/skill-usage-logger.cjs +0 -258
  139. package/.claude/hooks/src-edit-guard.cjs +0 -240
  140. package/.claude/hooks/sync-marketplace-agents.cjs +0 -346
  141. package/.claude/settings.json +0 -257
  142. package/.claude/skills/SDK-activity-patterns/SKILL.md +0 -428
  143. package/.claude/skills/SDK-document-templates/SKILL.md +0 -1033
  144. package/.claude/skills/SDK-function-fields/SKILL.md +0 -542
  145. package/.claude/skills/SDK-generate-skill/SKILL.md +0 -92
  146. package/.claude/skills/SDK-init-skill/SKILL.md +0 -127
  147. package/.claude/skills/SDK-insight-queries/SKILL.md +0 -787
  148. package/.claude/skills/SDK-ws-config-skill/SKILL.md +0 -1139
  149. package/.claude/skills/agent-structure/SKILL.md +0 -98
  150. package/.claude/skills/api-documentation-patterns/SKILL.md +0 -474
  151. package/.claude/skills/chrome-mcp-reference/SKILL.md +0 -370
  152. package/.claude/skills/delegation-routing/SKILL.md +0 -202
  153. package/.claude/skills/frontend-design/SKILL.md +0 -254
  154. package/.claude/skills/hailer-activity-mover/SKILL.md +0 -213
  155. package/.claude/skills/hailer-api-client/SKILL.md +0 -518
  156. package/.claude/skills/hailer-app-builder/SKILL.md +0 -1434
  157. package/.claude/skills/hailer-apps-pictures/SKILL.md +0 -269
  158. package/.claude/skills/hailer-design-system/SKILL.md +0 -235
  159. package/.claude/skills/hailer-monolith-automations/SKILL.md +0 -686
  160. package/.claude/skills/hailer-permissions-system/SKILL.md +0 -121
  161. package/.claude/skills/hailer-project-protocol/SKILL.md +0 -488
  162. package/.claude/skills/hailer-rest-api/SKILL.md +0 -61
  163. package/.claude/skills/hailer-rest-api/hailer-activities.md +0 -184
  164. package/.claude/skills/hailer-rest-api/hailer-admin.md +0 -473
  165. package/.claude/skills/hailer-rest-api/hailer-calendar.md +0 -256
  166. package/.claude/skills/hailer-rest-api/hailer-feed.md +0 -249
  167. package/.claude/skills/hailer-rest-api/hailer-insights.md +0 -195
  168. package/.claude/skills/hailer-rest-api/hailer-messaging.md +0 -276
  169. package/.claude/skills/hailer-rest-api/hailer-workflows.md +0 -283
  170. package/.claude/skills/insight-join-patterns/SKILL.md +0 -174
  171. package/.claude/skills/integration-patterns/SKILL.md +0 -421
  172. package/.claude/skills/json-only-output/SKILL.md +0 -72
  173. package/.claude/skills/lsp-setup/SKILL.md +0 -160
  174. package/.claude/skills/mcp-direct-tools/SKILL.md +0 -153
  175. package/.claude/skills/optional-parameters/SKILL.md +0 -72
  176. package/.claude/skills/publish-hailer-app/SKILL.md +0 -244
  177. package/.claude/skills/testing-patterns/SKILL.md +0 -630
  178. package/.claude/skills/tool-builder/SKILL.md +0 -250
  179. package/.claude/skills/tool-parameter-usage/SKILL.md +0 -126
  180. package/.claude/skills/tool-response-verification/SKILL.md +0 -92
  181. package/.claude/skills/zapier-hailer-patterns/SKILL.md +0 -581
  182. package/.hailer-mcp-port +0 -1
  183. package/.mcp.json +0 -13
  184. package/.opencode/agent/agent-ada-skill-builder.md +0 -35
  185. package/.opencode/agent/agent-alejandro-function-fields.md +0 -39
  186. package/.opencode/agent/agent-bjorn-config-audit.md +0 -36
  187. package/.opencode/agent/agent-builder-agent-creator.md +0 -39
  188. package/.opencode/agent/agent-code-simplifier.md +0 -31
  189. package/.opencode/agent/agent-dmitri-activity-crud.md +0 -40
  190. package/.opencode/agent/agent-giuseppe-app-builder.md +0 -37
  191. package/.opencode/agent/agent-gunther-mcp-tools.md +0 -39
  192. package/.opencode/agent/agent-helga-workflow-config.md +0 -204
  193. package/.opencode/agent/agent-igor-activity-mover-automation.md +0 -46
  194. package/.opencode/agent/agent-ingrid-doc-templates.md +0 -39
  195. package/.opencode/agent/agent-ivan-monolith.md +0 -46
  196. package/.opencode/agent/agent-kenji-data-reader.md +0 -53
  197. package/.opencode/agent/agent-lars-code-inspector.md +0 -28
  198. package/.opencode/agent/agent-marco-mockup-builder.md +0 -42
  199. package/.opencode/agent/agent-marcus-api-documenter.md +0 -53
  200. package/.opencode/agent/agent-marketplace-publisher.md +0 -44
  201. package/.opencode/agent/agent-marketplace-reviewer.md +0 -42
  202. package/.opencode/agent/agent-permissions-handler.md +0 -50
  203. package/.opencode/agent/agent-simple-writer.md +0 -45
  204. package/.opencode/agent/agent-svetlana-code-review.md +0 -39
  205. package/.opencode/agent/agent-tanya-test-runner.md +0 -57
  206. package/.opencode/agent/agent-ui-designer.md +0 -56
  207. package/.opencode/agent/agent-viktor-sql-insights.md +0 -34
  208. package/.opencode/agent/agent-web-search.md +0 -42
  209. package/.opencode/agent/agent-yevgeni-discussions.md +0 -37
  210. package/.opencode/agent/agent-zara-zapier.md +0 -53
  211. package/.opencode/commands/app-squad.md +0 -135
  212. package/.opencode/commands/audit-squad.md +0 -158
  213. package/.opencode/commands/autoplan.md +0 -563
  214. package/.opencode/commands/cleanup-squad.md +0 -98
  215. package/.opencode/commands/config-squad.md +0 -106
  216. package/.opencode/commands/crud-squad.md +0 -87
  217. package/.opencode/commands/data-squad.md +0 -97
  218. package/.opencode/commands/debug-squad.md +0 -303
  219. package/.opencode/commands/doc-squad.md +0 -65
  220. package/.opencode/commands/handoff.md +0 -137
  221. package/.opencode/commands/health.md +0 -49
  222. package/.opencode/commands/help-agents.md +0 -151
  223. package/.opencode/commands/help-commands.md +0 -32
  224. package/.opencode/commands/help-faq.md +0 -29
  225. package/.opencode/commands/help-plugins.md +0 -28
  226. package/.opencode/commands/help-skills.md +0 -7
  227. package/.opencode/commands/help-tools.md +0 -40
  228. package/.opencode/commands/help.md +0 -28
  229. package/.opencode/commands/hotfix-squad.md +0 -112
  230. package/.opencode/commands/integration-squad.md +0 -82
  231. package/.opencode/commands/janitor-squad.md +0 -167
  232. package/.opencode/commands/learn-auto.md +0 -120
  233. package/.opencode/commands/learn.md +0 -120
  234. package/.opencode/commands/mcp-list.md +0 -27
  235. package/.opencode/commands/onboard-squad.md +0 -140
  236. package/.opencode/commands/plan-workspace.md +0 -732
  237. package/.opencode/commands/prd.md +0 -131
  238. package/.opencode/commands/project-status.md +0 -82
  239. package/.opencode/commands/publish.md +0 -138
  240. package/.opencode/commands/recap.md +0 -69
  241. package/.opencode/commands/restore.md +0 -64
  242. package/.opencode/commands/review-squad.md +0 -152
  243. package/.opencode/commands/save.md +0 -24
  244. package/.opencode/commands/stats.md +0 -19
  245. package/.opencode/commands/swarm.md +0 -210
  246. package/.opencode/commands/tool-builder.md +0 -39
  247. package/.opencode/commands/ws-pull.md +0 -44
  248. package/.opencode/opencode.json +0 -21
  249. package/inbox/failures.log +0 -1
  250. package/inbox/usage.jsonl +0 -4
  251. package/scripts/postinstall.cjs +0 -64
  252. 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
- };