@hailer/mcp 1.0.28 → 1.1.2

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 (233) hide show
  1. package/.claude/.session-checked +1 -0
  2. package/.claude/agents/agent-ada-skill-builder.md +10 -2
  3. package/.claude/agents/agent-alejandro-function-fields.md +104 -37
  4. package/.claude/agents/agent-bjorn-config-audit.md +41 -21
  5. package/.claude/agents/agent-builder-agent-creator.md +13 -3
  6. package/.claude/agents/agent-code-simplifier.md +53 -0
  7. package/.claude/agents/agent-dmitri-activity-crud.md +126 -11
  8. package/.claude/agents/agent-giuseppe-app-builder.md +212 -22
  9. package/.claude/agents/agent-gunther-mcp-tools.md +7 -36
  10. package/.claude/agents/agent-helga-workflow-config.md +75 -10
  11. package/.claude/agents/agent-igor-activity-mover-automation.md +125 -0
  12. package/.claude/agents/agent-ingrid-doc-templates.md +164 -36
  13. package/.claude/agents/agent-ivan-monolith.md +154 -0
  14. package/.claude/agents/agent-kenji-data-reader.md +15 -8
  15. package/.claude/agents/agent-lars-code-inspector.md +56 -8
  16. package/.claude/agents/agent-marco-mockup-builder.md +110 -0
  17. package/.claude/agents/agent-marcus-api-documenter.md +323 -0
  18. package/.claude/agents/agent-marketplace-publisher.md +232 -72
  19. package/.claude/agents/agent-marketplace-reviewer.md +255 -79
  20. package/.claude/agents/agent-permissions-handler.md +208 -0
  21. package/.claude/agents/agent-simple-writer.md +48 -0
  22. package/.claude/agents/agent-svetlana-code-review.md +127 -14
  23. package/.claude/agents/agent-tanya-test-runner.md +333 -0
  24. package/.claude/agents/agent-ui-designer.md +100 -0
  25. package/.claude/agents/agent-viktor-sql-insights.md +19 -6
  26. package/.claude/agents/agent-web-search.md +55 -0
  27. package/.claude/agents/agent-yevgeni-discussions.md +7 -1
  28. package/.claude/agents/agent-zara-zapier.md +159 -0
  29. package/.claude/commands/app-squad.md +135 -0
  30. package/.claude/commands/audit-squad.md +158 -0
  31. package/.claude/commands/autoplan.md +563 -0
  32. package/.claude/commands/cleanup-squad.md +98 -0
  33. package/.claude/commands/config-squad.md +106 -0
  34. package/.claude/commands/crud-squad.md +87 -0
  35. package/.claude/commands/data-squad.md +97 -0
  36. package/.claude/commands/debug-squad.md +303 -0
  37. package/.claude/commands/doc-squad.md +65 -0
  38. package/.claude/commands/handoff.md +137 -0
  39. package/.claude/commands/health.md +49 -0
  40. package/.claude/commands/help.md +2 -1
  41. package/.claude/commands/help:agents.md +96 -16
  42. package/.claude/commands/help:commands.md +55 -11
  43. package/.claude/commands/help:faq.md +16 -1
  44. package/.claude/commands/help:skills.md +93 -0
  45. package/.claude/commands/hotfix-squad.md +112 -0
  46. package/.claude/commands/integration-squad.md +82 -0
  47. package/.claude/commands/janitor-squad.md +167 -0
  48. package/.claude/commands/learn-auto.md +120 -0
  49. package/.claude/commands/learn.md +120 -0
  50. package/.claude/commands/mcp-list.md +27 -0
  51. package/.claude/commands/onboard-squad.md +140 -0
  52. package/.claude/commands/plan-workspace.md +732 -0
  53. package/.claude/commands/prd.md +131 -0
  54. package/.claude/commands/project-status.md +82 -0
  55. package/.claude/commands/publish.md +138 -0
  56. package/.claude/commands/recap.md +69 -0
  57. package/.claude/commands/restore.md +64 -0
  58. package/.claude/commands/review-squad.md +152 -0
  59. package/.claude/commands/save.md +24 -0
  60. package/.claude/commands/stats.md +19 -0
  61. package/.claude/commands/swarm.md +210 -0
  62. package/.claude/commands/tool-builder.md +3 -1
  63. package/.claude/commands/ws-pull.md +1 -1
  64. package/.claude/commands/yolo-off.md +17 -0
  65. package/.claude/commands/yolo.md +82 -0
  66. package/.claude/hooks/_shared-memory.cjs +305 -0
  67. package/.claude/hooks/_utils.cjs +134 -0
  68. package/.claude/hooks/agent-failure-detector.cjs +164 -79
  69. package/.claude/hooks/agent-usage-logger.cjs +204 -0
  70. package/.claude/hooks/app-edit-guard.cjs +20 -4
  71. package/.claude/hooks/auto-learn.cjs +316 -0
  72. package/.claude/hooks/bash-guard.cjs +282 -0
  73. package/.claude/hooks/builder-mode-manager.cjs +183 -54
  74. package/.claude/hooks/bulk-activity-guard.cjs +283 -0
  75. package/.claude/hooks/context-watchdog.cjs +292 -0
  76. package/.claude/hooks/delegation-reminder.cjs +478 -0
  77. package/.claude/hooks/design-system-lint.cjs +283 -0
  78. package/.claude/hooks/post-scaffold-hook.cjs +16 -3
  79. package/.claude/hooks/prompt-guard.cjs +366 -0
  80. package/.claude/hooks/publish-template-guard.cjs +16 -0
  81. package/.claude/hooks/session-start.cjs +35 -0
  82. package/.claude/hooks/shared-memory-writer.cjs +147 -0
  83. package/.claude/hooks/skill-injector.cjs +140 -0
  84. package/.claude/hooks/skill-usage-logger.cjs +258 -0
  85. package/.claude/hooks/src-edit-guard.cjs +16 -1
  86. package/.claude/hooks/sync-marketplace-agents.cjs +53 -8
  87. package/.claude/scripts/yolo-toggle.cjs +142 -0
  88. package/.claude/settings.json +141 -14
  89. package/.claude/skills/SDK-activity-patterns/SKILL.md +428 -0
  90. package/.claude/skills/SDK-document-templates/SKILL.md +1033 -0
  91. package/.claude/skills/SDK-function-fields/SKILL.md +542 -0
  92. package/.claude/skills/SDK-generate-skill/SKILL.md +92 -0
  93. package/.claude/skills/SDK-init-skill/SKILL.md +127 -0
  94. package/.claude/skills/SDK-insight-queries/SKILL.md +787 -0
  95. package/.claude/skills/SDK-ws-config-skill/SKILL.md +1139 -0
  96. package/.claude/skills/agent-structure/SKILL.md +98 -0
  97. package/.claude/skills/api-documentation-patterns/SKILL.md +474 -0
  98. package/.claude/skills/chrome-mcp-reference/SKILL.md +370 -0
  99. package/.claude/skills/delegation-routing/SKILL.md +202 -0
  100. package/.claude/skills/frontend-design/SKILL.md +254 -0
  101. package/.claude/skills/hailer-activity-mover/SKILL.md +213 -0
  102. package/.claude/skills/hailer-api-client/SKILL.md +518 -0
  103. package/.claude/skills/hailer-app-builder/SKILL.md +939 -11
  104. package/.claude/skills/hailer-apps-pictures/SKILL.md +269 -0
  105. package/.claude/skills/hailer-design-system/SKILL.md +235 -0
  106. package/.claude/skills/hailer-monolith-automations/SKILL.md +686 -0
  107. package/.claude/skills/hailer-permissions-system/SKILL.md +121 -0
  108. package/.claude/skills/hailer-project-protocol/SKILL.md +488 -0
  109. package/.claude/skills/hailer-rest-api/SKILL.md +61 -0
  110. package/.claude/skills/hailer-rest-api/hailer-activities.md +184 -0
  111. package/.claude/skills/hailer-rest-api/hailer-admin.md +473 -0
  112. package/.claude/skills/hailer-rest-api/hailer-calendar.md +256 -0
  113. package/.claude/skills/hailer-rest-api/hailer-feed.md +249 -0
  114. package/.claude/skills/hailer-rest-api/hailer-insights.md +195 -0
  115. package/.claude/skills/hailer-rest-api/hailer-messaging.md +276 -0
  116. package/.claude/skills/hailer-rest-api/hailer-workflows.md +283 -0
  117. package/.claude/skills/insight-join-patterns/SKILL.md +3 -0
  118. package/.claude/skills/integration-patterns/SKILL.md +421 -0
  119. package/.claude/skills/json-only-output/SKILL.md +52 -12
  120. package/.claude/skills/lsp-setup/SKILL.md +160 -0
  121. package/.claude/skills/mcp-direct-tools/SKILL.md +153 -0
  122. package/.claude/skills/optional-parameters/SKILL.md +32 -23
  123. package/.claude/skills/publish-hailer-app/SKILL.md +76 -12
  124. package/.claude/skills/testing-patterns/SKILL.md +630 -0
  125. package/.claude/skills/tool-builder/SKILL.md +250 -0
  126. package/.claude/skills/tool-parameter-usage/SKILL.md +59 -45
  127. package/.claude/skills/tool-response-verification/SKILL.md +82 -48
  128. package/.claude/skills/zapier-hailer-patterns/SKILL.md +581 -0
  129. package/.env.example +26 -7
  130. package/CLAUDE.md +290 -224
  131. package/dist/CLAUDE.md +370 -0
  132. package/dist/app.d.ts +1 -1
  133. package/dist/app.js +101 -101
  134. package/dist/bot/bot-config.d.ts +26 -0
  135. package/dist/bot/bot-config.js +135 -0
  136. package/dist/bot/bot-manager.d.ts +40 -0
  137. package/dist/bot/bot-manager.js +137 -0
  138. package/dist/bot/bot.d.ts +127 -0
  139. package/dist/bot/bot.js +1328 -0
  140. package/dist/bot/operation-logger.d.ts +28 -0
  141. package/dist/bot/operation-logger.js +132 -0
  142. package/dist/bot/services/conversation-manager.d.ts +60 -0
  143. package/dist/bot/services/conversation-manager.js +246 -0
  144. package/dist/bot/services/index.d.ts +9 -0
  145. package/dist/bot/services/index.js +18 -0
  146. package/dist/bot/services/message-classifier.d.ts +42 -0
  147. package/dist/bot/services/message-classifier.js +228 -0
  148. package/dist/bot/services/message-formatter.d.ts +88 -0
  149. package/dist/bot/services/message-formatter.js +411 -0
  150. package/dist/bot/services/session-logger.d.ts +162 -0
  151. package/dist/bot/services/session-logger.js +724 -0
  152. package/dist/bot/services/token-billing.d.ts +78 -0
  153. package/dist/bot/services/token-billing.js +233 -0
  154. package/dist/bot/services/types.d.ts +169 -0
  155. package/dist/bot/services/types.js +12 -0
  156. package/dist/bot/services/typing-indicator.d.ts +23 -0
  157. package/dist/bot/services/typing-indicator.js +60 -0
  158. package/dist/bot/services/workspace-schema-cache.d.ts +122 -0
  159. package/dist/bot/services/workspace-schema-cache.js +506 -0
  160. package/dist/bot/tool-executor.d.ts +28 -0
  161. package/dist/bot/tool-executor.js +48 -0
  162. package/dist/bot/workspace-overview.d.ts +12 -0
  163. package/dist/bot/workspace-overview.js +94 -0
  164. package/dist/cli.d.ts +1 -8
  165. package/dist/cli.js +1 -249
  166. package/dist/config.d.ts +96 -3
  167. package/dist/config.js +148 -37
  168. package/dist/core.d.ts +5 -0
  169. package/dist/core.js +61 -8
  170. package/dist/lib/discussion-lock.d.ts +42 -0
  171. package/dist/lib/discussion-lock.js +110 -0
  172. package/dist/lib/logger.d.ts +0 -1
  173. package/dist/lib/logger.js +39 -23
  174. package/dist/lib/request-logger.d.ts +77 -0
  175. package/dist/lib/request-logger.js +147 -0
  176. package/dist/mcp/UserContextCache.js +16 -13
  177. package/dist/mcp/hailer-clients.js +18 -17
  178. package/dist/mcp/signal-handler.js +29 -13
  179. package/dist/mcp/tool-registry.d.ts +4 -15
  180. package/dist/mcp/tool-registry.js +94 -32
  181. package/dist/mcp/tools/activity.js +28 -69
  182. package/dist/mcp/tools/app-core.js +9 -4
  183. package/dist/mcp/tools/app-marketplace.js +22 -12
  184. package/dist/mcp/tools/app-member.js +5 -2
  185. package/dist/mcp/tools/app-scaffold.js +32 -18
  186. package/dist/mcp/tools/bot-config/constants.d.ts +23 -0
  187. package/dist/mcp/tools/bot-config/constants.js +94 -0
  188. package/dist/mcp/tools/bot-config/core.d.ts +253 -0
  189. package/dist/mcp/tools/bot-config/core.js +2456 -0
  190. package/dist/mcp/tools/bot-config/index.d.ts +10 -0
  191. package/dist/mcp/tools/bot-config/index.js +59 -0
  192. package/dist/mcp/tools/bot-config/tools.d.ts +7 -0
  193. package/dist/mcp/tools/bot-config/tools.js +15 -0
  194. package/dist/mcp/tools/bot-config/types.d.ts +50 -0
  195. package/dist/mcp/tools/bot-config/types.js +6 -0
  196. package/dist/mcp/tools/discussion.js +107 -77
  197. package/dist/mcp/tools/document.d.ts +11 -0
  198. package/dist/mcp/tools/document.js +741 -0
  199. package/dist/mcp/tools/file.js +5 -2
  200. package/dist/mcp/tools/insight.js +36 -12
  201. package/dist/mcp/tools/investigate.d.ts +9 -0
  202. package/dist/mcp/tools/investigate.js +254 -0
  203. package/dist/mcp/tools/user.d.ts +2 -4
  204. package/dist/mcp/tools/user.js +9 -50
  205. package/dist/mcp/tools/workflow.d.ts +1 -0
  206. package/dist/mcp/tools/workflow.js +164 -52
  207. package/dist/mcp/utils/hailer-api-client.js +26 -17
  208. package/dist/mcp/webhook-handler.d.ts +64 -3
  209. package/dist/mcp/webhook-handler.js +219 -9
  210. package/dist/mcp-server.d.ts +4 -0
  211. package/dist/mcp-server.js +237 -25
  212. package/dist/plugins/bug-fixer/index.d.ts +2 -0
  213. package/dist/plugins/bug-fixer/index.js +18 -0
  214. package/dist/plugins/bug-fixer/tools.d.ts +45 -0
  215. package/dist/plugins/bug-fixer/tools.js +1096 -0
  216. package/package.json +10 -10
  217. package/scripts/test-hal-tools.ts +154 -0
  218. package/.claude/agents/agent-nora-name-functions.md +0 -123
  219. package/.claude/assistant-knowledge.md +0 -23
  220. package/.claude/commands/install-plugin.md +0 -261
  221. package/.claude/commands/list-plugins.md +0 -42
  222. package/.claude/commands/marketplace-setup.md +0 -33
  223. package/.claude/commands/publish-plugin.md +0 -55
  224. package/.claude/commands/uninstall-plugin.md +0 -87
  225. package/.claude/hooks/interactive-mode.cjs +0 -87
  226. package/.claude/hooks/mcp-server-guard.cjs +0 -108
  227. package/.claude/skills/marketplace-publishing.md +0 -155
  228. package/dist/bot/chat-bot.d.ts +0 -31
  229. package/dist/bot/chat-bot.js +0 -357
  230. package/dist/mcp/tools/metrics.d.ts +0 -13
  231. package/dist/mcp/tools/metrics.js +0 -546
  232. package/dist/stdio-server.d.ts +0 -14
  233. package/dist/stdio-server.js +0 -114
@@ -0,0 +1,210 @@
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.
@@ -2,7 +2,9 @@
2
2
  description: Activate tool-builder mode to implement a new MCP tool
3
3
  ---
4
4
 
5
- Load the `tool-builder` skill and enter tool-building mode.
5
+ # Tool Builder Mode
6
+
7
+ Loading `tool-builder` skill for MCP tool patterns...
6
8
 
7
9
  **What tool should I build?**
8
10
 
@@ -17,7 +17,7 @@ Pull the current workspace configuration from Hailer and save it locally.
17
17
  **Instructions for Claude:**
18
18
 
19
19
  1. Read `.env.local` file to get `WORKSPACE_CONFIG_PATH`
20
- 2. Run: `cd "$WORKSPACE_CONFIG_PATH" && npm run ws-pull`
20
+ 2. Run: `cd "$WORKSPACE_CONFIG_PATH" && npm run pull`
21
21
  3. **AUTOMATICALLY read the generated files to load context:**
22
22
  - Read `workspace/enums.ts` (complete file - contains ALL field and phase IDs)
23
23
  - List `workspace/` directory to see all workflow folders
@@ -0,0 +1,17 @@
1
+ ---
2
+ description: Disable yolo mode and restore normal permissions
3
+ ---
4
+ # Disable Yolo Mode
5
+
6
+ Run this command to disable yolo mode:
7
+
8
+ ```bash
9
+ node .claude/scripts/yolo-toggle.cjs off
10
+ ```
11
+
12
+ This will:
13
+ - Remove the permissive permissions added by yolo mode
14
+ - Restore normal confirmation prompts
15
+ - Delete the .yolo-mode marker file
16
+
17
+ Confirm when done: "Normal mode restored. Permission prompts re-enabled."
@@ -0,0 +1,82 @@
1
+ ---
2
+ description: Run autonomously without asking permission
3
+ argument-hint: <task to complete>
4
+ ---
5
+ # AUTONOMOUS MODE
6
+
7
+ Execute the following task without stopping to ask questions:
8
+
9
+ **Task:** $ARGUMENTS
10
+
11
+ ## Step 1: Enable yolo mode
12
+
13
+ Run this command to find and execute yolo-toggle:
14
+ ```bash
15
+ node .claude/scripts/yolo-toggle.cjs on
16
+ ```
17
+
18
+ ## Step 2: Create restore point (if git available)
19
+
20
+ If this is a git repository, run `/save "Before YOLO: $ARGUMENTS"` to create a restore point.
21
+ If no git, skip this step silently.
22
+
23
+ ## Step 3: Gather context first
24
+
25
+ Before writing any code:
26
+ 1. Read DEVELOPMENT.md to understand project state
27
+ 2. Read relevant PRD if one exists for this task
28
+ 3. Check workspace/ files if this is a Hailer project
29
+ 4. Understand existing patterns before creating new ones
30
+
31
+ **Don't skip context gathering** - autonomous doesn't mean blind.
32
+
33
+ ## Step 4: Execute the task
34
+
35
+ **Rules:**
36
+ 1. Make decisions yourself - don't ask for preferences
37
+ 2. Choose the most sensible option when multiple approaches exist
38
+ 3. Proceed through errors - try to fix them, only stop if truly stuck
39
+ 4. Complete the entire task before reporting back
40
+ 5. Use your best judgment for code style, naming, structure
41
+ 6. **ALWAYS delegate to agents** - Kenji reads, Dmitri writes, Giuseppe builds apps, etc.
42
+ Yolo = "agents work without permission prompts", NOT "orchestrator does everything".
43
+ The delegation-reminder hook ENFORCES this - it blocks direct tool use in yolo mode.
44
+
45
+ **Boundaries:**
46
+ - ONLY edit/create/delete files in the CURRENT PROJECT FOLDER
47
+ - You MAY read other projects for reference/context
48
+ - You MAY NOT edit, write, or modify anything outside this project
49
+
50
+ **Still requires confirmation:**
51
+ - Push commands (npm run push, fields-push, etc.) - safety hooks still active
52
+
53
+ ## Step 5: Context management
54
+
55
+ The **context-watchdog hook** monitors context automatically during yolo mode. It will:
56
+ - Warn you at ~20 agent calls (early heads-up)
57
+ - Warn urgently at ~35 agent calls (save progress now)
58
+ - Inject handoff instructions when auto-compaction fires (context IS full)
59
+ - Block you from stopping after compaction until handoff is written
60
+
61
+ **When you see a watchdog warning**, follow its instructions:
62
+ 1. Update DEVELOPMENT.md with current progress
63
+ 2. Write SESSION-HANDOFF.md with full state and next steps
64
+ 3. Run `/save` with progress description
65
+ 4. Tell user: "Context getting full. Run `/yolo` again to continue."
66
+
67
+ **Don't wait for the watchdog** if you notice the task is large - save progress proactively at natural breakpoints.
68
+
69
+ ## Step 6: When complete
70
+
71
+ 1. Update DEVELOPMENT.md with what was done
72
+ 2. If implementing a PRD, update its status (Draft → Complete) and check off completed items
73
+ 3. Run `/save` with completion description
74
+ 4. Disable yolo mode:
75
+ ```bash
76
+ node .claude/scripts/yolo-toggle.cjs off
77
+ ```
78
+ 5. Report summary of what was accomplished
79
+
80
+ ---
81
+
82
+ GO. Do the task end-to-end, then report what you did.
@@ -0,0 +1,305 @@
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
+ };