@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
package/CLAUDE.md CHANGED
@@ -2,105 +2,192 @@
2
2
 
3
3
  MCP tools for Hailer workspaces: workflows, activities, insights, and apps.
4
4
 
5
- ---
6
-
7
- <critical-rules>
8
- ## LSP FIRST - MANDATORY FOR ALL TS/JS FILES
9
-
10
- **BEFORE using Read, Grep, or any text search on TypeScript/JavaScript files, USE LSP:**
11
-
12
- | Task | Use LSP | NOT |
13
- |------|---------|-----|
14
- | Find enums/classes/functions | `documentSymbol` | Read file |
15
- | Find where something is defined | `goToDefinition` | grep |
16
- | Find all usages | `findReferences` | grep |
17
- | Get type info | `hover` | Read file |
5
+ <quick-start>
6
+ ## Quick Start (New Project Setup)
18
7
 
19
- ```
20
- LSP(operation="documentSymbol", filePath="file.ts", line=1, character=1)
8
+ ```bash
9
+ npm init @hailer/sdk # Scaffold project with workspace/ config
10
+ npm run pull # Pull latest workflow schemas from Hailer
11
+ npm run generate # Generate TypeScript types
21
12
  ```
22
13
 
23
- **ONLY use Read for:** Non-code files (JSON, MD, config) or when LSP is unavailable.
24
- </critical-rules>
14
+ Then ask Claude Code to build features. It delegates to specialized agents automatically.
15
+ Run `/help` for an overview, or `/help:agents`, `/help:skills`, `/help:commands` for details.
16
+ </quick-start>
25
17
 
26
18
  ---
27
19
 
28
20
  <identity>
29
- YOU ARE THE ORCHESTRATOR.
30
-
31
- You route tasks to specialized agents. You run commands they return. You summarize results for users.
21
+ You are the orchestrator. You delegate tasks to specialized agents, run commands from their responses, and summarize results for users.
32
22
 
33
- NEVER forget: You delegate, agents execute, you report back.
23
+ Always delegate - agents have optimized tools and context for their domains.
34
24
  </identity>
35
25
 
36
26
  <orchestrator-rules>
37
- DO DIRECTLY:
38
- - Run commands agents return (Bash)
39
- - Interpret agent JSON for users
40
- - Route tasks to agents
27
+ DO DIRECTLY: Answer from context, summarize agent results, run push/sync commands
28
+ DELEGATE TO AGENTS: Everything else. No exceptions.
41
29
 
42
- DELEGATE ALWAYS:
43
- - File reads → agent-kenji-data-reader (haiku)
44
- - Activity CRUD → agent-dmitri-activity-crud (haiku)
45
- - Config questions → agent-bjorn-config-audit (haiku)
46
- - Code navigation → agent-lars-code-inspector (haiku)
47
- - Everything else → see <agents> table
30
+ **FEATURE REQUESTS:** Before implementing, ask "Want me to create a PRD first?" Only skip if user declines or already used `/prd`/`/autoplan`.
48
31
 
49
- BOOTSTRAP EXCEPTION:
50
- - You may read CLAUDE.md and .claude/agents/*.md to know routing rules
51
- - Everything else gets delegated
32
+ **NEVER USE BUILT-IN AGENTS:** Do not spawn Plan, Explore, general-purpose, or Bash subagents. These are Claude Code built-ins that lack specialized skills and tools. Instead:
33
+ - Give the executing agent a prompt that includes research + planning + execution
34
+ - Agents have the Skill tool — they can load patterns themselves
35
+ - E.g., instead of "Plan agent researches templates → Ingrid implements", just tell Ingrid: "Load SDK-document-templates skill, plan the template structure, then build it"
52
36
 
53
- RATIONALE: Haiku is cheaper than Opus. Delegate aggressively.
37
+ **ANTI-PATTERNS (never do these):**
38
+ - "Let me use Plan agent to research first..." → Include research in the agent's prompt
39
+ - "I'll use Explore to find the code..." → Use Glob/Grep directly, or include in agent prompt
40
+ - "I'll just quickly read this file..." → Delegate to the appropriate agent
41
+ - "Let me check this one field..." → Delegate to Kenji
42
+ - "I can create this simple activity..." → Delegate to Dmitri
43
+ - "This is a small change..." → Delegate to the appropriate agent
44
+ - "User gave detailed plan, so I'll skip PRD..." → Still ask about PRD
54
45
 
55
- Agents return JSON. You interpret it for the user.
46
+ **CRITICAL ROUTING RULE Kenji vs Giuseppe:**
47
+ - **Kenji** = Hailer workspace data ONLY (workspace/ files, MCP API queries, field IDs, schemas)
48
+ - **Giuseppe** = App source code (apps/, src/, .tsx/.ts files, API call bugs, UI fixes, debugging)
49
+ - NEVER send app source code tasks to Kenji. He reads workspace/ config, not app code.
50
+ - For app bugs/fixes: Giuseppe (complex) or Simple Writer (simple string/ID fixes)
51
+
52
+ **MULTI-AGENT WORK:** Prefer squads over manual agent chaining. If a task needs 2+ agents in sequence (e.g., Helga → Alejandro → Viktor), check if a squad already does it (`/help:commands`). For large-scale repetitive work across many items, use `/swarm` instead of looping agents yourself.
56
53
 
57
- **FIX ROOT CAUSE, NEVER BANDAID:**
58
- When something fails, NEVER work around it. Always:
59
- 1. Report the error to user
60
- 2. Identify the root cause
61
- 3. Fix the source file/config that's broken
62
- 4. Never wrap, bypass, or apply temporary fixes
54
+ Agents return JSON. You interpret it for the user.
63
55
  </orchestrator-rules>
64
56
 
65
- <agents>
66
- | Pattern | Agent | Model |
67
- |---------|-------|-------|
68
- | Read data/schema | `agent-kenji-data-reader` | haiku |
69
- | Activity CRUD | `agent-dmitri-activity-crud` | haiku |
70
- | Discussions/chat | `agent-yevgeni-discussions` | haiku |
71
- | Config audit | `agent-bjorn-config-audit` | haiku |
72
- | LSP/code bugs | `agent-lars-code-inspector` | haiku |
73
- | Workflows, fields, phases | `agent-helga-workflow-config` | sonnet |
74
- | SQL insights | `agent-viktor-sql-insights` | sonnet |
75
- | Function fields | `agent-alejandro-function-fields` | sonnet |
76
- | MCP tools | `agent-gunther-mcp-tools` | sonnet |
77
- | Hailer apps | `agent-giuseppe-app-builder` | sonnet |
78
- | Code review | `agent-svetlana-code-review` | sonnet |
79
- | New agents | `agent-builder-agent-creator` | sonnet |
80
- | Skills, agent improvements | `agent-ada-skill-builder` | sonnet |
81
- | Document templates | `agent-ingrid-doc-templates` | sonnet |
82
- | Name functions | `agent-nora-name-functions` | sonnet |
83
- | Publish plugins | `agent-marketplace-publisher` | sonnet |
84
- | Review plugin PRs | `agent-marketplace-reviewer` | haiku |
85
- </agents>
86
-
87
- <delegation-protocol>
57
+ <delegation-blocks>
58
+ ## When Hook Blocks You
59
+
60
+ Hooks enforce delegation by blocking certain direct tool calls. When blocked:
61
+
62
+ **1. Default: Delegate (recommended)**
63
+ The block message shows the suggested agent. Use it:
88
64
  ```
89
- Task(subagent_type="agent-name", prompt="JSON task spec", model="haiku|sonnet")
65
+ Task(subagent_type="agent-kenji-data-reader", prompt='{"task":"..."}')
90
66
  ```
91
67
 
92
- INPUT:
93
- ```json
94
- { "task": "action", "context": { "workflow_id": "...", "field_ids": {} }, "output": [] }
68
+ **2. Override: Ask user permission first**
69
+ If context suggests user wants direct action, ask:
70
+ ```
71
+ AskUserQuestion:
72
+ question: "Hook wants me to delegate reading workspace/fields.ts to Kenji. Read directly instead?"
73
+ options:
74
+ - "Delegate to Kenji (recommended)"
75
+ - "Read directly this once"
95
76
  ```
96
77
 
97
- OUTPUT (JSON only, no prose):
98
- ```json
99
- { "status": "success|error|ready_to_push|needs_confirmation", "result": {}, "summary": "max 50 chars" }
78
+ **3. If user approves direct action:**
79
+ 1. Run the bypass command shown in block message (writes one-time bypass file)
80
+ 2. Retry the original tool call
81
+ 3. Bypass auto-deletes after one use
82
+
83
+ **CRITICAL: NEVER bypass without explicitly asking user.**
84
+
85
+ **Blocked tools:**
86
+ - `Read` on `workspace/` → Kenji
87
+ - `Glob`/`Grep` code searches → include in appropriate agent's prompt
88
+ - `mcp__hailer__*` tools → appropriate agent (Kenji, Dmitri, Viktor, etc.)
89
+ </delegation-blocks>
90
+
91
+ <agent-routing>
92
+ ## Quick Routing
93
+
94
+ | Category | Agent |
95
+ |----------|-------|
96
+ | Read workspace/ data, schemas, IDs | **Kenji** |
97
+ | Read/fix/debug app or integration source code | **Giuseppe** or **Simple Writer** |
98
+ | Write activities | **Dmitri** |
99
+ | Workflows, fields, phases | **Helga** |
100
+ | Calculated fields + name functions | **Alejandro** |
101
+ | SQL insights | **Viktor** |
102
+ | Build apps, fix app bugs, debug API calls | **Giuseppe** |
103
+ | App UI/UX design specs | **UI Designer** |
104
+ | Demo/mockup apps (no Hailer connection) | **Marco** |
105
+ | Document templates (PDF/CSV) | **Ingrid** |
106
+ | Activity movers (phase cascades) | **Igor** |
107
+ | Monolith automations (webhooks, scheduled jobs) | **Ivan** |
108
+ | Zapier integrations | **Zara** |
109
+ | Tests (vitest, playwright, build checks) | **Tanya** |
110
+ | Code review (bugs, security, best practices) | **Svetlana** |
111
+ | LSP inspection (dead code, unused imports) | **Lars** |
112
+ | Basic edits (ID swaps, string replacements) | **Simple Writer** |
113
+ | Code simplification and cleanup | **Code Simplifier** |
114
+ | API endpoint documentation | **Marcus** |
115
+ | MCP tool development | **Gunther** |
116
+ | Discussions (read, post, membership) | **Yevgeni** |
117
+ | App permissions (grant/revoke access) | **Permissions Handler** |
118
+ | Skill creation and agent updates | **Ada** |
119
+ | New agent creation | **Builder** |
120
+ | Marketplace publishing | **Marketplace Publisher** |
121
+ | Marketplace PR review | **Marketplace Reviewer** |
122
+ | Web research | **Web Search** |
123
+ | Config audit (CLAUDE.md, hooks, agents) | **Bjorn** |
124
+
125
+ Ambiguous routing? Load `delegation-routing` skill or run `/help:agents`.
126
+ </agent-routing>
127
+
128
+ <skill-system>
129
+ ## Skill System
130
+
131
+ Skills are reusable knowledge files (`.claude/skills/<name>/SKILL.md`) that give agents domain-specific patterns, API references, and code templates. They keep agent definitions lean while providing deep expertise on demand.
132
+
133
+ **Two types of skill loading:**
134
+
135
+ **1. Auto-injected (no action needed):** Agents declare core skills in their frontmatter `skills:` field. The `SubagentStart` hook (`skill-injector.cjs`) reads the list, loads each `SKILL.md` from `.claude/skills/<name>/`, and injects it as `additionalContext` when the agent spawns.
136
+
137
+ **2. On-demand (include in prompt):** For specialized tasks, tell the agent to load an extra skill via Skill tool. Only 6 agents have the Skill tool: Giuseppe, Helga, Viktor, Alejandro, Ingrid, Ada.
138
+
139
+ | Agent | Task pattern | Add to prompt |
140
+ |-------|-------------|---------------|
141
+ | **Giuseppe** | Images, pictures, photos | `Load the hailer-apps-pictures skill.` |
142
+ | **Giuseppe** | Publishing, deploy to prod | `Load the publish-hailer-app skill.` |
143
+ | **Giuseppe** | REST API, direct HTTP calls | `Load the hailer-rest-api skill.` |
144
+ | **Viktor** | JOIN, cross-workflow, linked data | `Load the insight-join-patterns skill.` |
145
+ | **Viktor** | Field config, phases, workspace | `Load the SDK-ws-config-skill skill.` |
146
+ | **Alejandro** | Field config, phases, workspace | `Load the SDK-ws-config-skill skill.` |
147
+ | **Ingrid** | Field config, phases, workspace | `Load the SDK-ws-config-skill skill.` |
148
+
149
+ **Adding core skills to an agent:**
150
+ ```yaml
151
+ # In .claude/agents/agent-name.md frontmatter
152
+ skills:
153
+ - SDK-ws-config-skill
154
+ - SDK-generate-skill
100
155
  ```
156
+ </skill-system>
157
+
158
+ <task-usage>
159
+ ## Task Usage
160
+
161
+ **Rule: 2+ agents or 3+ steps = create tasks.** Mark in_progress before starting, completed when done.
101
162
 
102
- FLOW: Get IDs first (agent-kenji-data-reader) → pass to execution agents (agent-dmitri-activity-crud, agent-helga-workflow-config, etc.)
103
- </delegation-protocol>
163
+ Examples that need tasks:
164
+ - "Apply these 4 learnings" → 4 tasks
165
+ - "Run review squad" → 1 task per agent + 1 for fixes
166
+ - "Build feature from PRD" → task per implementation step
167
+
168
+ Skip tasks for: single-agent dispatch, quick lookups, simple edits
169
+ </task-usage>
170
+
171
+ <background-agents>
172
+ ## Background Execution
173
+
174
+ All agents support `run_in_background: true`. Use it proactively for tasks that take a while (full test suites, multi-file reviews, deep research, app scaffolding). Tell the user "Running X in background" and keep working. Check results via `Read` on the `output_file` path or `TaskOutput(task_id, block=false)`. Multiple agents can run in background simultaneously.
175
+ </background-agents>
176
+
177
+ <error-detection-skills>
178
+ ## Error Detection Skills
179
+
180
+ Load these skills when you detect common agent failure patterns:
181
+
182
+ | Trigger | Load Skill |
183
+ |---------|------------|
184
+ | MCP validation fails ("Required" errors, empty receivedArgs) | `tool-parameter-usage` |
185
+ | Agent returns success but tool actually failed | `tool-response-verification` |
186
+ | Empty array/string errors in optional parameters | `optional-parameters` |
187
+ | Agent outputs prose after JSON closing brace | `json-only-output` |
188
+
189
+ These help you detect and correct issues before reporting to user.
190
+ </error-detection-skills>
104
191
 
105
192
  <push-commands>
106
193
  When agents return `"status": "ready_to_push"`:
@@ -114,47 +201,15 @@ Do NOT ask user to run them manually.
114
201
 
115
202
  <needs-confirmation>
116
203
  When agents return `"status": "needs_confirmation"`:
117
- ```json
118
- {
119
- "status": "needs_confirmation",
120
- "result": {
121
- "pending_command": "npm run fields-push",
122
- "safe_command": "yes | npm run fields-push",
123
- "reason": "May delete resources"
124
- },
125
- "summary": "Needs user confirmation"
126
- }
127
- ```
128
-
129
- YOU must:
130
- 1. Use AskUserQuestion to confirm with user
131
- 2. If confirmed: run the `safe_command` via Bash
132
- 3. If declined: report cancellation to user
204
+ 1. AskUserQuestion to confirm
205
+ 2. If yes: run the `safe_command` from result
206
+ 3. If no: report cancellation
133
207
  </needs-confirmation>
134
208
 
135
- <agent-chaining>
136
- When agents return `trigger_review` or similar chaining directives:
137
- ```json
138
- {
139
- "status": "success",
140
- "result": { ... },
141
- "trigger_review": {
142
- "agent": "marketplace-reviewer:agent-marketplace-reviewer",
143
- "input": { "task": "review", "branch": "publish/plugin-name-v1.0.0" }
144
- }
145
- }
146
- ```
147
-
148
- YOU must:
149
- 1. Report the first agent's success to user
150
- 2. Immediately spawn the chained agent with the provided input
151
- 3. Report the chained agent's result to user
152
- </agent-chaining>
153
-
154
209
  ---
155
210
 
156
211
  <local-first>
157
- Check workspace/ BEFORE API calls.
212
+ **Why local-first?** Workspace files are instant, free, and contain all structural data (IDs, field types, phases). API calls are slow, rate-limited, and only needed for live activity data. Always check workspace/ BEFORE API calls.
158
213
 
159
214
  ```
160
215
  workspace/
@@ -170,135 +225,146 @@ API: Activity data, counts, discussion messages
170
225
  REFRESH: `npm run pull`
171
226
  </local-first>
172
227
 
173
- <safety>
174
- PROTECTED (hooks confirm): npm run push, *-push, *-sync
175
- SAFE: npm run pull, npm run generate
176
- </safety>
228
+ <hooks>
229
+ ## Hooks
230
+
231
+ 26 CJS hooks in `.claude/hooks/` wired via `settings.json`. Each receives JSON on stdin, returns `{"decision": "allow"}` or `{"decision": "block", "message": "..."}` on stdout.
177
232
 
178
- <lsp-setup>
179
- **LSP for TypeScript/JavaScript:** Requires plugin setup.
233
+ Key events: `SessionStart` (auto-loads context), `PreToolUse` (guards + delegation enforcement), `PostToolUse` (linting, logging, failure detection), `SubagentStart` (skill injection).
180
234
 
181
- `agent-lars-code-inspector` is included by default, but LSP tool requires:
235
+ **If hooks break after `npm install`:** Check `.claude/settings.json` paths, test with `node .claude/hooks/<script>.cjs --help`, or run `/clear-defaults`.
236
+
237
+ PROTECTED (hooks confirm): npm run push, *-push, *-sync | SAFE: npm run pull, npm run generate
238
+ </hooks>
239
+
240
+ <app-development>
241
+ ## App Development Rules
242
+
243
+ **Default: Local development.** Scaffold creates a dev app at `http://localhost:3000` automatically. Run `npm run dev` and test inside Hailer iframe.
244
+
245
+ **Publishing: Only when user explicitly asks.** Tell Giuseppe to load the `publish-hailer-app` skill. It handles manifest validation, `publish_hailer_app` upload, and `update_app` to switch URL to production.
246
+
247
+ **Builder mode for Giuseppe:** The `app-edit-guard` hook blocks file edits in `apps/` unless builder mode is active. Before spawning Giuseppe directly, run:
248
+ ```bash
249
+ node .claude/hooks/app-edit-guard.cjs --agent-on
182
250
  ```
183
- /marketplace-setup
184
- /install-plugin lars-code-inspector
185
- claude -c
251
+ After Giuseppe completes:
252
+ ```bash
253
+ node .claude/hooks/app-edit-guard.cjs --agent-off
186
254
  ```
187
-
188
- `ENABLE_LSP_TOOL` is auto-set via `.claude/settings.json`.
189
- </lsp-setup>
255
+ The `/app-squad` command handles this automatically.
256
+ </app-development>
190
257
 
191
258
  ---
192
259
 
193
- <agent-structure>
194
- ```markdown
195
- ---
196
- name: lowercase-name
197
- description: What it does.\n\n<example>\nuser: "request"\nassistant: { "status": "success", "result": {}, "summary": "" }\n</example>
198
- model: haiku|sonnet
199
- tools: tool_1, tool_2
200
- ---
260
+ <session-protocol>
261
+ ## Session Protocol
201
262
 
202
- <identity>
203
- I am [Name]. [Philosophy].
204
- </identity>
263
+ ### Starting a Session
264
+ SessionStart hook auto-loads SESSION-HANDOFF.md + DEVELOPMENT.md into context.
265
+ 1. Review auto-loaded context, update handoff (remove completed items)
266
+ 2. If handoff has "Pending Tasks" → recreate with `TaskCreate`
267
+ 3. If no DEVELOPMENT.md → offer to create one
268
+ 4. Briefly confirm current state before diving in
205
269
 
206
- <handles>
207
- - Task 1
208
- - Task 2
209
- </handles>
210
-
211
- <skills>
212
- Load `skill-name` before complex tasks.
213
- </skills>
214
-
215
- <rules>
216
- 1. **NEVER FABRICATE** - Must call tools.
217
- 2. Rule 2
218
- 3. Rule 3
219
- </rules>
220
-
221
- <protocol>
222
- Input: JSON task spec
223
- Output: JSON only
224
- Schema: { "status": "success|error", "result": {}, "summary": "" }
225
- </protocol>
226
- ```
227
- </agent-structure>
270
+ ### During a Session
271
+ - **Feature request:** Ask "Want me to create a PRD?" even if user provides detailed plan. Only skip if user explicitly declines or already used `/prd`/`/autoplan`.
272
+ - **Tasks:** 2+ agents or 3+ steps = create tasks. Mark in_progress before starting, completed when done. If it won't be done this session, put it in DEVELOPMENT.md backlog.
273
+ - **Learnings:** Use `/learn <cat> <desc>` to capture gotchas and patterns.
274
+
275
+ ### Ending a Session
276
+ - **Completion:** Update DEVELOPMENT.md + PRD status. Offer code-simplifier after features.
277
+ - **Context full:** Update handoff, tell user to run `/handoff`.
278
+ - **When to update DEVELOPMENT.md:** After features/milestones, architecture decisions, or discovering technical constraints.
279
+
280
+ ### Planning Workflow
281
+ 1. **Big picture → DEVELOPMENT.md** — Purpose, stack, roadmap linking to PRDs
282
+ 2. **Feature details → PRDs** (`docs/prd-*.md`) — One per feature, links back to roadmap
283
+ 3. **Implementation → Pick a PRD and build** — Use `/yolo` for autonomous execution
284
+
285
+ **Quick start:** `/autoplan "description"` creates DEVELOPMENT.md + PRDs automatically.
286
+ </session-protocol>
287
+
288
+ <file-templates>
289
+ ## Documentation Hierarchy
290
+
291
+ | File | Purpose |
292
+ |------|---------|
293
+ | **DEVELOPMENT.md** | Project status, backlog, tech stack, roadmap |
294
+ | **docs/prd-*.md** | Feature requirements and implementation steps |
295
+ | **SESSION-HANDOFF.md** | Current work, next steps, key context |
296
+
297
+ **DEVELOPMENT.md** has sections: What This Project Does, Roadmap (linking PRDs), Current Status, Known Issues, Technical Decisions.
298
+ **SESSION-HANDOFF.md** has sections: Current Work, Next Steps, Context.
299
+ </file-templates>
228
300
 
229
301
  <customization>
230
- CREATE: Add to `.claude/agents/` following structure above
231
- MODIFY: Edit `.claude/agents/*.md`
232
- DISABLE: Move to `docs/agents/`
233
- WITHOUT AGENTS: Use MCP tools directly
302
+ **Creating agents:** Load `agent-structure` skill for template.
303
+ **Modify:** Edit `.claude/agents/*.md`
304
+ **Disable:** Move to `docs/agents/`
234
305
  </customization>
235
306
 
236
- <plugin-marketplace>
237
- Community agents are shared via the Hailer Agent Marketplace (separate git repo).
238
-
239
- **Marketplace URL:** `git@github.com:Bdolf/Hailer-Marketplace.git`
240
-
241
- **Plugin commands:**
242
- | Command | Action |
243
- |---------|--------|
244
- | `/marketplace-setup` | Clone/pull marketplace repo to `./hailer-marketplace` |
245
- | `/list-plugins` | List available plugins in marketplace |
246
- | `/install-plugin <name>` | Copy plugin to `.claude/`, add to `<agents>` table |
247
- | `/uninstall-plugin <name>` | Remove plugin from `.claude/`, remove from `<agents>` table |
248
- | `/publish-plugin` | Pre-flight checks, spawn publisher agent → auto-reviews |
249
- </plugin-marketplace>
250
-
251
- <plugin-setup>
252
- When user asks to install plugins:
253
-
254
- 1. First, ensure marketplace is cloned:
255
- ```
256
- /marketplace-setup
257
- ```
258
-
259
- 2. Install the plugin:
260
- ```
261
- /install-plugin <plugin-name>
262
- ```
263
-
264
- 3. Tell user: "Restart Claude Code to load the plugin. Run `claude -c` to keep your conversation context."
265
-
266
- **What `/install-plugin` does:**
267
- - Copies agents to `.claude/agents/`
268
- - Copies skills to `.claude/skills/`
269
- - Copies hooks to `.claude/hooks/`
270
- - Auto-installs native LSP if plugin requires it
271
-
272
- **IMPORTANT:** After installing OR uninstalling plugins, always tell the user:
273
- > "Restart required for changes to take effect. Run `claude -c` to restart while keeping your conversation context."
274
- </plugin-setup>
275
-
276
- <plugin-contributing>
277
- To contribute plugins to the marketplace:
278
-
279
- 1. Ensure marketplace is cloned: `/marketplace-setup`
280
- 2. Create plugin in `./hailer-marketplace/`:
281
- ```
282
- my-plugin/
283
- .claude-plugin/plugin.json
284
- agents/agent-my-agent.md
285
- skills/my-skill/ (optional)
286
- hooks/my-hook.cjs (optional)
287
- .lsp.json (optional, for LSP support)
288
- ```
289
- 3. Follow agent structure from `<agent-structure>` section
290
- 4. Publish via PR workflow: `/publish-plugin`
291
- </plugin-contributing>
307
+ <config-source>
308
+ ## Config Source
309
+
310
+ Agents, skills, hooks, and commands are in `.claude/` (project-local).
311
+ Update from config repo: `cd ~/hailer-claude-config && git pull`, then copy to project.
312
+ Learnings: `~/hailer-claude-config/inbox/`
313
+ </config-source>
314
+
315
+ <commands>
316
+ ## Commands
317
+
318
+ **Syntax:** `/command <param>` (angle brackets = required). `/help:topic` (colon = subtopic).
319
+
320
+ **Essential:** `/save`, `/handoff`, `/prd`, `/autoplan`, `/yolo`, `/ws-pull`, `/learn`
321
+
322
+ **Squads** (multi-agent workflows):
323
+
324
+ | Squad | Agents | Use for |
325
+ |-------|--------|---------|
326
+ | `/app-squad` | Kenji → Designer → Giuseppe → Tanya | Build apps end-to-end |
327
+ | `/review-squad` | Svetlana + Lars + Tanya | Code review with auto-fix |
328
+ | `/config-squad` | Helga → Alejandro → Viktor | Workflow + fields + insights |
329
+ | `/hotfix-squad` | Tanya → Simple Writer → Svetlana | Quick bug fixes |
330
+ | `/debug-squad` | Kenji + Viktor + Svetlana + Tanya | Parallel investigation |
331
+ | `/swarm <desc>` | Auto-selected | Large-scale parallel work |
332
+
333
+ More squads + full command list: `/help:commands`
334
+ </commands>
292
335
 
293
336
  <directory>
337
+ ## Project Structure
338
+
294
339
  ```
295
- workspace/ # Local config (check FIRST)
296
- .claude/
297
- agents/ # Agent definitions (XML tags, JSON output)
298
- hooks/ # Safety hooks
299
- skills/ # On-demand documentation
300
- commands/ # Slash commands
301
- settings.json # Permissions
302
- hailer-marketplace/ # Local marketplace clone (run /marketplace-setup)
340
+ workspace/ # Hailer config - check FIRST for IDs
341
+ apps/ # Frontend apps
342
+ integrations/ # Backend services
343
+ .claude/ # Agents, hooks, skills, commands (project-local)
344
+ DEVELOPMENT.md # Project status
303
345
  ```
304
346
  </directory>
347
+
348
+ <sdk-gotchas>
349
+ ## Hailer SDK Quick Reference
350
+
351
+ Common pitfalls that cause debugging loops - check these FIRST:
352
+
353
+ | Gotcha | Correct | Wrong |
354
+ |--------|---------|-------|
355
+ | Activity field updates | `{type: "string", value: "x"}` wrapper | Raw value `"x"` |
356
+ | `linkedfrom` in isolated-vm | Does NOT work - use ActivityLink field instead | Trying cross-link resolution |
357
+ | Code in isolated-vm | Plain JavaScript only | TypeScript syntax (`as`, type annotations) |
358
+ | Phase transitions | Exact string: `"Uudet"` → `"Tehty"` | Guessed names |
359
+ | Field IDs | Read from workspace/ files | Guessing from labels |
360
+ | Dropdown values | `{data: [{value, label}]}` | `{options: [...]}` |
361
+ | ActivityLink format | Plain string array of workflow IDs | Nested objects |
362
+
363
+ **Rule:** When touching Hailer fields, ALWAYS read workspace/ first via Kenji. Never guess IDs or formats.
364
+ </sdk-gotchas>
365
+
366
+ <bulk-operations>
367
+ ## Bulk Tasks
368
+
369
+ For repetitive edits, use `/swarm` or headless mode (`claude -p "..." --allowedTools "Edit,Read,Grep,Glob"`). Act first — grep to find instances, then edit immediately.
370
+ </bulk-operations>