@wnlen/agent-execution-template 0.8.16 → 0.8.18
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 +40 -0
- package/README.zh-CN.md +35 -0
- package/bin/agent-execution-template.js +54 -4
- package/docs/SPEC.md +9 -4
- package/package.json +3 -2
- package/template/en/ai/README.md +3 -19
- package/template/en/ai/project/task.md +26 -3
- package/template/en/ai/template/VERSION +1 -1
- package/template/en/ai/template/execution-policy.md +109 -0
- package/template/en/ai/template/prompt.md +19 -12
- package/template/en/ai/template/protocol.md +9 -64
- package/template/en/ai/template/rules/core.md +10 -27
- package/template/zh/ai/README.md +3 -19
- package/template/zh/ai/project/task.md +20 -2
- package/template/zh/ai/template/VERSION +1 -1
- package/template/zh/ai/template/execution-policy.md +95 -0
- package/template/zh/ai/template/prompt.md +13 -8
- package/template/zh/ai/template/protocol.md +7 -50
- package/template/zh/ai/template/rules/core.md +9 -20
- package/test/check-release.js +94 -0
- package/test/selftest.js +54 -10
|
@@ -49,71 +49,16 @@ Project Bootstrap / Context Reconcile / Strategy Update -> Project Confirm -> Ta
|
|
|
49
49
|
|
|
50
50
|
## Execution Authorization Modes
|
|
51
51
|
|
|
52
|
-
|
|
53
|
-
decomposes the task and judges risk, then chooses `normal` or
|
|
54
|
-
`bounded_continuous`. Continuous execution does not depend on a human keyword.
|
|
55
|
-
|
|
56
|
-
Pre-execution planning must:
|
|
57
|
-
|
|
58
|
-
- Infer goal, scope, acceptance, permissions, and verification method from the
|
|
59
|
-
human goal, project context, and repository facts.
|
|
60
|
-
- List the L1 task checklist and assign Green / Yellow / Red risk to each L1.
|
|
61
|
-
- Use `normal` if there are fewer than 2 L1 tasks.
|
|
62
|
-
- Automatically use `bounded_continuous` if there are 2 or more L1 tasks.
|
|
63
|
-
- Stop for human confirmation first if any L1 is Red; Green and Yellow do not
|
|
64
|
-
block startup.
|
|
65
|
-
|
|
66
|
-
Bounded continuous execution rules:
|
|
67
|
-
|
|
68
|
-
- Execute the task tree in L1 -> L2 -> L3 order. Before executing an L1, plan
|
|
69
|
-
its naturally derived L2 tasks; before executing an L2, plan L3 tasks if it
|
|
70
|
-
still needs decomposition.
|
|
71
|
-
- Default to at most 3 levels. Add L4 dynamically only when L3 would otherwise
|
|
72
|
-
be too large, unverifiable, or hard to revert.
|
|
73
|
-
- Every L1/L2/L3/L4 node must have risk, expected edit scope, acceptance method,
|
|
74
|
-
and evidence requirements.
|
|
75
|
-
- Show the L1 checklist as task items; when an L1 is complete, check it off and
|
|
76
|
-
strike it through.
|
|
77
|
-
- Default to `vertical_slice` progress: each loop should produce a runnable,
|
|
78
|
-
reviewable, or reversible increment.
|
|
79
|
-
- The AI infers goal, scope, acceptance, and permissions, but must not cross
|
|
80
|
-
project rules, explicit human limits, `permission.modify.denied`, security
|
|
81
|
-
boundaries, or destructive-action limits.
|
|
82
|
-
- `Green` may continue automatically.
|
|
83
|
-
- `Yellow` may continue after local low-risk correction.
|
|
84
|
-
- `Red` must stop for human confirmation.
|
|
85
|
-
- If permission must expand, an unallowed command must run, network access is
|
|
86
|
-
needed, a destructive action is needed, or product direction / core
|
|
87
|
-
architecture would change, the current node must be Red.
|
|
88
|
-
- After all work is complete, run one final review; re-check only Yellow, Red,
|
|
89
|
-
failed verification, or high-impact modules.
|
|
90
|
-
- Every checkpoint must include evidence; a purely subjective Green is not valid.
|
|
91
|
-
- Continuous execution does not change model policy; still escalate through
|
|
92
|
-
`model_policy` for planning, architecture, failure review, or acceptance disputes.
|
|
93
|
-
|
|
94
|
-
Must stop when:
|
|
95
|
-
|
|
96
|
-
- The task would change product direction, core architecture, data structures,
|
|
97
|
-
security boundaries, payment, accounts, or permissions.
|
|
98
|
-
- The task would delete many files or rewrite a core module.
|
|
99
|
-
- The task outline, acceptance, or permission contains a material conflict.
|
|
100
|
-
- The current implementation affects multiple later modules and the task
|
|
101
|
-
contract does not cover that impact.
|
|
102
|
-
- Tests fail and cannot be fixed locally.
|
|
103
|
-
- There are two or more high-cost options that need human judgment.
|
|
104
|
-
|
|
105
|
-
Use this compact checkpoint format:
|
|
52
|
+
Before task execution, read `ai/template/execution-policy.md`.
|
|
106
53
|
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
### Auto-Continue Decision
|
|
116
|
-
```
|
|
54
|
+
The default execution policy is `auto`: the AI first decomposes L1 tasks and
|
|
55
|
+
judges Green / Yellow / Red risk, then chooses `normal` or `bounded_continuous`.
|
|
56
|
+
Use `normal` when there are fewer than 2 L1 tasks; automatically use
|
|
57
|
+
`bounded_continuous` when there are 2 or more L1 tasks. Only Red stops for
|
|
58
|
+
human confirmation.
|
|
59
|
+
|
|
60
|
+
Task tree, risk rubric, checkpoint evidence, and `task_tree` status update
|
|
61
|
+
rules are defined in `ai/template/execution-policy.md`.
|
|
117
62
|
|
|
118
63
|
## Bootstrap Mode
|
|
119
64
|
|
|
@@ -119,33 +119,16 @@ or dependency files unless the human explicitly authorizes it.
|
|
|
119
119
|
|
|
120
120
|
## Bounded Continuous Execution Gate
|
|
121
121
|
|
|
122
|
-
Before every execution, the AI must
|
|
123
|
-
of waiting for the human to
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
-
|
|
130
|
-
-
|
|
131
|
-
|
|
132
|
-
- Stop for human confirmation if any L1 is Red; Green and Yellow may continue.
|
|
133
|
-
|
|
134
|
-
When enabled:
|
|
135
|
-
|
|
136
|
-
- Execute in L1 -> L2 -> L3 order; plan L2 before executing an L1, and plan L3
|
|
137
|
-
as needed before executing an L2.
|
|
138
|
-
- Default to at most 3 levels; add L4 dynamically only when L3 is still too
|
|
139
|
-
large, unverifiable, or hard to revert.
|
|
140
|
-
- Show the L1 checklist as task items; when an L1 is complete, check it off and
|
|
141
|
-
strike it through.
|
|
142
|
-
- Every task node must have risk, expected edit scope, acceptance method, and
|
|
143
|
-
evidence requirements.
|
|
144
|
-
- The checkpoint budget is a maximum, not a required count.
|
|
145
|
-
- Every checkpoint must include evidence.
|
|
146
|
-
- `Green` may continue automatically.
|
|
147
|
-
- `Yellow` continues after local low-risk correction.
|
|
148
|
-
- `Red` must stop for human confirmation.
|
|
122
|
+
Before every execution, the AI must read `ai/template/execution-policy.md`,
|
|
123
|
+
decompose the task, and judge risk instead of waiting for the human to
|
|
124
|
+
explicitly say "enable continuous execution".
|
|
125
|
+
|
|
126
|
+
Hard gates:
|
|
127
|
+
|
|
128
|
+
- `execution_policy.task_tree` must record the L1 checklist and execution state.
|
|
129
|
+
- Every task node must have Green / Yellow / Red risk.
|
|
130
|
+
- Every checkpoint must include evidence; a purely subjective Green is not valid.
|
|
131
|
+
- Red must stop for human confirmation.
|
|
149
132
|
- Any product direction, core architecture, data structure, security, payment,
|
|
150
133
|
account, permission, large deletion, core rewrite, or high-cost option choice
|
|
151
134
|
must stop.
|
package/template/zh/ai/README.md
CHANGED
|
@@ -11,6 +11,7 @@ project 是现场工作区
|
|
|
11
11
|
|
|
12
12
|
- `template/prompt.md`:AI 启动提示。
|
|
13
13
|
- `template/bootstrap.md`:项目发现和上下文引导提示。
|
|
14
|
+
- `template/execution-policy.md`:自动连续执行、任务树、风险分级和 Checkpoint 规则。
|
|
14
15
|
- `template/reconcile.md`:把新的权威资料合并进现有项目上下文。
|
|
15
16
|
- `template/VERSION`:已安装模板版本。
|
|
16
17
|
- `template/protocol.md`:引导流程、执行流程、模型分工、同步规则。
|
|
@@ -111,22 +112,5 @@ ai/project/inbox/ideas/
|
|
|
111
112
|
- 只回流 `ai/template/**`。
|
|
112
113
|
- 永远不要回流 `ai/project/**`。
|
|
113
114
|
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
- 人类提供意图、硬约束和最终验收。
|
|
117
|
-
- Agent 从现有文档、清单、引用和项目文件中起草 `project/project.md` 和相关 `project/refs/*`。
|
|
118
|
-
- 人类提供当前任务目标后,Agent 起草 `project/task.md`。
|
|
119
|
-
- 人类在执行前检查并确认项目和任务草稿。
|
|
120
|
-
- 引导只能写项目上下文文件;当提供当前任务时,也可以写 `project/task.md`。
|
|
121
|
-
- 引导不得编辑源码、测试、配置、依赖文件、生成文件、运行时文件、结果文件或指标文件。
|
|
122
|
-
- 最多问 3 个澄清问题。
|
|
123
|
-
- 只在答案会改变范围、风险、权限或验收时提问。
|
|
124
|
-
- 重复出现的假设应变成 `project/runtime.md` 更新建议。
|
|
125
|
-
|
|
126
|
-
## 模型分工协议
|
|
127
|
-
|
|
128
|
-
- 模型策略位于 `project/task.md.model_policy`。
|
|
129
|
-
- 常规执行默认使用 `cheap`。
|
|
130
|
-
- 中等实现复杂度使用 `standard`。
|
|
131
|
-
- 只有规划、风险判断、架构复核、失败复盘或验收判断才使用 `strong`。
|
|
132
|
-
- 在 `project/metrics.json` 中记录实际档位、触发条件、角色和升级原因。
|
|
115
|
+
详细执行规则见 `template/protocol.md`、`template/bootstrap.md`、
|
|
116
|
+
`template/execution-policy.md` 和 `template/rules/`。
|
|
@@ -3,6 +3,7 @@ task_id: ""
|
|
|
3
3
|
type: "bugfix | feature | refactor | docs | config | test | research | strategy_update | apply_strategy_update"
|
|
4
4
|
priority: "P0 | P1 | P2 | P3"
|
|
5
5
|
risk_level: "low | medium | high"
|
|
6
|
+
readiness: "draft_for_confirmation | ready_to_execute | blocked"
|
|
6
7
|
depends_on_previous_result: false
|
|
7
8
|
execution_policy:
|
|
8
9
|
mode: "auto | normal | bounded_continuous"
|
|
@@ -10,7 +11,17 @@ execution_policy:
|
|
|
10
11
|
max_depth: 3
|
|
11
12
|
allow_depth_4_when_needed: true
|
|
12
13
|
progress_unit: "vertical_slice"
|
|
13
|
-
task_tree:
|
|
14
|
+
task_tree:
|
|
15
|
+
- id: "L1-1"
|
|
16
|
+
title: ""
|
|
17
|
+
risk: "Green | Yellow | Red"
|
|
18
|
+
status: "pending | running | done | blocked"
|
|
19
|
+
scope:
|
|
20
|
+
allowed: []
|
|
21
|
+
denied: []
|
|
22
|
+
acceptance: []
|
|
23
|
+
evidence: []
|
|
24
|
+
children: []
|
|
14
25
|
checkpoint_budget:
|
|
15
26
|
l1: 0
|
|
16
27
|
l2: 0
|
|
@@ -69,7 +80,9 @@ permission:
|
|
|
69
80
|
这个文件是当前执行契约。优先在引导模式中,根据简短人类目标和仓库上下文生成,
|
|
70
81
|
然后由人类在执行前检查。
|
|
71
82
|
|
|
72
|
-
|
|
83
|
+
优先使用安全假设,少问额外问题。AI 应基于用户目标、项目上下文和仓库事实推断
|
|
84
|
+
范围、风险、权限和验收;如果推断会越过权限、安全边界或验收无法定义,将
|
|
85
|
+
`readiness` 标为 `blocked` 或将相关任务节点标为 `Red`,等待人类确认。
|
|
73
86
|
|
|
74
87
|
## 目标
|
|
75
88
|
|
|
@@ -116,6 +129,10 @@ permission:
|
|
|
116
129
|
|
|
117
130
|
- 目标、范围、验收、权限和风险评级由 AI 基于用户目标、项目上下文和仓库事实推断;
|
|
118
131
|
不要求用户预先逐项提供。
|
|
132
|
+
- `readiness = ready_to_execute` 表示没有 Red 预检项,可以执行。
|
|
133
|
+
- `readiness = draft_for_confirmation` 表示需要人类确认后才能执行。
|
|
134
|
+
- `readiness = blocked` 表示当前任务不可执行,必须写 blocked 结果。
|
|
135
|
+
- 执行前必须把 L1 任务清单写入 `execution_policy.task_tree`。
|
|
119
136
|
- 执行前必须列出 L1 任务清单;每个 L1 用待办列表表示,完成后打勾并划掉。
|
|
120
137
|
- 执行某个 L1 前,AI 先规划自然衍生出的 L2;如果 L2 仍需拆分,再规划 L3。
|
|
121
138
|
- 默认最多 3 层;只有当不拆 L4 会导致 L3 过大或不可验证时,才允许动态增加 L4。
|
|
@@ -125,6 +142,7 @@ permission:
|
|
|
125
142
|
- `checkpoint_budget` 是最多可用检查点预算,不是必须用完的次数;不要为了消耗预算而汇报。
|
|
126
143
|
- 只有在触发 `checkpoint_triggers`、风险升高或准备收尾时才输出 Checkpoint。
|
|
127
144
|
- 每个 Checkpoint 必须包含证据:已改文件、已运行命令、验证结果或无法验证的原因。
|
|
145
|
+
- 执行中必须更新 `task_tree` 节点状态:`pending`、`running`、`done` 或 `blocked`。
|
|
128
146
|
- 完成后只做一次总复盘;只对 Yellow、Red、失败验证或高影响模块做二次抽检。
|
|
129
147
|
- 连续执行不改变模型策略;涉及判断、架构、失败复盘或验收争议时仍按 `model_policy` 升级。
|
|
130
148
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
0.8.
|
|
1
|
+
0.8.18
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
# 执行策略
|
|
2
|
+
|
|
3
|
+
不要总结这个文件。
|
|
4
|
+
任务执行时按本文件选择 `normal` 或 `bounded_continuous`。
|
|
5
|
+
|
|
6
|
+
## 默认策略
|
|
7
|
+
|
|
8
|
+
默认执行策略是 `auto`:AI 在每次执行前先做任务分解和风险判断,再决定使用
|
|
9
|
+
`normal` 还是 `bounded_continuous`。启用连续执行不依赖用户说出特定口令。
|
|
10
|
+
|
|
11
|
+
执行前规划必须:
|
|
12
|
+
|
|
13
|
+
- 根据用户目标、项目上下文和仓库事实,推断目标、范围、验收、权限和验证方式。
|
|
14
|
+
- 列出 L1 任务清单,并为每个 L1 生成 Green / Yellow / Red 风险评级。
|
|
15
|
+
- 如果 L1 少于 2 个,使用 `normal`。
|
|
16
|
+
- 如果 L1 为 2 个或更多,自动启用 `bounded_continuous`。
|
|
17
|
+
- 如果任一 L1 为 Red,先停止并让人类确认;Green 和 Yellow 不阻塞启动。
|
|
18
|
+
- 将任务树写入 `ai/project/task.md` 的 `execution_policy.task_tree`。
|
|
19
|
+
|
|
20
|
+
## 任务树
|
|
21
|
+
|
|
22
|
+
任务树按 L1 -> L2 -> L3 执行。
|
|
23
|
+
|
|
24
|
+
- 执行某个 L1 前,先规划它自然衍生出的 L2。
|
|
25
|
+
- 执行某个 L2 前,如果仍需拆分,再规划 L3。
|
|
26
|
+
- 默认最多 3 层。只有当 L3 仍过大、不可验证或不可回退时,才动态增加 L4。
|
|
27
|
+
- L1/L2/L3/L4 都必须有风险评级、预期改动范围、验收方式和证据要求。
|
|
28
|
+
- L1 清单必须用待办列表展示;每完成一个 L1,就打勾并划掉。
|
|
29
|
+
- 执行中必须更新 `task_tree` 节点状态:`pending`、`running`、`done` 或 `blocked`。
|
|
30
|
+
|
|
31
|
+
推荐节点结构:
|
|
32
|
+
|
|
33
|
+
```yaml
|
|
34
|
+
id: "L1-1"
|
|
35
|
+
title: ""
|
|
36
|
+
risk: "Green | Yellow | Red"
|
|
37
|
+
status: "pending | running | done | blocked"
|
|
38
|
+
scope:
|
|
39
|
+
allowed: []
|
|
40
|
+
denied: []
|
|
41
|
+
acceptance: []
|
|
42
|
+
evidence: []
|
|
43
|
+
children: []
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
## 风险分级
|
|
47
|
+
|
|
48
|
+
Green:
|
|
49
|
+
|
|
50
|
+
- 在当前任务范围内;
|
|
51
|
+
- 不需要新增权限、命令、网络或破坏性操作;
|
|
52
|
+
- 验收方式明确;
|
|
53
|
+
- 不改变产品方向、核心架构、数据结构、安全边界、支付、账号或权限。
|
|
54
|
+
|
|
55
|
+
Yellow:
|
|
56
|
+
|
|
57
|
+
- 仍在当前任务范围内;
|
|
58
|
+
- 存在局部不确定或局部验证失败;
|
|
59
|
+
- 可以用低风险修正继续;
|
|
60
|
+
- 不需要扩大权限、范围、命令或验收。
|
|
61
|
+
|
|
62
|
+
Red:
|
|
63
|
+
|
|
64
|
+
- 需要扩大权限、运行未允许命令、访问网络或执行破坏性操作;
|
|
65
|
+
- 需要改变产品方向、核心架构、数据结构、安全边界、支付、账号或权限;
|
|
66
|
+
- 需要删除大量文件、重写核心模块或在多个高成本方案之间取舍;
|
|
67
|
+
- 验收不可定义,或任务目标和项目方向发生实质冲突。
|
|
68
|
+
|
|
69
|
+
只有 Red 停止等待人类确认。Green 自动继续。Yellow 做局部低风险修正后继续。
|
|
70
|
+
|
|
71
|
+
## Checkpoint
|
|
72
|
+
|
|
73
|
+
Checkpoint 只在风险升高、边界即将变化、完成垂直切片或准备收尾时输出。
|
|
74
|
+
不要为了消耗预算而汇报。
|
|
75
|
+
|
|
76
|
+
每个 Checkpoint 必须包含:
|
|
77
|
+
|
|
78
|
+
```text
|
|
79
|
+
## Checkpoint
|
|
80
|
+
### 任务树
|
|
81
|
+
### 当前完成度
|
|
82
|
+
### 已完成
|
|
83
|
+
### 证据
|
|
84
|
+
### 偏离风险:Green / Yellow / Red
|
|
85
|
+
### 下一步建议
|
|
86
|
+
### 是否自动继续
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
证据必须包含已改文件、已运行命令、验证结果,或无法验证的原因。
|
|
90
|
+
不接受只有主观判断的 Green。
|
|
91
|
+
|
|
92
|
+
## 模型策略
|
|
93
|
+
|
|
94
|
+
连续执行不改变 `model_policy`。遇到规划、架构、失败复盘或验收争议,
|
|
95
|
+
仍按 `model_policy` 升级,并在 `ai/project/metrics.json` 中记录原因。
|
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
|
|
10
10
|
1. `ai/template/protocol.md`
|
|
11
11
|
2. `ai/template/rules/core.md`
|
|
12
|
+
3. `ai/template/execution-policy.md`
|
|
12
13
|
|
|
13
14
|
然后选择模式:
|
|
14
15
|
|
|
@@ -51,11 +52,14 @@
|
|
|
51
52
|
2. 根据用户当前目标、项目上下文和仓库事实,推断目标、范围、验收、权限、
|
|
52
53
|
验证方式和初始风险;不要要求用户逐项提供。
|
|
53
54
|
3. 起草 `ai/project/task.md`,并将 `execution_policy.mode` 设为 `auto`。
|
|
54
|
-
4. 执行前列出 L1 任务清单并标注 Green / Yellow / Red
|
|
55
|
-
`normal`;L1 为 2
|
|
56
|
-
|
|
55
|
+
4. 执行前列出 L1 任务清单并标注 Green / Yellow / Red,同时写入
|
|
56
|
+
`execution_policy.task_tree`。L1 少于 2 个时使用 `normal`;L1 为 2 个或更多时
|
|
57
|
+
自动使用 `bounded_continuous`。
|
|
58
|
+
5. 如果没有 Red 预检项,将 `readiness` 设为 `ready_to_execute`;如果需要人类确认,
|
|
59
|
+
设为 `draft_for_confirmation`;如果不可执行,设为 `blocked`。
|
|
60
|
+
6. 只有出现 Red 预检项时才停止等待人类确认。若用户要求的是执行或继续,且预检
|
|
57
61
|
只有 Green / Yellow,可以直接进入执行模式。
|
|
58
|
-
|
|
62
|
+
7. 不要在任务草稿模式中修改源码或业务文件。
|
|
59
63
|
|
|
60
64
|
任务草稿模式必须以下面结构结束:
|
|
61
65
|
|
|
@@ -104,10 +108,11 @@
|
|
|
104
108
|
2. `ai/project/runtime.md`
|
|
105
109
|
3. `ai/project/task.md`
|
|
106
110
|
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
+
然后按 `ai/template/execution-policy.md` 做执行前规划:列出 L1 清单,给每个 L1
|
|
112
|
+
标注 Green / Yellow / Red,并写入 `execution_policy.task_tree`。根据 L1 数量自动选择
|
|
113
|
+
`normal` 或 `bounded_continuous`。执行 L1 前规划 L2,执行 L2 前按需规划 L3;
|
|
114
|
+
默认最多 3 层,必要时允许 L4。每完成一个 L1,在清单中打勾并划掉,并更新
|
|
115
|
+
`task_tree` 节点状态。只有 Red 停止等待人类确认;Green 自动继续,Yellow 做局部
|
|
111
116
|
低风险修正后继续。最后把结果写入:
|
|
112
117
|
|
|
113
118
|
- `ai/project/result.json`
|
|
@@ -43,57 +43,14 @@ ai/project/task.md = 当前执行契约
|
|
|
43
43
|
|
|
44
44
|
## 执行授权模式
|
|
45
45
|
|
|
46
|
-
|
|
47
|
-
`normal` 还是 `bounded_continuous`。启用连续执行不依赖用户说出特定口令。
|
|
48
|
-
|
|
49
|
-
执行前规划必须:
|
|
50
|
-
|
|
51
|
-
- 根据用户目标、项目上下文和仓库事实,推断目标、范围、验收、权限和验证方式。
|
|
52
|
-
- 列出 L1 任务清单,并为每个 L1 生成 Green / Yellow / Red 风险评级。
|
|
53
|
-
- 如果 L1 少于 2 个,使用 `normal`。
|
|
54
|
-
- 如果 L1 为 2 个或更多,自动启用 `bounded_continuous`。
|
|
55
|
-
- 如果任一 L1 为 Red,先停止并让人类确认;Green 和 Yellow 不阻塞启动。
|
|
56
|
-
|
|
57
|
-
边界内连续执行规则:
|
|
58
|
-
|
|
59
|
-
- 任务树按 L1 -> L2 -> L3 执行。执行某个 L1 前,先规划它自然衍生出的 L2;
|
|
60
|
-
执行某个 L2 前,如果仍需拆分,再规划 L3。
|
|
61
|
-
- 默认最多 3 层。只有当 L3 仍过大、不可验证或不可回退时,才动态增加 L4。
|
|
62
|
-
- L1/L2/L3/L4 都必须有风险评级、预期改动范围、验收方式和证据要求。
|
|
63
|
-
- L1 清单必须用待办列表展示;每完成一个 L1,就打勾并划掉。
|
|
64
|
-
- 默认按 `vertical_slice` 推进:每轮都产出可运行、可检查或可回退的增量。
|
|
65
|
-
- 目标、范围、验收和权限由 AI 推断,但不能越过项目规则、显式用户限制、
|
|
66
|
-
`permission.modify.denied`、安全边界或破坏性操作限制。
|
|
67
|
-
- `Green` 可以自动继续。
|
|
68
|
-
- `Yellow` 可以在局部低风险修正后继续。
|
|
69
|
-
- `Red` 必须停止等待人类确认。
|
|
70
|
-
- 如果需要扩大权限、运行未允许命令、访问网络、执行破坏性操作、改变产品方向或核心架构,
|
|
71
|
-
当前节点必须标为 Red。
|
|
72
|
-
- 全部完成后只做一次总复盘;只对 Yellow、Red、验证失败或高影响模块做二次抽检。
|
|
73
|
-
- 每个 Checkpoint 必须给出证据,不接受只有主观判断的 Green。
|
|
74
|
-
- 连续执行不改变模型策略;遇到规划、架构、失败复盘或验收争议,仍按 `model_policy` 升级。
|
|
75
|
-
|
|
76
|
-
必须停止的情况:
|
|
77
|
-
|
|
78
|
-
- 需要改变产品方向、核心架构、数据结构、安全边界、支付、账号或权限。
|
|
79
|
-
- 需要删除大量文件或重写核心模块。
|
|
80
|
-
- 发现任务大纲、验收或权限之间存在实质冲突。
|
|
81
|
-
- 当前实现会影响多个后续模块,且任务契约没有覆盖该影响。
|
|
82
|
-
- 测试失败且无法局部修复。
|
|
83
|
-
- 出现两个以上高成本方案,需要人类裁决。
|
|
84
|
-
|
|
85
|
-
检查点使用紧凑格式:
|
|
46
|
+
任务执行前必须读取 `ai/template/execution-policy.md`。
|
|
86
47
|
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
### 偏离风险:Green / Yellow / Red
|
|
94
|
-
### 下一步建议
|
|
95
|
-
### 是否自动继续
|
|
96
|
-
```
|
|
48
|
+
执行策略默认是 `auto`:AI 先拆 L1 任务并判断 Green / Yellow / Red,再决定使用
|
|
49
|
+
`normal` 或 `bounded_continuous`。L1 少于 2 个使用 `normal`;L1 为 2 个或更多
|
|
50
|
+
自动启用 `bounded_continuous`。只有 Red 停止等待人类确认。
|
|
51
|
+
|
|
52
|
+
任务树、风险分级、Checkpoint 证据和 `task_tree` 状态更新规则由
|
|
53
|
+
`ai/template/execution-policy.md` 定义。
|
|
97
54
|
|
|
98
55
|
## 引导模式
|
|
99
56
|
|
|
@@ -103,26 +103,15 @@
|
|
|
103
103
|
|
|
104
104
|
## 边界内连续执行门
|
|
105
105
|
|
|
106
|
-
每次执行前,AI
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
-
|
|
112
|
-
-
|
|
113
|
-
-
|
|
114
|
-
|
|
115
|
-
启用后:
|
|
116
|
-
|
|
117
|
-
- 按 L1 -> L2 -> L3 执行;执行某个 L1 前规划 L2,执行某个 L2 前按需规划 L3。
|
|
118
|
-
- 默认最多 3 层;只有当 L3 仍过大、不可验证或不可回退时,才动态增加 L4。
|
|
119
|
-
- L1 清单必须用待办列表展示;每完成一个 L1,就打勾并划掉。
|
|
120
|
-
- 每个任务节点必须有风险评级、预期改动范围、验收方式和证据要求。
|
|
121
|
-
- 检查点预算是上限,不是必须用完的次数。
|
|
122
|
-
- 每个 Checkpoint 必须包含证据。
|
|
123
|
-
- `Green` 可自动继续。
|
|
124
|
-
- `Yellow` 做局部低风险修正后继续。
|
|
125
|
-
- `Red` 必须停止等待人类确认。
|
|
106
|
+
每次执行前,AI 必须读取 `ai/template/execution-policy.md`,先做任务分解和风险判断,
|
|
107
|
+
而不是等待用户显式说“启用连续执行”。
|
|
108
|
+
|
|
109
|
+
硬门禁:
|
|
110
|
+
|
|
111
|
+
- `execution_policy.task_tree` 必须记录 L1 清单和执行状态。
|
|
112
|
+
- 每个任务节点必须有 Green / Yellow / Red 风险评级。
|
|
113
|
+
- 每个 Checkpoint 必须包含证据;不接受只有主观判断的 Green。
|
|
114
|
+
- Red 必须停止等待人类确认。
|
|
126
115
|
- 任何方向、核心架构、数据结构、安全、支付、账号、权限、大量删除、
|
|
127
116
|
核心重写或高成本方案取舍,都必须停止。
|
|
128
117
|
- 需要扩大范围、权限、命令、网络或验收时,必须停止。
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
const fs = require("fs");
|
|
4
|
+
const path = require("path");
|
|
5
|
+
|
|
6
|
+
const repoRoot = path.resolve(__dirname, "..");
|
|
7
|
+
const packagePath = path.join(repoRoot, "package.json");
|
|
8
|
+
const packageJson = JSON.parse(fs.readFileSync(packagePath, "utf8"));
|
|
9
|
+
|
|
10
|
+
function fail(message) {
|
|
11
|
+
throw new Error(message);
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
function read(relativePath) {
|
|
15
|
+
return fs.readFileSync(path.join(repoRoot, relativePath), "utf8");
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
function listFiles(relativeDir) {
|
|
19
|
+
const root = path.join(repoRoot, relativeDir);
|
|
20
|
+
const files = [];
|
|
21
|
+
|
|
22
|
+
function walk(dir) {
|
|
23
|
+
for (const entry of fs.readdirSync(dir, { withFileTypes: true })) {
|
|
24
|
+
const fullPath = path.join(dir, entry.name);
|
|
25
|
+
if (entry.isDirectory()) {
|
|
26
|
+
walk(fullPath);
|
|
27
|
+
} else if (entry.isFile()) {
|
|
28
|
+
files.push(path.relative(root, fullPath).split(path.sep).join("/"));
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
walk(root);
|
|
34
|
+
return files.sort();
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
function assertEqual(actual, expected, message) {
|
|
38
|
+
if (actual !== expected) {
|
|
39
|
+
fail(`${message}\nExpected: ${expected}\nActual: ${actual}`);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
function assertIncludes(content, expected, message) {
|
|
44
|
+
if (!content.includes(expected)) {
|
|
45
|
+
fail(`${message}\nMissing: ${expected}`);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
function assertFileListsMatch(leftDir, rightDir, message) {
|
|
50
|
+
const left = listFiles(leftDir).join("\n");
|
|
51
|
+
const right = listFiles(rightDir).join("\n");
|
|
52
|
+
assertEqual(left, right, message);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
function assertTreesMatch(leftDir, rightDir, message) {
|
|
56
|
+
const leftFiles = listFiles(leftDir);
|
|
57
|
+
const rightFiles = listFiles(rightDir);
|
|
58
|
+
assertEqual(leftFiles.join("\n"), rightFiles.join("\n"), `${message}: file list differs`);
|
|
59
|
+
|
|
60
|
+
for (const file of leftFiles) {
|
|
61
|
+
const left = read(path.join(leftDir, file));
|
|
62
|
+
const right = read(path.join(rightDir, file));
|
|
63
|
+
assertEqual(left, right, `${message}: ${file} differs`);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
function main() {
|
|
68
|
+
const version = packageJson.version;
|
|
69
|
+
assertEqual(packageJson.name, "@wnlen/agent-execution-template", "package name changed unexpectedly");
|
|
70
|
+
assertEqual(
|
|
71
|
+
packageJson.bin && packageJson.bin["agent-execution-template"],
|
|
72
|
+
"bin/agent-execution-template.js",
|
|
73
|
+
"package bin entry should point to the CLI"
|
|
74
|
+
);
|
|
75
|
+
|
|
76
|
+
assertEqual(read("template/zh/ai/template/VERSION").trim(), version, "zh template version must match package version");
|
|
77
|
+
assertEqual(read("template/en/ai/template/VERSION").trim(), version, "en template version must match package version");
|
|
78
|
+
assertEqual(read("ai/template/VERSION").trim(), version, "installed zh template version must match package version");
|
|
79
|
+
|
|
80
|
+
assertFileListsMatch("template/zh/ai", "template/en/ai", "zh and en templates must expose the same file layout");
|
|
81
|
+
assertTreesMatch("template/zh/ai/template", "ai/template", "installed ai/template must mirror template/zh/ai/template");
|
|
82
|
+
assertEqual(read("template/zh/ai/README.md"), read("ai/README.md"), "installed ai/README.md must mirror template/zh/ai/README.md");
|
|
83
|
+
|
|
84
|
+
const spec = read("docs/SPEC.md");
|
|
85
|
+
assertIncludes(spec, `Package: @wnlen/agent-execution-template@${version}`, "SPEC package version must match package.json");
|
|
86
|
+
|
|
87
|
+
const scripts = packageJson.scripts || {};
|
|
88
|
+
assertIncludes(scripts.test || "", "test/selftest.js", "npm test should run the CLI selftest");
|
|
89
|
+
assertIncludes(scripts.test || "", "test/check-release.js", "npm test should run release consistency checks");
|
|
90
|
+
|
|
91
|
+
console.log("release check ok");
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
main();
|