@pennixrv/trellis 0.7.0-beta.5 → 0.7.0-beta.50

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 (219) hide show
  1. package/dist/cli/index.d.ts.map +1 -1
  2. package/dist/cli/index.js +47 -3
  3. package/dist/cli/index.js.map +1 -1
  4. package/dist/commands/backup.d.ts +25 -0
  5. package/dist/commands/backup.d.ts.map +1 -0
  6. package/dist/commands/backup.js +152 -0
  7. package/dist/commands/backup.js.map +1 -0
  8. package/dist/commands/channel/adapters/claude.d.ts.map +1 -1
  9. package/dist/commands/channel/adapters/claude.js +2 -0
  10. package/dist/commands/channel/adapters/claude.js.map +1 -1
  11. package/dist/commands/channel/adapters/codex.d.ts +5 -1
  12. package/dist/commands/channel/adapters/codex.d.ts.map +1 -1
  13. package/dist/commands/channel/adapters/codex.js +19 -9
  14. package/dist/commands/channel/adapters/codex.js.map +1 -1
  15. package/dist/commands/channel/adapters/index.d.ts +3 -0
  16. package/dist/commands/channel/adapters/index.d.ts.map +1 -1
  17. package/dist/commands/channel/adapters/index.js +3 -3
  18. package/dist/commands/channel/adapters/index.js.map +1 -1
  19. package/dist/commands/channel/adapters/types.d.ts +2 -0
  20. package/dist/commands/channel/adapters/types.d.ts.map +1 -1
  21. package/dist/commands/channel/guard.d.ts.map +1 -1
  22. package/dist/commands/channel/guard.js +38 -29
  23. package/dist/commands/channel/guard.js.map +1 -1
  24. package/dist/commands/channel/index.d.ts.map +1 -1
  25. package/dist/commands/channel/index.js +52 -16
  26. package/dist/commands/channel/index.js.map +1 -1
  27. package/dist/commands/channel/kill.d.ts.map +1 -1
  28. package/dist/commands/channel/kill.js +37 -15
  29. package/dist/commands/channel/kill.js.map +1 -1
  30. package/dist/commands/channel/messages.d.ts.map +1 -1
  31. package/dist/commands/channel/messages.js +3 -2
  32. package/dist/commands/channel/messages.js.map +1 -1
  33. package/dist/commands/channel/process-identity.d.ts +3 -0
  34. package/dist/commands/channel/process-identity.d.ts.map +1 -0
  35. package/dist/commands/channel/process-identity.js +24 -0
  36. package/dist/commands/channel/process-identity.js.map +1 -0
  37. package/dist/commands/channel/profiles.d.ts +26 -0
  38. package/dist/commands/channel/profiles.d.ts.map +1 -0
  39. package/dist/commands/channel/profiles.js +186 -0
  40. package/dist/commands/channel/profiles.js.map +1 -0
  41. package/dist/commands/channel/rm.d.ts +0 -1
  42. package/dist/commands/channel/rm.d.ts.map +1 -1
  43. package/dist/commands/channel/rm.js +203 -96
  44. package/dist/commands/channel/rm.js.map +1 -1
  45. package/dist/commands/channel/spawn.d.ts +3 -0
  46. package/dist/commands/channel/spawn.d.ts.map +1 -1
  47. package/dist/commands/channel/spawn.js +43 -15
  48. package/dist/commands/channel/spawn.js.map +1 -1
  49. package/dist/commands/channel/supervisor/idle.d.ts +2 -0
  50. package/dist/commands/channel/supervisor/idle.d.ts.map +1 -1
  51. package/dist/commands/channel/supervisor/idle.js +15 -7
  52. package/dist/commands/channel/supervisor/idle.js.map +1 -1
  53. package/dist/commands/channel/supervisor/inbox.d.ts.map +1 -1
  54. package/dist/commands/channel/supervisor/inbox.js +48 -33
  55. package/dist/commands/channel/supervisor/inbox.js.map +1 -1
  56. package/dist/commands/channel/supervisor/stdout.d.ts.map +1 -1
  57. package/dist/commands/channel/supervisor/stdout.js +6 -3
  58. package/dist/commands/channel/supervisor/stdout.js.map +1 -1
  59. package/dist/commands/channel/supervisor/warning.d.ts.map +1 -1
  60. package/dist/commands/channel/supervisor/warning.js +2 -3
  61. package/dist/commands/channel/supervisor/warning.js.map +1 -1
  62. package/dist/commands/channel/supervisor.d.ts +12 -0
  63. package/dist/commands/channel/supervisor.d.ts.map +1 -1
  64. package/dist/commands/channel/supervisor.js +88 -16
  65. package/dist/commands/channel/supervisor.js.map +1 -1
  66. package/dist/commands/channel/wait.d.ts +3 -1
  67. package/dist/commands/channel/wait.d.ts.map +1 -1
  68. package/dist/commands/channel/wait.js +59 -14
  69. package/dist/commands/channel/wait.js.map +1 -1
  70. package/dist/commands/init.d.ts.map +1 -1
  71. package/dist/commands/init.js +23 -10
  72. package/dist/commands/init.js.map +1 -1
  73. package/dist/commands/update.d.ts.map +1 -1
  74. package/dist/commands/update.js +446 -333
  75. package/dist/commands/update.js.map +1 -1
  76. package/dist/commands/workflow.d.ts +1 -0
  77. package/dist/commands/workflow.d.ts.map +1 -1
  78. package/dist/commands/workflow.js +56 -1
  79. package/dist/commands/workflow.js.map +1 -1
  80. package/dist/configurators/codex.d.ts +6 -0
  81. package/dist/configurators/codex.d.ts.map +1 -1
  82. package/dist/configurators/codex.js +93 -0
  83. package/dist/configurators/codex.js.map +1 -1
  84. package/dist/configurators/shared.js +2 -2
  85. package/dist/configurators/shared.js.map +1 -1
  86. package/dist/constants/paths.d.ts +2 -0
  87. package/dist/constants/paths.d.ts.map +1 -1
  88. package/dist/constants/paths.js +2 -0
  89. package/dist/constants/paths.js.map +1 -1
  90. package/dist/migrations/manifests/0.7.0-beta.10.json +9 -0
  91. package/dist/migrations/manifests/0.7.0-beta.11.json +9 -0
  92. package/dist/migrations/manifests/0.7.0-beta.12.json +9 -0
  93. package/dist/migrations/manifests/0.7.0-beta.13.json +9 -0
  94. package/dist/migrations/manifests/0.7.0-beta.14.json +9 -0
  95. package/dist/migrations/manifests/0.7.0-beta.15.json +9 -0
  96. package/dist/migrations/manifests/0.7.0-beta.16.json +9 -0
  97. package/dist/migrations/manifests/0.7.0-beta.17.json +9 -0
  98. package/dist/migrations/manifests/0.7.0-beta.18.json +9 -0
  99. package/dist/migrations/manifests/0.7.0-beta.19.json +9 -0
  100. package/dist/migrations/manifests/0.7.0-beta.20.json +9 -0
  101. package/dist/migrations/manifests/0.7.0-beta.21.json +17 -0
  102. package/dist/migrations/manifests/0.7.0-beta.22.json +9 -0
  103. package/dist/migrations/manifests/0.7.0-beta.23.json +9 -0
  104. package/dist/migrations/manifests/0.7.0-beta.24.json +9 -0
  105. package/dist/migrations/manifests/0.7.0-beta.25.json +9 -0
  106. package/dist/migrations/manifests/0.7.0-beta.26.json +9 -0
  107. package/dist/migrations/manifests/0.7.0-beta.27.json +9 -0
  108. package/dist/migrations/manifests/0.7.0-beta.28.json +9 -0
  109. package/dist/migrations/manifests/0.7.0-beta.29.json +9 -0
  110. package/dist/migrations/manifests/0.7.0-beta.30.json +9 -0
  111. package/dist/migrations/manifests/0.7.0-beta.31.json +9 -0
  112. package/dist/migrations/manifests/0.7.0-beta.32.json +9 -0
  113. package/dist/migrations/manifests/0.7.0-beta.33.json +9 -0
  114. package/dist/migrations/manifests/0.7.0-beta.34.json +9 -0
  115. package/dist/migrations/manifests/0.7.0-beta.35.json +9 -0
  116. package/dist/migrations/manifests/0.7.0-beta.36.json +9 -0
  117. package/dist/migrations/manifests/0.7.0-beta.37.json +9 -0
  118. package/dist/migrations/manifests/0.7.0-beta.38.json +9 -0
  119. package/dist/migrations/manifests/0.7.0-beta.39.json +9 -0
  120. package/dist/migrations/manifests/0.7.0-beta.40.json +9 -0
  121. package/dist/migrations/manifests/0.7.0-beta.41.json +9 -0
  122. package/dist/migrations/manifests/0.7.0-beta.42.json +9 -0
  123. package/dist/migrations/manifests/0.7.0-beta.43.json +9 -0
  124. package/dist/migrations/manifests/0.7.0-beta.44.json +9 -0
  125. package/dist/migrations/manifests/0.7.0-beta.45.json +9 -0
  126. package/dist/migrations/manifests/0.7.0-beta.46.json +9 -0
  127. package/dist/migrations/manifests/0.7.0-beta.47.json +9 -0
  128. package/dist/migrations/manifests/0.7.0-beta.48.json +9 -0
  129. package/dist/migrations/manifests/0.7.0-beta.49.json +13 -0
  130. package/dist/migrations/manifests/0.7.0-beta.50.json +12 -0
  131. package/dist/migrations/manifests/0.7.0-beta.6.json +9 -0
  132. package/dist/migrations/manifests/0.7.0-beta.7.json +9 -0
  133. package/dist/migrations/manifests/0.7.0-beta.8.json +9 -0
  134. package/dist/migrations/manifests/0.7.0-beta.9.json +9 -0
  135. package/dist/templates/codex/hooks/session-start.py +21 -17
  136. package/dist/templates/common/bundled-skills/trellis-channel/SKILL.md +3 -1
  137. package/dist/templates/common/bundled-skills/trellis-channel/references/command-reference.md +24 -16
  138. package/dist/templates/common/bundled-skills/trellis-channel/references/forum.md +4 -12
  139. package/dist/templates/common/bundled-skills/trellis-channel/references/multi-target-dispatch.md +139 -0
  140. package/dist/templates/common/bundled-skills/trellis-channel/references/progress-debugging.md +9 -5
  141. package/dist/templates/common/bundled-skills/trellis-channel/references/subnode-work.md +84 -14
  142. package/dist/templates/common/bundled-skills/trellis-channel/references/workers.md +9 -11
  143. package/dist/templates/common/bundled-skills/trellis-channel/references/workflows.md +25 -14
  144. package/dist/templates/common/bundled-skills/trellis-meta/references/customize-local/change-skills-or-commands.md +13 -11
  145. package/dist/templates/common/bundled-skills/trellis-meta/references/customize-local/change-task-lifecycle.md +7 -2
  146. package/dist/templates/common/bundled-skills/trellis-meta/references/local-architecture/task-system.md +6 -1
  147. package/dist/templates/common/bundled-skills/trellis-meta/references/local-architecture/workflow.md +6 -4
  148. package/dist/templates/common/bundled-skills/trellis-session-insight/SKILL.md +42 -3
  149. package/dist/templates/common/bundled-skills/trellis-session-insight/references/cli-quick-reference.md +1 -1
  150. package/dist/templates/common/bundled-skills/trellis-session-insight/references/triggering-patterns.md +10 -2
  151. package/dist/templates/common/commands/continue.md +36 -8
  152. package/dist/templates/common/commands/finish-work.md +17 -2
  153. package/dist/templates/common/commands/start.md +8 -1
  154. package/dist/templates/common/skills/brainstorm.md +49 -22
  155. package/dist/templates/common/skills/break-loop.md +6 -10
  156. package/dist/templates/common/skills/check.md +34 -5
  157. package/dist/templates/copilot/hooks/session-start.py +19 -15
  158. package/dist/templates/copilot/prompts/brainstorm.prompt.md +27 -21
  159. package/dist/templates/markdown/spec/backend/database-guidelines.md.txt +22 -22
  160. package/dist/templates/markdown/spec/backend/directory-structure.md.txt +20 -20
  161. package/dist/templates/markdown/spec/backend/error-handling.md.txt +22 -22
  162. package/dist/templates/markdown/spec/backend/index.md.txt +19 -19
  163. package/dist/templates/markdown/spec/backend/logging-guidelines.md.txt +22 -22
  164. package/dist/templates/markdown/spec/backend/quality-guidelines.md.txt +22 -22
  165. package/dist/templates/markdown/spec/frontend/component-guidelines.md.txt +25 -25
  166. package/dist/templates/markdown/spec/frontend/directory-structure.md.txt +20 -20
  167. package/dist/templates/markdown/spec/frontend/hook-guidelines.md.txt +22 -22
  168. package/dist/templates/markdown/spec/frontend/index.md.txt +20 -20
  169. package/dist/templates/markdown/spec/frontend/quality-guidelines.md.txt +22 -22
  170. package/dist/templates/markdown/spec/frontend/state-management.md.txt +22 -22
  171. package/dist/templates/markdown/spec/frontend/type-safety.md.txt +22 -22
  172. package/dist/templates/markdown/spec/guides/code-reuse-thinking-guide.md.txt +80 -85
  173. package/dist/templates/markdown/spec/guides/cross-layer-thinking-guide.md.txt +164 -209
  174. package/dist/templates/markdown/spec/guides/cross-platform-thinking-guide.md.txt +161 -185
  175. package/dist/templates/markdown/spec/guides/index.md.txt +51 -51
  176. package/dist/templates/markdown/workspace-index.md +44 -44
  177. package/dist/templates/opencode/lib/session-utils.js +2 -2
  178. package/dist/templates/shared-hooks/inject-shell-session-context.py +3 -6
  179. package/dist/templates/shared-hooks/inject-workflow-state.py +3 -2
  180. package/dist/templates/shared-hooks/session-start.py +23 -18
  181. package/dist/templates/trellis/agents/subnode-profiles.json +13 -0
  182. package/dist/templates/trellis/agents/subnode.md +11 -5
  183. package/dist/templates/trellis/config.yaml +2 -0
  184. package/dist/templates/trellis/index.d.ts +2 -1
  185. package/dist/templates/trellis/index.d.ts.map +1 -1
  186. package/dist/templates/trellis/index.js +4 -2
  187. package/dist/templates/trellis/index.js.map +1 -1
  188. package/dist/templates/trellis/scripts/add_session.py +35 -32
  189. package/dist/templates/trellis/scripts/common/active_task.py +8 -8
  190. package/dist/templates/trellis/scripts/common/developer.py +18 -18
  191. package/dist/templates/trellis/scripts/common/ownership_record.py +13 -8
  192. package/dist/templates/trellis/scripts/common/safe_commit.py +38 -9
  193. package/dist/templates/trellis/scripts/common/task_planning.py +137 -0
  194. package/dist/templates/trellis/scripts/common/task_store.py +46 -14
  195. package/dist/templates/trellis/scripts/common/workflow_phase.py +4 -3
  196. package/dist/templates/trellis/scripts/subnode_artifact.py +470 -21
  197. package/dist/templates/trellis/scripts/task.py +175 -2
  198. package/dist/templates/trellis/workflow.md +407 -388
  199. package/dist/utils/managed-paths.d.ts +2 -0
  200. package/dist/utils/managed-paths.d.ts.map +1 -1
  201. package/dist/utils/managed-paths.js +24 -2
  202. package/dist/utils/managed-paths.js.map +1 -1
  203. package/dist/utils/template-fetcher.d.ts +1 -0
  204. package/dist/utils/template-fetcher.d.ts.map +1 -1
  205. package/dist/utils/template-fetcher.js +2 -1
  206. package/dist/utils/template-fetcher.js.map +1 -1
  207. package/dist/utils/uninstall-scrubbers.d.ts.map +1 -1
  208. package/dist/utils/uninstall-scrubbers.js +5 -0
  209. package/dist/utils/uninstall-scrubbers.js.map +1 -1
  210. package/dist/utils/workflow-provenance.d.ts +24 -0
  211. package/dist/utils/workflow-provenance.d.ts.map +1 -0
  212. package/dist/utils/workflow-provenance.js +71 -0
  213. package/dist/utils/workflow-provenance.js.map +1 -0
  214. package/dist/utils/workflow-resolver.d.ts +9 -2
  215. package/dist/utils/workflow-resolver.d.ts.map +1 -1
  216. package/dist/utils/workflow-resolver.js +33 -7
  217. package/dist/utils/workflow-resolver.js.map +1 -1
  218. package/package.json +2 -2
  219. package/dist/templates/trellis/agents/subnode.env +0 -4
@@ -1,50 +1,72 @@
1
- # Development Workflow
1
+ # 开发工作流(Development Workflow)
2
2
 
3
3
  ---
4
4
 
5
- ## Core Principles
5
+ ## 核心原则(Core Principles)
6
6
 
7
- 1. **Plan before code** — figure out what to do before you start
8
- 2. **Specs injected, not remembered** — guidelines are injected via hook/skill, not recalled from memory
9
- 3. **Persist everything** — research, decisions, and lessons all go to files; conversations get compacted, files don't
10
- 4. **Incremental development** — one task at a time
11
- 5. **Capture learnings** — after each task, review and write new knowledge back to spec
7
+ 1. **先规划再编码**——开始前先明确要做什么。
8
+ 2. **注入规范而不是凭记忆遵守**——指南通过 Hook/Skill 注入,而不是从记忆中调用。
9
+ 3. **全部持久化**——研究、决策和经验都写入文件;对话会压缩,文件不会。
10
+ 4. **增量开发**——一次推进一个任务。
11
+ 5. **记录经验**——每个任务完成后复盘,并将新知识写回 spec。
12
12
 
13
13
  ---
14
14
 
15
- ## Trellis System
15
+ ### 继续与压缩恢复(Continuation and Compaction)
16
16
 
17
- ### Developer Identity
17
+ 根目录、任务、阶段、授权和待执行动作已知时,复用当前对话或足够的压缩检查点。普通继续直接恢复该动作,不重复启动、任务/Git/历史或交接核验。新会话、目标变化或用户明确要求检查时,只查询缺失或冲突事实。原生受保护写入保留 owner 身份和所有权检查。不要重复或重答压缩前已经消费的用户输入;真正的新输入按正常流程处理。不增加恢复缓存或额外等待器。
18
18
 
19
- On first use, initialize your identity:
19
+ ## 方案批准与任务选择(Plan Approval And Task Selection)
20
+
21
+ 显式将任务元数据分类为 `execution_class=direct|planned` 和 `delivery_mode=change_bearing|analysis_only`;未分类的旧 planning 任务需在 start 前补一次分类。直接小任务和符合条件的 analysis-only 任务保留现有最短路径。已有 in_progress 任务不重置。
22
+
23
+ 除边界清晰的研究外,使用 `pennix-decision-grill` 筛选涉及用户实质取舍的选择;一个实质选择即可触发。它负责渐进提问方法,不负责任务生命周期。先处理依赖已满足且有证据支撑的选择,再处理影响和优先级;一次询问一至三个相互独立且连贯的决策,回答后重新评估。不要询问可直接查明的事实或已经确定的实现细节。在执行有界本地/网络证据工作或明确批准独立子节点前保存决策检查点。可执行前沿为空可能表示缺少证据,不表示方案已封口。
24
+
25
+ 对于 planned/change-bearing 工作,先收敛决策和必要任务资产,运行原生 `task.py plan seal <task>`,展示实质方案并停在实施前。只有之后用户明确批准**当前任务当前封口版本**,才可运行 `task.py plan approve <task> --revision <n> --basis "<简短且不含敏感信息的实际批准依据>"`,然后运行 `task.py start`。最初的交付请求、父任务批准和设计答复都不构成实施批准。`--allow-empty-context` 只覆盖上下文清单,不覆盖批准门禁。原生记录负责结构约束,对话真实性仍由 Agent 负责。
26
+
27
+ 实质范围、owner、风险、公开行为或验收变化必须运行 `task.py replan`,重新封口、展示并取得新版本批准。对已封口的 planning 任务重新封口会产生新的实质版本。措辞、格式、进度和执行证据不会自动使封口失效。通用 create/set-meta 不能预填保留的 `meta.planning` 记录。
28
+
29
+ 用户明确要求向 `in_progress` 任务增加内容时,只有该内容服务于同一任务、保持实际 owner 和目标不变、规模小、可逆且风险低,并且实质上不改变已封口的范围、owner、风险、公开行为、数据完整性、凭据、部署/发布路径或验收,才可在当前阶段继续。将请求、分类、owner、验收和验证写入未封口执行记录;该请求只授权这一项明确增加的内容。任何条件不满足或不清楚时,保留当前结论,记录 `decision-needed`,使用原生 `task.py replan`,走重新封口和后续批准路径。
30
+
31
+ 使用原生 `task.py select <task>` 只选择上下文:它不改变阶段或分支,不触发 after_start Hook,也不授予实施权限。`create --no-start` 有意保留之前的指针。切换前保存旧检查点;存在活动 Channel 工作时,按 `trellis-channel` 的多目标流程暂停补充并排空已派发单元和预留,保留待处理单元及旧阶段。不要终止/重试或自动重启用户停止的任务。普通继续/压缩恢复保留检查点快速路径。
32
+
33
+ ## Trellis 系统(Trellis System)
34
+
35
+ ### 开发者身份(Developer Identity)
36
+
37
+ 首次使用时初始化身份:
20
38
 
21
39
  ```bash
22
40
  python3 ./.trellis/scripts/init_developer.py <your-name>
23
41
  ```
24
42
 
25
- Creates `.trellis/.developer` (gitignored) + `.trellis/workspace/<your-name>/`.
43
+ 创建 `.trellis/.developer`(由 git 忽略)和 `.trellis/workspace/<your-name>/`。
26
44
 
27
- ### Spec System
45
+ ### Spec 系统(Spec System)
28
46
 
29
- `.trellis/spec/` holds coding guidelines organized by package and layer.
47
+ `.trellis/spec/` 按包和层保存编码指南。
30
48
 
31
- - `.trellis/spec/<package>/<layer>/index.md` — entry point with **Pre-Development Checklist** + **Quality Check**. Actual guidelines live in the `.md` files it points to.
32
- - `.trellis/spec/guides/index.md` — cross-package thinking guides.
49
+ - `.trellis/spec/<package>/<layer>/index.md`——包含**开发前清单(Pre-Development Checklist)**和**质量检查(Quality Check)**的入口,实际指南位于它链接的 `.md` 文件。
50
+ - `.trellis/spec/guides/index.md`——跨包思考指南。
33
51
 
34
52
  ```bash
35
53
  python3 ./.trellis/scripts/get_context.py --mode packages # list packages / layers
36
54
  ```
37
55
 
38
- **When to update spec**: new pattern/convention found · bug-fix prevention to codify · new technical decision.
56
+ **更新 spec 的时机**:发现新的模式/约定、需要固化错误修复预防措施或形成新的技术决策。
39
57
 
40
- ### Task System
58
+ ### 任务系统(Task System)
41
59
 
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.
60
+ 每个任务在 `.trellis/tasks/{MM-DD-name}/` 下有自己的目录,其中包含 `task.json`、`prd.md`、可选的 `design.md`、可选的 `implement.md`、可选的 `research/`,以及在支持子代理的平台上使用的上下文清单(`implement.jsonl`、`check.jsonl`)。
43
61
 
44
62
  ```bash
45
63
  # Task lifecycle
46
64
  python3 ./.trellis/scripts/task.py create "<title>" [--slug <name>] [--parent <dir>]
47
- python3 ./.trellis/scripts/task.py start <name> # set active task (session-scoped when available)
65
+ python3 ./.trellis/scripts/task.py select <name> # context only, preserve phase
66
+ python3 ./.trellis/scripts/task.py plan seal <name> # current material plan
67
+ python3 ./.trellis/scripts/task.py plan approve <name> --revision <n> --basis "<actual approval>"
68
+ python3 ./.trellis/scripts/task.py start <name> # begin only when start gates pass
69
+ python3 ./.trellis/scripts/task.py replan <name> "<reason>" # return material ambiguity to planning
48
70
  python3 ./.trellis/scripts/task.py current --source # show active task and source
49
71
  python3 ./.trellis/scripts/task.py finish # clear active task (triggers after_finish hooks)
50
72
  python3 ./.trellis/scripts/task.py archive <name> # move to archive/{year-month}/
@@ -74,22 +96,22 @@ python3 ./.trellis/scripts/task.py remove-subtask <parent> <child>
74
96
  python3 ./.trellis/scripts/task.py create-pr [name] [--dry-run]
75
97
  ```
76
98
 
77
- > Run `python3 ./.trellis/scripts/task.py --help` to see the authoritative, up-to-date list.
99
+ > 运行 `python3 ./.trellis/scripts/task.py --help` 查看权威的最新命令列表。
78
100
 
79
- **Current-task mechanism**: `task.py create` creates the task directory and (when session identity is available) auto-sets the per-session active-task pointer so the planning breadcrumb fires immediately. `task.py start` writes the same pointer (idempotent if already set) and flips `task.json.status` from `planning` to `in_progress`. State is stored under `.trellis/.runtime/sessions/`. If no context key is available from hook input, `TRELLIS_CONTEXT_ID`, or a platform-native session environment variable, `task.py start` fails with a session identity hint because it cannot persist a session pointer; read-only context may still project one unique developer-owned resumable task. `task.py finish` deletes the current session file (status unchanged). `task.py archive <task>` writes `status=completed`, moves the directory to `archive/`, and deletes any runtime session files that still point at the archived task.
101
+ **当前任务机制(Current-task mechanism)**:`task.py create` 创建任务目录;会话身份可用时,自动设置每会话活动任务指针,让规划面包屑立即生效。`task.py start` 写入同一指针(已设置时保持幂等),并将 `task.json.status` 从 `planning` 切换为 `in_progress`。状态存放在 `.trellis/.runtime/sessions/`。如果 Hook 输入、`TRELLIS_CONTEXT_ID` 或平台原生会话环境变量没有提供上下文键,`task.py start` 会给出会话身份提示,因为它无法持久化会话指针;只读上下文仍可投影唯一的开发者所属可恢复任务。`task.py finish` 删除当前会话文件,状态不变。`task.py archive <task>` 写入 `status=completed`,将目录移动到 `archive/`,并删除仍指向该任务的运行时会话文件。
80
102
 
81
- ### Workspace System
103
+ ### 工作区系统(Workspace System)
82
104
 
83
- Records every AI session for cross-session tracking under `.trellis/workspace/<developer>/`.
105
+ 在 `.trellis/workspace/<developer>/` 下记录每个 AI 会话,用于跨会话跟踪。
84
106
 
85
- - `journal-N.md` — session log. **Max 2000 lines per file**; a new `journal-(N+1).md` is auto-created when exceeded.
86
- - `index.md` — personal index (total sessions, last active).
107
+ - `journal-N.md`——会话日志。每个文件**最多 2000 行**,超过后自动创建 `journal-(N+1).md`。
108
+ - `index.md`——个人索引(会话总数、最近活动)。
87
109
 
88
110
  ```bash
89
111
  python3 ./.trellis/scripts/add_session.py --title "Title" --commit "hash" --summary "Summary"
90
112
  ```
91
113
 
92
- ### Context Script
114
+ ### 上下文脚本(Context Script)
93
115
 
94
116
  ```bash
95
117
  python3 ./.trellis/scripts/get_context.py # full session runtime
@@ -100,55 +122,48 @@ python3 ./.trellis/scripts/get_context.py --mode phase --step <X.Y> # detailed
100
122
  ---
101
123
 
102
124
  <!--
103
- WORKFLOW-STATE BREADCRUMB CONTRACT (read this before editing the tag blocks below)
104
-
105
- The [workflow-state:STATUS] blocks embedded in the ## Phase Index section
106
- below are the SINGLE source of truth for the per-turn `<workflow-state>`
107
- breadcrumb that every supported AI platform's UserPromptSubmit hook
108
- reads. inject-workflow-state.py (Python platforms) and
109
- inject-workflow-state.js (OpenCode plugin) only parse them — there is no
110
- fallback dict baked into the scripts after v0.5.0-rc.0.
111
-
112
- STATUS charset: [A-Za-z0-9_-]+. When the hook can't find a tag, it
113
- degrades to a generic "Refer to workflow.md for current step." line —
114
- intentionally visible so users notice and fix a broken workflow.md.
115
-
116
- INVARIANT (test/regression.test.ts):
117
- Every workflow-walkthrough step marked `[required · once]` must have a
118
- matching enforcement line in its phase's [workflow-state:*] block. The
119
- breadcrumb is the only per-turn channel; if a mandatory step isn't
120
- mentioned there, the AI silently skips it (Phase 1 planning gate
121
- skip and Phase 3.4 commit skip both manifested via this gap).
122
-
123
- TAG ↔ PHASE scoping:
124
- [workflow-state:no_task] → no active task; before Phase 1
125
- [workflow-state:unbound_task] → one developer-owned task exists without a session pointer
126
- [workflow-state:unbound_ambiguous] → multiple developer-owned tasks exist without a session pointer
127
- [workflow-state:unbound_ambiguous-inline] → Codex inline variant of unbound_ambiguous
128
- [workflow-state:task_error] → active task record is unreadable; repair it before continuing
129
- [workflow-state:planning] → all of Phase 1 (status='planning')
130
- [workflow-state:planning-inline] → Codex inline variant of Phase 1
131
- [workflow-state:in_progress] → Phase 2 + Phase 3.2-3.4
132
- (status stays 'in_progress' from
133
- task.py start until task.py archive)
134
- [workflow-state:in_progress-inline] → Codex inline variant of Phase 2/3
135
- [workflow-state:completed] → currently DEAD: cmd_archive flips
136
- status and moves the dir in the same
137
- call, so the resolver loses the
138
- pointer (block kept for a future
139
- explicit in_progress→completed
140
- transition)
141
-
142
- Editing checklist:
143
- - When you change a [workflow-state:STATUS] block, also check the
144
- matching phase's `[required · once]` walkthrough steps for sync
145
- - Run `trellis update` after editing to push the new bodies to
146
- downstream user projects (block-level managed replacement)
147
- - Full runtime contract:
125
+ 工作流状态面包屑合同(WORKFLOW-STATE BREADCRUMB CONTRACT;编辑以下标记块前阅读)
126
+
127
+ 下方 ## Phase Index 区域中的 [workflow-state:STATUS] 块是每个支持平台的
128
+ UserPromptSubmit Hook 读取的每轮 <workflow-state> 面包屑唯一事实来源。
129
+ inject-workflow-state.py(Python 平台)和 inject-workflow-state.js(OpenCode 插件)
130
+ 只解析这些块;v0.5.0-rc.0 之后,脚本中不再内置回退字典。
131
+
132
+ STATUS 字符集为 [A-Za-z0-9_-]+。Hook 找不到标签时,会降级为通用的
133
+ "Refer to workflow.md for current step.",让用户能发现并修复损坏的 workflow.md。
134
+
135
+ 不变量(test/regression.test.ts):
136
+ 每个标记为 `[required · once]` 的工作流步骤,都必须在所属阶段的
137
+ [workflow-state:*] 块中有对应的约束行。面包屑是每轮唯一的提示通道;
138
+ 如果没有提到必需步骤,AI 会静默跳过它(阶段一规划门禁和阶段 3.4 提交门禁
139
+ 都曾因这一缺口被跳过)。
140
+
141
+ 标签与阶段范围:
142
+ [workflow-state:no_task] → 无活动任务;阶段一之前
143
+ [workflow-state:unbound_task] → 开发者有一个任务,但没有会话指针
144
+ [workflow-state:unbound_ambiguous] → 开发者有多个任务,但没有会话指针
145
+ [workflow-state:unbound_ambiguous-inline] → unbound_ambiguous 的 Codex inline 版本
146
+ [workflow-state:task_error] → 活动任务记录不可读;继续前先修复
147
+ [workflow-state:planning] → 整个阶段一(status='planning')
148
+ [workflow-state:planning-inline] → 阶段一的 Codex inline 版本
149
+ [workflow-state:in_progress] → 阶段二与阶段 3.2–3.4
150
+ (从 task.py start 到 task.py archive,
151
+ status 保持 'in_progress')
152
+ [workflow-state:in_progress-inline] → 阶段二/三的 Codex inline 版本
153
+ [workflow-state:completed] → 当前不可达:cmd_archive 在同一次调用中
154
+ 修改状态并移动目录,解析器因此失去指针。
155
+ 保留此块以支持未来显式的
156
+ in_progress→completed 转换。
157
+
158
+ 编辑清单:
159
+ - 修改 [workflow-state:STATUS] 块时,同时检查对应阶段的 `[required · once]`
160
+ 工作流步骤是否同步
161
+ - 编辑后运行 `trellis update`,通过按块管理的替换将新正文推送到下游项目
162
+ - 完整运行时合同:
148
163
  .trellis/spec/cli/backend/workflow-state-contract.md
149
164
  -->
150
165
 
151
- ## Phase Index
166
+ ## 阶段索引(Phase Index)
152
167
 
153
168
  ```
154
169
  Phase 1: Plan → classify, then create planning artifacts for work that needs a task
@@ -156,190 +171,191 @@ Phase 2: Execute → implement only after task status is in_progress
156
171
  Phase 3: Finish → verify, update spec, commit, and wrap up
157
172
  ```
158
173
 
159
- ### Request Triage
174
+ ### 请求分流(Request Triage)
175
+
176
+ - 直接小任务:对于边界清晰、只涉及一个表面且可以立即验证的操作,可以不创建 Trellis 任务直接进行,但仍遵守通常安全规则。如果探索扩大了范围,或发现需要设计、owner、发布或持久记录,先停止并创建任务。
177
+ - 复杂任务:询问是否可以创建 Trellis 任务并进入规划。如果用户拒绝,不进行大范围内联实施;解释、澄清范围或建议拆分为更小的任务。
178
+ - 用户批准创建任务不等于批准开始实施,仍须先完成规划。
160
179
 
161
- - Direct small work: for a clearly bounded, single-surface operation with an immediate verification path, proceed without creating a Trellis task. Apply normal safety rules. If discovery expands the scope or reveals a design, ownership, release, or durable-record need, stop and create a task before continuing.
162
- - 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.
163
- - User approval to create a task is not approval to start implementation. Planning still happens first.
180
+ ### analysis-only 任务
164
181
 
165
- ### Analysis-only tasks
182
+ 当 `task.json.meta.delivery_mode = "analysis_only"` 且 `prd.md` 明确证据交付物以及产品源码、运行时配置、部署、凭据和外部系统均不变的边界时,analysis-only 任务符合条件。复杂度、跨 owner 范围、多个证据单元、建议或未解决的产品选择都不会使它失去资格。用户的研究请求授权主会话完成所请求的证据工作。
166
183
 
167
- An analysis-only task is eligible only when `task.json.meta.delivery_mode = "analysis_only"` exactly and its `prd.md` names the evidence deliverable plus a no-change boundary for product source, runtime configuration, deployment, credentials, and external systems. Task creation consent authorizes that bounded evidence work, not protected-target changes.
184
+ 让任务保持 `planning`:写入并验证研究、审查或设计证据,提交任务资产后直接归档。不要运行 `task.py start`,不要配置实施上下文,不要求 Planning Seal,也不等待第二次实施批准。如果需要独立子节点证据,在任务中冻结派发方案,并在任何 spawn/send 前取得明确批准;该批准只授权清单中的证据派发。如果证据建议修改受保护目标,记录建议并另建 change-bearing 任务,之后才能实施。
168
185
 
169
- Keep an eligible analysis-only task in `planning`: write its research, audit, or design evidence; verify its acceptance criteria and boundary; commit task artifacts; then archive directly. Do not run `task.py start`, configure implementation context, or wait for a second implementation approval. If the evidence recommends a protected-target change, record the recommendation and create a separate change-bearing task before doing it.
186
+ ### 规划资产(Planning Artifacts)
170
187
 
171
- ### Planning Artifacts
188
+ - `prd.md`——需求、约束和验收标准。不要在其中放技术设计或执行清单。
189
+ - `design.md`——复杂任务的技术设计:边界、合同、数据流、取舍、兼容性和发布/回滚形态。
190
+ - `implement.md`——复杂任务的执行计划:有序清单、验证命令、审查门禁和回滚点。
191
+ - `implement.jsonl` / `check.jsonl`——子代理上下文使用的 spec 与研究清单,不替代 `implement.md`。
192
+ - 轻量任务可以只有 PRD。复杂任务在 `task.py start` 前必须有 `prd.md`、`design.md` 和 `implement.md`。
172
193
 
173
- - `prd.md` — requirements, constraints, and acceptance criteria. Do not put technical design or execution checklists here.
174
- - `design.md` — technical design for complex tasks: boundaries, contracts, data flow, tradeoffs, compatibility, rollout / rollback shape.
175
- - `implement.md` — execution plan for complex tasks: ordered checklist, validation commands, review gates, and rollback points.
176
- - `implement.jsonl` / `check.jsonl` — spec and research manifests for sub-agent context. They do not replace `implement.md`.
177
- - Lightweight tasks may be PRD-only. Complex tasks must have `prd.md`, `design.md`, and `implement.md` before `task.py start`.
194
+ 对于阅读量较大的研究、审查或调查,将无法在当前有界会话中持久化一个有用结论的工作拆成证据单元。每个单元在开始下一个单元前记录一个问题或范围、最小证据、落点、停止条件、结论或阻塞、未知项和恢复点。按一个普通上下文窗口控制规模,不承诺精确 token 或时间;例行导航无需记录。
178
195
 
179
- ### Parent / Child Task Trees
196
+ ### 父子任务树(Parent / Child Task Trees)
180
197
 
181
- 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.
198
+ 当一个用户请求包含多个可独立验证的交付物时使用父任务。父任务负责源需求集合、任务图、跨子任务验收标准和最终集成审查;除非父任务本身也有直接工作,否则通常不作为实施目标。
182
199
 
183
- 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.
200
+ 对可以独立规划、实施、检查和归档的交付物使用子任务。父子结构不是依赖系统:如果一个子任务必须等待另一个子任务,在该子任务的 `prd.md` / `implement.md` 中写明顺序,并保持每个子任务的验收标准可测试。
184
201
 
185
- 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>`.
202
+ 使用 `task.py create "<title>" --slug <name> --parent <parent-dir>` 创建新子任务。使用 `task.py add-subtask <parent> <child>` 关联已有任务,使用 `task.py remove-subtask <parent> <child>` 解除错误关联。
186
203
 
187
- <!-- Per-turn breadcrumb: shown when there is no active task (before Phase 1) -->
204
+ <!-- 每轮面包屑:无活动任务时显示(阶段一之前)。 -->
188
205
 
189
206
  [workflow-state:no_task]
190
- No active task. First classify the current turn. Direct small work with a clear single owner and immediate verification may proceed without a Trellis task under normal safety rules.
191
- If scope expands or requires design, ownership, release, credentials, or a durable record, create a Trellis task before continuing.
192
- 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.
207
+ 没有活动任务。先分类当前轮次。owner 清晰、可以立即验证的直接小任务,可以在通常安全规则下不创建 Trellis 任务直接进行。
208
+ 如果范围扩大,或需要设计、owner、发布、凭据或持久记录,继续前先创建 Trellis 任务。
209
+ 复杂任务:询问用户是否可以创建 Trellis 任务并进入规划。如果用户拒绝,解释、澄清范围或建议拆分为更小任务。
193
210
  [/workflow-state:no_task]
194
211
 
195
- <!-- Per-turn breadcrumb: shown when one resumable task exists without a direct session binding. -->
212
+ <!-- 每轮面包屑:存在一个可恢复任务且无直接会话绑定时显示。 -->
196
213
 
197
214
  [workflow-state:unbound_task]
198
- An existing task is assigned to the current developer, but this shell has no direct Trellis session binding. Do not create a duplicate task. Continue reading and working from the existing task artifacts; before any lifecycle write or closure, run the native `task.py start <task>` command once a direct session identity is available. Never edit `.trellis/.runtime/sessions/` manually.
215
+ 已有一个由开发者拥有的任务,但没有直接会话绑定。检查原生 `task.py current --json`:非空 `session_source` 表示直接身份已可用;未绑定来源仍表示没有任务绑定。根据用户明确意图选择已有任务,不要猜测或创建重复任务。先恢复其规划/状态门禁。只有激活合同允许时,才在 Planning Seal 和 change-bearing 任务实施授权之后运行原生 `task.py start <task>`。符合条件的 `analysis_only` 任务保持 planning,不运行 start。缺少身份时单独报告;绝不虚构身份或编辑运行时指针。
199
216
  [/workflow-state:unbound_task]
200
217
 
201
- <!-- Per-turn breadcrumb shown when multiple resumable tasks exist without a direct session binding. -->
218
+ <!-- 每轮面包屑:存在多个可恢复任务且无直接会话绑定时显示。 -->
202
219
 
203
220
  [workflow-state:unbound_ambiguous]
204
- Multiple active tasks belong to the current developer, but this shell has no direct Trellis session binding. Do not guess or create a duplicate task. Review the listed candidates and run `python3 ./.trellis/scripts/task.py start <task>` with the intended task once a direct session identity is available.
221
+ 多个由开发者拥有的任务没有直接会话绑定。检查原生 `task.py current --json`:非空 `session_source` 表示直接身份已可用;未绑定来源仍表示没有任务绑定。根据用户明确意图选择已有任务,不要猜测或创建重复任务。先恢复其规划/状态门禁。只有激活合同允许时,才在 Planning Seal 和 change-bearing 任务实施授权之后运行原生 `task.py start <task>`。符合条件的 `analysis_only` 任务保持 planning,不运行 start。缺少身份时单独报告;绝不虚构身份或编辑运行时指针。
205
222
  [/workflow-state:unbound_ambiguous]
206
223
 
207
224
  [workflow-state:unbound_ambiguous-inline]
208
- Multiple active tasks belong to the current developer, but this Codex session has no direct Trellis session binding. Do not guess or create a duplicate task. Review the listed candidates and run `python3 ./.trellis/scripts/task.py start <task>` with the intended task once a direct session identity is available.
225
+ 多个由开发者拥有的任务没有直接会话绑定。检查原生 `task.py current --json`:非空 `session_source` 表示直接身份已可用;未绑定来源仍表示没有任务绑定。根据用户明确意图选择已有任务,不要猜测或创建重复任务。先恢复其规划/状态门禁。只有激活合同允许时,才在 Planning Seal 和 change-bearing 任务实施授权之后运行原生 `task.py start <task>`。符合条件的 `analysis_only` 任务保持 planning,不运行 start。缺少身份时单独报告;绝不虚构身份或编辑运行时指针。
209
226
  [/workflow-state:unbound_ambiguous-inline]
210
227
 
211
- <!-- Per-turn breadcrumb: shown when the active task record cannot be read. -->
228
+ <!-- 每轮面包屑:活动任务记录不可读时显示。 -->
212
229
 
213
230
  [workflow-state:task_error]
214
- The active task record could not be read. Do not create or activate another task.
215
- Inspect the task directory named above and repair its task.json. It must be a valid JSON object with a non-empty status.
216
- Preserve existing task fields and artifacts. If the correct status cannot be determined safely, ask the user before reconstructing the record.
231
+ 无法读取活动任务记录。不要创建或激活其他任务。
232
+ 检查上方命名的任务目录并修复其 task.json。它必须是有效 JSON 对象,且 status 非空。
233
+ 保留现有任务字段和资产。如果无法安全确定正确状态,在重建记录前询问用户。
217
234
  [/workflow-state:task_error]
218
235
 
219
- ### Phase 1: Plan
220
- - 1.0 Create task `[required · once]` (only after task-creation consent)
221
- - 1.1 Requirement exploration `[required · repeatable]` (`prd.md`; complex tasks also need `design.md` + `implement.md`)
222
- - 1.2 Research `[optional · repeatable]`
223
- - 1.3 Configure context `[required · once]` — Claude Code, Cursor, OpenCode, Codex, Kiro, Gemini, Qoder, CodeBuddy, Copilot, Droid, Pi, Oh My Pi, ZCode, Snow, Reasonix, Grok, Kimi Code (sub-agent-dispatch platforms only; inline and eligible analysis-only tasks skip)
224
- - 1.4 Activate task `[required · once]` (change-bearing tasks only: review gate, then `task.py start`; status → in_progress)
225
- - 1.5 Completion criteria
236
+ ### 阶段一:规划(Phase 1: Plan)
237
+ - 1.0 创建任务 `[required · once]`(仅在获得创建任务同意后)
238
+ - 1.1 需求探索 `[required · repeatable]`(`prd.md`;复杂任务还需要 `design.md` + `implement.md`)
239
+ - 1.2 研究 `[optional · repeatable]`
240
+ - 1.3 配置上下文 `[required · once]`——Claude Code、Cursor、OpenCode、Codex、Kiro、Gemini、Qoder、CodeBuddy、Copilot、Droid、Pi、Oh My Pi、ZCode、Snow、Reasonix、Grok、Kimi Code(仅派发子代理的平台;inline 和符合条件的 analysis-only 任务跳过)
241
+ - 1.4 激活任务 `[required · once]`(仅 change-bearing 任务:审查门禁后运行 `task.py start`;状态 → in_progress)
242
+ - 1.5 完成标准
226
243
 
227
- <!-- Per-turn breadcrumb: shown throughout Phase 1 (status='planning') -->
244
+ <!-- 每轮面包屑:整个阶段一显示(status='planning')。 -->
228
245
 
229
246
  [workflow-state:planning]
230
- Load `trellis-brainstorm`; stay in planning.
231
- If `task.json.meta.delivery_mode = "analysis_only"` exactly, complete the declared evidence work now. Do not wait for a start review or run `task.py start`; when the PRD boundary and acceptance evidence pass, commit task artifacts and archive directly. A protected-target recommendation requires a separate change-bearing task.
232
- Lightweight: `prd.md` can be enough. Complex: finish `prd.md`, `design.md`, and `implement.md`; ask for review before `task.py start`.
233
- Multi-deliverable scope: consider a parent task plus independently verifiable child tasks; dependencies must be written in child artifacts, not implied by tree position.
234
- Sub-agent mode: curate `implement.jsonl` and `check.jsonl` as spec/research manifests before start.
247
+ 加载 `trellis-brainstorm`;保持 planning。
248
+ 如果 `task.json.meta.delivery_mode = "analysis_only"`,无论复杂度或跨 owner 范围如何,都完成有界证据工作;PRD 必须写明证据交付物和受保护目标不变边界。不要运行 Planning Seal 或等待实施批准。涉及受保护目标的建议必须另建 change-bearing 任务。
249
+ 对于 `analysis_only`,无论复杂度或跨 owner 范围如何,都完成有界证据工作;PRD 必须写明证据交付物和受保护目标不变边界。不要运行 Planning Seal 或等待实施批准。对于 change-bearing 工作,轻量任务可以使用 `prd.md`;复杂任务在实施审查前需要 `design.md`、`implement.md` 和 Planning Seal。研究建议和开放的产品选择可以记录,但不要将其封口为实施决策。持久化定义请求所需的答复,并继续同一规划循环。
250
+ 多交付物范围:考虑父任务和可独立验证的子任务;依赖必须写入子任务资产,不能从树结构位置推断。
251
+ 子代理模式:在 start 前维护 `implement.jsonl` 和 `check.jsonl` 作为 spec/研究清单。
252
+ planned/change-bearing start 需要原生 plan seal,以及对当前任务当前实质版本的匹配批准。选择上下文不构成批准。
235
253
  [/workflow-state:planning]
236
254
 
237
- <!-- Per-turn breadcrumb: shown throughout Phase 1 when Codex uses its default
238
- codex.dispatch_mode=inline. Codex-only alternate to [workflow-state:planning]. The main agent
239
- edits code directly in Phase 2, so jsonl curation is skipped —
240
- the inline workflow loads `trellis-before-dev` instead of injecting JSONL
241
- into a sub-agent. -->
255
+ <!-- Codex 使用默认 codex.dispatch_mode=inline 时,阶段一持续显示的每轮面包屑。
256
+ 这是 [workflow-state:planning] 的 Codex 专用替代块。主 Agent 在阶段二直接编辑代码,
257
+ 因此跳过 JSONL 整理;inline 工作流加载 `trellis-before-dev`,而不是向子代理注入 JSONL。 -->
242
258
 
243
259
  [workflow-state:planning-inline]
244
- Load `trellis-brainstorm`; stay in planning.
245
- If `task.json.meta.delivery_mode = "analysis_only"` exactly, complete the declared evidence work now. Do not wait for a start review or run `task.py start`; when the PRD boundary and acceptance evidence pass, commit task artifacts and archive directly. A protected-target recommendation requires a separate change-bearing task.
246
- Lightweight: `prd.md` can be enough. Complex: finish `prd.md`, `design.md`, and `implement.md`; ask for review before `task.py start`.
247
- Multi-deliverable scope: consider a parent task plus independently verifiable child tasks; dependencies must be written in child artifacts, not implied by tree position.
248
- Inline mode: skip jsonl curation; Phase 2 reads artifacts/specs via `trellis-before-dev`.
260
+ 加载 `trellis-brainstorm`;保持 planning。
261
+ 如果 `task.json.meta.delivery_mode = "analysis_only"`,无论复杂度或跨 owner 范围如何,都完成有界证据工作;PRD 必须写明证据交付物和受保护目标不变边界。不要运行 Planning Seal 或等待实施批准。涉及受保护目标的建议必须另建 change-bearing 任务。
262
+ 对于 `analysis_only`,无论复杂度或跨 owner 范围如何,都完成有界证据工作;PRD 必须写明证据交付物和受保护目标不变边界。不要运行 Planning Seal 或等待实施批准。对于 change-bearing 工作,轻量任务可以使用 `prd.md`;复杂任务在实施审查前需要 `design.md`、`implement.md` 和 Planning Seal。研究建议和开放的产品选择可以记录,但不要将其封口为实施决策。持久化定义请求所需的答复,并继续同一规划循环。
263
+ 多交付物范围:考虑父任务和可独立验证的子任务;依赖必须写入子任务资产,不能从树结构位置推断。
264
+ Inline 模式跳过 JSONL 整理;阶段二通过 `trellis-before-dev` 读取任务资产和 spec。
265
+ planned/change-bearing 任务开始前需要原生 plan seal,以及对当前任务当前实质版本的匹配批准。选择上下文不构成批准。
249
266
  [/workflow-state:planning-inline]
250
267
 
251
- ### Phase 2: Execute
252
- - 2.1 Implement `[required · repeatable]`
253
- - 2.2 Quality check `[required · repeatable]`
254
- - 2.3 Rollback `[on demand]`
268
+ ### 阶段二:执行(Phase 2: Execute)
269
+ - 2.1 实施 `[required · repeatable]`
270
+ - 2.2 质量检查 `[required · repeatable]`
271
+ - 2.3 回滚 `[on demand]`
255
272
 
256
- <!-- Per-turn breadcrumb: shown while status='in_progress'.
257
- Scope: all of Phase 2 + Phase 3.2-3.4 (status stays 'in_progress' from
258
- task.py start until task.py archive; only archive flips it). The body
259
- therefore must cover every required step from implementation through
260
- commit, including Phase 3.3 spec update and Phase 3.4 commit. -->
273
+ <!-- status='in_progress' 时显示的每轮面包屑。
274
+ 范围覆盖阶段二和阶段 3.2-3.4(从 task.py start 到 task.py archive 期间状态保持
275
+ 'in_progress',只有 archive 会翻转状态)。因此正文必须覆盖从实施到提交的每个必需步骤,
276
+ 包括阶段 3.3 spec 更新和阶段 3.4 提交。 -->
261
277
 
262
- Sub-agent dispatch protocol applies to all platforms and all sub-agents, including native Codex `SubagentStart` context injection with child-side pull fallback, class-2 Gemini/Qoder/Copilot/Reasonix/Trae/Grok/Kimi Code/DeepSeek Harness, hook-backed ZCode/Snow, and `trellis-research`: every dispatch prompt starts with `Active task: <task path from task.py current>` before role-specific instructions. On Grok Build, use `spawn_subagent` with `subagent_type` set to the Trellis agent name (e.g. `trellis-implement`). On Kimi Code, dispatch the built-in `coder` / `explore` sub-agent with the matching `.kimi-code/skills/trellis-<role>/SKILL.md` instructions. On DeepSeek Harness, tell the child to load the matching `.dsh/skills/trellis-agent-<role>/SKILL.md` exactly once, then choose the synchronization path by capability. If the optional companion plugin exposes `trellis_wait`, dispatch `subagent` in its default continuable background mode, continue independent work, and call `trellis_wait` once per dependent child id when a dependent gate is next; each call returns only after DSH has queued that child's native settlement notice. Without `trellis_wait`, dispatch each child with `run_in_background: false` from the outset so no dependent gate can overtake it. Never simulate waiting with shell sleep, polling loops, `job_output`, repeated `list_agents`, or another long-running command, and never leave a background child without an event-driven wait path.
278
+ 子代理派发协议适用于所有平台和所有子代理,包括使用原生 Codex `SubagentStart` 注入上下文并以子代理侧读取为后备的模式、Gemini/Qoder/Copilot/Reasonix/Trae/Grok/Kimi Code/DeepSeek Harness、由 Hook 支持的 ZCode/Snow 以及 `trellis-research`:每个派发提示都必须先写 `Active task: <task path from task.py current>`,再写角色指令。Grok Build 使用 `spawn_subagent`,并将 `subagent_type` 设为 Trellis Agent 名称(例如 `trellis-implement`)。Kimi Code 派发内置 `coder` / `explore` 子代理,并提供对应的 `.kimi-code/skills/trellis-<role>/SKILL.md` 指令。DeepSeek Harness 要求子代理恰好加载一次对应的 `.dsh/skills/trellis-agent-<role>/SKILL.md`,再按能力选择同步路径。如果可选伴随插件提供 `trellis_wait`,使用默认可继续的后台模式派发 `subagent`,继续独立工作;依赖门即将满足时,对每个依赖子代理 ID 调用一次 `trellis_wait`,每次调用都要等到 DSH 排入该子代理的原生结算通知后才返回。没有 `trellis_wait` 时,从一开始就为每个子代理设置 `run_in_background: false`,避免依赖门越过它。不得用 shell sleep、轮询循环、`job_output`、重复 `list_agents` 或其他长命令模拟等待,也不得让后台子代理脱离事件驱动的等待路径。
263
279
 
264
280
  [workflow-state:in_progress]
265
- Tools: `trellis-implement` / `trellis-research` name sub-agent roles dispatched through your platform's sub-agent mechanism, not skills the main session loads itself (on Claude Code: use the Task/Agent tool, never the Skill tool). `trellis-update-spec` is a skill. `trellis-check` exists as both; prefer the Agent/role form when verifying after code changes.
266
- On DeepSeek Harness, role instructions ship as collision-free `trellis-agent-implement` / `trellis-agent-check` / `trellis-agent-research` skills under `.dsh/skills/`. The main session must not load them itself: tell the child to load the matching role skill exactly once. If `trellis_wait` is available, use the default background mode, do independent work, then call `trellis_wait` once per dependent child id and consume each native settlement notice before entering the dependent gate. If it is unavailable, dispatch every child with `run_in_background: false` from the outset. Do not poll, sleep, or start a background child without an event-driven wait path.
267
- Flow: `trellis-implement` -> `trellis-check` -> `trellis-update-spec` -> commit (Phase 3.4) -> `/trellis:finish-work`.
268
- Use this block only when `codex.dispatch_mode: auto` is explicitly selected. 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.
269
- 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`.
281
+ 满足上述 in_progress 条件、且由用户明确要求的有界增补,留在当前阶段,并记录到未封口执行记录。出现实质未决选择时,立即解释影响和建议,停止依赖该选择的动作并记录 `decision-needed`。运行原生 `task.py replan <task> "<reason>"` 回到规划,再使用阻塞式提问工具并重新封口/批准新的实质版本。不要延后该选择,也不要手动修改任务状态。
282
+ `trellis-implement` / `trellis-research` 表示通过平台子代理机制派发的角色,不是主会话自行加载的 Skill(Claude Code 使用 Task/Agent 工具,不使用 Skill 工具)。`trellis-update-spec` 是 Skill。`trellis-check` 同时存在于两种入口;代码变更后验证时优先使用 Agent/角色入口。
283
+ DeepSeek Harness 的角色指令以互不冲突的 `trellis-agent-implement` / `trellis-agent-check` / `trellis-agent-research` Skill 分发到 `.dsh/skills/`。主会话不得自行加载;要求子代理恰好加载一次对应角色 Skill。提供 `trellis_wait` 时,使用默认后台模式,继续独立工作,然后对每个依赖子代理 ID 调用一次 `trellis_wait`,消费原生结算通知后才进入依赖门。未提供时,从一开始就为每个子代理设置 `run_in_background: false`。不得轮询、sleep 或启动没有事件驱动等待路径的后台子代理。
284
+ 流程:`trellis-implement` → `trellis-check` → `trellis-update-spec` → 提交(阶段 3.4)→ `/trellis:finish-work`。
285
+ 仅在明确选择 `codex.dispatch_mode: auto` 时使用此块。子代理自豁免:如果当前已经是 `trellis-implement`,不得再派发 `trellis-implement` 或 `trellis-check`;如果当前已经是 `trellis-check`,不得再派发 `trellis-check` 或 `trellis-implement`。只有主会话负责派发。
286
+ 派发提示必须以 `Active task: <task path from task.py current>` 开始。读取上下文的顺序为:JSONL 条目 → `prd.md` → 存在时的 `design.md` → 存在时的 `implement.md`。
270
287
  [/workflow-state:in_progress]
271
288
 
272
- <!-- Per-turn breadcrumb: shown while status='in_progress' when Codex uses its
273
- default codex.dispatch_mode=inline. Codex-only alternate to
274
- [workflow-state:in_progress]. The main session edits code directly
275
- instead of dispatching sub-agents. -->
289
+ <!-- 每轮面包屑:status='in_progress' 且 Codex 使用默认
290
+ codex.dispatch_mode=inline 时显示。仅供 Codex 替代
291
+ [workflow-state:in_progress];主会话直接编辑代码,不派发子代理。 -->
276
292
 
277
293
  [workflow-state:in_progress-inline]
278
- Flow: `trellis-before-dev` -> edit -> `trellis-check` -> validation -> `trellis-update-spec` -> commit (Phase 3.4) -> `/trellis:finish-work`.
279
- Do not dispatch implement/check sub-agents in inline mode.
280
- Read context: `prd.md` -> `design.md if present` -> `implement.md if present`, plus relevant spec/research loaded by skills.
294
+ 流程:`trellis-before-dev` → 编辑 → `trellis-check` → 验证 → `trellis-update-spec` → 提交(阶段 3.4)→ `/trellis:finish-work`。
295
+ 满足上述 in_progress 条件、且由用户明确要求的有界增补,留在当前阶段,并记录到未封口执行记录。出现实质未决选择时,立即解释影响和建议,停止依赖该选择的动作并记录 `decision-needed`。运行原生 `task.py replan <task> "<reason>"` 回到规划,再使用阻塞式提问工具并重新封口/批准新的实质版本。不要延后该选择,也不要手动修改任务状态。
296
+ Inline 模式不派发 implement/check 子代理。
297
+ 已选工作流仍可使用明确的 Channel 独立证据子节点;不得用主会话自称通过替代必需的独立证据。
298
+ 读取上下文的顺序为:`prd.md` → 存在时的 `design.md` → 存在时的 `implement.md`,再读取 Skill 加载的相关 spec/研究。
281
299
  [/workflow-state:in_progress-inline]
282
300
 
283
- ### Phase 3: Finish
284
- - 3.2 Debug retrospective `[on demand]`
285
- - 3.3 Spec update `[required · once]`
286
- - 3.4 Commit changes `[required · once]`
287
- - 3.5 Wrap-up reminder
301
+ ### 阶段三:完成(Phase 3: Finish)
302
+ - 3.2 调试复盘 `[on demand]`
303
+ - 3.3 更新 Spec `[required · once]`
304
+ - 3.4 提交变更 `[required · once]`
305
+ - 3.5 收尾提醒
288
306
 
289
- > Note: step 3.1 was folded into 2.2 (last-iteration full-scope check) and 3.4 (commit preamble). Numbering kept stable to avoid breaking external references.
307
+ > 注意:步骤 3.1 已并入 2.2(最后一次迭代的全范围检查)和 3.4(提交前置检查)。保留原有编号,避免破坏外部引用。
290
308
 
291
- <!-- Per-turn breadcrumb: shown while status='completed'.
292
- Currently DEAD in normal flow: cmd_archive writes status='completed' in
293
- the same call that moves the task dir to archive/, so the active-task
294
- resolver loses the pointer and the hook never fires on archived tasks.
295
- Block preserved for a future status-transition redesign (e.g. an
296
- explicit in_progress→completed command). Edit through the same spec
297
- channel as the live blocks. -->
309
+ <!-- 每轮面包屑:status='completed' 时显示。
310
+ 当前正常流程不可达:cmd_archive 在同次调用写入 status='completed'
311
+ 并将目录移至 archive/,活动任务解析器失去指针,Hook 不会作用于归档任务。
312
+ 保留此块供未来状态转换重设计使用(如显式 in_progress→completed 命令)。
313
+ 修改时遵循与活动块相同的 spec 入口。 -->
298
314
 
299
315
  [workflow-state:completed]
300
- Code committed. Run `/trellis:finish-work`; if dirty, return to Phase 3.4 first.
316
+ 代码已提交。运行 `/trellis:finish-work`;如果工作树仍脏,先回到阶段 3.4。
301
317
  [/workflow-state:completed]
302
318
 
303
- ### Rules
319
+ ### 规则(Rules)
304
320
 
305
- 1. Identify which Phase you're in, then continue from the next step there
306
- 2. Run steps in order inside each Phase; `[required]` steps can't be skipped
307
- 3. Phases can roll back (e.g., Execute reveals a prd defect → return to Plan to fix, then re-enter Execute)
308
- 4. Steps tagged `[once]` are skipped if the output already exists; don't re-run
309
- 5. Artifact presence informs the next step; missing `design.md` / `implement.md` is valid for lightweight tasks and incomplete planning for complex tasks.
321
+ 1. 确认当前阶段,然后从该阶段的下一步继续
322
+ 2. 按阶段内顺序执行;不能跳过 `[required]` 步骤
323
+ 3. 阶段可以回退(例如执行发现 PRD 缺陷 → 回到规划修复 → 再次进入执行)
324
+ 4. 标记为 `[once]` 的步骤已有产物时跳过,不重复运行
325
+ 5. 根据资产是否存在判断下一步;轻量任务可以没有 `design.md` / `implement.md`,复杂任务缺少它们则表示规划未完成。
310
326
 
311
- ### Active Task Routing
327
+ ### 活动任务路由(Active Task Routing)
312
328
 
313
- When a user request matches one of these intents inside an active task, route first, then load the detailed phase step if needed.
329
+ 活动任务中的用户请求符合下列意图时,先路由,再按需要加载阶段步骤详情。
314
330
 
315
331
  [Claude Code, Cursor, OpenCode, codex-sub-agent, Kiro, Gemini, Qoder, CodeBuddy, Copilot, Droid, Pi, Oh My Pi, ZCode, Snow, Reasonix, Trae, Grok, Kimi Code, DeepSeek Harness]
316
332
 
317
- - Planning or unclear requirements -> `trellis-brainstorm`.
318
- - Explicit eligible `analysis_only` -> complete evidence in planning, then commit artifacts and archive directly.
319
- - `in_progress` implementation/check -> dispatch `trellis-implement` / `trellis-check`.
320
- - Repeated debugging -> `trellis-break-loop`; spec updates -> `trellis-update-spec`.
333
+ - 规划或需求不清 → `trellis-brainstorm`。
334
+ - 明确符合条件的 `analysis_only` → 在规划中完成证据,然后提交资产并直接归档。
335
+ - `in_progress` 实施/检查 → 派发 `trellis-implement` / `trellis-check`。
336
+ - 重复调试 → `trellis-break-loop`;spec 更新 → `trellis-update-spec`。
321
337
 
322
338
  [/Claude Code, Cursor, OpenCode, codex-sub-agent, Kiro, Gemini, Qoder, CodeBuddy, Copilot, Droid, Pi, Oh My Pi, ZCode, Snow, Reasonix, Trae, Grok, Kimi Code, DeepSeek Harness]
323
339
 
324
340
  [codex-inline, Kilo, Antigravity, Devin]
325
341
 
326
- - Planning or unclear requirements -> `trellis-brainstorm`.
327
- - Explicit eligible `analysis_only` -> complete evidence in planning, then commit artifacts and archive directly.
328
- - Before editing -> `trellis-before-dev`; after editing -> `trellis-check`.
329
- - Repeated debugging -> `trellis-break-loop`; spec updates -> `trellis-update-spec`.
342
+ - 规划或需求不清 → `trellis-brainstorm`。
343
+ - 明确符合条件的 `analysis_only` → 在规划中完成证据,然后提交资产并直接归档。
344
+ - 编辑前 → `trellis-before-dev`;编辑后 → `trellis-check`。
345
+ - 重复调试 → `trellis-break-loop`;spec 更新 → `trellis-update-spec`。
330
346
 
331
347
  [/codex-inline, Kilo, Antigravity, Devin]
332
348
 
333
- ### Guardrails
349
+ ### 防护栏(Guardrails)
334
350
 
335
- - Only an eligible `task.json.meta.delivery_mode = "analysis_only"` task may complete while `planning`; it may write evidence artifacts, but any protected-target change requires a separate change-bearing task.
336
- - Task creation approval is not implementation approval; change-bearing implementation waits for `task.py start` after artifact review.
337
- - PRD-only is valid for lightweight tasks; complex tasks need `design.md` + `implement.md`.
338
- - Planning must be persisted to task artifacts; checks must run before reporting completion.
351
+ - PRD 写明有界证据和受保护目标不变边界时,`analysis_only` 任务可以在 `planning` 中完成;复杂度、跨 owner 范围、多个证据单元和建议都不会使其失去资格。任何受保护目标变更都需要单独的 change-bearing 任务。
352
+ - 创建任务批准不等于实施批准;change-bearing 实施需等待资产审查后的 `task.py start`。
353
+ - 轻量任务可以只有 PRD;复杂任务需要 `design.md` + `implement.md`。
354
+ - 规划必须持久化到任务资产;报告完成前必须运行检查。
339
355
 
340
- ### Loading Step Detail
356
+ ### 加载步骤详情(Loading Step Detail)
341
357
 
342
- At each step, run this to fetch detailed guidance:
358
+ 每一步都可运行以下命令获取详细指引:
343
359
 
344
360
  ```bash
345
361
  python3 ./.trellis/scripts/get_context.py --mode phase --step <step>
@@ -348,329 +364,332 @@ python3 ./.trellis/scripts/get_context.py --mode phase --step <step>
348
364
 
349
365
  ---
350
366
 
351
- ## Phase 1: Plan
367
+ ## 阶段一:规划(Phase 1: Plan)
352
368
 
353
- Goal: classify the request, perform only eligible direct small work without a task, and create planning artifacts when a task is needed.
369
+ 目标:分类请求;只有符合条件的直接小任务才可不创建任务立即执行;需要任务时创建规划资产。
354
370
 
355
- #### 1.0 Create task `[required · once]`
371
+ #### 1.0 创建任务(Create task)`[required · once]`
356
372
 
357
- 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:
373
+ 只有取得创建任务同意后才创建任务目录。命令会将状态设为 `planning`、写入 `task.json`、创建默认 `prd.md`;会话身份可用时,还会自动将新任务设为当前目标:
358
374
 
359
375
  ```bash
360
376
  python3 ./.trellis/scripts/task.py create "<task title>" --slug <name>
361
377
  ```
362
378
 
363
- `--slug` is the human-readable name only. Do **not** include the `MM-DD-` date prefix; `task.py create` adds that prefix automatically.
379
+ `--slug` 仅填写人类可读名称。不要包含 `MM-DD-` 日期前缀;`task.py create` 会自动添加该前缀。
364
380
 
365
- 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.
381
+ 对于任务树,先创建父任务,再使用 `--parent <parent-dir>` 创建各子任务。不要因为存在子任务就启动父任务;启动拥有下一个可独立验证交付物的子任务。
366
382
 
367
- After this command succeeds, the per-turn breadcrumb auto-switches to `[workflow-state:planning]`, telling the AI to stay in planning.
383
+ 命令成功后,每轮面包屑会自动切换为 `[workflow-state:planning]`,要求 AI 留在规划阶段。
368
384
 
369
- 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.
385
+ 这里仅运行 `create`,不要同时运行 `start`。`start` 会将状态切换为 `in_progress`,在规划资产审查前就把面包屑切换到实施阶段。将 `start` 留到步骤 1.4。
370
386
 
371
- For an evidence-only task, set `task.json.meta.delivery_mode = "analysis_only"` at creation or with `task.py set-meta`. Its PRD must name the evidence deliverable and exclude protected-target changes before the task proceeds.
387
+ 对于只交付证据的任务,在创建时或使用 `task.py set-meta` 设置 `task.json.meta.delivery_mode = "analysis_only"`。任务继续前,其 PRD 必须写明证据交付物并排除受保护目标变更。
372
388
 
373
- Skip when `python3 ./.trellis/scripts/task.py current --source` already points to a task.
389
+ 如果 `python3 ./.trellis/scripts/task.py current --source` 已指向任务,则跳过此步骤。
374
390
 
375
- #### 1.1 Requirement exploration `[required · repeatable]`
391
+ #### 1.1 需求探索(Requirement exploration)`[required · repeatable]`
376
392
 
377
- Load the `trellis-brainstorm` skill and explore requirements interactively with the user per the skill's guidance.
393
+ 加载 `trellis-brainstorm` Skill,按照其指引与用户交互探索需求。
378
394
 
379
- For an eligible analysis-only task, converge the PRD boundary, then perform the declared research, audit, or design work in this phase. It does not need a start review or `task.py start`; after acceptance evidence is recorded, continue directly to Phase 3.3.
395
+ 对于符合条件的 analysis-only 任务,在本阶段收敛 PRD 边界,然后完成声明的研究、审查或设计工作。不需要 start 审查或运行 `task.py start`;记录验收证据后直接进入阶段 3.3。
380
396
 
381
- The brainstorm skill will guide you to:
382
- - Ask one question at a time
383
- - Prefer researching over asking the user
384
- - Prefer offering options over open-ended questions
385
- - Update `prd.md` immediately after each user answer
386
- - Split large scopes into a parent task plus child tasks when the deliverables can be verified independently
387
- - Keep `prd.md` focused on requirements and acceptance criteria
388
- - For complex tasks, produce `design.md` and `implement.md` before implementation starts
397
+ brainstorm Skill 会引导你:
398
+ - 将最多三个相互独立的实质前沿问题成组处理;只有依赖顺序要求时才一次询问一个
399
+ - 优先研究,减少直接询问用户
400
+ - 优先提供选项,减少开放式提问
401
+ - 每次用户答复后立即更新 `prd.md`
402
+ - 交付物可独立验证时,将大范围拆成父任务和子任务
403
+ - 让 `prd.md` 专注于需求和验收标准
404
+ - 复杂任务在开始实施前生成 `design.md` 和 `implement.md`
405
+ - 对阅读量大的工作拆成证据单元,并在继续前持久化每个单元的结论或恢复点
406
+ - 在 change-bearing 实施审查或 `task.py start` 前,对任务资产运行 Planning Seal 收口检查,并锁定目标、分支、依赖、发布、验证、回滚、动态事实处理和实施决策;`analysis_only` 不使用此门禁
389
407
 
390
- When considering a parent/child split:
391
- - Use a parent task when one request contains several independently verifiable deliverables.
392
- - Parent tasks own source requirements, child-task mapping, cross-child acceptance criteria, and final integration review.
393
- - Child tasks own actual deliverables that can be planned, implemented, checked, and archived independently.
394
- - 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`.
395
- - Start the child task that owns the next deliverable. Do not start the parent unless the parent itself has direct implementation work.
408
+ 考虑拆分父子任务时:
409
+ - 一个请求包含多个可独立验证的交付物时使用父任务。
410
+ - 父任务负责原始需求、子任务映射、跨子任务验收标准和最终集成审查。
411
+ - 子任务负责可以独立规划、实施、检查和归档的实际交付物。
412
+ - 父子结构不是依赖系统。如果子任务 B 依赖子任务 A,将顺序写入子任务 B 的 `prd.md` / `implement.md`。
413
+ - 启动拥有下一个交付物的子任务。除非父任务本身有直接实施工作,否则不要启动父任务。
396
414
 
397
- Return to this step whenever requirements change and revise the relevant artifact.
415
+ 需求变化时回到此步骤并修改相关资产。
398
416
 
399
- #### 1.2 Research `[optional · repeatable]`
417
+ #### 1.2 研究(Research)`[optional · repeatable]`
400
418
 
401
- Research can happen at any time during requirement exploration. It isn't limited to local code — you can use any available tool (MCP servers, skills, web search, etc.) to look up external information, including third-party library docs, industry practices, API references, etc.
419
+ 需求探索期间可以随时研究。研究不限于本地代码;可以使用可用的 MCP 服务、Skill、网页搜索等工具查询第三方库文档、行业实践、API 参考等外部信息。
402
420
 
403
421
  [Claude Code, Cursor, OpenCode, codex-sub-agent, Kiro, Gemini, Qoder, CodeBuddy, Copilot, Droid, Pi, Oh My Pi, ZCode, Snow, Reasonix, Trae, Grok, Kimi Code, DeepSeek Harness]
404
422
 
405
- Spawn the research sub-agent:
423
+ 派发研究子代理:
406
424
 
407
- - **Agent type**: `trellis-research`
408
- - **Task description**: Research <specific question>
409
- - **Key requirement**: Research output MUST be persisted to `{TASK_DIR}/research/`
410
- - **DeepSeek Harness**: tell the child to load `trellis-agent-research` exactly once. If `trellis_wait` is available, use the default continuable background mode, dispatch independent questions concurrently when useful, continue unrelated work, then call `trellis_wait` once per child id and consume each settlement notice before advancing. Without `trellis_wait`, dispatch each required child with `run_in_background: false`; do not poll or sleep.
425
+ - **Agent 类型**:`trellis-research`
426
+ - **任务描述**:研究 <具体问题>
427
+ - **关键要求**:研究输出必须持久化到 `{TASK_DIR}/research/`
428
+ - **DeepSeek Harness**:告知子代理恰好加载一次 `trellis-agent-research`。如果提供 `trellis_wait`,使用默认可继续的后台模式;有用时并发派发独立问题,继续不相关工作,然后对每个子代理 ID 调用一次 `trellis_wait` 并消费每个结算通知后再推进。没有 `trellis_wait` 时,每个必需子代理都设置 `run_in_background: false`;不得轮询或 sleep。
411
429
 
412
430
  [/Claude Code, Cursor, OpenCode, codex-sub-agent, Kiro, Gemini, Qoder, CodeBuddy, Copilot, Droid, Pi, Oh My Pi, ZCode, Snow, Reasonix, Trae, Grok, Kimi Code, DeepSeek Harness]
413
431
 
414
432
  [codex-inline, Kilo, Antigravity, Devin]
415
433
 
416
- Do the research in the main session directly and write findings into `{TASK_DIR}/research/`. `codex-inline` is the explicit mode that keeps work in the main session.
434
+ 直接在主会话中研究,并将发现写入 `{TASK_DIR}/research/`。`codex-inline` 是将工作保留在主会话中的明确模式。
417
435
 
418
436
  [/codex-inline, Kilo, Antigravity, Devin]
419
437
 
420
- **Research artifact conventions**:
421
- - One file per research topic (e.g. `research/auth-library-comparison.md`)
422
- - Record third-party library usage examples, API references, version constraints in files
423
- - Note relevant spec file paths you discovered for later reference
438
+ **研究资产约定**:
439
+ - 每个研究主题一个文件(例如 `research/auth-library-comparison.md`)
440
+ - 在文件中记录第三方库用法示例、API 参考和版本约束
441
+ - 记录发现的相关 spec 文件路径,供后续引用
424
442
 
425
- Brainstorm and research can interleave freely — pause to research a technical question, then return to talk with the user.
443
+ 头脑风暴和研究可以交错进行:遇到技术问题先暂停对话进行研究,再回来继续与用户沟通。
426
444
 
427
- **Key principle**: Research output must be written to files, not left only in the chat. Conversations get compacted; files don't.
445
+ **核心原则**:研究输出必须写入文件,不能只留在对话中。对话会被压缩,文件不会。
428
446
 
429
- #### 1.3 Configure context `[required · once]`
447
+ #### 1.3 配置上下文(Configure context)`[required · once]`
430
448
 
431
- Eligible analysis-only tasks skip this step because they never enter Phase 2 or dispatch implementation/check agents.
449
+ 符合条件的 analysis-only 任务不会进入阶段二,也不会派发实施/检查 Agent,因此跳过此步骤。
432
450
 
433
451
  [Claude Code, Cursor, OpenCode, codex-sub-agent, Kiro, Gemini, Qoder, CodeBuddy, Copilot, Droid, Pi, Oh My Pi, ZCode, Snow, Reasonix, Trae, Grok, Kimi Code, DeepSeek Harness]
434
452
 
435
- 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.
453
+ 整理 `implement.jsonl` 和 `check.jsonl`,让阶段二子代理获得正确的 spec/研究上下文。这些文件在 `task create` 时以一行自描述的 `_example` 种子创建;此处需要填入真实条目。
436
454
 
437
- **Location**: `{TASK_DIR}/implement.jsonl` and `{TASK_DIR}/check.jsonl` (already exist).
455
+ **位置**:`{TASK_DIR}/implement.jsonl` 和 `{TASK_DIR}/check.jsonl`(已存在)。
438
456
 
439
- **Format**: one JSON object per line — `{"file": "<path>", "reason": "<why>"}`. Paths are repo-root relative.
457
+ **格式**:每行一个 JSON 对象——`{"file": "<path>", "reason": "<why>"}`。路径相对于仓库根目录。
440
458
 
441
- **What to put in**:
442
- - **Spec files** — `.trellis/spec/<package>/<layer>/index.md` and any specific guideline files (`error-handling.md`, `conventions.md`, etc.) relevant to this task
443
- - **Research files** — `{TASK_DIR}/research/*.md` that the sub-agent will need to consult
459
+ **写入内容**:
460
+ - **Spec 文件**——`.trellis/spec/<package>/<layer>/index.md` 以及与任务相关的具体指南文件(`error-handling.md`、`conventions.md` 等)
461
+ - **研究文件**——子代理需要查阅的 `{TASK_DIR}/research/*.md`
444
462
 
445
- **What NOT to put in**:
446
- - Code files (`src/**`, `packages/**/*.ts`, etc.) — those are read by the sub-agent during implementation, not pre-registered here
447
- - Files you're about to modify — same reason
463
+ **不要写入**:
464
+ - 代码文件(`src/**`、`packages/**/*.ts` 等);子代理会在实施时读取,不在此处预注册
465
+ - 即将修改的文件;原因相同
448
466
 
449
- **Split between the two files**:
450
- - `implement.jsonl` → specs + research the implement sub-agent needs to write code correctly
451
- - `check.jsonl` → specs for the check sub-agent (quality guidelines, check conventions, same research if needed)
467
+ **两个文件的分工**:
468
+ - `implement.jsonl` → 实施子代理正确编写代码所需的 spec 和研究
469
+ - `check.jsonl` → 检查子代理所需的 spec(质量指南、检查约定,以及必要时的相同研究)
452
470
 
453
- 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.
471
+ 这些清单不替代 `implement.md`。`implement.md` 是复杂任务的人类可读执行计划;JSONL 文件只列出要注入或加载的上下文文件。
454
472
 
455
- **How to discover relevant specs**:
473
+ **发现相关 spec**:
456
474
 
457
475
  ```bash
458
476
  python3 ./.trellis/scripts/get_context.py --mode packages
459
477
  ```
460
478
 
461
- Lists every package + its spec layers with paths. Pick the entries that match this task's domain.
479
+ 该命令列出每个包及其 spec 层和路径。选择与本任务领域匹配的条目。
462
480
 
463
- **How to append entries**:
481
+ **追加条目**:
464
482
 
465
- Either edit the jsonl file directly in your editor, or use:
483
+ 可以在编辑器中直接编辑 JSONL 文件,也可以使用:
466
484
 
467
485
  ```bash
468
486
  python3 ./.trellis/scripts/task.py add-context "$TASK_DIR" implement "<path>" "<reason>"
469
487
  python3 ./.trellis/scripts/task.py add-context "$TASK_DIR" check "<path>" "<reason>"
470
488
  ```
471
489
 
472
- Delete the seed `_example` line once real entries exist (optional — it's skipped automatically by consumers).
490
+ 存在真实条目后可以删除 `_example` 种子行(可选;消费者会自动跳过它)。
473
491
 
474
- Ready gate: both `implement.jsonl` and `check.jsonl` must contain at least one real `{"file": "...", "reason": "..."}` entry before `task.py start`. The seed `_example` row alone is not ready.
492
+ 就绪门禁:运行 `task.py start` 前,`implement.jsonl` 和 `check.jsonl` 都必须至少包含一个真实的 `{"file": "...", "reason": "..."}` 条目。只有 `_example` 种子行不算就绪。
475
493
 
476
- Skip this step only when both files already have real curated entries.
494
+ 只有两个文件都已有整理好的真实条目时才跳过此步骤。
477
495
 
478
496
  [/Claude Code, Cursor, OpenCode, codex-sub-agent, Kiro, Gemini, Qoder, CodeBuddy, Copilot, Droid, Pi, Oh My Pi, ZCode, Snow, Reasonix, Trae, Grok, Kimi Code, DeepSeek Harness]
479
497
 
480
498
  [codex-inline, Kilo, Antigravity, Devin]
481
499
 
482
- Skip this step. Context is loaded directly by the `trellis-before-dev` skill in Phase 2.
500
+ 跳过此步骤。阶段二由 `trellis-before-dev` Skill 直接加载上下文。
483
501
 
484
502
  [/codex-inline, Kilo, Antigravity, Devin]
485
503
 
486
- #### 1.4 Activate task `[required · once]`
504
+ #### 1.4 激活任务(Activate task)`[required · once]`
487
505
 
488
- This step applies only to change-bearing tasks. An eligible analysis-only task stays in `planning` and, after its evidence work is complete, continues directly to Phase 3.3 without running `task.py start`.
506
+ 此步骤仅适用于 change-bearing 任务。符合条件的 analysis-only 任务保持 `planning`,完成证据工作后不运行 `task.py start`,直接进入阶段 3.3。
489
507
 
490
- After artifact review, flip the task status to `in_progress`:
508
+ 完成 Planning Seal 收口检查、资产审查以及上文适用的原生 plan seal/approve 门禁后,将任务状态切换为 `in_progress`:
491
509
 
492
510
  ```bash
493
511
  python3 ./.trellis/scripts/task.py start <task-dir>
494
512
  ```
495
513
 
496
- 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-dispatch platforms, `implement.jsonl` and `check.jsonl` must both have real curated entries before start. Runtime consumers tolerate missing or seed-only manifests for compatibility, but that tolerance is not a planning-ready state.
514
+ 轻量任务可以只有 `prd.md`。复杂任务在 start 前必须存在并审查 `prd.md`、`design.md` 和 `implement.md`。在派发子代理的平台上,start 前 `implement.jsonl` 和 `check.jsonl` 都必须有真实整理条目。运行时消费者为兼容性可以容忍清单缺失或只有种子内容,但这种容忍不代表规划已就绪。
497
515
 
498
- After this command succeeds, the breadcrumb auto-switches to `[workflow-state:in_progress]`, and the rest of Phase 2 / 3 follows.
516
+ 命令成功后,面包屑自动切换为 `[workflow-state:in_progress]`,随后进入阶段二和阶段三。
499
517
 
500
- 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.
518
+ 如果 `task.py start` 因会话身份错误而失败(Hook 输入、`TRELLIS_CONTEXT_ID` 或平台原生会话环境中没有上下文键),按照错误提示设置会话身份后重试。
501
519
 
502
- #### 1.5 Completion criteria
520
+ #### 1.5 完成标准(Completion criteria)
503
521
 
504
- | Condition | Required |
522
+ | 条件(Condition) | 必需(Required) |
505
523
  |------|:---:|
506
- | `prd.md` exists | ✅ |
507
- | Change-bearing task: user confirms implementation | ✅ |
508
- | Change-bearing task: `task.py start` has been run (status = in_progress) | ✅ |
509
- | Analysis-only task: exact metadata, named evidence deliverable, recorded acceptance evidence, and protected targets unchanged | ✅ |
510
- | `research/` has artifacts (complex tasks) | recommended |
511
- | `design.md` exists (complex tasks) | ✅ |
512
- | `implement.md` exists (complex tasks) | ✅ |
524
+ | `prd.md` 存在 | ✅ |
525
+ | Change-bearing 任务:用户确认实施 | ✅ |
526
+ | Change-bearing 任务:已运行 `task.py start`(status = in_progress) | ✅ |
527
+ | Analysis-only 任务:准确的元数据、明确的证据交付物、已记录验收证据,且受保护目标未变 | ✅ |
528
+ | `research/` 有资产(复杂任务) | 推荐 |
529
+ | `design.md` 存在(复杂任务) | ✅ |
530
+ | `implement.md` 存在(复杂任务) | ✅ |
531
+ | Change-bearing 任务:已记录 Planning Seal 收口检查;静态实施决策和路径已锁定 | ✅ |
513
532
 
514
533
  [Claude Code, Cursor, OpenCode, codex-sub-agent, Kiro, Gemini, Qoder, CodeBuddy, Copilot, Droid, Pi, Oh My Pi, ZCode, Snow, Reasonix, Trae, Grok, Kimi Code, DeepSeek Harness]
515
534
 
516
- | Change-bearing task: `implement.jsonl` and `check.jsonl` each contain at least one real curated entry (seed row does not count) | ✅ |
535
+ | Change-bearing 任务:`implement.jsonl` 和 `check.jsonl` 都必须至少包含真实整理条目(种子行不算) | ✅ |
517
536
 
518
537
  [/Claude Code, Cursor, OpenCode, codex-sub-agent, Kiro, Gemini, Qoder, CodeBuddy, Copilot, Droid, Pi, Oh My Pi, ZCode, Snow, Reasonix, Trae, Grok, Kimi Code, DeepSeek Harness]
519
538
 
520
539
  ---
521
540
 
522
- ## Phase 2: Execute
541
+ ## 阶段二:执行(Phase 2: Execute)
523
542
 
524
- Goal: turn reviewed planning artifacts into code that passes quality checks.
543
+ 目标:将已审查的规划资产转化为通过质量检查的代码。
525
544
 
526
- #### 2.1 Implement `[required · repeatable]`
545
+ #### 2.1 实施(Implement)`[required · repeatable]`
527
546
 
528
547
  [Claude Code, Cursor, OpenCode, codex-sub-agent, CodeBuddy, Droid, Pi, ZCode, Snow, Oh My Pi]
529
548
 
530
- Spawn the implement sub-agent:
549
+ 派发实施子代理:
531
550
 
532
- - **Agent type**: `trellis-implement`
533
- - **Task description**: Implement the reviewed task artifacts, consulting materials under `{TASK_DIR}/research/`; finish by running project lint and type-check
534
- - **Dispatch prompt guard**: The prompt MUST start with `Active task: <task path>`, then tell the spawned agent it is already the `trellis-implement` sub-agent and must implement directly, not spawn another `trellis-implement` / `trellis-check`.
551
+ - **Agent 类型**:`trellis-implement`
552
+ - **任务描述**:根据已审查的任务资产实施,参考 `{TASK_DIR}/research/` 下的材料;完成后运行项目 lint 和类型检查。
553
+ - **派发提示约束**:提示必须以 `Active task: <task path>` 开始,然后告知派发的 Agent 已经是 `trellis-implement` 子代理,必须直接实施,不得再派发其他 `trellis-implement` / `trellis-check`。
535
554
 
536
- The platform hook/plugin auto-handles:
537
- - Reads `implement.jsonl` and injects referenced spec/research files into the agent prompt
538
- - Injects `prd.md`, `design.md` if present, and `implement.md` if present
539
- - For Codex, `SubagentStart` supplies native context injection; the agent profile keeps child-side loading as the fallback
555
+ 平台 Hook/插件会自动处理:
556
+ - 读取 `implement.jsonl`,并将引用的 spec/研究文件注入 Agent 提示
557
+ - 注入存在时的 `prd.md`、`design.md` 和 `implement.md`
558
+ - 对 Codex,`SubagentStart` 提供原生上下文注入;Agent 配置保留子代理侧读取作为后备路径
540
559
 
541
560
  [/Claude Code, Cursor, OpenCode, codex-sub-agent, CodeBuddy, Droid, Pi, ZCode, Snow, Oh My Pi]
542
561
 
543
562
  [Gemini, Qoder, Copilot, Reasonix, Trae, Grok, Kimi Code, DeepSeek Harness]
544
563
 
545
- Spawn the implement sub-agent:
564
+ 派发实施子代理:
546
565
 
547
- - **Agent type**: `trellis-implement`
548
- - **Task description**: Implement the reviewed task artifacts, consulting materials under `{TASK_DIR}/research/`; finish by running project lint and type-check
549
- - **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`.
550
- - **DeepSeek Harness**: tell the child to load `trellis-agent-implement` exactly once. If `trellis_wait` is available, use the default background mode, continue independent work, then wait once for that child id and consume its successful native settlement notice before Phase 2.2. Without `trellis_wait`, dispatch that child with `run_in_background: false`. Do not poll or sleep.
566
+ - **Agent 类型**:`trellis-implement`
567
+ - **任务描述**:根据已审查的任务资产实施,参考 `{TASK_DIR}/research/` 下的材料;完成后运行项目 lint 和类型检查。
568
+ - **派发提示约束**:提示必须以 `Active task: <task path>` 开始,然后明确告知派发的 Agent 已经是 `trellis-implement`,必须直接实施,不得再派发 `trellis-implement` / `trellis-check`。
569
+ - **DeepSeek Harness**:告知子代理恰好加载一次 `trellis-agent-implement`。提供 `trellis_wait` 时,使用默认后台模式,继续独立工作,然后对该子代理 ID 等待一次并消费其成功的原生结算通知后才进入阶段 2.2。没有 `trellis_wait` 时,派发设置 `run_in_background: false`。不得轮询或 sleep。
551
570
 
552
- The pull-based sub-agent definition auto-handles the context load requirement:
553
- - Resolves the active task with `task.py current --source`, then reads `prd.md`, `design.md` if present, and `implement.md` if present
554
- - Reads `implement.jsonl` and requires the agent to load each referenced spec/research file before coding
571
+ 拉取式子代理定义会自动处理上下文加载:
572
+ - 使用 `task.py current --source` 解析活动任务,然后读取 `prd.md`、存在时的 `design.md` 和 `implement.md`
573
+ - 读取 `implement.jsonl`,并要求 Agent 在编码前加载每个引用的 spec/研究文件
555
574
 
556
575
  [/Gemini, Qoder, Copilot, Reasonix, Trae, Grok, Kimi Code, DeepSeek Harness]
557
576
 
558
577
  [Kiro]
559
578
 
560
- Spawn the implement sub-agent:
579
+ 派发实施子代理:
561
580
 
562
- - **Agent type**: `trellis-implement`
563
- - **Task description**: Implement the reviewed task artifacts, consulting materials under `{TASK_DIR}/research/`; finish by running project lint and type-check
564
- - **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`.
581
+ - **Agent 类型**:`trellis-implement`
582
+ - **任务描述**:根据已审查的任务资产实施,参考 `{TASK_DIR}/research/` 下的材料;完成后运行项目 lint 和类型检查。
583
+ - **派发提示约束**:告知派发的 Agent 已经是 `trellis-implement` 子代理,必须直接实施,不得再派发 `trellis-implement` / `trellis-check`。
565
584
 
566
- The platform prelude auto-handles the context load requirement:
567
- - Reads `implement.jsonl` and injects referenced spec/research files into the agent prompt
568
- - Injects `prd.md`, `design.md` if present, and `implement.md` if present
585
+ 平台前置处理会自动加载上下文:
586
+ - 读取 `implement.jsonl`,并将引用的 spec/研究文件注入 Agent 提示
587
+ - 注入存在时的 `prd.md`、`design.md` 和 `implement.md`
569
588
 
570
589
  [/Kiro]
571
590
 
572
591
  [codex-inline, Kilo, Antigravity, Devin]
573
592
 
574
- 1. Load the `trellis-before-dev` skill to read project guidelines
575
- 2. Read `{TASK_DIR}/prd.md`, then `design.md` if present, then `implement.md` if present
576
- 3. Consult materials under `{TASK_DIR}/research/`
577
- 4. Implement the code per reviewed artifacts
578
- 5. Run project lint and type-check
593
+ 1. 加载 `trellis-before-dev` Skill 读取项目指南
594
+ 2. 读取 `{TASK_DIR}/prd.md`,再读取存在时的 `design.md` 和 `implement.md`
595
+ 3. 查阅 `{TASK_DIR}/research/` 下的材料
596
+ 4. 根据已审查资产实施代码
597
+ 5. 运行项目 lint 和类型检查
579
598
 
580
599
  [/codex-inline, Kilo, Antigravity, Devin]
581
600
 
582
- #### 2.2 Quality check `[required · repeatable]`
601
+ #### 2.2 质量检查(Quality check)`[required · repeatable]`
583
602
 
584
603
  [Claude Code, Cursor, OpenCode, codex-sub-agent, Kiro, Gemini, Qoder, CodeBuddy, Copilot, Droid, Pi, Oh My Pi, ZCode, Snow, Reasonix, Trae, Grok, Kimi Code, DeepSeek Harness]
585
604
 
586
- Spawn the check sub-agent:
605
+ 派发检查子代理:
587
606
 
588
- - **Agent type**: `trellis-check`
589
- - **Task description**: Review all code changes against specs and task artifacts; fix any findings directly; ensure lint and type-check pass
590
- - **Dispatch prompt guard**: The prompt MUST start with `Active task: <task path>`, then tell the spawned agent it is already the `trellis-check` sub-agent and must review/fix directly, not spawn another `trellis-check` / `trellis-implement`.
591
- - **DeepSeek Harness**: tell the child to load `trellis-agent-check` exactly once. If `trellis_wait` is available, use the default background mode, continue independent work, then wait once for that child id and consume its successful native settlement notice before Phase 3. Without `trellis_wait`, dispatch that child with `run_in_background: false`. Do not poll or sleep.
607
+ - **Agent 类型**:`trellis-check`
608
+ - **任务描述**:对照 spec 和任务资产审查全部代码变更;直接修复发现的问题;确保 lint 和类型检查通过。
609
+ - **派发提示约束**:提示必须以 `Active task: <task path>` 开始,然后告知派发的 Agent 已经是 `trellis-check` 子代理,必须直接审查/修复,不得再派发其他 `trellis-check` / `trellis-implement`。
610
+ - **DeepSeek Harness**:告知子代理恰好加载一次 `trellis-agent-check`。提供 `trellis_wait` 时,使用默认后台模式,继续独立工作,然后对该子代理 ID 等待一次并消费其成功的原生结算通知后才进入阶段三。没有 `trellis_wait` 时,派发设置 `run_in_background: false`。不得轮询或 sleep。
592
611
 
593
- The check agent's job:
594
- - Review code changes against specs
595
- - Review code changes against `prd.md`, `design.md` if present, and `implement.md` if present
596
- - Auto-fix issues it finds
597
- - Run lint and typecheck to verify
598
- - A required check that cannot run, is skipped, or exits non-zero is blocked/failed, never passed. Do not weaken or rewrite acceptance criteria to advance the workflow.
612
+ 检查 Agent 的职责:
613
+ - 对照 spec 审查代码变更
614
+ - 对照 `prd.md`、存在时的 `design.md` 和 `implement.md` 审查代码变更
615
+ - 自动修复发现的问题
616
+ - 运行 lint 和类型检查进行验证
617
+ - 必须检查但无法运行、被跳过或以非零状态退出的检查属于阻塞/失败,绝不能算作通过。不要为了推进工作流而降低或改写验收标准。
599
618
 
600
619
  [/Claude Code, Cursor, OpenCode, codex-sub-agent, Kiro, Gemini, Qoder, CodeBuddy, Copilot, Droid, Pi, Oh My Pi, ZCode, Snow, Reasonix, Trae, Grok, Kimi Code, DeepSeek Harness]
601
620
 
602
621
  [codex-inline, Kilo, Antigravity, Devin]
603
622
 
604
- Load the `trellis-check` skill and verify the code per its guidance:
605
- - Spec compliance
606
- - lint / type-check / tests
607
- - Cross-layer consistency (when changes span layers)
623
+ 加载 `trellis-check` Skill 并按其指引验证代码:
624
+ - spec 合规性
625
+ - lint / 类型检查 / 测试
626
+ - 跨层一致性(变更跨层时)
608
627
 
609
- If issues are found → fix → re-check, until green.
628
+ 如果发现问题 → 修复 → 重新检查,直到通过。
610
629
 
611
630
  [/codex-inline, Kilo, Antigravity, Devin]
612
631
 
613
- **Final pass (before Phase 3.4 commit)**: the last 2.2 of a task must run full-scope, not just on the latest implement chunk. List all affected packages with `python3 ./.trellis/scripts/get_context.py --mode packages`, then load each package's spec index Quality Check section. This catches cross-layer / multi-package issues a mid-iteration local 2.2 cannot.
632
+ **最终检查(阶段 3.4 提交前)**:任务最后一次 2.2 必须覆盖完整范围,不能只检查最近一次实施的改动。使用 `python3 ./.trellis/scripts/get_context.py --mode packages` 列出所有受影响的包,然后加载每个包 spec 索引中的质量检查部分。这可以发现中途局部 2.2 无法发现的跨层/多包问题。
614
633
 
615
- #### 2.3 Rollback `[on demand]`
634
+ #### 2.3 回滚(Rollback)`[on demand]`
616
635
 
617
- - `check` reveals a prd defect → return to Phase 1, fix `prd.md`, then redo 2.1
618
- - Implementation went wrong → revert code, redo 2.1
619
- - Need more research → research (same as Phase 1.2), write findings into `research/`
636
+ - `check` 暴露 PRD 缺陷 → 返回阶段一,修复 `prd.md`,然后重新执行 2.1
637
+ - 实施出错 → 回退代码,重新执行 2.1
638
+ - 需要更多研究 → 进行研究(同阶段一的 1.2),将发现写入 `research/`
620
639
 
621
640
  ---
622
641
 
623
- ## Phase 3: Finish
642
+ ## 阶段三:完成(Phase 3: Finish)
624
643
 
625
- Goal: ensure code quality, capture lessons, record the work.
644
+ 目标:确保代码质量,记录经验和工作过程。
626
645
 
627
- **Analysis-only completion route**: after the evidence work in Phase 1, verify the PRD acceptance criteria and no-change boundary, then continue with 3.3 and 3.4 for task artifacts only before `/trellis:finish-work`. Do not run Phase 2 or `task.py start`.
646
+ **Analysis-only 完成路径**:阶段一证据工作完成后,验证 PRD 验收标准和不变更边界,然后只针对任务资产进入 3.3 和 3.4,最后运行 `/trellis:finish-work`。不要运行阶段二或 `task.py start`。
628
647
 
629
- #### 3.2 Debug retrospective `[on demand]`
648
+ #### 3.2 调试复盘(Debug retrospective)`[on demand]`
630
649
 
631
- If this task involved repeated debugging (the same issue was fixed multiple times), load the `trellis-break-loop` skill to:
632
- - Classify the root cause
633
- - Explain why earlier fixes failed
634
- - Propose prevention
650
+ 如果任务涉及重复调试(同一问题被多次修复),加载 `trellis-break-loop` Skill:
651
+ - 分类根因
652
+ - 解释之前的修复为什么失败
653
+ - 提出预防措施
635
654
 
636
- The goal is to capture debugging lessons so the same class of issue doesn't recur.
655
+ 目标是记录调试经验,避免同类问题再次发生。
637
656
 
638
- #### 3.3 Spec update `[required · once]`
657
+ #### 3.3 更新 Spec(Spec update)`[required · once]`
639
658
 
640
- Load the `trellis-update-spec` skill and review whether this task produced new knowledge worth recording:
641
- - Newly discovered patterns or conventions
642
- - Pitfalls you hit
643
- - New technical decisions
659
+ 加载 `trellis-update-spec` Skill,审查本任务是否产生了值得记录的新知识:
660
+ - 新发现的模式或约定
661
+ - 遇到的陷阱
662
+ - 新的技术决策
644
663
 
645
- Update the docs under `.trellis/spec/` accordingly. Even if the conclusion is "nothing to update", walk through the judgment.
664
+ 相应更新 `.trellis/spec/` 下的文档。即使结论是“不需要更新”,也要完成并记录判断过程。
646
665
 
647
- #### 3.4 Commit changes `[required · once]`
666
+ #### 3.4 提交变更(Commit changes)`[required · once]`
648
667
 
649
- **Spec-sync preamble**: before drafting commits, ask: did this task fix a bug or surface non-obvious knowledge that should land in `.trellis/spec/` so future-you (or future-AI) doesn't repeat the mistake? If yes, return to Phase 3.3 first — spec writes belong in the same task's commit batch, not as a forgotten follow-up.
668
+ **Spec 同步前置检查**:起草提交前询问:本任务是否修复了缺陷,或发现了应写入 `.trellis/spec/` 的非显然知识,以免未来的你或 AI 重复犯错?如果是,先回到阶段 3.3;spec 写入应包含在本任务的提交批次中,不能遗忘到后续。
650
669
 
651
- The AI drives a batched commit of this task's code changes so `/finish-work` can run cleanly afterwards. Goal: produce work commits FIRST, then bookkeeping (archive + journal) commits land after — never interleaved.
670
+ 由 AI 批量提交本任务的代码变更,使 `/finish-work` 能在之后干净运行。目标是先生成工作提交,再生成归档和日志等记账提交;两者不得交错。
652
671
 
653
- **Step-by-step**:
672
+ **步骤**:
654
673
 
655
- 1. **Inspect dirty state**:
674
+ 1. **检查脏状态**:
656
675
  ```bash
657
676
  git status --porcelain
658
677
  ```
659
- Snapshot every dirty path. If the working tree is clean, skip to 3.5.
678
+ 记录所有脏路径。如果工作树干净,跳到 3.5。
660
679
 
661
- 2. **Learn commit style** from recent history (so drafted messages blend in):
680
+ 2. **从近期历史了解提交风格**(使拟定消息保持一致):
662
681
  ```bash
663
682
  git log --oneline -5
664
683
  ```
665
- Note the prefix convention (`feat:` / `fix:` / `chore:` / `docs:` ...), language (中文/English), and length style.
684
+ 记录前缀约定(`feat:` / `fix:` / `chore:` / `docs:` 等)、语言(中文/English)和长度风格。
666
685
 
667
- 3. **Classify dirty files into two groups**:
668
- - **AI-edited this session** — files you wrote/edited via Edit/Write/Bash tool calls in this session. You know what changed and why.
669
- - **Unrecognized** — dirty files you did NOT touch this session (could be the user's manual edits, leftover WIP from a previous session, or unrelated work). Do NOT silently include these.
686
+ 3. **将脏文件分为两组**:
687
+ - **本会话由 AI 编辑**——本会话通过 Edit/Write/Bash 工具调用写入或编辑的文件。你知道它们改了什么以及为什么改。
688
+ - **未识别**——本会话没有触碰的脏文件(可能是用户手动编辑、之前会话遗留的 WIP 或无关工作)。不要静默纳入。
670
689
 
671
- 4. **Draft a commit plan**. Group AI-edited files into logical commits (1 commit per coherent change unit, not 1 commit per file). Each entry: `<commit message>` + file list. List unrecognized files separately at the bottom.
690
+ 4. **起草提交计划**。将 AI 编辑的文件按逻辑提交分组(每个连贯变更单元一个提交,而不是每个文件一个提交)。每项包含 `<commit message>` 和文件列表;将未识别文件单独列在末尾。
672
691
 
673
- 5. **Present the plan once, ask for one-shot confirmation**. Format:
692
+ 5. **展示一次计划并一次性请求确认**。格式:
674
693
  ```
675
694
  Proposed commits (in order):
676
695
  1. <message>
@@ -686,54 +705,54 @@ The AI drives a batched commit of this task's code changes so `/finish-work` can
686
705
  Reply 'ok' / '行' to execute. Reply with edits, or '我自己来' / 'manual' to abort.
687
706
  ```
688
707
 
689
- 6. **On confirmation**: run `git add <files>` + `git commit -m "<msg>"` for each batch in order. Do not amend. Do not push.
708
+ 6. **获得确认后**:按顺序对每个批次运行 `git add <files>` + `git commit -m "<msg>"`。不要 amend,不要 push。
690
709
 
691
- 7. **On rejection** (user replies "不行" / "我自己来" / "manual" / any pushback on the plan): stop. Do not attempt a second plan. The user will commit by hand; you skip ahead to 3.5 once they confirm.
710
+ 7. **遭到拒绝时**(用户回复“不行”/“我自己来”/“manual”或对计划提出任何反对):停止,不要再尝试第二个计划。用户会手动提交;用户确认后跳到 3.5。
692
711
 
693
- **Rules**:
694
- - No `git commit --amend` anywhere — three-stage three-commit flow (work commits → archive commit → journal commit).
695
- - Never push to remote in this step.
696
- - If the user wants different message wording but accepts the file grouping, edit the message and re-confirm once — but if they reject the grouping, exit to manual mode.
697
- - The batched plan is one prompt; do not prompt per commit.
712
+ **规则**:
713
+ - 任何位置都不得使用 `git commit --amend`——采用三阶段三提交流程(工作提交 → 归档提交 → 日志提交)。
714
+ - 此步骤绝不 push 到远程。
715
+ - 用户接受文件分组但希望调整消息措辞时,修改消息并重新确认一次;如果拒绝分组,退出到手动模式。
716
+ - 批量计划只使用一个提问,不要逐提交提问。
698
717
 
699
- #### 3.5 Wrap-up reminder
718
+ #### 3.5 收尾提醒(Wrap-up reminder)
700
719
 
701
- After the above, remind the user they can run `/finish-work` to wrap up (archive the task, record the session).
720
+ 完成以上步骤后,提醒用户可以运行 `/finish-work` 收尾(归档任务、记录会话)。
702
721
 
703
722
  ---
704
723
 
705
- ## Customizing Trellis (for forks)
724
+ ## 自定义 Trellis(适用于 fork)
706
725
 
707
- This section is for developers who want to modify the Trellis workflow itself. All customization is done by editing this file; the scripts are parsers only.
726
+ 本节面向需要修改 Trellis 工作流本身的开发者。所有自定义都通过编辑本文件完成;脚本只负责解析。
708
727
 
709
- ### Changing what a step means
728
+ ### 修改步骤含义
710
729
 
711
- Edit the corresponding step's walkthrough body in the Phase 1 / 2 / 3 sections above. Critical invariants:
712
- - No active task must triage first; direct small work may proceed only when bounded, single-surface, and immediately verifiable, otherwise create a Trellis task first.
713
- - Planning must distinguish lightweight PRD-only tasks from complex tasks that require `prd.md`, `design.md`, and `implement.md` before start.
714
- - Every required execution path must keep the Phase 3.4 commit reminder reachable before `/trellis:finish-work`.
730
+ 编辑上方阶段一/二/三中对应步骤的说明正文。关键不变量:
731
+ - 没有活动任务时先分类;只有边界清晰、涉及单一表面且可立即验证的直接小任务可以继续,否则先创建 Trellis 任务。
732
+ - 规划必须区分只有 PRD 的轻量任务,以及 start 前需要 `prd.md`、`design.md` 和 `implement.md` 的复杂任务。
733
+ - 每条必需执行路径都必须在 `/trellis:finish-work` 前保留可达的阶段 3.4 提交提醒。
715
734
 
716
- All tag blocks live in the `## Phase Index` section above, immediately after each phase summary:
735
+ 所有标签块位于上方 `## Phase Index` 区域中,紧跟各阶段摘要之后:
717
736
 
718
- | Scope | Corresponding tag |
737
+ | 范围(Scope) | 对应标签(Corresponding tag) |
719
738
  |---|---|
720
- | No active task (before Phase 1) | `[workflow-state:no_task]` (after the Phase Index ASCII art) |
721
- | One developer-owned task without a session binding | `[workflow-state:unbound_task]` (bind before lifecycle writes) |
722
- | Multiple developer-owned tasks without a session binding | `[workflow-state:unbound_ambiguous]` / `[workflow-state:unbound_ambiguous-inline]` (choose and bind explicitly) |
723
- | Active task record unreadable | `[workflow-state:task_error]` (repair the existing task before continuing) |
724
- | All of Phase 1 (task created → ready for implementation) | `[workflow-state:planning]` (after Phase 1 summary) |
725
- | Codex inline Phase 1 | `[workflow-state:planning-inline]` |
726
- | Phase 2 + Phase 3.2–3.4 (implementation + check + wrap-up) | `[workflow-state:in_progress]` (after Phase 2 summary) |
727
- | Codex inline Phase 2 + Phase 3.2–3.4 | `[workflow-state:in_progress-inline]` |
728
- | After Phase 3.5 (archived) | `[workflow-state:completed]` (after Phase 3 summary; **currently DEAD**) |
739
+ | 没有活动任务(阶段一之前) | `[workflow-state:no_task]`(阶段索引图之后) |
740
+ | 一个开发者所属任务没有会话绑定 | `[workflow-state:unbound_task]`(生命周期写入前绑定) |
741
+ | 多个开发者所属任务没有会话绑定 | `[workflow-state:unbound_ambiguous]` / `[workflow-state:unbound_ambiguous-inline]`(明确选择并绑定) |
742
+ | 活动任务记录不可读 | `[workflow-state:task_error]`(继续前修复已有任务) |
743
+ | 整个阶段一(创建任务 → 实施就绪) | `[workflow-state:planning]`(阶段一摘要之后) |
744
+ | Codex inline 阶段一 | `[workflow-state:planning-inline]` |
745
+ | 阶段二 + 阶段 3.2–3.4(实施 + 检查 + 收尾) | `[workflow-state:in_progress]`(阶段二摘要之后) |
746
+ | Codex inline 阶段二 + 阶段 3.2–3.4 | `[workflow-state:in_progress-inline]` |
747
+ | 阶段 3.5 之后(已归档) | `[workflow-state:completed]`(阶段三摘要之后;**目前不可达**) |
729
748
 
730
- ### Changing the per-turn prompt text
749
+ ### 修改每轮提示文本
731
750
 
732
- Directly edit the body of the corresponding `[workflow-state:STATUS]` block. After editing, run `trellis update` (if you're a template maintainer) or restart your AI session (if you're customizing your own project) — no script changes required.
751
+ 直接编辑对应 `[workflow-state:STATUS]` 块的正文。编辑后,模板维护者运行 `trellis update`,自定义项目重启 AI 会话;不需要修改脚本。
733
752
 
734
- ### Adding a custom status
753
+ ### 添加自定义状态
735
754
 
736
- Add a new block:
755
+ 添加新块:
737
756
 
738
757
  ```
739
758
  [workflow-state:my-status]
@@ -741,14 +760,14 @@ your per-turn prompt text
741
760
  [/workflow-state:my-status]
742
761
  ```
743
762
 
744
- Constraints:
745
- - STATUS charset: `[A-Za-z0-9_-]+` (underscores and hyphens allowed, e.g. `in-review`, `blocked-by-team`)
746
- - A lifecycle hook must write `task.json.status` to your custom value, otherwise the tag is never read
747
- - Lifecycle hooks live in `task.json.hooks.after_*` and bind to one of `after_create / after_start / after_finish / after_archive`
763
+ 约束:
764
+ - STATUS 字符集:`[A-Za-z0-9_-]+`(允许下划线和连字符,例如 `in-review`、`blocked-by-team`)
765
+ - 生命周期 Hook 必须将 `task.json.status` 写为自定义值,否则标签不会被读取
766
+ - 生命周期 Hook 位于 `task.json.hooks.after_*`,绑定到 `after_create / after_start / after_finish / after_archive` 之一
748
767
 
749
- ### Adding a lifecycle hook
768
+ ### 添加生命周期 Hook
750
769
 
751
- Add a `hooks` field to your `task.json`:
770
+ 在 `task.json` 中添加 `hooks` 字段:
752
771
 
753
772
  ```json
754
773
  {
@@ -760,11 +779,11 @@ Add a `hooks` field to your `task.json`:
760
779
  }
761
780
  ```
762
781
 
763
- Supported events: `after_create / after_start / after_finish / after_archive`. Note that `after_finish` ≠ a status change (it only clears the active-task pointer); use `after_archive` for "task is done" notifications.
782
+ 支持的事件:`after_create / after_start / after_finish / after_archive`。注意 `after_finish` 不等于状态变化(它只清除活动任务指针);“任务完成”通知应使用 `after_archive`。
764
783
 
765
- ### Full contract
784
+ ### 完整合同
766
785
 
767
- For the workflow state machine's runtime contract, the locations of all status writers, pseudo-statuses (`no_task` / `stale_<source_type>`), the hook reachability matrix, and other deep details, see:
786
+ 关于工作流状态机运行时合同、所有状态写入位置、伪状态(`no_task` / `stale_<source_type>`)、Hook 可达性矩阵及其他详细内容,参阅:
768
787
 
769
- - `.trellis/spec/cli/backend/workflow-state-contract.md` — runtime contract + writer table + test invariants
770
- - `.trellis/scripts/inject-workflow-state.py` — actual parser (reads workflow.md only, no embedded text)
788
+ - `.trellis/spec/cli/backend/workflow-state-contract.md`——运行时合同、写入表和测试不变量
789
+ - `.trellis/scripts/inject-workflow-state.py`——实际解析器(只读取 workflow.md,没有内嵌正文)