@orderful/droid 0.25.2 → 0.27.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 (159) hide show
  1. package/.claude-plugin/marketplace.json +114 -0
  2. package/.github/workflows/ci.yml +20 -0
  3. package/AGENTS.md +75 -18
  4. package/CHANGELOG.md +73 -0
  5. package/README.md +30 -4
  6. package/dist/bin/droid.js +164 -75
  7. package/dist/index.js +68 -26
  8. package/dist/lib/migrations.d.ts +8 -0
  9. package/dist/lib/migrations.d.ts.map +1 -1
  10. package/dist/lib/skill-config.d.ts.map +1 -1
  11. package/dist/lib/skills.d.ts.map +1 -1
  12. package/dist/lib/tools.d.ts.map +1 -1
  13. package/dist/lib/types.d.ts +10 -2
  14. package/dist/lib/types.d.ts.map +1 -1
  15. package/dist/tools/README.md +1 -1
  16. package/dist/tools/brain/.claude-plugin/plugin.json +16 -0
  17. package/dist/tools/brain/TOOL.yaml +7 -5
  18. package/dist/tools/brain/commands/brain.md +17 -49
  19. package/dist/tools/brain/commands/scratchpad.md +13 -50
  20. package/{src/tools/brain/skills/droid-brain → dist/tools/brain/skills/brain}/SKILL.md +6 -6
  21. package/dist/tools/brain/skills/{droid-brain-obsidian → brain-obsidian}/SKILL.md +9 -9
  22. package/dist/tools/coach/.claude-plugin/plugin.json +16 -0
  23. package/dist/tools/coach/TOOL.yaml +4 -3
  24. package/dist/tools/coach/commands/coach.md +14 -54
  25. package/{src/tools/coach/skills/droid-coach → dist/tools/coach/skills/coach}/SKILL.md +5 -4
  26. package/dist/tools/code-review/.claude-plugin/plugin.json +16 -0
  27. package/dist/tools/code-review/TOOL.yaml +4 -3
  28. package/dist/tools/code-review/commands/code-review.md +18 -102
  29. package/dist/tools/code-review/skills/code-review/SKILL.md +154 -0
  30. package/dist/tools/codex/.claude-plugin/plugin.json +16 -0
  31. package/dist/tools/codex/TOOL.yaml +5 -4
  32. package/dist/tools/codex/commands/codex.md +18 -65
  33. package/dist/tools/codex/skills/{droid-codex → codex}/SKILL.md +64 -45
  34. package/{src/tools/codex/skills/droid-codex → dist/tools/codex/skills/codex}/references/loading.md +94 -55
  35. package/dist/tools/codex/skills/codex/scripts/git-finish-write.d.ts.map +1 -0
  36. package/dist/tools/codex/skills/codex/scripts/git-preamble.d.ts.map +1 -0
  37. package/dist/tools/codex/skills/codex/scripts/git-start-write.d.ts.map +1 -0
  38. package/dist/tools/comments/.claude-plugin/plugin.json +16 -0
  39. package/dist/tools/comments/TOOL.yaml +4 -3
  40. package/dist/tools/comments/commands/comments.md +12 -14
  41. package/{src/tools/comments/skills/droid-comments → dist/tools/comments/skills/comments}/SKILL.md +4 -2
  42. package/dist/tools/droid/.claude-plugin/plugin.json +15 -0
  43. package/dist/tools/droid/TOOL.yaml +1 -1
  44. package/dist/tools/droid/skills/droid/SKILL.md +1 -1
  45. package/dist/tools/project/.claude-plugin/plugin.json +16 -0
  46. package/dist/tools/project/TOOL.yaml +4 -3
  47. package/dist/tools/project/commands/project.md +12 -27
  48. package/dist/tools/project/skills/{droid-project → project}/SKILL.md +13 -12
  49. package/dist/tools/tech-design/.claude-plugin/plugin.json +16 -0
  50. package/dist/tools/tech-design/TOOL.yaml +19 -0
  51. package/dist/tools/tech-design/commands/tech-design.md +31 -0
  52. package/dist/tools/tech-design/skills/tech-design/SKILL.md +218 -0
  53. package/dist/tools/tech-design/skills/tech-design/references/draft.md +321 -0
  54. package/dist/tools/tech-design/skills/tech-design/references/gaps.md +328 -0
  55. package/dist/tools/tech-design/skills/tech-design/references/publish.md +409 -0
  56. package/dist/tools/tech-design/skills/tech-design/references/research-doc-template.md +129 -0
  57. package/dist/tools/tech-design/skills/tech-design/references/rollup-template.md +55 -0
  58. package/dist/tools/tech-design/skills/tech-design/references/start.md +353 -0
  59. package/dist/tools/tech-design/skills/tech-design/references/think.md +356 -0
  60. package/dist/tools/tech-design/skills/tech-design/references/thought-doc-template.md +72 -0
  61. package/package.json +3 -2
  62. package/scripts/build-plugins.ts +207 -0
  63. package/src/commands/tui/components/Badge.test.tsx +10 -4
  64. package/src/commands/tui.tsx +4 -4
  65. package/src/lib/migrations.ts +95 -4
  66. package/src/lib/skill-config.ts +95 -57
  67. package/src/lib/skills.test.ts +199 -74
  68. package/src/lib/skills.ts +57 -56
  69. package/src/lib/tools.ts +19 -12
  70. package/src/lib/types.ts +20 -5
  71. package/src/tools/README.md +1 -1
  72. package/src/tools/brain/.claude-plugin/plugin.json +16 -0
  73. package/src/tools/brain/TOOL.yaml +7 -5
  74. package/src/tools/brain/commands/brain.md +17 -49
  75. package/src/tools/brain/commands/scratchpad.md +13 -50
  76. package/{dist/tools/brain/skills/droid-brain → src/tools/brain/skills/brain}/SKILL.md +6 -6
  77. package/src/tools/brain/skills/{droid-brain-obsidian → brain-obsidian}/SKILL.md +9 -9
  78. package/src/tools/coach/.claude-plugin/plugin.json +16 -0
  79. package/src/tools/coach/TOOL.yaml +4 -3
  80. package/src/tools/coach/commands/coach.md +14 -54
  81. package/{dist/tools/coach/skills/droid-coach → src/tools/coach/skills/coach}/SKILL.md +5 -4
  82. package/src/tools/code-review/.claude-plugin/plugin.json +16 -0
  83. package/src/tools/code-review/TOOL.yaml +4 -3
  84. package/src/tools/code-review/commands/code-review.md +18 -102
  85. package/src/tools/code-review/skills/code-review/SKILL.md +154 -0
  86. package/src/tools/codex/.claude-plugin/plugin.json +16 -0
  87. package/src/tools/codex/TOOL.yaml +5 -4
  88. package/src/tools/codex/commands/codex.md +18 -65
  89. package/src/tools/codex/skills/{droid-codex → codex}/SKILL.md +64 -45
  90. package/{dist/tools/codex/skills/droid-codex → src/tools/codex/skills/codex}/references/loading.md +94 -55
  91. package/src/tools/comments/.claude-plugin/plugin.json +16 -0
  92. package/src/tools/comments/TOOL.yaml +4 -3
  93. package/src/tools/comments/commands/comments.md +12 -14
  94. package/{dist/tools/comments/skills/droid-comments → src/tools/comments/skills/comments}/SKILL.md +4 -2
  95. package/src/tools/droid/.claude-plugin/plugin.json +15 -0
  96. package/src/tools/droid/TOOL.yaml +1 -1
  97. package/src/tools/droid/skills/droid/SKILL.md +1 -1
  98. package/src/tools/project/.claude-plugin/plugin.json +16 -0
  99. package/src/tools/project/TOOL.yaml +4 -3
  100. package/src/tools/project/commands/project.md +12 -27
  101. package/src/tools/project/skills/{droid-project → project}/SKILL.md +13 -12
  102. package/src/tools/tech-design/.claude-plugin/plugin.json +16 -0
  103. package/src/tools/tech-design/TOOL.yaml +19 -0
  104. package/src/tools/tech-design/commands/tech-design.md +31 -0
  105. package/src/tools/tech-design/skills/tech-design/SKILL.md +218 -0
  106. package/src/tools/tech-design/skills/tech-design/references/draft.md +321 -0
  107. package/src/tools/tech-design/skills/tech-design/references/gaps.md +328 -0
  108. package/src/tools/tech-design/skills/tech-design/references/publish.md +409 -0
  109. package/src/tools/tech-design/skills/tech-design/references/research-doc-template.md +129 -0
  110. package/src/tools/tech-design/skills/tech-design/references/rollup-template.md +55 -0
  111. package/src/tools/tech-design/skills/tech-design/references/start.md +353 -0
  112. package/src/tools/tech-design/skills/tech-design/references/think.md +356 -0
  113. package/src/tools/tech-design/skills/tech-design/references/thought-doc-template.md +72 -0
  114. package/dist/tools/code-review/skills/droid-code-review/SKILL.md +0 -55
  115. package/dist/tools/codex/skills/droid-codex/scripts/git-finish-write.d.ts.map +0 -1
  116. package/dist/tools/codex/skills/droid-codex/scripts/git-preamble.d.ts.map +0 -1
  117. package/dist/tools/codex/skills/droid-codex/scripts/git-start-write.d.ts.map +0 -1
  118. package/src/tools/code-review/skills/droid-code-review/SKILL.md +0 -55
  119. /package/dist/tools/brain/skills/{droid-brain → brain}/references/metadata.md +0 -0
  120. /package/dist/tools/brain/skills/{droid-brain → brain}/references/naming.md +0 -0
  121. /package/dist/tools/brain/skills/{droid-brain → brain}/references/templates.md +0 -0
  122. /package/dist/tools/brain/skills/{droid-brain → brain}/references/workflows.md +0 -0
  123. /package/dist/tools/brain/skills/{droid-brain-obsidian → brain-obsidian}/references/templates.md +0 -0
  124. /package/dist/tools/brain/skills/{droid-brain-obsidian → brain-obsidian}/references/workflows.md +0 -0
  125. /package/dist/tools/codex/skills/{droid-codex → codex}/references/creating.md +0 -0
  126. /package/dist/tools/codex/skills/{droid-codex → codex}/references/decisions.md +0 -0
  127. /package/dist/tools/codex/skills/{droid-codex → codex}/references/topics.md +0 -0
  128. /package/dist/tools/codex/skills/{droid-codex → codex}/scripts/git-finish-write.d.ts +0 -0
  129. /package/dist/tools/codex/skills/{droid-codex → codex}/scripts/git-finish-write.ts +0 -0
  130. /package/dist/tools/codex/skills/{droid-codex → codex}/scripts/git-preamble.d.ts +0 -0
  131. /package/dist/tools/codex/skills/{droid-codex → codex}/scripts/git-preamble.ts +0 -0
  132. /package/dist/tools/codex/skills/{droid-codex → codex}/scripts/git-scripts.test.ts +0 -0
  133. /package/dist/tools/codex/skills/{droid-codex → codex}/scripts/git-start-write.d.ts +0 -0
  134. /package/dist/tools/codex/skills/{droid-codex → codex}/scripts/git-start-write.ts +0 -0
  135. /package/dist/tools/project/skills/{droid-project → project}/references/changelog.md +0 -0
  136. /package/dist/tools/project/skills/{droid-project → project}/references/creating.md +0 -0
  137. /package/dist/tools/project/skills/{droid-project → project}/references/loading.md +0 -0
  138. /package/dist/tools/project/skills/{droid-project → project}/references/templates.md +0 -0
  139. /package/dist/tools/project/skills/{droid-project → project}/references/updating.md +0 -0
  140. /package/dist/tools/project/skills/{droid-project → project}/references/versioning.md +0 -0
  141. /package/src/tools/brain/skills/{droid-brain → brain}/references/metadata.md +0 -0
  142. /package/src/tools/brain/skills/{droid-brain → brain}/references/naming.md +0 -0
  143. /package/src/tools/brain/skills/{droid-brain → brain}/references/templates.md +0 -0
  144. /package/src/tools/brain/skills/{droid-brain → brain}/references/workflows.md +0 -0
  145. /package/src/tools/brain/skills/{droid-brain-obsidian → brain-obsidian}/references/templates.md +0 -0
  146. /package/src/tools/brain/skills/{droid-brain-obsidian → brain-obsidian}/references/workflows.md +0 -0
  147. /package/src/tools/codex/skills/{droid-codex → codex}/references/creating.md +0 -0
  148. /package/src/tools/codex/skills/{droid-codex → codex}/references/decisions.md +0 -0
  149. /package/src/tools/codex/skills/{droid-codex → codex}/references/topics.md +0 -0
  150. /package/src/tools/codex/skills/{droid-codex → codex}/scripts/git-finish-write.ts +0 -0
  151. /package/src/tools/codex/skills/{droid-codex → codex}/scripts/git-preamble.ts +0 -0
  152. /package/src/tools/codex/skills/{droid-codex → codex}/scripts/git-scripts.test.ts +0 -0
  153. /package/src/tools/codex/skills/{droid-codex → codex}/scripts/git-start-write.ts +0 -0
  154. /package/src/tools/project/skills/{droid-project → project}/references/changelog.md +0 -0
  155. /package/src/tools/project/skills/{droid-project → project}/references/creating.md +0 -0
  156. /package/src/tools/project/skills/{droid-project → project}/references/loading.md +0 -0
  157. /package/src/tools/project/skills/{droid-project → project}/references/templates.md +0 -0
  158. /package/src/tools/project/skills/{droid-project → project}/references/updating.md +0 -0
  159. /package/src/tools/project/skills/{droid-project → project}/references/versioning.md +0 -0
@@ -0,0 +1,353 @@
1
+ # Starting a Tech Design
2
+
3
+ **Trigger:** `/tech-design start --from codex:{project}` or user wants to start a new tech design
4
+
5
+ **Goal:** Create research doc + thought doc via brain skill. Deep dive into codex project and codebase, persist discoveries.
6
+
7
+ **Security Note:** All user-provided inputs (project names, section names, etc.) must be validated/sanitized before use in shell commands or file paths. Strip special characters and validate against expected patterns to prevent command injection and path traversal attacks.
8
+
9
+ ## Procedure
10
+
11
+ ### 1. Validate Prerequisites
12
+
13
+ Check that required tools are configured:
14
+
15
+ - **Brain skill:** Check if `~/.droid/skills/brain/overrides.yaml` exists
16
+ - **Codex skill:** Check if `~/.droid/skills/codex/overrides.yaml` exists
17
+
18
+ If prerequisites fail, guide user to configure:
19
+
20
+ - Brain missing: "Please set up brain first by running `/brain`"
21
+ - Codex missing: "Please set up codex first by running `/codex`"
22
+
23
+ ### 2. Load Codex Project Context
24
+
25
+ Use the codex skill to load project context:
26
+
27
+ ```
28
+ /codex project {projectName}
29
+ ```
30
+
31
+ The codex skill will:
32
+
33
+ - Find the project in the codex repository
34
+ - Load PRD.md, DESIGN.md, and other project files
35
+ - Return project context (or error if not found)
36
+
37
+ **If project not found:**
38
+
39
+ - Codex will warn: "⚠️ No project found for '{project}' in codex."
40
+ - Offer options:
41
+ 1. Create it with: `/codex new {project}`
42
+ 2. Start fresh without codex context
43
+ - Get user confirmation to continue
44
+
45
+ **If project found:**
46
+
47
+ - Extract key context for research doc:
48
+ - Problem statement (from PRD)
49
+ - Goals and scope
50
+ - UI/UX considerations (from DESIGN.md if present)
51
+ - Key constraints or requirements
52
+
53
+ ### 3. Create Research Doc via Brain Skill
54
+
55
+ Use the brain skill to create a research document:
56
+
57
+ ```
58
+ /brain research tech-design-{project}-research
59
+ ```
60
+
61
+ **Research doc template:**
62
+
63
+ ```markdown
64
+ # Research: {Project Name}
65
+
66
+ **Type:** research
67
+ **Status:** exploring
68
+ **Created:** {current date}
69
+ **PRD:** [[codex:projects/{project}/PRD]]
70
+
71
+ Research for tech design: {brief description from PRD}
72
+
73
+ ## Codex Context
74
+
75
+ {2-3 paragraph summary from step 2:}
76
+
77
+ - Problem statement
78
+ - Goals and scope
79
+ - Key requirements
80
+ - UI/UX considerations (if applicable)
81
+
82
+ ## Codebase Discoveries
83
+
84
+ {This section populated in step 4}
85
+
86
+ ## Key Findings
87
+
88
+ {Summary - populated after research complete}
89
+ ```
90
+
91
+ ### 4. Deep Dive into Codebase
92
+
93
+ Explore code repositories to discover patterns, similar features, integration points, and dependencies.
94
+
95
+ **Note:** The specific repositories to search should be discovered from the project context or user's workspace. Common patterns to look for:
96
+
97
+ - **Existing similar features:**
98
+ - Search for related functionality
99
+ - Note file paths and patterns used
100
+ - **Integration points:**
101
+ - Where will this feature connect to existing code?
102
+ - What modules/services will it interact with?
103
+ - **Dependencies:**
104
+ - What libraries/packages are relevant?
105
+ - What's already available in the codebase?
106
+ - **Technical patterns:**
107
+ - Architecture patterns (service layer, controllers, etc.)
108
+ - Data access patterns
109
+ - API patterns
110
+ - Testing patterns
111
+
112
+ **Populate research doc with findings:**
113
+
114
+ Update the "Codebase Discoveries" section with specific discoveries:
115
+
116
+ ```markdown
117
+ ## Codebase Discoveries
118
+
119
+ ### Existing Patterns
120
+
121
+ - Pattern: {Description}
122
+ - Found in: {file paths}
123
+ - How it works: {brief explanation}
124
+
125
+ ### Similar Implementations
126
+
127
+ - Feature: {Similar feature name}
128
+ - Location: {file paths}
129
+ - Relevant parts: {what to learn from it}
130
+
131
+ ### Integration Points
132
+
133
+ - Module/Service: {name}
134
+ - Location: {file path}
135
+ - How to integrate: {approach}
136
+
137
+ ### Dependencies
138
+
139
+ - Library: {name} - {already available / need to add}
140
+ - Purpose: {why needed}
141
+
142
+ ### Technical Stack Notes
143
+
144
+ {Framework-specific observations discovered during exploration}
145
+
146
+ - Architecture: {e.g., layered, modular, microservices}
147
+ - Patterns: {e.g., dependency injection, event-driven}
148
+ - Testing: {e.g., unit test setup, integration test patterns}
149
+ ```
150
+
151
+ ### 5. Create Thought Doc via Brain Skill
152
+
153
+ Use the brain skill to create the planning document:
154
+
155
+ ```
156
+ /brain plan tech-design-{project}
157
+ ```
158
+
159
+ **Thought doc template:**
160
+
161
+ ```markdown
162
+ # [Tech Design] {Project Name}
163
+
164
+ **Type:** plan
165
+ **Status:** exploring
166
+ **Created:** {current date}
167
+ **PRD:** [[codex:projects/{project}/PRD]]
168
+ **Research:** [[tech-design-{project}-research]]
169
+
170
+ Tech design for {project}.
171
+
172
+ ## Background
173
+
174
+ {2-3 paragraphs from PRD context:}
175
+
176
+ - What problem we're solving
177
+ - Who it's for and why it matters
178
+ - Key constraints or requirements
179
+
180
+ See research doc for codebase context and discovered patterns.
181
+
182
+ ## Proposal
183
+
184
+ {What we're building - to be drafted}
185
+
186
+ ## Open Questions
187
+
188
+ {What we don't know yet - to be explored}
189
+ ```
190
+
191
+ Set thought doc as active in brain's session tracking.
192
+
193
+ ### 6. Provide Links to User
194
+
195
+ After creating both docs, give the user the file paths:
196
+
197
+ ```
198
+ ✓ Research doc created: {full_path_to_research_doc}
199
+ ✓ Tech design created: {full_path_to_thought_doc}
200
+
201
+ Research doc includes:
202
+ • Codex project context from {project}
203
+ • Codebase discoveries: {count} patterns found, {count} integration points identified
204
+ • Technical stack notes
205
+
206
+ You can continue working on this with:
207
+ • /tech-design draft - Auto-generate sections from research
208
+ • /tech-design think {topic} - Explore specific ideas
209
+ • /brain add {text} - Quick additions to active doc
210
+ • /brain or /scratchpad - Work on either doc directly
211
+
212
+ What would you like to do next?
213
+ ```
214
+
215
+ ## Error Handling
216
+
217
+ - **Brain not configured:** "Brain skill not configured. Please run `/brain` to set up your brain directory first."
218
+ - **Codex not configured:** "Codex skill not configured. Please run `/codex` to set up your codex repository first."
219
+ - **PRD missing:** Offer to create via `/codex new {project}` or continue without context
220
+ - **Docs already exist:** "Tech design docs for '{project}' already exist. Open existing or create new?"
221
+ - **Codebase exploration fails:** Gracefully note what couldn't be found, continue with what's available
222
+
223
+ ## Example Output
224
+
225
+ ```
226
+ ✓ Loaded PRD context from codex:transaction-templates
227
+ ✓ Deep diving into codebase...
228
+
229
+ Research findings:
230
+ 📁 Found 3 similar patterns for template handling
231
+ 🔗 Identified 5 integration points (validation, storage, API)
232
+ 📦 Dependencies: 2 already available, 1 to add
233
+
234
+ ✓ Research doc created: {brain_dir}/0-Inbox/research/tech-design-transaction-templates-research.md
235
+ ✓ Tech design created: {brain_dir}/0-Inbox/plans/tech-design-transaction-templates.md
236
+
237
+ Research doc includes:
238
+ • Codex project context from transaction-templates
239
+ • Codebase discoveries: 3 patterns found, 5 integration points identified
240
+ • Technical stack notes
241
+
242
+ You can continue working on this with:
243
+ • /tech-design draft - Auto-generate sections from research
244
+ • /tech-design think {topic} - Explore specific ideas
245
+ • /brain add {text} - Quick additions to active doc
246
+ • /brain or /scratchpad - Work on either doc directly
247
+
248
+ What would you like to do next?
249
+ ```
250
+
251
+ The codex skill will:
252
+
253
+ - Find the project in the codex repository
254
+ - Load PRD.md, DESIGN.md, and other project files
255
+ - Return project context (or error if not found)
256
+
257
+ **If project not found:**
258
+
259
+ - Codex will warn: "⚠️ No project found for '{project}' in codex."
260
+ - Offer options:
261
+ 1. Create it with: `/codex new {project}`
262
+ 2. Start fresh without codex context
263
+ - Get user confirmation to continue
264
+
265
+ **If project found:**
266
+
267
+ - Extract key context from the codex response:
268
+ - Problem statement (from PRD)
269
+ - Goals and scope
270
+ - UI/UX considerations (from DESIGN.md if present)
271
+ - Key constraints or requirements
272
+
273
+ Create a concise summary (2-3 paragraphs) for the Background section.
274
+
275
+ ### 3. Create Thought Doc via Brain Skill
276
+
277
+ Use the brain skill to create the planning doc. This ensures the doc goes to the user's configured brain location.
278
+
279
+ **Template content to create:**
280
+
281
+ ```markdown
282
+ # [Tech Design] {Feature Name}
283
+
284
+ **Type:** plan
285
+ **Status:** exploring
286
+ **Created:** {current date YYYY-MM-DD}
287
+ **PRD:** [[codex:projects/{project}/PRD]]
288
+
289
+ Tech design for {project}.
290
+
291
+ ## Background
292
+
293
+ {Insert PRD/DESIGN summary from step 3, or leave empty if no context}
294
+
295
+ ## Proposal
296
+
297
+ {What we're building}
298
+
299
+ ## Open Questions
300
+
301
+ {What we don't know yet}
302
+ ```
303
+
304
+ **How to create via brain:**
305
+
306
+ - Use the brain skill's document creation logic (reads `brain_dir` and `inbox_folder` from brain's config)
307
+ - Create in the plans/ subfolder
308
+ - Filename: `tech-design-{project}.md`
309
+ - Populate Background section with codex context summary from step 2
310
+ - Set as active doc in brain's session tracking
311
+
312
+ ### 4. Provide Link to User
313
+
314
+ After creating the doc, give the user the file path:
315
+
316
+ ```
317
+ ✓ Tech design created: {full_path_to_doc}
318
+
319
+ {If PRD context was loaded:}
320
+ Background section populated with PRD context from codex:{project}
321
+
322
+ You can continue working on this with:
323
+ • /tech-design draft - Auto-generate full doc from codebase research
324
+ • /tech-design think {topic} - Explore specific sections or ideas
325
+ • /brain add {text} - Quick additions to active doc
326
+ • /brain or /scratchpad - Work on it directly
327
+
328
+ What would you like to do next?
329
+ ```
330
+
331
+ ## Error Handling
332
+
333
+ - **Brain not configured:** "Brain skill not configured. Please run `/brain` to set up your brain directory first."
334
+ - **Codex not configured:** "Codex skill not configured. Please run `/codex` to set up your codex repository first."
335
+ - **PRD missing:** Offer to create via `/codex new {project}` or continue without context
336
+ - **Thought doc already exists:** "A tech design for '{project}' already exists at {path}. Open existing or create new?"
337
+
338
+ ## Example Output
339
+
340
+ ```
341
+ ✓ Loaded PRD context from codex:transaction-templates
342
+ ✓ Tech design created: {brain_dir}/0-Inbox/plans/tech-design-transaction-templates.md
343
+
344
+ Background section populated with PRD context from codex:transaction-templates
345
+
346
+ You can continue working on this with:
347
+ • /tech-design draft - Auto-generate full doc from codebase research
348
+ • /tech-design think {topic} - Explore specific sections or ideas
349
+ • /brain add {text} - Quick additions to active doc
350
+ • /brain or /scratchpad - Work on it directly
351
+
352
+ What would you like to do next?
353
+ ```
@@ -0,0 +1,356 @@
1
+ # Thinking Through Ideas
2
+
3
+ **Trigger:** `/tech-design think [topic]` or user wants to explore an idea
4
+
5
+ **Goal:** Explore, stress-test, decide. Think before drafting. Often flows: think → decide → draft.
6
+
7
+ ## Think vs Draft
8
+
9
+ | Mode | Purpose | Output |
10
+ | --------- | ----------------------------------------------------- | ---------------------------------------------- |
11
+ | **Think** | Explore an idea, stress-test it, decide if it belongs | Discussion, possibly @{user} comment for later |
12
+ | **Draft** | Write content into the doc (whole doc or section) | Updates thought doc directly |
13
+
14
+ ## Procedure
15
+
16
+ ### 1. Determine Mode
17
+
18
+ ```bash
19
+ if [ -n "$topic" ]; then
20
+ # Directed or freeform based on topic type
21
+ if is_section_name "$topic"; then
22
+ mode="directed" # e.g., "rollout", "API design"
23
+ else
24
+ mode="freeform" # e.g., "Should we use events or polling?"
25
+ fi
26
+ else
27
+ # No args - scan for empty sections
28
+ mode="scan"
29
+ fi
30
+ ```
31
+
32
+ ### 2. Scan Mode (No Args)
33
+
34
+ **Scan thought doc for empty sections:**
35
+
36
+ ```bash
37
+ # Read thought doc
38
+ # Identify sections with no content (just headers)
39
+ # Pick the first important empty section
40
+
41
+ echo "I see these sections are empty:"
42
+ echo " • Data Model"
43
+ echo " • Rollout Plan"
44
+ echo " • Security Considerations"
45
+ echo ""
46
+ echo "Want to walk through Data Model? We can explore:"
47
+ echo " • What tables/schemas you need"
48
+ echo " • Relationships between entities"
49
+ echo " • Migration strategy"
50
+ ```
51
+
52
+ ### 3. Directed Mode (Topic is a Section)
53
+
54
+ **Questions focused on that section:**
55
+
56
+ #### Rollout
57
+
58
+ - Phased or big bang?
59
+ - Feature flags? Which service?
60
+ - What's the rollback strategy?
61
+ - How do we know it's working? (metrics)
62
+ - What's the blast radius if it fails?
63
+
64
+ ```
65
+ Let's think through the rollout plan.
66
+
67
+ ❓ Phased rollout or all at once?
68
+ Context: {Impact from PRD - who/what is affected}
69
+
70
+ ❓ Feature flags?
71
+ {Check research doc for feature flag setup discovered}
72
+ Should we add a flag for this feature?
73
+
74
+ ❓ Rollback strategy?
75
+ If things go wrong, how quickly can we revert?
76
+
77
+ ❓ Monitoring?
78
+ What metrics tell us it's healthy vs broken?
79
+ ```
80
+
81
+ #### Data Model
82
+
83
+ - What tables do we need?
84
+ - What are the relationships?
85
+ - How does this relate to existing schema?
86
+ - Migration strategy? (backfill needed?)
87
+ - Indexing considerations?
88
+
89
+ ```
90
+ Let's design the data model.
91
+
92
+ ❓ What entities do we need?
93
+ Based on the PRD, I'm thinking:
94
+ - {Entity 1}
95
+ - {Entity 2}
96
+ - {Entity 3}
97
+
98
+ ❓ Relationships?
99
+ {Entity} (1) → (many) {Related}?
100
+ Or keep it simple with just one table?
101
+
102
+ ❓ Existing schema?
103
+ {Check research doc for existing tables/entities discovered}
104
+ How does this relate to what's already there?
105
+
106
+ ❓ Indexes?
107
+ What queries will be hot? What lookups are critical?
108
+ ```
109
+
110
+ #### API Surface
111
+
112
+ - Who calls this API?
113
+ - What data do they need?
114
+ - Rate limiting concerns?
115
+ - Versioning strategy?
116
+ - Error responses?
117
+
118
+ ```
119
+ Let's think through the API design.
120
+
121
+ ❓ Who's calling this?
122
+ Internal services? External clients? Both?
123
+
124
+ ❓ What data do they actually need?
125
+ The PRD mentions {feature} - what specifically?
126
+
127
+ ❓ Rate limits?
128
+ {Check research doc for rate limiting patterns discovered}
129
+ What's appropriate for this endpoint?
130
+
131
+ ❓ Versioning?
132
+ /v1/{resource} or /{resource}?
133
+ Room to evolve later?
134
+ ```
135
+
136
+ #### Security
137
+
138
+ - Input validation?
139
+ - Authentication? Authorization?
140
+ - Data sensitivity?
141
+ - Audit logging?
142
+ - Rate limiting / DoS protection?
143
+
144
+ ```
145
+ Let's think through security.
146
+
147
+ ❓ Input validation?
148
+ User-provided {data} - what's the attack surface?
149
+ SQL injection? Script injection? File upload risks?
150
+
151
+ ❓ Who can access/modify this?
152
+ Just internal admins? End users too?
153
+ What's the authorization model?
154
+
155
+ ❓ Sensitive data?
156
+ {Check research doc for auth/security patterns discovered}
157
+ Does this contain PII, credentials, or business-critical data?
158
+ Encryption needed?
159
+
160
+ ❓ Audit trail?
161
+ Should we log who created/modified/accessed this?
162
+ ```
163
+
164
+ ### 4. Freeform Mode (Open-Ended Question)
165
+
166
+ **Stress-test the specific idea:**
167
+
168
+ Example: "Should we use events or polling for status updates?"
169
+
170
+ ```
171
+ Let's explore: events vs polling for status updates
172
+
173
+ ❓ What triggers the status update?
174
+ Is it a state change in the system?
175
+ Or external webhook?
176
+
177
+ ❓ What data needs to be in the event?
178
+ Just "status changed" or full state snapshot?
179
+
180
+ ❓ Who consumes these updates?
181
+ One service? Multiple? External partners?
182
+
183
+ ❓ Failure modes?
184
+ If event delivery fails, what happens?
185
+ Can we replay? Do we need exactly-once delivery?
186
+
187
+ ❓ Performance?
188
+ How many status updates/sec do we expect?
189
+ Is polling's latency acceptable?
190
+
191
+ ❓ Existing patterns?
192
+ {Check research doc for event/messaging patterns discovered}
193
+ Would this fit those patterns?
194
+
195
+ Based on your answers:
196
+ ✓ Events: If low-latency, many consumers, or triggering workflows
197
+ ✓ Polling: If simpler, external consumers, or status changes infrequent
198
+ ```
199
+
200
+ ### 5. Capture Exploration
201
+
202
+ **After exploration, ask where to put it:**
203
+
204
+ ```
205
+ Good discussion! How should I capture this?
206
+
207
+ 1. Add to thought doc now
208
+ → Write to appropriate section (or Open Questions if undecided)
209
+
210
+ 2. Keep in chat
211
+ → You can reference it later if needed
212
+
213
+ 3. Create @{user} comment in thought doc
214
+ → Leaves a marker for you to review later
215
+
216
+ Which would you prefer?
217
+ ```
218
+
219
+ **If option 1 (add to doc):**
220
+
221
+ ```bash
222
+ # Write to appropriate section
223
+ # If decision made: add to Proposal or Key Decisions
224
+ # If still exploring: add to Open Questions with context
225
+ ```
226
+
227
+ **If option 3 (create comment):**
228
+
229
+ ```bash
230
+ # Read user_mention from ~/.droid/config.yaml
231
+ # Add comment to thought doc:
232
+
233
+ > @{user} Explored events vs polling for status updates
234
+ >
235
+ > Key considerations:
236
+ > - Latency requirement: <100ms
237
+ > - Multiple consumers: dashboard, webhooks, alerts
238
+ > - Volume: ~1000 updates/day
239
+ >
240
+ > Recommendation: Events using existing event-emitter pattern
241
+ > Rationale: Low latency needed, multiple consumers, fits existing architecture
242
+ >
243
+ > Next step: Draft this into Proposal section?
244
+ ```
245
+
246
+ ## Cross-Platform Approach
247
+
248
+ **Use prose-based questioning** - works on OpenCode + Claude Code:
249
+
250
+ ```
251
+ # Instead of:
252
+ Select an option: [Events | Polling | Hybrid]
253
+
254
+ # Use:
255
+ What's your latency requirement?
256
+ (e.g., "under 100ms", "a few seconds is fine", "real-time")
257
+ ```
258
+
259
+ **Response patterns to watch for:**
260
+
261
+ - "real-time" / "immediate" → suggests events
262
+ - "eventually" / "doesn't matter" → suggests polling
263
+ - "multiple consumers" → suggests pub/sub events
264
+ - "simple" / "straightforward" → suggests polling
265
+
266
+ ## Example Output (Directed)
267
+
268
+ ```
269
+ Let's think through the rollout plan.
270
+
271
+ ❓ Phased rollout or all at once?
272
+ Context: {Impact from PRD - scale, users affected, risk level}
273
+
274
+ > User: Let's do phased - this is risky
275
+
276
+ ❓ Feature flags?
277
+ {Check research doc for feature flag system discovered}. Should we add `{feature-name}` flag?
278
+
279
+ > User: Yes, good idea
280
+
281
+ ❓ What phases make sense?
282
+ 10% → 50% → 100%? Or something else?
283
+
284
+ > User: Let's do 10% for a week, then 50%, then 100%
285
+
286
+ ❓ Rollback strategy?
287
+ If validation starts failing, how quickly can we revert?
288
+
289
+ > User: Just toggle the flag off. Should be instant.
290
+
291
+ ❓ Monitoring?
292
+ What metrics tell us it's healthy vs broken?
293
+
294
+ > User: Error rate, success rate, latency
295
+
296
+ ✓ Got it! Summary:
297
+ • 3-phase rollout: 10% (1 week) → 50% (1 week) → 100%
298
+ • Feature flag: `{feature-name}` ({system from research doc})
299
+ • Rollback: Toggle flag off, <1 min to take effect
300
+ • Monitoring: error rate, success rate, p95 latency
301
+
302
+ How should I capture this?
303
+ 1. Add to Rollout Plan section now
304
+ 2. Keep in chat
305
+ 3. Create @{user} comment to review later
306
+ ```
307
+
308
+ ## Example Output (Freeform)
309
+
310
+ ```
311
+ Let's explore: events vs polling for status updates
312
+
313
+ ❓ What triggers the status update?
314
+
315
+ > User: When a transaction moves to "completed" or "failed"
316
+
317
+ ❓ Who needs to know?
318
+ One service? Multiple? External partners?
319
+
320
+ > User: Our dashboard, partner webhooks, and internal alerting
321
+
322
+ ❓ How many status updates per day?
323
+
324
+ > User: About 10,000 - roughly 10/min steady state, spikes to 100/min
325
+
326
+ ❓ Latency requirement?
327
+
328
+ > User: Dashboard should update within a few seconds. Webhooks can be delayed a bit.
329
+
330
+ ❓ Existing patterns?
331
+ {Check research doc for event/messaging patterns discovered}
332
+
333
+ > User: Yeah, we use {pattern} for internal events
334
+
335
+ ✓ Analysis:
336
+ Events are a better fit:
337
+ ✓ Multiple consumers (dashboard, webhooks, alerts)
338
+ ✓ Moderate volume (10-100/min) - well within event system capacity
339
+ ✓ Fits existing architecture ({pattern from research doc})
340
+ ✓ Low latency for dashboard (few seconds acceptable)
341
+
342
+ Implementation:
343
+ • Emit `{feature}.{event}` event
344
+ • Dashboard subscribes via {mechanism from research}
345
+ • Webhooks subscribe and batch deliver
346
+ • Alerts subscribe for failures only
347
+
348
+ Should I add this to the Proposal section?
349
+ ```
350
+
351
+ ## Error Handling
352
+
353
+ - **Thought doc not found:** Remind user to run `/tech-design start` first
354
+ - **Empty thought doc:** Suggest running `/tech-design draft` first to have context
355
+ - **User gives terse answers:** Ask follow-up questions to dig deeper
356
+ - **User says "I don't know":** Offer to research codebase or flag as Open Question