@mindfoldhq/trellis 0.4.0-beta.9 → 0.4.0-rc.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (56) hide show
  1. package/README.md +3 -3
  2. package/dist/cli/index.js +1 -0
  3. package/dist/cli/index.js.map +1 -1
  4. package/dist/commands/init.d.ts +1 -0
  5. package/dist/commands/init.d.ts.map +1 -1
  6. package/dist/commands/init.js +132 -4
  7. package/dist/commands/init.js.map +1 -1
  8. package/dist/commands/update.d.ts.map +1 -1
  9. package/dist/commands/update.js +14 -2
  10. package/dist/commands/update.js.map +1 -1
  11. package/dist/configurators/droid.d.ts +5 -0
  12. package/dist/configurators/droid.d.ts.map +1 -0
  13. package/dist/configurators/droid.js +48 -0
  14. package/dist/configurators/droid.js.map +1 -0
  15. package/dist/configurators/index.d.ts.map +1 -1
  16. package/dist/configurators/index.js +13 -0
  17. package/dist/configurators/index.js.map +1 -1
  18. package/dist/migrations/manifests/0.4.0-beta.10.json +9 -0
  19. package/dist/migrations/manifests/0.4.0-rc.0.json +9 -0
  20. package/dist/migrations/manifests/0.4.0-rc.1.json +9 -0
  21. package/dist/templates/claude/hooks/ralph-loop.py +10 -9
  22. package/dist/templates/claude/hooks/session-start.py +29 -12
  23. package/dist/templates/claude/hooks/statusline.py +7 -0
  24. package/dist/templates/codex/hooks/session-start.py +29 -14
  25. package/dist/templates/copilot/hooks/session-start.py +29 -4
  26. package/dist/templates/droid/commands/trellis/before-dev.md +33 -0
  27. package/dist/templates/droid/commands/trellis/brainstorm.md +491 -0
  28. package/dist/templates/droid/commands/trellis/break-loop.md +111 -0
  29. package/dist/templates/droid/commands/trellis/check-cross-layer.md +157 -0
  30. package/dist/templates/droid/commands/trellis/check.md +29 -0
  31. package/dist/templates/droid/commands/trellis/create-command.md +158 -0
  32. package/dist/templates/droid/commands/trellis/finish-work.md +147 -0
  33. package/dist/templates/droid/commands/trellis/integrate-skill.md +223 -0
  34. package/dist/templates/droid/commands/trellis/onboard.md +362 -0
  35. package/dist/templates/droid/commands/trellis/record-session.md +66 -0
  36. package/dist/templates/droid/commands/trellis/start.md +377 -0
  37. package/dist/templates/droid/commands/trellis/update-spec.md +358 -0
  38. package/dist/templates/droid/index.d.ts +27 -0
  39. package/dist/templates/droid/index.d.ts.map +1 -0
  40. package/dist/templates/droid/index.js +47 -0
  41. package/dist/templates/droid/index.js.map +1 -0
  42. package/dist/templates/extract.d.ts +11 -0
  43. package/dist/templates/extract.d.ts.map +1 -1
  44. package/dist/templates/extract.js +19 -0
  45. package/dist/templates/extract.js.map +1 -1
  46. package/dist/templates/iflow/hooks/session-start.py +29 -12
  47. package/dist/templates/opencode/lib/trellis-context.js +4 -248
  48. package/dist/templates/opencode/plugins/inject-subagent-context.js +71 -121
  49. package/dist/templates/opencode/plugins/session-start.js +143 -119
  50. package/dist/templates/trellis/scripts/common/cli_adapter.py +27 -2
  51. package/dist/templates/trellis/workflow.md +17 -4
  52. package/dist/types/ai-tools.d.ts +3 -3
  53. package/dist/types/ai-tools.d.ts.map +1 -1
  54. package/dist/types/ai-tools.js +9 -1
  55. package/dist/types/ai-tools.js.map +1 -1
  56. package/package.json +1 -1
@@ -125,6 +125,32 @@ def _get_task_status(trellis_dir: Path) -> str:
125
125
  return f"Status: READY\nTask: {task_title}\nNext: Continue with implement or check"
126
126
 
127
127
 
128
+ def _build_workflow_toc(workflow_path: Path) -> str:
129
+ """Build a compact section index for workflow.md (lazy-load the full file on demand).
130
+
131
+ Replaces full-file injection to keep additionalContext payload small.
132
+ The full file is accessible via: Read tool on .trellis/workflow.md
133
+ """
134
+ content = read_file(workflow_path)
135
+ if not content:
136
+ return "No workflow.md found"
137
+
138
+ toc_lines = [
139
+ "# Development Workflow — Section Index",
140
+ "Full guide: .trellis/workflow.md (read on demand)",
141
+ "",
142
+ ]
143
+ for line in content.splitlines():
144
+ if line.startswith("## "):
145
+ toc_lines.append(line)
146
+
147
+ toc_lines += [
148
+ "",
149
+ "To read a section: use the Read tool on .trellis/workflow.md",
150
+ ]
151
+ return "\n".join(toc_lines)
152
+
153
+
128
154
  def main() -> None:
129
155
  if should_skip_injection():
130
156
  sys.exit(0)
@@ -137,7 +163,6 @@ def main() -> None:
137
163
  project_dir = Path(".").resolve()
138
164
 
139
165
  trellis_dir = project_dir / ".trellis"
140
- codex_dir = project_dir / ".codex"
141
166
 
142
167
  output = StringIO()
143
168
 
@@ -154,8 +179,7 @@ Read and follow all instructions below carefully.
154
179
  output.write("\n</current-state>\n\n")
155
180
 
156
181
  output.write("<workflow>\n")
157
- workflow_content = read_file(trellis_dir / "workflow.md", "No workflow.md found")
158
- output.write(workflow_content)
182
+ output.write(_build_workflow_toc(trellis_dir / "workflow.md"))
159
183
  output.write("\n</workflow>\n\n")
160
184
 
161
185
  output.write("<guidelines>\n")
@@ -193,21 +217,12 @@ Read and follow all instructions below carefully.
193
217
 
194
218
  output.write("</guidelines>\n\n")
195
219
 
196
- # Inject start skill as instructions (Codex uses skills, not slash commands)
197
- start_skill = codex_dir / "skills" / "start" / "SKILL.md"
198
- if not start_skill.is_file():
199
- start_skill = project_dir / ".agents" / "skills" / "start" / "SKILL.md"
200
- if start_skill.is_file():
201
- output.write("<instructions>\n")
202
- output.write(read_file(start_skill))
203
- output.write("\n</instructions>\n\n")
204
-
205
220
  task_status = _get_task_status(trellis_dir)
206
221
  output.write(f"<task-status>\n{task_status}\n</task-status>\n\n")
207
222
 
208
223
  output.write("""<ready>
209
- Context loaded. Steps 1-3 (workflow, context, guidelines) are already injected above — do NOT re-read them.
210
- Start from Step 4. Wait for user's first message, then follow <instructions> to handle their request.
224
+ Context loaded. Workflow index, project state, and guidelines are already injected above — do NOT re-read them.
225
+ Wait for the user's first message, then handle it following the workflow guide.
211
226
  If there is an active task, ask whether to continue it.
212
227
  </ready>""")
213
228
 
@@ -125,6 +125,32 @@ def _get_task_status(trellis_dir: Path) -> str:
125
125
  return f"Status: READY\nTask: {task_title}\nNext: Continue with implement or check"
126
126
 
127
127
 
128
+ def _build_workflow_toc(workflow_path: Path) -> str:
129
+ """Build a compact section index for workflow.md (lazy-load the full file on demand).
130
+
131
+ Replaces full-file injection to keep additionalContext payload small.
132
+ The full file is accessible via: Read tool on .trellis/workflow.md
133
+ """
134
+ content = read_file(workflow_path)
135
+ if not content:
136
+ return "No workflow.md found"
137
+
138
+ toc_lines = [
139
+ "# Development Workflow — Section Index",
140
+ "Full guide: .trellis/workflow.md (read on demand)",
141
+ "",
142
+ ]
143
+ for line in content.splitlines():
144
+ if line.startswith("## "):
145
+ toc_lines.append(line)
146
+
147
+ toc_lines += [
148
+ "",
149
+ "To read a section: use the Read tool on .trellis/workflow.md",
150
+ ]
151
+ return "\n".join(toc_lines)
152
+
153
+
128
154
  def main() -> None:
129
155
  if should_skip_injection():
130
156
  sys.exit(0)
@@ -153,8 +179,7 @@ Read and follow all instructions below carefully.
153
179
  output.write("\n</current-state>\n\n")
154
180
 
155
181
  output.write("<workflow>\n")
156
- workflow_content = read_file(trellis_dir / "workflow.md", "No workflow.md found")
157
- output.write(workflow_content)
182
+ output.write(_build_workflow_toc(trellis_dir / "workflow.md"))
158
183
  output.write("\n</workflow>\n\n")
159
184
 
160
185
  output.write("<guidelines>\n")
@@ -196,8 +221,8 @@ Read and follow all instructions below carefully.
196
221
  output.write(f"<task-status>\n{task_status}\n</task-status>\n\n")
197
222
 
198
223
  output.write("""<ready>
199
- Context loaded. Steps 1-3 (workflow, context, guidelines) are already injected above — do NOT re-read them.
200
- Start from Step 4. Wait for user's first message, then follow the workflow to handle their request.
224
+ Context loaded. Workflow index, project state, and guidelines are already injected above — do NOT re-read them.
225
+ Wait for the user's first message, then handle it following the workflow guide.
201
226
  If there is an active task, ask whether to continue it.
202
227
  </ready>""")
203
228
 
@@ -0,0 +1,33 @@
1
+ ---
2
+ description: Read the relevant development guidelines before starting your task
3
+ ---
4
+
5
+ Read the relevant development guidelines before starting your task.
6
+
7
+ Execute these steps:
8
+
9
+ 1. **Discover packages and their spec layers**:
10
+ ```bash
11
+ python3 ./.trellis/scripts/get_context.py --mode packages
12
+ ```
13
+
14
+ 2. **Identify which specs apply** to your task based on:
15
+ - Which package you're modifying (e.g., `cli/`, `docs-site/`)
16
+ - What type of work (backend, frontend, unit-test, docs, etc.)
17
+
18
+ 3. **Read the spec index** for each relevant module:
19
+ ```bash
20
+ cat .trellis/spec/<package>/<layer>/index.md
21
+ ```
22
+ Follow the **"Pre-Development Checklist"** section in the index.
23
+
24
+ 4. **Read the specific guideline files** listed in the Pre-Development Checklist that are relevant to your task. The index is NOT the goal — it points you to the actual guideline files (e.g., `error-handling.md`, `conventions.md`, `mock-strategies.md`). Read those files to understand the coding standards and patterns.
25
+
26
+ 5. **Always read shared guides**:
27
+ ```bash
28
+ cat .trellis/spec/guides/index.md
29
+ ```
30
+
31
+ 6. Understand the coding standards and patterns you need to follow, then proceed with your development plan.
32
+
33
+ This step is **mandatory** before writing any code.
@@ -0,0 +1,491 @@
1
+ ---
2
+ description: Collaborative requirements discovery before implementation
3
+ ---
4
+
5
+ # Brainstorm - Requirements Discovery (AI Coding Enhanced)
6
+
7
+ Guide AI through collaborative requirements discovery **before implementation**, optimized for AI coding workflows:
8
+
9
+ * **Task-first** (capture ideas immediately)
10
+ * **Action-before-asking** (reduce low-value questions)
11
+ * **Research-first** for technical choices (avoid asking users to invent options)
12
+ * **Diverge → Converge** (expand thinking, then lock MVP)
13
+
14
+ ---
15
+
16
+ ## When to Use
17
+
18
+ Triggered from `/trellis-start` when the user describes a development task, especially when:
19
+
20
+ * requirements are unclear or evolving
21
+ * there are multiple valid implementation paths
22
+ * trade-offs matter (UX, reliability, maintainability, cost, performance)
23
+ * the user might not know the best options up front
24
+
25
+ ---
26
+
27
+ ## Core Principles (Non-negotiable)
28
+
29
+ 1. **Task-first (capture early)**
30
+ Always ensure a task exists at the start so the user's ideas are recorded immediately.
31
+
32
+ 2. **Action before asking**
33
+ If you can derive the answer from repo code, docs, configs, conventions, or quick research — do that first.
34
+
35
+ 3. **One question per message**
36
+ Never overwhelm the user with a list of questions. Ask one, update PRD, repeat.
37
+
38
+ 4. **Prefer concrete options**
39
+ For preference/decision questions, present 2–3 feasible, specific approaches with trade-offs.
40
+
41
+ 5. **Research-first for technical choices**
42
+ If the decision depends on industry conventions / similar tools / established patterns, do research first, then propose options.
43
+
44
+ 6. **Diverge → Converge**
45
+ After initial understanding, proactively consider future evolution, related scenarios, and failure/edge cases — then converge to an MVP with explicit out-of-scope.
46
+
47
+ 7. **No meta questions**
48
+ Do not ask "should I search?" or "can you paste the code so I can continue?"
49
+ If you need information: search/inspect. If blocked: ask the minimal blocking question.
50
+
51
+ ---
52
+
53
+ ## Step 0: Ensure Task Exists (ALWAYS)
54
+
55
+ Before any Q&A, ensure a task exists. If none exists, create one immediately.
56
+
57
+ * Use a **temporary working title** derived from the user's message.
58
+ * It's OK if the title is imperfect — refine later in PRD.
59
+
60
+ ```bash
61
+ TASK_DIR=$(python3 ./.trellis/scripts/task.py create "brainstorm: <short goal>" --slug <auto>)
62
+ ```
63
+
64
+ Create/seed `prd.md` immediately with what you know:
65
+
66
+ ```markdown
67
+ # brainstorm: <short goal>
68
+
69
+ ## Goal
70
+
71
+ <one paragraph: what + why>
72
+
73
+ ## What I already know
74
+
75
+ * <facts from user message>
76
+ * <facts discovered from repo/docs>
77
+
78
+ ## Assumptions (temporary)
79
+
80
+ * <assumptions to validate>
81
+
82
+ ## Open Questions
83
+
84
+ * <ONLY Blocking / Preference questions; keep list short>
85
+
86
+ ## Requirements (evolving)
87
+
88
+ * <start with what is known>
89
+
90
+ ## Acceptance Criteria (evolving)
91
+
92
+ * [ ] <testable criterion>
93
+
94
+ ## Definition of Done (team quality bar)
95
+
96
+ * Tests added/updated (unit/integration where appropriate)
97
+ * Lint / typecheck / CI green
98
+ * Docs/notes updated if behavior changes
99
+ * Rollout/rollback considered if risky
100
+
101
+ ## Out of Scope (explicit)
102
+
103
+ * <what we will not do in this task>
104
+
105
+ ## Technical Notes
106
+
107
+ * <files inspected, constraints, links, references>
108
+ * <research notes summary if applicable>
109
+ ```
110
+
111
+ ---
112
+
113
+ ## Step 1: Auto-Context (DO THIS BEFORE ASKING QUESTIONS)
114
+
115
+ Before asking questions like "what does the code look like?", gather context yourself:
116
+
117
+ ### Repo inspection checklist
118
+
119
+ * Identify likely modules/files impacted
120
+ * Locate existing patterns (similar features, conventions, error handling style)
121
+ * Check configs, scripts, existing command definitions
122
+ * Note any constraints (runtime, dependency policy, build tooling)
123
+
124
+ ### Documentation checklist
125
+
126
+ * Look for existing PRDs/specs/templates
127
+ * Look for command usage examples, README, ADRs if any
128
+
129
+ Write findings into PRD:
130
+
131
+ * Add to `What I already know`
132
+ * Add constraints/links to `Technical Notes`
133
+
134
+ ---
135
+
136
+ ## Step 2: Classify Complexity (still useful, not gating task creation)
137
+
138
+ | Complexity | Criteria | Action |
139
+ | ------------ | ------------------------------------------------------ | ------------------------------------------- |
140
+ | **Trivial** | Single-line fix, typo, obvious change | Skip brainstorm, implement directly |
141
+ | **Simple** | Clear goal, 1–2 files, scope well-defined | Ask 1 confirm question, then implement |
142
+ | **Moderate** | Multiple files, some ambiguity | Light brainstorm (2–3 high-value questions) |
143
+ | **Complex** | Vague goal, architectural choices, multiple approaches | Full brainstorm |
144
+
145
+ > Note: Task already exists from Step 0. Classification only affects depth of brainstorming.
146
+
147
+ ---
148
+
149
+ ## Step 3: Question Gate (Ask ONLY high-value questions)
150
+
151
+ Before asking ANY question, run the following gate:
152
+
153
+ ### Gate A — Can I derive this without the user?
154
+
155
+ If answer is available via:
156
+
157
+ * repo inspection (code/config)
158
+ * docs/specs/conventions
159
+ * quick market/OSS research
160
+
161
+ → **Do not ask.** Fetch it, summarize, update PRD.
162
+
163
+ ### Gate B — Is this a meta/lazy question?
164
+
165
+ Examples:
166
+
167
+ * "Should I search?"
168
+ * "Can you paste the code so I can proceed?"
169
+ * "What does the code look like?" (when repo is available)
170
+
171
+ → **Do not ask.** Take action.
172
+
173
+ ### Gate C — What type of question is it?
174
+
175
+ * **Blocking**: cannot proceed without user input
176
+ * **Preference**: multiple valid choices, depends on product/UX/risk preference
177
+ * **Derivable**: should be answered by inspection/research
178
+
179
+ → Only ask **Blocking** or **Preference**.
180
+
181
+ ---
182
+
183
+ ## Step 4: Research-first Mode (Mandatory for technical choices)
184
+
185
+ ### Trigger conditions (any → research-first)
186
+
187
+ * The task involves selecting an approach, library, protocol, framework, template system, plugin mechanism, or CLI UX convention
188
+ * The user asks for "best practice", "how others do it", "recommendation"
189
+ * The user can't reasonably enumerate options
190
+
191
+ ### Research steps
192
+
193
+ 1. Identify 2–4 comparable tools/patterns
194
+ 2. Summarize common conventions and why they exist
195
+ 3. Map conventions onto our repo constraints
196
+ 4. Produce **2–3 feasible approaches** for our project
197
+
198
+ ### Research output format (PRD)
199
+
200
+ Add a section in PRD (either within Technical Notes or as its own):
201
+
202
+ ```markdown
203
+ ## Research Notes
204
+
205
+ ### What similar tools do
206
+
207
+ * ...
208
+ * ...
209
+
210
+ ### Constraints from our repo/project
211
+
212
+ * ...
213
+
214
+ ### Feasible approaches here
215
+
216
+ **Approach A: <name>** (Recommended)
217
+
218
+ * How it works:
219
+ * Pros:
220
+ * Cons:
221
+
222
+ **Approach B: <name>**
223
+
224
+ * How it works:
225
+ * Pros:
226
+ * Cons:
227
+
228
+ **Approach C: <name>** (optional)
229
+
230
+ * ...
231
+ ```
232
+
233
+ Then ask **one** preference question:
234
+
235
+ * "Which approach do you prefer: A / B / C (or other)?"
236
+
237
+ ---
238
+
239
+ ## Step 5: Expansion Sweep (DIVERGE) — Required after initial understanding
240
+
241
+ After you can summarize the goal, proactively broaden thinking before converging.
242
+
243
+ ### Expansion categories (keep to 1–2 bullets each)
244
+
245
+ 1. **Future evolution**
246
+
247
+ * What might this feature become in 1–3 months?
248
+ * What extension points are worth preserving now?
249
+
250
+ 2. **Related scenarios**
251
+
252
+ * What adjacent commands/flows should remain consistent with this?
253
+ * Are there parity expectations (create vs update, import vs export, etc.)?
254
+
255
+ 3. **Failure & edge cases**
256
+
257
+ * Conflicts, offline/network failure, retries, idempotency, compatibility, rollback
258
+ * Input validation, security boundaries, permission checks
259
+
260
+ ### Expansion message template (to user)
261
+
262
+ ```markdown
263
+ I understand you want to implement: <current goal>.
264
+
265
+ Before diving into design, let me quickly diverge to consider three categories (to avoid rework later):
266
+
267
+ 1. Future evolution: <1–2 bullets>
268
+ 2. Related scenarios: <1–2 bullets>
269
+ 3. Failure/edge cases: <1–2 bullets>
270
+
271
+ For this MVP, which would you like to include (or none)?
272
+
273
+ 1. Current requirement only (minimal viable)
274
+ 2. Add <X> (reserve for future extension)
275
+ 3. Add <Y> (improve robustness/consistency)
276
+ 4. Other: describe your preference
277
+ ```
278
+
279
+ Then update PRD:
280
+
281
+ * What's in MVP → `Requirements`
282
+ * What's excluded → `Out of Scope`
283
+
284
+ ---
285
+
286
+ ## Step 6: Q&A Loop (CONVERGE)
287
+
288
+ ### Rules
289
+
290
+ * One question per message
291
+ * Prefer multiple-choice when possible
292
+ * After each user answer:
293
+
294
+ * Update PRD immediately
295
+ * Move answered items from `Open Questions` → `Requirements`
296
+ * Update `Acceptance Criteria` with testable checkboxes
297
+ * Clarify `Out of Scope`
298
+
299
+ ### Question priority (recommended)
300
+
301
+ 1. **MVP scope boundary** (what is included/excluded)
302
+ 2. **Preference decisions** (after presenting concrete options)
303
+ 3. **Failure/edge behavior** (only for MVP-critical paths)
304
+ 4. **Success metrics & Acceptance Criteria** (what proves it works)
305
+
306
+ ### Preferred question format (multiple choice)
307
+
308
+ ```markdown
309
+ For <topic>, which approach do you prefer?
310
+
311
+ 1. **Option A** — <what it means + trade-off>
312
+ 2. **Option B** — <what it means + trade-off>
313
+ 3. **Option C** — <what it means + trade-off>
314
+ 4. **Other** — describe your preference
315
+ ```
316
+
317
+ ---
318
+
319
+ ## Step 7: Propose Approaches + Record Decisions (Complex tasks)
320
+
321
+ After requirements are clear enough, propose 2–3 approaches (if not already done via research-first):
322
+
323
+ ```markdown
324
+ Based on current information, here are 2–3 feasible approaches:
325
+
326
+ **Approach A: <name>** (Recommended)
327
+
328
+ * How:
329
+ * Pros:
330
+ * Cons:
331
+
332
+ **Approach B: <name>**
333
+
334
+ * How:
335
+ * Pros:
336
+ * Cons:
337
+
338
+ Which direction do you prefer?
339
+ ```
340
+
341
+ Record the outcome in PRD as an ADR-lite section:
342
+
343
+ ```markdown
344
+ ## Decision (ADR-lite)
345
+
346
+ **Context**: Why this decision was needed
347
+ **Decision**: Which approach was chosen
348
+ **Consequences**: Trade-offs, risks, potential future improvements
349
+ ```
350
+
351
+ ---
352
+
353
+ ## Step 8: Final Confirmation + Implementation Plan
354
+
355
+ When open questions are resolved, confirm complete requirements with a structured summary:
356
+
357
+ ### Final confirmation format
358
+
359
+ ```markdown
360
+ Here's my understanding of the complete requirements:
361
+
362
+ **Goal**: <one sentence>
363
+
364
+ **Requirements**:
365
+
366
+ * ...
367
+ * ...
368
+
369
+ **Acceptance Criteria**:
370
+
371
+ * [ ] ...
372
+ * [ ] ...
373
+
374
+ **Definition of Done**:
375
+
376
+ * ...
377
+
378
+ **Out of Scope**:
379
+
380
+ * ...
381
+
382
+ **Technical Approach**:
383
+ <brief summary + key decisions>
384
+
385
+ **Implementation Plan (small PRs)**:
386
+
387
+ * PR1: <scaffolding + tests + minimal plumbing>
388
+ * PR2: <core behavior>
389
+ * PR3: <edge cases + docs + cleanup>
390
+
391
+ Does this look correct? If yes, I'll proceed with implementation.
392
+ ```
393
+
394
+ ### Subtask Decomposition (Complex Tasks)
395
+
396
+ For complex tasks with multiple independent work items, create subtasks:
397
+
398
+ ```bash
399
+ # Create child tasks
400
+ CHILD1=$(python3 ./.trellis/scripts/task.py create "Child task 1" --slug child1 --parent "$TASK_DIR")
401
+ CHILD2=$(python3 ./.trellis/scripts/task.py create "Child task 2" --slug child2 --parent "$TASK_DIR")
402
+
403
+ # Or link existing tasks
404
+ python3 ./.trellis/scripts/task.py add-subtask "$TASK_DIR" "$CHILD_DIR"
405
+ ```
406
+
407
+ ---
408
+
409
+ ## PRD Target Structure (final)
410
+
411
+ `prd.md` should converge to:
412
+
413
+ ```markdown
414
+ # <Task Title>
415
+
416
+ ## Goal
417
+
418
+ <why + what>
419
+
420
+ ## Requirements
421
+
422
+ * ...
423
+
424
+ ## Acceptance Criteria
425
+
426
+ * [ ] ...
427
+
428
+ ## Definition of Done
429
+
430
+ * ...
431
+
432
+ ## Technical Approach
433
+
434
+ <key design + decisions>
435
+
436
+ ## Decision (ADR-lite)
437
+
438
+ Context / Decision / Consequences
439
+
440
+ ## Out of Scope
441
+
442
+ * ...
443
+
444
+ ## Technical Notes
445
+
446
+ <constraints, references, files, research notes>
447
+ ```
448
+
449
+ ---
450
+
451
+ ## Anti-Patterns (Hard Avoid)
452
+
453
+ * Asking user for code/context that can be derived from repo
454
+ * Asking user to choose an approach before presenting concrete options
455
+ * Meta questions about whether to research
456
+ * Staying narrowly on the initial request without considering evolution/edges
457
+ * Letting brainstorming drift without updating PRD
458
+
459
+ ---
460
+
461
+ ## Integration with Start Workflow
462
+
463
+ After brainstorm completes (Step 8 confirmation approved), the flow continues to the Task Workflow's **Phase 2: Prepare for Implementation**:
464
+
465
+ ```text
466
+ Brainstorm
467
+ Step 0: Create task directory + seed PRD
468
+ Step 1–7: Discover requirements, research, converge
469
+ Step 8: Final confirmation → user approves
470
+
471
+ Task Workflow Phase 2 (Prepare for Implementation)
472
+ Code-Spec Depth Check (if applicable)
473
+ → Research codebase (based on confirmed PRD)
474
+ → Configure code-spec context (jsonl files)
475
+ → Activate task
476
+
477
+ Task Workflow Phase 3 (Execute)
478
+ Implement → Check → Complete
479
+ ```
480
+
481
+ The task directory and PRD already exist from brainstorm, so Phase 1 of the Task Workflow is skipped entirely.
482
+
483
+ ---
484
+
485
+ ## Related Commands
486
+
487
+ | Command | When to Use |
488
+ |---------|-------------|
489
+ | `/trellis-start` | Entry point that triggers brainstorm |
490
+ | `/trellis-finish-work` | After implementation is complete |
491
+ | `/trellis-update-spec` | If new patterns emerge during work |