@ktpartners/dgs-platform 2.6.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (256) hide show
  1. package/LICENSE +38 -0
  2. package/README.md +851 -0
  3. package/agents/dgs-codebase-cross-analyzer.md +183 -0
  4. package/agents/dgs-codebase-mapper.md +782 -0
  5. package/agents/dgs-codebase-synthesizer.md +156 -0
  6. package/agents/dgs-debugger.md +1256 -0
  7. package/agents/dgs-executor.md +550 -0
  8. package/agents/dgs-integration-checker.md +481 -0
  9. package/agents/dgs-nyquist-auditor.md +178 -0
  10. package/agents/dgs-phase-researcher.md +563 -0
  11. package/agents/dgs-phase-verifier.md +450 -0
  12. package/agents/dgs-plan-checker.md +708 -0
  13. package/agents/dgs-planner.md +1324 -0
  14. package/agents/dgs-project-researcher.md +631 -0
  15. package/agents/dgs-research-synthesizer.md +249 -0
  16. package/agents/dgs-roadmapper.md +652 -0
  17. package/agents/dgs-verifier.md +607 -0
  18. package/bin/install.js +2073 -0
  19. package/commands/dgs/add-doc.md +45 -0
  20. package/commands/dgs/add-idea.md +38 -0
  21. package/commands/dgs/add-phase.md +43 -0
  22. package/commands/dgs/add-repo.md +54 -0
  23. package/commands/dgs/add-tests.md +41 -0
  24. package/commands/dgs/add-todo.md +47 -0
  25. package/commands/dgs/approve-spec.md +38 -0
  26. package/commands/dgs/audit-milestone.md +36 -0
  27. package/commands/dgs/audit-phase.md +37 -0
  28. package/commands/dgs/cancel-job.md +23 -0
  29. package/commands/dgs/capture-principle.md +143 -0
  30. package/commands/dgs/check-todos.md +45 -0
  31. package/commands/dgs/cleanup.md +18 -0
  32. package/commands/dgs/complete-milestone.md +136 -0
  33. package/commands/dgs/complete-project.md +70 -0
  34. package/commands/dgs/consolidate-ideas.md +50 -0
  35. package/commands/dgs/create-milestone-job.md +37 -0
  36. package/commands/dgs/debug.md +164 -0
  37. package/commands/dgs/develop-idea.md +53 -0
  38. package/commands/dgs/discuss-idea.md +41 -0
  39. package/commands/dgs/discuss-phase.md +83 -0
  40. package/commands/dgs/execute-phase.md +41 -0
  41. package/commands/dgs/fast.md +38 -0
  42. package/commands/dgs/find-related-ideas.md +43 -0
  43. package/commands/dgs/health.md +28 -0
  44. package/commands/dgs/help.md +22 -0
  45. package/commands/dgs/import-spec.md +36 -0
  46. package/commands/dgs/init-product.md +28 -0
  47. package/commands/dgs/insert-phase.md +32 -0
  48. package/commands/dgs/join-discord.md +18 -0
  49. package/commands/dgs/list-docs.md +40 -0
  50. package/commands/dgs/list-ideas.md +42 -0
  51. package/commands/dgs/list-jobs.md +22 -0
  52. package/commands/dgs/list-phase-assumptions.md +46 -0
  53. package/commands/dgs/list-projects.md +57 -0
  54. package/commands/dgs/list-specs.md +40 -0
  55. package/commands/dgs/map-codebase.md +92 -0
  56. package/commands/dgs/new-milestone.md +44 -0
  57. package/commands/dgs/new-project.md +42 -0
  58. package/commands/dgs/node-repair.md +26 -0
  59. package/commands/dgs/overlap-check.md +20 -0
  60. package/commands/dgs/pause-work.md +38 -0
  61. package/commands/dgs/plan-milestone-gaps.md +34 -0
  62. package/commands/dgs/plan-phase.md +44 -0
  63. package/commands/dgs/progress.md +24 -0
  64. package/commands/dgs/quick.md +41 -0
  65. package/commands/dgs/reactivate-project.md +70 -0
  66. package/commands/dgs/reapply-patches.md +110 -0
  67. package/commands/dgs/refine-spec.md +38 -0
  68. package/commands/dgs/reject-idea.md +43 -0
  69. package/commands/dgs/remove-doc.md +44 -0
  70. package/commands/dgs/remove-phase.md +31 -0
  71. package/commands/dgs/remove-repo.md +69 -0
  72. package/commands/dgs/research-idea.md +43 -0
  73. package/commands/dgs/research-phase.md +189 -0
  74. package/commands/dgs/restore-idea.md +45 -0
  75. package/commands/dgs/resume-work.md +40 -0
  76. package/commands/dgs/rollback-job.md +24 -0
  77. package/commands/dgs/run-job.md +35 -0
  78. package/commands/dgs/search.md +40 -0
  79. package/commands/dgs/set-profile.md +34 -0
  80. package/commands/dgs/settings.md +38 -0
  81. package/commands/dgs/switch-project.md +58 -0
  82. package/commands/dgs/undo-consolidation.md +42 -0
  83. package/commands/dgs/update-idea.md +44 -0
  84. package/commands/dgs/update.md +37 -0
  85. package/commands/dgs/validate-phase.md +35 -0
  86. package/commands/dgs/verify-work.md +39 -0
  87. package/commands/dgs/write-spec.md +49 -0
  88. package/deliver-great-systems/.planning/phases/09-backend-wiring-and-error-handling/09-01-SUMMARY.md +84 -0
  89. package/deliver-great-systems/.planning/phases/09-backend-wiring-and-error-handling/09-02-SUMMARY.md +86 -0
  90. package/deliver-great-systems/.planning/phases/10-v1-to-v2-migration-flow/10-01-SUMMARY.md +85 -0
  91. package/deliver-great-systems/bin/dgs-tools.cjs +1444 -0
  92. package/deliver-great-systems/bin/lib/auto-test.cjs +1365 -0
  93. package/deliver-great-systems/bin/lib/commands.cjs +570 -0
  94. package/deliver-great-systems/bin/lib/config.cjs +417 -0
  95. package/deliver-great-systems/bin/lib/conflict-agent.cjs +1063 -0
  96. package/deliver-great-systems/bin/lib/conflict-agent.test.cjs +554 -0
  97. package/deliver-great-systems/bin/lib/context.cjs +929 -0
  98. package/deliver-great-systems/bin/lib/context.test.cjs +693 -0
  99. package/deliver-great-systems/bin/lib/core.cjs +744 -0
  100. package/deliver-great-systems/bin/lib/core.test.cjs +822 -0
  101. package/deliver-great-systems/bin/lib/docs.cjs +919 -0
  102. package/deliver-great-systems/bin/lib/docs.test.cjs +211 -0
  103. package/deliver-great-systems/bin/lib/execution.cjs +705 -0
  104. package/deliver-great-systems/bin/lib/execution.test.cjs +1472 -0
  105. package/deliver-great-systems/bin/lib/frontmatter.cjs +324 -0
  106. package/deliver-great-systems/bin/lib/ideas.cjs +1406 -0
  107. package/deliver-great-systems/bin/lib/ideas.test.cjs +1417 -0
  108. package/deliver-great-systems/bin/lib/identity.cjs +125 -0
  109. package/deliver-great-systems/bin/lib/init.cjs +1114 -0
  110. package/deliver-great-systems/bin/lib/init.test.cjs +1271 -0
  111. package/deliver-great-systems/bin/lib/jobs.cjs +2015 -0
  112. package/deliver-great-systems/bin/lib/jobs.test.cjs +2619 -0
  113. package/deliver-great-systems/bin/lib/merge-conflicts.cjs +654 -0
  114. package/deliver-great-systems/bin/lib/merge-conflicts.test.cjs +370 -0
  115. package/deliver-great-systems/bin/lib/migration.cjs +352 -0
  116. package/deliver-great-systems/bin/lib/migration.test.cjs +582 -0
  117. package/deliver-great-systems/bin/lib/milestone.cjs +243 -0
  118. package/deliver-great-systems/bin/lib/overlap.cjs +437 -0
  119. package/deliver-great-systems/bin/lib/overlap.test.cjs +747 -0
  120. package/deliver-great-systems/bin/lib/path-audit.test.cjs +384 -0
  121. package/deliver-great-systems/bin/lib/paths.cjs +144 -0
  122. package/deliver-great-systems/bin/lib/paths.test.cjs +486 -0
  123. package/deliver-great-systems/bin/lib/phase.cjs +910 -0
  124. package/deliver-great-systems/bin/lib/projects.cjs +691 -0
  125. package/deliver-great-systems/bin/lib/projects.test.cjs +871 -0
  126. package/deliver-great-systems/bin/lib/repos.cjs +1432 -0
  127. package/deliver-great-systems/bin/lib/repos.test.cjs +1882 -0
  128. package/deliver-great-systems/bin/lib/roadmap.cjs +305 -0
  129. package/deliver-great-systems/bin/lib/search.cjs +570 -0
  130. package/deliver-great-systems/bin/lib/specs.cjs +1303 -0
  131. package/deliver-great-systems/bin/lib/state.cjs +893 -0
  132. package/deliver-great-systems/bin/lib/template.cjs +228 -0
  133. package/deliver-great-systems/bin/lib/test-helpers.cjs +291 -0
  134. package/deliver-great-systems/bin/lib/verify.cjs +796 -0
  135. package/deliver-great-systems/references/checkpoints.md +776 -0
  136. package/deliver-great-systems/references/conflict-resolution.md +66 -0
  137. package/deliver-great-systems/references/context-tiers.md +166 -0
  138. package/deliver-great-systems/references/continuation-format.md +249 -0
  139. package/deliver-great-systems/references/decimal-phase-calculation.md +67 -0
  140. package/deliver-great-systems/references/git-integration.md +250 -0
  141. package/deliver-great-systems/references/git-planning-commit.md +40 -0
  142. package/deliver-great-systems/references/model-profile-resolution.md +36 -0
  143. package/deliver-great-systems/references/model-profiles.md +95 -0
  144. package/deliver-great-systems/references/phase-argument-parsing.md +61 -0
  145. package/deliver-great-systems/references/planning-config.md +224 -0
  146. package/deliver-great-systems/references/questioning.md +162 -0
  147. package/deliver-great-systems/references/spec-review-loop.md +177 -0
  148. package/deliver-great-systems/references/tdd.md +265 -0
  149. package/deliver-great-systems/references/ui-brand.md +160 -0
  150. package/deliver-great-systems/references/verification-patterns.md +612 -0
  151. package/deliver-great-systems/templates/DEBUG.md +166 -0
  152. package/deliver-great-systems/templates/UAT.md +251 -0
  153. package/deliver-great-systems/templates/VALIDATION.md +95 -0
  154. package/deliver-great-systems/templates/claude-md.md +74 -0
  155. package/deliver-great-systems/templates/codebase/architecture.md +257 -0
  156. package/deliver-great-systems/templates/codebase/concerns.md +312 -0
  157. package/deliver-great-systems/templates/codebase/conventions.md +309 -0
  158. package/deliver-great-systems/templates/codebase/integrations.md +282 -0
  159. package/deliver-great-systems/templates/codebase/stack.md +188 -0
  160. package/deliver-great-systems/templates/codebase/structure.md +287 -0
  161. package/deliver-great-systems/templates/codebase/testing.md +482 -0
  162. package/deliver-great-systems/templates/config.json +38 -0
  163. package/deliver-great-systems/templates/context.md +354 -0
  164. package/deliver-great-systems/templates/continue-here.md +80 -0
  165. package/deliver-great-systems/templates/debug-subagent-prompt.md +93 -0
  166. package/deliver-great-systems/templates/discovery.md +148 -0
  167. package/deliver-great-systems/templates/milestone-archive.md +125 -0
  168. package/deliver-great-systems/templates/milestone.md +117 -0
  169. package/deliver-great-systems/templates/phase-prompt.md +615 -0
  170. package/deliver-great-systems/templates/planner-subagent-prompt.md +119 -0
  171. package/deliver-great-systems/templates/project.md +186 -0
  172. package/deliver-great-systems/templates/requirements.md +233 -0
  173. package/deliver-great-systems/templates/research-project/ARCHITECTURE.md +206 -0
  174. package/deliver-great-systems/templates/research-project/FEATURES.md +149 -0
  175. package/deliver-great-systems/templates/research-project/PITFALLS.md +202 -0
  176. package/deliver-great-systems/templates/research-project/STACK.md +122 -0
  177. package/deliver-great-systems/templates/research-project/SUMMARY.md +172 -0
  178. package/deliver-great-systems/templates/research.md +554 -0
  179. package/deliver-great-systems/templates/retrospective.md +54 -0
  180. package/deliver-great-systems/templates/roadmap.md +204 -0
  181. package/deliver-great-systems/templates/state.md +178 -0
  182. package/deliver-great-systems/templates/summary-complex.md +59 -0
  183. package/deliver-great-systems/templates/summary-minimal.md +41 -0
  184. package/deliver-great-systems/templates/summary-standard.md +48 -0
  185. package/deliver-great-systems/templates/summary.md +253 -0
  186. package/deliver-great-systems/templates/user-setup.md +313 -0
  187. package/deliver-great-systems/templates/verification-report.md +324 -0
  188. package/deliver-great-systems/workflows/add-doc.md +151 -0
  189. package/deliver-great-systems/workflows/add-idea.md +96 -0
  190. package/deliver-great-systems/workflows/add-phase.md +120 -0
  191. package/deliver-great-systems/workflows/add-tests.md +359 -0
  192. package/deliver-great-systems/workflows/add-todo.md +162 -0
  193. package/deliver-great-systems/workflows/approve-spec.md +194 -0
  194. package/deliver-great-systems/workflows/audit-milestone.md +364 -0
  195. package/deliver-great-systems/workflows/audit-phase.md +462 -0
  196. package/deliver-great-systems/workflows/cancel-job.md +108 -0
  197. package/deliver-great-systems/workflows/check-todos.md +181 -0
  198. package/deliver-great-systems/workflows/cleanup.md +247 -0
  199. package/deliver-great-systems/workflows/codereview.md +526 -0
  200. package/deliver-great-systems/workflows/complete-milestone.md +1298 -0
  201. package/deliver-great-systems/workflows/consolidate-ideas.md +365 -0
  202. package/deliver-great-systems/workflows/create-milestone-job.md +177 -0
  203. package/deliver-great-systems/workflows/develop-idea.md +544 -0
  204. package/deliver-great-systems/workflows/diagnose-issues.md +231 -0
  205. package/deliver-great-systems/workflows/discovery-phase.md +301 -0
  206. package/deliver-great-systems/workflows/discuss-idea.md +263 -0
  207. package/deliver-great-systems/workflows/discuss-phase.md +733 -0
  208. package/deliver-great-systems/workflows/execute-phase.md +571 -0
  209. package/deliver-great-systems/workflows/execute-plan.md +592 -0
  210. package/deliver-great-systems/workflows/find-related-ideas.md +271 -0
  211. package/deliver-great-systems/workflows/health.md +173 -0
  212. package/deliver-great-systems/workflows/help.md +997 -0
  213. package/deliver-great-systems/workflows/import-spec.md +381 -0
  214. package/deliver-great-systems/workflows/init-product.md +767 -0
  215. package/deliver-great-systems/workflows/insert-phase.md +138 -0
  216. package/deliver-great-systems/workflows/list-docs.md +119 -0
  217. package/deliver-great-systems/workflows/list-ideas.md +154 -0
  218. package/deliver-great-systems/workflows/list-jobs.md +89 -0
  219. package/deliver-great-systems/workflows/list-phase-assumptions.md +192 -0
  220. package/deliver-great-systems/workflows/list-specs.md +101 -0
  221. package/deliver-great-systems/workflows/map-codebase.md +621 -0
  222. package/deliver-great-systems/workflows/new-milestone.md +591 -0
  223. package/deliver-great-systems/workflows/new-project.md +1113 -0
  224. package/deliver-great-systems/workflows/node-repair.md +94 -0
  225. package/deliver-great-systems/workflows/overlap-check.md +86 -0
  226. package/deliver-great-systems/workflows/pause-work.md +134 -0
  227. package/deliver-great-systems/workflows/plan-milestone-gaps.md +306 -0
  228. package/deliver-great-systems/workflows/plan-phase.md +698 -0
  229. package/deliver-great-systems/workflows/progress.md +386 -0
  230. package/deliver-great-systems/workflows/quick.md +845 -0
  231. package/deliver-great-systems/workflows/refine-spec.md +275 -0
  232. package/deliver-great-systems/workflows/reject-idea.md +109 -0
  233. package/deliver-great-systems/workflows/remove-doc.md +117 -0
  234. package/deliver-great-systems/workflows/remove-phase.md +163 -0
  235. package/deliver-great-systems/workflows/research-idea.md +325 -0
  236. package/deliver-great-systems/workflows/research-phase.md +81 -0
  237. package/deliver-great-systems/workflows/restore-idea.md +101 -0
  238. package/deliver-great-systems/workflows/resume-project.md +311 -0
  239. package/deliver-great-systems/workflows/rollback-job.md +130 -0
  240. package/deliver-great-systems/workflows/run-job.md +498 -0
  241. package/deliver-great-systems/workflows/search.md +130 -0
  242. package/deliver-great-systems/workflows/set-profile.md +83 -0
  243. package/deliver-great-systems/workflows/settings.md +470 -0
  244. package/deliver-great-systems/workflows/transition.md +563 -0
  245. package/deliver-great-systems/workflows/undo-consolidation.md +155 -0
  246. package/deliver-great-systems/workflows/update-idea.md +157 -0
  247. package/deliver-great-systems/workflows/update.md +242 -0
  248. package/deliver-great-systems/workflows/validate-phase.md +177 -0
  249. package/deliver-great-systems/workflows/verify-phase.md +253 -0
  250. package/deliver-great-systems/workflows/verify-work.md +671 -0
  251. package/deliver-great-systems/workflows/write-spec.md +450 -0
  252. package/hooks/dist/dgs-check-update.js +62 -0
  253. package/hooks/dist/dgs-context-monitor.js +141 -0
  254. package/hooks/dist/dgs-statusline.js +115 -0
  255. package/package.json +60 -0
  256. package/scripts/build-hooks.js +43 -0
@@ -0,0 +1,554 @@
1
+ # Research Template
2
+
3
+ Template for `phases/XX-name/{phase_num}-RESEARCH.md` (in planning root) - comprehensive ecosystem research before planning.
4
+
5
+ > **Layout-agnostic:** Workflows resolve the phase directory path via `${phase_dir}` from init output. Works in both standard and root layouts.
6
+
7
+ **Purpose:** Document what Claude needs to know to implement a phase well - not just "which library" but "how do experts build this."
8
+
9
+ ---
10
+
11
+ ## File Template
12
+
13
+ ```markdown
14
+ # Phase [X]: [Name] - Research
15
+
16
+ **Researched:** [date]
17
+ **Domain:** [primary technology/problem domain]
18
+ **Confidence:** [HIGH/MEDIUM/LOW]
19
+
20
+ <user_constraints>
21
+ ## User Constraints (from CONTEXT.md)
22
+
23
+ **CRITICAL:** If CONTEXT.md exists from /dgs:discuss-phase, copy locked decisions here verbatim. These MUST be honored by the planner.
24
+
25
+ ### Locked Decisions
26
+ [Copy from CONTEXT.md `## Decisions` section - these are NON-NEGOTIABLE]
27
+ - [Decision 1]
28
+ - [Decision 2]
29
+
30
+ ### Claude's Discretion
31
+ [Copy from CONTEXT.md - areas where researcher/planner can choose]
32
+ - [Area 1]
33
+ - [Area 2]
34
+
35
+ ### Deferred Ideas (OUT OF SCOPE)
36
+ [Copy from CONTEXT.md - do NOT research or plan these]
37
+ - [Deferred 1]
38
+ - [Deferred 2]
39
+
40
+ **If no CONTEXT.md exists:** Write "No user constraints - all decisions at Claude's discretion"
41
+ </user_constraints>
42
+
43
+ <research_summary>
44
+ ## Summary
45
+
46
+ [2-3 paragraph executive summary]
47
+ - What was researched
48
+ - What the standard approach is
49
+ - Key recommendations
50
+
51
+ **Primary recommendation:** [one-liner actionable guidance]
52
+ </research_summary>
53
+
54
+ <standard_stack>
55
+ ## Standard Stack
56
+
57
+ The established libraries/tools for this domain:
58
+
59
+ ### Core
60
+ | Library | Version | Purpose | Why Standard |
61
+ |---------|---------|---------|--------------|
62
+ | [name] | [ver] | [what it does] | [why experts use it] |
63
+ | [name] | [ver] | [what it does] | [why experts use it] |
64
+
65
+ ### Supporting
66
+ | Library | Version | Purpose | When to Use |
67
+ |---------|---------|---------|-------------|
68
+ | [name] | [ver] | [what it does] | [use case] |
69
+ | [name] | [ver] | [what it does] | [use case] |
70
+
71
+ ### Alternatives Considered
72
+ | Instead of | Could Use | Tradeoff |
73
+ |------------|-----------|----------|
74
+ | [standard] | [alternative] | [when alternative makes sense] |
75
+
76
+ **Installation:**
77
+ ```bash
78
+ npm install [packages]
79
+ # or
80
+ yarn add [packages]
81
+ ```
82
+ </standard_stack>
83
+
84
+ <architecture_patterns>
85
+ ## Architecture Patterns
86
+
87
+ ### Recommended Project Structure
88
+ ```
89
+ src/
90
+ ├── [folder]/ # [purpose]
91
+ ├── [folder]/ # [purpose]
92
+ └── [folder]/ # [purpose]
93
+ ```
94
+
95
+ ### Pattern 1: [Pattern Name]
96
+ **What:** [description]
97
+ **When to use:** [conditions]
98
+ **Example:**
99
+ ```typescript
100
+ // [code example from Context7/official docs]
101
+ ```
102
+
103
+ ### Pattern 2: [Pattern Name]
104
+ **What:** [description]
105
+ **When to use:** [conditions]
106
+ **Example:**
107
+ ```typescript
108
+ // [code example]
109
+ ```
110
+
111
+ ### Anti-Patterns to Avoid
112
+ - **[Anti-pattern]:** [why it's bad, what to do instead]
113
+ - **[Anti-pattern]:** [why it's bad, what to do instead]
114
+ </architecture_patterns>
115
+
116
+ <dont_hand_roll>
117
+ ## Don't Hand-Roll
118
+
119
+ Problems that look simple but have existing solutions:
120
+
121
+ | Problem | Don't Build | Use Instead | Why |
122
+ |---------|-------------|-------------|-----|
123
+ | [problem] | [what you'd build] | [library] | [edge cases, complexity] |
124
+ | [problem] | [what you'd build] | [library] | [edge cases, complexity] |
125
+ | [problem] | [what you'd build] | [library] | [edge cases, complexity] |
126
+
127
+ **Key insight:** [why custom solutions are worse in this domain]
128
+ </dont_hand_roll>
129
+
130
+ <common_pitfalls>
131
+ ## Common Pitfalls
132
+
133
+ ### Pitfall 1: [Name]
134
+ **What goes wrong:** [description]
135
+ **Why it happens:** [root cause]
136
+ **How to avoid:** [prevention strategy]
137
+ **Warning signs:** [how to detect early]
138
+
139
+ ### Pitfall 2: [Name]
140
+ **What goes wrong:** [description]
141
+ **Why it happens:** [root cause]
142
+ **How to avoid:** [prevention strategy]
143
+ **Warning signs:** [how to detect early]
144
+
145
+ ### Pitfall 3: [Name]
146
+ **What goes wrong:** [description]
147
+ **Why it happens:** [root cause]
148
+ **How to avoid:** [prevention strategy]
149
+ **Warning signs:** [how to detect early]
150
+ </common_pitfalls>
151
+
152
+ <code_examples>
153
+ ## Code Examples
154
+
155
+ Verified patterns from official sources:
156
+
157
+ ### [Common Operation 1]
158
+ ```typescript
159
+ // Source: [Context7/official docs URL]
160
+ [code]
161
+ ```
162
+
163
+ ### [Common Operation 2]
164
+ ```typescript
165
+ // Source: [Context7/official docs URL]
166
+ [code]
167
+ ```
168
+
169
+ ### [Common Operation 3]
170
+ ```typescript
171
+ // Source: [Context7/official docs URL]
172
+ [code]
173
+ ```
174
+ </code_examples>
175
+
176
+ <sota_updates>
177
+ ## State of the Art (2024-2025)
178
+
179
+ What's changed recently:
180
+
181
+ | Old Approach | Current Approach | When Changed | Impact |
182
+ |--------------|------------------|--------------|--------|
183
+ | [old] | [new] | [date/version] | [what it means for implementation] |
184
+
185
+ **New tools/patterns to consider:**
186
+ - [Tool/Pattern]: [what it enables, when to use]
187
+ - [Tool/Pattern]: [what it enables, when to use]
188
+
189
+ **Deprecated/outdated:**
190
+ - [Thing]: [why it's outdated, what replaced it]
191
+ </sota_updates>
192
+
193
+ <open_questions>
194
+ ## Open Questions
195
+
196
+ Things that couldn't be fully resolved:
197
+
198
+ 1. **[Question]**
199
+ - What we know: [partial info]
200
+ - What's unclear: [the gap]
201
+ - Recommendation: [how to handle during planning/execution]
202
+
203
+ 2. **[Question]**
204
+ - What we know: [partial info]
205
+ - What's unclear: [the gap]
206
+ - Recommendation: [how to handle]
207
+ </open_questions>
208
+
209
+ <sources>
210
+ ## Sources
211
+
212
+ ### Primary (HIGH confidence)
213
+ - [Context7 library ID] - [topics fetched]
214
+ - [Official docs URL] - [what was checked]
215
+
216
+ ### Secondary (MEDIUM confidence)
217
+ - [WebSearch verified with official source] - [finding + verification]
218
+
219
+ ### Tertiary (LOW confidence - needs validation)
220
+ - [WebSearch only] - [finding, marked for validation during implementation]
221
+ </sources>
222
+
223
+ <metadata>
224
+ ## Metadata
225
+
226
+ **Research scope:**
227
+ - Core technology: [what]
228
+ - Ecosystem: [libraries explored]
229
+ - Patterns: [patterns researched]
230
+ - Pitfalls: [areas checked]
231
+
232
+ **Confidence breakdown:**
233
+ - Standard stack: [HIGH/MEDIUM/LOW] - [reason]
234
+ - Architecture: [HIGH/MEDIUM/LOW] - [reason]
235
+ - Pitfalls: [HIGH/MEDIUM/LOW] - [reason]
236
+ - Code examples: [HIGH/MEDIUM/LOW] - [reason]
237
+
238
+ **Research date:** [date]
239
+ **Valid until:** [estimate - 30 days for stable tech, 7 days for fast-moving]
240
+ </metadata>
241
+
242
+ ---
243
+
244
+ *Phase: XX-name*
245
+ *Research completed: [date]*
246
+ *Ready for planning: [yes/no]*
247
+ ```
248
+
249
+ ---
250
+
251
+ ## Good Example
252
+
253
+ ```markdown
254
+ # Phase 3: 3D City Driving - Research
255
+
256
+ **Researched:** 2025-01-20
257
+ **Domain:** Three.js 3D web game with driving mechanics
258
+ **Confidence:** HIGH
259
+
260
+ <research_summary>
261
+ ## Summary
262
+
263
+ Researched the Three.js ecosystem for building a 3D city driving game. The standard approach uses Three.js with React Three Fiber for component architecture, Rapier for physics, and drei for common helpers.
264
+
265
+ Key finding: Don't hand-roll physics or collision detection. Rapier (via @react-three/rapier) handles vehicle physics, terrain collision, and city object interactions efficiently. Custom physics code leads to bugs and performance issues.
266
+
267
+ **Primary recommendation:** Use R3F + Rapier + drei stack. Start with vehicle controller from drei, add Rapier vehicle physics, build city with instanced meshes for performance.
268
+ </research_summary>
269
+
270
+ <standard_stack>
271
+ ## Standard Stack
272
+
273
+ ### Core
274
+ | Library | Version | Purpose | Why Standard |
275
+ |---------|---------|---------|--------------|
276
+ | three | 0.160.0 | 3D rendering | The standard for web 3D |
277
+ | @react-three/fiber | 8.15.0 | React renderer for Three.js | Declarative 3D, better DX |
278
+ | @react-three/drei | 9.92.0 | Helpers and abstractions | Solves common problems |
279
+ | @react-three/rapier | 1.2.1 | Physics engine bindings | Best physics for R3F |
280
+
281
+ ### Supporting
282
+ | Library | Version | Purpose | When to Use |
283
+ |---------|---------|---------|-------------|
284
+ | @react-three/postprocessing | 2.16.0 | Visual effects | Bloom, DOF, motion blur |
285
+ | leva | 0.9.35 | Debug UI | Tweaking parameters |
286
+ | zustand | 4.4.7 | State management | Game state, UI state |
287
+ | use-sound | 4.0.1 | Audio | Engine sounds, ambient |
288
+
289
+ ### Alternatives Considered
290
+ | Instead of | Could Use | Tradeoff |
291
+ |------------|-----------|----------|
292
+ | Rapier | Cannon.js | Cannon simpler but less performant for vehicles |
293
+ | R3F | Vanilla Three | Vanilla if no React, but R3F DX is much better |
294
+ | drei | Custom helpers | drei is battle-tested, don't reinvent |
295
+
296
+ **Installation:**
297
+ ```bash
298
+ npm install three @react-three/fiber @react-three/drei @react-three/rapier zustand
299
+ ```
300
+ </standard_stack>
301
+
302
+ <architecture_patterns>
303
+ ## Architecture Patterns
304
+
305
+ ### Recommended Project Structure
306
+ ```
307
+ src/
308
+ ├── components/
309
+ │ ├── Vehicle/ # Player car with physics
310
+ │ ├── City/ # City generation and buildings
311
+ │ ├── Road/ # Road network
312
+ │ └── Environment/ # Sky, lighting, fog
313
+ ├── hooks/
314
+ │ ├── useVehicleControls.ts
315
+ │ └── useGameState.ts
316
+ ├── stores/
317
+ │ └── gameStore.ts # Zustand state
318
+ └── utils/
319
+ └── cityGenerator.ts # Procedural generation helpers
320
+ ```
321
+
322
+ ### Pattern 1: Vehicle with Rapier Physics
323
+ **What:** Use RigidBody with vehicle-specific settings, not custom physics
324
+ **When to use:** Any ground vehicle
325
+ **Example:**
326
+ ```typescript
327
+ // Source: @react-three/rapier docs
328
+ import { RigidBody, useRapier } from '@react-three/rapier'
329
+
330
+ function Vehicle() {
331
+ const rigidBody = useRef()
332
+
333
+ return (
334
+ <RigidBody
335
+ ref={rigidBody}
336
+ type="dynamic"
337
+ colliders="hull"
338
+ mass={1500}
339
+ linearDamping={0.5}
340
+ angularDamping={0.5}
341
+ >
342
+ <mesh>
343
+ <boxGeometry args={[2, 1, 4]} />
344
+ <meshStandardMaterial />
345
+ </mesh>
346
+ </RigidBody>
347
+ )
348
+ }
349
+ ```
350
+
351
+ ### Pattern 2: Instanced Meshes for City
352
+ **What:** Use InstancedMesh for repeated objects (buildings, trees, props)
353
+ **When to use:** >100 similar objects
354
+ **Example:**
355
+ ```typescript
356
+ // Source: drei docs
357
+ import { Instances, Instance } from '@react-three/drei'
358
+
359
+ function Buildings({ positions }) {
360
+ return (
361
+ <Instances limit={1000}>
362
+ <boxGeometry />
363
+ <meshStandardMaterial />
364
+ {positions.map((pos, i) => (
365
+ <Instance key={i} position={pos} scale={[1, Math.random() * 5 + 1, 1]} />
366
+ ))}
367
+ </Instances>
368
+ )
369
+ }
370
+ ```
371
+
372
+ ### Anti-Patterns to Avoid
373
+ - **Creating meshes in render loop:** Create once, update transforms only
374
+ - **Not using InstancedMesh:** Individual meshes for buildings kills performance
375
+ - **Custom physics math:** Rapier handles it better, every time
376
+ </architecture_patterns>
377
+
378
+ <dont_hand_roll>
379
+ ## Don't Hand-Roll
380
+
381
+ | Problem | Don't Build | Use Instead | Why |
382
+ |---------|-------------|-------------|-----|
383
+ | Vehicle physics | Custom velocity/acceleration | Rapier RigidBody | Wheel friction, suspension, collisions are complex |
384
+ | Collision detection | Raycasting everything | Rapier colliders | Performance, edge cases, tunneling |
385
+ | Camera follow | Manual lerp | drei CameraControls or custom with useFrame | Smooth interpolation, bounds |
386
+ | City generation | Pure random placement | Grid-based with noise for variation | Random looks wrong, grid is predictable |
387
+ | LOD | Manual distance checks | drei <Detailed> | Handles transitions, hysteresis |
388
+
389
+ **Key insight:** 3D game development has 40+ years of solved problems. Rapier implements proper physics simulation. drei implements proper 3D helpers. Fighting these leads to bugs that look like "game feel" issues but are actually physics edge cases.
390
+ </dont_hand_roll>
391
+
392
+ <common_pitfalls>
393
+ ## Common Pitfalls
394
+
395
+ ### Pitfall 1: Physics Tunneling
396
+ **What goes wrong:** Fast objects pass through walls
397
+ **Why it happens:** Default physics step too large for velocity
398
+ **How to avoid:** Use CCD (Continuous Collision Detection) in Rapier
399
+ **Warning signs:** Objects randomly appearing outside buildings
400
+
401
+ ### Pitfall 2: Performance Death by Draw Calls
402
+ **What goes wrong:** Game stutters with many buildings
403
+ **Why it happens:** Each mesh = 1 draw call, hundreds of buildings = hundreds of calls
404
+ **How to avoid:** InstancedMesh for similar objects, merge static geometry
405
+ **Warning signs:** GPU bound, low FPS despite simple scene
406
+
407
+ ### Pitfall 3: Vehicle "Floaty" Feel
408
+ **What goes wrong:** Car doesn't feel grounded
409
+ **Why it happens:** Missing proper wheel/suspension simulation
410
+ **How to avoid:** Use Rapier vehicle controller or tune mass/damping carefully
411
+ **Warning signs:** Car bounces oddly, doesn't grip corners
412
+ </common_pitfalls>
413
+
414
+ <code_examples>
415
+ ## Code Examples
416
+
417
+ ### Basic R3F + Rapier Setup
418
+ ```typescript
419
+ // Source: @react-three/rapier getting started
420
+ import { Canvas } from '@react-three/fiber'
421
+ import { Physics } from '@react-three/rapier'
422
+
423
+ function Game() {
424
+ return (
425
+ <Canvas>
426
+ <Physics gravity={[0, -9.81, 0]}>
427
+ <Vehicle />
428
+ <City />
429
+ <Ground />
430
+ </Physics>
431
+ </Canvas>
432
+ )
433
+ }
434
+ ```
435
+
436
+ ### Vehicle Controls Hook
437
+ ```typescript
438
+ // Source: Community pattern, verified with drei docs
439
+ import { useFrame } from '@react-three/fiber'
440
+ import { useKeyboardControls } from '@react-three/drei'
441
+
442
+ function useVehicleControls(rigidBodyRef) {
443
+ const [, getKeys] = useKeyboardControls()
444
+
445
+ useFrame(() => {
446
+ const { forward, back, left, right } = getKeys()
447
+ const body = rigidBodyRef.current
448
+ if (!body) return
449
+
450
+ const impulse = { x: 0, y: 0, z: 0 }
451
+ if (forward) impulse.z -= 10
452
+ if (back) impulse.z += 5
453
+
454
+ body.applyImpulse(impulse, true)
455
+
456
+ if (left) body.applyTorqueImpulse({ x: 0, y: 2, z: 0 }, true)
457
+ if (right) body.applyTorqueImpulse({ x: 0, y: -2, z: 0 }, true)
458
+ })
459
+ }
460
+ ```
461
+ </code_examples>
462
+
463
+ <sota_updates>
464
+ ## State of the Art (2024-2025)
465
+
466
+ | Old Approach | Current Approach | When Changed | Impact |
467
+ |--------------|------------------|--------------|--------|
468
+ | cannon-es | Rapier | 2023 | Rapier is faster, better maintained |
469
+ | vanilla Three.js | React Three Fiber | 2020+ | R3F is now standard for React apps |
470
+ | Manual InstancedMesh | drei <Instances> | 2022 | Simpler API, handles updates |
471
+
472
+ **New tools/patterns to consider:**
473
+ - **WebGPU:** Coming but not production-ready for games yet (2025)
474
+ - **drei Gltf helpers:** <useGLTF.preload> for loading screens
475
+
476
+ **Deprecated/outdated:**
477
+ - **cannon.js (original):** Use cannon-es fork or better, Rapier
478
+ - **Manual raycasting for physics:** Just use Rapier colliders
479
+ </sota_updates>
480
+
481
+ <sources>
482
+ ## Sources
483
+
484
+ ### Primary (HIGH confidence)
485
+ - /pmndrs/react-three-fiber - getting started, hooks, performance
486
+ - /pmndrs/drei - instances, controls, helpers
487
+ - /dimforge/rapier-js - physics setup, vehicle physics
488
+
489
+ ### Secondary (MEDIUM confidence)
490
+ - Three.js discourse "city driving game" threads - verified patterns against docs
491
+ - R3F examples repository - verified code works
492
+
493
+ ### Tertiary (LOW confidence - needs validation)
494
+ - None - all findings verified
495
+ </sources>
496
+
497
+ <metadata>
498
+ ## Metadata
499
+
500
+ **Research scope:**
501
+ - Core technology: Three.js + React Three Fiber
502
+ - Ecosystem: Rapier, drei, zustand
503
+ - Patterns: Vehicle physics, instancing, city generation
504
+ - Pitfalls: Performance, physics, feel
505
+
506
+ **Confidence breakdown:**
507
+ - Standard stack: HIGH - verified with Context7, widely used
508
+ - Architecture: HIGH - from official examples
509
+ - Pitfalls: HIGH - documented in discourse, verified in docs
510
+ - Code examples: HIGH - from Context7/official sources
511
+
512
+ **Research date:** 2025-01-20
513
+ **Valid until:** 2025-02-20 (30 days - R3F ecosystem stable)
514
+ </metadata>
515
+
516
+ ---
517
+
518
+ *Phase: 03-city-driving*
519
+ *Research completed: 2025-01-20*
520
+ *Ready for planning: yes*
521
+ ```
522
+
523
+ ---
524
+
525
+ ## Guidelines
526
+
527
+ **When to create:**
528
+ - Before planning phases in niche/complex domains
529
+ - When Claude's training data is likely stale or sparse
530
+ - When "how do experts do this" matters more than "which library"
531
+
532
+ **Structure:**
533
+ - Use XML tags for section markers (matches DGS templates)
534
+ - Seven core sections: summary, standard_stack, architecture_patterns, dont_hand_roll, common_pitfalls, code_examples, sources
535
+ - All sections required (drives comprehensive research)
536
+
537
+ **Content quality:**
538
+ - Standard stack: Specific versions, not just names
539
+ - Architecture: Include actual code examples from authoritative sources
540
+ - Don't hand-roll: Be explicit about what problems to NOT solve yourself
541
+ - Pitfalls: Include warning signs, not just "don't do this"
542
+ - Sources: Mark confidence levels honestly
543
+
544
+ **Integration with planning:**
545
+ - RESEARCH.md loaded as @context reference in PLAN.md
546
+ - Standard stack informs library choices
547
+ - Don't hand-roll prevents custom solutions
548
+ - Pitfalls inform verification criteria
549
+ - Code examples can be referenced in task actions
550
+
551
+ **After creation:**
552
+ - File lives in phase directory: `phases/XX-name/{phase_num}-RESEARCH.md` (in planning root)
553
+ - Referenced during planning workflow
554
+ - plan-phase loads it automatically when present
@@ -0,0 +1,54 @@
1
+ # Project Retrospective
2
+
3
+ *A living document updated after each milestone. Lessons feed forward into future planning.*
4
+
5
+ ## Milestone: v{version} — {name}
6
+
7
+ **Shipped:** {date}
8
+ **Phases:** {count} | **Plans:** {count} | **Sessions:** {count}
9
+
10
+ ### What Was Built
11
+ - {Key deliverable 1}
12
+ - {Key deliverable 2}
13
+ - {Key deliverable 3}
14
+
15
+ ### What Worked
16
+ - {Efficiency win or successful pattern}
17
+ - {What went smoothly}
18
+
19
+ ### What Was Inefficient
20
+ - {Missed opportunity}
21
+ - {What took longer than expected}
22
+
23
+ ### Patterns Established
24
+ - {New pattern or convention that should persist}
25
+
26
+ ### Key Lessons
27
+ 1. {Specific, actionable lesson}
28
+ 2. {Another lesson}
29
+
30
+ ### Cost Observations
31
+ - Model mix: {X}% opus, {Y}% sonnet, {Z}% haiku
32
+ - Sessions: {count}
33
+ - Notable: {efficiency observation}
34
+
35
+ ---
36
+
37
+ ## Cross-Milestone Trends
38
+
39
+ ### Process Evolution
40
+
41
+ | Milestone | Sessions | Phases | Key Change |
42
+ |-----------|----------|--------|------------|
43
+ | v{X} | {N} | {M} | {What changed in process} |
44
+
45
+ ### Cumulative Quality
46
+
47
+ | Milestone | Tests | Coverage | Zero-Dep Additions |
48
+ |-----------|-------|----------|-------------------|
49
+ | v{X} | {N} | {Y}% | {count} |
50
+
51
+ ### Top Lessons (Verified Across Milestones)
52
+
53
+ 1. {Lesson verified by multiple milestones}
54
+ 2. {Another cross-validated lesson}