@hailer/mcp 1.1.12 → 1.1.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (271) hide show
  1. package/CHANGELOG.md +0 -7
  2. package/{.claude → dist}/CLAUDE.md +2 -2
  3. package/dist/app.js +18 -5
  4. package/dist/bot/bot-config.d.ts +10 -1
  5. package/dist/bot/bot-config.js +64 -3
  6. package/dist/bot/bot-manager.d.ts +2 -0
  7. package/dist/bot/bot-manager.js +9 -2
  8. package/dist/bot/bot.d.ts +33 -0
  9. package/dist/bot/bot.js +461 -160
  10. package/dist/bot/services/message-classifier.js +17 -0
  11. package/dist/bot/services/permission-guard.d.ts +52 -0
  12. package/dist/bot/services/permission-guard.js +149 -0
  13. package/dist/bot/services/types.d.ts +5 -0
  14. package/dist/bot/services/typing-indicator.d.ts +6 -1
  15. package/dist/bot/services/typing-indicator.js +19 -3
  16. package/dist/cli.js +0 -0
  17. package/dist/config.d.ts +6 -1
  18. package/dist/config.js +43 -0
  19. package/dist/core.js +3 -6
  20. package/dist/lib/discussion-lock.d.ts +42 -0
  21. package/dist/lib/discussion-lock.js +110 -0
  22. package/dist/mcp/UserContextCache.d.ts +5 -0
  23. package/dist/mcp/UserContextCache.js +51 -19
  24. package/dist/mcp/hailer-clients.d.ts +19 -1
  25. package/dist/mcp/hailer-clients.js +158 -24
  26. package/dist/mcp/session-store.d.ts +68 -0
  27. package/dist/mcp/session-store.js +169 -0
  28. package/dist/mcp/signal-handler.js +2 -0
  29. package/dist/mcp/tool-registry.d.ts +17 -4
  30. package/dist/mcp/tool-registry.js +37 -7
  31. package/dist/mcp/tools/activity.js +99 -7
  32. package/dist/mcp/tools/app-scaffold.js +304 -336
  33. package/dist/mcp/tools/bot-config/constants.d.ts +23 -0
  34. package/dist/mcp/tools/bot-config/constants.js +94 -0
  35. package/dist/mcp/tools/bot-config/core.d.ts +253 -0
  36. package/dist/mcp/tools/bot-config/core.js +2456 -0
  37. package/dist/mcp/tools/bot-config/index.d.ts +10 -0
  38. package/dist/mcp/tools/bot-config/index.js +59 -0
  39. package/dist/mcp/tools/bot-config/tools.d.ts +7 -0
  40. package/dist/mcp/tools/bot-config/tools.js +15 -0
  41. package/dist/mcp/tools/bot-config/types.d.ts +50 -0
  42. package/dist/mcp/tools/bot-config/types.js +6 -0
  43. package/dist/mcp/tools/bug-fixer-tools.d.ts +45 -0
  44. package/dist/mcp/tools/bug-fixer-tools.js +1096 -0
  45. package/dist/mcp/tools/company.d.ts +9 -0
  46. package/dist/mcp/tools/company.js +88 -0
  47. package/dist/mcp/tools/discussion.js +68 -0
  48. package/dist/mcp/tools/document.d.ts +11 -0
  49. package/dist/mcp/tools/document.js +741 -0
  50. package/dist/mcp/tools/investigate.d.ts +9 -0
  51. package/dist/mcp/tools/investigate.js +254 -0
  52. package/dist/mcp/tools/workflow-permissions.d.ts +15 -0
  53. package/dist/mcp/tools/workflow-permissions.js +204 -0
  54. package/dist/mcp/tools/workflow.js +57 -18
  55. package/dist/mcp/utils/index.d.ts +2 -0
  56. package/dist/mcp/utils/index.js +12 -1
  57. package/dist/mcp/utils/role-utils.d.ts +74 -0
  58. package/dist/mcp/utils/role-utils.js +151 -0
  59. package/dist/mcp/utils/types.d.ts +43 -1
  60. package/dist/mcp/utils/types.js +14 -0
  61. package/dist/mcp/webhook-handler.d.ts +4 -0
  62. package/dist/mcp/webhook-handler.js +8 -0
  63. package/dist/mcp-server.d.ts +23 -2
  64. package/dist/mcp-server.js +639 -127
  65. package/dist/plugins/vipunen/client.d.ts +150 -0
  66. package/dist/plugins/vipunen/client.js +535 -0
  67. package/dist/plugins/vipunen/config/schema-config.json +19 -0
  68. package/dist/plugins/vipunen/config/schema-doc.json +22 -0
  69. package/dist/plugins/vipunen/index.d.ts +41 -0
  70. package/dist/plugins/vipunen/index.js +88 -0
  71. package/dist/plugins/vipunen/tools.d.ts +26 -0
  72. package/dist/plugins/vipunen/tools.js +501 -0
  73. package/dist/stdio-server.d.ts +14 -0
  74. package/dist/stdio-server.js +101 -0
  75. package/package.json +2 -1
  76. package/.claude/agents/agent-ada-skill-builder.md +0 -94
  77. package/.claude/agents/agent-alejandro-function-fields.md +0 -342
  78. package/.claude/agents/agent-bjorn-config-audit.md +0 -103
  79. package/.claude/agents/agent-builder-agent-creator.md +0 -130
  80. package/.claude/agents/agent-code-simplifier.md +0 -53
  81. package/.claude/agents/agent-dmitri-activity-crud.md +0 -159
  82. package/.claude/agents/agent-giuseppe-app-builder.md +0 -247
  83. package/.claude/agents/agent-gunther-mcp-tools.md +0 -39
  84. package/.claude/agents/agent-helga-workflow-config.md +0 -204
  85. package/.claude/agents/agent-igor-activity-mover-automation.md +0 -125
  86. package/.claude/agents/agent-ingrid-doc-templates.md +0 -261
  87. package/.claude/agents/agent-ivan-monolith.md +0 -154
  88. package/.claude/agents/agent-kenji-data-reader.md +0 -86
  89. package/.claude/agents/agent-lars-code-inspector.md +0 -102
  90. package/.claude/agents/agent-marco-mockup-builder.md +0 -110
  91. package/.claude/agents/agent-marcus-api-documenter.md +0 -323
  92. package/.claude/agents/agent-marketplace-publisher.md +0 -280
  93. package/.claude/agents/agent-marketplace-reviewer.md +0 -309
  94. package/.claude/agents/agent-permissions-handler.md +0 -208
  95. package/.claude/agents/agent-simple-writer.md +0 -48
  96. package/.claude/agents/agent-svetlana-code-review.md +0 -171
  97. package/.claude/agents/agent-tanya-test-runner.md +0 -333
  98. package/.claude/agents/agent-ui-designer.md +0 -100
  99. package/.claude/agents/agent-viktor-sql-insights.md +0 -212
  100. package/.claude/agents/agent-web-search.md +0 -55
  101. package/.claude/agents/agent-yevgeni-discussions.md +0 -45
  102. package/.claude/agents/agent-zara-zapier.md +0 -159
  103. package/.claude/commands/app-squad.md +0 -135
  104. package/.claude/commands/audit-squad.md +0 -158
  105. package/.claude/commands/autoplan.md +0 -563
  106. package/.claude/commands/cleanup-squad.md +0 -98
  107. package/.claude/commands/config-squad.md +0 -106
  108. package/.claude/commands/crud-squad.md +0 -87
  109. package/.claude/commands/data-squad.md +0 -97
  110. package/.claude/commands/debug-squad.md +0 -303
  111. package/.claude/commands/doc-squad.md +0 -65
  112. package/.claude/commands/handoff.md +0 -137
  113. package/.claude/commands/health.md +0 -49
  114. package/.claude/commands/help.md +0 -29
  115. package/.claude/commands/help:agents.md +0 -151
  116. package/.claude/commands/help:commands.md +0 -78
  117. package/.claude/commands/help:faq.md +0 -79
  118. package/.claude/commands/help:plugins.md +0 -50
  119. package/.claude/commands/help:skills.md +0 -93
  120. package/.claude/commands/help:tools.md +0 -75
  121. package/.claude/commands/hotfix-squad.md +0 -112
  122. package/.claude/commands/integration-squad.md +0 -82
  123. package/.claude/commands/janitor-squad.md +0 -167
  124. package/.claude/commands/learn-auto.md +0 -120
  125. package/.claude/commands/learn.md +0 -120
  126. package/.claude/commands/mcp-list.md +0 -27
  127. package/.claude/commands/onboard-squad.md +0 -140
  128. package/.claude/commands/plan-workspace.md +0 -732
  129. package/.claude/commands/prd.md +0 -130
  130. package/.claude/commands/project-status.md +0 -82
  131. package/.claude/commands/publish.md +0 -138
  132. package/.claude/commands/recap.md +0 -69
  133. package/.claude/commands/restore.md +0 -64
  134. package/.claude/commands/review-squad.md +0 -152
  135. package/.claude/commands/save.md +0 -24
  136. package/.claude/commands/stats.md +0 -19
  137. package/.claude/commands/swarm.md +0 -210
  138. package/.claude/commands/tool-builder.md +0 -39
  139. package/.claude/commands/ws-pull.md +0 -44
  140. package/.claude/hooks/_shared-memory.cjs +0 -305
  141. package/.claude/hooks/_utils.cjs +0 -108
  142. package/.claude/hooks/agent-failure-detector.cjs +0 -383
  143. package/.claude/hooks/agent-usage-logger.cjs +0 -204
  144. package/.claude/hooks/app-edit-guard.cjs +0 -494
  145. package/.claude/hooks/auto-learn.cjs +0 -304
  146. package/.claude/hooks/bash-guard.cjs +0 -272
  147. package/.claude/hooks/builder-mode-manager.cjs +0 -354
  148. package/.claude/hooks/bulk-activity-guard.cjs +0 -271
  149. package/.claude/hooks/context-watchdog.cjs +0 -230
  150. package/.claude/hooks/delegation-reminder.cjs +0 -465
  151. package/.claude/hooks/design-system-lint.cjs +0 -271
  152. package/.claude/hooks/post-scaffold-hook.cjs +0 -181
  153. package/.claude/hooks/prompt-guard.cjs +0 -354
  154. package/.claude/hooks/publish-template-guard.cjs +0 -147
  155. package/.claude/hooks/session-start.cjs +0 -35
  156. package/.claude/hooks/shared-memory-writer.cjs +0 -147
  157. package/.claude/hooks/skill-injector.cjs +0 -140
  158. package/.claude/hooks/skill-usage-logger.cjs +0 -258
  159. package/.claude/hooks/src-edit-guard.cjs +0 -240
  160. package/.claude/hooks/sync-marketplace-agents.cjs +0 -346
  161. package/.claude/settings.json +0 -257
  162. package/.claude/skills/SDK-activity-patterns/SKILL.md +0 -428
  163. package/.claude/skills/SDK-document-templates/SKILL.md +0 -1033
  164. package/.claude/skills/SDK-function-fields/SKILL.md +0 -542
  165. package/.claude/skills/SDK-generate-skill/SKILL.md +0 -92
  166. package/.claude/skills/SDK-init-skill/SKILL.md +0 -127
  167. package/.claude/skills/SDK-insight-queries/SKILL.md +0 -787
  168. package/.claude/skills/SDK-ws-config-skill/SKILL.md +0 -1139
  169. package/.claude/skills/agent-structure/SKILL.md +0 -98
  170. package/.claude/skills/api-documentation-patterns/SKILL.md +0 -474
  171. package/.claude/skills/chrome-mcp-reference/SKILL.md +0 -370
  172. package/.claude/skills/delegation-routing/SKILL.md +0 -202
  173. package/.claude/skills/frontend-design/SKILL.md +0 -254
  174. package/.claude/skills/hailer-activity-mover/SKILL.md +0 -213
  175. package/.claude/skills/hailer-api-client/SKILL.md +0 -518
  176. package/.claude/skills/hailer-app-builder/SKILL.md +0 -1434
  177. package/.claude/skills/hailer-apps-pictures/SKILL.md +0 -269
  178. package/.claude/skills/hailer-design-system/SKILL.md +0 -235
  179. package/.claude/skills/hailer-monolith-automations/SKILL.md +0 -686
  180. package/.claude/skills/hailer-permissions-system/SKILL.md +0 -121
  181. package/.claude/skills/hailer-project-protocol/SKILL.md +0 -488
  182. package/.claude/skills/hailer-rest-api/SKILL.md +0 -61
  183. package/.claude/skills/hailer-rest-api/hailer-activities.md +0 -184
  184. package/.claude/skills/hailer-rest-api/hailer-admin.md +0 -473
  185. package/.claude/skills/hailer-rest-api/hailer-calendar.md +0 -256
  186. package/.claude/skills/hailer-rest-api/hailer-feed.md +0 -249
  187. package/.claude/skills/hailer-rest-api/hailer-insights.md +0 -195
  188. package/.claude/skills/hailer-rest-api/hailer-messaging.md +0 -276
  189. package/.claude/skills/hailer-rest-api/hailer-workflows.md +0 -283
  190. package/.claude/skills/insight-join-patterns/SKILL.md +0 -174
  191. package/.claude/skills/integration-patterns/SKILL.md +0 -421
  192. package/.claude/skills/json-only-output/SKILL.md +0 -72
  193. package/.claude/skills/lsp-setup/SKILL.md +0 -160
  194. package/.claude/skills/mcp-direct-tools/SKILL.md +0 -153
  195. package/.claude/skills/optional-parameters/SKILL.md +0 -72
  196. package/.claude/skills/publish-hailer-app/SKILL.md +0 -244
  197. package/.claude/skills/testing-patterns/SKILL.md +0 -630
  198. package/.claude/skills/tool-builder/SKILL.md +0 -250
  199. package/.claude/skills/tool-parameter-usage/SKILL.md +0 -126
  200. package/.claude/skills/tool-response-verification/SKILL.md +0 -92
  201. package/.claude/skills/zapier-hailer-patterns/SKILL.md +0 -581
  202. package/.mcp.json +0 -13
  203. package/.opencode/agent/agent-ada-skill-builder.md +0 -35
  204. package/.opencode/agent/agent-alejandro-function-fields.md +0 -39
  205. package/.opencode/agent/agent-bjorn-config-audit.md +0 -36
  206. package/.opencode/agent/agent-builder-agent-creator.md +0 -39
  207. package/.opencode/agent/agent-code-simplifier.md +0 -31
  208. package/.opencode/agent/agent-dmitri-activity-crud.md +0 -40
  209. package/.opencode/agent/agent-giuseppe-app-builder.md +0 -37
  210. package/.opencode/agent/agent-gunther-mcp-tools.md +0 -39
  211. package/.opencode/agent/agent-helga-workflow-config.md +0 -203
  212. package/.opencode/agent/agent-igor-activity-mover-automation.md +0 -46
  213. package/.opencode/agent/agent-ingrid-doc-templates.md +0 -39
  214. package/.opencode/agent/agent-ivan-monolith.md +0 -46
  215. package/.opencode/agent/agent-kenji-data-reader.md +0 -53
  216. package/.opencode/agent/agent-lars-code-inspector.md +0 -28
  217. package/.opencode/agent/agent-marco-mockup-builder.md +0 -42
  218. package/.opencode/agent/agent-marcus-api-documenter.md +0 -53
  219. package/.opencode/agent/agent-marketplace-publisher.md +0 -44
  220. package/.opencode/agent/agent-marketplace-reviewer.md +0 -42
  221. package/.opencode/agent/agent-permissions-handler.md +0 -50
  222. package/.opencode/agent/agent-simple-writer.md +0 -45
  223. package/.opencode/agent/agent-svetlana-code-review.md +0 -39
  224. package/.opencode/agent/agent-tanya-test-runner.md +0 -57
  225. package/.opencode/agent/agent-ui-designer.md +0 -56
  226. package/.opencode/agent/agent-viktor-sql-insights.md +0 -34
  227. package/.opencode/agent/agent-web-search.md +0 -42
  228. package/.opencode/agent/agent-yevgeni-discussions.md +0 -37
  229. package/.opencode/agent/agent-zara-zapier.md +0 -53
  230. package/.opencode/commands/app-squad.md +0 -135
  231. package/.opencode/commands/audit-squad.md +0 -158
  232. package/.opencode/commands/autoplan.md +0 -563
  233. package/.opencode/commands/cleanup-squad.md +0 -98
  234. package/.opencode/commands/config-squad.md +0 -106
  235. package/.opencode/commands/crud-squad.md +0 -87
  236. package/.opencode/commands/data-squad.md +0 -97
  237. package/.opencode/commands/debug-squad.md +0 -303
  238. package/.opencode/commands/doc-squad.md +0 -65
  239. package/.opencode/commands/handoff.md +0 -137
  240. package/.opencode/commands/health.md +0 -49
  241. package/.opencode/commands/help-agents.md +0 -151
  242. package/.opencode/commands/help-commands.md +0 -32
  243. package/.opencode/commands/help-faq.md +0 -29
  244. package/.opencode/commands/help-plugins.md +0 -28
  245. package/.opencode/commands/help-skills.md +0 -7
  246. package/.opencode/commands/help-tools.md +0 -40
  247. package/.opencode/commands/help.md +0 -28
  248. package/.opencode/commands/hotfix-squad.md +0 -112
  249. package/.opencode/commands/integration-squad.md +0 -82
  250. package/.opencode/commands/janitor-squad.md +0 -167
  251. package/.opencode/commands/learn-auto.md +0 -120
  252. package/.opencode/commands/learn.md +0 -120
  253. package/.opencode/commands/mcp-list.md +0 -27
  254. package/.opencode/commands/onboard-squad.md +0 -140
  255. package/.opencode/commands/plan-workspace.md +0 -732
  256. package/.opencode/commands/prd.md +0 -131
  257. package/.opencode/commands/project-status.md +0 -82
  258. package/.opencode/commands/publish.md +0 -138
  259. package/.opencode/commands/recap.md +0 -69
  260. package/.opencode/commands/restore.md +0 -64
  261. package/.opencode/commands/review-squad.md +0 -152
  262. package/.opencode/commands/save.md +0 -24
  263. package/.opencode/commands/stats.md +0 -19
  264. package/.opencode/commands/swarm.md +0 -210
  265. package/.opencode/commands/tool-builder.md +0 -39
  266. package/.opencode/commands/ws-pull.md +0 -44
  267. package/.opencode/opencode.json +0 -28
  268. package/SESSION-HANDOFF.md +0 -68
  269. package/inbox/2026-03-04-bot-config-patterns.md +0 -24
  270. package/scripts/postinstall.cjs +0 -64
  271. package/scripts/test-hal-tools.ts +0 -154
@@ -1,732 +0,0 @@
1
- ---
2
- description: Comprehensive workspace planning with thorough discovery
3
- argument-hint: <business/project description>
4
- allowed-tools: Task, Bash, Read, AskUserQuestion
5
- ---
6
- # Plan Workspace Command
7
-
8
- Deep discovery process for planning a complete Hailer workspace. Ask MANY questions before creating anything.
9
-
10
- ## Philosophy
11
-
12
- **This is NOT a quick command.** This is a thorough discovery session that should feel like a proper requirements gathering meeting. Ask questions until you truly understand:
13
- - The business and its processes
14
- - Who uses the system and why
15
- - What data flows where
16
- - What automation saves time
17
- - What reporting matters
18
-
19
- **Rule: When in doubt, ask another question.**
20
-
21
- ---
22
-
23
- ## Design Patterns (Reference for Planning)
24
-
25
- Keep these patterns in mind throughout discovery. They inform how to structure workflows.
26
-
27
- ### Workflow Structure
28
-
29
- **Header + Rows (Two Workflows)**
30
- Any entity with line items needs two workflows:
31
-
32
- | Header | Rows | Links To |
33
- |--------|------|----------|
34
- | Sales Orders | Order Rows | Products, Services |
35
- | Purchase Orders | PO Rows | Products, Suppliers |
36
- | Invoices | Invoice Rows | (or linked Order Rows) |
37
- | Quotes | Quote Lines | Products, Services |
38
- | Projects | Tasks | - |
39
-
40
- **Why two workflows:**
41
- - Rows can have independent phases (partial delivery)
42
- - Row count unlimited
43
- - Aggregation via function fields (order total = sum of lines)
44
- - Cleaner reporting
45
-
46
- **Naming convention (Finnish):** Base + "rivit" suffix
47
- - Tilaukset → Tilausrivit
48
- - Myyntitilaukset → Myyntitilausrivit
49
- - Laskut → Laskurivit
50
-
51
- **Row Source Flexibility**
52
- Rows don't have to be one workflow. A Sales Order might link to:
53
- - Product Rows → Products catalog
54
- - Service Rows → Services catalog
55
- - Production Rows → Production items
56
-
57
- Use separate row workflows when types have different fields or processes.
58
-
59
- ---
60
-
61
- **Dataset vs Workflow**
62
-
63
- | Type | When to Use | Examples | Phase Behavior |
64
- |------|-------------|----------|----------------|
65
- | **Dataset** | Static/reference data | Products, Customers, Suppliers | Categories (activities don't transition) |
66
- | **Workflow** | Lifecycle/state data | Orders, Invoices, Tasks | Phases (activities progress through stages) |
67
-
68
- - **Dataset:** Activities are categorized but don't "move" - a Product stays in "Electronics" category
69
- - **Workflow:** Activities progress through phases - an Order moves from "Draft" → "Confirmed" → "Shipped"
70
-
71
- This affects phase design:
72
- - Datasets: phases = categories (no transitions expected)
73
- - Workflows: phases = lifecycle stages (transitions matter)
74
-
75
- ---
76
-
77
- **Master Data vs Transactional**
78
-
79
- | Type | enableUnlinkedMode | Examples |
80
- |------|-------------------|----------|
81
- | Master data | `true` (independent) | Customers, Products, Suppliers, Employees |
82
- | Transactional | `false` (requires context) | Orders, Invoices, Quotes, their Rows |
83
-
84
- ---
85
-
86
- **Domain Prefixes (Large Workspaces)**
87
- For 30+ workflows, use prefixes to organize:
88
- - `INV-` Invoicing (INV-Laskut, INV-Laskurivit)
89
- - `VH-` Warehouse (VH-Varastopaikat, VH-Nimikkeet)
90
- - `MYY-` Sales (MYY-Tilaukset, MYY-Tilausrivit)
91
- - `OST-` Purchasing (OST-Tilaukset, OST-Tilausrivit)
92
-
93
- ---
94
-
95
- **Phase-Specific Field Visibility**
96
-
97
- Different phases can show different fields. Plan this during design:
98
-
99
- **Workflow example (Orders):**
100
- | Phase | Fields Shown |
101
- |-------|--------------|
102
- | Draft | Customer, Items, Notes |
103
- | Confirmed | + Confirmed Date, Confirmed By |
104
- | Shipped | + Ship Date, Tracking Number |
105
- | Invoiced | + Invoice Number, Invoice Date |
106
-
107
- **Dataset example (Products):**
108
- | Category | Fields Shown |
109
- |----------|--------------|
110
- | Physical Products | Name, Price, + Dimensions, Weight, Stock |
111
- | Services | Name, Price, + Hourly Rate, Duration |
112
- | Both | Name, Description, Price (shared) |
113
-
114
- Document in PRD which fields appear in which phases.
115
-
116
- ---
117
-
118
- **Phase Rationalization for Apps**
119
-
120
- When building apps, document which phases to show per user role:
121
-
122
- ```markdown
123
- ## Data Access (in app PRD)
124
-
125
- | View | Phases Fetched | Rationale |
126
- |------|----------------|-----------|
127
- | Sales Dashboard | Active only | Hide internal WIP from sales team |
128
- | Manager View | Draft + Active | Managers need WIP visibility |
129
- | Admin Panel | All phases | Full access for admin |
130
- | Public Portal | Active only | No internal data exposed |
131
- | Insights/Reports | Active only | Accurate counts, no draft duplicates |
132
- ```
133
-
134
- **Why this matters:**
135
- - Prevents exposing draft/internal data to wrong users
136
- - Ensures reports show accurate counts
137
- - Different roles need different visibility
138
-
139
- ---
140
-
141
- ### Row Lifecycle Patterns
142
-
143
- **Pattern A: Rows progress through phases (simpler)**
144
- ```
145
- Order Row → "Ordered" → "Shipped" → "Invoiced"
146
- ```
147
- - Same activity, phase changes
148
- - Invoice workflow links to the rows
149
- - Works when 1:1 (ordered = shipped = invoiced)
150
- - Good for simple processes without integrations
151
-
152
- **Pattern B: Rows generate new activities (complex)**
153
- ```
154
- Order Row → creates → Invoice Row
155
- → creates → Delivery Row
156
- ```
157
- - Separate workflows for each document type
158
- - Use when:
159
- - Partial invoicing (invoice 3 of 5 rows now)
160
- - Consolidated invoicing (multiple orders → one invoice)
161
- - Accounting integration needs clean invoice data
162
- - Different pricing (order price ≠ invoice price)
163
-
164
- **Decision Guide**
165
-
166
- | Scenario | Approach |
167
- |----------|----------|
168
- | Simple tracking, no integrations | Rows progress through phases |
169
- | 1:1 order-to-invoice | Rows progress through phases |
170
- | Partial deliveries/invoices | Separate row workflows |
171
- | Accounting integration (Netvisor, etc.) | Separate invoice rows |
172
- | Multiple orders → one invoice | Separate invoice rows |
173
-
174
- ---
175
-
176
- ### Integration Patterns
177
-
178
- | Need | Solution |
179
- |------|----------|
180
- | Phase cascades (parent → children) | Activity Mover |
181
- | Simple notifications/external tasks | Zapier webhooks |
182
- | Complex automations, scheduled jobs | Project Monolith |
183
- | Accounting sync (Netvisor, Procountor) | Monolith integration |
184
- | No integration (manual export) | Export insight (CSV) |
185
-
186
- **Export insight fallback:** When no direct integration, create an insight that formats invoice data for CSV download. User imports manually to accounting.
187
-
188
- ---
189
-
190
- ### Document Templates
191
-
192
- Used for: Invoices, Quotes, Order Confirmations, Delivery Notes, Reports
193
-
194
- Templates pull data from header workflow + linked rows. Typically PDF format with company branding.
195
-
196
- ---
197
-
198
- ### Single Workflow Pattern
199
-
200
- Use only for:
201
- - Master data (Customers, Products, Suppliers)
202
- - Simple tracking without line items (Expenses, Notes, Logs)
203
- - Reference data (Categories, Types)
204
-
205
- ## Instructions
206
-
207
- ### Phase 1: Business Context (5-10 questions)
208
-
209
- Start by understanding the big picture. Use AskUserQuestion tool.
210
-
211
- **Questions to ask:**
212
- 1. What's the business/organization? (company name, industry)
213
- 2. What problem are we solving? (pain points, current process)
214
- 3. Who are the main users? (roles - admin, sales, warehouse, customers)
215
- 4. How many users approximately? (scale affects design)
216
- 5. Is this replacing an existing system? (migration needs)
217
- 6. Any compliance/regulatory requirements? (GDPR, industry-specific)
218
- 7. What's the timeline expectation? (MVP vs complete)
219
- 8. Any existing systems to integrate with? (ERP, accounting, etc.)
220
- 9. What language for workflow/field names?
221
- - Finnish: "Tilaukset", "Tilausrivit", "Asiakkaat"
222
- - English: "Orders", "Order Lines", "Customers"
223
- - Swedish: "Beställningar", "Beställningsrader"
224
-
225
- **Ask follow-ups based on answers.** If they mention "customers", ask what kind. If they mention "orders", ask about the order lifecycle.
226
-
227
- ---
228
-
229
- ### Phase 2: Functional Areas (multiSelect + deep dive)
230
-
231
- Present functional areas as multiSelect:
232
-
233
- ```
234
- Which business functions need to be covered?
235
- - [ ] Sales & CRM (customers, leads, opportunities, quotes)
236
- - [ ] Order Management (orders, order lines, fulfillment)
237
- - [ ] Purchasing (suppliers, purchase orders, receiving)
238
- - [ ] Inventory (products, stock levels, warehouses)
239
- - [ ] Projects & Tasks (projects, tasks, milestones)
240
- - [ ] Time & Expense (time tracking, expenses, billing)
241
- - [ ] HR & People (employees, onboarding, leave)
242
- - [ ] Finance (invoices, payments, accounts)
243
- - [ ] Assets & Equipment (equipment, maintenance, bookings)
244
- - [ ] Tickets & Support (tickets, SLA, knowledge base)
245
- - [ ] Custom (describe your specific needs)
246
- ```
247
-
248
- **For EACH selected area, ask detailed questions:**
249
-
250
- #### If Sales & CRM selected:
251
- - What's your sales process? (stages/phases)
252
- - Do you track leads separately from customers?
253
- - Do you create quotes/proposals?
254
- - What customer info do you need? (contacts, addresses, segments)
255
- - How do you track sales activities? (calls, meetings, emails)
256
- - What makes a customer "won" vs "lost"?
257
-
258
- #### If Order Management selected:
259
- - What triggers an order? (quote approval, direct entry, portal)
260
- - What's the order lifecycle? (draft → confirmed → shipped → invoiced)
261
- - Do orders have line items? (products, quantities, prices)
262
- - Do you need delivery tracking?
263
- - How do you handle partial deliveries?
264
- - Any approval workflows needed?
265
-
266
- #### If Purchasing selected:
267
- - How do you decide what to purchase?
268
- - Do you need supplier comparison/approval?
269
- - What's the PO lifecycle?
270
- - Do you track goods receiving?
271
- - How do you match POs to invoices?
272
-
273
- #### If Inventory selected:
274
- - What do you track? (products, materials, equipment)
275
- - Multiple warehouses/locations?
276
- - Do you need stock alerts (min/max levels)?
277
- - Batch/serial number tracking?
278
- - How does stock relate to orders/purchasing?
279
-
280
- #### If Projects & Tasks selected:
281
- - What types of projects?
282
- - How do you track progress? (phases, milestones, % complete)
283
- - Do projects have budgets?
284
- - How are tasks assigned?
285
- - Do you need Gantt/timeline views?
286
-
287
- #### If Time & Expense selected:
288
- - Who tracks time? (employees, contractors)
289
- - Billable vs non-billable?
290
- - How do you approve time entries?
291
- - Expense categories needed?
292
- - How does this connect to invoicing?
293
-
294
- #### If HR & People selected:
295
- - What employee data do you track?
296
- - Onboarding checklists needed?
297
- - Leave/vacation tracking?
298
- - Performance reviews?
299
- - Training/certifications?
300
-
301
- #### If Finance selected:
302
- - Invoice from orders or standalone?
303
- - Payment tracking?
304
- - Multiple currencies?
305
- - Integration with accounting software?
306
- - Recurring invoices/subscriptions?
307
-
308
- #### If Assets & Equipment selected:
309
- - What assets do you track?
310
- - Maintenance schedules?
311
- - Booking/reservation system?
312
- - Depreciation tracking?
313
-
314
- #### If Tickets & Support selected:
315
- - What channels? (email, portal, phone)
316
- - SLA tracking needed?
317
- - Escalation rules?
318
- - Knowledge base?
319
- - Customer self-service?
320
-
321
- ---
322
-
323
- ### Phase 3: Workflow Relationships (critical!)
324
-
325
- After functional areas, understand how they connect:
326
-
327
- **Questions:**
328
- 1. When [X] happens, what should update in [Y]?
329
- 2. Draw me through a typical transaction end-to-end
330
- 3. What workflows need to link to each other?
331
- 4. Are there parent-child relationships? (Order → Order Lines)
332
- 5. What's the "master" data? (Customers used everywhere?)
333
-
334
- **Create a mental model:**
335
- ```
336
- Customer → Orders → Order Lines
337
-
338
- Deliveries → Invoices → Payments
339
- ```
340
-
341
- ---
342
-
343
- ### Phase 4: User Experience & Apps
344
-
345
- **Questions about apps/portals:**
346
- 1. Do you need a customer-facing portal?
347
- - What can customers see? (orders, invoices, tickets)
348
- - Can they create things? (orders, tickets)
349
- - Login required or public access?
350
- 2. Do you need internal dashboards?
351
- - What KPIs matter?
352
- - Who sees what? (role-based views)
353
- 3. Mobile needs?
354
- - Which roles need mobile access?
355
- - What actions on mobile?
356
- 4. Any special UI needs?
357
- - Kanban boards?
358
- - Calendar views?
359
- - Map views?
360
-
361
- ---
362
-
363
- ### Phase 5: Reporting & Insights
364
-
365
- **Questions:**
366
- 1. What reports do you need today? (existing reports to replicate)
367
- 2. What questions do you want to answer?
368
- - "How much did we sell this month?"
369
- - "Which customers are overdue?"
370
- - "What's our project profitability?"
371
- 3. Who needs which reports?
372
- 4. Export formats needed? (PDF, Excel)
373
- 5. Any real-time dashboards?
374
- 6. Public reports for customers?
375
-
376
- ---
377
-
378
- ### Phase 6: Document Templates (PDF/CSV)
379
-
380
- **Questions:**
381
- 1. What documents do you need to generate?
382
- - Quotes/Proposals?
383
- - Order confirmations?
384
- - Invoices?
385
- - Delivery notes/Packing slips?
386
- - Purchase orders?
387
- - Reports/Summaries?
388
- - Certificates/Contracts?
389
- 2. For each document type:
390
- - What data needs to be on it? (fields, line items)
391
- - Company branding? (logo, colors, footer)
392
- - Multiple languages?
393
- - Any legal text/terms & conditions?
394
- 3. Do you have existing templates to match? (ask for examples)
395
- 4. PDF vs CSV vs both?
396
- 5. Who generates these? (automated or manual trigger)
397
- 6. Any e-signature needs? (SignSpace integration)
398
-
399
- ---
400
-
401
- ### Phase 6.5: Calculated Fields (Function Fields)
402
-
403
- **Discovery questions:**
404
- 1. What values need to be calculated automatically?
405
- - Totals? (quantity × price)
406
- - Dates? (days until due, age in days)
407
- - Status indicators? (overdue → 🔴)
408
- - Counts? (how many line items per order?)
409
-
410
- 2. For each workflow, ask:
411
- - What derived data do users need to see?
412
- - What would they otherwise calculate manually?
413
- - Any fields that depend on other fields?
414
-
415
- **Common function field patterns:**
416
-
417
- | Type | Example | Formula Pattern |
418
- |------|---------|-----------------|
419
- | **Arithmetic** | Total = qty × price | `return qty * price;` |
420
- | **Date diff** | Days open = today - created | `Math.floor((Date.now() - created) / 86400000)` |
421
- | **Conditional** | Priority icon = 🔴/🟡/🟢 | `priority === 'high' ? '🔴' : '🟢'` |
422
- | **Backlink count** | Order count per customer | Count activities linking back |
423
- | **Aggregation** | Order total from line items | Sum child activity values |
424
- | **Status** | Overdue if due_date < today | `due_date < Date.now() ? 'Overdue' : 'OK'` |
425
-
426
- **Ask for each workflow:**
427
- - Any totals or sums needed?
428
- - Any date-based calculations? (days remaining, age)
429
- - Any conditional formatting or status indicators?
430
- - Any counts from linked activities?
431
-
432
- **Document as:**
433
- ```
434
- Workflow: Orders
435
- - total_amount: function (sum of line item totals)
436
- - days_until_due: function (due_date - today)
437
- - overdue_indicator: function (🔴 if overdue, else empty)
438
- ```
439
-
440
- ---
441
-
442
- ### Phase 7: Automations & Integrations
443
-
444
- **Phase cascade / activity movers:**
445
- 1. When [parent] moves to [phase], should [children] auto-move?
446
- - Order "Shipped" → Order Lines "Shipped"?
447
- - Project "Completed" → Tasks "Archived"?
448
-
449
- **Scheduled automations:**
450
- 1. Any monthly/weekly jobs?
451
- - Auto-invoice subscriptions?
452
- - Reminder emails?
453
- - Status updates?
454
- 2. Any daily syncs needed?
455
-
456
- **External integrations:**
457
- 1. Accounting system? (Netvisor, Procountor, other)
458
- 2. ERP system?
459
- 3. Email/calendar? (Outlook, Gmail)
460
- 4. E-signatures? (SignSpace)
461
- 5. Payment providers?
462
- 6. Any APIs to connect to?
463
-
464
- **Notifications:**
465
- 1. Who gets notified when?
466
- 2. Email vs in-app vs both?
467
-
468
- ---
469
-
470
- ### Phase 8: Summarize Understanding
471
-
472
- Before creating anything, summarize back to user:
473
-
474
- ```
475
- ## Here's what I understood:
476
-
477
- **Business:** [company] in [industry] solving [problem]
478
- **Users:** [roles and counts]
479
- **Timeline:** [MVP vs full]
480
-
481
- **Workflows planned:**
482
- 1. Customers - [fields, phases, function fields]
483
- 2. Orders - [fields, phases, function fields]
484
- 3. ...
485
-
486
- **Relationships:**
487
- - Customers → Orders (one-to-many)
488
- - Orders → Order Lines (parent-child)
489
- - ...
490
-
491
- **Apps:**
492
- - Customer Portal (public, view orders/invoices)
493
- - Sales Dashboard (internal, KPIs)
494
-
495
- **Automations:**
496
- - Order shipped → Lines shipped (activity mover)
497
- - Monthly invoicing (scheduled)
498
- - Netvisor sync (integration)
499
-
500
- **Did I miss anything? Any corrections?**
501
- ```
502
-
503
- **Ask for confirmation before proceeding.**
504
-
505
- ---
506
-
507
- ### Phase 9: Generate Documentation
508
-
509
- Only after user confirms understanding:
510
-
511
- #### Create DEVELOPMENT.md
512
-
513
- ```markdown
514
- # [Project Name] - Workspace Plan
515
-
516
- **Client:** [name]
517
- **Industry:** [industry]
518
- **Created:** YYYY-MM-DD
519
- **Status:** Planning
520
-
521
- ---
522
-
523
- ## Overview
524
- [2-3 sentences about the business problem being solved]
525
-
526
- ---
527
-
528
- ## Users & Roles
529
-
530
- | Role | Count | Access Level | Primary Functions |
531
- |------|-------|--------------|-------------------|
532
- | [role] | ~X | Admin/Editor/Viewer | [what they do] |
533
-
534
- ---
535
-
536
- ## Data Model
537
-
538
- ### Workflows
539
-
540
- | Workflow | Purpose | Key Fields | Phases |
541
- |----------|---------|------------|--------|
542
- | [name] | [what it stores] | [important fields] | [phase list] |
543
-
544
- ### Relationships
545
-
546
- ```
547
- [ASCII diagram of workflow relationships]
548
- ```
549
-
550
- ---
551
-
552
- ## Apps & Portals
553
-
554
- | App | Type | Users | Purpose |
555
- |-----|------|-------|---------|
556
- | [name] | Public/Internal | [roles] | [what it does] |
557
-
558
- ---
559
-
560
- ## Insights & Reports
561
-
562
- | Report | Purpose | Data Source | Public? |
563
- |--------|---------|-------------|---------|
564
- | [name] | [what question it answers] | [workflows] | Yes/No |
565
-
566
- ---
567
-
568
- ## Automations
569
-
570
- | Automation | Type | Trigger | Action |
571
- |------------|------|---------|--------|
572
- | [name] | Mover/Scheduled/Webhook | [when] | [what happens] |
573
-
574
- ---
575
-
576
- ## Integrations
577
-
578
- | System | Direction | Data |
579
- |--------|-----------|------|
580
- | [name] | →/←/↔ Hailer | [what syncs] |
581
-
582
- ---
583
-
584
- ## Document Templates
585
-
586
- | Template | Type | Workflow | Trigger |
587
- |----------|------|----------|---------|
588
- | [name] | PDF/CSV | [source workflow] | Manual/Auto |
589
-
590
- ---
591
-
592
- ## Roadmap
593
-
594
- | # | Component | PRD | Priority | Status |
595
- |---|-----------|-----|----------|--------|
596
- | 1 | [Workflow: X] | [link] | Must have | Planned |
597
- | 2 | [Workflow: Y] | [link] | Must have | Planned |
598
- | 3 | [App: Z] | [link] | Should have | Planned |
599
-
600
- ---
601
-
602
- ## Open Questions
603
- - [Any unresolved items from discovery]
604
-
605
- ---
606
-
607
- ## Technical Decisions
608
- | Decision | Rationale | Date |
609
- |----------|-----------|------|
610
- ```
611
-
612
- #### Create PRDs for each component
613
-
614
- Use the PRD templates from autoplan but with REAL DATA from the discovery:
615
- - `docs/prd-workflow-*.md` - With actual fields, phases, **function fields**, and nameFunction from answers
616
- - `docs/prd-app-*.md` - With actual screens, features from answers
617
- - `docs/prd-insight-*.md` - With actual queries from answers
618
- - `docs/prd-template-*.md` - For each document template (PDF/CSV)
619
- - `docs/prd-automation-*.md` - For each automation identified
620
-
621
- **Document Template PRD** (`docs/prd-template-[name].md`):
622
- ```markdown
623
- # PRD: Template - [Name]
624
-
625
- **Status:** Planned
626
- **Created:** YYYY-MM-DD
627
- **Parent:** [DEVELOPMENT.md](../DEVELOPMENT.md)
628
- **Type:** PDF / CSV
629
-
630
- ---
631
-
632
- ## Purpose
633
- [What document this generates and when it's used]
634
-
635
- ---
636
-
637
- ## Source Workflow
638
- - **Workflow:** [which workflow this pulls data from]
639
- - **Trigger:** Manual / On phase change / Scheduled
640
-
641
- ---
642
-
643
- ## Document Layout
644
-
645
- ### Header
646
- - Company logo: [yes/no, position]
647
- - Company info: [address, phone, etc.]
648
- - Document title: [e.g., "Invoice", "Quote"]
649
- - Document number: [field]
650
- - Date: [field]
651
-
652
- ### Recipient Section
653
- - Customer/Recipient info: [fields]
654
-
655
- ### Body
656
- - Line items table: [columns needed]
657
- - [Any other sections]
658
-
659
- ### Footer
660
- - Totals: [subtotal, tax, total fields]
661
- - Payment terms / Notes: [text]
662
- - Legal text: [if any]
663
-
664
- ---
665
-
666
- ## Field Mapping
667
-
668
- | Document Field | Hailer Field | Format |
669
- |----------------|--------------|--------|
670
- | Invoice # | [field id] | prefix + number |
671
- | Date | [field id] | DD.MM.YYYY |
672
- | Customer | [linked field] | name |
673
-
674
- ---
675
-
676
- ## Implementation Steps
677
- 1. [ ] Create template in workspace/templates.ts
678
- 2. [ ] Map all fields
679
- 3. [ ] Add generation function
680
- 4. [ ] Test with sample data
681
- 5. [ ] Push and verify
682
-
683
- ---
684
-
685
- ## Verification
686
- - [ ] PDF generates correctly
687
- - [ ] All fields populate
688
- - [ ] Layout matches requirements
689
- - [ ] Branding correct
690
- ```
691
-
692
- ---
693
-
694
- ### Phase 10: Report
695
-
696
- ```
697
- ## Workspace Plan Complete
698
-
699
- **Created:**
700
- - DEVELOPMENT.md (master plan)
701
- - X workflow PRDs
702
- - X app PRDs
703
- - X insight PRDs
704
- - X template PRDs (PDF/CSV)
705
- - X automation PRDs
706
-
707
- **Total components planned:** X
708
-
709
- **Recommended build order:**
710
- 1. Core workflows (master data first) - Helga auto-spawns Alejandro for nameFunction
711
- 2. Transactional workflows - Helga auto-spawns Alejandro for nameFunction + function fields
712
- 3. Cross-workflow function fields (if needed separately)
713
- 4. Insights for apps/reports
714
- 5. Document templates (PDF/CSV)
715
- 6. Apps
716
- 7. Automations (last, need everything else first)
717
-
718
- **Next steps:**
719
- 1. Review PRDs with stakeholder
720
- 2. Start with `/yolo docs/prd-workflow-customers.md`
721
- ```
722
-
723
- ---
724
-
725
- ## Important Reminders
726
-
727
- - **Ask MORE questions than you think necessary**
728
- - **Never assume** - if unclear, ask
729
- - **Summarize and confirm** before creating files
730
- - **Real data** - PRDs should have actual field names, phases, not placeholders
731
- - **Think relationships** - how workflows connect is often more important than individual fields
732
- - **Consider scale** - 10 users vs 1000 users affects design