qualia-framework 2.1.0

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/README.md +50 -0
  2. package/bin/cli.js +519 -0
  3. package/framework/agents/architecture-strategist.md +53 -0
  4. package/framework/agents/backend-agent.md +150 -0
  5. package/framework/agents/code-simplicity-reviewer.md +86 -0
  6. package/framework/agents/frontend-agent.md +111 -0
  7. package/framework/agents/kieran-typescript-reviewer.md +96 -0
  8. package/framework/agents/performance-oracle.md +111 -0
  9. package/framework/agents/qualia-codebase-mapper.md +760 -0
  10. package/framework/agents/qualia-debugger.md +1203 -0
  11. package/framework/agents/qualia-executor.md +881 -0
  12. package/framework/agents/qualia-integration-checker.md +423 -0
  13. package/framework/agents/qualia-phase-researcher.md +453 -0
  14. package/framework/agents/qualia-plan-checker.md +699 -0
  15. package/framework/agents/qualia-planner.md +1241 -0
  16. package/framework/agents/qualia-project-researcher.md +602 -0
  17. package/framework/agents/qualia-research-synthesizer.md +236 -0
  18. package/framework/agents/qualia-roadmapper.md +605 -0
  19. package/framework/agents/qualia-verifier.md +685 -0
  20. package/framework/agents/team-orchestrator.md +228 -0
  21. package/framework/agents/teams/full-stack-team.md +48 -0
  22. package/framework/agents/teams/optimize-team.md +53 -0
  23. package/framework/agents/teams/review-team.md +62 -0
  24. package/framework/agents/teams/ship-team.md +86 -0
  25. package/framework/agents/test-agent.md +182 -0
  26. package/framework/askpass.sh +2 -0
  27. package/framework/commands/design.md +53 -0
  28. package/framework/commands/quick-db.md +22 -0
  29. package/framework/config/retention.json +35 -0
  30. package/framework/core/PRINCIPLES.md +77 -0
  31. package/framework/hooks/auto-format.sh +45 -0
  32. package/framework/hooks/block-env-edit.sh +42 -0
  33. package/framework/hooks/branch-guard.sh +46 -0
  34. package/framework/hooks/confirm-delete.sh +56 -0
  35. package/framework/hooks/migration-validate.sh +68 -0
  36. package/framework/hooks/notification-speak.sh +15 -0
  37. package/framework/hooks/pre-commit.sh +80 -0
  38. package/framework/hooks/pre-compact.sh +55 -0
  39. package/framework/hooks/pre-deploy-gate.sh +151 -0
  40. package/framework/hooks/qualia-colors.sh +32 -0
  41. package/framework/hooks/retention-cleanup.sh +43 -0
  42. package/framework/hooks/save-session-state.sh +153 -0
  43. package/framework/hooks/session-context-loader.sh +28 -0
  44. package/framework/hooks/session-learn.sh +30 -0
  45. package/framework/knowledge/claudecode-bible.md +1384 -0
  46. package/framework/knowledge/client-prefs.md +22 -0
  47. package/framework/knowledge/common-fixes.md +25 -0
  48. package/framework/knowledge/deployment-map.md +35 -0
  49. package/framework/knowledge/email-signature.html +1 -0
  50. package/framework/knowledge/employees.md +8 -0
  51. package/framework/knowledge/learned-patterns.md +51 -0
  52. package/framework/knowledge/optimization-research-2026.md +137 -0
  53. package/framework/knowledge/qualia-context.md +67 -0
  54. package/framework/knowledge/supabase-patterns.md +50 -0
  55. package/framework/knowledge/voice-agent-patterns.md +46 -0
  56. package/framework/qualia-engine/VERSION +1 -0
  57. package/framework/qualia-engine/bin/qualia-tools.js +2160 -0
  58. package/framework/qualia-engine/bin/qualia-tools.test.js +1054 -0
  59. package/framework/qualia-engine/references/checkpoints.md +775 -0
  60. package/framework/qualia-engine/references/continuation-format.md +249 -0
  61. package/framework/qualia-engine/references/decimal-phase-calculation.md +65 -0
  62. package/framework/qualia-engine/references/design-quality.md +56 -0
  63. package/framework/qualia-engine/references/git-integration.md +254 -0
  64. package/framework/qualia-engine/references/git-planning-commit.md +50 -0
  65. package/framework/qualia-engine/references/model-profile-resolution.md +32 -0
  66. package/framework/qualia-engine/references/model-profiles.md +73 -0
  67. package/framework/qualia-engine/references/phase-argument-parsing.md +61 -0
  68. package/framework/qualia-engine/references/planning-config.md +195 -0
  69. package/framework/qualia-engine/references/questioning.md +141 -0
  70. package/framework/qualia-engine/references/tdd.md +263 -0
  71. package/framework/qualia-engine/references/ui-brand.md +160 -0
  72. package/framework/qualia-engine/references/verification-patterns.md +612 -0
  73. package/framework/qualia-engine/templates/DEBUG.md +159 -0
  74. package/framework/qualia-engine/templates/DESIGN.md +81 -0
  75. package/framework/qualia-engine/templates/UAT.md +247 -0
  76. package/framework/qualia-engine/templates/codebase/architecture.md +255 -0
  77. package/framework/qualia-engine/templates/codebase/concerns.md +310 -0
  78. package/framework/qualia-engine/templates/codebase/conventions.md +307 -0
  79. package/framework/qualia-engine/templates/codebase/integrations.md +280 -0
  80. package/framework/qualia-engine/templates/codebase/stack.md +186 -0
  81. package/framework/qualia-engine/templates/codebase/structure.md +285 -0
  82. package/framework/qualia-engine/templates/codebase/testing.md +480 -0
  83. package/framework/qualia-engine/templates/config.json +35 -0
  84. package/framework/qualia-engine/templates/context.md +283 -0
  85. package/framework/qualia-engine/templates/continue-here.md +78 -0
  86. package/framework/qualia-engine/templates/debug-subagent-prompt.md +91 -0
  87. package/framework/qualia-engine/templates/discovery.md +146 -0
  88. package/framework/qualia-engine/templates/milestone-archive.md +123 -0
  89. package/framework/qualia-engine/templates/milestone.md +115 -0
  90. package/framework/qualia-engine/templates/phase-prompt.md +567 -0
  91. package/framework/qualia-engine/templates/planner-subagent-prompt.md +117 -0
  92. package/framework/qualia-engine/templates/project.md +184 -0
  93. package/framework/qualia-engine/templates/projects/ai-agent.md +156 -0
  94. package/framework/qualia-engine/templates/projects/mobile-app.md +181 -0
  95. package/framework/qualia-engine/templates/projects/voice-agent.md +134 -0
  96. package/framework/qualia-engine/templates/projects/website.md +137 -0
  97. package/framework/qualia-engine/templates/requirements.md +231 -0
  98. package/framework/qualia-engine/templates/research-project/ARCHITECTURE.md +204 -0
  99. package/framework/qualia-engine/templates/research-project/FEATURES.md +147 -0
  100. package/framework/qualia-engine/templates/research-project/PITFALLS.md +200 -0
  101. package/framework/qualia-engine/templates/research-project/STACK.md +120 -0
  102. package/framework/qualia-engine/templates/research-project/SUMMARY.md +170 -0
  103. package/framework/qualia-engine/templates/research.md +552 -0
  104. package/framework/qualia-engine/templates/roadmap.md +202 -0
  105. package/framework/qualia-engine/templates/state.md +176 -0
  106. package/framework/qualia-engine/templates/summary-complex.md +59 -0
  107. package/framework/qualia-engine/templates/summary-minimal.md +41 -0
  108. package/framework/qualia-engine/templates/summary-standard.md +48 -0
  109. package/framework/qualia-engine/templates/summary.md +246 -0
  110. package/framework/qualia-engine/templates/user-setup.md +311 -0
  111. package/framework/qualia-engine/templates/verification-report.md +322 -0
  112. package/framework/qualia-engine/workflows/add-phase.md +179 -0
  113. package/framework/qualia-engine/workflows/add-todo.md +157 -0
  114. package/framework/qualia-engine/workflows/audit-milestone.md +241 -0
  115. package/framework/qualia-engine/workflows/check-todos.md +176 -0
  116. package/framework/qualia-engine/workflows/complete-milestone.md +858 -0
  117. package/framework/qualia-engine/workflows/diagnose-issues.md +219 -0
  118. package/framework/qualia-engine/workflows/discovery-phase.md +289 -0
  119. package/framework/qualia-engine/workflows/discuss-phase.md +534 -0
  120. package/framework/qualia-engine/workflows/execute-phase.md +559 -0
  121. package/framework/qualia-engine/workflows/execute-plan.md +438 -0
  122. package/framework/qualia-engine/workflows/help.md +470 -0
  123. package/framework/qualia-engine/workflows/insert-phase.md +220 -0
  124. package/framework/qualia-engine/workflows/list-phase-assumptions.md +178 -0
  125. package/framework/qualia-engine/workflows/map-codebase.md +327 -0
  126. package/framework/qualia-engine/workflows/new-milestone.md +363 -0
  127. package/framework/qualia-engine/workflows/new-project.md +1037 -0
  128. package/framework/qualia-engine/workflows/pause-work.md +122 -0
  129. package/framework/qualia-engine/workflows/plan-milestone-gaps.md +256 -0
  130. package/framework/qualia-engine/workflows/plan-phase.md +422 -0
  131. package/framework/qualia-engine/workflows/progress.md +354 -0
  132. package/framework/qualia-engine/workflows/quick.md +252 -0
  133. package/framework/qualia-engine/workflows/remove-phase.md +326 -0
  134. package/framework/qualia-engine/workflows/research-phase.md +74 -0
  135. package/framework/qualia-engine/workflows/resume-project.md +306 -0
  136. package/framework/qualia-engine/workflows/set-profile.md +80 -0
  137. package/framework/qualia-engine/workflows/settings.md +145 -0
  138. package/framework/qualia-engine/workflows/transition.md +556 -0
  139. package/framework/qualia-engine/workflows/update.md +197 -0
  140. package/framework/qualia-engine/workflows/verify-phase.md +195 -0
  141. package/framework/qualia-engine/workflows/verify-work.md +625 -0
  142. package/framework/rules/context7.md +11 -0
  143. package/framework/rules/deployment.md +29 -0
  144. package/framework/rules/frontend.md +33 -0
  145. package/framework/rules/security.md +12 -0
  146. package/framework/rules/speed.md +20 -0
  147. package/framework/scripts/__pycache__/say.cpython-314.pyc +0 -0
  148. package/framework/scripts/apply-retention.sh +120 -0
  149. package/framework/scripts/bootstrap-pop-os.sh +354 -0
  150. package/framework/scripts/claude-voice +13 -0
  151. package/framework/scripts/cleanup.sh +131 -0
  152. package/framework/scripts/cowork-mode.sh +141 -0
  153. package/framework/scripts/generate-project-claude-md.sh +153 -0
  154. package/framework/scripts/load-test-webhook.js +172 -0
  155. package/framework/scripts/say.py +236 -0
  156. package/framework/scripts/showcase-video-recorder/ffmpeg-builder.js +167 -0
  157. package/framework/scripts/showcase-video-recorder/playwright-helpers.js +216 -0
  158. package/framework/scripts/speak.py +55 -0
  159. package/framework/scripts/speak.sh +18 -0
  160. package/framework/scripts/status.sh +138 -0
  161. package/framework/scripts/sync-to-framework.sh +65 -0
  162. package/framework/scripts/voice-hotkey.py +227 -0
  163. package/framework/scripts/voice-input.sh +51 -0
  164. package/framework/skills/animate/SKILL.md +202 -0
  165. package/framework/skills/bolder/SKILL.md +144 -0
  166. package/framework/skills/browser-qa/SKILL.md +536 -0
  167. package/framework/skills/clarify/SKILL.md +179 -0
  168. package/framework/skills/colorize/SKILL.md +170 -0
  169. package/framework/skills/critique/SKILL.md +126 -0
  170. package/framework/skills/deep-research/SKILL.md +271 -0
  171. package/framework/skills/delight/SKILL.md +329 -0
  172. package/framework/skills/deploy/SKILL.md +261 -0
  173. package/framework/skills/deploy-verify/SKILL.md +377 -0
  174. package/framework/skills/deploy-verify/scripts/canary-check.sh +206 -0
  175. package/framework/skills/deploy-verify/scripts/check-console-errors.js +147 -0
  176. package/framework/skills/deploy-verify/scripts/check-cwv.js +139 -0
  177. package/framework/skills/deploy-verify/scripts/project-detect.sh +84 -0
  178. package/framework/skills/deploy-verify/scripts/verify.sh +548 -0
  179. package/framework/skills/design-quieter/SKILL.md +130 -0
  180. package/framework/skills/distill/SKILL.md +149 -0
  181. package/framework/skills/docs-lookup/SKILL.md +78 -0
  182. package/framework/skills/fcm-notifications/SKILL.md +125 -0
  183. package/framework/skills/financial-ledger/SKILL.md +1039 -0
  184. package/framework/skills/frontend-master/NOTICE.md +4 -0
  185. package/framework/skills/frontend-master/SKILL.md +127 -0
  186. package/framework/skills/frontend-master/reference/color-and-contrast.md +132 -0
  187. package/framework/skills/frontend-master/reference/interaction-design.md +123 -0
  188. package/framework/skills/frontend-master/reference/motion-design.md +99 -0
  189. package/framework/skills/frontend-master/reference/responsive-design.md +114 -0
  190. package/framework/skills/frontend-master/reference/spatial-design.md +100 -0
  191. package/framework/skills/frontend-master/reference/typography.md +131 -0
  192. package/framework/skills/frontend-master/reference/ux-writing.md +107 -0
  193. package/framework/skills/harden/SKILL.md +357 -0
  194. package/framework/skills/i18n-rtl/SKILL.md +752 -0
  195. package/framework/skills/learn/SKILL.md +71 -0
  196. package/framework/skills/memory/SKILL.md +50 -0
  197. package/framework/skills/mobile-expo/SKILL.md +864 -0
  198. package/framework/skills/mobile-expo/references/store-checklist.md +550 -0
  199. package/framework/skills/nestjs-backend/README.md +73 -0
  200. package/framework/skills/nestjs-backend/SKILL.md +446 -0
  201. package/framework/skills/nestjs-backend/references/templates.md +1173 -0
  202. package/framework/skills/normalize/SKILL.md +79 -0
  203. package/framework/skills/onboard/SKILL.md +242 -0
  204. package/framework/skills/polish/SKILL.md +209 -0
  205. package/framework/skills/pr/SKILL.md +66 -0
  206. package/framework/skills/qualia/SKILL.md +153 -0
  207. package/framework/skills/qualia-add-todo/SKILL.md +68 -0
  208. package/framework/skills/qualia-audit-milestone/SKILL.md +92 -0
  209. package/framework/skills/qualia-check-todos/SKILL.md +55 -0
  210. package/framework/skills/qualia-complete-milestone/SKILL.md +108 -0
  211. package/framework/skills/qualia-debug/SKILL.md +149 -0
  212. package/framework/skills/qualia-design/SKILL.md +203 -0
  213. package/framework/skills/qualia-discuss-phase/SKILL.md +72 -0
  214. package/framework/skills/qualia-execute-phase/SKILL.md +86 -0
  215. package/framework/skills/qualia-help/SKILL.md +67 -0
  216. package/framework/skills/qualia-idk/SKILL.md +352 -0
  217. package/framework/skills/qualia-list-phase-assumptions/SKILL.md +67 -0
  218. package/framework/skills/qualia-new-milestone/SKILL.md +72 -0
  219. package/framework/skills/qualia-new-project/SKILL.md +92 -0
  220. package/framework/skills/qualia-optimize/SKILL.md +417 -0
  221. package/framework/skills/qualia-pause-work/SKILL.md +96 -0
  222. package/framework/skills/qualia-plan-milestone-gaps/SKILL.md +57 -0
  223. package/framework/skills/qualia-plan-phase/SKILL.md +101 -0
  224. package/framework/skills/qualia-progress/SKILL.md +53 -0
  225. package/framework/skills/qualia-quick/SKILL.md +89 -0
  226. package/framework/skills/qualia-research-phase/SKILL.md +88 -0
  227. package/framework/skills/qualia-resume-work/SKILL.md +62 -0
  228. package/framework/skills/qualia-review/SKILL.md +263 -0
  229. package/framework/skills/qualia-start/SKILL.md +182 -0
  230. package/framework/skills/qualia-verify-work/SKILL.md +105 -0
  231. package/framework/skills/qualia-workflow/SKILL.md +130 -0
  232. package/framework/skills/rag/SKILL.md +750 -0
  233. package/framework/skills/responsive/SKILL.md +231 -0
  234. package/framework/skills/retro/SKILL.md +284 -0
  235. package/framework/skills/sakani-conventions/SKILL.md +136 -0
  236. package/framework/skills/sakani-conventions/evals/evals.json +23 -0
  237. package/framework/skills/sakani-conventions/references/entities.md +365 -0
  238. package/framework/skills/sakani-conventions/references/error-codes.md +95 -0
  239. package/framework/skills/seo-master/SKILL.md +490 -0
  240. package/framework/skills/seo-master/references/checklist.md +199 -0
  241. package/framework/skills/seo-master/references/structured-data.md +609 -0
  242. package/framework/skills/ship/SKILL.md +202 -0
  243. package/framework/skills/stack-researcher/SKILL.md +215 -0
  244. package/framework/skills/status/SKILL.md +154 -0
  245. package/framework/skills/status/scripts/health-check.sh +562 -0
  246. package/framework/skills/subscription-payments/SKILL.md +250 -0
  247. package/framework/skills/supabase/SKILL.md +973 -0
  248. package/framework/skills/supabase/references/templates.md +159 -0
  249. package/framework/skills/team/SKILL.md +67 -0
  250. package/framework/skills/test-runner/SKILL.md +202 -0
  251. package/framework/skills/voice-agent/SKILL.md +407 -0
  252. package/framework/skills/zoho-workflow/SKILL.md +51 -0
  253. package/framework/statusline-command.sh +117 -0
  254. package/package.json +24 -0
  255. package/profiles/fawzi.json +16 -0
  256. package/profiles/hasan.json +16 -0
  257. package/profiles/moayad.json +16 -0
  258. package/templates/CLAUDE-owner.md +52 -0
  259. package/templates/CLAUDE.md.hbs +58 -0
  260. package/templates/env.claude.template +12 -0
  261. package/templates/settings.json +141 -0
@@ -0,0 +1,117 @@
1
+ # Planner Subagent Prompt Template
2
+
3
+ Template for spawning qualia-planner agent. The agent contains all planning expertise - this template provides planning context only.
4
+
5
+ ---
6
+
7
+ ## Template
8
+
9
+ ```markdown
10
+ <planning_context>
11
+
12
+ **Phase:** {phase_number}
13
+ **Mode:** {standard | gap_closure}
14
+
15
+ **Project State:**
16
+ @.planning/STATE.md
17
+
18
+ **Roadmap:**
19
+ @.planning/ROADMAP.md
20
+
21
+ **Requirements (if exists):**
22
+ @.planning/REQUIREMENTS.md
23
+
24
+ **Phase Context (if exists):**
25
+ @.planning/phases/{phase_dir}/{phase}-CONTEXT.md
26
+
27
+ **Research (if exists):**
28
+ @.planning/phases/{phase_dir}/{phase}-RESEARCH.md
29
+
30
+ **Gap Closure (if --gaps mode):**
31
+ @.planning/phases/{phase_dir}/{phase}-VERIFICATION.md
32
+ @.planning/phases/{phase_dir}/{phase}-UAT.md
33
+
34
+ </planning_context>
35
+
36
+ <downstream_consumer>
37
+ Output consumed by /qualia:execute-phase
38
+ Plans must be executable prompts with:
39
+ - Frontmatter (wave, depends_on, files_modified, autonomous)
40
+ - Tasks in XML format
41
+ - Verification criteria
42
+ - must_haves for goal-backward verification
43
+ </downstream_consumer>
44
+
45
+ <quality_gate>
46
+ Before returning PLANNING COMPLETE:
47
+ - [ ] PLAN.md files created in phase directory
48
+ - [ ] Each plan has valid frontmatter
49
+ - [ ] Tasks are specific and actionable
50
+ - [ ] Dependencies correctly identified
51
+ - [ ] Waves assigned for parallel execution
52
+ - [ ] must_haves derived from phase goal
53
+ </quality_gate>
54
+ ```
55
+
56
+ ---
57
+
58
+ ## Placeholders
59
+
60
+ | Placeholder | Source | Example |
61
+ |-------------|--------|---------|
62
+ | `{phase_number}` | From roadmap/arguments | `5` or `2.1` |
63
+ | `{phase_dir}` | Phase directory name | `05-user-profiles` |
64
+ | `{phase}` | Phase prefix | `05` |
65
+ | `{standard \| gap_closure}` | Mode flag | `standard` |
66
+
67
+ ---
68
+
69
+ ## Usage
70
+
71
+ **From /qualia:plan-phase (standard mode):**
72
+ ```python
73
+ Task(
74
+ prompt=filled_template,
75
+ subagent_type="qualia-planner",
76
+ description="Plan Phase {phase}"
77
+ )
78
+ ```
79
+
80
+ **From /qualia:plan-phase --gaps (gap closure mode):**
81
+ ```python
82
+ Task(
83
+ prompt=filled_template, # with mode: gap_closure
84
+ subagent_type="qualia-planner",
85
+ description="Plan gaps for Phase {phase}"
86
+ )
87
+ ```
88
+
89
+ ---
90
+
91
+ ## Continuation
92
+
93
+ For checkpoints, spawn fresh agent with:
94
+
95
+ ```markdown
96
+ <objective>
97
+ Continue planning for Phase {phase_number}: {phase_name}
98
+ </objective>
99
+
100
+ <prior_state>
101
+ Phase directory: @.planning/phases/{phase_dir}/
102
+ Existing plans: @.planning/phases/{phase_dir}/*-PLAN.md
103
+ </prior_state>
104
+
105
+ <checkpoint_response>
106
+ **Type:** {checkpoint_type}
107
+ **Response:** {user_response}
108
+ </checkpoint_response>
109
+
110
+ <mode>
111
+ Continue: {standard | gap_closure}
112
+ </mode>
113
+ ```
114
+
115
+ ---
116
+
117
+ **Note:** Planning methodology, task breakdown, dependency analysis, wave assignment, TDD detection, and goal-backward derivation are baked into the qualia-planner agent. This template only passes context.
@@ -0,0 +1,184 @@
1
+ # PROJECT.md Template
2
+
3
+ Template for `.planning/PROJECT.md` — the living project context document.
4
+
5
+ <template>
6
+
7
+ ```markdown
8
+ # [Project Name]
9
+
10
+ ## What This Is
11
+
12
+ [Current accurate description — 2-3 sentences. What does this product do and who is it for?
13
+ Use the user's language and framing. Update whenever reality drifts from this description.]
14
+
15
+ ## Core Value
16
+
17
+ [The ONE thing that matters most. If everything else fails, this must work.
18
+ One sentence that drives prioritization when tradeoffs arise.]
19
+
20
+ ## Requirements
21
+
22
+ ### Validated
23
+
24
+ <!-- Shipped and confirmed valuable. -->
25
+
26
+ (None yet — ship to validate)
27
+
28
+ ### Active
29
+
30
+ <!-- Current scope. Building toward these. -->
31
+
32
+ - [ ] [Requirement 1]
33
+ - [ ] [Requirement 2]
34
+ - [ ] [Requirement 3]
35
+
36
+ ### Out of Scope
37
+
38
+ <!-- Explicit boundaries. Includes reasoning to prevent re-adding. -->
39
+
40
+ - [Exclusion 1] — [why]
41
+ - [Exclusion 2] — [why]
42
+
43
+ ## Context
44
+
45
+ [Background information that informs implementation:
46
+ - Technical environment or ecosystem
47
+ - Relevant prior work or experience
48
+ - User research or feedback themes
49
+ - Known issues to address]
50
+
51
+ ## Constraints
52
+
53
+ - **[Type]**: [What] — [Why]
54
+ - **[Type]**: [What] — [Why]
55
+
56
+ Common types: Tech stack, Timeline, Budget, Dependencies, Compatibility, Performance, Security
57
+
58
+ ## Key Decisions
59
+
60
+ <!-- Decisions that constrain future work. Add throughout project lifecycle. -->
61
+
62
+ | Decision | Rationale | Outcome |
63
+ |----------|-----------|---------|
64
+ | [Choice] | [Why] | [✓ Good / ⚠️ Revisit / — Pending] |
65
+
66
+ ---
67
+ *Last updated: [date] after [trigger]*
68
+ ```
69
+
70
+ </template>
71
+
72
+ <guidelines>
73
+
74
+ **What This Is:**
75
+ - Current accurate description of the product
76
+ - 2-3 sentences capturing what it does and who it's for
77
+ - Use the user's words and framing
78
+ - Update when the product evolves beyond this description
79
+
80
+ **Core Value:**
81
+ - The single most important thing
82
+ - Everything else can fail; this cannot
83
+ - Drives prioritization when tradeoffs arise
84
+ - Rarely changes; if it does, it's a significant pivot
85
+
86
+ **Requirements — Validated:**
87
+ - Requirements that shipped and proved valuable
88
+ - Format: `- ✓ [Requirement] — [version/phase]`
89
+ - These are locked — changing them requires explicit discussion
90
+
91
+ **Requirements — Active:**
92
+ - Current scope being built toward
93
+ - These are hypotheses until shipped and validated
94
+ - Move to Validated when shipped, Out of Scope if invalidated
95
+
96
+ **Requirements — Out of Scope:**
97
+ - Explicit boundaries on what we're not building
98
+ - Always include reasoning (prevents re-adding later)
99
+ - Includes: considered and rejected, deferred to future, explicitly excluded
100
+
101
+ **Context:**
102
+ - Background that informs implementation decisions
103
+ - Technical environment, prior work, user feedback
104
+ - Known issues or technical debt to address
105
+ - Update as new context emerges
106
+
107
+ **Constraints:**
108
+ - Hard limits on implementation choices
109
+ - Tech stack, timeline, budget, compatibility, dependencies
110
+ - Include the "why" — constraints without rationale get questioned
111
+
112
+ **Key Decisions:**
113
+ - Significant choices that affect future work
114
+ - Add decisions as they're made throughout the project
115
+ - Track outcome when known:
116
+ - ✓ Good — decision proved correct
117
+ - ⚠️ Revisit — decision may need reconsideration
118
+ - — Pending — too early to evaluate
119
+
120
+ **Last Updated:**
121
+ - Always note when and why the document was updated
122
+ - Format: `after Phase 2` or `after v1.0 milestone`
123
+ - Triggers review of whether content is still accurate
124
+
125
+ </guidelines>
126
+
127
+ <evolution>
128
+
129
+ PROJECT.md evolves throughout the project lifecycle.
130
+
131
+ **After each phase transition:**
132
+ 1. Requirements invalidated? → Move to Out of Scope with reason
133
+ 2. Requirements validated? → Move to Validated with phase reference
134
+ 3. New requirements emerged? → Add to Active
135
+ 4. Decisions to log? → Add to Key Decisions
136
+ 5. "What This Is" still accurate? → Update if drifted
137
+
138
+ **After each milestone:**
139
+ 1. Full review of all sections
140
+ 2. Core Value check — still the right priority?
141
+ 3. Audit Out of Scope — reasons still valid?
142
+ 4. Update Context with current state (users, feedback, metrics)
143
+
144
+ </evolution>
145
+
146
+ <brownfield>
147
+
148
+ For existing codebases:
149
+
150
+ 1. **Map codebase first** via `/qualia:map-codebase`
151
+
152
+ 2. **Infer Validated requirements** from existing code:
153
+ - What does the codebase actually do?
154
+ - What patterns are established?
155
+ - What's clearly working and relied upon?
156
+
157
+ 3. **Gather Active requirements** from user:
158
+ - Present inferred current state
159
+ - Ask what they want to build next
160
+
161
+ 4. **Initialize:**
162
+ - Validated = inferred from existing code
163
+ - Active = user's goals for this work
164
+ - Out of Scope = boundaries user specifies
165
+ - Context = includes current codebase state
166
+
167
+ </brownfield>
168
+
169
+ <state_reference>
170
+
171
+ STATE.md references PROJECT.md:
172
+
173
+ ```markdown
174
+ ## Project Reference
175
+
176
+ See: .planning/PROJECT.md (updated [date])
177
+
178
+ **Core value:** [One-liner from Core Value section]
179
+ **Current focus:** [Current phase name]
180
+ ```
181
+
182
+ This ensures Claude reads current PROJECT.md context.
183
+
184
+ </state_reference>
@@ -0,0 +1,156 @@
1
+ # Project Template: AI Agent
2
+
3
+ > AI chat agent with Next.js frontend, Supabase backend, and AI provider integration.
4
+
5
+ **Stack:** Next.js 16+, React 19, TypeScript, Supabase, AI SDK / OpenRouter / Gemini, Vercel
6
+ **Phases:** 7
7
+ **Type:** ai-agent
8
+
9
+ ## Phases
10
+
11
+ ### Phase 1: Foundation
12
+ **Goal:** Working Next.js app with Supabase schema, auth, and base project structure
13
+ **Skills:** [@supabase]
14
+ **Tasks:**
15
+ - Initialize Next.js 16+ with App Router, TypeScript strict, Tailwind v4
16
+ - Design Supabase schema: users, conversations, messages, system_prompts
17
+ - Configure Supabase client (server.ts + client.ts pattern)
18
+ - Implement auth: login, signup (Supabase Auth)
19
+ - RLS policies on all tables (user can only access own conversations)
20
+ - Environment variables for AI provider keys
21
+ - Base layout with navigation shell
22
+
23
+ **Success Criteria:**
24
+ 1. User can create account and log in
25
+ 2. Database schema deployed with RLS enabled
26
+ 3. Server-side auth working
27
+ 4. `npx tsc --noEmit` passes
28
+
29
+ ---
30
+
31
+ ### Phase 2: AI Core
32
+ **Goal:** Working AI conversation engine with streaming responses and conversation persistence
33
+ **Skills:** [@supabase]
34
+ **Tasks:**
35
+ - AI provider integration (OpenRouter / Gemini / OpenAI — based on project needs)
36
+ - System prompt management (stored in Supabase, editable)
37
+ - Streaming response handler (SSE or WebSocket)
38
+ - Conversation management: create, continue, branch
39
+ - Message persistence: save user messages and AI responses
40
+ - Context window management (truncation strategy for long conversations)
41
+ - Token usage tracking per conversation
42
+ - Error handling: rate limits, provider failures, timeout recovery
43
+
44
+ **Success Criteria:**
45
+ 1. User can send message and receive streaming AI response
46
+ 2. Conversations persist across page reloads
47
+ 3. System prompt shapes AI behavior correctly
48
+ 4. Graceful handling of API errors (no crash, clear user message)
49
+
50
+ ---
51
+
52
+ ### Phase 3: Chat UI
53
+ **Goal:** Polished chat interface with real-time feel and markdown support
54
+ **Skills:** [@frontend-master]
55
+ **Tasks:**
56
+ - Message bubbles with user/AI distinction
57
+ - Streaming text animation (typewriter effect)
58
+ - Markdown rendering in AI responses (code blocks, lists, links)
59
+ - Typing indicator while AI generates
60
+ - Conversation list sidebar with search
61
+ - New conversation button
62
+ - Auto-scroll to latest message
63
+ - Message input with multiline support and send on Enter
64
+ - Copy message button
65
+ - Responsive layout (sidebar collapses on mobile)
66
+
67
+ **Success Criteria:**
68
+ 1. Messages render with clear user/AI visual distinction
69
+ 2. Streaming responses appear character-by-character
70
+ 3. Code blocks syntax-highlighted and copyable
71
+ 4. UI works on mobile (sidebar toggles, input accessible)
72
+
73
+ ---
74
+
75
+ ### Phase 4: Admin Panel
76
+ **Goal:** Admin interface for managing the AI agent: prompts, users, analytics
77
+ **Skills:** [@admin-panel, @supabase]
78
+ **Tasks:**
79
+ - Admin auth (role-based, separate from user auth)
80
+ - System prompt editor (CRUD, version history)
81
+ - User management: list, view conversations, ban/unban
82
+ - Conversation analytics: message counts, popular topics, response times
83
+ - Token usage dashboard per user and total
84
+ - AI model configuration (switch providers, adjust temperature)
85
+ - Export conversations (CSV/JSON)
86
+
87
+ **Success Criteria:**
88
+ 1. Admin can edit system prompt and see changes reflected in new conversations
89
+ 2. Admin can view user conversations and usage stats
90
+ 3. Analytics dashboard shows meaningful metrics
91
+ 4. Non-admins cannot access admin routes
92
+
93
+ ---
94
+
95
+ ### Phase 5: Channel Integration
96
+ **Goal:** AI agent accessible via WhatsApp, Telegram, or web widget (based on project needs)
97
+ **Skills:** [@supabase]
98
+ **Tasks:**
99
+ - Webhook endpoint for channel provider
100
+ - Message format translation (channel format ↔ internal format)
101
+ - User identity mapping (channel user → Supabase user)
102
+ - Media handling (images, voice messages if applicable)
103
+ - Rate limiting per channel user
104
+ - Channel-specific formatting (WhatsApp markdown vs web markdown)
105
+ - Health check endpoint for webhook verification
106
+
107
+ **Success Criteria:**
108
+ 1. Messages from channel reach AI and response returns to channel
109
+ 2. Conversation history shared across channels for same user
110
+ 3. Rate limiting prevents abuse
111
+ 4. Webhook responds within provider timeout limits
112
+
113
+ ---
114
+
115
+ ### Phase 6: Safety & Resilience
116
+ **Goal:** Production-grade safety: prompt injection defense, rate limiting, failover
117
+ **Skills:** []
118
+ **Tasks:**
119
+ - Prompt injection detection (input sanitization, pattern matching)
120
+ - Output filtering (PII detection, harmful content blocking)
121
+ - Rate limiting: per-user, per-IP, global
122
+ - AI provider failover (primary → secondary provider)
123
+ - Conversation length limits with graceful handling
124
+ - Input validation (max length, content type)
125
+ - Logging: all AI interactions logged for audit
126
+ - Error recovery: conversation state preserved on failures
127
+
128
+ **Success Criteria:**
129
+ 1. Known prompt injection patterns blocked
130
+ 2. Rate limits enforced and clear feedback to user
131
+ 3. Provider failover works (disable primary, secondary picks up)
132
+ 4. No PII leaked in AI responses (if configured)
133
+
134
+ ---
135
+
136
+ ### Phase 7: Deploy & Verify
137
+ **Goal:** Production deployment with AI-specific verification
138
+ **Skills:** [@deploy-verify]
139
+ **Team:** ship-team
140
+ **Tasks:**
141
+ - Final type check and lint
142
+ - Production build
143
+ - Deploy to Vercel
144
+ - Verify AI provider keys work in production
145
+ - Test full conversation flow in production
146
+ - Load test: concurrent conversations (if applicable)
147
+ - Run 6-check post-deploy verification
148
+ - Supabase production review (RLS, no service key exposed)
149
+
150
+ **Success Criteria:**
151
+ 1. HTTP 200, auth flow works, no console errors
152
+ 2. AI responds correctly in production
153
+ 3. Conversations persist across sessions
154
+ 4. API latency < 500ms for non-AI endpoints
155
+ 5. AI response time < 5s for first token
156
+ 6. No source maps or service keys exposed
@@ -0,0 +1,181 @@
1
+ # Project Template: Mobile App
2
+
3
+ > React Native + Expo managed workflow + Supabase. Full pipeline from dev to App Store.
4
+
5
+ **Stack:** React Native, Expo (managed workflow), TypeScript, expo-router, Supabase, EAS Build/Submit
6
+ **Phases:** 8
7
+ **Type:** mobile-app
8
+
9
+ ## Phases
10
+
11
+ ### Phase 1: Foundation
12
+ **Goal:** Working Expo app with TypeScript, navigation, and Supabase connected
13
+ **Skills:** [@supabase]
14
+ **Tasks:**
15
+ - Initialize Expo project with managed workflow and TypeScript strict
16
+ - Configure expo-router (file-based routing)
17
+ - Set up Supabase client (with @react-native-async-storage for token persistence)
18
+ - Configure environment variables (expo-constants, app.config.ts)
19
+ - Create tab navigation shell (bottom tabs)
20
+ - Set up development build configuration
21
+ - Configure ESLint + Prettier for React Native
22
+
23
+ **Success Criteria:**
24
+ 1. App runs on iOS simulator and Android emulator
25
+ 2. Tab navigation works between screens
26
+ 3. Supabase client connects (test query succeeds)
27
+ 4. TypeScript strict mode passes
28
+
29
+ ---
30
+
31
+ ### Phase 2: Auth
32
+ **Goal:** Complete auth flow with secure token storage and deep linking
33
+ **Skills:** [@supabase]
34
+ **Tasks:**
35
+ - Login screen (email/password)
36
+ - Signup screen with email verification
37
+ - Password reset flow
38
+ - Auth state persistence (AsyncStorage + Supabase session)
39
+ - Protected route wrapper (redirect unauthenticated to login)
40
+ - Deep linking for email verification and password reset
41
+ - Biometric authentication unlock (optional, Face ID / fingerprint)
42
+ - Auth loading state (splash → check session → route)
43
+
44
+ **Success Criteria:**
45
+ 1. User can sign up, verify email, and log in
46
+ 2. Session persists across app restarts
47
+ 3. Deep links from email open correct screen
48
+ 4. Unauthenticated users always see login screen
49
+
50
+ ---
51
+
52
+ ### Phase 3: Core Screens
53
+ **Goal:** Main app screens with data fetching, pull-to-refresh, and CRUD
54
+ **Skills:** [@supabase]
55
+ **Tasks:**
56
+ - Home / dashboard screen with key data
57
+ - List screen with FlatList (pagination, pull-to-refresh)
58
+ - Detail screen with full resource view
59
+ - Create form with validation
60
+ - Edit form (pre-populated)
61
+ - Delete with confirmation
62
+ - Search / filter functionality
63
+ - Empty states and error states for all screens
64
+ - Loading skeletons
65
+
66
+ **Success Criteria:**
67
+ 1. User can perform full CRUD on core resources
68
+ 2. Lists paginate correctly and pull-to-refresh works
69
+ 3. Forms validate input and show clear errors
70
+ 4. Empty states and loading states visible
71
+ 5. Back navigation works correctly on all flows
72
+
73
+ ---
74
+
75
+ ### Phase 4: Native Features
76
+ **Goal:** Platform-specific features: camera, push notifications, location, biometrics
77
+ **Skills:** []
78
+ **Tasks:**
79
+ - Push notifications (expo-notifications + Supabase Edge Function for sending)
80
+ - Camera integration (expo-camera or expo-image-picker)
81
+ - Location services (expo-location — if applicable)
82
+ - Biometric unlock (expo-local-authentication)
83
+ - Share functionality (expo-sharing)
84
+ - Haptic feedback on key interactions
85
+ - Platform-specific UI adjustments (iOS vs Android)
86
+ - Permission request flows with clear explanations
87
+
88
+ **Success Criteria:**
89
+ 1. Push notifications deliver on both platforms
90
+ 2. Camera/image picker works and uploads to Supabase Storage
91
+ 3. Permission requests explain why access is needed
92
+ 4. Haptic feedback on primary actions
93
+
94
+ ---
95
+
96
+ ### Phase 5: Offline & Performance
97
+ **Goal:** Offline-first data with background sync and smooth 60fps UI
98
+ **Skills:** []
99
+ **Tasks:**
100
+ - Local SQLite database (expo-sqlite) for offline cache
101
+ - Sync engine: local changes → Supabase when online
102
+ - Conflict resolution strategy (last-write-wins or merge)
103
+ - Network status detection (NetInfo)
104
+ - Optimistic updates (UI updates immediately, sync in background)
105
+ - Image caching (expo-image)
106
+ - List rendering optimization (FlashList or FlatList tuning)
107
+ - Memory profiling and leak detection
108
+ - Startup time optimization (reduce bundle, lazy imports)
109
+
110
+ **Success Criteria:**
111
+ 1. App works offline for core read/write operations
112
+ 2. Data syncs when connectivity restored
113
+ 3. No dropped frames on list scrolling (60fps)
114
+ 4. App cold start < 2s
115
+ 5. Memory usage stable over extended use
116
+
117
+ ---
118
+
119
+ ### Phase 6: App Store Prep
120
+ **Goal:** App store assets, configuration, and metadata ready for submission
121
+ **Skills:** []
122
+ **Tasks:**
123
+ - App icon (all required sizes for iOS + Android)
124
+ - Splash screen (animated or static)
125
+ - App Store screenshots (6.7", 6.5", 5.5" for iOS; phone + tablet for Android)
126
+ - App Store description, keywords, category
127
+ - Privacy policy URL
128
+ - app.json / app.config.ts: version, bundle ID, permissions justification
129
+ - EAS Build configuration (eas.json: development, preview, production profiles)
130
+ - Code signing: Apple Developer certificates, Google Play keystore
131
+
132
+ **Success Criteria:**
133
+ 1. App icon renders correctly on both platforms
134
+ 2. Splash screen displays during load
135
+ 3. Screenshots capture key features
136
+ 4. EAS Build config has all 3 profiles
137
+ 5. Code signing configured for both platforms
138
+
139
+ ---
140
+
141
+ ### Phase 7: Build & Submit
142
+ **Goal:** Production builds submitted to App Store Connect and Google Play Console
143
+ **Skills:** []
144
+ **Tasks:**
145
+ - EAS Build: production profile for iOS
146
+ - EAS Build: production profile for Android
147
+ - Test production builds on physical devices
148
+ - EAS Submit to App Store Connect (TestFlight)
149
+ - EAS Submit to Google Play Console (internal testing track)
150
+ - Fix any submission rejection issues
151
+ - TestFlight beta testing round
152
+ - Google Play internal testing round
153
+
154
+ **Success Criteria:**
155
+ 1. iOS build uploads to App Store Connect without errors
156
+ 2. Android build uploads to Google Play Console without errors
157
+ 3. TestFlight build installs and runs on test devices
158
+ 4. Google Play internal test installs and runs
159
+ 5. No crash reports from beta testing
160
+
161
+ ---
162
+
163
+ ### Phase 8: Post-Launch
164
+ **Goal:** Production monitoring, OTA updates, and crash reporting configured
165
+ **Skills:** []
166
+ **Tasks:**
167
+ - OTA updates: configure expo-updates for instant patches
168
+ - Crash reporting (Sentry or expo-updates error tracking)
169
+ - Analytics: screen views, key actions, funnel tracking
170
+ - App Store listing live: submit for review (iOS), promote to production (Android)
171
+ - Monitor first 48h: crash rates, ANR rates, user feedback
172
+ - Hotfix process: OTA for JS changes, new build for native changes
173
+ - Version bump and changelog for next release
174
+
175
+ **Success Criteria:**
176
+ 1. OTA updates deliver to users within minutes
177
+ 2. Crash reports appear in dashboard with stack traces
178
+ 3. Analytics tracking key user flows
179
+ 4. App live on both stores
180
+ 5. No critical crashes in first 48h
181
+ 6. Hotfix pipeline tested and documented