@mindfoldhq/trellis 0.6.0-beta.7 → 0.6.0-beta.8

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 (58) hide show
  1. package/dist/configurators/codex.d.ts.map +1 -1
  2. package/dist/configurators/codex.js +5 -3
  3. package/dist/configurators/codex.js.map +1 -1
  4. package/dist/configurators/shared.js +4 -4
  5. package/dist/configurators/shared.js.map +1 -1
  6. package/dist/migrations/manifests/0.6.0-beta.8.json +9 -0
  7. package/dist/templates/claude/agents/trellis-check.md +2 -2
  8. package/dist/templates/claude/agents/trellis-implement.md +8 -7
  9. package/dist/templates/codebuddy/agents/trellis-check.md +2 -2
  10. package/dist/templates/codebuddy/agents/trellis-implement.md +8 -7
  11. package/dist/templates/codex/agents/trellis-check.toml +4 -4
  12. package/dist/templates/codex/agents/trellis-implement.toml +4 -4
  13. package/dist/templates/codex/hooks/session-start.py +183 -119
  14. package/dist/templates/codex/skills/before-dev/SKILL.md +12 -6
  15. package/dist/templates/codex/skills/brainstorm/SKILL.md +113 -51
  16. package/dist/templates/codex/skills/check/SKILL.md +86 -18
  17. package/dist/templates/codex/skills/start/SKILL.md +33 -323
  18. package/dist/templates/common/bundled-skills/trellis-meta/references/customize-local/change-context-loading.md +7 -4
  19. package/dist/templates/common/bundled-skills/trellis-meta/references/customize-local/change-spec-structure.md +1 -1
  20. package/dist/templates/common/bundled-skills/trellis-meta/references/customize-local/change-workflow.md +3 -2
  21. package/dist/templates/common/bundled-skills/trellis-meta/references/local-architecture/context-injection.md +5 -5
  22. package/dist/templates/common/bundled-skills/trellis-meta/references/local-architecture/spec-system.md +1 -1
  23. package/dist/templates/common/bundled-skills/trellis-meta/references/local-architecture/task-system.md +8 -6
  24. package/dist/templates/common/bundled-skills/trellis-meta/references/platform-files/agents.md +5 -4
  25. package/dist/templates/common/commands/continue.md +6 -5
  26. package/dist/templates/common/commands/start.md +7 -6
  27. package/dist/templates/common/skills/before-dev.md +12 -6
  28. package/dist/templates/common/skills/brainstorm.md +56 -42
  29. package/dist/templates/common/skills/check.md +7 -1
  30. package/dist/templates/copilot/hooks/session-start.py +183 -90
  31. package/dist/templates/copilot/prompts/before-dev.prompt.md +12 -6
  32. package/dist/templates/copilot/prompts/brainstorm.prompt.md +146 -84
  33. package/dist/templates/copilot/prompts/check.prompt.md +86 -18
  34. package/dist/templates/copilot/prompts/parallel.prompt.md +16 -8
  35. package/dist/templates/copilot/prompts/start.prompt.md +33 -367
  36. package/dist/templates/cursor/agents/trellis-check.md +2 -2
  37. package/dist/templates/cursor/agents/trellis-implement.md +8 -7
  38. package/dist/templates/droid/droids/trellis-check.md +2 -2
  39. package/dist/templates/droid/droids/trellis-implement.md +8 -7
  40. package/dist/templates/gemini/agents/trellis-implement.md +7 -6
  41. package/dist/templates/kiro/agents/trellis-check.json +1 -1
  42. package/dist/templates/kiro/agents/trellis-implement.json +1 -1
  43. package/dist/templates/opencode/agents/trellis-check.md +2 -2
  44. package/dist/templates/opencode/agents/trellis-implement.md +9 -8
  45. package/dist/templates/opencode/lib/session-utils.js +212 -123
  46. package/dist/templates/opencode/plugins/inject-subagent-context.js +23 -7
  47. package/dist/templates/opencode/plugins/inject-workflow-state.js +1 -4
  48. package/dist/templates/pi/extensions/trellis/index.ts.txt +7 -5
  49. package/dist/templates/qoder/agents/trellis-implement.md +7 -6
  50. package/dist/templates/shared-hooks/inject-subagent-context.py +36 -14
  51. package/dist/templates/shared-hooks/inject-workflow-state.py +18 -42
  52. package/dist/templates/shared-hooks/session-start.py +197 -163
  53. package/dist/templates/trellis/scripts/common/task_context.py +3 -3
  54. package/dist/templates/trellis/scripts/common/task_store.py +39 -7
  55. package/dist/templates/trellis/scripts/common/workflow_phase.py +7 -10
  56. package/dist/templates/trellis/scripts/task.py +3 -3
  57. package/dist/templates/trellis/workflow.md +98 -98
  58. package/package.json +1 -1
@@ -17,13 +17,13 @@ Guide AI through collaborative requirements discovery **before implementation**,
17
17
  * **Task-first** (capture ideas immediately)
18
18
  * **Action-before-asking** (reduce low-value questions)
19
19
  * **Research-first** for technical choices (avoid asking users to invent options)
20
- * **Diverge �?Converge** (expand thinking, then lock MVP)
20
+ * **Diverge Converge** (expand thinking, then lock MVP)
21
21
 
22
22
  ---
23
23
 
24
24
  ## When to Use
25
25
 
26
- Triggered from `/` when the user describes a development task, especially when:
26
+ Triggered from {{CMD_REF:start}} when the user describes a development task, especially when:
27
27
 
28
28
  * requirements are unclear or evolving
29
29
  * there are multiple valid implementation paths
@@ -38,19 +38,19 @@ Triggered from `/` when the user describes a development task, especially when:
38
38
  Always ensure a task exists at the start so the user's ideas are recorded immediately.
39
39
 
40
40
  2. **Action before asking**
41
- If you can derive the answer from repo code, docs, configs, conventions, or quick research �?do that first.
41
+ If you can derive the answer from repo code, docs, configs, conventions, or quick research do that first.
42
42
 
43
43
  3. **One question per message**
44
44
  Never overwhelm the user with a list of questions. Ask one, update PRD, repeat.
45
45
 
46
46
  4. **Prefer concrete options**
47
- For preference/decision questions, present 2�? feasible, specific approaches with trade-offs.
47
+ For preference/decision questions, present 2–3 feasible, specific approaches with trade-offs.
48
48
 
49
49
  5. **Research-first for technical choices**
50
50
  If the decision depends on industry conventions / similar tools / established patterns, do research first, then propose options.
51
51
 
52
- 6. **Diverge �?Converge**
53
- After initial understanding, proactively consider future evolution, related scenarios, and failure/edge cases �?then converge to an MVP with explicit out-of-scope.
52
+ 6. **Diverge Converge**
53
+ After initial understanding, proactively consider future evolution, related scenarios, and failure/edge cases then converge to an MVP with explicit out-of-scope.
54
54
 
55
55
  7. **No meta questions**
56
56
  Do not ask "should I search?" or "can you paste the code so I can continue?"
@@ -63,13 +63,16 @@ Triggered from `/` when the user describes a development task, especially when:
63
63
  Before any Q&A, ensure a task exists. If none exists, create one immediately.
64
64
 
65
65
  * Use a **temporary working title** derived from the user's message.
66
- * It's OK if the title is imperfect �?refine later in PRD.
66
+ * It's OK if the title is imperfect refine later in PRD.
67
67
 
68
68
  ```bash
69
69
  TASK_DIR=$(python3 ./.trellis/scripts/task.py create "brainstorm: <short goal>" --slug <auto>)
70
70
  ```
71
71
 
72
- Create/seed `prd.md` immediately with what you know:
72
+ Use a slug without a date prefix. `task.py create` adds the `MM-DD-`
73
+ directory prefix automatically.
74
+
75
+ `task.py create` already created a default `prd.md`. Immediately update it with what you know:
73
76
 
74
77
  ```markdown
75
78
  # brainstorm: <short goal>
@@ -78,7 +81,7 @@ Create/seed `prd.md` immediately with what you know:
78
81
 
79
82
  <one paragraph: what + why>
80
83
 
81
- ## What I already know
84
+ ## Background / Known Context
82
85
 
83
86
  * <facts from user message>
84
87
  * <facts discovered from repo/docs>
@@ -91,11 +94,11 @@ Create/seed `prd.md` immediately with what you know:
91
94
 
92
95
  * <ONLY Blocking / Preference questions; keep list short>
93
96
 
94
- ## Requirements (evolving)
97
+ ## Requirements
95
98
 
96
99
  * <start with what is known>
97
100
 
98
- ## Acceptance Criteria (evolving)
101
+ ## Acceptance Criteria
99
102
 
100
103
  * [ ] <testable criterion>
101
104
 
@@ -110,10 +113,39 @@ Create/seed `prd.md` immediately with what you know:
110
113
 
111
114
  * <what we will not do in this task>
112
115
 
113
- ## Technical Notes
116
+ ## Research References
117
+
118
+ * <links to research/*.md or external references>
119
+ ```
120
+
121
+ For complex tasks, also create/update:
114
122
 
115
- * <files inspected, constraints, links, references>
116
- * <research notes summary if applicable>
123
+ ```markdown
124
+ # design.md
125
+
126
+ ## Technical Design
127
+
128
+ <boundaries, contracts, data flow, compatibility, tradeoffs>
129
+
130
+ ## Rollout / Rollback
131
+
132
+ <operational notes if relevant>
133
+ ```
134
+
135
+ ```markdown
136
+ # implement.md
137
+
138
+ ## Implementation Checklist
139
+
140
+ - [ ] <ordered implementation step>
141
+
142
+ ## Validation
143
+
144
+ - <lint/typecheck/test command>
145
+
146
+ ## Review Gates
147
+
148
+ - <human or technical checkpoint before start/finish>
117
149
  ```
118
150
 
119
151
  ---
@@ -136,8 +168,8 @@ Before asking questions like "what does the code look like?", gather context you
136
168
 
137
169
  Write findings into PRD:
138
170
 
139
- * Add to `What I already know`
140
- * Add constraints/links to `Technical Notes`
171
+ * Add user-visible facts to `Background / Known Context`
172
+ * Write technical findings to `research/*.md`, `design.md`, or `implement.md` as appropriate
141
173
 
142
174
  ---
143
175
 
@@ -146,8 +178,8 @@ Write findings into PRD:
146
178
  | Complexity | Criteria | Action |
147
179
  | ------------ | ------------------------------------------------------ | ------------------------------------------- |
148
180
  | **Trivial** | Single-line fix, typo, obvious change | Skip brainstorm, implement directly |
149
- | **Simple** | Clear goal, 1�? files, scope well-defined | Ask 1 confirm question, then implement |
150
- | **Moderate** | Multiple files, some ambiguity | Light brainstorm (2�? high-value questions) |
181
+ | **Simple** | Clear goal, 1–2 files, scope well-defined | Ask 1 confirm question, then implement |
182
+ | **Moderate** | Multiple files, some ambiguity | Light brainstorm (2–3 high-value questions) |
151
183
  | **Complex** | Vague goal, architectural choices, multiple approaches | Full brainstorm |
152
184
 
153
185
  > Note: Task already exists from Step 0. Classification only affects depth of brainstorming.
@@ -158,7 +190,7 @@ Write findings into PRD:
158
190
 
159
191
  Before asking ANY question, run the following gate:
160
192
 
161
- ### Gate A �?Can I derive this without the user?
193
+ ### Gate A Can I derive this without the user?
162
194
 
163
195
  If answer is available via:
164
196
 
@@ -166,9 +198,9 @@ If answer is available via:
166
198
  * docs/specs/conventions
167
199
  * quick market/OSS research
168
200
 
169
- �?**Do not ask.** Fetch it, summarize, update PRD.
201
+ → **Do not ask.** Fetch it, summarize, update PRD.
170
202
 
171
- ### Gate B �?Is this a meta/lazy question?
203
+ ### Gate B Is this a meta/lazy question?
172
204
 
173
205
  Examples:
174
206
 
@@ -176,38 +208,83 @@ Examples:
176
208
  * "Can you paste the code so I can proceed?"
177
209
  * "What does the code look like?" (when repo is available)
178
210
 
179
- �?**Do not ask.** Take action.
211
+ → **Do not ask.** Take action.
180
212
 
181
- ### Gate C �?What type of question is it?
213
+ ### Gate C What type of question is it?
182
214
 
183
215
  * **Blocking**: cannot proceed without user input
184
216
  * **Preference**: multiple valid choices, depends on product/UX/risk preference
185
217
  * **Derivable**: should be answered by inspection/research
186
218
 
187
- �?Only ask **Blocking** or **Preference**.
219
+ Only ask **Blocking** or **Preference**.
188
220
 
189
221
  ---
190
222
 
191
223
  ## Step 4: Research-first Mode (Mandatory for technical choices)
192
224
 
193
- ### Trigger conditions (any �?research-first)
225
+ ### Trigger conditions (any research-first)
194
226
 
195
227
  * The task involves selecting an approach, library, protocol, framework, template system, plugin mechanism, or CLI UX convention
196
228
  * The user asks for "best practice", "how others do it", "recommendation"
197
229
  * The user can't reasonably enumerate options
198
230
 
199
- ### Research steps
231
+ ### Delegate to `trellis-research` sub-agent (don't research inline)
232
+
233
+ For each research topic, **spawn a `trellis-research` sub-agent via the Task tool** — don't do WebFetch / WebSearch / `gh api` inline in the main conversation.
234
+
235
+ Why:
236
+ - The sub-agent has its own context window → doesn't pollute brainstorm context with raw tool output
237
+ - It persists findings to `{TASK_DIR}/research/<topic>.md` (the contract — see `workflow.md` Phase 1.2)
238
+ - It returns only `{file path, one-line summary}` to the main agent
239
+ - Independent topics can be **parallelized** — spawn multiple sub-agents in one tool call
240
+
241
+ > **Codex exception**: on Codex CLI, do NOT dispatch `trellis-research` for research-first mode — do the research inline (WebFetch / WebSearch in the main session) and write findings to `{TASK_DIR}/research/<topic>.md` yourself. Reason: Codex `spawn_agent` runs sub-agents with `fork_turns="none"` (isolated context, no parent session inheritance), so the research sub-agent cannot resolve the active task path via `task.py current` and silently aborts without producing files. Inline research on Codex avoids this failure mode. The 3+ inline research calls limit (B rule in `workflow.md`) is relaxed for Codex specifically.
200
242
 
201
- 1. Identify 2�? comparable tools/patterns
243
+ Agent type: `trellis-research`
244
+ Task description template: "Research <specific question>; persist findings to `{TASK_DIR}/research/<topic-slug>.md`."
245
+
246
+ ❌ Bad (what you must NOT do):
247
+ ```
248
+ Main agent: WebFetch(url-A) → WebFetch(url-B) → Bash(gh api ...)
249
+ → WebSearch(q1) → WebSearch(q2) → ... (10+ inline calls)
250
+ → Write(research/topic.md)
251
+ ```
252
+ → Pollutes main context with raw HTML/JSON, burns tokens.
253
+
254
+ ✅ Good:
255
+ ```
256
+ Main agent: Task(subagent_type="trellis-research",
257
+ prompt="Research topic A; persist to research/topic-a.md")
258
+ + Task(subagent_type="trellis-research",
259
+ prompt="Research topic B; persist to research/topic-b.md")
260
+ + Task(subagent_type="trellis-research",
261
+ prompt="Research topic C; persist to research/topic-c.md")
262
+ → Reads research/topic-{a,b,c}.md after they finish.
263
+ ```
264
+
265
+ ### Research steps (to pass into each sub-agent prompt)
266
+
267
+ Each `trellis-research` sub-agent should:
268
+
269
+ 1. Identify 2–4 comparable tools/patterns for its topic
202
270
  2. Summarize common conventions and why they exist
203
271
  3. Map conventions onto our repo constraints
204
- 4. Produce **2�? feasible approaches** for our project
272
+ 4. Write findings to `{TASK_DIR}/research/<topic>.md`
273
+
274
+ Main agent then reads the persisted files and produces **2–3 feasible approaches** in PRD.
205
275
 
206
276
  ### Research output format (PRD)
207
277
 
208
- Add a section in PRD (either within Technical Notes or as its own):
278
+ The PRD itself should only reference the persisted research files, not duplicate their content. Add a `## Research References` section pointing at `research/*.md`.
279
+
280
+ Optionally, add a convergence section with feasible approaches derived from the research:
209
281
 
210
282
  ```markdown
283
+ ## Research References
284
+
285
+ * [`research/<topic-a>.md`](research/<topic-a>.md) — <one-line takeaway>
286
+ * [`research/<topic-b>.md`](research/<topic-b>.md) — <one-line takeaway>
287
+
211
288
  ## Research Notes
212
289
 
213
290
  ### What similar tools do
@@ -244,15 +321,15 @@ Then ask **one** preference question:
244
321
 
245
322
  ---
246
323
 
247
- ## Step 5: Expansion Sweep (DIVERGE) �?Required after initial understanding
324
+ ## Step 5: Expansion Sweep (DIVERGE) Required after initial understanding
248
325
 
249
326
  After you can summarize the goal, proactively broaden thinking before converging.
250
327
 
251
- ### Expansion categories (keep to 1�? bullets each)
328
+ ### Expansion categories (keep to 1–2 bullets each)
252
329
 
253
330
  1. **Future evolution**
254
331
 
255
- * What might this feature become in 1�? months?
332
+ * What might this feature become in 1–3 months?
256
333
  * What extension points are worth preserving now?
257
334
 
258
335
  2. **Related scenarios**
@@ -272,9 +349,9 @@ I understand you want to implement: <current goal>.
272
349
 
273
350
  Before diving into design, let me quickly diverge to consider three categories (to avoid rework later):
274
351
 
275
- 1. Future evolution: <1�? bullets>
276
- 2. Related scenarios: <1�? bullets>
277
- 3. Failure/edge cases: <1�? bullets>
352
+ 1. Future evolution: <1–2 bullets>
353
+ 2. Related scenarios: <1–2 bullets>
354
+ 3. Failure/edge cases: <1–2 bullets>
278
355
 
279
356
  For this MVP, which would you like to include (or none)?
280
357
 
@@ -286,8 +363,8 @@ For this MVP, which would you like to include (or none)?
286
363
 
287
364
  Then update PRD:
288
365
 
289
- * What's in MVP �?`Requirements`
290
- * What's excluded �?`Out of Scope`
366
+ * What's in MVP → `Requirements`
367
+ * What's excluded → `Out of Scope`
291
368
 
292
369
  ---
293
370
 
@@ -300,7 +377,7 @@ Then update PRD:
300
377
  * After each user answer:
301
378
 
302
379
  * Update PRD immediately
303
- * Move answered items from `Open Questions` �?`Requirements`
380
+ * Move answered items from `Open Questions` → `Requirements`
304
381
  * Update `Acceptance Criteria` with testable checkboxes
305
382
  * Clarify `Out of Scope`
306
383
 
@@ -316,20 +393,20 @@ Then update PRD:
316
393
  ```markdown
317
394
  For <topic>, which approach do you prefer?
318
395
 
319
- 1. **Option A** �?<what it means + trade-off>
320
- 2. **Option B** �?<what it means + trade-off>
321
- 3. **Option C** �?<what it means + trade-off>
322
- 4. **Other** �?describe your preference
396
+ 1. **Option A** — <what it means + trade-off>
397
+ 2. **Option B** — <what it means + trade-off>
398
+ 3. **Option C** — <what it means + trade-off>
399
+ 4. **Other** describe your preference
323
400
  ```
324
401
 
325
402
  ---
326
403
 
327
404
  ## Step 7: Propose Approaches + Record Decisions (Complex tasks)
328
405
 
329
- After requirements are clear enough, propose 2�? approaches (if not already done via research-first):
406
+ After requirements are clear enough, propose 2–3 approaches (if not already done via research-first):
330
407
 
331
408
  ```markdown
332
- Based on current information, here are 2�? feasible approaches:
409
+ Based on current information, here are 2–3 feasible approaches:
333
410
 
334
411
  **Approach A: <name>** (Recommended)
335
412
 
@@ -358,7 +435,7 @@ Record the outcome in PRD as an ADR-lite section:
358
435
 
359
436
  ---
360
437
 
361
- ## Step 8: Final Confirmation + Implementation Plan
438
+ ## Step 8: Final Confirmation + Planning Artifacts
362
439
 
363
440
  When open questions are resolved, confirm complete requirements with a structured summary:
364
441
 
@@ -387,16 +464,13 @@ Here's my understanding of the complete requirements:
387
464
 
388
465
  * ...
389
466
 
390
- **Technical Approach**:
391
- <brief summary + key decisions>
392
-
393
- **Implementation Plan (small PRs)**:
467
+ **Artifact status**:
394
468
 
395
- * PR1: <scaffolding + tests + minimal plumbing>
396
- * PR2: <core behavior>
397
- * PR3: <edge cases + docs + cleanup>
469
+ * prd.md: <ready / needs update>
470
+ * design.md: <not needed for lightweight / ready / missing>
471
+ * implement.md: <not needed for lightweight / ready / missing>
398
472
 
399
- Does this look correct? If yes, I'll proceed with implementation.
473
+ Does this look correct? If yes, the next step is planning review before `task.py start`.
400
474
  ```
401
475
 
402
476
  ### Subtask Decomposition (Complex Tasks)
@@ -433,25 +507,13 @@ python3 ./.trellis/scripts/task.py add-subtask "$TASK_DIR" "$CHILD_DIR"
433
507
 
434
508
  * [ ] ...
435
509
 
436
- ## Definition of Done
437
-
438
- * ...
439
-
440
- ## Technical Approach
441
-
442
- <key design + decisions>
443
-
444
- ## Decision (ADR-lite)
445
-
446
- Context / Decision / Consequences
447
-
448
510
  ## Out of Scope
449
511
 
450
512
  * ...
451
513
 
452
- ## Technical Notes
514
+ ## Research References
453
515
 
454
- <constraints, references, files, research notes>
516
+ * <links to research/*.md or external references>
455
517
  ```
456
518
 
457
519
  ---
@@ -468,25 +530,25 @@ Context / Decision / Consequences
468
530
 
469
531
  ## Integration with Start Workflow
470
532
 
471
- After brainstorm completes (Step 8 confirmation approved), the flow continues to the Task Workflow's **Phase 2: Prepare for Implementation**:
533
+ After brainstorm completes (Step 8 confirmation approved), the flow continues to the Task Workflow planning review gate:
472
534
 
473
535
  ```text
474
536
  Brainstorm
475
- Step 0: Create task directory + seed PRD
476
- Step 1�?: Discover requirements, research, converge
477
- Step 8: Final confirmation �?user approves
478
- �?
479
- Task Workflow Phase 2 (Prepare for Implementation)
480
- Code-Spec Depth Check (if applicable)
481
- �?Research codebase (based on confirmed PRD)
482
- �?Configure code-spec context (jsonl files)
483
- �?Activate task
484
- �?
485
- Task Workflow Phase 3 (Execute)
486
- Implement �?Check �?Complete
537
+ Step 0: Create task directory + update PRD
538
+ Step 1–7: Discover requirements, research, converge
539
+ Step 8: Final confirmation user approves planning artifacts
540
+
541
+ Task Workflow Phase 1 (Plan)
542
+ Lightweight task → PRD-only may be enough
543
+ Complex task design.md + implement.md required
544
+ Sub-agent platforms → curate implement.jsonl / check.jsonl manifests
545
+ Review gate → task.py start
546
+
547
+ Task Workflow Phase 2 (Execute)
548
+ Implement Check Complete
487
549
  ```
488
550
 
489
- The task directory and PRD already exist from brainstorm, so Phase 1 of the Task Workflow is skipped entirely.
551
+ The task directory and PRD already exist from brainstorm, but Phase 1 is not skipped; it owns artifact review and the `task.py start` gate.
490
552
 
491
553
  ---
492
554
 
@@ -494,6 +556,6 @@ The task directory and PRD already exist from brainstorm, so Phase 1 of the Task
494
556
 
495
557
  | Command | When to Use |
496
558
  |---------|-------------|
497
- | `/` | Entry point that triggers brainstorm |
498
- | `/` | After implementation is complete |
499
- | `/` | If new patterns emerge during work |
559
+ | `{{CMD_REF:start}}` | Entry point that triggers brainstorm |
560
+ | `{{CMD_REF:finish-work}}` | After implementation is complete |
561
+ | `{{CMD_REF:update-spec}}` | If new patterns emerge during work |
@@ -2,28 +2,96 @@
2
2
  description: "Trellis Copilot prompt: check.prompt"
3
3
  ---
4
4
 
5
- Check if the code you just wrote follows the development guidelines.
5
+ # Code Quality Check
6
6
 
7
- Execute these steps:
7
+ Comprehensive quality verification for recently written code. Combines spec compliance, cross-layer safety, and pre-commit checks.
8
8
 
9
- 1. **Identify changed files**:
10
- ```bash
11
- git diff --name-only HEAD
12
- ```
9
+ ---
10
+
11
+ ## Step 1: Identify What Changed
12
+
13
+ ```bash
14
+ git diff --name-only HEAD
15
+ git status
16
+ ```
17
+
18
+ ## Step 2: Read Task Artifacts and Applicable Specs
19
+
20
+ Read the current task artifacts in order:
21
+
22
+ - `prd.md`
23
+ - `design.md` if present
24
+ - `implement.md` if present
25
+
26
+ ```bash
27
+ python3 ./.trellis/scripts/get_context.py --mode packages
28
+ ```
29
+
30
+ For each changed package/layer, read the spec index and follow its **Quality Check** section:
31
+
32
+ ```bash
33
+ cat .trellis/spec/<package>/<layer>/index.md
34
+ ```
35
+
36
+ Read the specific guideline files referenced — the index is a pointer, not the goal.
37
+
38
+ ## Step 3: Run Project Checks
39
+
40
+ Run the project's lint, type-check, and test commands. Fix any failures before proceeding.
41
+
42
+ ## Step 4: Review Against Checklist
43
+
44
+ ### Code Quality
45
+
46
+ - [ ] Linter passes?
47
+ - [ ] Type checker passes (if applicable)?
48
+ - [ ] Tests pass?
49
+ - [ ] No debug logging left in?
50
+ - [ ] No suppressed warnings or type-safety bypasses?
13
51
 
14
- 2. **Determine which spec modules apply** based on the changed file paths:
15
- ```bash
16
- python3 ./.trellis/scripts/get_context.py --mode packages
17
- ```
52
+ ### Test Coverage
18
53
 
19
- 3. **Read the spec index** for each relevant module:
20
- ```bash
21
- cat .trellis/spec/<package>/<layer>/index.md
22
- ```
23
- Follow the **"Quality Check"** section in the index.
54
+ - [ ] New function unit test added?
55
+ - [ ] Bug fix → regression test added?
56
+ - [ ] Changed behavior → existing tests updated?
24
57
 
25
- 4. **Read the specific guideline files** referenced in the Quality Check section (e.g., `quality-guidelines.md`, `conventions.md`). The index is NOT the goal �?it points you to the actual guideline files. Read those files and review your code against them.
58
+ ### Spec Sync
59
+
60
+ - [ ] Does `.trellis/spec/` need updates? (new patterns, conventions, lessons learned)
61
+
62
+ > "If I fixed a bug or discovered something non-obvious, should I document it so future me won't hit the same issue?" → If YES, update the relevant spec doc.
63
+
64
+ ## Step 5: Cross-Layer Dimensions (if applicable)
65
+
66
+ Skip this step if your change is confined to a single layer.
67
+
68
+ ### A. Data Flow (changes touch 3+ layers)
69
+
70
+ - [ ] Read flow traces correctly: Storage → Service → API → UI
71
+ - [ ] Write flow traces correctly: UI → API → Service → Storage
72
+ - [ ] Types/schemas correctly passed between layers?
73
+ - [ ] Errors properly propagated to caller?
74
+
75
+ ### B. Code Reuse (modifying constants, creating utilities)
76
+
77
+ - [ ] Searched for existing similar code before creating new?
78
+ ```bash
79
+ grep -r "pattern" src/
80
+ ```
81
+ - [ ] If 2+ places define same value → extracted to shared constant?
82
+ - [ ] After batch modification, all occurrences updated?
83
+
84
+ ### C. Import/Dependency (creating new files)
85
+
86
+ - [ ] Correct import paths (relative vs absolute)?
87
+ - [ ] No circular dependencies?
88
+
89
+ ### D. Same-Layer Consistency
90
+
91
+ - [ ] Other places using the same concept are consistent?
92
+
93
+ ---
26
94
 
27
- 5. **Run lint and typecheck** for the affected package.
95
+ ## Step 6: Report and Fix
28
96
 
29
- 6. **Report any violations** and fix them if found.
97
+ Report violations found and fix them directly. Re-run project checks after fixes.
@@ -122,18 +122,26 @@ python3 ./.trellis/scripts/task.py add-context "$TASK_DIR" implement "<path>" "<
122
122
  python3 ./.trellis/scripts/task.py add-context "$TASK_DIR" check "<path>" "<reason>"
123
123
  ```
124
124
 
125
- #### Step 4: Create prd.md
125
+ #### Step 4: Update prd.md
126
126
 
127
127
  ```bash
128
- cat > "$TASK_DIR/prd.md" << 'EOF'
128
+ # task.py create already created prd.md; edit it with requirements and acceptance criteria.
129
+ $EDITOR "$TASK_DIR/prd.md"
130
+ ```
131
+
132
+ Use this shape:
133
+
134
+ ```markdown
129
135
  # Feature: <name>
130
136
 
137
+ ## Goal
138
+ ...
139
+
131
140
  ## Requirements
132
141
  - ...
133
142
 
134
143
  ## Acceptance Criteria
135
- - ...
136
- EOF
144
+ - [ ] ...
137
145
  ```
138
146
 
139
147
  #### Step 5: Validate and Start
@@ -181,10 +189,10 @@ python3 ./.trellis/scripts/multi_agent/cleanup.py <branch> # Cleanup wo
181
189
 
182
190
  The dispatch agent in worktree will automatically execute:
183
191
 
184
- 1. implement �?Implement feature
185
- 2. check �?Check code quality
186
- 3. finish �?Final verification
187
- 4. create-pr �?Create PR
192
+ 1. implement �?Implement feature
193
+ 2. check �?Check code quality
194
+ 3. finish �?Final verification
195
+ 4. create-pr �?Create PR
188
196
 
189
197
  ---
190
198