@mindfoldhq/trellis 0.3.5 → 0.3.7

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 (65) hide show
  1. package/README.md +17 -4
  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 +243 -49
  7. package/dist/commands/init.js.map +1 -1
  8. package/dist/commands/update.d.ts +12 -0
  9. package/dist/commands/update.d.ts.map +1 -1
  10. package/dist/commands/update.js +92 -2
  11. package/dist/commands/update.js.map +1 -1
  12. package/dist/migrations/index.d.ts.map +1 -1
  13. package/dist/migrations/index.js +3 -1
  14. package/dist/migrations/index.js.map +1 -1
  15. package/dist/migrations/manifests/0.3.6.json +9 -0
  16. package/dist/migrations/manifests/0.3.7.json +9 -0
  17. package/dist/templates/claude/commands/trellis/brainstorm.md +13 -0
  18. package/dist/templates/claude/commands/trellis/record-session.md +4 -1
  19. package/dist/templates/claude/commands/trellis/start.md +20 -4
  20. package/dist/templates/claude/hooks/inject-subagent-context.py +1 -1
  21. package/dist/templates/claude/hooks/session-start.py +86 -23
  22. package/dist/templates/claude/settings.json +10 -0
  23. package/dist/templates/codex/skills/brainstorm/SKILL.md +13 -0
  24. package/dist/templates/codex/skills/record-session/SKILL.md +4 -1
  25. package/dist/templates/codex/skills/start/SKILL.md +20 -4
  26. package/dist/templates/cursor/commands/trellis-brainstorm.md +13 -0
  27. package/dist/templates/cursor/commands/trellis-record-session.md +4 -1
  28. package/dist/templates/cursor/commands/trellis-start.md +20 -4
  29. package/dist/templates/gemini/commands/trellis/brainstorm.toml +15 -0
  30. package/dist/templates/gemini/commands/trellis/record-session.toml +4 -1
  31. package/dist/templates/gemini/commands/trellis/start.toml +60 -3
  32. package/dist/templates/iflow/commands/trellis/brainstorm.md +13 -0
  33. package/dist/templates/iflow/commands/trellis/record-session.md +4 -1
  34. package/dist/templates/iflow/commands/trellis/start.md +20 -4
  35. package/dist/templates/iflow/hooks/inject-subagent-context.py +1 -1
  36. package/dist/templates/iflow/hooks/session-start.py +86 -23
  37. package/dist/templates/kilo/workflows/brainstorm.md +13 -0
  38. package/dist/templates/kilo/workflows/record-session.md +4 -1
  39. package/dist/templates/kilo/workflows/start.md +64 -3
  40. package/dist/templates/kiro/skills/brainstorm/SKILL.md +13 -0
  41. package/dist/templates/kiro/skills/record-session/SKILL.md +4 -1
  42. package/dist/templates/kiro/skills/start/SKILL.md +20 -4
  43. package/dist/templates/markdown/spec/backend/directory-structure.md +292 -0
  44. package/dist/templates/markdown/spec/backend/script-conventions.md +220 -38
  45. package/dist/templates/opencode/commands/trellis/brainstorm.md +13 -0
  46. package/dist/templates/opencode/commands/trellis/record-session.md +4 -1
  47. package/dist/templates/opencode/commands/trellis/start.md +9 -1
  48. package/dist/templates/opencode/plugin/session-start.js +149 -16
  49. package/dist/templates/qoder/skills/brainstorm/SKILL.md +13 -0
  50. package/dist/templates/qoder/skills/record-session/SKILL.md +4 -1
  51. package/dist/templates/qoder/skills/start/SKILL.md +60 -3
  52. package/dist/templates/trellis/config.yaml +18 -0
  53. package/dist/templates/trellis/index.d.ts.map +1 -1
  54. package/dist/templates/trellis/index.js.map +1 -1
  55. package/dist/templates/trellis/scripts/common/config.py +20 -0
  56. package/dist/templates/trellis/scripts/common/git_context.py +160 -12
  57. package/dist/templates/trellis/scripts/common/task_queue.py +4 -0
  58. package/dist/templates/trellis/scripts/common/worktree.py +78 -11
  59. package/dist/templates/trellis/scripts/create_bootstrap.py +3 -0
  60. package/dist/templates/trellis/scripts/task.py +312 -17
  61. package/dist/utils/template-fetcher.d.ts +60 -7
  62. package/dist/utils/template-fetcher.d.ts.map +1 -1
  63. package/dist/utils/template-fetcher.js +183 -14
  64. package/dist/utils/template-fetcher.js.map +1 -1
  65. package/package.json +7 -9
@@ -65,6 +65,60 @@ def run_script(script_path: Path) -> str:
65
65
  return "No context available"
66
66
 
67
67
 
68
+ def _get_task_status(trellis_dir: Path) -> str:
69
+ """Check current task status and return structured status string."""
70
+ current_task_file = trellis_dir / ".current-task"
71
+ if not current_task_file.is_file():
72
+ return "Status: NO ACTIVE TASK\nNext: Describe what you want to work on"
73
+
74
+ task_ref = current_task_file.read_text(encoding="utf-8").strip()
75
+ if not task_ref:
76
+ return "Status: NO ACTIVE TASK\nNext: Describe what you want to work on"
77
+
78
+ # Resolve task directory
79
+ if Path(task_ref).is_absolute():
80
+ task_dir = Path(task_ref)
81
+ elif task_ref.startswith(".trellis/"):
82
+ task_dir = trellis_dir.parent / task_ref
83
+ else:
84
+ task_dir = trellis_dir / "tasks" / task_ref
85
+ if not task_dir.is_dir():
86
+ return f"Status: STALE POINTER\nTask: {task_ref}\nNext: Task directory not found. Run: python3 ./.trellis/scripts/task.py finish"
87
+
88
+ # Read task.json
89
+ task_json_path = task_dir / "task.json"
90
+ task_data = {}
91
+ if task_json_path.is_file():
92
+ try:
93
+ task_data = json.loads(task_json_path.read_text(encoding="utf-8"))
94
+ except (json.JSONDecodeError, PermissionError):
95
+ pass
96
+
97
+ task_title = task_data.get("title", task_ref)
98
+ task_status = task_data.get("status", "unknown")
99
+
100
+ if task_status == "completed":
101
+ return f"Status: COMPLETED\nTask: {task_title}\nNext: Archive with `python3 ./.trellis/scripts/task.py archive {task_dir.name}` or start a new task"
102
+
103
+ # Check if context is configured (jsonl files exist and non-empty)
104
+ has_context = False
105
+ for jsonl_name in ("implement.jsonl", "check.jsonl", "spec.jsonl"):
106
+ jsonl_path = task_dir / jsonl_name
107
+ if jsonl_path.is_file() and jsonl_path.stat().st_size > 0:
108
+ has_context = True
109
+ break
110
+
111
+ has_prd = (task_dir / "prd.md").is_file()
112
+
113
+ if not has_prd:
114
+ return f"Status: NOT READY\nTask: {task_title}\nMissing: prd.md not created\nNext: Write PRD, then research → init-context → start"
115
+
116
+ if not has_context:
117
+ return f"Status: NOT READY\nTask: {task_title}\nMissing: Context not configured (no jsonl files)\nNext: Complete Phase 2 (research → init-context → start) before implementing"
118
+
119
+ return f"Status: READY\nTask: {task_title}\nNext: Continue with implement or check"
120
+
121
+
68
122
  def main():
69
123
  if should_skip_injection():
70
124
  sys.exit(0)
@@ -93,28 +147,31 @@ Read and follow all instructions below carefully.
93
147
  output.write("\n</workflow>\n\n")
94
148
 
95
149
  output.write("<guidelines>\n")
96
-
97
- output.write("## Frontend\n")
98
- frontend_index = read_file(
99
- trellis_dir / "spec" / "frontend" / "index.md", "Not configured"
100
- )
101
- output.write(frontend_index)
102
- output.write("\n\n")
103
-
104
- output.write("## Backend\n")
105
- backend_index = read_file(
106
- trellis_dir / "spec" / "backend" / "index.md", "Not configured"
107
- )
108
- output.write(backend_index)
109
- output.write("\n\n")
110
-
111
- output.write("## Guides\n")
112
- guides_index = read_file(
113
- trellis_dir / "spec" / "guides" / "index.md", "Not configured"
114
- )
115
- output.write(guides_index)
116
-
117
- output.write("\n</guidelines>\n\n")
150
+ output.write("**Note**: The guidelines below are index files — they list available guideline documents and their locations.\n")
151
+ output.write("During actual development, you MUST read the specific guideline files listed in each index's Pre-Development Checklist.\n\n")
152
+
153
+ spec_dir = trellis_dir / "spec"
154
+ if spec_dir.is_dir():
155
+ for sub in sorted(spec_dir.iterdir()):
156
+ if not sub.is_dir() or sub.name.startswith("."):
157
+ continue
158
+ index_file = sub / "index.md"
159
+ if index_file.is_file():
160
+ output.write(f"## {sub.name}\n")
161
+ output.write(read_file(index_file))
162
+ output.write("\n\n")
163
+ else:
164
+ # Check for nested package dirs (monorepo: spec/<pkg>/<layer>/index.md)
165
+ for nested in sorted(sub.iterdir()):
166
+ if not nested.is_dir():
167
+ continue
168
+ nested_index = nested / "index.md"
169
+ if nested_index.is_file():
170
+ output.write(f"## {sub.name}/{nested.name}\n")
171
+ output.write(read_file(nested_index))
172
+ output.write("\n\n")
173
+
174
+ output.write("</guidelines>\n\n")
118
175
 
119
176
  output.write("<instructions>\n")
120
177
  start_md = read_file(
@@ -123,8 +180,14 @@ Read and follow all instructions below carefully.
123
180
  output.write(start_md)
124
181
  output.write("\n</instructions>\n\n")
125
182
 
183
+ # R2: Check task status and inject structured tag
184
+ task_status = _get_task_status(trellis_dir)
185
+ output.write(f"<task-status>\n{task_status}\n</task-status>\n\n")
186
+
126
187
  output.write("""<ready>
127
- Context loaded. Wait for user's first message, then follow <instructions> to handle their request.
188
+ Context loaded. Steps 1-3 (workflow, context, guidelines) are already injected above do NOT re-read them.
189
+ Start from Step 4. Wait for user's first message, then follow <instructions> to handle their request.
190
+ If there is an active task, ask whether to continue it.
128
191
  </ready>""")
129
192
 
130
193
  result = {
@@ -42,6 +42,16 @@
42
42
  "timeout": 30
43
43
  }
44
44
  ]
45
+ },
46
+ {
47
+ "matcher": "Agent",
48
+ "hooks": [
49
+ {
50
+ "type": "command",
51
+ "command": "{{PYTHON_CMD}} .claude/hooks/inject-subagent-context.py",
52
+ "timeout": 30
53
+ }
54
+ ]
45
55
  }
46
56
  ],
47
57
  "SubagentStop": [
@@ -392,6 +392,19 @@ Here's my understanding of the complete requirements:
392
392
  Does this look correct? If yes, I'll proceed with implementation.
393
393
  ```
394
394
 
395
+ ### Subtask Decomposition (Complex Tasks)
396
+
397
+ For complex tasks with multiple independent work items, create subtasks:
398
+
399
+ ```bash
400
+ # Create child tasks
401
+ CHILD1=$(python3 ./.trellis/scripts/task.py create "Child task 1" --slug child1 --parent "$TASK_DIR")
402
+ CHILD2=$(python3 ./.trellis/scripts/task.py create "Child task 2" --slug child2 --parent "$TASK_DIR")
403
+
404
+ # Or link existing tasks
405
+ python3 ./.trellis/scripts/task.py add-subtask "$TASK_DIR" "$CHILD_DIR"
406
+ ```
407
+
395
408
  ---
396
409
 
397
410
  ## PRD Target Structure (final)
@@ -17,7 +17,10 @@ description: "Record work progress after human has tested and committed code"
17
17
  python3 ./.trellis/scripts/get_context.py --mode record
18
18
  ```
19
19
 
20
- [!] If MY ACTIVE TASKS shows any completed tasks, archive them FIRST:
20
+ [!] Archive tasks whose work is **actually done** — judge by work status, not the `status` field in task.json:
21
+ - Code committed? → Archive it (don't wait for PR)
22
+ - All acceptance criteria met? → Archive it
23
+ - Don't skip archiving just because `status` still says `planning` or `in_progress`
21
24
 
22
25
  ```bash
23
26
  python3 ./.trellis/scripts/task.py archive <task-name>
@@ -50,6 +50,10 @@ cat .trellis/spec/backend/index.md # Backend guidelines
50
50
  cat .trellis/spec/guides/index.md # Thinking guides
51
51
  ```
52
52
 
53
+ > **Important**: The index files are navigation — they list the actual guideline files (e.g., `error-handling.md`, `conventions.md`, `mock-strategies.md`).
54
+ > At this step, just read the indexes to understand what's available.
55
+ > When you start actual development, you MUST go back and read the specific guideline files relevant to your task, as listed in the index's Pre-Development Checklist.
56
+
53
57
  ### Step 4: Report and Ask
54
58
 
55
59
  Report what you learned and ask: "What would you like to work on?"
@@ -74,6 +78,10 @@ When user describes a task, classify it:
74
78
  > Task Workflow ensures code-specs are injected to the right context, resulting in higher quality code.
75
79
  > The overhead is minimal, but the benefit is significant.
76
80
 
81
+ > **Subtask Decomposition**: If brainstorm reveals multiple independent work items,
82
+ > consider creating subtasks using `--parent` flag or `add-subtask` command.
83
+ > See the brainstorm skill's Step 8 for details.
84
+
77
85
  ---
78
86
 
79
87
  ## Question / Trivial Fix
@@ -89,15 +97,23 @@ For questions or trivial fixes, work directly:
89
97
 
90
98
  For simple, well-defined tasks:
91
99
 
92
- 1. Quick confirm: "I understand you want to [goal]. Ready to proceed?"
93
- 2. If yes, proceed to **Task Workflow Phase 1 Path B** (create task, write PRD, then research)
94
- 3. If no, clarify and confirm again
100
+ 1. Quick confirm: "I understand you want to [goal]. Shall I proceed?"
101
+ 2. If no, clarify and confirm again
102
+ 3. **If yes: execute ALL steps below without stopping. Do NOT ask for additional confirmation between steps.**
103
+ - Create task directory (Phase 1 Path B, Step 2)
104
+ - Write PRD (Step 3)
105
+ - Research codebase (Phase 2, Step 5)
106
+ - Configure context (Step 6)
107
+ - Activate task (Step 7)
108
+ - Implement (Phase 3, Step 8)
109
+ - Check quality (Step 9)
110
+ - Complete (Step 10)
95
111
 
96
112
  ---
97
113
 
98
114
  ## Complex Task - Brainstorm First
99
115
 
100
- For complex or vague tasks, use the brainstorm process to clarify requirements.
116
+ For complex or vague tasks, **automatically start the brainstorm process** — do NOT skip directly to implementation.
101
117
 
102
118
  See `$brainstorm` for the full process. Summary:
103
119
 
@@ -387,6 +387,19 @@ Here's my understanding of the complete requirements:
387
387
  Does this look correct? If yes, I'll proceed with implementation.
388
388
  ```
389
389
 
390
+ ### Subtask Decomposition (Complex Tasks)
391
+
392
+ For complex tasks with multiple independent work items, create subtasks:
393
+
394
+ ```bash
395
+ # Create child tasks
396
+ CHILD1=$(python3 ./.trellis/scripts/task.py create "Child task 1" --slug child1 --parent "$TASK_DIR")
397
+ CHILD2=$(python3 ./.trellis/scripts/task.py create "Child task 2" --slug child2 --parent "$TASK_DIR")
398
+
399
+ # Or link existing tasks
400
+ python3 ./.trellis/scripts/task.py add-subtask "$TASK_DIR" "$CHILD_DIR"
401
+ ```
402
+
390
403
  ---
391
404
 
392
405
  ## PRD Target Structure (final)
@@ -12,7 +12,10 @@
12
12
  python3 ./.trellis/scripts/get_context.py --mode record
13
13
  ```
14
14
 
15
- [!] If MY ACTIVE TASKS shows any completed tasks, archive them FIRST:
15
+ [!] Archive tasks whose work is **actually done** — judge by work status, not the `status` field in task.json:
16
+ - Code committed? → Archive it (don't wait for PR)
17
+ - All acceptance criteria met? → Archive it
18
+ - Don't skip archiving just because `status` still says `planning` or `in_progress`
16
19
 
17
20
  ```bash
18
21
  python3 ./.trellis/scripts/task.py archive <task-name>
@@ -58,6 +58,10 @@ cat .trellis/spec/guides/index.md
58
58
  cat .trellis/spec/guides/cross-layer-thinking-guide.md
59
59
  ```
60
60
 
61
+ > **Important**: The index files are navigation — they list the actual guideline files (e.g., `error-handling.md`, `conventions.md`, `mock-strategies.md`).
62
+ > At this step, just read the indexes to understand what's available.
63
+ > When you start actual development, you MUST go back and read the specific guideline files relevant to your task, as listed in the index's Pre-Development Checklist.
64
+
61
65
  ### Step 4: Check Active Tasks `[AI]`
62
66
 
63
67
  ```bash
@@ -104,6 +108,10 @@ When user describes a task, classify it:
104
108
  > Task Workflow ensures code-specs are injected to the right context, resulting in higher quality code.
105
109
  > The overhead is minimal, but the benefit is significant.
106
110
 
111
+ > **Subtask Decomposition**: If brainstorm reveals multiple independent work items,
112
+ > consider creating subtasks using `--parent` flag or `add-subtask` command.
113
+ > See `/trellis:brainstorm` Step 8 for details.
114
+
107
115
  ---
108
116
 
109
117
  ## Question / Trivial Fix
@@ -119,15 +127,23 @@ For questions or trivial fixes, work directly:
119
127
 
120
128
  For simple, well-defined tasks:
121
129
 
122
- 1. Quick confirm: "I understand you want to [goal]. Ready to proceed?"
123
- 2. If yes, proceed to **Task Workflow Phase 1 Path B** (create task, write PRD, then research)
124
- 3. If no, clarify and confirm again
130
+ 1. Quick confirm: "I understand you want to [goal]. Shall I proceed?"
131
+ 2. If no, clarify and confirm again
132
+ 3. **If yes: execute ALL steps below without stopping. Do NOT ask for additional confirmation between steps.**
133
+ - Create task directory (Phase 1 Path B, Step 2)
134
+ - Write PRD (Step 3)
135
+ - Research codebase (Phase 2, Step 5)
136
+ - Configure context (Step 6)
137
+ - Activate task (Step 7)
138
+ - Implement (Phase 3, Step 8)
139
+ - Check quality (Step 9)
140
+ - Complete (Step 10)
125
141
 
126
142
  ---
127
143
 
128
144
  ## Complex Task - Brainstorm First
129
145
 
130
- For complex or vague tasks, use `/trellis-brainstorm` first to clarify requirements before implementation.
146
+ For complex or vague tasks, **automatically start the brainstorm process** do NOT skip directly to implementation. Use `/trellis-brainstorm`.
131
147
 
132
148
  Summary:
133
149
 
@@ -402,6 +402,21 @@ Does this look correct? If yes, I'll proceed with implementation.
402
402
 
403
403
  ---
404
404
 
405
+ ### Subtask Decomposition (Complex Tasks)
406
+
407
+ For complex tasks with multiple independent work items, create subtasks:
408
+
409
+ ```bash
410
+ # Create child tasks
411
+ CHILD1=$(python3 ./.trellis/scripts/task.py create "Child task 1" --slug child1 --parent "$TASK_DIR")
412
+ CHILD2=$(python3 ./.trellis/scripts/task.py create "Child task 2" --slug child2 --parent "$TASK_DIR")
413
+
414
+ # Or link existing tasks
415
+ python3 ./.trellis/scripts/task.py add-subtask "$TASK_DIR" "$CHILD_DIR"
416
+ ```
417
+
418
+ ---
419
+
405
420
  ## Integration with Start Workflow
406
421
 
407
422
  After brainstorm completes (Step 8 confirmation approved), the flow continues to the Task Workflow's **Phase 2: Prepare for Implementation**.
@@ -15,7 +15,10 @@ prompt = """
15
15
  python3 ./.trellis/scripts/get_context.py --mode record
16
16
  ```
17
17
 
18
- [!] If MY ACTIVE TASKS shows any completed tasks, archive them FIRST:
18
+ [!] Archive tasks whose work is **actually done** — judge by work status, not the `status` field in task.json:
19
+ - Code committed? → Archive it (don't wait for PR)
20
+ - All acceptance criteria met? → Archive it
21
+ - Don't skip archiving just because `status` still says `planning` or `in_progress`
19
22
 
20
23
  ```bash
21
24
  python3 ./.trellis/scripts/task.py archive <task-name>
@@ -48,6 +48,10 @@ cat .trellis/spec/backend/index.md # Backend guidelines
48
48
  cat .trellis/spec/guides/index.md # Thinking guides
49
49
  ```
50
50
 
51
+ > **Important**: The index files are navigation — they list the actual guideline files (e.g., `error-handling.md`, `conventions.md`, `mock-strategies.md`).
52
+ > At this step, just read the indexes to understand what's available.
53
+ > When you start actual development, you MUST go back and read the specific guideline files relevant to your task, as listed in the index's Pre-Development Checklist.
54
+
51
55
  ### Step 4: Report and Ask
52
56
 
53
57
  Report what you learned and ask: "What would you like to work on?"
@@ -61,12 +65,28 @@ When user describes a task, classify it:
61
65
  | Type | Criteria | Workflow |
62
66
  |------|----------|----------|
63
67
  | **Question** | User asks about code, architecture, or how something works | Answer directly |
64
- | **Trivial Fix** | Typo fix, comment update, single-line change, < 5 minutes | Direct Edit |
65
- | **Development Task** | Any code change that: modifies logic, adds features, fixes bugs, touches multiple files | **Task Workflow** |
68
+ | **Trivial Fix** | Typo fix, comment update, single-line change | Direct Edit |
69
+ | **Simple Task** | Clear goal, 1-2 files, well-defined scope | Quick confirm Implement |
70
+ | **Complex Task** | Vague goal, multiple files, architectural decisions | **Brainstorm → Task Workflow** |
71
+
72
+ ### Classification Signals
73
+
74
+ **Trivial/Simple indicators:**
75
+ - User specifies exact file and change
76
+ - "Fix the typo in X"
77
+ - "Add field Y to component Z"
78
+ - Clear acceptance criteria already stated
79
+
80
+ **Complex indicators:**
81
+ - "I want to add a feature for..."
82
+ - "Can you help me improve..."
83
+ - Mentions multiple areas or systems
84
+ - No clear implementation path
85
+ - User seems unsure about approach
66
86
 
67
87
  ### Decision Rule
68
88
 
69
- > **If in doubt, use Task Workflow.**
89
+ > **If in doubt, use Brainstorm + Task Workflow.**
70
90
  >
71
91
  > Task Workflow ensures specs are injected to agents, resulting in higher quality code.
72
92
  > The overhead is minimal, but the benefit is significant.
@@ -82,6 +102,43 @@ For questions or trivial fixes, work directly:
82
102
 
83
103
  ---
84
104
 
105
+ ## Simple Task
106
+
107
+ For simple, well-defined tasks:
108
+
109
+ 1. Quick confirm: "I understand you want to [goal]. Shall I proceed?"
110
+ 2. If no, clarify and confirm again
111
+ 3. **If yes: execute ALL steps below without stopping. Do NOT ask for additional confirmation between steps.**
112
+ - Create task directory (Phase 1 Path B, Step 2)
113
+ - Write PRD (Step 3)
114
+ - Research codebase (Phase 2, Step 5)
115
+ - Configure context (Step 6)
116
+ - Activate task (Step 7)
117
+ - Implement (Phase 3, Step 8)
118
+ - Check quality (Step 9)
119
+ - Complete (Step 10)
120
+
121
+ ---
122
+
123
+ ## Complex Task - Brainstorm First
124
+
125
+ For complex or vague tasks, **automatically start the brainstorm process** — do NOT skip directly to implementation.
126
+
127
+ See `/trellis:brainstorm` for the full process. Summary:
128
+
129
+ 1. **Acknowledge and classify** - State your understanding
130
+ 2. **Create task directory** - Track evolving requirements in `prd.md`
131
+ 3. **Ask questions one at a time** - Update PRD after each answer
132
+ 4. **Propose approaches** - For architectural decisions
133
+ 5. **Confirm final requirements** - Get explicit approval
134
+ 6. **Proceed to Task Workflow** - With clear requirements in PRD
135
+
136
+ > **Subtask Decomposition**: If brainstorm reveals multiple independent work items,
137
+ > consider creating subtasks using `--parent` flag or `add-subtask` command.
138
+ > See `/trellis:brainstorm` Step 8 for details.
139
+
140
+ ---
141
+
85
142
  ## Task Workflow (Development Tasks)
86
143
 
87
144
  **Why this workflow?**
@@ -387,6 +387,19 @@ Here's my understanding of the complete requirements:
387
387
  Does this look correct? If yes, I'll proceed with implementation.
388
388
  ```
389
389
 
390
+ ### Subtask Decomposition (Complex Tasks)
391
+
392
+ For complex tasks with multiple independent work items, create subtasks:
393
+
394
+ ```bash
395
+ # Create child tasks
396
+ CHILD1=$(python3 ./.trellis/scripts/task.py create "Child task 1" --slug child1 --parent "$TASK_DIR")
397
+ CHILD2=$(python3 ./.trellis/scripts/task.py create "Child task 2" --slug child2 --parent "$TASK_DIR")
398
+
399
+ # Or link existing tasks
400
+ python3 ./.trellis/scripts/task.py add-subtask "$TASK_DIR" "$CHILD_DIR"
401
+ ```
402
+
390
403
  ---
391
404
 
392
405
  ## PRD Target Structure (final)
@@ -12,7 +12,10 @@
12
12
  python3 ./.trellis/scripts/get_context.py --mode record
13
13
  ```
14
14
 
15
- [!] If MY ACTIVE TASKS shows any completed tasks, archive them FIRST:
15
+ [!] Archive tasks whose work is **actually done** — judge by work status, not the `status` field in task.json:
16
+ - Code committed? → Archive it (don't wait for PR)
17
+ - All acceptance criteria met? → Archive it
18
+ - Don't skip archiving just because `status` still says `planning` or `in_progress`
16
19
 
17
20
  ```bash
18
21
  python3 ./.trellis/scripts/task.py archive <task-name>
@@ -46,6 +46,10 @@ cat .trellis/spec/guides/index.md # Thinking guides
46
46
  cat .trellis/spec/unit-test/index.md # Testing guidelines
47
47
  ```
48
48
 
49
+ > **Important**: The index files are navigation — they list the actual guideline files (e.g., `error-handling.md`, `conventions.md`, `mock-strategies.md`).
50
+ > At this step, just read the indexes to understand what's available.
51
+ > When you start actual development, you MUST go back and read the specific guideline files relevant to your task, as listed in the index's Pre-Development Checklist.
52
+
49
53
  ### Step 4: Report and Ask
50
54
 
51
55
  Report what you learned and ask: "What would you like to work on?"
@@ -100,15 +104,23 @@ For questions or trivial fixes, work directly:
100
104
 
101
105
  For simple, well-defined tasks:
102
106
 
103
- 1. Quick confirm: "I understand you want to [goal]. Ready to proceed?"
104
- 2. If yes, proceed to **Task Workflow Phase 1 Path B** (create task, write PRD, then research)
105
- 3. If no, clarify and confirm again
107
+ 1. Quick confirm: "I understand you want to [goal]. Shall I proceed?"
108
+ 2. If no, clarify and confirm again
109
+ 3. **If yes: execute ALL steps below without stopping. Do NOT ask for additional confirmation between steps.**
110
+ - Create task directory (Phase 1 Path B, Step 2)
111
+ - Write PRD (Step 3)
112
+ - Research codebase (Phase 2, Step 5)
113
+ - Configure context (Step 6)
114
+ - Activate task (Step 7)
115
+ - Implement (Phase 3, Step 8)
116
+ - Check quality (Step 9)
117
+ - Complete (Step 10)
106
118
 
107
119
  ---
108
120
 
109
121
  ## Complex Task - Brainstorm First
110
122
 
111
- For complex or vague tasks, use the brainstorm process to clarify requirements.
123
+ For complex or vague tasks, **automatically start the brainstorm process** — do NOT skip directly to implementation.
112
124
 
113
125
  See `/trellis:brainstorm` for the full process. Summary:
114
126
 
@@ -119,6 +131,10 @@ See `/trellis:brainstorm` for the full process. Summary:
119
131
  5. **Confirm final requirements** - Get explicit approval
120
132
  6. **Proceed to Task Workflow** - With clear requirements in PRD
121
133
 
134
+ > **Subtask Decomposition**: If brainstorm reveals multiple independent work items,
135
+ > consider creating subtasks using `--parent` flag or `add-subtask` command.
136
+ > See `/trellis:brainstorm` Step 8 for details.
137
+
122
138
  ### Key Brainstorm Principles
123
139
 
124
140
  | Principle | Description |
@@ -707,7 +707,7 @@ def main():
707
707
 
708
708
  tool_name = input_data.get("tool_name", "")
709
709
 
710
- if tool_name != "Task":
710
+ if tool_name not in ("Task", "Agent"):
711
711
  sys.exit(0)
712
712
 
713
713
  tool_input = input_data.get("tool_input", {})