@pennixrv/trellis 0.7.0-beta.45 → 0.7.0-beta.47

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 (35) hide show
  1. package/dist/commands/workflow.js +1 -1
  2. package/dist/commands/workflow.js.map +1 -1
  3. package/dist/migrations/manifests/0.7.0-beta.46.json +9 -0
  4. package/dist/migrations/manifests/0.7.0-beta.47.json +9 -0
  5. package/dist/templates/codex/hooks/session-start.py +6 -6
  6. package/dist/templates/common/skills/brainstorm.md +12 -0
  7. package/dist/templates/common/skills/break-loop.md +4 -0
  8. package/dist/templates/common/skills/check.md +12 -0
  9. package/dist/templates/copilot/hooks/session-start.py +6 -6
  10. package/dist/templates/markdown/spec/backend/database-guidelines.md.txt +22 -22
  11. package/dist/templates/markdown/spec/backend/directory-structure.md.txt +20 -20
  12. package/dist/templates/markdown/spec/backend/error-handling.md.txt +22 -22
  13. package/dist/templates/markdown/spec/backend/index.md.txt +19 -19
  14. package/dist/templates/markdown/spec/backend/logging-guidelines.md.txt +22 -22
  15. package/dist/templates/markdown/spec/backend/quality-guidelines.md.txt +22 -22
  16. package/dist/templates/markdown/spec/frontend/component-guidelines.md.txt +25 -25
  17. package/dist/templates/markdown/spec/frontend/directory-structure.md.txt +20 -20
  18. package/dist/templates/markdown/spec/frontend/hook-guidelines.md.txt +22 -22
  19. package/dist/templates/markdown/spec/frontend/index.md.txt +20 -20
  20. package/dist/templates/markdown/spec/frontend/quality-guidelines.md.txt +22 -22
  21. package/dist/templates/markdown/spec/frontend/state-management.md.txt +22 -22
  22. package/dist/templates/markdown/spec/frontend/type-safety.md.txt +22 -22
  23. package/dist/templates/markdown/spec/guides/code-reuse-thinking-guide.md.txt +80 -85
  24. package/dist/templates/markdown/spec/guides/cross-layer-thinking-guide.md.txt +164 -209
  25. package/dist/templates/markdown/spec/guides/cross-platform-thinking-guide.md.txt +161 -185
  26. package/dist/templates/markdown/spec/guides/index.md.txt +51 -51
  27. package/dist/templates/markdown/workspace-index.md +44 -44
  28. package/dist/templates/opencode/lib/session-utils.js +2 -2
  29. package/dist/templates/shared-hooks/session-start.py +7 -7
  30. package/dist/templates/trellis/scripts/add_session.py +35 -32
  31. package/dist/templates/trellis/scripts/common/developer.py +18 -18
  32. package/dist/templates/trellis/scripts/common/task_store.py +11 -11
  33. package/dist/templates/trellis/scripts/common/workflow_phase.py +4 -3
  34. package/dist/templates/trellis/workflow.md +403 -458
  35. package/package.json +2 -2
@@ -1,104 +1,63 @@
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
- ### Continuation and Compaction
16
-
17
- Reuse the current conversation or sufficient compaction checkpoint when root,
18
- task, phase, authorization and pending action are known. An ordinary continue
19
- resumes that action without repeated startup, task/Git/history or handoff
20
- validation. Query only missing/conflicting facts for a fresh session, changed
21
- target or explicit inspection. Native protected writes retain owner identity
22
- and ownership checks. Never repeat or re-answer consumed pre-compaction user
23
- input; handle genuinely new input normally. No recovery cache or extra waiter.
24
-
25
- ## Plan Approval And Task Selection
26
-
27
- Classify task meta explicitly as `execution_class=direct|planned` and
28
- `delivery_mode=change_bearing|analysis_only`; an unclassified old planning task
29
- needs this once before start. Direct small work and eligible analysis-only work
30
- retain their existing shortest paths. Existing in-progress tasks are not reset.
31
-
32
- Except for clearly bounded research, screen consequential user-owned choices
33
- with `pennix-decision-grill`; one material choice is sufficient. It owns the
34
- progressive questioning method, not task lifecycle. Use dependency-ready,
35
- evidence-backed choices first, then impact/priority; ask one to three coherent
36
- independent decisions and reassess after answers. Do not ask discoverable facts
37
- or settled implementation details. Save the decision checkpoint before bounded
38
- local/web evidence or explicitly approved independent subnodes. An empty ready
39
- frontier may mean missing evidence, not a closed plan.
40
-
41
- For planned/change-bearing work, close decisions and required task artifacts,
42
- run native `task.py plan seal <task>`, present that material plan, and stop before
43
- implementation. Only a later explicit user approval for THIS task's CURRENT
44
- sealed revision authorizes `task.py plan approve <task> --revision <n> --basis
45
- "<short non-sensitive actual approval basis>"`, then `task.py start`. Initial
46
- delivery requests, parent-task approval, and design answers do not qualify.
47
- `--allow-empty-context` overrides only context manifests, never approval.
48
- The native record enforces structure; chat authenticity remains agent-owned.
49
-
50
- Material scope, owner, risk, public behavior, or acceptance changes require
51
- `task.py replan` and a newly sealed, presented, subsequently approved revision.
52
- Resealing a sealed planning task declares a new material revision. Wording,
53
- formatting, progress, and execution evidence do not automatically invalidate it.
54
- Generic create/set-meta cannot prefill the reserved `meta.planning` record.
55
-
56
- An explicitly user-requested addition to an `in_progress` task may continue in
57
- the current phase when it serves the same task, keeps the same actual owner and
58
- target, is small, reversible, and low risk, and changes none of the sealed
59
- scope in substance, owner, risk, public behavior, data integrity, credentials,
60
- deployment/release path, or acceptance. Record the request, classification,
61
- owner, acceptance, and verification in the unsealed execution record; the
62
- request authorizes only that exact addition. If any condition is false or
63
- unclear, preserve the current conclusion, record `decision-needed`, and use
64
- native `task.py replan` with the normal new-seal and later-approval path.
65
-
66
- Use native `task.py select <task>` for context-only selection: no phase/branch
67
- change, after_start hook, or implementation authority. `create --no-start`
68
- deliberately keeps the prior pointer. Save the old checkpoint before switching;
69
- with live Channel work, pause refills and drain all already dispatched units and
70
- reservations according to `trellis-channel`'s multi-target procedure, preserving
71
- pending units and the old phase. Do not kill/retry or automatically restart a
72
- user-stopped task. Ordinary continue/compaction retains the checkpoint fast path.
73
-
74
- ## Trellis System
75
-
76
- ### Developer Identity
77
-
78
- On first use, initialize your identity:
15
+ ### 继续与压缩恢复(Continuation and Compaction)
16
+
17
+ 根目录、任务、阶段、授权和待执行动作已知时,复用当前对话或足够的压缩检查点。普通继续直接恢复该动作,不重复启动、任务/Git/历史或交接核验。新会话、目标变化或用户明确要求检查时,只查询缺失或冲突事实。原生受保护写入保留 owner 身份和所有权检查。不要重复或重答压缩前已经消费的用户输入;真正的新输入按正常流程处理。不增加恢复缓存或额外等待器。
18
+
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
+ 首次使用时初始化身份:
79
38
 
80
39
  ```bash
81
40
  python3 ./.trellis/scripts/init_developer.py <your-name>
82
41
  ```
83
42
 
84
- Creates `.trellis/.developer` (gitignored) + `.trellis/workspace/<your-name>/`.
43
+ 创建 `.trellis/.developer`(由 git 忽略)和 `.trellis/workspace/<your-name>/`。
85
44
 
86
- ### Spec System
45
+ ### Spec 系统(Spec System)
87
46
 
88
- `.trellis/spec/` holds coding guidelines organized by package and layer.
47
+ `.trellis/spec/` 按包和层保存编码指南。
89
48
 
90
- - `.trellis/spec/<package>/<layer>/index.md` — entry point with **Pre-Development Checklist** + **Quality Check**. Actual guidelines live in the `.md` files it points to.
91
- - `.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`——跨包思考指南。
92
51
 
93
52
  ```bash
94
53
  python3 ./.trellis/scripts/get_context.py --mode packages # list packages / layers
95
54
  ```
96
55
 
97
- **When to update spec**: new pattern/convention found · bug-fix prevention to codify · new technical decision.
56
+ **更新 spec 的时机**:发现新的模式/约定、需要固化错误修复预防措施或形成新的技术决策。
98
57
 
99
- ### Task System
58
+ ### 任务系统(Task System)
100
59
 
101
- 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`)。
102
61
 
103
62
  ```bash
104
63
  # Task lifecycle
@@ -137,22 +96,22 @@ python3 ./.trellis/scripts/task.py remove-subtask <parent> <child>
137
96
  python3 ./.trellis/scripts/task.py create-pr [name] [--dry-run]
138
97
  ```
139
98
 
140
- > Run `python3 ./.trellis/scripts/task.py --help` to see the authoritative, up-to-date list.
99
+ > 运行 `python3 ./.trellis/scripts/task.py --help` 查看权威的最新命令列表。
141
100
 
142
- **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/`,并删除仍指向该任务的运行时会话文件。
143
102
 
144
- ### Workspace System
103
+ ### 工作区系统(Workspace System)
145
104
 
146
- Records every AI session for cross-session tracking under `.trellis/workspace/<developer>/`.
105
+ 在 `.trellis/workspace/<developer>/` 下记录每个 AI 会话,用于跨会话跟踪。
147
106
 
148
- - `journal-N.md` — session log. **Max 2000 lines per file**; a new `journal-(N+1).md` is auto-created when exceeded.
149
- - `index.md` — personal index (total sessions, last active).
107
+ - `journal-N.md`——会话日志。每个文件**最多 2000 行**,超过后自动创建 `journal-(N+1).md`。
108
+ - `index.md`——个人索引(会话总数、最近活动)。
150
109
 
151
110
  ```bash
152
111
  python3 ./.trellis/scripts/add_session.py --title "Title" --commit "hash" --summary "Summary"
153
112
  ```
154
113
 
155
- ### Context Script
114
+ ### 上下文脚本(Context Script)
156
115
 
157
116
  ```bash
158
117
  python3 ./.trellis/scripts/get_context.py # full session runtime
@@ -163,55 +122,48 @@ python3 ./.trellis/scripts/get_context.py --mode phase --step <X.Y> # detailed
163
122
  ---
164
123
 
165
124
  <!--
166
- WORKFLOW-STATE BREADCRUMB CONTRACT (read this before editing the tag blocks below)
167
-
168
- The [workflow-state:STATUS] blocks embedded in the ## Phase Index section
169
- below are the SINGLE source of truth for the per-turn `<workflow-state>`
170
- breadcrumb that every supported AI platform's UserPromptSubmit hook
171
- reads. inject-workflow-state.py (Python platforms) and
172
- inject-workflow-state.js (OpenCode plugin) only parse them — there is no
173
- fallback dict baked into the scripts after v0.5.0-rc.0.
174
-
175
- STATUS charset: [A-Za-z0-9_-]+. When the hook can't find a tag, it
176
- degrades to a generic "Refer to workflow.md for current step." line —
177
- intentionally visible so users notice and fix a broken workflow.md.
178
-
179
- INVARIANT (test/regression.test.ts):
180
- Every workflow-walkthrough step marked `[required · once]` must have a
181
- matching enforcement line in its phase's [workflow-state:*] block. The
182
- breadcrumb is the only per-turn channel; if a mandatory step isn't
183
- mentioned there, the AI silently skips it (Phase 1 planning gate
184
- skip and Phase 3.4 commit skip both manifested via this gap).
185
-
186
- TAG ↔ PHASE scoping:
187
- [workflow-state:no_task] → no active task; before Phase 1
188
- [workflow-state:unbound_task] → one developer-owned task exists without a session pointer
189
- [workflow-state:unbound_ambiguous] → multiple developer-owned tasks exist without a session pointer
190
- [workflow-state:unbound_ambiguous-inline] → Codex inline variant of unbound_ambiguous
191
- [workflow-state:task_error] → active task record is unreadable; repair it before continuing
192
- [workflow-state:planning] → all of Phase 1 (status='planning')
193
- [workflow-state:planning-inline] → Codex inline variant of Phase 1
194
- [workflow-state:in_progress] → Phase 2 + Phase 3.2-3.4
195
- (status stays 'in_progress' from
196
- task.py start until task.py archive)
197
- [workflow-state:in_progress-inline] → Codex inline variant of Phase 2/3
198
- [workflow-state:completed] → currently DEAD: cmd_archive flips
199
- status and moves the dir in the same
200
- call, so the resolver loses the
201
- pointer (block kept for a future
202
- explicit in_progress→completed
203
- transition)
204
-
205
- Editing checklist:
206
- - When you change a [workflow-state:STATUS] block, also check the
207
- matching phase's `[required · once]` walkthrough steps for sync
208
- - Run `trellis update` after editing to push the new bodies to
209
- downstream user projects (block-level managed replacement)
210
- - 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
+ - 完整运行时合同:
211
163
  .trellis/spec/cli/backend/workflow-state-contract.md
212
164
  -->
213
165
 
214
- ## Phase Index
166
+ ## 阶段索引(Phase Index)
215
167
 
216
168
  ```
217
169
  Phase 1: Plan → classify, then create planning artifacts for work that needs a task
@@ -219,197 +171,191 @@ Phase 2: Execute → implement only after task status is in_progress
219
171
  Phase 3: Finish → verify, update spec, commit, and wrap up
220
172
  ```
221
173
 
222
- ### Request Triage
174
+ ### 请求分流(Request Triage)
223
175
 
224
- - 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.
225
- - 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.
226
- - User approval to create a task is not approval to start implementation. Planning still happens first.
176
+ - 直接小任务:对于边界清晰、只涉及一个表面且可以立即验证的操作,可以不创建 Trellis 任务直接进行,但仍遵守通常安全规则。如果探索扩大了范围,或发现需要设计、owner、发布或持久记录,先停止并创建任务。
177
+ - 复杂任务:询问是否可以创建 Trellis 任务并进入规划。如果用户拒绝,不进行大范围内联实施;解释、澄清范围或建议拆分为更小的任务。
178
+ - 用户批准创建任务不等于批准开始实施,仍须先完成规划。
227
179
 
228
- ### Analysis-only tasks
180
+ ### analysis-only 任务
229
181
 
230
- An analysis-only task is eligible 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. Complexity, cross-owner scope, multiple evidence units, recommendations, or unresolved product choices do not make it ineligible. The user's research request authorizes the requested main-session evidence work.
182
+ 当 `task.json.meta.delivery_mode = "analysis_only"` 且 `prd.md` 明确证据交付物以及产品源码、运行时配置、部署、凭据和外部系统均不变的边界时,analysis-only 任务符合条件。复杂度、跨 owner 范围、多个证据单元、建议或未解决的产品选择都不会使它失去资格。用户的研究请求授权主会话完成所请求的证据工作。
231
183
 
232
- Keep the task in `planning`: write and verify its research, audit, or design evidence, commit task artifacts, and archive directly. Do not run `task.py start`, configure implementation context, require a Planning Seal, or wait for a second implementation approval. If independent subnode evidence is requested, freeze the dispatch plan in the task and obtain explicit approval before any spawn/send; that approval authorizes only the listed evidence dispatch. If the evidence recommends a protected-target change, record the recommendation and create a separate change-bearing task before doing it.
184
+ 让任务保持 `planning`:写入并验证研究、审查或设计证据,提交任务资产后直接归档。不要运行 `task.py start`,不要配置实施上下文,不要求 Planning Seal,也不等待第二次实施批准。如果需要独立子节点证据,在任务中冻结派发方案,并在任何 spawn/send 前取得明确批准;该批准只授权清单中的证据派发。如果证据建议修改受保护目标,记录建议并另建 change-bearing 任务,之后才能实施。
233
185
 
234
- ### Planning Artifacts
186
+ ### 规划资产(Planning Artifacts)
235
187
 
236
- - `prd.md` — requirements, constraints, and acceptance criteria. Do not put technical design or execution checklists here.
237
- - `design.md` — technical design for complex tasks: boundaries, contracts, data flow, tradeoffs, compatibility, rollout / rollback shape.
238
- - `implement.md` — execution plan for complex tasks: ordered checklist, validation commands, review gates, and rollback points.
239
- - `implement.jsonl` / `check.jsonl` — spec and research manifests for sub-agent context. They do not replace `implement.md`.
240
- - Lightweight tasks may be PRD-only. Complex tasks must have `prd.md`, `design.md`, and `implement.md` before `task.py start`.
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`。
241
193
 
242
- For read-heavy research, audit, review, or investigation, split work that cannot persist one useful conclusion in the current bounded session into evidence units. Each unit records one question or scope, minimal evidence, destination, stop condition, conclusion or blocker, unknowns, and recovery point before the next unit begins. Size for one normal context window, without an exact token or time promise; routine navigation needs no record.
194
+ 对于阅读量较大的研究、审查或调查,将无法在当前有界会话中持久化一个有用结论的工作拆成证据单元。每个单元在开始下一个单元前记录一个问题或范围、最小证据、落点、停止条件、结论或阻塞、未知项和恢复点。按一个普通上下文窗口控制规模,不承诺精确 token 或时间;例行导航无需记录。
243
195
 
244
- ### Parent / Child Task Trees
196
+ ### 父子任务树(Parent / Child Task Trees)
245
197
 
246
- 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
+ 当一个用户请求包含多个可独立验证的交付物时使用父任务。父任务负责源需求集合、任务图、跨子任务验收标准和最终集成审查;除非父任务本身也有直接工作,否则通常不作为实施目标。
247
199
 
248
- 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` 中写明顺序,并保持每个子任务的验收标准可测试。
249
201
 
250
- 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>` 解除错误关联。
251
203
 
252
- <!-- Per-turn breadcrumb: shown when there is no active task (before Phase 1) -->
204
+ <!-- 每轮面包屑:无活动任务时显示(阶段一之前)。 -->
253
205
 
254
206
  [workflow-state:no_task]
255
- 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.
256
- If scope expands or requires design, ownership, release, credentials, or a durable record, create a Trellis task before continuing.
257
- 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 任务并进入规划。如果用户拒绝,解释、澄清范围或建议拆分为更小任务。
258
210
  [/workflow-state:no_task]
259
211
 
260
- <!-- Per-turn breadcrumb: shown when one resumable task exists without a direct session binding. -->
212
+ <!-- 每轮面包屑:存在一个可恢复任务且无直接会话绑定时显示。 -->
261
213
 
262
214
  [workflow-state:unbound_task]
263
- An existing developer-owned task has no direct session binding. Inspect native `task.py current --json`: a non-null `session_source` means direct identity is already available; an unbound source still means no task binding. Select the existing task from the user's explicit intent; do not guess or create a duplicate. Resume its planning/status gates first. Run native `task.py start <task>` only when its activation contract permits it, after the Planning Seal and implementation authorization for a planning change-bearing task. An eligible `analysis_only` task stays in planning without start. If identity is absent, report that separately; never invent an identity or edit runtime pointers.
215
+ 已有一个由开发者拥有的任务,但没有直接会话绑定。检查原生 `task.py current --json`:非空 `session_source` 表示直接身份已可用;未绑定来源仍表示没有任务绑定。根据用户明确意图选择已有任务,不要猜测或创建重复任务。先恢复其规划/状态门禁。只有激活合同允许时,才在 Planning Seal 和 change-bearing 任务实施授权之后运行原生 `task.py start <task>`。符合条件的 `analysis_only` 任务保持 planning,不运行 start。缺少身份时单独报告;绝不虚构身份或编辑运行时指针。
264
216
  [/workflow-state:unbound_task]
265
217
 
266
- <!-- Per-turn breadcrumb shown when multiple resumable tasks exist without a direct session binding. -->
218
+ <!-- 每轮面包屑:存在多个可恢复任务且无直接会话绑定时显示。 -->
267
219
 
268
220
  [workflow-state:unbound_ambiguous]
269
- Multiple developer-owned tasks have no direct session binding. Inspect native `task.py current --json`: a non-null `session_source` means direct identity is already available; an unbound source still means no task binding. Select the existing task from the user's explicit intent; do not guess or create a duplicate. Resume its planning/status gates first. Run native `task.py start <task>` only when its activation contract permits it, after the Planning Seal and implementation authorization for a planning change-bearing task. An eligible `analysis_only` task stays in planning without start. If identity is absent, report that separately; never invent an identity or edit runtime pointers.
221
+ 多个由开发者拥有的任务没有直接会话绑定。检查原生 `task.py current --json`:非空 `session_source` 表示直接身份已可用;未绑定来源仍表示没有任务绑定。根据用户明确意图选择已有任务,不要猜测或创建重复任务。先恢复其规划/状态门禁。只有激活合同允许时,才在 Planning Seal 和 change-bearing 任务实施授权之后运行原生 `task.py start <task>`。符合条件的 `analysis_only` 任务保持 planning,不运行 start。缺少身份时单独报告;绝不虚构身份或编辑运行时指针。
270
222
  [/workflow-state:unbound_ambiguous]
271
223
 
272
224
  [workflow-state:unbound_ambiguous-inline]
273
- Multiple developer-owned tasks have no direct session binding. Inspect native `task.py current --json`: a non-null `session_source` means direct identity is already available; an unbound source still means no task binding. Select the existing task from the user's explicit intent; do not guess or create a duplicate. Resume its planning/status gates first. Run native `task.py start <task>` only when its activation contract permits it, after the Planning Seal and implementation authorization for a planning change-bearing task. An eligible `analysis_only` task stays in planning without start. If identity is absent, report that separately; never invent an identity or edit runtime pointers.
225
+ 多个由开发者拥有的任务没有直接会话绑定。检查原生 `task.py current --json`:非空 `session_source` 表示直接身份已可用;未绑定来源仍表示没有任务绑定。根据用户明确意图选择已有任务,不要猜测或创建重复任务。先恢复其规划/状态门禁。只有激活合同允许时,才在 Planning Seal 和 change-bearing 任务实施授权之后运行原生 `task.py start <task>`。符合条件的 `analysis_only` 任务保持 planning,不运行 start。缺少身份时单独报告;绝不虚构身份或编辑运行时指针。
274
226
  [/workflow-state:unbound_ambiguous-inline]
275
227
 
276
- <!-- Per-turn breadcrumb: shown when the active task record cannot be read. -->
228
+ <!-- 每轮面包屑:活动任务记录不可读时显示。 -->
277
229
 
278
230
  [workflow-state:task_error]
279
- The active task record could not be read. Do not create or activate another task.
280
- Inspect the task directory named above and repair its task.json. It must be a valid JSON object with a non-empty status.
281
- 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
+ 保留现有任务字段和资产。如果无法安全确定正确状态,在重建记录前询问用户。
282
234
  [/workflow-state:task_error]
283
235
 
284
- ### Phase 1: Plan
285
- - 1.0 Create task `[required · once]` (only after task-creation consent)
286
- - 1.1 Requirement exploration `[required · repeatable]` (`prd.md`; complex tasks also need `design.md` + `implement.md`)
287
- - 1.2 Research `[optional · repeatable]`
288
- - 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)
289
- - 1.4 Activate task `[required · once]` (change-bearing tasks only: review gate, then `task.py start`; status → in_progress)
290
- - 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 完成标准
291
243
 
292
- <!-- Per-turn breadcrumb: shown throughout Phase 1 (status='planning') -->
244
+ <!-- 每轮面包屑:整个阶段一显示(status='planning')。 -->
293
245
 
294
246
  [workflow-state:planning]
295
- Load `trellis-brainstorm`; stay in planning.
296
- If `task.json.meta.delivery_mode = "analysis_only"` exactly, complete bounded evidence work regardless of complexity or cross-owner scope; the PRD names the evidence deliverable and protected-target no-change boundary. Do not run a Planning Seal or wait for implementation approval. A protected-target recommendation requires a separate change-bearing task.
297
- For `analysis_only`, complete the bounded evidence work regardless of complexity or cross-owner scope; its PRD names the evidence deliverable and protected-target no-change boundary. Do not run a Planning Seal or wait for implementation approval. For change-bearing work, lightweight tasks may use `prd.md`; complex tasks need `design.md` and `implement.md` plus the Planning Seal before implementation review. Research recommendations and open product choices may be recorded without sealing them as implementation decisions. Persist answers needed to define the requested work and continue the same planning loop.
298
- Multi-deliverable scope: consider a parent task plus independently verifiable child tasks; dependencies must be written in child artifacts, not implied by tree position.
299
- Sub-agent mode: curate `implement.jsonl` and `check.jsonl` as spec/research manifests before start.
300
- Planned/change-bearing start requires native plan seal and matching later approval of this task's current material revision. Selecting context does not approve it.
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,以及对当前任务当前实质版本的匹配批准。选择上下文不构成批准。
301
253
  [/workflow-state:planning]
302
254
 
303
- <!-- Per-turn breadcrumb: shown throughout Phase 1 when Codex uses its default
304
- codex.dispatch_mode=inline. Codex-only alternate to [workflow-state:planning]. The main agent
305
- edits code directly in Phase 2, so jsonl curation is skipped —
306
- the inline workflow loads `trellis-before-dev` instead of injecting JSONL
307
- into a sub-agent. -->
255
+ <!-- Codex 使用默认 codex.dispatch_mode=inline 时,阶段一持续显示的每轮面包屑。
256
+ 这是 [workflow-state:planning] 的 Codex 专用替代块。主 Agent 在阶段二直接编辑代码,
257
+ 因此跳过 JSONL 整理;inline 工作流加载 `trellis-before-dev`,而不是向子代理注入 JSONL。 -->
308
258
 
309
259
  [workflow-state:planning-inline]
310
- Load `trellis-brainstorm`; stay in planning.
311
- If `task.json.meta.delivery_mode = "analysis_only"` exactly, complete bounded evidence work regardless of complexity or cross-owner scope; the PRD names the evidence deliverable and protected-target no-change boundary. Do not run a Planning Seal or wait for implementation approval. A protected-target recommendation requires a separate change-bearing task.
312
- For `analysis_only`, complete the bounded evidence work regardless of complexity or cross-owner scope; its PRD names the evidence deliverable and protected-target no-change boundary. Do not run a Planning Seal or wait for implementation approval. For change-bearing work, lightweight tasks may use `prd.md`; complex tasks need `design.md` and `implement.md` plus the Planning Seal before implementation review. Research recommendations and open product choices may be recorded without sealing them as implementation decisions. Persist answers needed to define the requested work and continue the same planning loop.
313
- Multi-deliverable scope: consider a parent task plus independently verifiable child tasks; dependencies must be written in child artifacts, not implied by tree position.
314
- Inline mode: skip jsonl curation; Phase 2 reads artifacts/specs via `trellis-before-dev`.
315
- Planned/change-bearing start requires native plan seal and matching later approval of this task's current material revision. Selecting context does not approve it.
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,以及对当前任务当前实质版本的匹配批准。选择上下文不构成批准。
316
266
  [/workflow-state:planning-inline]
317
267
 
318
- ### Phase 2: Execute
319
- - 2.1 Implement `[required · repeatable]`
320
- - 2.2 Quality check `[required · repeatable]`
321
- - 2.3 Rollback `[on demand]`
268
+ ### 阶段二:执行(Phase 2: Execute)
269
+ - 2.1 实施 `[required · repeatable]`
270
+ - 2.2 质量检查 `[required · repeatable]`
271
+ - 2.3 回滚 `[on demand]`
322
272
 
323
- <!-- Per-turn breadcrumb: shown while status='in_progress'.
324
- Scope: all of Phase 2 + Phase 3.2-3.4 (status stays 'in_progress' from
325
- task.py start until task.py archive; only archive flips it). The body
326
- therefore must cover every required step from implementation through
327
- 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 提交。 -->
328
277
 
329
- 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` 或其他长命令模拟等待,也不得让后台子代理脱离事件驱动的等待路径。
330
279
 
331
280
  [workflow-state:in_progress]
332
- An explicitly user-requested bounded amendment that satisfies the in-progress conditions above stays in the current phase and is recorded in the unsealed execution record. If a material unresolved decision appears, immediately explain its impact and recommendation, stop dependent actions and record `decision-needed`. Run native `task.py replan <task> "<reason>"` to planning, then use the blocking question tool and re-seal/approve the new material revision. Do not defer the decision or change task state by hand.
333
- 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.
334
- 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.
335
- Flow: `trellis-implement` -> `trellis-check` -> `trellis-update-spec` -> commit (Phase 3.4) -> `/trellis:finish-work`.
336
- 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.
337
- 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`。
338
287
  [/workflow-state:in_progress]
339
288
 
340
- <!-- Per-turn breadcrumb: shown while status='in_progress' when Codex uses its
341
- default codex.dispatch_mode=inline. Codex-only alternate to
342
- [workflow-state:in_progress]. The main session edits code directly
343
- instead of dispatching sub-agents. -->
289
+ <!-- 每轮面包屑:status='in_progress' 且 Codex 使用默认
290
+ codex.dispatch_mode=inline 时显示。仅供 Codex 替代
291
+ [workflow-state:in_progress];主会话直接编辑代码,不派发子代理。 -->
344
292
 
345
293
  [workflow-state:in_progress-inline]
346
- Flow: `trellis-before-dev` -> edit -> `trellis-check` -> validation -> `trellis-update-spec` -> commit (Phase 3.4) -> `/trellis:finish-work`.
347
- An explicitly user-requested bounded amendment that satisfies the in-progress conditions above stays in the current phase and is recorded in the unsealed execution record. If a material unresolved decision appears, immediately explain its impact and recommendation, stop dependent actions and record `decision-needed`. Run native `task.py replan <task> "<reason>"` to planning, then use the blocking question tool and re-seal/approve the new material revision. Do not defer the decision or change task state by hand.
348
- Do not dispatch implement/check sub-agents in inline mode.
349
- Explicit Channel independent-evidence subnodes remain available under the selected workflow; required independent evidence cannot be replaced by main-session pass claims.
350
- 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/研究。
351
299
  [/workflow-state:in_progress-inline]
352
300
 
353
- ### Phase 3: Finish
354
- - 3.2 Debug retrospective `[on demand]`
355
- - 3.3 Spec update `[required · once]`
356
- - 3.4 Commit changes `[required · once]`
357
- - 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 收尾提醒
358
306
 
359
- > 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(提交前置检查)。保留原有编号,避免破坏外部引用。
360
308
 
361
- <!-- Per-turn breadcrumb: shown while status='completed'.
362
- Currently DEAD in normal flow: cmd_archive writes status='completed' in
363
- the same call that moves the task dir to archive/, so the active-task
364
- resolver loses the pointer and the hook never fires on archived tasks.
365
- Block preserved for a future status-transition redesign (e.g. an
366
- explicit in_progress→completed command). Edit through the same spec
367
- channel as the live blocks. -->
309
+ <!-- 每轮面包屑:status='completed' 时显示。
310
+ 当前正常流程不可达:cmd_archive 在同次调用写入 status='completed'
311
+ 并将目录移至 archive/,活动任务解析器失去指针,Hook 不会作用于归档任务。
312
+ 保留此块供未来状态转换重设计使用(如显式 in_progress→completed 命令)。
313
+ 修改时遵循与活动块相同的 spec 入口。 -->
368
314
 
369
315
  [workflow-state:completed]
370
- Code committed. Run `/trellis:finish-work`; if dirty, return to Phase 3.4 first.
316
+ 代码已提交。运行 `/trellis:finish-work`;如果工作树仍脏,先回到阶段 3.4。
371
317
  [/workflow-state:completed]
372
318
 
373
- ### Rules
319
+ ### 规则(Rules)
374
320
 
375
- 1. Identify which Phase you're in, then continue from the next step there
376
- 2. Run steps in order inside each Phase; `[required]` steps can't be skipped
377
- 3. Phases can roll back (e.g., Execute reveals a prd defect → return to Plan to fix, then re-enter Execute)
378
- 4. Steps tagged `[once]` are skipped if the output already exists; don't re-run
379
- 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`,复杂任务缺少它们则表示规划未完成。
380
326
 
381
- ### Active Task Routing
327
+ ### 活动任务路由(Active Task Routing)
382
328
 
383
- When a user request matches one of these intents inside an active task, route first, then load the detailed phase step if needed.
329
+ 活动任务中的用户请求符合下列意图时,先路由,再按需要加载阶段步骤详情。
384
330
 
385
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]
386
332
 
387
- - Planning or unclear requirements -> `trellis-brainstorm`.
388
- - Explicit eligible `analysis_only` -> complete evidence in planning, then commit artifacts and archive directly.
389
- - `in_progress` implementation/check -> dispatch `trellis-implement` / `trellis-check`.
390
- - 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`。
391
337
 
392
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]
393
339
 
394
340
  [codex-inline, Kilo, Antigravity, Devin]
395
341
 
396
- - Planning or unclear requirements -> `trellis-brainstorm`.
397
- - Explicit eligible `analysis_only` -> complete evidence in planning, then commit artifacts and archive directly.
398
- - Before editing -> `trellis-before-dev`; after editing -> `trellis-check`.
399
- - 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`。
400
346
 
401
347
  [/codex-inline, Kilo, Antigravity, Devin]
402
348
 
403
- ### Guardrails
349
+ ### 防护栏(Guardrails)
404
350
 
405
- - `analysis_only` tasks may complete in `planning` when their PRD names bounded evidence and a protected-target no-change boundary; complexity, cross-owner scope, multiple evidence units, and recommendations do not make them ineligible. Any protected-target change requires a separate change-bearing task.
406
- - Task creation approval is not implementation approval; change-bearing implementation waits for `task.py start` after artifact review.
407
- - PRD-only is valid for lightweight tasks; complex tasks need `design.md` + `implement.md`.
408
- - 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
+ - 规划必须持久化到任务资产;报告完成前必须运行检查。
409
355
 
410
- ### Loading Step Detail
356
+ ### 加载步骤详情(Loading Step Detail)
411
357
 
412
- At each step, run this to fetch detailed guidance:
358
+ 每一步都可运行以下命令获取详细指引:
413
359
 
414
360
  ```bash
415
361
  python3 ./.trellis/scripts/get_context.py --mode phase --step <step>
@@ -418,333 +364,332 @@ python3 ./.trellis/scripts/get_context.py --mode phase --step <step>
418
364
 
419
365
  ---
420
366
 
421
- ## Phase 1: Plan
367
+ ## 阶段一:规划(Phase 1: Plan)
422
368
 
423
- Goal: classify the request, perform only eligible direct small work without a task, and create planning artifacts when a task is needed.
369
+ 目标:分类请求;只有符合条件的直接小任务才可不创建任务立即执行;需要任务时创建规划资产。
424
370
 
425
- #### 1.0 Create task `[required · once]`
371
+ #### 1.0 创建任务(Create task)`[required · once]`
426
372
 
427
- 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`;会话身份可用时,还会自动将新任务设为当前目标:
428
374
 
429
375
  ```bash
430
376
  python3 ./.trellis/scripts/task.py create "<task title>" --slug <name>
431
377
  ```
432
378
 
433
- `--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` 会自动添加该前缀。
434
380
 
435
- 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>` 创建各子任务。不要因为存在子任务就启动父任务;启动拥有下一个可独立验证交付物的子任务。
436
382
 
437
- 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 留在规划阶段。
438
384
 
439
- 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。
440
386
 
441
- 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 必须写明证据交付物并排除受保护目标变更。
442
388
 
443
- Skip when `python3 ./.trellis/scripts/task.py current --source` already points to a task.
389
+ 如果 `python3 ./.trellis/scripts/task.py current --source` 已指向任务,则跳过此步骤。
444
390
 
445
- #### 1.1 Requirement exploration `[required · repeatable]`
391
+ #### 1.1 需求探索(Requirement exploration)`[required · repeatable]`
446
392
 
447
- Load the `trellis-brainstorm` skill and explore requirements interactively with the user per the skill's guidance.
393
+ 加载 `trellis-brainstorm` Skill,按照其指引与用户交互探索需求。
448
394
 
449
- 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。
450
396
 
451
- The brainstorm skill will guide you to:
452
- - Batch up to three independent material frontier questions; ask one only when dependency ordering requires it
453
- - Prefer researching over asking the user
454
- - Prefer offering options over open-ended questions
455
- - Update `prd.md` immediately after each user answer
456
- - Split large scopes into a parent task plus child tasks when the deliverables can be verified independently
457
- - Keep `prd.md` focused on requirements and acceptance criteria
458
- - For complex tasks, produce `design.md` and `implement.md` before implementation starts
459
- - For read-heavy work, split long investigation into evidence units and persist each unit's conclusion or recovery point before continuing
460
- - Before change-bearing implementation review or `task.py start`, run the Planning Seal closure pass across task artifacts and lock targets, branches, dependencies, release, validation, rollback, dynamic-fact handling, and implementation decisions; `analysis_only` does not use this gate
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` 不使用此门禁
461
407
 
462
- When considering a parent/child split:
463
- - Use a parent task when one request contains several independently verifiable deliverables.
464
- - Parent tasks own source requirements, child-task mapping, cross-child acceptance criteria, and final integration review.
465
- - Child tasks own actual deliverables that can be planned, implemented, checked, and archived independently.
466
- - 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`.
467
- - 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
+ - 启动拥有下一个交付物的子任务。除非父任务本身有直接实施工作,否则不要启动父任务。
468
414
 
469
- Return to this step whenever requirements change and revise the relevant artifact.
415
+ 需求变化时回到此步骤并修改相关资产。
470
416
 
471
- #### 1.2 Research `[optional · repeatable]`
417
+ #### 1.2 研究(Research)`[optional · repeatable]`
472
418
 
473
- 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 参考等外部信息。
474
420
 
475
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]
476
422
 
477
- Spawn the research sub-agent:
423
+ 派发研究子代理:
478
424
 
479
- - **Agent type**: `trellis-research`
480
- - **Task description**: Research <specific question>
481
- - **Key requirement**: Research output MUST be persisted to `{TASK_DIR}/research/`
482
- - **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。
483
429
 
484
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]
485
431
 
486
432
  [codex-inline, Kilo, Antigravity, Devin]
487
433
 
488
- 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` 是将工作保留在主会话中的明确模式。
489
435
 
490
436
  [/codex-inline, Kilo, Antigravity, Devin]
491
437
 
492
- **Research artifact conventions**:
493
- - One file per research topic (e.g. `research/auth-library-comparison.md`)
494
- - Record third-party library usage examples, API references, version constraints in files
495
- - Note relevant spec file paths you discovered for later reference
438
+ **研究资产约定**:
439
+ - 每个研究主题一个文件(例如 `research/auth-library-comparison.md`)
440
+ - 在文件中记录第三方库用法示例、API 参考和版本约束
441
+ - 记录发现的相关 spec 文件路径,供后续引用
496
442
 
497
- Brainstorm and research can interleave freely — pause to research a technical question, then return to talk with the user.
443
+ 头脑风暴和研究可以交错进行:遇到技术问题先暂停对话进行研究,再回来继续与用户沟通。
498
444
 
499
- **Key principle**: Research output must be written to files, not left only in the chat. Conversations get compacted; files don't.
445
+ **核心原则**:研究输出必须写入文件,不能只留在对话中。对话会被压缩,文件不会。
500
446
 
501
- #### 1.3 Configure context `[required · once]`
447
+ #### 1.3 配置上下文(Configure context)`[required · once]`
502
448
 
503
- Eligible analysis-only tasks skip this step because they never enter Phase 2 or dispatch implementation/check agents.
449
+ 符合条件的 analysis-only 任务不会进入阶段二,也不会派发实施/检查 Agent,因此跳过此步骤。
504
450
 
505
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]
506
452
 
507
- 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` 种子创建;此处需要填入真实条目。
508
454
 
509
- **Location**: `{TASK_DIR}/implement.jsonl` and `{TASK_DIR}/check.jsonl` (already exist).
455
+ **位置**:`{TASK_DIR}/implement.jsonl` 和 `{TASK_DIR}/check.jsonl`(已存在)。
510
456
 
511
- **Format**: one JSON object per line — `{"file": "<path>", "reason": "<why>"}`. Paths are repo-root relative.
457
+ **格式**:每行一个 JSON 对象——`{"file": "<path>", "reason": "<why>"}`。路径相对于仓库根目录。
512
458
 
513
- **What to put in**:
514
- - **Spec files** — `.trellis/spec/<package>/<layer>/index.md` and any specific guideline files (`error-handling.md`, `conventions.md`, etc.) relevant to this task
515
- - **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`
516
462
 
517
- **What NOT to put in**:
518
- - Code files (`src/**`, `packages/**/*.ts`, etc.) — those are read by the sub-agent during implementation, not pre-registered here
519
- - Files you're about to modify — same reason
463
+ **不要写入**:
464
+ - 代码文件(`src/**`、`packages/**/*.ts` 等);子代理会在实施时读取,不在此处预注册
465
+ - 即将修改的文件;原因相同
520
466
 
521
- **Split between the two files**:
522
- - `implement.jsonl` → specs + research the implement sub-agent needs to write code correctly
523
- - `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(质量指南、检查约定,以及必要时的相同研究)
524
470
 
525
- 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 文件只列出要注入或加载的上下文文件。
526
472
 
527
- **How to discover relevant specs**:
473
+ **发现相关 spec**:
528
474
 
529
475
  ```bash
530
476
  python3 ./.trellis/scripts/get_context.py --mode packages
531
477
  ```
532
478
 
533
- Lists every package + its spec layers with paths. Pick the entries that match this task's domain.
479
+ 该命令列出每个包及其 spec 层和路径。选择与本任务领域匹配的条目。
534
480
 
535
- **How to append entries**:
481
+ **追加条目**:
536
482
 
537
- Either edit the jsonl file directly in your editor, or use:
483
+ 可以在编辑器中直接编辑 JSONL 文件,也可以使用:
538
484
 
539
485
  ```bash
540
486
  python3 ./.trellis/scripts/task.py add-context "$TASK_DIR" implement "<path>" "<reason>"
541
487
  python3 ./.trellis/scripts/task.py add-context "$TASK_DIR" check "<path>" "<reason>"
542
488
  ```
543
489
 
544
- Delete the seed `_example` line once real entries exist (optional — it's skipped automatically by consumers).
490
+ 存在真实条目后可以删除 `_example` 种子行(可选;消费者会自动跳过它)。
545
491
 
546
- 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` 种子行不算就绪。
547
493
 
548
- Skip this step only when both files already have real curated entries.
494
+ 只有两个文件都已有整理好的真实条目时才跳过此步骤。
549
495
 
550
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]
551
497
 
552
498
  [codex-inline, Kilo, Antigravity, Devin]
553
499
 
554
- Skip this step. Context is loaded directly by the `trellis-before-dev` skill in Phase 2.
500
+ 跳过此步骤。阶段二由 `trellis-before-dev` Skill 直接加载上下文。
555
501
 
556
502
  [/codex-inline, Kilo, Antigravity, Devin]
557
503
 
558
- #### 1.4 Activate task `[required · once]`
504
+ #### 1.4 激活任务(Activate task)`[required · once]`
559
505
 
560
- 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。
561
507
 
562
- After the Planning Seal closure pass, artifact review, and applicable native
563
- plan seal/approve gates described above, flip the task status to `in_progress`:
508
+ 完成 Planning Seal 收口检查、资产审查以及上文适用的原生 plan seal/approve 门禁后,将任务状态切换为 `in_progress`:
564
509
 
565
510
  ```bash
566
511
  python3 ./.trellis/scripts/task.py start <task-dir>
567
512
  ```
568
513
 
569
- 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` 都必须有真实整理条目。运行时消费者为兼容性可以容忍清单缺失或只有种子内容,但这种容忍不代表规划已就绪。
570
515
 
571
- 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]`,随后进入阶段二和阶段三。
572
517
 
573
- 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` 或平台原生会话环境中没有上下文键),按照错误提示设置会话身份后重试。
574
519
 
575
- #### 1.5 Completion criteria
520
+ #### 1.5 完成标准(Completion criteria)
576
521
 
577
- | Condition | Required |
522
+ | 条件(Condition) | 必需(Required) |
578
523
  |------|:---:|
579
- | `prd.md` exists | ✅ |
580
- | Change-bearing task: user confirms implementation | ✅ |
581
- | Change-bearing task: `task.py start` has been run (status = in_progress) | ✅ |
582
- | Analysis-only task: exact metadata, named evidence deliverable, recorded acceptance evidence, and protected targets unchanged | ✅ |
583
- | `research/` has artifacts (complex tasks) | recommended |
584
- | `design.md` exists (complex tasks) | ✅ |
585
- | `implement.md` exists (complex tasks) | ✅ |
586
- | Change-bearing task: Planning Seal closure pass recorded; static implementation decisions and paths are locked | ✅ |
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 收口检查;静态实施决策和路径已锁定 | ✅ |
587
532
 
588
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]
589
534
 
590
- | 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` 都必须至少包含真实整理条目(种子行不算) | ✅ |
591
536
 
592
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]
593
538
 
594
539
  ---
595
540
 
596
- ## Phase 2: Execute
541
+ ## 阶段二:执行(Phase 2: Execute)
597
542
 
598
- Goal: turn reviewed planning artifacts into code that passes quality checks.
543
+ 目标:将已审查的规划资产转化为通过质量检查的代码。
599
544
 
600
- #### 2.1 Implement `[required · repeatable]`
545
+ #### 2.1 实施(Implement)`[required · repeatable]`
601
546
 
602
547
  [Claude Code, Cursor, OpenCode, codex-sub-agent, CodeBuddy, Droid, Pi, ZCode, Snow, Oh My Pi]
603
548
 
604
- Spawn the implement sub-agent:
549
+ 派发实施子代理:
605
550
 
606
- - **Agent type**: `trellis-implement`
607
- - **Task description**: Implement the reviewed task artifacts, consulting materials under `{TASK_DIR}/research/`; finish by running project lint and type-check
608
- - **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`。
609
554
 
610
- The platform hook/plugin auto-handles:
611
- - Reads `implement.jsonl` and injects referenced spec/research files into the agent prompt
612
- - Injects `prd.md`, `design.md` if present, and `implement.md` if present
613
- - 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 配置保留子代理侧读取作为后备路径
614
559
 
615
560
  [/Claude Code, Cursor, OpenCode, codex-sub-agent, CodeBuddy, Droid, Pi, ZCode, Snow, Oh My Pi]
616
561
 
617
562
  [Gemini, Qoder, Copilot, Reasonix, Trae, Grok, Kimi Code, DeepSeek Harness]
618
563
 
619
- Spawn the implement sub-agent:
564
+ 派发实施子代理:
620
565
 
621
- - **Agent type**: `trellis-implement`
622
- - **Task description**: Implement the reviewed task artifacts, consulting materials under `{TASK_DIR}/research/`; finish by running project lint and type-check
623
- - **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`.
624
- - **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。
625
570
 
626
- The pull-based sub-agent definition auto-handles the context load requirement:
627
- - Resolves the active task with `task.py current --source`, then reads `prd.md`, `design.md` if present, and `implement.md` if present
628
- - 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/研究文件
629
574
 
630
575
  [/Gemini, Qoder, Copilot, Reasonix, Trae, Grok, Kimi Code, DeepSeek Harness]
631
576
 
632
577
  [Kiro]
633
578
 
634
- Spawn the implement sub-agent:
579
+ 派发实施子代理:
635
580
 
636
- - **Agent type**: `trellis-implement`
637
- - **Task description**: Implement the reviewed task artifacts, consulting materials under `{TASK_DIR}/research/`; finish by running project lint and type-check
638
- - **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`。
639
584
 
640
- The platform prelude auto-handles the context load requirement:
641
- - Reads `implement.jsonl` and injects referenced spec/research files into the agent prompt
642
- - 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`
643
588
 
644
589
  [/Kiro]
645
590
 
646
591
  [codex-inline, Kilo, Antigravity, Devin]
647
592
 
648
- 1. Load the `trellis-before-dev` skill to read project guidelines
649
- 2. Read `{TASK_DIR}/prd.md`, then `design.md` if present, then `implement.md` if present
650
- 3. Consult materials under `{TASK_DIR}/research/`
651
- 4. Implement the code per reviewed artifacts
652
- 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 和类型检查
653
598
 
654
599
  [/codex-inline, Kilo, Antigravity, Devin]
655
600
 
656
- #### 2.2 Quality check `[required · repeatable]`
601
+ #### 2.2 质量检查(Quality check)`[required · repeatable]`
657
602
 
658
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]
659
604
 
660
- Spawn the check sub-agent:
605
+ 派发检查子代理:
661
606
 
662
- - **Agent type**: `trellis-check`
663
- - **Task description**: Review all code changes against specs and task artifacts; fix any findings directly; ensure lint and type-check pass
664
- - **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`.
665
- - **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。
666
611
 
667
- The check agent's job:
668
- - Review code changes against specs
669
- - Review code changes against `prd.md`, `design.md` if present, and `implement.md` if present
670
- - Auto-fix issues it finds
671
- - Run lint and typecheck to verify
672
- - 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
+ - 必须检查但无法运行、被跳过或以非零状态退出的检查属于阻塞/失败,绝不能算作通过。不要为了推进工作流而降低或改写验收标准。
673
618
 
674
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]
675
620
 
676
621
  [codex-inline, Kilo, Antigravity, Devin]
677
622
 
678
- Load the `trellis-check` skill and verify the code per its guidance:
679
- - Spec compliance
680
- - lint / type-check / tests
681
- - Cross-layer consistency (when changes span layers)
623
+ 加载 `trellis-check` Skill 并按其指引验证代码:
624
+ - spec 合规性
625
+ - lint / 类型检查 / 测试
626
+ - 跨层一致性(变更跨层时)
682
627
 
683
- If issues are found → fix → re-check, until green.
628
+ 如果发现问题 → 修复 → 重新检查,直到通过。
684
629
 
685
630
  [/codex-inline, Kilo, Antigravity, Devin]
686
631
 
687
- **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 无法发现的跨层/多包问题。
688
633
 
689
- #### 2.3 Rollback `[on demand]`
634
+ #### 2.3 回滚(Rollback)`[on demand]`
690
635
 
691
- - `check` reveals a prd defect → return to Phase 1, fix `prd.md`, then redo 2.1
692
- - Implementation went wrong → revert code, redo 2.1
693
- - 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/`
694
639
 
695
640
  ---
696
641
 
697
- ## Phase 3: Finish
642
+ ## 阶段三:完成(Phase 3: Finish)
698
643
 
699
- Goal: ensure code quality, capture lessons, record the work.
644
+ 目标:确保代码质量,记录经验和工作过程。
700
645
 
701
- **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`。
702
647
 
703
- #### 3.2 Debug retrospective `[on demand]`
648
+ #### 3.2 调试复盘(Debug retrospective)`[on demand]`
704
649
 
705
- If this task involved repeated debugging (the same issue was fixed multiple times), load the `trellis-break-loop` skill to:
706
- - Classify the root cause
707
- - Explain why earlier fixes failed
708
- - Propose prevention
650
+ 如果任务涉及重复调试(同一问题被多次修复),加载 `trellis-break-loop` Skill:
651
+ - 分类根因
652
+ - 解释之前的修复为什么失败
653
+ - 提出预防措施
709
654
 
710
- The goal is to capture debugging lessons so the same class of issue doesn't recur.
655
+ 目标是记录调试经验,避免同类问题再次发生。
711
656
 
712
- #### 3.3 Spec update `[required · once]`
657
+ #### 3.3 更新 Spec(Spec update)`[required · once]`
713
658
 
714
- Load the `trellis-update-spec` skill and review whether this task produced new knowledge worth recording:
715
- - Newly discovered patterns or conventions
716
- - Pitfalls you hit
717
- - New technical decisions
659
+ 加载 `trellis-update-spec` Skill,审查本任务是否产生了值得记录的新知识:
660
+ - 新发现的模式或约定
661
+ - 遇到的陷阱
662
+ - 新的技术决策
718
663
 
719
- Update the docs under `.trellis/spec/` accordingly. Even if the conclusion is "nothing to update", walk through the judgment.
664
+ 相应更新 `.trellis/spec/` 下的文档。即使结论是“不需要更新”,也要完成并记录判断过程。
720
665
 
721
- #### 3.4 Commit changes `[required · once]`
666
+ #### 3.4 提交变更(Commit changes)`[required · once]`
722
667
 
723
- **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 写入应包含在本任务的提交批次中,不能遗忘到后续。
724
669
 
725
- 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` 能在之后干净运行。目标是先生成工作提交,再生成归档和日志等记账提交;两者不得交错。
726
671
 
727
- **Step-by-step**:
672
+ **步骤**:
728
673
 
729
- 1. **Inspect dirty state**:
674
+ 1. **检查脏状态**:
730
675
  ```bash
731
676
  git status --porcelain
732
677
  ```
733
- Snapshot every dirty path. If the working tree is clean, skip to 3.5.
678
+ 记录所有脏路径。如果工作树干净,跳到 3.5。
734
679
 
735
- 2. **Learn commit style** from recent history (so drafted messages blend in):
680
+ 2. **从近期历史了解提交风格**(使拟定消息保持一致):
736
681
  ```bash
737
682
  git log --oneline -5
738
683
  ```
739
- Note the prefix convention (`feat:` / `fix:` / `chore:` / `docs:` ...), language (中文/English), and length style.
684
+ 记录前缀约定(`feat:` / `fix:` / `chore:` / `docs:` 等)、语言(中文/English)和长度风格。
740
685
 
741
- 3. **Classify dirty files into two groups**:
742
- - **AI-edited this session** — files you wrote/edited via Edit/Write/Bash tool calls in this session. You know what changed and why.
743
- - **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 或无关工作)。不要静默纳入。
744
689
 
745
- 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>` 和文件列表;将未识别文件单独列在末尾。
746
691
 
747
- 5. **Present the plan once, ask for one-shot confirmation**. Format:
692
+ 5. **展示一次计划并一次性请求确认**。格式:
748
693
  ```
749
694
  Proposed commits (in order):
750
695
  1. <message>
@@ -760,54 +705,54 @@ The AI drives a batched commit of this task's code changes so `/finish-work` can
760
705
  Reply 'ok' / '行' to execute. Reply with edits, or '我自己来' / 'manual' to abort.
761
706
  ```
762
707
 
763
- 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。
764
709
 
765
- 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。
766
711
 
767
- **Rules**:
768
- - No `git commit --amend` anywhere — three-stage three-commit flow (work commits → archive commit → journal commit).
769
- - Never push to remote in this step.
770
- - 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.
771
- - The batched plan is one prompt; do not prompt per commit.
712
+ **规则**:
713
+ - 任何位置都不得使用 `git commit --amend`——采用三阶段三提交流程(工作提交 → 归档提交 → 日志提交)。
714
+ - 此步骤绝不 push 到远程。
715
+ - 用户接受文件分组但希望调整消息措辞时,修改消息并重新确认一次;如果拒绝分组,退出到手动模式。
716
+ - 批量计划只使用一个提问,不要逐提交提问。
772
717
 
773
- #### 3.5 Wrap-up reminder
718
+ #### 3.5 收尾提醒(Wrap-up reminder)
774
719
 
775
- After the above, remind the user they can run `/finish-work` to wrap up (archive the task, record the session).
720
+ 完成以上步骤后,提醒用户可以运行 `/finish-work` 收尾(归档任务、记录会话)。
776
721
 
777
722
  ---
778
723
 
779
- ## Customizing Trellis (for forks)
724
+ ## 自定义 Trellis(适用于 fork)
780
725
 
781
- 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 工作流本身的开发者。所有自定义都通过编辑本文件完成;脚本只负责解析。
782
727
 
783
- ### Changing what a step means
728
+ ### 修改步骤含义
784
729
 
785
- Edit the corresponding step's walkthrough body in the Phase 1 / 2 / 3 sections above. Critical invariants:
786
- - 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.
787
- - Planning must distinguish lightweight PRD-only tasks from complex tasks that require `prd.md`, `design.md`, and `implement.md` before start.
788
- - 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 提交提醒。
789
734
 
790
- All tag blocks live in the `## Phase Index` section above, immediately after each phase summary:
735
+ 所有标签块位于上方 `## Phase Index` 区域中,紧跟各阶段摘要之后:
791
736
 
792
- | Scope | Corresponding tag |
737
+ | 范围(Scope) | 对应标签(Corresponding tag) |
793
738
  |---|---|
794
- | No active task (before Phase 1) | `[workflow-state:no_task]` (after the Phase Index ASCII art) |
795
- | One developer-owned task without a session binding | `[workflow-state:unbound_task]` (bind before lifecycle writes) |
796
- | Multiple developer-owned tasks without a session binding | `[workflow-state:unbound_ambiguous]` / `[workflow-state:unbound_ambiguous-inline]` (choose and bind explicitly) |
797
- | Active task record unreadable | `[workflow-state:task_error]` (repair the existing task before continuing) |
798
- | All of Phase 1 (task created → ready for implementation) | `[workflow-state:planning]` (after Phase 1 summary) |
799
- | Codex inline Phase 1 | `[workflow-state:planning-inline]` |
800
- | Phase 2 + Phase 3.2–3.4 (implementation + check + wrap-up) | `[workflow-state:in_progress]` (after Phase 2 summary) |
801
- | Codex inline Phase 2 + Phase 3.2–3.4 | `[workflow-state:in_progress-inline]` |
802
- | 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]`(阶段三摘要之后;**目前不可达**) |
803
748
 
804
- ### Changing the per-turn prompt text
749
+ ### 修改每轮提示文本
805
750
 
806
- 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 会话;不需要修改脚本。
807
752
 
808
- ### Adding a custom status
753
+ ### 添加自定义状态
809
754
 
810
- Add a new block:
755
+ 添加新块:
811
756
 
812
757
  ```
813
758
  [workflow-state:my-status]
@@ -815,14 +760,14 @@ your per-turn prompt text
815
760
  [/workflow-state:my-status]
816
761
  ```
817
762
 
818
- Constraints:
819
- - STATUS charset: `[A-Za-z0-9_-]+` (underscores and hyphens allowed, e.g. `in-review`, `blocked-by-team`)
820
- - A lifecycle hook must write `task.json.status` to your custom value, otherwise the tag is never read
821
- - 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` 之一
822
767
 
823
- ### Adding a lifecycle hook
768
+ ### 添加生命周期 Hook
824
769
 
825
- Add a `hooks` field to your `task.json`:
770
+ 在 `task.json` 中添加 `hooks` 字段:
826
771
 
827
772
  ```json
828
773
  {
@@ -834,11 +779,11 @@ Add a `hooks` field to your `task.json`:
834
779
  }
835
780
  ```
836
781
 
837
- 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`。
838
783
 
839
- ### Full contract
784
+ ### 完整合同
840
785
 
841
- 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 可达性矩阵及其他详细内容,参阅:
842
787
 
843
- - `.trellis/spec/cli/backend/workflow-state-contract.md` — runtime contract + writer table + test invariants
844
- - `.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,没有内嵌正文)