@mindfoldhq/trellis 0.6.0-beta.2 → 0.6.0-beta.20

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 (330) hide show
  1. package/README.md +1 -1
  2. package/dist/cli/index.d.ts +1 -1
  3. package/dist/cli/index.d.ts.map +1 -1
  4. package/dist/cli/index.js +58 -2
  5. package/dist/cli/index.js.map +1 -1
  6. package/dist/commands/channel/adapters/claude.d.ts +29 -0
  7. package/dist/commands/channel/adapters/claude.d.ts.map +1 -0
  8. package/dist/commands/channel/adapters/claude.js +203 -0
  9. package/dist/commands/channel/adapters/claude.js.map +1 -0
  10. package/dist/commands/channel/adapters/codex.d.ts +85 -0
  11. package/dist/commands/channel/adapters/codex.d.ts.map +1 -0
  12. package/dist/commands/channel/adapters/codex.js +505 -0
  13. package/dist/commands/channel/adapters/codex.js.map +1 -0
  14. package/dist/commands/channel/adapters/index.d.ts +84 -0
  15. package/dist/commands/channel/adapters/index.d.ts.map +1 -0
  16. package/dist/commands/channel/adapters/index.js +115 -0
  17. package/dist/commands/channel/adapters/index.js.map +1 -0
  18. package/dist/commands/channel/adapters/types.d.ts +33 -0
  19. package/dist/commands/channel/adapters/types.d.ts.map +1 -0
  20. package/dist/commands/channel/adapters/types.js +2 -0
  21. package/dist/commands/channel/adapters/types.js.map +1 -0
  22. package/dist/commands/channel/agent-loader.d.ts +32 -0
  23. package/dist/commands/channel/agent-loader.d.ts.map +1 -0
  24. package/dist/commands/channel/agent-loader.js +154 -0
  25. package/dist/commands/channel/agent-loader.js.map +1 -0
  26. package/dist/commands/channel/context-loader.d.ts +26 -0
  27. package/dist/commands/channel/context-loader.d.ts.map +1 -0
  28. package/dist/commands/channel/context-loader.js +290 -0
  29. package/dist/commands/channel/context-loader.js.map +1 -0
  30. package/dist/commands/channel/context.d.ts +16 -0
  31. package/dist/commands/channel/context.d.ts.map +1 -0
  32. package/dist/commands/channel/context.js +83 -0
  33. package/dist/commands/channel/context.js.map +1 -0
  34. package/dist/commands/channel/create.d.ts +27 -0
  35. package/dist/commands/channel/create.d.ts.map +1 -0
  36. package/dist/commands/channel/create.js +39 -0
  37. package/dist/commands/channel/create.js.map +1 -0
  38. package/dist/commands/channel/dev-parse-trace.d.ts +14 -0
  39. package/dist/commands/channel/dev-parse-trace.d.ts.map +1 -0
  40. package/dist/commands/channel/dev-parse-trace.js +70 -0
  41. package/dist/commands/channel/dev-parse-trace.js.map +1 -0
  42. package/dist/commands/channel/guard.d.ts +150 -0
  43. package/dist/commands/channel/guard.d.ts.map +1 -0
  44. package/dist/commands/channel/guard.js +474 -0
  45. package/dist/commands/channel/guard.js.map +1 -0
  46. package/dist/commands/channel/index.d.ts +3 -0
  47. package/dist/commands/channel/index.d.ts.map +1 -0
  48. package/dist/commands/channel/index.js +531 -0
  49. package/dist/commands/channel/index.js.map +1 -0
  50. package/dist/commands/channel/interrupt.d.ts +10 -0
  51. package/dist/commands/channel/interrupt.d.ts.map +1 -0
  52. package/dist/commands/channel/interrupt.js +22 -0
  53. package/dist/commands/channel/interrupt.js.map +1 -0
  54. package/dist/commands/channel/kill.d.ts +7 -0
  55. package/dist/commands/channel/kill.d.ts.map +1 -0
  56. package/dist/commands/channel/kill.js +121 -0
  57. package/dist/commands/channel/kill.js.map +1 -0
  58. package/dist/commands/channel/list.d.ts +17 -0
  59. package/dist/commands/channel/list.d.ts.map +1 -0
  60. package/dist/commands/channel/list.js +233 -0
  61. package/dist/commands/channel/list.js.map +1 -0
  62. package/dist/commands/channel/messages.d.ts +15 -0
  63. package/dist/commands/channel/messages.d.ts.map +1 -0
  64. package/dist/commands/channel/messages.js +245 -0
  65. package/dist/commands/channel/messages.js.map +1 -0
  66. package/dist/commands/channel/rm.d.ts +27 -0
  67. package/dist/commands/channel/rm.d.ts.map +1 -0
  68. package/dist/commands/channel/rm.js +216 -0
  69. package/dist/commands/channel/rm.js.map +1 -0
  70. package/dist/commands/channel/run.d.ts +30 -0
  71. package/dist/commands/channel/run.d.ts.map +1 -0
  72. package/dist/commands/channel/run.js +130 -0
  73. package/dist/commands/channel/run.js.map +1 -0
  74. package/dist/commands/channel/send.d.ts +11 -0
  75. package/dist/commands/channel/send.d.ts.map +1 -0
  76. package/dist/commands/channel/send.js +24 -0
  77. package/dist/commands/channel/send.js.map +1 -0
  78. package/dist/commands/channel/spawn.d.ts +40 -0
  79. package/dist/commands/channel/spawn.d.ts.map +1 -0
  80. package/dist/commands/channel/spawn.js +244 -0
  81. package/dist/commands/channel/spawn.js.map +1 -0
  82. package/dist/commands/channel/store/events.d.ts +39 -0
  83. package/dist/commands/channel/store/events.d.ts.map +1 -0
  84. package/dist/commands/channel/store/events.js +87 -0
  85. package/dist/commands/channel/store/events.js.map +1 -0
  86. package/dist/commands/channel/store/filter.d.ts +3 -0
  87. package/dist/commands/channel/store/filter.d.ts.map +1 -0
  88. package/dist/commands/channel/store/filter.js +2 -0
  89. package/dist/commands/channel/store/filter.js.map +1 -0
  90. package/dist/commands/channel/store/lock.d.ts +23 -0
  91. package/dist/commands/channel/store/lock.d.ts.map +1 -0
  92. package/dist/commands/channel/store/lock.js +99 -0
  93. package/dist/commands/channel/store/lock.js.map +1 -0
  94. package/dist/commands/channel/store/paths.d.ts +63 -0
  95. package/dist/commands/channel/store/paths.d.ts.map +1 -0
  96. package/dist/commands/channel/store/paths.js +246 -0
  97. package/dist/commands/channel/store/paths.js.map +1 -0
  98. package/dist/commands/channel/store/schema.d.ts +27 -0
  99. package/dist/commands/channel/store/schema.d.ts.map +1 -0
  100. package/dist/commands/channel/store/schema.js +34 -0
  101. package/dist/commands/channel/store/schema.js.map +1 -0
  102. package/dist/commands/channel/store/thread-state.d.ts +5 -0
  103. package/dist/commands/channel/store/thread-state.d.ts.map +1 -0
  104. package/dist/commands/channel/store/thread-state.js +16 -0
  105. package/dist/commands/channel/store/thread-state.js.map +1 -0
  106. package/dist/commands/channel/store/watch.d.ts +19 -0
  107. package/dist/commands/channel/store/watch.d.ts.map +1 -0
  108. package/dist/commands/channel/store/watch.js +146 -0
  109. package/dist/commands/channel/store/watch.js.map +1 -0
  110. package/dist/commands/channel/supervisor/idle.d.ts +46 -0
  111. package/dist/commands/channel/supervisor/idle.d.ts.map +1 -0
  112. package/dist/commands/channel/supervisor/idle.js +72 -0
  113. package/dist/commands/channel/supervisor/idle.js.map +1 -0
  114. package/dist/commands/channel/supervisor/inbox.d.ts +30 -0
  115. package/dist/commands/channel/supervisor/inbox.d.ts.map +1 -0
  116. package/dist/commands/channel/supervisor/inbox.js +160 -0
  117. package/dist/commands/channel/supervisor/inbox.js.map +1 -0
  118. package/dist/commands/channel/supervisor/shutdown.d.ts +68 -0
  119. package/dist/commands/channel/supervisor/shutdown.d.ts.map +1 -0
  120. package/dist/commands/channel/supervisor/shutdown.js +146 -0
  121. package/dist/commands/channel/supervisor/shutdown.js.map +1 -0
  122. package/dist/commands/channel/supervisor/stdout.d.ts +51 -0
  123. package/dist/commands/channel/supervisor/stdout.d.ts.map +1 -0
  124. package/dist/commands/channel/supervisor/stdout.js +121 -0
  125. package/dist/commands/channel/supervisor/stdout.js.map +1 -0
  126. package/dist/commands/channel/supervisor/turns.d.ts +31 -0
  127. package/dist/commands/channel/supervisor/turns.d.ts.map +1 -0
  128. package/dist/commands/channel/supervisor/turns.js +45 -0
  129. package/dist/commands/channel/supervisor/turns.js.map +1 -0
  130. package/dist/commands/channel/supervisor/warning.d.ts +48 -0
  131. package/dist/commands/channel/supervisor/warning.d.ts.map +1 -0
  132. package/dist/commands/channel/supervisor/warning.js +77 -0
  133. package/dist/commands/channel/supervisor/warning.js.map +1 -0
  134. package/dist/commands/channel/supervisor.d.ts +59 -0
  135. package/dist/commands/channel/supervisor.d.ts.map +1 -0
  136. package/dist/commands/channel/supervisor.js +344 -0
  137. package/dist/commands/channel/supervisor.js.map +1 -0
  138. package/dist/commands/channel/text-body.d.ts +13 -0
  139. package/dist/commands/channel/text-body.d.ts.map +1 -0
  140. package/dist/commands/channel/text-body.js +47 -0
  141. package/dist/commands/channel/text-body.js.map +1 -0
  142. package/dist/commands/channel/threads.d.ts +39 -0
  143. package/dist/commands/channel/threads.d.ts.map +1 -0
  144. package/dist/commands/channel/threads.js +106 -0
  145. package/dist/commands/channel/threads.js.map +1 -0
  146. package/dist/commands/channel/title.d.ts +12 -0
  147. package/dist/commands/channel/title.d.ts.map +1 -0
  148. package/dist/commands/channel/title.js +24 -0
  149. package/dist/commands/channel/title.js.map +1 -0
  150. package/dist/commands/channel/wait.d.ts +17 -0
  151. package/dist/commands/channel/wait.d.ts.map +1 -0
  152. package/dist/commands/channel/wait.js +75 -0
  153. package/dist/commands/channel/wait.js.map +1 -0
  154. package/dist/commands/init.d.ts +2 -0
  155. package/dist/commands/init.d.ts.map +1 -1
  156. package/dist/commands/init.js +97 -42
  157. package/dist/commands/init.js.map +1 -1
  158. package/dist/commands/mem.d.ts +13 -117
  159. package/dist/commands/mem.d.ts.map +1 -1
  160. package/dist/commands/mem.js +168 -1074
  161. package/dist/commands/mem.js.map +1 -1
  162. package/dist/commands/uninstall.d.ts.map +1 -1
  163. package/dist/commands/uninstall.js +28 -2
  164. package/dist/commands/uninstall.js.map +1 -1
  165. package/dist/commands/update.d.ts.map +1 -1
  166. package/dist/commands/update.js +31 -111
  167. package/dist/commands/update.js.map +1 -1
  168. package/dist/commands/upgrade.d.ts +28 -0
  169. package/dist/commands/upgrade.d.ts.map +1 -0
  170. package/dist/commands/upgrade.js +84 -0
  171. package/dist/commands/upgrade.js.map +1 -0
  172. package/dist/commands/workflow.d.ts +35 -0
  173. package/dist/commands/workflow.d.ts.map +1 -0
  174. package/dist/commands/workflow.js +219 -0
  175. package/dist/commands/workflow.js.map +1 -0
  176. package/dist/configurators/claude.d.ts.map +1 -1
  177. package/dist/configurators/claude.js +1 -0
  178. package/dist/configurators/claude.js.map +1 -1
  179. package/dist/configurators/codex.d.ts.map +1 -1
  180. package/dist/configurators/codex.js +5 -3
  181. package/dist/configurators/codex.js.map +1 -1
  182. package/dist/configurators/shared.js +4 -4
  183. package/dist/configurators/shared.js.map +1 -1
  184. package/dist/configurators/workflow.d.ts +8 -0
  185. package/dist/configurators/workflow.d.ts.map +1 -1
  186. package/dist/configurators/workflow.js +3 -2
  187. package/dist/configurators/workflow.js.map +1 -1
  188. package/dist/migrations/manifests/0.5.10.json +9 -0
  189. package/dist/migrations/manifests/0.5.11.json +16 -0
  190. package/dist/migrations/manifests/0.5.12.json +9 -0
  191. package/dist/migrations/manifests/0.5.13.json +9 -0
  192. package/dist/migrations/manifests/0.5.14.json +9 -0
  193. package/dist/migrations/manifests/0.5.15.json +9 -0
  194. package/dist/migrations/manifests/0.5.16.json +9 -0
  195. package/dist/migrations/manifests/0.5.17.json +9 -0
  196. package/dist/migrations/manifests/0.5.18.json +9 -0
  197. package/dist/migrations/manifests/0.6.0-beta.10.json +9 -0
  198. package/dist/migrations/manifests/0.6.0-beta.11.json +9 -0
  199. package/dist/migrations/manifests/0.6.0-beta.12.json +9 -0
  200. package/dist/migrations/manifests/0.6.0-beta.13.json +9 -0
  201. package/dist/migrations/manifests/0.6.0-beta.14.json +9 -0
  202. package/dist/migrations/manifests/0.6.0-beta.15.json +9 -0
  203. package/dist/migrations/manifests/0.6.0-beta.16.json +9 -0
  204. package/dist/migrations/manifests/0.6.0-beta.17.json +9 -0
  205. package/dist/migrations/manifests/0.6.0-beta.18.json +16 -0
  206. package/dist/migrations/manifests/0.6.0-beta.19.json +9 -0
  207. package/dist/migrations/manifests/0.6.0-beta.20.json +9 -0
  208. package/dist/migrations/manifests/0.6.0-beta.3.json +9 -0
  209. package/dist/migrations/manifests/0.6.0-beta.4.json +9 -0
  210. package/dist/migrations/manifests/0.6.0-beta.5.json +9 -0
  211. package/dist/migrations/manifests/0.6.0-beta.6.json +16 -0
  212. package/dist/migrations/manifests/0.6.0-beta.7.json +9 -0
  213. package/dist/migrations/manifests/0.6.0-beta.8.json +9 -0
  214. package/dist/migrations/manifests/0.6.0-beta.9.json +9 -0
  215. package/dist/templates/claude/agents/trellis-check.md +13 -7
  216. package/dist/templates/claude/agents/trellis-implement.md +8 -7
  217. package/dist/templates/claude/settings.json +4 -4
  218. package/dist/templates/codebuddy/agents/trellis-check.md +13 -7
  219. package/dist/templates/codebuddy/agents/trellis-implement.md +8 -7
  220. package/dist/templates/codebuddy/settings.json +4 -4
  221. package/dist/templates/codex/agents/trellis-check.toml +4 -4
  222. package/dist/templates/codex/agents/trellis-implement.toml +4 -4
  223. package/dist/templates/codex/config.toml +5 -3
  224. package/dist/templates/codex/hooks/session-start.py +205 -119
  225. package/dist/templates/codex/hooks.json +2 -2
  226. package/dist/templates/codex/skills/before-dev/SKILL.md +12 -6
  227. package/dist/templates/codex/skills/brainstorm/SKILL.md +69 -457
  228. package/dist/templates/codex/skills/check/SKILL.md +86 -18
  229. package/dist/templates/codex/skills/start/SKILL.md +33 -323
  230. package/dist/templates/common/bundled-skills/trellis-meta/references/customize-local/change-context-loading.md +7 -4
  231. package/dist/templates/common/bundled-skills/trellis-meta/references/customize-local/change-spec-structure.md +1 -1
  232. package/dist/templates/common/bundled-skills/trellis-meta/references/customize-local/change-workflow.md +3 -2
  233. package/dist/templates/common/bundled-skills/trellis-meta/references/local-architecture/context-injection.md +5 -5
  234. package/dist/templates/common/bundled-skills/trellis-meta/references/local-architecture/spec-system.md +1 -1
  235. package/dist/templates/common/bundled-skills/trellis-meta/references/local-architecture/task-system.md +35 -6
  236. package/dist/templates/common/bundled-skills/trellis-meta/references/platform-files/agents.md +5 -4
  237. package/dist/templates/common/bundled-skills/trellis-spec-bootstarp/SKILL.md +41 -0
  238. package/dist/templates/common/bundled-skills/trellis-spec-bootstarp/references/mcp-setup.md +90 -0
  239. package/dist/templates/common/bundled-skills/trellis-spec-bootstarp/references/repository-analysis.md +59 -0
  240. package/dist/templates/common/bundled-skills/trellis-spec-bootstarp/references/spec-task-planning.md +61 -0
  241. package/dist/templates/common/bundled-skills/trellis-spec-bootstarp/references/spec-writing.md +70 -0
  242. package/dist/templates/common/commands/continue.md +6 -5
  243. package/dist/templates/common/commands/start.md +9 -6
  244. package/dist/templates/common/skills/before-dev.md +12 -6
  245. package/dist/templates/common/skills/brainstorm.md +68 -504
  246. package/dist/templates/common/skills/check.md +7 -1
  247. package/dist/templates/copilot/hooks/session-start.py +219 -101
  248. package/dist/templates/copilot/hooks.json +2 -2
  249. package/dist/templates/copilot/prompts/before-dev.prompt.md +12 -6
  250. package/dist/templates/copilot/prompts/brainstorm.prompt.md +69 -457
  251. package/dist/templates/copilot/prompts/check.prompt.md +86 -18
  252. package/dist/templates/copilot/prompts/parallel.prompt.md +16 -8
  253. package/dist/templates/copilot/prompts/start.prompt.md +33 -367
  254. package/dist/templates/cursor/agents/trellis-check.md +13 -7
  255. package/dist/templates/cursor/agents/trellis-implement.md +8 -7
  256. package/dist/templates/cursor/hooks.json +1 -7
  257. package/dist/templates/droid/droids/trellis-check.md +13 -7
  258. package/dist/templates/droid/droids/trellis-implement.md +8 -7
  259. package/dist/templates/droid/settings.json +4 -4
  260. package/dist/templates/gemini/agents/trellis-check.md +11 -5
  261. package/dist/templates/gemini/agents/trellis-implement.md +7 -6
  262. package/dist/templates/gemini/settings.json +2 -2
  263. package/dist/templates/kiro/agents/trellis-check.json +1 -1
  264. package/dist/templates/kiro/agents/trellis-implement.json +1 -1
  265. package/dist/templates/markdown/spec/guides/code-reuse-thinking-guide.md.txt +127 -9
  266. package/dist/templates/markdown/spec/guides/cross-layer-thinking-guide.md.txt +171 -6
  267. package/dist/templates/markdown/spec/guides/cross-platform-thinking-guide.md.txt +333 -43
  268. package/dist/templates/markdown/spec/guides/index.md.txt +18 -0
  269. package/dist/templates/opencode/agents/trellis-check.md +13 -7
  270. package/dist/templates/opencode/agents/trellis-implement.md +9 -8
  271. package/dist/templates/opencode/lib/session-utils.js +212 -123
  272. package/dist/templates/opencode/lib/trellis-context.js +73 -11
  273. package/dist/templates/opencode/plugins/inject-subagent-context.js +131 -29
  274. package/dist/templates/opencode/plugins/inject-workflow-state.js +9 -5
  275. package/dist/templates/opencode/plugins/session-start.js +9 -1
  276. package/dist/templates/pi/agents/trellis-check.md +5 -4
  277. package/dist/templates/pi/agents/trellis-implement.md +5 -4
  278. package/dist/templates/pi/extensions/trellis/index.ts.txt +1357 -754
  279. package/dist/templates/qoder/agents/trellis-check.md +11 -5
  280. package/dist/templates/qoder/agents/trellis-implement.md +7 -6
  281. package/dist/templates/qoder/settings.json +4 -4
  282. package/dist/templates/shared-hooks/index.d.ts.map +1 -1
  283. package/dist/templates/shared-hooks/index.js +0 -1
  284. package/dist/templates/shared-hooks/index.js.map +1 -1
  285. package/dist/templates/shared-hooks/inject-subagent-context.py +36 -14
  286. package/dist/templates/shared-hooks/inject-workflow-state.py +40 -42
  287. package/dist/templates/shared-hooks/session-start.py +222 -171
  288. package/dist/templates/trellis/config.yaml +38 -0
  289. package/dist/templates/trellis/index.d.ts +1 -0
  290. package/dist/templates/trellis/index.d.ts.map +1 -1
  291. package/dist/templates/trellis/index.js +2 -0
  292. package/dist/templates/trellis/index.js.map +1 -1
  293. package/dist/templates/trellis/scripts/add_session.py +50 -24
  294. package/dist/templates/trellis/scripts/common/config.py +57 -1
  295. package/dist/templates/trellis/scripts/common/safe_commit.py +285 -0
  296. package/dist/templates/trellis/scripts/common/session_context.py +384 -137
  297. package/dist/templates/trellis/scripts/common/task_context.py +3 -3
  298. package/dist/templates/trellis/scripts/common/task_store.py +161 -15
  299. package/dist/templates/trellis/scripts/common/workflow_phase.py +7 -10
  300. package/dist/templates/trellis/scripts/task.py +3 -3
  301. package/dist/templates/trellis/workflow.md +119 -98
  302. package/dist/utils/cwd-guard.d.ts +38 -0
  303. package/dist/utils/cwd-guard.d.ts.map +1 -0
  304. package/dist/utils/cwd-guard.js +62 -0
  305. package/dist/utils/cwd-guard.js.map +1 -0
  306. package/dist/utils/file-writer.d.ts +13 -0
  307. package/dist/utils/file-writer.d.ts.map +1 -1
  308. package/dist/utils/file-writer.js +59 -1
  309. package/dist/utils/file-writer.js.map +1 -1
  310. package/dist/utils/manifest-prune.d.ts +61 -0
  311. package/dist/utils/manifest-prune.d.ts.map +1 -0
  312. package/dist/utils/manifest-prune.js +136 -0
  313. package/dist/utils/manifest-prune.js.map +1 -0
  314. package/dist/utils/task-json.d.ts +9 -42
  315. package/dist/utils/task-json.d.ts.map +1 -1
  316. package/dist/utils/task-json.js +8 -45
  317. package/dist/utils/task-json.js.map +1 -1
  318. package/dist/utils/template-hash.d.ts +32 -6
  319. package/dist/utils/template-hash.d.ts.map +1 -1
  320. package/dist/utils/template-hash.js +53 -31
  321. package/dist/utils/template-hash.js.map +1 -1
  322. package/dist/utils/uninstall-scrubbers.d.ts +1 -0
  323. package/dist/utils/uninstall-scrubbers.d.ts.map +1 -1
  324. package/dist/utils/uninstall-scrubbers.js +21 -0
  325. package/dist/utils/uninstall-scrubbers.js.map +1 -1
  326. package/dist/utils/workflow-resolver.d.ts +86 -0
  327. package/dist/utils/workflow-resolver.d.ts.map +1 -0
  328. package/dist/utils/workflow-resolver.js +265 -0
  329. package/dist/utils/workflow-resolver.js.map +1 -0
  330. package/package.json +9 -8
@@ -39,7 +39,7 @@ python3 ./.trellis/scripts/get_context.py --mode packages # list packages / la
39
39
 
40
40
  ### Task System
41
41
 
42
- Every task has its own directory under `.trellis/tasks/{MM-DD-name}/` holding `prd.md`, `implement.jsonl`, `check.jsonl`, `task.json`, optional `research/`, `info.md`.
42
+ Every task has its own directory under `.trellis/tasks/{MM-DD-name}/` holding `task.json`, `prd.md`, optional `design.md`, optional `implement.md`, optional `research/`, and context manifests (`implement.jsonl`, `check.jsonl`) for sub-agent-capable platforms.
43
43
 
44
44
  ```bash
45
45
  # Task lifecycle
@@ -53,7 +53,7 @@ python3 ./.trellis/scripts/task.py list-archive
53
53
 
54
54
  # Code-spec context (injected into implement/check agents via JSONL).
55
55
  # `implement.jsonl` / `check.jsonl` are seeded on `task create` for sub-agent-capable
56
- # platforms; the AI curates real spec + research entries during Phase 1.3.
56
+ # platforms; the AI curates real spec + research entries during planning when needed.
57
57
  python3 ./.trellis/scripts/task.py add-context <name> <action> <file> <reason>
58
58
  python3 ./.trellis/scripts/task.py list-context <name> [action]
59
59
  python3 ./.trellis/scripts/task.py validate <name>
@@ -99,7 +99,7 @@ python3 ./.trellis/scripts/get_context.py --mode phase --step <X.Y> # detailed
99
99
  <!--
100
100
  WORKFLOW-STATE BREADCRUMB CONTRACT (read this before editing the tag blocks below)
101
101
 
102
- The 4 [workflow-state:STATUS] blocks embedded in the ## Phase Index section
102
+ The [workflow-state:STATUS] blocks embedded in the ## Phase Index section
103
103
  below are the SINGLE source of truth for the per-turn `<workflow-state>`
104
104
  breadcrumb that every supported AI platform's UserPromptSubmit hook
105
105
  reads. inject-workflow-state.py (Python platforms) and
@@ -114,15 +114,17 @@ python3 ./.trellis/scripts/get_context.py --mode phase --step <X.Y> # detailed
114
114
  Every workflow-walkthrough step marked `[required · once]` must have a
115
115
  matching enforcement line in its phase's [workflow-state:*] block. The
116
116
  breadcrumb is the only per-turn channel; if a mandatory step isn't
117
- mentioned there, the AI silently skips it (Phase 1.3 jsonl curation
117
+ mentioned there, the AI silently skips it (Phase 1 planning gate
118
118
  skip and Phase 3.4 commit skip both manifested via this gap).
119
119
 
120
120
  TAG ↔ PHASE scoping:
121
121
  [workflow-state:no_task] → no active task; before Phase 1
122
122
  [workflow-state:planning] → all of Phase 1 (status='planning')
123
+ [workflow-state:planning-inline] → Codex inline variant of Phase 1
123
124
  [workflow-state:in_progress] → Phase 2 + Phase 3.1-3.4
124
125
  (status stays 'in_progress' from
125
126
  task.py start until task.py archive)
127
+ [workflow-state:in_progress-inline] → Codex inline variant of Phase 2/3
126
128
  [workflow-state:completed] → currently DEAD: cmd_archive flips
127
129
  status and moves the dir in the same
128
130
  call, so the resolver loses the
@@ -142,45 +144,69 @@ python3 ./.trellis/scripts/get_context.py --mode phase --step <X.Y> # detailed
142
144
  ## Phase Index
143
145
 
144
146
  ```
145
- Phase 1: Plan → figure out what to do (brainstorm + research → prd.md)
146
- Phase 2: Execute → write code and pass quality checks
147
- Phase 3: Finish → distill lessons + wrap-up
147
+ Phase 1: Plan → classify, get task-creation consent, then write planning artifacts
148
+ Phase 2: Execute → implement only after task status is in_progress
149
+ Phase 3: Finish → verify, update spec, commit, and wrap up
148
150
  ```
149
151
 
152
+ ### Request Triage
153
+
154
+ - Simple conversation or small task: ask only whether this turn should create a Trellis task. If the user says no, skip Trellis for this session.
155
+ - Complex task: ask whether you may create a Trellis task and enter planning. If the user says no, do not do broad inline implementation; explain, clarify scope, or suggest a smaller split.
156
+ - User approval to create a task is not approval to start implementation. Planning still happens first.
157
+
158
+ ### Planning Artifacts
159
+
160
+ - `prd.md` — requirements, constraints, and acceptance criteria. Do not put technical design or execution checklists here.
161
+ - `design.md` — technical design for complex tasks: boundaries, contracts, data flow, tradeoffs, compatibility, rollout / rollback shape.
162
+ - `implement.md` — execution plan for complex tasks: ordered checklist, validation commands, review gates, and rollback points.
163
+ - `implement.jsonl` / `check.jsonl` — spec and research manifests for sub-agent context. They do not replace `implement.md`.
164
+ - Lightweight tasks may be PRD-only. Complex tasks must have `prd.md`, `design.md`, and `implement.md` before `task.py start`.
165
+
166
+ ### Parent / Child Task Trees
167
+
168
+ Use a parent task when one user request contains several independently verifiable deliverables. The parent task owns the source requirement set, the task map, cross-child acceptance criteria, and final integration review; it normally should not be the implementation target unless it also has direct work.
169
+
170
+ Use child tasks for deliverables that can be planned, implemented, checked, and archived independently. Parent/child structure is not a dependency system: if one child must wait for another, write that ordering in the child `prd.md` / `implement.md` and keep each child's acceptance criteria testable.
171
+
172
+ Create new children with `task.py create "<title>" --slug <name> --parent <parent-dir>`. Link existing tasks with `task.py add-subtask <parent> <child>`, and unlink mistakes with `task.py remove-subtask <parent> <child>`.
173
+
150
174
  <!-- Per-turn breadcrumb: shown when there is no active task (before Phase 1) -->
151
175
 
152
176
  [workflow-state:no_task]
153
- No active task. **A Direct answer** pure Q&A / explanation / lookup / chat; no file writes + one-line answer + repo reads 2 files → AI judges, no override needed.
154
- **B Create a task** — any implementation / code change / build / refactor work. Entry sequence: (1) `python3 ./.trellis/scripts/task.py create "<title>"` to create the task (status=planning, breadcrumb switches to [workflow-state:planning] for brainstorm + jsonl phase guidance) → (2) load `trellis-brainstorm` skill to discuss requirements with the user and iterate on prd.md → (3) once prd is done and jsonl is curated, run `task.py start <task-dir>` to enter [workflow-state:in_progress] for the implementation skeleton. **"It looks small" is NOT grounds for downgrading B to A or C**.
155
- **C Inline change** (per-turn only, escape hatch for B) — the user's CURRENT message MUST contain one of: "skip trellis" / "no task" / "just do it" / "don't create a task" / "跳过 trellis" / "别走流程" / "小修一下" / "直接改" / "先别建任务" → briefly acknowledge ("ok, skipping trellis flow this turn"), then inline. **Without seeing one of these phrases you must NOT inline on your own**; do not invent an override the user never said.
177
+ No active task. First classify the current turn and ask for task-creation consent before creating any Trellis task.
178
+ Simple conversation / small task: ask only whether this turn should create a Trellis task. If the user says no, skip Trellis for this session.
179
+ Complex task: ask the user if you can create a Trellis task and enter the planning phase. If the user says no, explain, clarify scope, or suggest a smaller split.
156
180
  [/workflow-state:no_task]
157
181
 
158
182
  ### Phase 1: Plan
159
- - 1.0 Create task `[required · once]` (just `task.py create`; status enters planning)
160
- - 1.1 Requirement exploration `[required · repeatable]`
183
+ - 1.0 Create task `[required · once]` (only after task-creation consent)
184
+ - 1.1 Requirement exploration `[required · repeatable]` (`prd.md`; complex tasks also need `design.md` + `implement.md`)
161
185
  - 1.2 Research `[optional · repeatable]`
162
- - 1.3 Configure context `[required · once]` — Claude Code, Cursor, OpenCode, Codex, Kiro, Gemini, Qoder, CodeBuddy, Copilot, Droid, Pi
163
- - 1.4 Activate task `[required · once]` (run `task.py start`; status → in_progress)
186
+ - 1.3 Configure context `[conditional · once]` — Claude Code, Cursor, OpenCode, Codex, Kiro, Gemini, Qoder, CodeBuddy, Copilot, Droid, Pi
187
+ - 1.4 Activate task `[required · once]` (review gate, then `task.py start`; status → in_progress)
164
188
  - 1.5 Completion criteria
165
189
 
166
190
  <!-- Per-turn breadcrumb: shown throughout Phase 1 (status='planning') -->
167
191
 
168
192
  [workflow-state:planning]
169
- Load the `trellis-brainstorm` skill and iterate on prd.md with the user.
170
- Phase 1.3 (required, once): before `task.py start`, you MUST curate `implement.jsonl` and `check.jsonl` list the spec / research files sub-agents need so they get the right context injected. You may skip only if the jsonl already has agent-curated entries (the seed `_example` row alone doesn't count).
171
- Then run `task.py start <task-dir>` to flip status to in_progress.
193
+ Load `trellis-brainstorm`; stay in planning.
194
+ Lightweight: `prd.md` can be enough. Complex: finish `prd.md`, `design.md`, and `implement.md`; ask for review before `task.py start`.
195
+ Multi-deliverable scope: consider a parent task plus independently verifiable child tasks; dependencies must be written in child artifacts, not implied by tree position.
196
+ Sub-agent mode: curate `implement.jsonl` and `check.jsonl` as spec/research manifests before start.
172
197
  [/workflow-state:planning]
173
198
 
174
199
  <!-- Per-turn breadcrumb: shown throughout Phase 1 when codex.dispatch_mode=inline.
175
200
  Codex-only opt-in alternate to [workflow-state:planning]. The main agent
176
- edits code directly in Phase 2, so Phase 1.3 jsonl curation is skipped —
201
+ edits code directly in Phase 2, so jsonl curation is skipped —
177
202
  the inline workflow loads `trellis-before-dev` instead of injecting JSONL
178
203
  into a sub-agent. -->
179
204
 
180
205
  [workflow-state:planning-inline]
181
- Load the `trellis-brainstorm` skill and iterate on prd.md with the user.
182
- Phase 1.3 jsonl curation is **skipped** in inline dispatch mode — the main session loads `trellis-before-dev` directly in Phase 2 and reads spec context itself, so there is no sub-agent to inject jsonl into.
183
- Then run `task.py start <task-dir>` to flip status to in_progress.
206
+ Load `trellis-brainstorm`; stay in planning.
207
+ Lightweight: `prd.md` can be enough. Complex: finish `prd.md`, `design.md`, and `implement.md`; ask for review before `task.py start`.
208
+ Multi-deliverable scope: consider a parent task plus independently verifiable child tasks; dependencies must be written in child artifacts, not implied by tree position.
209
+ Inline mode: skip jsonl curation; Phase 2 reads artifacts/specs via `trellis-before-dev`.
184
210
  [/workflow-state:planning-inline]
185
211
 
186
212
  ### Phase 2: Execute
@@ -194,12 +220,13 @@ Then run `task.py start <task-dir>` to flip status to in_progress.
194
220
  therefore must cover every required step from implementation through
195
221
  commit, including Phase 3.3 spec update and Phase 3.4 commit. -->
196
222
 
223
+ Sub-agent dispatch protocol applies to all platforms and all sub-agents, including class-2 Codex/Copilot/Gemini/Qoder and `trellis-research`: every dispatch prompt starts with `Active task: <task path from task.py current>` before role-specific instructions.
224
+
197
225
  [workflow-state:in_progress]
198
- **Flow**: trellis-implement trellis-check trellis-update-spec commit (Phase 3.4) → `/trellis:finish-work`.
199
- **Main-session default (no override)**: dispatch the `trellis-implement` / `trellis-check` sub-agents — the main agent does NOT edit code by default. Phase 3.4 commit (required, once): after trellis-update-spec, or whenever implementation is verifiably complete, the main agent **drives the commit** state the commit plan in user-facing text, then run `git commit` — BEFORE suggesting `/trellis:finish-work`. `/finish-work` refuses to run on a dirty working tree (paths outside `.trellis/workspace/` and `.trellis/tasks/`).
200
- **Sub-agent self-exemption**: if you are already running as `trellis-implement`, implement directly from the loaded task context and do NOT spawn another `trellis-implement`; if you are already running as `trellis-check`, review/fix directly and do NOT spawn another `trellis-check`. The default dispatch rule applies to the main session only.
201
- **Sub-agent dispatch protocol (all platforms, all sub-agents)**: When you spawn `trellis-implement` / `trellis-check` / `trellis-research`, your dispatch prompt **MUST** start with one line: `Active task: <task path from \`task.py current\`>`. No exceptions. On class-2 platforms (codex / copilot / gemini / qoder) the sub-agent depends on this line because there is no hook to inject task context. On class-1 platforms (claude / cursor / opencode / kiro / codebuddy / droid) the line is normally redundant — the hook injects context directly — but it serves as a critical fallback when the hook fails (Windows + Claude Code PreToolUse silent skip, `--continue` resume, fork distribution, hooks disabled, etc.). For `trellis-research`, the line tells the sub-agent which `{task_dir}/research/` to write into.
202
- **Inline override** (per-turn only, escape hatch for sub-agent dispatch): the user's CURRENT message MUST explicitly contain one of: "do it inline" / "no sub-agent" / "你直接改" / "别派 sub-agent" / "main session 写就行" / "不用 sub-agent". **Without seeing one of these phrases you must NOT inline on your own**; do not invent an override the user never said.
226
+ Tools: `trellis-implement` / `trellis-research` are sub-agent types only (Task/Agent tool, NOT Skill; there is no skill by these names). `trellis-update-spec` is a skill. `trellis-check` exists as both; prefer the Agent form when verifying after code changes.
227
+ Flow: `trellis-implement` -> `trellis-check` -> `trellis-update-spec` -> commit (Phase 3.4) -> `/trellis:finish-work`.
228
+ Main-session default: dispatch implement/check sub-agents. Sub-agent self-exemption: if already running as `trellis-implement`, do NOT spawn another `trellis-implement` or `trellis-check`; if already running as `trellis-check`, do NOT spawn another `trellis-check` or `trellis-implement`. Dispatch is main session only.
229
+ Dispatch prompt starts with `Active task: <task path from task.py current>`. Read context: jsonl entries -> `prd.md` -> `design.md if present` -> `implement.md if present`.
203
230
  [/workflow-state:in_progress]
204
231
 
205
232
  <!-- Per-turn breadcrumb: shown while status='in_progress' when
@@ -208,9 +235,9 @@ Then run `task.py start <task-dir>` to flip status to in_progress.
208
235
  instead of dispatching sub-agents. -->
209
236
 
210
237
  [workflow-state:in_progress-inline]
211
- **Flow** (inline mode): main session loads `trellis-before-dev` main session edits code → main session loads `trellis-check` run lint / type-check / tests → fix → `trellis-update-spec` commit (Phase 3.4) `/trellis:finish-work`.
212
- **Main-session default (inline dispatch_mode)**: the main agent edits code directly. Do NOT dispatch `trellis-implement` / `trellis-check` sub-agents. Load the `trellis-before-dev` skill before writing code; load the `trellis-check` skill before reporting completion.
213
- Phase 3.4 commit (required, once): after `trellis-update-spec`, or whenever implementation is verifiably complete, the main agent **drives the commit** — state the commit plan in user-facing text, then run `git commit` — BEFORE suggesting `/trellis:finish-work`. `/finish-work` refuses to run on a dirty working tree (paths outside `.trellis/workspace/` and `.trellis/tasks/`).
238
+ Flow: `trellis-before-dev` -> edit -> `trellis-check` -> validation -> `trellis-update-spec` -> commit (Phase 3.4) -> `/trellis:finish-work`.
239
+ Do not dispatch implement/check sub-agents in inline mode.
240
+ Read context: `prd.md` -> `design.md if present` -> `implement.md if present`, plus relevant spec/research loaded by skills.
214
241
  [/workflow-state:in_progress-inline]
215
242
 
216
243
  ### Phase 3: Finish
@@ -229,9 +256,7 @@ Phase 3.4 commit (required, once): after `trellis-update-spec`, or whenever impl
229
256
  channel as the live blocks. -->
230
257
 
231
258
  [workflow-state:completed]
232
- Code committed via Phase 3.4; run `/trellis:finish-work` to wrap up (archive the task + record session).
233
- If you reach this state with uncommitted code, return to Phase 3.4 first — `/finish-work` refuses to run on a dirty working tree.
234
- `task.py archive` deletes any runtime session files that still point at the archived task.
259
+ Code committed. Run `/trellis:finish-work`; if dirty, return to Phase 3.4 first.
235
260
  [/workflow-state:completed]
236
261
 
237
262
  ### Rules
@@ -240,60 +265,33 @@ If you reach this state with uncommitted code, return to Phase 3.4 first — `/f
240
265
  2. Run steps in order inside each Phase; `[required]` steps can't be skipped
241
266
  3. Phases can roll back (e.g., Execute reveals a prd defect → return to Plan to fix, then re-enter Execute)
242
267
  4. Steps tagged `[once]` are skipped if the output already exists; don't re-run
268
+ 5. Artifact presence informs the next step; missing `design.md` / `implement.md` is valid for lightweight tasks and incomplete planning for complex tasks.
243
269
 
244
- ### Skill Routing
270
+ ### Active Task Routing
245
271
 
246
- When a user request matches one of these intents, load the corresponding skill (or dispatch the corresponding sub-agent) first do not skip skills.
272
+ When a user request matches one of these intents inside an active task, route first, then load the detailed phase step if needed.
247
273
 
248
274
  [Claude Code, Cursor, OpenCode, codex-sub-agent, Kiro, Gemini, Qoder, CodeBuddy, Copilot, Droid, Pi]
249
275
 
250
- | User intent | Route |
251
- |---|---|
252
- | Wants a new feature / requirement unclear | `trellis-brainstorm` |
253
- | About to write code / start implementing | Dispatch the `trellis-implement` sub-agent per Phase 2.1 |
254
- | Finished writing / want to verify | Dispatch the `trellis-check` sub-agent per Phase 2.2 |
255
- | Stuck / fixed same bug several times | `trellis-break-loop` |
256
- | Spec needs update | `trellis-update-spec` |
257
-
258
- **Why `trellis-before-dev` is NOT in this table:** you are not the one writing code — the `trellis-implement` sub-agent is. Sub-agent platforms get spec context via `implement.jsonl` injection / prelude, not via the main thread loading `trellis-before-dev`.
276
+ - Planning or unclear requirements -> `trellis-brainstorm`.
277
+ - `in_progress` implementation/check -> dispatch `trellis-implement` / `trellis-check`.
278
+ - Repeated debugging -> `trellis-break-loop`; spec updates -> `trellis-update-spec`.
259
279
 
260
280
  [/Claude Code, Cursor, OpenCode, codex-sub-agent, Kiro, Gemini, Qoder, CodeBuddy, Copilot, Droid, Pi]
261
281
 
262
282
  [codex-inline, Kilo, Antigravity, Windsurf]
263
283
 
264
- | User intent | Skill |
265
- |---|---|
266
- | Wants a new feature / requirement unclear | `trellis-brainstorm` |
267
- | About to write code / start implementing | `trellis-before-dev` (then implement directly in the main session) |
268
- | Finished writing / want to verify | `trellis-check` |
269
- | Stuck / fixed same bug several times | `trellis-break-loop` |
270
- | Spec needs update | `trellis-update-spec` |
284
+ - Planning or unclear requirements -> `trellis-brainstorm`.
285
+ - Before editing -> `trellis-before-dev`; after editing -> `trellis-check`.
286
+ - Repeated debugging -> `trellis-break-loop`; spec updates -> `trellis-update-spec`.
271
287
 
272
288
  [/codex-inline, Kilo, Antigravity, Windsurf]
273
289
 
274
- ### DO NOT skip skills
290
+ ### Guardrails
275
291
 
276
- [Claude Code, Cursor, OpenCode, codex-sub-agent, Kiro, Gemini, Qoder, CodeBuddy, Copilot, Droid, Pi]
277
-
278
- | What you're thinking | Why it's wrong |
279
- |---|---|
280
- | "This is simple, I'll just code it in the main thread" | Dispatching `trellis-implement` is the cheap path; skipping it tempts you to write code in the main thread and lose spec context — sub-agents get `implement.jsonl` injected, you don't |
281
- | "I already thought it through in plan mode" | Plan-mode output lives in memory — sub-agents can't see it; must be persisted to prd.md |
282
- | "I already know the spec" | The spec may have been updated since you last read it; the sub-agent gets the fresh copy, you may not |
283
- | "Code first, check later" | `trellis-check` surfaces issues you won't notice yourself; earlier is cheaper |
284
-
285
- [/Claude Code, Cursor, OpenCode, codex-sub-agent, Kiro, Gemini, Qoder, CodeBuddy, Copilot, Droid, Pi]
286
-
287
- [codex-inline, Kilo, Antigravity, Windsurf]
288
-
289
- | What you're thinking | Why it's wrong |
290
- |---|---|
291
- | "This is simple, just code it" | Simple tasks often grow complex; `trellis-before-dev` takes under a minute and loads the spec context you'll need |
292
- | "I already thought it through in plan mode" | Plan-mode output lives in memory — must be persisted to prd.md before code |
293
- | "I already know the spec" | The spec may have been updated since you last read it; read again |
294
- | "Code first, check later" | `trellis-check` surfaces issues you won't notice yourself; earlier is cheaper |
295
-
296
- [/codex-inline, Kilo, Antigravity, Windsurf]
292
+ - Task creation approval is not implementation approval; implementation waits for `task.py start` after artifact review.
293
+ - PRD-only is valid for lightweight tasks; complex tasks need `design.md` + `implement.md`.
294
+ - Planning must be persisted to task artifacts; checks must run before reporting completion.
297
295
 
298
296
  ### Loading Step Detail
299
297
 
@@ -308,11 +306,11 @@ python3 ./.trellis/scripts/get_context.py --mode phase --step <step>
308
306
 
309
307
  ## Phase 1: Plan
310
308
 
311
- Goal: figure out what to build, produce a clear requirements doc and the context needed to implement it.
309
+ Goal: classify the request, get task-creation consent when a task is needed, and produce the planning artifacts required before implementation.
312
310
 
313
311
  #### 1.0 Create task `[required · once]`
314
312
 
315
- Create the task directory (status enters `planning`, the session active-task pointer auto-targets the new task when session identity is available):
313
+ Create the task directory only after task-creation consent. The command sets status to `planning`, writes `task.json`, creates a default `prd.md`, and auto-targets the new task when session identity is available:
316
314
 
317
315
  ```bash
318
316
  python3 ./.trellis/scripts/task.py create "<task title>" --slug <name>
@@ -320,9 +318,11 @@ python3 ./.trellis/scripts/task.py create "<task title>" --slug <name>
320
318
 
321
319
  `--slug` is the human-readable name only. Do **not** include the `MM-DD-` date prefix; `task.py create` adds that prefix automatically.
322
320
 
323
- After this command succeeds, the per-turn breadcrumb auto-switches to `[workflow-state:planning]`, telling the AI to enter the brainstorm + jsonl curation phase.
321
+ For task trees, create the parent task first and then create each child with `--parent <parent-dir>`. Do not start the parent just because children exist; start the child that owns the next independently verifiable deliverable.
322
+
323
+ After this command succeeds, the per-turn breadcrumb auto-switches to `[workflow-state:planning]`, telling the AI to stay in planning.
324
324
 
325
- ⚠️ **Run only `create` here — do not also run `start`**. `start` flips status to `in_progress`, which switches the breadcrumb to the implementation phase before brainstorm + jsonl are done — the AI will silently skip them. Save `start` for step 1.4, after jsonl curation is complete.
325
+ Run only `create` here — do not also run `start`. `start` flips status to `in_progress`, which switches the breadcrumb to the implementation phase before planning artifacts are reviewed. Save `start` for step 1.4.
326
326
 
327
327
  Skip when `python3 ./.trellis/scripts/task.py current --source` already points to a task.
328
328
 
@@ -335,8 +335,18 @@ The brainstorm skill will guide you to:
335
335
  - Prefer researching over asking the user
336
336
  - Prefer offering options over open-ended questions
337
337
  - Update `prd.md` immediately after each user answer
338
+ - Split large scopes into a parent task plus child tasks when the deliverables can be verified independently
339
+ - Keep `prd.md` focused on requirements and acceptance criteria
340
+ - For complex tasks, produce `design.md` and `implement.md` before implementation starts
338
341
 
339
- Return to this step whenever requirements change and revise `prd.md`.
342
+ When considering a parent/child split:
343
+ - Use a parent task when one request contains several independently verifiable deliverables.
344
+ - Parent tasks own source requirements, child-task mapping, cross-child acceptance criteria, and final integration review.
345
+ - Child tasks own actual deliverables that can be planned, implemented, checked, and archived independently.
346
+ - Parent/child structure is not a dependency system. If child B depends on child A, write that ordering in child B's `prd.md` / `implement.md`.
347
+ - Start the child task that owns the next deliverable. Do not start the parent unless the parent itself has direct implementation work.
348
+
349
+ Return to this step whenever requirements change and revise the relevant artifact.
340
350
 
341
351
  #### 1.2 Research `[optional · repeatable]`
342
352
 
@@ -371,7 +381,7 @@ Brainstorm and research can interleave freely — pause to research a technical
371
381
 
372
382
  [Claude Code, Cursor, OpenCode, codex-sub-agent, Kiro, Gemini, Qoder, CodeBuddy, Copilot, Droid, Pi]
373
383
 
374
- Curate `implement.jsonl` and `check.jsonl` so the Phase 2 sub-agents get the right spec context. These files were seeded on `task create` with a single self-describing `_example` line; your job here is to fill in real entries.
384
+ Curate `implement.jsonl` and `check.jsonl` so the Phase 2 sub-agents get the right spec/research context. These files were seeded on `task create` with a single self-describing `_example` line; your job here is to fill in real entries.
375
385
 
376
386
  **Location**: `{TASK_DIR}/implement.jsonl` and `{TASK_DIR}/check.jsonl` (already exist).
377
387
 
@@ -389,6 +399,8 @@ Curate `implement.jsonl` and `check.jsonl` so the Phase 2 sub-agents get the rig
389
399
  - `implement.jsonl` → specs + research the implement sub-agent needs to write code correctly
390
400
  - `check.jsonl` → specs for the check sub-agent (quality guidelines, check conventions, same research if needed)
391
401
 
402
+ These manifests do not replace `implement.md`. `implement.md` is the human-readable execution plan for a complex task; jsonl files only list context files to inject or load.
403
+
392
404
  **How to discover relevant specs**:
393
405
 
394
406
  ```bash
@@ -408,7 +420,7 @@ python3 ./.trellis/scripts/task.py add-context "$TASK_DIR" check "<path>" "<reas
408
420
 
409
421
  Delete the seed `_example` line once real entries exist (optional — it's skipped automatically by consumers).
410
422
 
411
- Skip when: `implement.jsonl` has agent-curated entries (the seed row alone doesn't count).
423
+ Skip when: `implement.jsonl` and `check.jsonl` have agent-curated entries (the seed row alone doesn't count).
412
424
 
413
425
  [/Claude Code, Cursor, OpenCode, codex-sub-agent, Kiro, Gemini, Qoder, CodeBuddy, Copilot, Droid, Pi]
414
426
 
@@ -420,12 +432,14 @@ Skip this step. Context is loaded directly by the `trellis-before-dev` skill in
420
432
 
421
433
  #### 1.4 Activate task `[required · once]`
422
434
 
423
- Once prd.md is complete and 1.3 jsonl curation is done, flip the task status to `in_progress`:
435
+ After artifact review, flip the task status to `in_progress`:
424
436
 
425
437
  ```bash
426
438
  python3 ./.trellis/scripts/task.py start <task-dir>
427
439
  ```
428
440
 
441
+ For lightweight tasks, `prd.md` can be enough. For complex tasks, `prd.md`, `design.md`, and `implement.md` must exist and be reviewed before start. On sub-agent-capable platforms, curate jsonl manifests when extra spec or research context is needed; seed-only manifests are tolerated by consumers.
442
+
429
443
  After this command succeeds, the breadcrumb auto-switches to `[workflow-state:in_progress]`, and the rest of Phase 2 / 3 follows.
430
444
 
431
445
  If `task.py start` errors with a session-identity message (no context key from hook input, `TRELLIS_CONTEXT_ID`, or platform-native session env), follow the hint in the error to set up session identity, then retry.
@@ -435,14 +449,15 @@ If `task.py start` errors with a session-identity message (no context key from h
435
449
  | Condition | Required |
436
450
  |------|:---:|
437
451
  | `prd.md` exists | ✅ |
438
- | User confirms requirements | ✅ |
452
+ | User confirms task should enter implementation | ✅ |
439
453
  | `task.py start` has been run (status = in_progress) | ✅ |
440
454
  | `research/` has artifacts (complex tasks) | recommended |
441
- | `info.md` technical design (complex tasks) | optional |
455
+ | `design.md` exists (complex tasks) | |
456
+ | `implement.md` exists (complex tasks) | ✅ |
442
457
 
443
458
  [Claude Code, Cursor, OpenCode, codex-sub-agent, Kiro, Gemini, Qoder, CodeBuddy, Copilot, Droid, Pi]
444
459
 
445
- | `implement.jsonl` has agent-curated entries (not just the seed row) | |
460
+ | `implement.jsonl` / `check.jsonl` curated when extra spec or research context is needed | recommended |
446
461
 
447
462
  [/Claude Code, Cursor, OpenCode, codex-sub-agent, Kiro, Gemini, Qoder, CodeBuddy, Copilot, Droid, Pi]
448
463
 
@@ -450,7 +465,7 @@ If `task.py start` errors with a session-identity message (no context key from h
450
465
 
451
466
  ## Phase 2: Execute
452
467
 
453
- Goal: turn the prd into code that passes quality checks.
468
+ Goal: turn reviewed planning artifacts into code that passes quality checks.
454
469
 
455
470
  #### 2.1 Implement `[required · repeatable]`
456
471
 
@@ -459,12 +474,12 @@ Goal: turn the prd into code that passes quality checks.
459
474
  Spawn the implement sub-agent:
460
475
 
461
476
  - **Agent type**: `trellis-implement`
462
- - **Task description**: Implement the requirements per prd.md, consulting materials under `{TASK_DIR}/research/`; finish by running project lint and type-check
477
+ - **Task description**: Implement the reviewed task artifacts, consulting materials under `{TASK_DIR}/research/`; finish by running project lint and type-check
463
478
  - **Dispatch prompt guard**: Tell the spawned agent it is already the `trellis-implement` sub-agent and must implement directly, not spawn another `trellis-implement` / `trellis-check`.
464
479
 
465
480
  The platform hook/plugin auto-handles:
466
- - Reads `implement.jsonl` and injects the referenced spec files into the agent prompt
467
- - Injects prd.md content
481
+ - Reads `implement.jsonl` and injects referenced spec/research files into the agent prompt
482
+ - Injects `prd.md`, `design.md` if present, and `implement.md` if present
468
483
 
469
484
  [/Claude Code, Cursor, OpenCode, Gemini, Qoder, CodeBuddy, Copilot, Droid, Pi]
470
485
 
@@ -473,12 +488,12 @@ The platform hook/plugin auto-handles:
473
488
  Spawn the implement sub-agent:
474
489
 
475
490
  - **Agent type**: `trellis-implement`
476
- - **Task description**: Implement the requirements per prd.md, consulting materials under `{TASK_DIR}/research/`; finish by running project lint and type-check
491
+ - **Task description**: Implement the reviewed task artifacts, consulting materials under `{TASK_DIR}/research/`; finish by running project lint and type-check
477
492
  - **Dispatch prompt guard**: The prompt MUST start with `Active task: <task path>`, then explicitly say the spawned agent is already `trellis-implement` and must implement directly without spawning another `trellis-implement` / `trellis-check`.
478
493
 
479
494
  The Codex sub-agent definition auto-handles the context load requirement:
480
- - Resolves the active task with `task.py current --source`, then reads `prd.md` and `info.md` if present
481
- - Reads `implement.jsonl` and requires the agent to load each referenced spec file before coding
495
+ - Resolves the active task with `task.py current --source`, then reads `prd.md`, `design.md` if present, and `implement.md` if present
496
+ - Reads `implement.jsonl` and requires the agent to load each referenced spec/research file before coding
482
497
 
483
498
  [/codex-sub-agent]
484
499
 
@@ -487,21 +502,21 @@ The Codex sub-agent definition auto-handles the context load requirement:
487
502
  Spawn the implement sub-agent:
488
503
 
489
504
  - **Agent type**: `trellis-implement`
490
- - **Task description**: Implement the requirements per prd.md, consulting materials under `{TASK_DIR}/research/`; finish by running project lint and type-check
505
+ - **Task description**: Implement the reviewed task artifacts, consulting materials under `{TASK_DIR}/research/`; finish by running project lint and type-check
491
506
  - **Dispatch prompt guard**: Tell the spawned agent it is already the `trellis-implement` sub-agent and must implement directly, not spawn another `trellis-implement` / `trellis-check`.
492
507
 
493
508
  The platform prelude auto-handles the context load requirement:
494
- - Reads `implement.jsonl` and injects the referenced spec files into the agent prompt
495
- - Injects prd.md content
509
+ - Reads `implement.jsonl` and injects referenced spec/research files into the agent prompt
510
+ - Injects `prd.md`, `design.md` if present, and `implement.md` if present
496
511
 
497
512
  [/Kiro]
498
513
 
499
514
  [codex-inline, Kilo, Antigravity, Windsurf]
500
515
 
501
516
  1. Load the `trellis-before-dev` skill to read project guidelines
502
- 2. Read `{TASK_DIR}/prd.md` for requirements
517
+ 2. Read `{TASK_DIR}/prd.md`, then `design.md` if present, then `implement.md` if present
503
518
  3. Consult materials under `{TASK_DIR}/research/`
504
- 4. Implement the code per requirements
519
+ 4. Implement the code per reviewed artifacts
505
520
  5. Run project lint and type-check
506
521
 
507
522
  [/codex-inline, Kilo, Antigravity, Windsurf]
@@ -513,11 +528,12 @@ The platform prelude auto-handles the context load requirement:
513
528
  Spawn the check sub-agent:
514
529
 
515
530
  - **Agent type**: `trellis-check`
516
- - **Task description**: Review all code changes against spec and prd; fix any findings directly; ensure lint and type-check pass
531
+ - **Task description**: Review all code changes against specs and task artifacts; fix any findings directly; ensure lint and type-check pass
517
532
  - **Dispatch prompt guard**: Tell the spawned agent it is already the `trellis-check` sub-agent and must review/fix directly, not spawn another `trellis-check` / `trellis-implement`.
518
533
 
519
534
  The check agent's job:
520
535
  - Review code changes against specs
536
+ - Review code changes against `prd.md`, `design.md` if present, and `implement.md` if present
521
537
  - Auto-fix issues it finds
522
538
  - Run lint and typecheck to verify
523
539
 
@@ -635,15 +651,20 @@ This section is for developers who want to modify the Trellis workflow itself. A
635
651
 
636
652
  ### Changing what a step means
637
653
 
638
- Edit the corresponding step's walkthrough body in the Phase 1 / 2 / 3 sections above. **Critical constraint**: if you change a step's `[required · once]` marker or add a new `[required · once]` step, you MUST also add a matching enforcement line to that phase's `[workflow-state:STATUS]` tag block — otherwise the per-turn breadcrumb omits the reinforcement, and the AI silently skips the step. The regression tests assert this.
654
+ Edit the corresponding step's walkthrough body in the Phase 1 / 2 / 3 sections above. Critical invariants:
655
+ - No active task must triage first and ask for task-creation consent before creating a Trellis task.
656
+ - Planning must distinguish lightweight PRD-only tasks from complex tasks that require `prd.md`, `design.md`, and `implement.md` before start.
657
+ - Every required execution path must keep the Phase 3.4 commit reminder reachable before `/trellis:finish-work`.
639
658
 
640
- All 4 tag blocks live in the `## Phase Index` section above, immediately after each phase summary:
659
+ All tag blocks live in the `## Phase Index` section above, immediately after each phase summary:
641
660
 
642
661
  | Scope | Corresponding tag |
643
662
  |---|---|
644
663
  | No active task (before Phase 1) | `[workflow-state:no_task]` (after the Phase Index ASCII art) |
645
664
  | All of Phase 1 (task created → ready for implementation) | `[workflow-state:planning]` (after Phase 1 summary) |
665
+ | Codex inline Phase 1 | `[workflow-state:planning-inline]` |
646
666
  | Phase 2 + Phase 3.1–3.4 (implementation + check + wrap-up) | `[workflow-state:in_progress]` (after Phase 2 summary) |
667
+ | Codex inline Phase 2 + Phase 3.1–3.4 | `[workflow-state:in_progress-inline]` |
647
668
  | After Phase 3.5 (archived) | `[workflow-state:completed]` (after Phase 3 summary; **currently DEAD**) |
648
669
 
649
670
  ### Changing the per-turn prompt text
@@ -0,0 +1,38 @@
1
+ /**
2
+ * Homedir guard for destructive commands (init, uninstall).
3
+ *
4
+ * Running `trellis init` / `trellis uninstall` in `$HOME` is catastrophic:
5
+ * platforms like Claude Code, Codex, OpenCode all store global runtime data
6
+ * (`.claude/projects/<sanitized-cwd>/*.jsonl` chat history, `.codex/sessions/`,
7
+ * `.opencode/` caches, etc.) directly in the user's home directory. If
8
+ * trellis manages the same `.{platform}/` config dirs and the hash manifest
9
+ * picks up runtime data, uninstall would later unlink it.
10
+ *
11
+ * Subdirectories of home (`~/Documents/projects/foo/`) are NOT blocked — only
12
+ * exact-home match.
13
+ *
14
+ * Bypass: `TRELLIS_ALLOW_HOMEDIR=1`.
15
+ */
16
+ /**
17
+ * Returns true if `process.cwd()` is exactly the user's home directory.
18
+ *
19
+ * Uses `realpathSync.native()` on both sides so symlinks, `..` segments, and
20
+ * case differences (Windows) don't confuse the comparison. On Windows the
21
+ * comparison is also case-insensitive — `C:\Users\Alice` matches
22
+ * `c:\users\alice`.
23
+ *
24
+ * Permissive on lookup failure: if realpath fails for any reason (broken
25
+ * symlink, EACCES, etc.) we return false so a safety check doesn't crash
26
+ * the command.
27
+ */
28
+ export declare function isCwdHomedir(): boolean;
29
+ /**
30
+ * Error message printed by both `trellis init` and `trellis uninstall` when
31
+ * the homedir guard trips.
32
+ */
33
+ export declare function homedirGuardMessage(commandName: "init" | "uninstall"): string;
34
+ /**
35
+ * Returns true when the bypass env var is set.
36
+ */
37
+ export declare function homedirBypassEnabled(): boolean;
38
+ //# sourceMappingURL=cwd-guard.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cwd-guard.d.ts","sourceRoot":"","sources":["../../src/utils/cwd-guard.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAKH;;;;;;;;;;;GAWG;AACH,wBAAgB,YAAY,IAAI,OAAO,CAYtC;AAED;;;GAGG;AACH,wBAAgB,mBAAmB,CAAC,WAAW,EAAE,MAAM,GAAG,WAAW,GAAG,MAAM,CAS7E;AAED;;GAEG;AACH,wBAAgB,oBAAoB,IAAI,OAAO,CAE9C"}
@@ -0,0 +1,62 @@
1
+ /**
2
+ * Homedir guard for destructive commands (init, uninstall).
3
+ *
4
+ * Running `trellis init` / `trellis uninstall` in `$HOME` is catastrophic:
5
+ * platforms like Claude Code, Codex, OpenCode all store global runtime data
6
+ * (`.claude/projects/<sanitized-cwd>/*.jsonl` chat history, `.codex/sessions/`,
7
+ * `.opencode/` caches, etc.) directly in the user's home directory. If
8
+ * trellis manages the same `.{platform}/` config dirs and the hash manifest
9
+ * picks up runtime data, uninstall would later unlink it.
10
+ *
11
+ * Subdirectories of home (`~/Documents/projects/foo/`) are NOT blocked — only
12
+ * exact-home match.
13
+ *
14
+ * Bypass: `TRELLIS_ALLOW_HOMEDIR=1`.
15
+ */
16
+ import { realpathSync } from "node:fs";
17
+ import * as os from "node:os";
18
+ /**
19
+ * Returns true if `process.cwd()` is exactly the user's home directory.
20
+ *
21
+ * Uses `realpathSync.native()` on both sides so symlinks, `..` segments, and
22
+ * case differences (Windows) don't confuse the comparison. On Windows the
23
+ * comparison is also case-insensitive — `C:\Users\Alice` matches
24
+ * `c:\users\alice`.
25
+ *
26
+ * Permissive on lookup failure: if realpath fails for any reason (broken
27
+ * symlink, EACCES, etc.) we return false so a safety check doesn't crash
28
+ * the command.
29
+ */
30
+ export function isCwdHomedir() {
31
+ try {
32
+ let cwd = realpathSync.native(process.cwd());
33
+ let home = realpathSync.native(os.homedir());
34
+ if (process.platform === "win32") {
35
+ cwd = cwd.toLowerCase();
36
+ home = home.toLowerCase();
37
+ }
38
+ return cwd === home;
39
+ }
40
+ catch {
41
+ return false;
42
+ }
43
+ }
44
+ /**
45
+ * Error message printed by both `trellis init` and `trellis uninstall` when
46
+ * the homedir guard trips.
47
+ */
48
+ export function homedirGuardMessage(commandName) {
49
+ return (`✗ Refusing to run \`trellis ${commandName}\` in your home directory.\n\n` +
50
+ `Trellis manages platform config dirs like .claude/, .codex/, .opencode/, which\n` +
51
+ `in your home directory also contain runtime data from those CLIs (chat history,\n` +
52
+ `session JSONLs, caches). Running here can wipe that data.\n\n` +
53
+ `Run trellis from your project directory instead. If you really want to run in\n` +
54
+ `$HOME, set TRELLIS_ALLOW_HOMEDIR=1.`);
55
+ }
56
+ /**
57
+ * Returns true when the bypass env var is set.
58
+ */
59
+ export function homedirBypassEnabled() {
60
+ return process.env.TRELLIS_ALLOW_HOMEDIR === "1";
61
+ }
62
+ //# sourceMappingURL=cwd-guard.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cwd-guard.js","sourceRoot":"","sources":["../../src/utils/cwd-guard.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAE9B;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,YAAY;IAC1B,IAAI,CAAC;QACH,IAAI,GAAG,GAAG,YAAY,CAAC,MAAM,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC;QAC7C,IAAI,IAAI,GAAG,YAAY,CAAC,MAAM,CAAC,EAAE,CAAC,OAAO,EAAE,CAAC,CAAC;QAC7C,IAAI,OAAO,CAAC,QAAQ,KAAK,OAAO,EAAE,CAAC;YACjC,GAAG,GAAG,GAAG,CAAC,WAAW,EAAE,CAAC;YACxB,IAAI,GAAG,IAAI,CAAC,WAAW,EAAE,CAAC;QAC5B,CAAC;QACD,OAAO,GAAG,KAAK,IAAI,CAAC;IACtB,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,KAAK,CAAC;IACf,CAAC;AACH,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,mBAAmB,CAAC,WAAiC;IACnE,OAAO,CACL,+BAA+B,WAAW,gCAAgC;QAC1E,kFAAkF;QAClF,mFAAmF;QACnF,+DAA+D;QAC/D,iFAAiF;QACjF,qCAAqC,CACtC,CAAC;AACJ,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,oBAAoB;IAClC,OAAO,OAAO,CAAC,GAAG,CAAC,qBAAqB,KAAK,GAAG,CAAC;AACnD,CAAC"}
@@ -4,6 +4,19 @@ export interface WriteOptions {
4
4
  }
5
5
  export declare function setWriteMode(mode: WriteMode): void;
6
6
  export declare function getWriteMode(): WriteMode;
7
+ /**
8
+ * Begin recording every write into the returned Set. Calls accumulate into the
9
+ * same set until `stopRecordingWrites` runs. POSIX relative paths (relative to
10
+ * `cwd`) are stored, matching `.template-hashes.json` keys.
11
+ *
12
+ * Nested recording sessions are NOT supported — the caller must ensure
13
+ * `stopRecordingWrites` runs before the next `startRecordingWrites`. Failure
14
+ * is silent (the second `start` replaces the first set), so callers should
15
+ * always pair start/stop in try/finally.
16
+ */
17
+ export declare function startRecordingWrites(cwd: string): Set<string>;
18
+ /** End recording. Subsequent writes are not captured until `start` is called again. */
19
+ export declare function stopRecordingWrites(): void;
7
20
  /**
8
21
  * Write file with conflict handling
9
22
  * - If file doesn't exist: write directly
@@ -1 +1 @@
1
- {"version":3,"file":"file-writer.d.ts","sourceRoot":"","sources":["../../src/utils/file-writer.ts"],"names":[],"mappings":"AAKA,MAAM,MAAM,SAAS,GAAG,KAAK,GAAG,OAAO,GAAG,MAAM,GAAG,QAAQ,CAAC;AAE5D,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,SAAS,CAAC;CACjB;AASD,wBAAgB,YAAY,CAAC,IAAI,EAAE,SAAS,GAAG,IAAI,CAElD;AAED,wBAAgB,YAAY,IAAI,SAAS,CAExC;AA6BD;;;;;;;;GAQG;AACH,wBAAsB,SAAS,CAC7B,QAAQ,EAAE,MAAM,EAChB,OAAO,EAAE,MAAM,EACf,OAAO,CAAC,EAAE;IAAE,UAAU,CAAC,EAAE,OAAO,CAAA;CAAE,GACjC,OAAO,CAAC,OAAO,CAAC,CA8GlB;AAED;;GAEG;AACH,wBAAgB,SAAS,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAE/C"}
1
+ {"version":3,"file":"file-writer.d.ts","sourceRoot":"","sources":["../../src/utils/file-writer.ts"],"names":[],"mappings":"AAOA,MAAM,MAAM,SAAS,GAAG,KAAK,GAAG,OAAO,GAAG,MAAM,GAAG,QAAQ,CAAC;AAE5D,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,SAAS,CAAC;CACjB;AASD,wBAAgB,YAAY,CAAC,IAAI,EAAE,SAAS,GAAG,IAAI,CAElD;AAED,wBAAgB,YAAY,IAAI,SAAS,CAExC;AAkBD;;;;;;;;;GASG;AACH,wBAAgB,oBAAoB,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC,MAAM,CAAC,CAK7D;AAED,uFAAuF;AACvF,wBAAgB,mBAAmB,IAAI,IAAI,CAG1C;AAsCD;;;;;;;;GAQG;AACH,wBAAsB,SAAS,CAC7B,QAAQ,EAAE,MAAM,EAChB,OAAO,EAAE,MAAM,EACf,OAAO,CAAC,EAAE;IAAE,UAAU,CAAC,EAAE,OAAO,CAAA;CAAE,GACjC,OAAO,CAAC,OAAO,CAAC,CA0HlB;AAED;;GAEG;AACH,wBAAgB,SAAS,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAE/C"}