@wnlen/agent-execution-template 0.8.21 → 0.8.23

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.
package/README.md CHANGED
@@ -181,6 +181,12 @@ acceptable vertical slice, not a mechanical step checklist:
181
181
  - [ ] L1-3 Export entrypoint Yellow
182
182
  ```
183
183
 
184
+ Simple tasks are not buried under a full process form. A single-L1, Green,
185
+ low-risk task uses a compact task contract with only the goal, scope,
186
+ acceptance, permissions, verification commands, and minimal `task_tree`.
187
+ Multi-L1, Yellow/Red, cross-module, continuously executed, or highly uncertain
188
+ tasks use an expanded task contract.
189
+
184
190
  Because there are two or more L1 tasks, the protocol automatically uses bounded
185
191
  continuous execution. Before each L1, the AI plans naturally derived L2/L3 work.
186
192
  After completing an L1, it checks and strikes the item. `task_tree` is written
package/README.zh-CN.md CHANGED
@@ -188,6 +188,10 @@ AI 会在执行前先拆 L1 任务。L1 必须是可独立验收的垂直切片
188
188
  - [ ] L1-3 导出入口 Yellow
189
189
  ```
190
190
 
191
+ 简单任务不会被完整流程表单淹没。单 L1、Green、低风险任务使用 compact task
192
+ contract,只保留目标、范围、验收、权限、验证命令和最小 `task_tree`。多 L1、
193
+ Yellow/Red、跨模块、连续执行或高不确定任务才使用 expanded task contract。
194
+
191
195
  因为 L1 有两个以上,协议会自动使用边界内连续执行。执行每个 L1 前,AI 再规划
192
196
  自然衍生的 L2/L3;完成一个 L1 后,在清单中打勾并划掉。`task_tree` 只在
193
197
  L1 开始/完成、Red/blocked、范围变化或最终收尾时写回,避免为微小步骤反复改文件。
@@ -52,11 +52,7 @@ const TASK_HEALTH_PATTERNS = [
52
52
  /^readiness:\s*/m,
53
53
  /^execution_policy:/m,
54
54
  /^\s+mode:\s*/m,
55
- /^\s+activation_rule:\s*/m,
56
55
  /^\s+task_tree:/m,
57
- /^\s+risk_gate:/m,
58
- /^\s+evidence_required:\s*/m,
59
- /^model_policy:/m,
60
56
  /^refs:/m,
61
57
  /^permission:/m
62
58
  ];
@@ -77,33 +73,31 @@ const TEXT = {
77
73
  `,
78
74
  unknown: "未知",
79
75
  sourceMissing: "找不到模板来源",
80
- ready: "Agent Execution Template 协议已安装。项目上下文尚未初始化。",
81
- initGuide: `[下一步:让 AI 初始化项目上下文]
82
- 已安装根目录 AI 兼容入口: AGENTS.md / CLAUDE.md
83
-
84
- 1. 无额外资料
85
- 对 AI 说: 开始初始化这个项目
86
- 2. 有已确定资料
87
- 先放到: ai/project/inbox/
88
- AI 说: 开始初始化这个项目,并吸收 ai/project/inbox/ 里的资料
89
-
90
- [后续]
91
- 1. 继续推进
92
- AI 说: 继续推进这个项目
93
- 2. 吸收新资料
94
- 先放到: ai/project/inbox/
95
- AI 说: 整合 ai/project/inbox/ 里的新资料
96
- 3. 优化上下文
97
- 运行命令: npx -y @wnlen/agent-execution-template refresh
98
- 4. 评估方向
99
- 先放到: ai/project/inbox/ideas/
100
- AI 说: 把 ai/project/inbox/ideas/ 里的新灵感生成方向修订提案
101
- 5. 查看下一步
102
- 运行命令: npx -y @wnlen/agent-execution-template next
103
-
104
- [区分标准]
105
- 资料 = 已确定的事实、文档、流程、接口、业务规则
106
- 方向 = 还没决定的新想法、产品策略、架构调整、路线变化`,
76
+ ready: "Agent Execution Template 已安装。",
77
+ initGuide: `你现在可以这样用:
78
+
79
+ 1. 第一次整理项目上下文
80
+ 【发给 AI】
81
+
82
+ 开始初始化这个项目
83
+
84
+ 2. 已有 README、PRD、架构文档或业务规则
85
+ 先放到 ai/project/inbox/
86
+ 【发给 AI】
87
+
88
+ 开始初始化这个项目,并吸收 ai/project/inbox/ 里的资料
89
+
90
+ 3. 后续有新资料要合并
91
+ 放到 ai/project/inbox/
92
+ 【发给 AI】
93
+
94
+ 整合 ai/project/inbox/ 里的新资料
95
+
96
+ 4. 有还没确定的新想法、产品方向或架构调整
97
+ 放到 ai/project/inbox/ideas/
98
+ 【发给 AI】
99
+
100
+ 把 ai/project/inbox/ideas/ 里的新灵感生成方向修订提案`,
107
101
  start: "开始:",
108
102
  startPrompt: "开始初始化这个项目",
109
103
  then: "然后:",
@@ -112,8 +106,8 @@ const TEXT = {
112
106
  confirmTask: "需要吸收新资料时,先放入 ai/project/inbox/,然后说:",
113
107
  executePrompt: "整合 ai/project/inbox/ 里的新资料",
114
108
  strategyHint: "需要修订方向时,先放入 ai/project/inbox/ideas/,然后生成 strategy_update 提案。",
115
- files: "文件",
116
- check: "检查",
109
+ files: "文件已就绪",
110
+ check: "检查安装",
117
111
  details: "详情:",
118
112
  refreshTitle: "Agent Execution Template 项目上下文重整",
119
113
  improveContextTitle: "Agent Execution Template 上下文总结优化",
@@ -191,33 +185,31 @@ Usage:
191
185
  `,
192
186
  unknown: "unknown",
193
187
  sourceMissing: "Template source not found",
194
- ready: "Agent Execution Template protocol installed. Project context is not initialized yet.",
195
- initGuide: `[Next: ask the AI to initialize project context]
196
- Installed root AI compatibility entrypoints: AGENTS.md / CLAUDE.md
197
-
198
- 1. Without extra material
199
- Tell the AI: Start initializing this project
200
- 2. With confirmed material
201
- Put it in: ai/project/inbox/
202
- Tell the AI: Start initializing this project and absorb the material in ai/project/inbox/
203
-
204
- [Follow-up]
205
- 1. Continue work
206
- Tell the AI: Continue this project
207
- 2. Absorb new material
208
- Put it in: ai/project/inbox/
209
- Tell the AI: Reconcile the new material in ai/project/inbox/
210
- 3. Improve context
211
- Run: npx -y @wnlen/agent-execution-template refresh
212
- 4. Evaluate direction
213
- Put it in: ai/project/inbox/ideas/
214
- Tell the AI: Generate a direction amendment proposal from ai/project/inbox/ideas/
215
- 5. Show next step
216
- Run: npx -y @wnlen/agent-execution-template next
217
-
218
- [Rule of thumb]
219
- Material = confirmed facts, docs, workflows, APIs, or business rules
220
- Direction = undecided ideas, product strategy, architecture changes, or roadmap changes`,
188
+ ready: "Agent Execution Template installed.",
189
+ initGuide: `You can use it like this:
190
+
191
+ 1. Set up project context for the first time
192
+ [Send to AI]
193
+
194
+ Start initializing this project
195
+
196
+ 2. You already have a README, PRD, architecture doc, or business rules
197
+ Put them in ai/project/inbox/
198
+ [Send to AI]
199
+
200
+ Start initializing this project and absorb the material in ai/project/inbox/
201
+
202
+ 3. Later, you have new material to merge
203
+ Put it in ai/project/inbox/
204
+ [Send to AI]
205
+
206
+ Reconcile the new material in ai/project/inbox/
207
+
208
+ 4. You have an undecided idea, product direction, or architecture change
209
+ Put it in ai/project/inbox/ideas/
210
+ [Send to AI]
211
+
212
+ Generate a direction amendment proposal from ai/project/inbox/ideas/`,
221
213
  start: "Start:",
222
214
  startPrompt: "Start initializing this project",
223
215
  then: "Then:",
@@ -226,8 +218,8 @@ Installed root AI compatibility entrypoints: AGENTS.md / CLAUDE.md
226
218
  confirmTask: "When you need to absorb new material, put it in ai/project/inbox/, then say:",
227
219
  executePrompt: "Reconcile the new material in ai/project/inbox/",
228
220
  strategyHint: "When direction changes, put ideas in ai/project/inbox/ideas/ and produce a strategy_update proposal.",
229
- files: "Files",
230
- check: "Check",
221
+ files: "Files ready",
222
+ check: "Check install",
231
223
  details: "Details:",
232
224
  refreshTitle: "Agent Execution Template project context refresh",
233
225
  improveContextTitle: "Agent Execution Template project context improvement",
@@ -604,17 +596,16 @@ function init({ lang = DEFAULT_LANG, verbose = false, quiet = false, manageEntry
604
596
  }
605
597
 
606
598
  if (!quiet) {
607
- const sourceNotice = isSourceCheckout() ? `${text.sourceCheckoutNotice}\n\n` : "";
599
+ const sourceNotice = isSourceCheckout() ? `\n${text.sourceCheckoutNotice}` : "";
608
600
  console.log(`${text.ready}
609
601
 
610
- ${text.initGuide}
602
+ ${text.initGuide}${sourceNotice}
611
603
 
612
- ${sourceNotice}
613
- ${text.files}: ${summarizeChanges(changes, lang)}
614
604
  ${text.check}: ${commandHint("doctor")}
615
605
  `);
616
606
 
617
607
  if (verbose) {
608
+ console.log(`${text.files}: ${summarizeChanges(changes, lang)}`);
618
609
  printChanges(text.details, changes, lang);
619
610
  }
620
611
  }
package/docs/SPEC.md CHANGED
@@ -24,7 +24,7 @@ npx 安装协议 -> AI 整理项目上下文 -> 人类确认 -> AI 生成任务
24
24
 
25
25
  ```text
26
26
  Protocol: v0.8
27
- Package: @wnlen/agent-execution-template@0.8.21
27
+ Package: @wnlen/agent-execution-template@0.8.23
28
28
  中文安装: npx -y @wnlen/agent-execution-template init
29
29
  英文安装: npx -y @wnlen/agent-execution-template init --lang en
30
30
  ```
@@ -420,7 +420,7 @@ npx -y @wnlen/agent-execution-template doctor
420
420
  ```text
421
421
  Agent Execution Template 检查
422
422
 
423
- 模板版本: 0.8.21
423
+ 模板版本: 0.8.23
424
424
  模板语言: zh
425
425
 
426
426
  [通过] ai/template/LANG
@@ -697,6 +697,16 @@ ai/project/task.md.execution_policy
697
697
  ai/template/execution-policy.md
698
698
  ```
699
699
 
700
+ `ai/project/task.md` 支持两种契约形态:
701
+
702
+ - compact task contract:用于单 L1、Green、低风险任务,只写目标、范围、验收、权限、
703
+ 验证命令和最小 `execution_policy.task_tree`。
704
+ - expanded task contract:用于多 L1、Yellow/Red、跨模块、连续执行、高不确定或高风险任务,
705
+ 可按需展开 checkpoint、模型策略、风险门和更完整的任务树字段。
706
+
707
+ 默认优先 compact。完整默认策略保存在 `ai/template/execution-policy.md`,简单任务不应把
708
+ `checkpoint_budget`、`model_policy` 等内部控制字段机械复制进 `task.md`。
709
+
700
710
  默认模式是 `auto`。AI 每次执行前先做任务分解和风险判断,再决定使用
701
711
  `normal` 还是 `bounded_continuous`,不依赖用户口令。
702
712
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wnlen/agent-execution-template",
3
- "version": "0.8.21",
3
+ "version": "0.8.23",
4
4
  "description": "Low-friction AI execution protocol template for coding agents.",
5
5
  "bin": {
6
6
  "agent-execution-template": "bin/agent-execution-template.js"
@@ -7,61 +7,11 @@ readiness: "draft_for_confirmation | ready_to_execute | blocked"
7
7
  depends_on_previous_result: false
8
8
  execution_policy:
9
9
  mode: "auto | normal | bounded_continuous"
10
- activation_rule: "auto_enable_when_l1_count_gte_2"
11
- max_depth: 3
12
- allow_depth_4_when_needed: true
13
- progress_unit: "vertical_slice"
14
- l1_granularity: "independently_acceptable_vertical_slice"
15
- write_back_policy: "l1_start_done_red_blocked_scope_change_final"
16
10
  task_tree:
17
11
  - id: "L1-1"
18
12
  title: ""
19
13
  risk: "Green | Yellow | Red"
20
14
  status: "pending | running | done | blocked"
21
- scope:
22
- allowed: []
23
- denied: []
24
- acceptance: []
25
- evidence: []
26
- children: []
27
- checkpoint_budget:
28
- l1: 0
29
- l2: 0
30
- l3: 0
31
- l4: 0
32
- checkpoint_triggers:
33
- - before_crossing_boundary
34
- - after_vertical_slice
35
- - before_final_review
36
- auto_continue:
37
- green: true
38
- yellow: "low_risk_only"
39
- red: false
40
- risk_gate:
41
- green: "continue"
42
- yellow: "continue_with_local_fix"
43
- red: "stop_for_human"
44
- evidence_required: true
45
- model_policy:
46
- default_tier: "cheap"
47
- allowed_tiers:
48
- - cheap
49
- - standard
50
- - strong
51
- escalation_allowed: true
52
- escalation_triggers:
53
- - ambiguous_goal
54
- - ambiguous_acceptance
55
- - high_risk_change
56
- - architecture_boundary
57
- - repeated_failure
58
- - verification_dispute
59
- strong_model_roles:
60
- - planning
61
- - risk_judgment
62
- - architecture_review
63
- - failure_review
64
- - acceptance_judgment
65
15
  refs:
66
16
  required: []
67
17
  optional: []
@@ -92,6 +42,13 @@ If this run creates or rewrites the task contract, keep
92
42
  `readiness = draft_for_confirmation` by default and stop at the handoff. Enter
93
43
  execution only when an existing task is explicitly `ready_to_execute`.
94
44
 
45
+ Default to a compact task contract. A single-L1, Green, low-risk task should
46
+ write only the goal, scope, acceptance, permissions, verification commands, and
47
+ minimal `execution_policy.task_tree`. Multi-L1, Yellow/Red, cross-module,
48
+ continuously executed, or highly uncertain tasks may expand checkpoint, model
49
+ policy, risk gate, and fuller task-tree fields as needed. The complete default
50
+ rules live in `ai/template/execution-policy.md`.
51
+
95
52
  ## Goal
96
53
 
97
54
  Describe the exact goal of this task. If generated from a short human request,
@@ -135,7 +92,8 @@ The task is complete when:
135
92
  Default to `auto`. The AI decides during pre-execution planning whether to use
136
93
  continuous execution; it does not wait for a human keyword. If planning finds
137
94
  fewer than 2 L1 tasks, use `normal`; if it finds 2 or more L1 tasks, use
138
- `bounded_continuous` automatically.
95
+ `bounded_continuous` automatically. Each L1 must be an independently acceptable
96
+ vertical slice.
139
97
 
140
98
  `bounded_continuous` means bounded continuous execution:
141
99
 
@@ -167,8 +125,10 @@ fewer than 2 L1 tasks, use `normal`; if it finds 2 or more L1 tasks, use
167
125
  architecture direction, or acceptance.
168
126
  - `progress_unit` defaults to `vertical_slice`: each work loop should produce
169
127
  a reviewable increment.
170
- - `checkpoint_budget` is the maximum checkpoint budget, not a required count;
171
- do not report just to spend the budget.
128
+ - Compact tasks should not expand internal control fields such as
129
+ `checkpoint_budget` or `model_policy`.
130
+ - Expanded tasks may add checkpoint budgets, model policy, risk gates, and
131
+ fuller node fields as needed.
172
132
  - Emit checkpoints only when risk changes from Green to Yellow/Red, scope or
173
133
  permission is about to expand, an L1 vertical slice is complete, verification
174
134
  failed but execution is about to continue, or final wrap-up is about to start.
@@ -1 +1 @@
1
- 0.8.21
1
+ 0.8.23
@@ -3,6 +3,22 @@
3
3
  Do not summarize this file.
4
4
  During task execution, use this file to choose `normal` or `bounded_continuous`.
5
5
 
6
+ ## Task Contract Shapes
7
+
8
+ `ai/project/task.md` has two valid shapes:
9
+
10
+ - Compact task contract: for single-L1, Green, low-risk tasks. Write only the
11
+ goal, scope, acceptance, permissions, verification commands, and minimal
12
+ `execution_policy.task_tree`; do not expand internal control fields such as
13
+ `checkpoint_budget` or `model_policy`.
14
+ - Expanded task contract: for multi-L1, Yellow/Red, cross-module, continuously
15
+ executed, highly uncertain, or high-risk tasks. Expand checkpoint, model
16
+ policy, risk gate, and fuller task-tree fields only when needed.
17
+
18
+ Prefer compact by default. Upgrade to expanded only when complexity, risk, or
19
+ auditability makes the extra structure worthwhile. The complete execution rules
20
+ live in this file and do not need to be repeated in every task draft.
21
+
6
22
  ## Default Policy
7
23
 
8
24
  The default execution policy is `auto`: before each execution, the AI first
@@ -25,6 +41,8 @@ Pre-execution planning must:
25
41
  - Stop for human confirmation first if any L1 is Red; Green and Yellow do not
26
42
  block startup.
27
43
  - Write the task tree to `execution_policy.task_tree` in `ai/project/task.md`.
44
+ Simple tasks should write only minimal L1 nodes; complex tasks can add
45
+ `scope`, `acceptance`, `evidence`, `children`, and related fields.
28
46
 
29
47
  ## Task Tree
30
48
 
@@ -48,7 +66,16 @@ Execute the task tree in L1 -> L2 -> L3 order.
48
66
  - During execution, use `pending`, `running`, `done`, or `blocked` for node
49
67
  status.
50
68
 
51
- Recommended node shape:
69
+ Minimal node shape:
70
+
71
+ ```yaml
72
+ id: "L1-1"
73
+ title: ""
74
+ risk: "Green | Yellow | Red"
75
+ status: "pending | running | done | blocked"
76
+ ```
77
+
78
+ Recommended node shape for complex tasks:
52
79
 
53
80
  ```yaml
54
81
  id: "L1-1"
@@ -67,11 +67,17 @@ In Task Draft Mode:
67
67
  2. Infer goal, scope, acceptance, permissions, verification method, and initial
68
68
  risk from the user's current goal, project context, and repository facts; do
69
69
  not require the human to provide each field upfront.
70
- 3. Draft `ai/project/task.md` and set `execution_policy.mode` to `auto`.
70
+ 3. Draft `ai/project/task.md`. For a single-L1, Green, low-risk task, default to
71
+ a compact task contract: write only the goal, scope, acceptance, permissions,
72
+ verification commands, and minimal `execution_policy.task_tree`. Use an
73
+ expanded task contract only for multi-L1, Yellow/Red, cross-module,
74
+ continuously executed, or highly uncertain tasks.
71
75
  4. Before execution, list the L1 checklist, mark each L1 Green / Yellow / Red,
72
76
  and write it to `execution_policy.task_tree`. Use `normal` if there are
73
77
  fewer than 2 L1 tasks; automatically use `bounded_continuous` if there are 2
74
- or more L1 tasks.
78
+ or more L1 tasks. The complete default rules live in
79
+ `ai/template/execution-policy.md`; do not mechanically copy internal control
80
+ fields such as `checkpoint_budget` or `model_policy` into simple task drafts.
75
81
  5. If this run creates or rewrites `ai/project/task.md`, set `readiness` to
76
82
  `draft_for_confirmation` and stop at the handoff; do not execute while the
77
83
  task is still a draft.
@@ -67,6 +67,13 @@ rewrites the task contract, stop at the confirmation handoff. Only Red stops for
67
67
  human confirmation, and Yellow only permits local low-risk correction inside the
68
68
  current L1/L2.
69
69
 
70
+ Task contracts are layered by complexity. A single-L1, Green, low-risk task uses
71
+ a compact task contract with only the goal, scope, acceptance, permissions,
72
+ verification commands, and minimal `execution_policy.task_tree`. Multi-L1,
73
+ Yellow/Red, cross-module, continuously executed, or highly uncertain tasks use
74
+ an expanded task contract and may include checkpoint, model policy, and fuller
75
+ task-tree fields as needed.
76
+
70
77
  Task tree, risk rubric, checkpoint evidence, and `task_tree` write-back rules
71
78
  are defined in `ai/template/execution-policy.md`.
72
79
 
@@ -7,61 +7,11 @@ readiness: "draft_for_confirmation | ready_to_execute | blocked"
7
7
  depends_on_previous_result: false
8
8
  execution_policy:
9
9
  mode: "auto | normal | bounded_continuous"
10
- activation_rule: "auto_enable_when_l1_count_gte_2"
11
- max_depth: 3
12
- allow_depth_4_when_needed: true
13
- progress_unit: "vertical_slice"
14
- l1_granularity: "independently_acceptable_vertical_slice"
15
- write_back_policy: "l1_start_done_red_blocked_scope_change_final"
16
10
  task_tree:
17
11
  - id: "L1-1"
18
12
  title: ""
19
13
  risk: "Green | Yellow | Red"
20
14
  status: "pending | running | done | blocked"
21
- scope:
22
- allowed: []
23
- denied: []
24
- acceptance: []
25
- evidence: []
26
- children: []
27
- checkpoint_budget:
28
- l1: 0
29
- l2: 0
30
- l3: 0
31
- l4: 0
32
- checkpoint_triggers:
33
- - before_crossing_boundary
34
- - after_vertical_slice
35
- - before_final_review
36
- auto_continue:
37
- green: true
38
- yellow: "low_risk_only"
39
- red: false
40
- risk_gate:
41
- green: "continue"
42
- yellow: "continue_with_local_fix"
43
- red: "stop_for_human"
44
- evidence_required: true
45
- model_policy:
46
- default_tier: "cheap"
47
- allowed_tiers:
48
- - cheap
49
- - standard
50
- - strong
51
- escalation_allowed: true
52
- escalation_triggers:
53
- - ambiguous_goal
54
- - ambiguous_acceptance
55
- - high_risk_change
56
- - architecture_boundary
57
- - repeated_failure
58
- - verification_dispute
59
- strong_model_roles:
60
- - planning
61
- - risk_judgment
62
- - architecture_review
63
- - failure_review
64
- - acceptance_judgment
65
15
  refs:
66
16
  required: []
67
17
  optional: []
@@ -86,6 +36,11 @@ permission:
86
36
  `Red`,等待确认。本轮新建或重写任务契约时,默认保持 `draft_for_confirmation` 并停下交接;
87
37
  只有既有任务为 `ready_to_execute` 时才执行。
88
38
 
39
+ 默认使用 compact task contract。单 L1、Green、低风险任务只写目标、范围、验收、
40
+ 权限、验证命令和最小 `execution_policy.task_tree`。多 L1、Yellow/Red、跨模块、
41
+ 连续执行或高不确定任务才按需展开 checkpoint、模型策略、风险门和更完整任务树字段。
42
+ 完整默认规则见 `ai/template/execution-policy.md`。
43
+
89
44
  ## 目标
90
45
 
91
46
  描述这个任务的准确目标。如果由简短人类请求生成,保留用户意图并明确写出假设。
@@ -124,7 +79,7 @@ permission:
124
79
  ## 执行策略
125
80
 
126
81
  默认 `auto`:AI 执行前规划并决定是否连续执行,不等用户口令。L1 < 2 用 `normal`;
127
- L1 >= 2 自动用 `bounded_continuous`。
82
+ L1 >= 2 自动用 `bounded_continuous`。L1 必须是可独立验收的垂直切片。
128
83
 
129
84
  `bounded_continuous` 表示边界内连续执行:
130
85
 
@@ -143,7 +98,8 @@ L1 >= 2 自动用 `bounded_continuous`。
143
98
  - 只有 Red 停下来让人类确认;Green 自动继续,Yellow 只允许当前 L1/L2 内的局部
144
99
  低风险修正,不能改变公共接口、数据模型、权限、安全、架构方向或验收标准。
145
100
  - `progress_unit` 默认为 `vertical_slice`:每轮都应产生可检查增量。
146
- - `checkpoint_budget` 是上限,不是必须用完;不要为消耗预算而汇报。
101
+ - compact 任务不要展开 `checkpoint_budget`、`model_policy` 等内部控制字段。
102
+ - expanded 任务可以按需增加 checkpoint 预算、模型策略、风险门和更完整节点字段。
147
103
  - 只有在风险从 Green 变 Yellow/Red、即将扩大范围或权限、完成 L1 垂直切片、
148
104
  验证失败后准备继续、准备最终收尾时才输出 Checkpoint。
149
105
  - 每个 Checkpoint 必须包含证据:已改文件、已运行命令、验证结果或无法验证的原因。
@@ -1 +1 @@
1
- 0.8.21
1
+ 0.8.23
@@ -3,6 +3,19 @@
3
3
  不要总结这个文件。
4
4
  任务执行时按本文件选择 `normal` 或 `bounded_continuous`。
5
5
 
6
+ ## 任务契约形态
7
+
8
+ `ai/project/task.md` 有两种合法形态:
9
+
10
+ - compact task contract:用于单 L1、Green、低风险任务。只写目标、范围、验收、
11
+ 权限、验证命令和最小 `execution_policy.task_tree`;不要展开
12
+ `checkpoint_budget`、`model_policy` 等内部控制字段。
13
+ - expanded task contract:用于多 L1、Yellow/Red、跨模块、连续执行、高不确定或
14
+ 高风险任务。需要时可展开 checkpoint、模型策略、风险门和更完整的任务树字段。
15
+
16
+ 默认优先 compact。只有复杂度、风险或审计需要证明它有价值时,才升级到 expanded。
17
+ 完整执行规则由本文件承载,不需要在每个任务草稿里重复。
18
+
6
19
  ## 默认策略
7
20
 
8
21
  默认执行策略是 `auto`:AI 在每次执行前先做任务分解和风险判断,再决定使用
@@ -19,7 +32,8 @@
19
32
  - 如果 L1 少于 2 个,使用 `normal`。
20
33
  - 如果 L1 为 2 个或更多,自动启用 `bounded_continuous`。
21
34
  - 如果任一 L1 为 Red,先停止并让人类确认;Green 和 Yellow 不阻塞启动。
22
- - 将任务树写入 `ai/project/task.md` 的 `execution_policy.task_tree`。
35
+ - 将任务树写入 `ai/project/task.md` 的 `execution_policy.task_tree`。简单任务只写最小
36
+ L1 节点;复杂任务再补充 scope、acceptance、evidence、children 等字段。
23
37
 
24
38
  ## 任务树
25
39
 
@@ -37,7 +51,16 @@
37
51
  出现 Red、blocked、范围变化或最终收尾时立即写回。不要为每个微小 L3 操作写回。
38
52
  - 执行中使用 `pending`、`running`、`done` 或 `blocked` 表示节点状态。
39
53
 
40
- 推荐节点结构:
54
+ 最小节点结构:
55
+
56
+ ```yaml
57
+ id: "L1-1"
58
+ title: ""
59
+ risk: "Green | Yellow | Red"
60
+ status: "pending | running | done | blocked"
61
+ ```
62
+
63
+ 复杂任务推荐节点结构:
41
64
 
42
65
  ```yaml
43
66
  id: "L1-1"
@@ -45,9 +45,13 @@
45
45
  1. 读取已确认的 `ai/project/project.md` 和相关 `ai/project/refs/*.md`。
46
46
  2. 根据用户目标、项目上下文和仓库事实推断目标、范围、验收、权限、验证方式和初始风险;
47
47
  不要求用户逐项提供。
48
- 3. 起草 `ai/project/task.md`,并将 `execution_policy.mode` 设为 `auto`。
48
+ 3. 起草 `ai/project/task.md`。单 L1、Green、低风险任务默认使用 compact task contract:
49
+ 只写目标、范围、验收、权限、验证命令和最小 `execution_policy.task_tree`。
50
+ 多 L1、Yellow/Red、跨模块、连续执行或高不确定任务才使用 expanded task contract。
49
51
  4. 执行前列出 L1 清单并标注 Green / Yellow / Red,写入 `execution_policy.task_tree`。
50
- L1 < 2 用 `normal`;L1 >= 2 自动用 `bounded_continuous`。
52
+ L1 < 2 用 `normal`;L1 >= 2 自动用 `bounded_continuous`。完整默认规则由
53
+ `ai/template/execution-policy.md` 承载,不要把 `checkpoint_budget`、`model_policy`
54
+ 等内部控制字段机械复制到简单任务草稿里。
51
55
  5. 本轮新建或重写 `task.md` 时,将 `readiness` 设为 `draft_for_confirmation` 并停止;
52
56
  草稿不能直接执行。
53
57
  6. 只有既有任务为 `ready_to_execute` 且无 Red 预检项,才进入执行;否则设为 `blocked`。
@@ -53,6 +53,11 @@ ai/project/task.md = 当前执行契约
53
53
  L1 必须是可独立验收的垂直切片。只有既有任务 `readiness = ready_to_execute` 才能执行;
54
54
  本轮新建或重写任务契约时先停下确认。Red 停止确认,Yellow 只允许当前 L1/L2 内的局部低风险修正。
55
55
 
56
+ 任务契约默认按复杂度分层。单 L1、Green、低风险任务使用 compact task contract,只保留
57
+ 目标、范围、验收、权限、验证命令和最小 `execution_policy.task_tree`。多 L1、Yellow/Red、
58
+ 跨模块、连续执行或高不确定任务才使用 expanded task contract,按需展开 checkpoint、
59
+ 模型策略和更完整的任务树字段。
60
+
56
61
  任务树、风险分级、Checkpoint 证据和 `task_tree` 写回规则由
57
62
  `ai/template/execution-policy.md` 定义。
58
63
 
package/test/selftest.js CHANGED
@@ -126,12 +126,12 @@ function testInitUpdateDoctor() {
126
126
  assert(read(cwd, "ai/template/rules/core.md").includes("需要扩大范围、权限、命令、网络或验收时"), "core rules should stop continuous execution before boundary expansion");
127
127
  assert(read(cwd, "ai/project/task.md").includes("execution_policy:"), "task template should include execution policy");
128
128
  assert(read(cwd, "ai/project/task.md").includes("readiness:"), "task template should include readiness state");
129
- assert(read(cwd, "ai/project/task.md").includes("activation_rule: \"auto_enable_when_l1_count_gte_2\""), "task template should define automatic activation rule");
130
- assert(read(cwd, "ai/project/task.md").includes("l1_granularity: \"independently_acceptable_vertical_slice\""), "task template should define L1 granularity");
131
- assert(read(cwd, "ai/project/task.md").includes("write_back_policy: \"l1_start_done_red_blocked_scope_change_final\""), "task template should define task tree write-back policy");
132
- assert(read(cwd, "ai/project/task.md").includes("risk_gate:"), "task template should define risk gate");
129
+ assert(read(cwd, "ai/project/task.md").includes("compact task contract"), "task template should default to compact contracts");
130
+ assert(read(cwd, "ai/project/task.md").includes("expanded 任务"), "task template should explain when to expand task contracts");
131
+ assert(!read(cwd, "ai/project/task.md").includes("activation_rule: \"auto_enable_when_l1_count_gte_2\""), "task template should not default to expanded activation metadata");
132
+ assert(!read(cwd, "ai/project/task.md").includes("checkpoint_budget:"), "task template should not default to checkpoint budget fields");
133
+ assert(!read(cwd, "ai/project/task.md").includes("model_policy:"), "task template should not default to model policy fields");
133
134
  assert(read(cwd, "ai/project/task.md").includes("status: \"pending | running | done | blocked\""), "task template should define task tree node status");
134
- assert(read(cwd, "ai/project/task.md").includes("progress_unit: \"vertical_slice\""), "task template should define continuous progress unit");
135
135
  assert(read(cwd, "ai/template/prompt.md").includes("开始初始化这个项目"), "execution prompt should route natural bootstrap entry");
136
136
  assert(read(cwd, "ai/template/prompt.md").includes("开始初始化这个项目,并吸收 ai/project/inbox/ 里的资料"), "execution prompt should route bootstrap with inbox material");
137
137
  assert(read(cwd, "ai/template/prompt.md").includes("不要重新 bootstrap"), "execution prompt should reconcile inbox material when project context already exists");
@@ -154,22 +154,33 @@ function testInitUpdateDoctor() {
154
154
  assert(read(cwd, "ai/template/rules/core.md").includes("ai/project/refs/final-shape.md"), "core rules should route direction refs");
155
155
  assert(read(cwd, "ai/project/proposals/final-shape-updates/_template.md").includes("`accepted`"), "proposal template should describe accepted status");
156
156
  const initOutput = run(["init"], cwd);
157
- assert(initOutput.includes("开始初始化这个项目"), "init output should provide compact natural bootstrap prompt");
158
- assert(initOutput.includes("根目录 AI 兼容入口: AGENTS.md / CLAUDE.md"), "init output should mention root AI compatibility entrypoints");
159
- assert(initOutput.includes("协议已安装。项目上下文尚未初始化"), "init output should distinguish protocol install from project context bootstrap");
160
- assert(initOutput.includes("[下一步:让 AI 初始化项目上下文]"), "init output should guide the AI bootstrap as the next step");
157
+ assert(initOutput.includes("Agent Execution Template 已安装。"), "init output should confirm installation");
158
+ assert(initOutput.includes("你现在可以这样用:"), "init output should introduce scenario-based usage");
159
+ assert(initOutput.includes("1. 第一次整理项目上下文"), "init output should cover first-time project context setup");
160
+ assert(initOutput.includes("【发给 AI】\n\n 开始初始化这个项目"), "init output should make the bootstrap prompt visually prominent");
161
+ assert(initOutput.includes("2. 已有 README、PRD、架构文档或业务规则"), "init output should cover initialization with existing material");
161
162
  assert(initOutput.includes("开始初始化这个项目,并吸收 ai/project/inbox/ 里的资料"), "init output should explain bootstrap with existing material");
162
- assert(initOutput.includes("整合 ai/project/inbox/ 里的新资料"), "init output should provide compact natural reconcile prompt");
163
- assert(initOutput.includes("优化上下文"), "init output should expose project context refresh in user language");
164
- assert(initOutput.includes(" ai/project/inbox/ideas/ 里的新灵感生成方向修订提案"), "init output should provide natural strategy prompt");
165
- assert(initOutput.includes("agent-execution-template next"), "init output should tell users how to recover the next step");
166
- assert(initOutput.includes("文件:"), "init output should summarize file changes");
163
+ assert(initOutput.includes("3. 后续有新资料要合并"), "init output should cover later material reconciliation");
164
+ assert(initOutput.includes("整合 ai/project/inbox/ 里的新资料"), "init output should show the reconcile prompt");
165
+ assert(initOutput.includes("4. 有还没确定的新想法、产品方向或架构调整"), "init output should cover undecided ideas");
166
+ assert(initOutput.includes(" ai/project/inbox/ideas/ 里的新灵感生成方向修订提案"), "init output should show the strategy proposal prompt");
167
+ assert(!initOutput.includes("项目上下文尚未初始化"), "init output should not state the obvious uninitialized context");
168
+ assert(!initOutput.includes("忘了下一步时运行"), "init output should not show next as the default fallback");
169
+ assert(!initOutput.includes("根目录 AI 入口"), "init output should not mention root AI entrypoint implementation details");
170
+ assert(!initOutput.includes("资料路径:"), "init output should not show abstract material path categories");
171
+ assert(!initOutput.includes("已确定资料:"), "init output should not show abstract confirmed material path categories");
172
+ assert(!initOutput.includes("未决定的新想法:"), "init output should not show abstract idea path categories");
173
+ assert(!initOutput.includes("agent-execution-template next"), "init output should not tell users to remember the next command");
174
+ assert(!initOutput.includes("文件已就绪:"), "init output should hide file change summaries by default");
175
+ assert(initOutput.includes("检查安装:"), "init output should show install check command");
167
176
  assert(!initOutput.includes("维护者提示"), "init output should not show source checkout guidance in user projects");
168
177
  assert(!initOutput.includes("[已更新]"), "init output should hide detailed file changes by default");
169
178
  assert(!initOutput.includes("Read ai/template/bootstrap.md"), "init output should not use weak Read bootstrap command");
170
179
  assert(countOccurrences(read(cwd, "AGENTS.md"), "agent-execution-template:start") === 1, "init should not duplicate AGENTS.md managed blocks");
171
180
  assert(countOccurrences(read(cwd, "CLAUDE.md"), "agent-execution-template:start") === 1, "init should not duplicate CLAUDE.md managed blocks");
172
- assert(run(["init", "--verbose"], cwd).includes("[已更新] ai/template/VERSION"), "init --verbose should show detailed file changes");
181
+ const verboseInitOutput = run(["init", "--verbose"], cwd);
182
+ assert(verboseInitOutput.includes("文件已就绪:"), "init --verbose should summarize file changes");
183
+ assert(verboseInitOutput.includes("[已更新] ai/template/VERSION"), "init --verbose should show detailed file changes");
173
184
  assert(countOccurrences(read(cwd, "AGENTS.md"), "agent-execution-template:start") === 1, "re-running init should keep one AGENTS.md managed block");
174
185
  assert(countOccurrences(read(cwd, "CLAUDE.md"), "agent-execution-template:start") === 1, "re-running init should keep one CLAUDE.md managed block");
175
186
  const reconcileOutput = run(["reconcile"], cwd);
@@ -248,12 +259,12 @@ function testEnglishInitUpdateDoctor() {
248
259
  assert(read(cwd, "ai/template/rules/core.md").includes("expand scope, permission, commands, network access, or acceptance"), "English core rules should stop continuous execution before boundary expansion");
249
260
  assert(read(cwd, "ai/project/task.md").includes("execution_policy:"), "English task template should include execution policy");
250
261
  assert(read(cwd, "ai/project/task.md").includes("readiness:"), "English task template should include readiness state");
251
- assert(read(cwd, "ai/project/task.md").includes("activation_rule: \"auto_enable_when_l1_count_gte_2\""), "English task template should define automatic activation rule");
252
- assert(read(cwd, "ai/project/task.md").includes("l1_granularity: \"independently_acceptable_vertical_slice\""), "English task template should define L1 granularity");
253
- assert(read(cwd, "ai/project/task.md").includes("write_back_policy: \"l1_start_done_red_blocked_scope_change_final\""), "English task template should define task tree write-back policy");
254
- assert(read(cwd, "ai/project/task.md").includes("risk_gate:"), "English task template should define risk gate");
262
+ assert(read(cwd, "ai/project/task.md").includes("compact task contract"), "English task template should default to compact contracts");
263
+ assert(read(cwd, "ai/project/task.md").includes("Expanded tasks"), "English task template should explain when to expand task contracts");
264
+ assert(!read(cwd, "ai/project/task.md").includes("activation_rule: \"auto_enable_when_l1_count_gte_2\""), "English task template should not default to expanded activation metadata");
265
+ assert(!read(cwd, "ai/project/task.md").includes("checkpoint_budget:"), "English task template should not default to checkpoint budget fields");
266
+ assert(!read(cwd, "ai/project/task.md").includes("model_policy:"), "English task template should not default to model policy fields");
255
267
  assert(read(cwd, "ai/project/task.md").includes("status: \"pending | running | done | blocked\""), "English task template should define task tree node status");
256
- assert(read(cwd, "ai/project/task.md").includes("progress_unit: \"vertical_slice\""), "English task template should define continuous progress unit");
257
268
  assert(read(cwd, "ai/template/prompt.md").includes("Start initializing this project and absorb the material in ai/project/inbox/"), "English execution prompt should route bootstrap with inbox material");
258
269
  assert(read(cwd, "ai/template/prompt.md").includes("instead of bootstrapping again"), "English execution prompt should reconcile inbox material when project context already exists");
259
270
  assert(read(cwd, "ai/template/prompt.md").includes("Reconcile the new material in ai/project/inbox/"), "English execution prompt should route natural reconcile entry");
@@ -273,16 +284,25 @@ function testEnglishInitUpdateDoctor() {
273
284
  assert(read(cwd, "ai/template/reconcile.md").includes("ai/project/inbox/processed/raw/file.md"), "English reconcile prompt should archive absorbed raw inbox material");
274
285
  assert(read(cwd, "ai/template/reconcile.md").includes("Unabsorbed material"), "English reconcile handoff should audit unabsorbed material");
275
286
  assert(read(cwd, "ai/template/reconcile.md").includes("Conflict handling"), "English reconcile handoff should audit conflict handling");
276
- assert(initOutput.includes("Start initializing this project"), "English init output should provide English bootstrap prompt");
277
- assert(initOutput.includes("root AI compatibility entrypoints: AGENTS.md / CLAUDE.md"), "English init output should mention root AI compatibility entrypoints");
278
- assert(initOutput.includes("protocol installed. Project context is not initialized yet"), "English init output should distinguish protocol install from project context bootstrap");
279
- assert(initOutput.includes("[Next: ask the AI to initialize project context]"), "English init output should guide the AI bootstrap as the next step");
287
+ assert(initOutput.includes("Agent Execution Template installed."), "English init output should confirm installation");
288
+ assert(initOutput.includes("You can use it like this:"), "English init output should introduce scenario-based usage");
289
+ assert(initOutput.includes("1. Set up project context for the first time"), "English init output should cover first-time project context setup");
290
+ assert(initOutput.includes("[Send to AI]\n\n Start initializing this project"), "English init output should make the bootstrap prompt visually prominent");
291
+ assert(initOutput.includes("2. You already have a README, PRD, architecture doc, or business rules"), "English init output should cover initialization with existing material");
280
292
  assert(initOutput.includes("Start initializing this project and absorb the material in ai/project/inbox/"), "English init output should explain bootstrap with existing material");
281
- assert(initOutput.includes("Reconcile the new material in ai/project/inbox/"), "English init output should provide English reconcile prompt");
282
- assert(initOutput.includes("Improve context"), "English init output should expose context refresh in user language");
283
- assert(initOutput.includes("Generate a direction amendment proposal from ai/project/inbox/ideas/"), "English init output should provide natural strategy prompt");
284
- assert(initOutput.includes("agent-execution-template next"), "English init output should tell users how to recover the next step");
285
- assert(initOutput.includes("Files:"), "English init output should summarize file changes");
293
+ assert(initOutput.includes("3. Later, you have new material to merge"), "English init output should cover later material reconciliation");
294
+ assert(initOutput.includes("Reconcile the new material in ai/project/inbox/"), "English init output should show the reconcile prompt");
295
+ assert(initOutput.includes("4. You have an undecided idea, product direction, or architecture change"), "English init output should cover undecided ideas");
296
+ assert(initOutput.includes("Generate a direction amendment proposal from ai/project/inbox/ideas/"), "English init output should show the strategy proposal prompt");
297
+ assert(!initOutput.includes("Project context is not initialized yet"), "English init output should not state the obvious uninitialized context");
298
+ assert(!initOutput.includes("If you forget the next step"), "English init output should not show next as the default fallback");
299
+ assert(!initOutput.includes("Root AI entrypoints"), "English init output should not mention root AI entrypoint implementation details");
300
+ assert(!initOutput.includes("Material paths:"), "English init output should not show abstract material path categories");
301
+ assert(!initOutput.includes("Confirmed material:"), "English init output should not show abstract confirmed material path categories");
302
+ assert(!initOutput.includes("Undecided ideas:"), "English init output should not show abstract idea path categories");
303
+ assert(!initOutput.includes("agent-execution-template next"), "English init output should not tell users to remember the next command");
304
+ assert(!initOutput.includes("Files ready:"), "English init output should hide file change summaries by default");
305
+ assert(initOutput.includes("Check install:"), "English init output should show install check command");
286
306
  assert(!initOutput.includes("Maintainer note"), "English init output should not show source checkout guidance in user projects");
287
307
  assert(!initOutput.includes("[UPDATED]"), "English init output should hide detailed file changes by default");
288
308
  assert(run(["init", "--lang=en", "--verbose"], cwd).includes("[UPDATED] ai/template/VERSION"), "English init --verbose should show detailed file changes");