@agile-vibe-coding/avc 0.2.3 → 0.3.1

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 (261) hide show
  1. package/cli/agents/agent-selector.md +23 -0
  2. package/cli/agents/code-implementer.md +117 -0
  3. package/cli/agents/code-validator.md +80 -0
  4. package/cli/agents/context-reviewer-epic.md +101 -0
  5. package/cli/agents/context-reviewer-story.md +92 -0
  6. package/cli/agents/context-writer-epic.md +145 -0
  7. package/cli/agents/context-writer-story.md +111 -0
  8. package/cli/agents/doc-writer-epic.md +42 -0
  9. package/cli/agents/doc-writer-story.md +43 -0
  10. package/cli/agents/duplicate-detector.md +110 -0
  11. package/cli/agents/epic-story-decomposer.md +318 -39
  12. package/cli/agents/mission-scope-generator.md +68 -4
  13. package/cli/agents/mission-scope-validator.md +40 -6
  14. package/cli/agents/project-context-extractor.md +21 -6
  15. package/cli/agents/scaffolding-generator.md +99 -0
  16. package/cli/agents/seed-validator.md +71 -0
  17. package/cli/agents/story-scope-reviewer.md +147 -0
  18. package/cli/agents/story-splitter.md +83 -0
  19. package/cli/agents/validator-documentation.json +31 -0
  20. package/cli/agents/validator-documentation.md +3 -1
  21. package/cli/api-reference-tool.js +368 -0
  22. package/cli/checks/catalog.json +76 -0
  23. package/cli/checks/code/quality.json +26 -0
  24. package/cli/checks/code/testing.json +14 -0
  25. package/cli/checks/code/traceability.json +26 -0
  26. package/cli/checks/cross-refs/epic.json +171 -0
  27. package/cli/checks/cross-refs/story.json +149 -0
  28. package/cli/checks/epic/api.json +114 -0
  29. package/cli/checks/epic/backend.json +126 -0
  30. package/cli/checks/epic/cloud.json +126 -0
  31. package/cli/checks/epic/data.json +102 -0
  32. package/cli/checks/epic/database.json +114 -0
  33. package/cli/checks/epic/developer.json +182 -0
  34. package/cli/checks/epic/devops.json +174 -0
  35. package/cli/checks/epic/frontend.json +162 -0
  36. package/cli/checks/epic/mobile.json +102 -0
  37. package/cli/checks/epic/qa.json +90 -0
  38. package/cli/checks/epic/security.json +184 -0
  39. package/cli/checks/epic/solution-architect.json +192 -0
  40. package/cli/checks/epic/test-architect.json +90 -0
  41. package/cli/checks/epic/ui.json +102 -0
  42. package/cli/checks/epic/ux.json +90 -0
  43. package/cli/checks/fixes/epic-fix-template.md +10 -0
  44. package/cli/checks/fixes/story-fix-template.md +10 -0
  45. package/cli/checks/story/api.json +186 -0
  46. package/cli/checks/story/backend.json +102 -0
  47. package/cli/checks/story/cloud.json +102 -0
  48. package/cli/checks/story/data.json +210 -0
  49. package/cli/checks/story/database.json +102 -0
  50. package/cli/checks/story/developer.json +168 -0
  51. package/cli/checks/story/devops.json +102 -0
  52. package/cli/checks/story/frontend.json +174 -0
  53. package/cli/checks/story/mobile.json +102 -0
  54. package/cli/checks/story/qa.json +210 -0
  55. package/cli/checks/story/security.json +198 -0
  56. package/cli/checks/story/solution-architect.json +230 -0
  57. package/cli/checks/story/test-architect.json +210 -0
  58. package/cli/checks/story/ui.json +102 -0
  59. package/cli/checks/story/ux.json +102 -0
  60. package/cli/coding-order.js +401 -0
  61. package/cli/dependency-checker.js +72 -0
  62. package/cli/epic-story-validator.js +284 -799
  63. package/cli/index.js +0 -0
  64. package/cli/init-model-config.js +17 -10
  65. package/cli/init.js +514 -92
  66. package/cli/kanban-server-manager.js +1 -2
  67. package/cli/llm-claude.js +98 -31
  68. package/cli/llm-gemini.js +29 -5
  69. package/cli/llm-local.js +493 -0
  70. package/cli/llm-openai.js +262 -41
  71. package/cli/llm-provider.js +147 -8
  72. package/cli/llm-token-limits.js +113 -4
  73. package/cli/llm-verifier.js +209 -1
  74. package/cli/llm-xiaomi.js +143 -0
  75. package/cli/message-constants.js +3 -12
  76. package/cli/messaging-api.js +6 -12
  77. package/cli/micro-check-fixer.js +335 -0
  78. package/cli/micro-check-runner.js +449 -0
  79. package/cli/micro-check-scorer.js +148 -0
  80. package/cli/micro-check-validator.js +538 -0
  81. package/cli/model-pricing.js +23 -0
  82. package/cli/model-selector.js +3 -2
  83. package/cli/prompt-logger.js +57 -0
  84. package/cli/repl-ink.js +106 -346
  85. package/cli/repl-old.js +1 -2
  86. package/cli/seed-processor.js +194 -24
  87. package/cli/sprint-planning-processor.js +2638 -289
  88. package/cli/template-processor.js +50 -3
  89. package/cli/token-tracker.js +50 -23
  90. package/cli/tools/generate-story-validators.js +1 -1
  91. package/cli/validation-router.js +70 -8
  92. package/cli/worktree-runner.js +654 -0
  93. package/kanban/client/dist/assets/index-D_KC5EQT.css +1 -0
  94. package/kanban/client/dist/assets/index-DjY5zqW7.js +351 -0
  95. package/kanban/client/dist/index.html +2 -2
  96. package/kanban/client/src/App.jsx +43 -14
  97. package/kanban/client/src/components/ceremony/AskArchPopup.jsx +7 -3
  98. package/kanban/client/src/components/ceremony/AskModelPopup.jsx +23 -10
  99. package/kanban/client/src/components/ceremony/CeremonyWorkflowModal.jsx +320 -133
  100. package/kanban/client/src/components/ceremony/ProviderSwitcherButton.jsx +290 -0
  101. package/kanban/client/src/components/ceremony/SponsorCallModal.jsx +80 -13
  102. package/kanban/client/src/components/ceremony/SprintPlanningModal.jsx +156 -22
  103. package/kanban/client/src/components/ceremony/steps/ArchitectureStep.jsx +11 -11
  104. package/kanban/client/src/components/ceremony/steps/CompleteStep.jsx +3 -21
  105. package/kanban/client/src/components/ceremony/steps/ReviewAnswersStep.jsx +214 -10
  106. package/kanban/client/src/components/ceremony/steps/RunningStep.jsx +23 -2
  107. package/kanban/client/src/components/kanban/CardDetailModal.jsx +97 -10
  108. package/kanban/client/src/components/kanban/GroupingSelector.jsx +7 -1
  109. package/kanban/client/src/components/kanban/KanbanCard.jsx +23 -14
  110. package/kanban/client/src/components/kanban/RefineWorkItemPopup.jsx +9 -14
  111. package/kanban/client/src/components/kanban/RunButton.jsx +162 -0
  112. package/kanban/client/src/components/kanban/SeedButton.jsx +176 -0
  113. package/kanban/client/src/components/settings/AgentsTab.jsx +103 -75
  114. package/kanban/client/src/components/settings/ApiKeysTab.jsx +31 -2
  115. package/kanban/client/src/components/settings/CeremonyModelsTab.jsx +9 -2
  116. package/kanban/client/src/components/settings/CheckEditorPopup.jsx +507 -0
  117. package/kanban/client/src/components/settings/CostThresholdsTab.jsx +3 -2
  118. package/kanban/client/src/components/settings/ModelPricingTab.jsx +72 -7
  119. package/kanban/client/src/components/settings/OpenAIAuthSection.jsx +412 -0
  120. package/kanban/client/src/components/settings/SettingsModal.jsx +4 -4
  121. package/kanban/client/src/components/stats/CostModal.jsx +34 -3
  122. package/kanban/client/src/hooks/useGrouping.js +59 -0
  123. package/kanban/client/src/lib/api.js +118 -4
  124. package/kanban/client/src/lib/status-grouping.js +10 -0
  125. package/kanban/client/src/store/kanbanStore.js +8 -0
  126. package/kanban/server/index.js +23 -2
  127. package/kanban/server/routes/ceremony.js +153 -4
  128. package/kanban/server/routes/costs.js +9 -3
  129. package/kanban/server/routes/openai-oauth.js +366 -0
  130. package/kanban/server/routes/settings.js +447 -14
  131. package/kanban/server/routes/websocket.js +7 -2
  132. package/kanban/server/routes/work-items.js +141 -1
  133. package/kanban/server/services/CeremonyService.js +275 -24
  134. package/kanban/server/services/TaskRunnerService.js +261 -0
  135. package/kanban/server/workers/run-task-worker.js +121 -0
  136. package/kanban/server/workers/seed-worker.js +94 -0
  137. package/kanban/server/workers/sponsor-call-worker.js +14 -6
  138. package/kanban/server/workers/sprint-planning-worker.js +94 -12
  139. package/package.json +2 -3
  140. package/cli/agents/solver-epic-api.json +0 -15
  141. package/cli/agents/solver-epic-api.md +0 -39
  142. package/cli/agents/solver-epic-backend.json +0 -15
  143. package/cli/agents/solver-epic-backend.md +0 -39
  144. package/cli/agents/solver-epic-cloud.json +0 -15
  145. package/cli/agents/solver-epic-cloud.md +0 -39
  146. package/cli/agents/solver-epic-data.json +0 -15
  147. package/cli/agents/solver-epic-data.md +0 -39
  148. package/cli/agents/solver-epic-database.json +0 -15
  149. package/cli/agents/solver-epic-database.md +0 -39
  150. package/cli/agents/solver-epic-developer.json +0 -15
  151. package/cli/agents/solver-epic-developer.md +0 -39
  152. package/cli/agents/solver-epic-devops.json +0 -15
  153. package/cli/agents/solver-epic-devops.md +0 -39
  154. package/cli/agents/solver-epic-frontend.json +0 -15
  155. package/cli/agents/solver-epic-frontend.md +0 -39
  156. package/cli/agents/solver-epic-mobile.json +0 -15
  157. package/cli/agents/solver-epic-mobile.md +0 -39
  158. package/cli/agents/solver-epic-qa.json +0 -15
  159. package/cli/agents/solver-epic-qa.md +0 -39
  160. package/cli/agents/solver-epic-security.json +0 -15
  161. package/cli/agents/solver-epic-security.md +0 -39
  162. package/cli/agents/solver-epic-solution-architect.json +0 -15
  163. package/cli/agents/solver-epic-solution-architect.md +0 -39
  164. package/cli/agents/solver-epic-test-architect.json +0 -15
  165. package/cli/agents/solver-epic-test-architect.md +0 -39
  166. package/cli/agents/solver-epic-ui.json +0 -15
  167. package/cli/agents/solver-epic-ui.md +0 -39
  168. package/cli/agents/solver-epic-ux.json +0 -15
  169. package/cli/agents/solver-epic-ux.md +0 -39
  170. package/cli/agents/solver-story-api.json +0 -15
  171. package/cli/agents/solver-story-api.md +0 -39
  172. package/cli/agents/solver-story-backend.json +0 -15
  173. package/cli/agents/solver-story-backend.md +0 -39
  174. package/cli/agents/solver-story-cloud.json +0 -15
  175. package/cli/agents/solver-story-cloud.md +0 -39
  176. package/cli/agents/solver-story-data.json +0 -15
  177. package/cli/agents/solver-story-data.md +0 -39
  178. package/cli/agents/solver-story-database.json +0 -15
  179. package/cli/agents/solver-story-database.md +0 -39
  180. package/cli/agents/solver-story-developer.json +0 -15
  181. package/cli/agents/solver-story-developer.md +0 -39
  182. package/cli/agents/solver-story-devops.json +0 -15
  183. package/cli/agents/solver-story-devops.md +0 -39
  184. package/cli/agents/solver-story-frontend.json +0 -15
  185. package/cli/agents/solver-story-frontend.md +0 -39
  186. package/cli/agents/solver-story-mobile.json +0 -15
  187. package/cli/agents/solver-story-mobile.md +0 -39
  188. package/cli/agents/solver-story-qa.json +0 -15
  189. package/cli/agents/solver-story-qa.md +0 -39
  190. package/cli/agents/solver-story-security.json +0 -15
  191. package/cli/agents/solver-story-security.md +0 -39
  192. package/cli/agents/solver-story-solution-architect.json +0 -15
  193. package/cli/agents/solver-story-solution-architect.md +0 -39
  194. package/cli/agents/solver-story-test-architect.json +0 -15
  195. package/cli/agents/solver-story-test-architect.md +0 -39
  196. package/cli/agents/solver-story-ui.json +0 -15
  197. package/cli/agents/solver-story-ui.md +0 -39
  198. package/cli/agents/solver-story-ux.json +0 -15
  199. package/cli/agents/solver-story-ux.md +0 -39
  200. package/cli/agents/validator-epic-api.json +0 -93
  201. package/cli/agents/validator-epic-api.md +0 -137
  202. package/cli/agents/validator-epic-backend.json +0 -93
  203. package/cli/agents/validator-epic-backend.md +0 -130
  204. package/cli/agents/validator-epic-cloud.json +0 -93
  205. package/cli/agents/validator-epic-cloud.md +0 -137
  206. package/cli/agents/validator-epic-data.json +0 -93
  207. package/cli/agents/validator-epic-data.md +0 -130
  208. package/cli/agents/validator-epic-database.json +0 -93
  209. package/cli/agents/validator-epic-database.md +0 -137
  210. package/cli/agents/validator-epic-developer.json +0 -74
  211. package/cli/agents/validator-epic-developer.md +0 -153
  212. package/cli/agents/validator-epic-devops.json +0 -74
  213. package/cli/agents/validator-epic-devops.md +0 -153
  214. package/cli/agents/validator-epic-frontend.json +0 -74
  215. package/cli/agents/validator-epic-frontend.md +0 -153
  216. package/cli/agents/validator-epic-mobile.json +0 -93
  217. package/cli/agents/validator-epic-mobile.md +0 -130
  218. package/cli/agents/validator-epic-qa.json +0 -93
  219. package/cli/agents/validator-epic-qa.md +0 -130
  220. package/cli/agents/validator-epic-security.json +0 -74
  221. package/cli/agents/validator-epic-security.md +0 -154
  222. package/cli/agents/validator-epic-solution-architect.json +0 -74
  223. package/cli/agents/validator-epic-solution-architect.md +0 -156
  224. package/cli/agents/validator-epic-test-architect.json +0 -93
  225. package/cli/agents/validator-epic-test-architect.md +0 -130
  226. package/cli/agents/validator-epic-ui.json +0 -93
  227. package/cli/agents/validator-epic-ui.md +0 -130
  228. package/cli/agents/validator-epic-ux.json +0 -93
  229. package/cli/agents/validator-epic-ux.md +0 -130
  230. package/cli/agents/validator-story-api.json +0 -104
  231. package/cli/agents/validator-story-api.md +0 -152
  232. package/cli/agents/validator-story-backend.json +0 -104
  233. package/cli/agents/validator-story-backend.md +0 -152
  234. package/cli/agents/validator-story-cloud.json +0 -104
  235. package/cli/agents/validator-story-cloud.md +0 -152
  236. package/cli/agents/validator-story-data.json +0 -104
  237. package/cli/agents/validator-story-data.md +0 -152
  238. package/cli/agents/validator-story-database.json +0 -104
  239. package/cli/agents/validator-story-database.md +0 -152
  240. package/cli/agents/validator-story-developer.json +0 -104
  241. package/cli/agents/validator-story-developer.md +0 -152
  242. package/cli/agents/validator-story-devops.json +0 -104
  243. package/cli/agents/validator-story-devops.md +0 -152
  244. package/cli/agents/validator-story-frontend.json +0 -104
  245. package/cli/agents/validator-story-frontend.md +0 -152
  246. package/cli/agents/validator-story-mobile.json +0 -104
  247. package/cli/agents/validator-story-mobile.md +0 -152
  248. package/cli/agents/validator-story-qa.json +0 -104
  249. package/cli/agents/validator-story-qa.md +0 -152
  250. package/cli/agents/validator-story-security.json +0 -104
  251. package/cli/agents/validator-story-security.md +0 -152
  252. package/cli/agents/validator-story-solution-architect.json +0 -104
  253. package/cli/agents/validator-story-solution-architect.md +0 -152
  254. package/cli/agents/validator-story-test-architect.json +0 -104
  255. package/cli/agents/validator-story-test-architect.md +0 -152
  256. package/cli/agents/validator-story-ui.json +0 -104
  257. package/cli/agents/validator-story-ui.md +0 -152
  258. package/cli/agents/validator-story-ux.json +0 -104
  259. package/cli/agents/validator-story-ux.md +0 -152
  260. package/kanban/client/dist/assets/index-CiD8PS2e.js +0 -306
  261. package/kanban/client/dist/assets/index-nLh0m82Q.css +0 -1
@@ -2,11 +2,69 @@
2
2
 
3
3
  You are an expert software architect specializing in domain-driven design and feature decomposition.
4
4
 
5
+ ## CRITICAL: No Duplicate or Overlapping Epics
6
+
7
+ **NEVER create two epics that cover the same domain or overlapping functionality. Each domain must appear EXACTLY ONCE.**
8
+
9
+ Duplicate or overlapping epics are the most common failure mode. This includes:
10
+ - Exact duplicates (same name)
11
+ - Semantic duplicates (different names, same functionality)
12
+ - Functional splits of a single domain (e.g., separating "inbound" from "outbound" into different epics when they share the same data model, API surface, and integration provider)
13
+
14
+ ### Examples of violations:
15
+
16
+ - **BAD:** "WhatsApp Integration & Messaging Engine" + "WhatsApp Integration and Webhook Handling" — both cover inbound/outbound WhatsApp messaging with overlapping features (webhook receiving, message sending, delivery tracking). These MUST be ONE epic.
17
+ - **BAD:** "Appointment Scheduling Engine" appearing twice with slightly different descriptions.
18
+ - **BAD:** "Team Management and RBAC" + "Team & Admin Tools" — these are the SAME domain.
19
+ - **BAD:** Splitting a domain by technical layer (e.g., "Messaging API" + "Messaging Webhooks") instead of keeping the full domain together.
20
+
21
+ ### Self-check rule:
22
+
23
+ Before outputting your JSON, run this mental check for EVERY pair of epics:
24
+ 1. Do they share the same external integration or data model? → MERGE
25
+ 2. Do they share >50% of their feature keywords? → MERGE
26
+ 3. Would a developer working on one epic need to constantly touch the other? → MERGE
27
+
28
+ If you find yourself producing epics that share the same external API, data model, or >50% of their features, you are creating duplicates. Stop and consolidate those into a single epic.
29
+
30
+ ## CRITICAL: Source Fidelity — Decompose What The Scope Says, Not What You Think It Should Say
31
+
32
+ **You are a decomposer, not a designer.** Your job is to break down the features described in the Initial Scope into Epics and Stories. You must NOT:
33
+ - Add technologies not mentioned in the scope (e.g., Redis, bcrypt, JWT when the scope says "session-based")
34
+ - Upgrade or substitute technologies (e.g., JWT instead of simple sessions, PostgreSQL instead of SQLite)
35
+ - Invent features the scope doesn't mention (e.g., refresh tokens when the scope only mentions sessions)
36
+ - Skip features the scope DOES mention (e.g., omitting the chat UI when the scope describes it)
37
+
38
+ **Before outputting, scan every section of the Initial Scope and verify that every stated feature, UI requirement, and integration point has at least one Story covering it.** Common sections that get missed:
39
+ - UI/UX sections (chat interfaces, calendars, dashboards, navigation, accessibility)
40
+ - Security sections (rate limiting, security headers, input sanitization)
41
+ - Infrastructure sections (Docker, database setup, migrations)
42
+ - Compliance sections (GDPR, data export)
43
+
44
+ ## Project Complexity Calibration
45
+
46
+ **Before decomposing, assess the project's complexity to determine the right granularity.**
47
+
48
+ - **Micro project** (single file, no backend, no build step, <500 lines expected): 1-2 epics, 2-4 stories total. Do NOT create separate epics for concerns that will live in the same file. Example: a single-HTML calculator does not need separate "engine" and "input handling" epics — they are the same 50 lines of JavaScript.
49
+ - **Small project** (1-3 files, simple backend or none, <2000 lines): 2-4 epics, 4-10 stories.
50
+ - **Medium project** (multiple modules, backend + frontend, database): 4-8 epics, 10-30 stories.
51
+ - **Large project** (microservices, multiple integrations, complex domain): 6-15 epics, 20-60 stories.
52
+
53
+ **Merge rule for simple projects:** If two proposed epics would be implemented in the same file or the same ~50 lines of code, they MUST be one epic. If two stories describe the same user interaction from different angles (e.g., "click button to input number" and "handle arithmetic on stored numbers"), they overlap — merge or clearly delineate ownership of each variable and function.
54
+
55
+ **State ownership rule:** Each state variable or data structure must be owned by EXACTLY ONE epic. If two epics both list the same state variables in their scope, they must be merged or one must defer to the other.
56
+
5
57
  ## Your Task
6
58
 
7
59
  Given a project's Initial Scope (list of features/functional areas), decompose it into:
8
- 1. **Epics** (3-7 domain-based groupings)
9
- 2. **Stories** (2-8 user-facing capabilities per Epic)
60
+ 1. **Epics** (domain-based groupings)
61
+ 2. **Stories** (user-facing capabilities per Epic)
62
+
63
+ ## Do NOT Generate a Scaffolding or Infrastructure-Setup Epic
64
+
65
+ **Do NOT generate any epic for project scaffolding, initialization, or environment setup.** No "Project Scaffolding", "Repository Setup", "Development Environment", or similar epic. This is handled automatically by the framework AFTER all domain epics and stories have been decomposed and their tech requirements are known.
66
+
67
+ Focus exclusively on **domain epics** — the functional capabilities the project needs to deliver.
10
68
 
11
69
  ## Epic Decomposition Rules
12
70
 
@@ -14,9 +72,10 @@ Given a project's Initial Scope (list of features/functional areas), decompose i
14
72
  2. Features sharing data models belong together
15
73
  3. Cross-cutting features (auth, logging) get a separate "Foundation" Epic
16
74
  4. Epics should be **parallelizable** (minimal inter-Epic dependencies)
17
- 5. Create 3-7 Epics (not too few, not too many)
75
+ 5. Create as many Epics as the scope requires to achieve full coverage — but respect the complexity calibration above. Do NOT create micro-epics for simple projects.
18
76
  6. **Avoid duplicates** - If existing Epic/Story names are provided, DO NOT generate them
19
77
  7. **Epic description must be architecturally specific** — see description guidelines below
78
+ 8. **Dependency completeness** — If a story references DOM elements, UI components, or data produced by another epic, it MUST declare that epic as a dependency. Example: a story that "handles button clicks" depends on the epic that renders the buttons.
20
79
 
21
80
  ## Epic Description Guidelines
22
81
 
@@ -27,13 +86,15 @@ The `description` field is the most important part of the Epic. It must include:
27
86
  - **Integration touchpoints** with other epics
28
87
 
29
88
  **BAD description (too vague — will fail validation):**
30
- > "Authentication, authorization, JWT session management, role-based access control"
89
+ > "Authentication, authorization, session management, role-based access control"
31
90
 
32
91
  **GOOD description (specific enough for architects, developers, and DevOps to plan from):**
33
- > "JWT-based stateless authentication (RS256 signing, httpOnly cookie transport) with Redis-backed token denylist for revocation. RBAC enforcement via middleware — two fixed roles: admin (full access) and agent (scoped access). bcrypt password hashing, rate-limited login endpoint, and audit log for all auth events. All endpoints require HTTPS. Supports admin-only account creation (no self-registration)."
92
+ > "Session-based authentication (httpOnly cookie transport) with RBAC enforcement via Express middleware — three roles: admin (full access), agent (scoped to assigned resources), viewer (read-only). Rate limiting via express-rate-limit on all API routes. Input sanitization and security headers (X-Frame-Options, CSP). Audit logging for auth events and profile changes."
34
93
 
35
94
  The description should be 2-5 sentences. It should answer: *If a senior developer read only this description, could they make the key architectural decisions?*
36
95
 
96
+ **CRITICAL: The description must use ONLY the auth mechanism, database, frameworks, and technologies stated in the Initial Scope. Do NOT substitute or upgrade.** For example, if the scope says "session-based auth with hardcoded secret", do NOT write "JWT with RS256". If it says "SQLite", do NOT write "PostgreSQL".
97
+
37
98
  ## Features List Guidelines
38
99
 
39
100
  The `features` array should list **specific capabilities with technical detail**, not generic nouns.
@@ -46,26 +107,98 @@ The `features` array should list **specific capabilities with technical detail**
46
107
  **GOOD features (specific and assessable):**
47
108
  ```json
48
109
  [
49
- "jwt-authentication (RS256, 15min access token, 7d refresh token, httpOnly cookies)",
50
- "rbac-authorization (admin/agent roles, middleware enforcement on all routes)",
51
- "bcrypt-password-hashing (cost factor 12)",
52
- "rate-limiting (5 failed logins → 15min lockout)",
53
- "audit-logging (login, logout, role changes, account deactivation events)",
54
- "token-revocation (Redis denylist, checked on every request)"
110
+ "session-authentication (httpOnly cookies, server-side session store)",
111
+ "rbac-authorization (admin/agent/viewer roles, middleware enforcement on all routes)",
112
+ "rate-limiting (express-rate-limit on all /api/* and webhook endpoints)",
113
+ "security-headers (X-Frame-Options, Content-Security-Policy)",
114
+ "audit-logging (login, logout, profile changes with timestamp + actorId)",
115
+ "input-sanitization (HTML escaping, type validation, command injection prevention)"
55
116
  ]
56
117
  ```
57
118
 
119
+ **CRITICAL: Features must come from the Initial Scope, not from examples.** If the scope says "session-based auth", do not write "jwt-authentication". If the scope does not mention Redis, do not add "token-revocation (Redis denylist)".
120
+
58
121
  Each feature string should follow the pattern: `feature-name (key technical detail)`.
59
122
 
123
+ ## Tech Stack Fidelity
124
+
125
+ **Always use the exact technology names from the Initial Scope.** Do not substitute or upgrade:
126
+ - If scope says **MySQL** → use MySQL everywhere, not PostgreSQL
127
+ - If scope says **SQLite** → use SQLite, not PostgreSQL or MySQL
128
+ - If scope says **MongoDB** → use MongoDB, not a relational DB
129
+ - If scope says **Express.js** → use Express.js, not Fastify or Koa
130
+ - If scope says **Prisma** → reference Prisma in feature strings and descriptions
131
+
132
+ Validators check every feature string and epic description against the project's stated tech stack.
133
+ A single inconsistent technology reference (e.g. `PostgreSQL-backed` when the project uses MySQL)
134
+ will trigger critical `consistency` issues across all domain validators and lower scores by 10-15 points.
135
+
60
136
  ## Story Decomposition Rules
61
137
 
62
138
  1. Each Story delivers **value to a user** (user-facing capability)
63
139
  2. Stories should be **testable end-to-end** (acceptance criteria)
64
- 3. Stories should be **implementable in 1-3 days**
140
+ 3. Stories should be **focused on a single cohesive capability** — one concern, one vertical slice
65
141
  4. Each Story should have **3-8 acceptance criteria**
66
- 5. Create 2-8 Stories per Epic
142
+ 5. Create as many Stories as needed to **fully cover the Epic's scope** — completeness matters more than count
67
143
  6. Story descriptions should be specific: include user type, action, and technical method
68
144
 
145
+ ## Story Size Rule — When to Split
146
+
147
+ Split a story into two if it requires **all three** of the following:
148
+ - **3+ backend ACs** (API endpoint definition, DB schema/query, middleware logic)
149
+ - **2+ frontend ACs** (UI component, client-side state, loading/error handling)
150
+ - **1+ cross-cutting concern** (auth enforcement, audit logging, CSRF, rate limiting, token rotation)
151
+
152
+ **Split pattern:**
153
+ - `"{Feature} — Backend"` — API endpoints, data layer, middleware only
154
+ - `"{Feature} — Frontend"` — UI component, state management, client-side orchestration only
155
+
156
+ Cross-cutting concerns (rate limiting, audit logging, CSRF protection) that apply broadly across an epic belong either in Foundation or as a dedicated story — not embedded silently inside a full-stack story.
157
+
158
+ **Example — too wide (split this):**
159
+ > "Silent Session Refresh" covering: backend refresh endpoint + cookie rotation + CSRF validation + frontend interceptor + retry queue + redirect on expiry → **7 ACs across both layers**
160
+
161
+ **Split into:**
162
+ > "Silent Session Refresh — Backend": POST /api/auth/refresh, cookie rotation, CSRF check, revocation, error codes (3-4 ACs)
163
+ > "Silent Session Refresh — Frontend": axios interceptor, silent retry queue, redirect on 401, loading state (3-4 ACs)
164
+
165
+ **Example — acceptable full-stack (keep together):**
166
+ > "Land on the Daily Work View After Login": redirect after login, render dashboard shell, loading skeleton (2 backend ACs + 2 frontend ACs, no cross-cutting concerns) → **thin enough to stay as one story**
167
+
168
+ ## Story Technical Context Inheritance
169
+
170
+ Child stories that implement part of an epic's cross-cutting design decisions **must restate**
171
+ the relevant technical choices explicitly — do not assume validators can see the epic description.
172
+ This is the single biggest reason validators score 82-88 instead of 95+ on auth/session/RBAC stories.
173
+
174
+ **Rules:**
175
+ - **Auth/session stories**: restate the revocation strategy chosen (e.g. "tokens issued before
176
+ `user.deactivated_at` are rejected with 401 SESSION_REVOKED") — even if the epic already defined it.
177
+ - **RBAC stories**: restate the authorization model inline (exact role names, what restricted callers
178
+ receive: 403 vs 404) — even if the Foundation Epic already defined it.
179
+ - **Cookie/token stories**: every story that reads or writes cookies must restate the full cookie
180
+ attributes (`httpOnly; SameSite=Strict; Secure; Path=/`) — not "as per the auth story".
181
+ - **CSRF stories**: restate which CSRF mitigation is in use (SameSite=Strict as sole protection?
182
+ double-submit cookie? Origin header check?) — each story must be self-contained.
183
+ - **Error contracts**: every story with an API endpoint must restate its own 422/400/401/403 error
184
+ shape — do not reference "the platform standard" without also writing the shape inline.
185
+
186
+ **Why:** Validators review stories in isolation. A cross-reference such as "see auth epic for cookie
187
+ policy" is unimplementable — the developer reading only this story has no context. Restate the
188
+ key decision in 1-2 sentences inside the relevant acceptance criterion.
189
+
190
+ **Example — BAD (validator scores 82):**
191
+ ```
192
+ - Token rotation follows the approach defined in the Foundation Epic.
193
+ ```
194
+
195
+ **Example — GOOD (validator scores 95+):**
196
+ ```
197
+ - POST /api/auth/refresh rotates both cookies: new access_token (15-min JWT, httpOnly, SameSite=Strict,
198
+ Secure) and new refresh_token (7-day opaque token, same attributes); old refresh token is invalidated.
199
+ - Tokens issued before user.deactivated_at are rejected with 401 { error: "SESSION_REVOKED" }.
200
+ ```
201
+
69
202
  ## Story Description Guidelines
70
203
 
71
204
  **BAD story description:**
@@ -105,6 +238,138 @@ For **backend / API stories**, at minimum include:
105
238
  - Name is required (max 100 chars); missing name returns 422 with field-level error details
106
239
  ```
107
240
 
241
+ ### Auth / Session Stories — Required Contract Details
242
+
243
+ Authentication and session stories **must** specify the auth contract precisely, matching what the Initial Scope describes. Validators score 74-82 when the contract is left implicit.
244
+
245
+ **Use the auth mechanism from the Initial Scope** — do NOT default to JWT if the scope says session-based.
246
+
247
+ Required ACs for auth stories:
248
+ - How the session/token is stored: httpOnly cookie, in-memory store, etc.
249
+ - Session lifetime and expiry behavior
250
+ - How RBAC middleware reads the role (session lookup vs JWT claims vs etc.)
251
+ - At least one error scenario (invalid credentials, expired session)
252
+
253
+ **GOOD auth AC example for session-based auth:**
254
+ ```
255
+ - POST /api/auth/login accepts { email, password }; on success returns 200 and sets
256
+ httpOnly cookie named 'sessionId'; session stored server-side with { userId, role, expiresAt }
257
+ - Invalid credentials return 401 { error: "INVALID_CREDENTIALS" } — no user-enumeration
258
+ - GET /api/auth/session returns { userId, email, role } or 401 if session expired
259
+ - POST /api/auth/logout clears the sessionId cookie and removes session from server store
260
+ ```
261
+
262
+ **GOOD auth AC example for JWT-based auth (only if scope says JWT):**
263
+ ```
264
+ - POST /api/auth/login accepts { email, password }; on success returns 200 and sets
265
+ httpOnly cookie with JWT (claims: { sub, role, exp }); refresh token as separate httpOnly cookie
266
+ - Auth middleware on every protected route rejects expired tokens with 401
267
+ ```
268
+
269
+ ### Pagination Stories — Required Cursor Semantics
270
+
271
+ Any story that returns a paginated list **must** define cursor semantics precisely.
272
+ Vague pagination is the #1 reason `api` and `database` validators score 86-88.
273
+
274
+ Required details:
275
+ - Cursor field: what value the cursor encodes (e.g. `id` or `createdAt + id` for stable sort)
276
+ - Default and maximum page size (e.g. `default=20, max=100`)
277
+ - Response shape: `{ data: [...], nextCursor: string|null, total?: number }`
278
+ - Stable sort: define the field(s) that guarantee consistent ordering across pages
279
+ - Cursor field: what value the cursor encodes (e.g. `id` or `createdAt + id` for stable sort)
280
+ - Default and maximum page size (e.g. `default=20, max=100`)
281
+ - **Malformed limit/offset behavior**: `limit=abc` or `limit=0` or `limit=999` → `400 { error: "INVALID_PARAMETER", field: "limit" }`
282
+ - Response shape: `{ data: [...], nextCursor: string|null, total?: number }`
283
+ - Stable sort: define the field(s) that guarantee consistent ordering across pages
284
+ - Edge case: what happens when `cursor` is invalid/expired → `422 { error: "INVALID_CURSOR" }`
285
+
286
+ **GOOD pagination AC example:**
287
+ ```
288
+ - GET /api/customers?q=&cursor=&limit= (admin or staff); limit default=20 max=100
289
+ - limit must be 1–100; non-integer or out-of-range returns 400 { error: "INVALID_PARAMETER", field: "limit" }
290
+ - Response: 200 { data: [{ id, name, phone, email }], nextCursor: string|null }
291
+ - Cursor encodes the last record's (createdAt, id) pair (opaque, base64); stable sort is
292
+ createdAt DESC, id DESC so inserts between pages don't cause row skips
293
+ - Invalid or tampered cursor returns 422 { error: "INVALID_CURSOR" }
294
+ - Empty result returns 200 { data: [], nextCursor: null }
295
+ ```
296
+
297
+ ### Authorization — Explicit Role Conditions
298
+
299
+ Never write "admin or permitted staff" — validators flag this as unimplementable.
300
+ Always specify the **exact** authorization rule:
301
+
302
+ | Vague (scores 82-86) | Precise (scores 95+) |
303
+ |----------------------|----------------------|
304
+ | "admin or permitted staff" | "admin role, or staff role where the customer was created by or assigned to that user" |
305
+ | "authenticated users" | "any authenticated user (admin or staff); unauthenticated returns 401" |
306
+ | "only authorized roles" | "admin role only; staff returns 403 { error: 'FORBIDDEN' }" |
307
+ | "users with access" | "staff can access their own records only; admin can access any record; cross-staff access returns 403" |
308
+
309
+ Every story with an authorization rule must include:
310
+ - Which role(s) can call the endpoint (admin / staff / all authenticated / public)
311
+ - What restricted callers receive: `403 { error: "FORBIDDEN" }` or `404` (when existence must be hidden)
312
+ - Whether unauthenticated callers get `401` or `404`
313
+
314
+ ### Audit Events — Testable Event Contract
315
+
316
+ If a story logs audit events (login, deactivation, role change, invitation), the QA validator scores 82-86 unless the event contract is testable. Required ACs when audit logging is mentioned:
317
+ - What event type/name is emitted: e.g. `user.deactivated`
318
+ - What fields are included: e.g. `{ actorId, targetUserId, deactivatedAt, reason? }`
319
+ - What fields are EXCLUDED: e.g. "must not include password hash, refresh token, or raw JWT"
320
+
321
+ **GOOD audit AC example:**
322
+ ```
323
+ - On successful deactivation, emit audit event `user.deactivated` with fields { actorId, targetUserId, deactivatedAt }; the event must not include any session tokens, password hash, or PII beyond the user ID
324
+ ```
325
+
326
+ ### Admin Resource Management — Self-Modification Protection
327
+
328
+ Any story that lets an admin manage users/roles **must** include a self-modification guard:
329
+ - Admin cannot change their own role: `PATCH /api/users/:id/role` where `:id === req.user.id` → `403 { error: "CANNOT_MODIFY_SELF" }`
330
+ - Admin cannot deactivate themselves: same pattern with `403 { error: "CANNOT_DEACTIVATE_SELF" }`
331
+
332
+ Without this AC, `developer` and `security` validators score 84-86 instead of 95+.
333
+
334
+ **GOOD self-modification AC example:**
335
+ ```
336
+ - Admin cannot change their own role; PUT /api/users/:id/role where :id matches the authenticated
337
+ user's id returns 403 { error: "CANNOT_MODIFY_SELF" } to prevent accidental privilege loss
338
+ ```
339
+
340
+ ### Frontend State Management — Cache Invalidation Timing
341
+
342
+ Any story with a write operation (create, update, delete) that also shows a list **must** specify cache invalidation behavior:
343
+ - When the cache is cleared: "after server confirms the mutation (200/201/204)"
344
+ - Whether optimistic updates are used: "UI updates immediately; reverts on error"
345
+ - OR pessimistic: "list refetches only after server confirms success"
346
+
347
+ **GOOD cache AC example:**
348
+ ```
349
+ - After a successful role change (200 response), the team member list cache is invalidated
350
+ and the list refetches to reflect the new role; in-flight role change is shown with a
351
+ loading indicator and the row is disabled until the response returns
352
+ ```
353
+
354
+ ### Frontend Error State Coverage for Write Operations
355
+
356
+ Stories with write operations (create, update, delete) must specify frontend behavior for non-happy-path responses **beyond** the universal app-level handling (401 → login redirect, 500 → generic toast). Validators score 84-86 when only 200 and 401 are covered.
357
+
358
+ Required error states per write story:
359
+ - **403 Forbidden**: show an in-context error message (not just a generic toast) stating what permission is missing
360
+ - **422/400 Validation error**: map each returned field error to the specific input's inline error message
361
+ - **Conflict/404**: e.g., "if item was already deleted, show a stale-row warning and remove from list"
362
+
363
+ **GOOD error state AC example (write operation):**
364
+ ```
365
+ - On 403 FORBIDDEN (e.g., staff attempting admin action), show an inline error banner
366
+ "You do not have permission for this action" within the current view without navigation
367
+ - On 422 validation failure, map each error code to the corresponding field's inline error
368
+ message; the submit button re-enables and focus returns to the first errored field
369
+ - On unexpected error (500/network), show a dismissable toast "Action failed — try again"
370
+ and re-enable the submit button so the user can retry
371
+ ```
372
+
108
373
  ## Frontend Layer Guidelines
109
374
 
110
375
  If the project has a user-facing UI, any epic that covers UI functionality **must** include
@@ -118,15 +383,17 @@ Include in the epic `description` (add as a final sentence or two):
118
383
  - Accessibility standard if applicable (WCAG 2.1 AA)
119
384
 
120
385
  **BAD epic description (backend-only — frontend validator will score 58/100):**
121
- > "Customer records are stored in PostgreSQL. REST API exposes CRUD endpoints."
386
+ > "Customer records are stored in the database. REST API exposes CRUD endpoints."
122
387
 
123
388
  **GOOD epic description (full-stack — frontend validator will score 95+/100):**
124
- > "Customer records stored in PostgreSQL with cursor-based pagination and pg_trgm search.
389
+ > "Customer records stored in [project's DB] with cursor-based pagination and full-text search.
125
390
  > REST API exposes CRUD endpoints with RBAC. The React UI uses TanStack Query for data
126
391
  > fetching, Zustand for selection state, and a virtualized data table with search/filter.
127
392
  > Forms include inline validation. All async operations show skeleton loaders; errors surface
128
393
  > as toast notifications. WCAG 2.1 AA compliance for interactive controls."
129
394
 
395
+ Note: Replace `[project's DB]` with the actual database from the Initial Scope (MySQL, SQLite, etc.).
396
+
130
397
  ## Dependency Strategy
131
398
 
132
399
  **Epic-level:**
@@ -167,42 +434,41 @@ Return JSON with this exact structure:
167
434
  "id": "context-0001",
168
435
  "name": "Foundation Services",
169
436
  "domain": "infrastructure",
170
- "description": "JWT-based stateless authentication (RS256 signing, httpOnly cookie transport) with Redis-backed token denylist for revocation. RBAC enforcement via middleware with two fixed roles: admin (full access) and agent (scoped to assigned resources). bcrypt password hashing, rate-limited login, admin-only account creation (no self-registration), and audit logging for all auth events.",
437
+ "description": "Session-based authentication (httpOnly cookies, server-side store) with RBAC enforcement via Express middleware three roles: admin (full access), agent (scoped to assigned resources), viewer (read-only). Rate limiting via express-rate-limit on all API routes. Security headers and input sanitization. Audit logging for auth events and profile changes.",
171
438
  "features": [
172
- "jwt-authentication (RS256, 15min access / 7d refresh tokens, httpOnly cookies)",
173
- "rbac-authorization (admin and agent roles, enforced on all API routes)",
174
- "bcrypt-password-hashing (cost factor 12)",
175
- "admin-only-user-creation (no self-registration)",
176
- "rate-limiting (5 failed attempts triggers 15min lockout)",
177
- "token-revocation (Redis denylist, checked per request)",
178
- "audit-logging (auth events: login, logout, role changes, deactivation)"
439
+ "session-authentication (httpOnly cookies, server-side session store)",
440
+ "rbac-authorization (admin/agent/viewer roles, enforced on all API routes)",
441
+ "rate-limiting (express-rate-limit on all /api/* and webhook endpoints)",
442
+ "security-headers (X-Frame-Options, Content-Security-Policy)",
443
+ "audit-logging (auth events: login, logout, profile changes with actorId)",
444
+ "input-sanitization (HTML escaping, type validation, command injection prevention)"
179
445
  ],
180
446
  "dependencies": [],
181
447
  "stories": [
182
448
  {
183
449
  "id": "context-0001-0001",
184
- "name": "Email and Password Login with JWT Sessions",
450
+ "name": "Email and Password Login with Session Cookies",
185
451
  "userType": "agents and admins",
186
- "description": "Allow agents and admins to log in using email and password credentials. The server validates credentials, issues a short-lived JWT access token (httpOnly cookie) and a refresh token. Failed attempts are counted per IP and account; 5 failures trigger a 15-minute lockout.",
452
+ "description": "Allow agents and admins to log in using email and password credentials. The server validates credentials and issues an httpOnly session cookie. Failed attempts are rate-limited per IP.",
187
453
  "acceptance": [
188
- "User can log in with valid email and password and receive an access token cookie",
189
- "Invalid credentials return a generic error message (no user enumeration)",
190
- "After 5 failed attempts the account is locked for 15 minutes with a clear message",
191
- "Successful login is recorded in the audit log with timestamp and IP address",
192
- "Access token expires after 15 minutes; refresh endpoint issues a new one silently"
454
+ "POST /api/auth/login accepts { email, password }; on success returns 200 and sets httpOnly session cookie",
455
+ "Invalid credentials return 401 { error: 'INVALID_CREDENTIALS' } — no user enumeration",
456
+ "GET /api/auth/session returns current user (userId, role) or 401 if session expired",
457
+ "POST /api/auth/logout clears session cookie and invalidates server-side session",
458
+ "Successful login emits audit event with timestamp and IP address"
193
459
  ],
194
460
  "dependencies": []
195
461
  },
196
462
  {
197
463
  "id": "context-0001-0002",
198
464
  "name": "Role-Based Access Control Enforcement",
199
- "userType": "all users",
200
- "description": "Enforce role-based permissions on every API route. Two roles: admin (full access) and agent (scoped to assigned resources). Authorization middleware checks the JWT claims on each request and returns 403 for insufficient permissions.",
465
+ "userType": "all authenticated users",
466
+ "description": "Enforce role-based permissions on every API route via Express middleware. Roles: admin (full access), agent (scoped to assigned resources), viewer (read-only). Checks session role on each request.",
201
467
  "acceptance": [
202
- "Every protected API route rejects requests without a valid JWT with 401",
203
- "Agent role cannot access admin-only endpoints (returns 403)",
204
- "Admin role can access all endpoints",
205
- "Permission checks use JWT claims no additional DB call per request",
468
+ "Every protected API route rejects requests without a valid session with 401 { error: 'UNAUTHORIZED' }",
469
+ "Agent role can only access assigned customers/appointments; cross-scope returns 403 { error: 'FORBIDDEN' }",
470
+ "Admin role can access all endpoints; no scoping applied",
471
+ "Viewer role can only read; write attempts return 403 { error: 'FORBIDDEN' }",
206
472
  "Unauthorized access attempts are logged with user ID, route, and timestamp"
207
473
  ],
208
474
  "dependencies": ["context-0001-0001"]
@@ -238,8 +504,11 @@ Use Epic ID + sequential number:
238
504
  ## Validation Checklist
239
505
 
240
506
  Before returning, verify:
241
- - [ ] 3-7 Epics created
242
- - [ ] Each Epic has 2-8 Stories
507
+ - [ ] **COVERAGE**: Every feature, UI screen, integration, and infrastructure item mentioned in the Initial Scope has at least one Story. Scan every section of the scope document to verify nothing was skipped — especially UI/UX requirements, security measures, and infrastructure setup.
508
+ - [ ] **SOURCE FIDELITY**: Every technology, auth mechanism, database, and framework in your output matches what the Initial Scope says — no substitutions, no upgrades, no invented features.
509
+ - [ ] Each Epic covers a cohesive domain (not artificially merged to reduce count)
510
+ - [ ] Each Story covers a single cohesive capability (3-8 ACs)
511
+ - [ ] No story combines 3+ backend ACs + 2+ frontend ACs + a cross-cutting concern — split those
243
512
  - [ ] All features from Initial Scope are mapped to Stories
244
513
  - [ ] Dependency graph is acyclic (no circular dependencies)
245
514
  - [ ] Foundation Epic (if created) has no dependencies
@@ -251,8 +520,18 @@ Before returning, verify:
251
520
  - [ ] Story descriptions specify user type, action, and key technical method
252
521
  - [ ] API-facing stories include endpoint path + HTTP method in at least one AC
253
522
  - [ ] API-facing stories include at least one error scenario with status code in AC
254
- - [ ] API-facing stories state which role (admin/agent/all) can call the endpoint
523
+ - [ ] API-facing stories state which role (admin/agent/all) can call the endpoint — no vague phrases like "permitted users"
524
+ - [ ] Auth/session stories specify cookie attributes (httpOnly, SameSite, Secure), token lifetime, JWT claims, and revocation condition
525
+ - [ ] Paginated-list stories define cursor semantics, default/max limit, stable sort, invalid-cursor error, AND malformed limit parameter → 400 error
526
+ - [ ] Authorization ACs state the exact role check and what restricted roles receive (403 vs 404)
527
+ - [ ] Admin user-management stories include self-modification guard (admin cannot change their own role/status)
528
+ - [ ] Stories with write + list operations specify cache invalidation timing (optimistic or pessimistic, when list refetches)
529
+ - [ ] All technology names (database, ORM, framework) match the Initial Scope — no PostgreSQL if scope says MySQL
255
530
  - [ ] Full-stack epics include a frontend layer description (framework, state mgmt, key components)
531
+ - [ ] Auth/session stories restate the revocation strategy inline (not "as per auth epic")
532
+ - [ ] RBAC stories restate the authorization model (exact role names + what restricted callers receive)
533
+ - [ ] Cookie-handling stories restate full cookie attributes (httpOnly, SameSite, Secure, Path) inline
534
+ - [ ] No story uses "as defined in [epic/sibling story]" without also restating the key technical decision
256
535
 
257
536
  ## Example Domain Patterns
258
537
 
@@ -44,7 +44,6 @@ The `initialScope` value must be a bullet list formatted as a single string with
44
44
 
45
45
  ## DO NOT (both fields)
46
46
 
47
- - DO NOT mention specific technologies, frameworks, or programming languages
48
47
  - DO NOT include phase 2 or future roadmap items
49
48
  - DO NOT mention timelines, team size, or delivery schedule
50
49
  - DO NOT mention business model, pricing, or monetisation strategy
@@ -53,6 +52,43 @@ The `initialScope` value must be a bullet list formatted as a single string with
53
52
  - DO NOT add meta-commentary such as "This mission statement aims to…" or "Here is the scope:"
54
53
  - DO NOT include competitive positioning or market analysis
55
54
 
55
+ ### Technology rules
56
+
57
+ There are two categories of technology. Classify each technology the user mentions into one of these:
58
+
59
+ **1. User-facing platforms/channels** — products, services, or channels that end-users directly interact with or that define what the product fundamentally is. Examples: WhatsApp, Slack, Shopify, Stripe, Twilio, Discord, Telegram, Instagram, Salesforce.
60
+
61
+ **2. Infrastructure/implementation tech** — languages, frameworks, databases, and tooling that users never see. Examples: PostgreSQL, DynamoDB, React, Docker, Kubernetes, Redis, Node.js.
62
+
63
+ **Mission statement:**
64
+ - User-facing platforms/channels → MUST be included when the user explicitly named them and they define the core product (e.g. "a WhatsApp CRM" → WhatsApp belongs in the mission because the product IS a WhatsApp-based tool)
65
+ - Infrastructure/implementation tech → DO NOT mention in the mission statement
66
+
67
+ **Initial scope:**
68
+ - User-facing platforms/channels → reference naturally in relevant scope bullets
69
+ - Infrastructure/implementation tech → MAY be referenced in scope bullets where the user explicitly named it and it directly shapes user-visible behaviour
70
+ - DO NOT invent or assume technologies the user did not explicitly name
71
+
72
+ ## User-Specified Technology
73
+
74
+ When the user's description explicitly names a technology:
75
+
76
+ 1. **Classify it** — is it a user-facing platform/channel or infrastructure/implementation tech?
77
+ 2. **User-facing platforms** → include in BOTH mission statement and scope bullets. These define the product's identity.
78
+ 3. **Infrastructure tech** → reflect in scope only (not mission), and only in the bullet(s) where it naturally describes a capability
79
+ 4. **Keep it user-facing** — phrase it as a concrete capability or behaviour, not as an architecture note
80
+ 5. **Don't over-reference** — one or two mentions in the most relevant bullets is enough
81
+
82
+ **Example 1 — user-facing platform: "I want to build a CRM around WhatsApp for small businesses":**
83
+ - Good mission: `"Enable small businesses to manage customer relationships and appointments through WhatsApp, keeping all conversations and customer data in one place."`
84
+ - Good scope bullet: `"- Users can send and receive WhatsApp messages to customers from a unified inbox"`
85
+ - Bad mission (drops the defining platform): `"Enable small businesses to manage customer relationships through a unified communication platform."` ← too vague, hides what makes this product unique
86
+
87
+ **Example 2 — infrastructure tech: "I want to build a task manager using DynamoDB for storage":**
88
+ - Good mission (no infra tech): `"Enable remote teams to coordinate work by creating, assigning, and tracking tasks across time zones from any device."`
89
+ - Good scope bullet: `"- All task data is stored in DynamoDB for consistent low-latency access regardless of team location"`
90
+ - Bad mission: `"Enable remote teams to coordinate work using DynamoDB."` ← DynamoDB is infra, not user value
91
+
56
92
  ## Scope Boundary Rules
57
93
 
58
94
  - If the description mentions a feature that sounds like phase 2, leave it out
@@ -60,11 +96,13 @@ The `initialScope` value must be a bullet list formatted as a single string with
60
96
  - Distinguish between user-facing features (in scope) and infrastructure decisions (not in scope)
61
97
  - Maximum 8 bullets; if you have more candidates, pick the 8 most user-important
62
98
 
63
- ## Full Example
99
+ ## Full Examples
100
+
101
+ **Example 1 — no specific technology named:**
64
102
 
65
- **Input**: "I want to build a recipe sharing app for home cooks"
103
+ Input: "I want to build a recipe sharing app for home cooks"
66
104
 
67
- **Output**:
105
+ Output:
68
106
  ```json
69
107
  {
70
108
  "missionStatement": "Help home cooks discover, save, and share recipes by building a community-driven platform where anyone can publish their own dishes and find inspiration from others.",
@@ -72,6 +110,32 @@ The `initialScope` value must be a bullet list formatted as a single string with
72
110
  }
73
111
  ```
74
112
 
113
+ **Example 2 — user named infrastructure tech (DynamoDB):**
114
+
115
+ Input: "I want to build a task manager for remote teams. We want to use DynamoDB as the main database because we need low-latency global access."
116
+
117
+ Output:
118
+ ```json
119
+ {
120
+ "missionStatement": "Enable remote teams to coordinate work by creating, assigning, and tracking tasks across time zones from any device.",
121
+ "initialScope": "- Users can create and title tasks with optional descriptions\n- Users can assign tasks to team members and set due dates\n- Users can mark tasks complete and view team progress\n- Team members receive notifications on assignment and status changes\n- Managers can filter and view team workload by assignee or status\n- All task data is stored in DynamoDB for consistent low-latency access regardless of team location"
122
+ }
123
+ ```
124
+ Note: DynamoDB is infrastructure tech → included in scope but NOT in mission.
125
+
126
+ **Example 3 — user named a user-facing platform (WhatsApp):**
127
+
128
+ Input: "I want a SaaS CRM built around WhatsApp messaging for small businesses that manage customer data and appointments"
129
+
130
+ Output:
131
+ ```json
132
+ {
133
+ "missionStatement": "Enable small businesses to manage customer relationships and appointments through WhatsApp, keeping all conversations and customer data in one place.",
134
+ "initialScope": "- Users can send and receive WhatsApp messages to customers from a unified inbox\n- Users can view customer profiles with contact information and conversation history\n- Users can create and manage appointments for each customer with automated reminders\n- Users can search through past WhatsApp conversations by customer or date\n- Users can log notes and follow-up tasks from conversations into customer profiles\n- Admins can manage team access and assign customer conversations to team members"
135
+ }
136
+ ```
137
+ Note: WhatsApp is a user-facing platform that defines what this product IS → included in BOTH mission and scope.
138
+
75
139
  ## Important Notes
76
140
 
77
141
  - Return **only** the JSON object — no markdown fences, no preamble, no explanation