@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 CHANGED
@@ -153,6 +153,31 @@ npx -y @wnlen/agent-execution-template strategy --lang en
153
153
  | Upgradeable template | Reuse protocol improvements without losing local project memory. |
154
154
  | Doctor checks | Validate required files and template version before running the agent. |
155
155
 
156
+ ## How Automatic Continuous Execution Works
157
+
158
+ The user can still give a natural-language goal, for example:
159
+
160
+ ```text
161
+ Build the settings page with profile editing, notification toggles, and export entrypoint
162
+ ```
163
+
164
+ Before execution, the AI decomposes L1 tasks:
165
+
166
+ ```text
167
+ - [ ] L1-1 Profile editing Green
168
+ - [ ] L1-2 Notification toggles Green
169
+ - [ ] L1-3 Export entrypoint Yellow
170
+ ```
171
+
172
+ Because there are two or more L1 tasks, the protocol automatically uses bounded
173
+ continuous execution. Before each L1, the AI plans naturally derived L2/L3 work.
174
+ After completing an L1, it checks and strikes the item, then writes status back
175
+ to `execution_policy.task_tree` in `ai/project/task.md`.
176
+
177
+ Only Red risk stops for confirmation. Green continues automatically, and Yellow
178
+ continues after local low-risk correction. Every checkpoint must include
179
+ evidence: changed files, commands run, and verification results.
180
+
156
181
  ## Installed Layout
157
182
 
158
183
  ```text
@@ -162,6 +187,7 @@ ai/
162
187
  template/
163
188
  VERSION
164
189
  bootstrap.md
190
+ execution-policy.md
165
191
  prompt.md
166
192
  reconcile.md
167
193
  protocol.md
@@ -418,11 +444,25 @@ Run the self-test:
418
444
  npm test
419
445
  ```
420
446
 
447
+ Run the release consistency check:
448
+
449
+ ```bash
450
+ npm run check:release
451
+ ```
452
+
421
453
  The test suite verifies the core CLI contract:
422
454
 
423
455
  - `init` creates the expected protocol and project files.
424
456
  - `update` does not overwrite `ai/project/**`.
425
457
  - `doctor` reports missing and empty required files correctly.
458
+ - `check:release` verifies versions, template shape, installed protocol state,
459
+ and the spec's package version.
460
+
461
+ When maintaining this npm package source checkout, test the local CLI with
462
+ `node bin/agent-execution-template.js <command>`. Use
463
+ `npx -y @wnlen/agent-execution-template <command>` in user projects only.
464
+ Maintainer-local `ai/project/**` bootstrap content should not be committed as
465
+ product changes.
426
466
 
427
467
  ## Contributing
428
468
 
package/README.zh-CN.md CHANGED
@@ -163,6 +163,29 @@ npx -y @wnlen/agent-execution-template strategy
163
163
  | 可升级模板 | 协议可以持续改进,不丢失项目本地记忆。 |
164
164
  | Doctor 检查 | 执行前检查必要文件和模板版本。 |
165
165
 
166
+ ## 自动连续执行怎么工作
167
+
168
+ 用户仍然只需要说自然语言目标,例如:
169
+
170
+ ```text
171
+ 实现设置页,包括资料编辑、通知开关和导出入口
172
+ ```
173
+
174
+ AI 会在执行前先拆 L1 任务:
175
+
176
+ ```text
177
+ - [ ] L1-1 资料编辑 Green
178
+ - [ ] L1-2 通知开关 Green
179
+ - [ ] L1-3 导出入口 Yellow
180
+ ```
181
+
182
+ 因为 L1 有两个以上,协议会自动使用边界内连续执行。执行每个 L1 前,AI 再规划
183
+ 自然衍生的 L2/L3;完成一个 L1 后,在清单中打勾并划掉,同时把状态写回
184
+ `ai/project/task.md` 的 `execution_policy.task_tree`。
185
+
186
+ 只有 Red 风险会停下来让你确认。Green 自动继续,Yellow 只做局部低风险修正后继续。
187
+ 每个 Checkpoint 都必须带证据:改了哪些文件、跑了哪些命令、验证结果是什么。
188
+
166
189
  ## 安装后的结构
167
190
 
168
191
  ```text
@@ -172,6 +195,7 @@ ai/
172
195
  template/
173
196
  VERSION
174
197
  bootstrap.md
198
+ execution-policy.md
175
199
  prompt.md
176
200
  reconcile.md
177
201
  protocol.md
@@ -425,11 +449,22 @@ License: MIT
425
449
  npm test
426
450
  ```
427
451
 
452
+ 发布前检查:
453
+
454
+ ```bash
455
+ npm run check:release
456
+ ```
457
+
428
458
  测试会验证核心 CLI 契约:
429
459
 
430
460
  - `init` 创建预期的协议和项目文件。
431
461
  - `update` 不覆盖 `ai/project/**`。
432
462
  - `doctor` 正确报告缺失文件和空的必要文件。
463
+ - `check:release` 验证版本号、模板结构、安装态协议和规格文档一致。
464
+
465
+ 维护这个 npm 包源码仓库时,用 `node bin/agent-execution-template.js <command>`
466
+ 测试当前 checkout;用户项目才使用 `npx -y @wnlen/agent-execution-template <command>`。
467
+ 维护者本地 `ai/project/**` 初始化内容不应作为产品改动提交。
433
468
 
434
469
  ## 贡献
435
470
 
@@ -13,6 +13,7 @@ const REQUIRED_FILES = [
13
13
  "ai/template/LANG",
14
14
  "ai/template/VERSION",
15
15
  "ai/template/bootstrap.md",
16
+ "ai/template/execution-policy.md",
16
17
  "ai/template/prompt.md",
17
18
  "ai/template/reconcile.md",
18
19
  "ai/template/protocol.md",
@@ -48,7 +49,13 @@ const TASK_HEALTH_PATTERNS = [
48
49
  /^type:\s*/m,
49
50
  /^priority:\s*/m,
50
51
  /^risk_level:\s*/m,
52
+ /^readiness:\s*/m,
51
53
  /^execution_policy:/m,
54
+ /^\s+mode:\s*/m,
55
+ /^\s+activation_rule:\s*/m,
56
+ /^\s+task_tree:/m,
57
+ /^\s+risk_gate:/m,
58
+ /^\s+evidence_required:\s*/m,
52
59
  /^model_policy:/m,
53
60
  /^refs:/m,
54
61
  /^permission:/m
@@ -146,7 +153,12 @@ const TEXT = {
146
153
  nextTellAgent: "把这句话发给你的 AI coding 工具:",
147
154
  nextRunCommand: "运行这个命令:",
148
155
  nextReviewProposal: "已有方向修订提案。先审查提案;确认后对 AI 说:",
156
+ nextContinuePrompt: "继续推进这个项目。执行前先拆 L1 任务;若 L1 >= 2,自动启用边界内连续执行;只有 Red 风险停下来确认。",
149
157
  repairHint: "缺失的 project 推荐文件可通过重新运行 init 安全补齐;已有 ai/project/** 不会被覆盖。",
158
+ sourceCheckoutNotice: `维护者提示: 当前目录看起来是 @wnlen/agent-execution-template 源码仓库。
159
+ 源码仓库内调试请使用: node bin/agent-execution-template.js <command>
160
+ 用户项目中安装才使用: npx -y @wnlen/agent-execution-template <command>
161
+ 不要把维护者本地初始化产生的 ai/project/** 当成产品改动提交。`,
150
162
  permissionDenied: "无法写入目标路径",
151
163
  permissionHint: `请检查 ai/** 的归属和权限。常见修复:
152
164
  sudo chown -R "$(id -un):$(id -gn)" ai
@@ -250,7 +262,12 @@ Usage:
250
262
  nextTellAgent: "Send this to your AI coding tool:",
251
263
  nextRunCommand: "Run this command:",
252
264
  nextReviewProposal: "A direction amendment proposal exists. Review it first; after confirmation, tell the AI:",
265
+ nextContinuePrompt: "Continue this project. Before execution, decompose L1 tasks; if L1 >= 2, automatically use bounded continuous execution; only Red risk stops for confirmation.",
253
266
  repairHint: "Missing recommended project files can be safely added by running init again; existing ai/project/** files are not overwritten.",
267
+ sourceCheckoutNotice: `Maintainer note: this directory looks like the @wnlen/agent-execution-template source checkout.
268
+ In the source repository, test with: node bin/agent-execution-template.js <command>
269
+ In user projects, install with: npx -y @wnlen/agent-execution-template <command>
270
+ Do not commit maintainer-local ai/project/** bootstrap content as product changes.`,
254
271
  permissionDenied: "Cannot write target path",
255
272
  permissionHint: `Check ownership and permissions under ai/**. Common fix:
256
273
  sudo chown -R "$(id -un):$(id -gn)" ai
@@ -282,6 +299,17 @@ function readPackageVersion() {
282
299
  }
283
300
  }
284
301
 
302
+ function readTargetPackageName() {
303
+ const packageFile = path.join(process.cwd(), "package.json");
304
+ if (!fs.existsSync(packageFile)) return null;
305
+ try {
306
+ const pkg = JSON.parse(fs.readFileSync(packageFile, "utf8"));
307
+ return pkg.name || null;
308
+ } catch {
309
+ return null;
310
+ }
311
+ }
312
+
285
313
  function readInstalledLang() {
286
314
  const langFile = path.join(TARGET_AI, "template", "LANG");
287
315
  if (!fs.existsSync(langFile)) return DEFAULT_LANG;
@@ -289,6 +317,24 @@ function readInstalledLang() {
289
317
  return SUPPORTED_LANGS.has(lang) ? lang : DEFAULT_LANG;
290
318
  }
291
319
 
320
+ function isSourceCheckout() {
321
+ return process.cwd() === PACKAGE_ROOT &&
322
+ readTargetPackageName() === "@wnlen/agent-execution-template";
323
+ }
324
+
325
+ function commandHint(command) {
326
+ if (isSourceCheckout()) {
327
+ return `node bin/agent-execution-template.js ${command}`;
328
+ }
329
+ return `npx -y @wnlen/agent-execution-template ${command}`;
330
+ }
331
+
332
+ function printSourceCheckoutNotice(lang) {
333
+ if (isSourceCheckout()) {
334
+ console.log(`${getText(lang).sourceCheckoutNotice}\n`);
335
+ }
336
+ }
337
+
292
338
  function parseLang(args, fallback = DEFAULT_LANG) {
293
339
  let lang = fallback;
294
340
  for (let index = 0; index < args.length; index += 1) {
@@ -478,12 +524,14 @@ function init({ lang = DEFAULT_LANG, verbose = false, quiet = false } = {}) {
478
524
  .map((change) => ({ ...change, path: path.join("ai/project", change.path) })));
479
525
 
480
526
  if (!quiet) {
527
+ const sourceNotice = isSourceCheckout() ? `${text.sourceCheckoutNotice}\n\n` : "";
481
528
  console.log(`${text.ready}
482
529
 
483
530
  ${text.initGuide}
484
531
 
532
+ ${sourceNotice}
485
533
  ${text.files}: ${summarizeChanges(changes, lang)}
486
- ${text.check}: npx -y @wnlen/agent-execution-template doctor
534
+ ${text.check}: ${commandHint("doctor")}
487
535
  `);
488
536
 
489
537
  if (verbose) {
@@ -537,12 +585,13 @@ function next({ lang = readInstalledLang() } = {}) {
537
585
  }
538
586
 
539
587
  console.log(`${text.nextTitle}\n`);
588
+ printSourceCheckoutNotice(lang);
540
589
 
541
590
  const templatePath = path.join(TARGET_AI, "template");
542
591
  const projectPath = path.join(TARGET_AI, "project");
543
592
  if (!fs.existsSync(templatePath) || !fs.existsSync(projectPath)) {
544
593
  console.log(`${text.nextRunInit}
545
- npx -y @wnlen/agent-execution-template init
594
+ ${commandHint("init")}
546
595
  `);
547
596
  return;
548
597
  }
@@ -583,7 +632,7 @@ function next({ lang = readInstalledLang() } = {}) {
583
632
  }
584
633
 
585
634
  console.log(`${text.nextTellAgent}
586
- ${lang === "zh" ? "继续推进这个项目" : "Continue this project"}
635
+ ${text.nextContinuePrompt}
587
636
  `);
588
637
  }
589
638
 
@@ -669,6 +718,7 @@ function doctor() {
669
718
  const lang = readInstalledLang();
670
719
  const text = getText(lang);
671
720
  console.log(`${text.doctorTitle}\n`);
721
+ printSourceCheckoutNotice(lang);
672
722
  console.log(`${text.templateVersion}: ${readVersion(path.join(TARGET_AI, "template")) || text.unknown}`);
673
723
  console.log(`${text.templateLang}: ${lang}\n`);
674
724
 
@@ -739,7 +789,7 @@ function doctor() {
739
789
  }
740
790
 
741
791
  if (missing > 0) {
742
- console.log(`\n[${text.fail}] ${text.runInit}`);
792
+ console.log(`\n[${text.fail}] ${commandHint("init")}`);
743
793
  process.exitCode = 1;
744
794
  } else if (warnings > 0) {
745
795
  console.log(`\n[${text.pass}] ${text.readyWithWarnings}`);
package/docs/SPEC.md CHANGED
@@ -22,7 +22,7 @@ npx 安装协议 -> AI 整理项目上下文 -> 人类确认 -> AI 生成任务
22
22
 
23
23
  ```text
24
24
  Protocol: v0.8
25
- Package: @wnlen/agent-execution-template@0.8.16
25
+ Package: @wnlen/agent-execution-template@0.8.18
26
26
  中文安装: npx -y @wnlen/agent-execution-template init
27
27
  英文安装: npx -y @wnlen/agent-execution-template init --lang en
28
28
  ```
@@ -181,6 +181,7 @@ ai/
181
181
  template/
182
182
  VERSION
183
183
  bootstrap.md
184
+ execution-policy.md
184
185
  prompt.md
185
186
  reconcile.md
186
187
  protocol.md
@@ -243,6 +244,7 @@ project 是现场。
243
244
  ```text
244
245
  ai/template/VERSION
245
246
  ai/template/bootstrap.md
247
+ ai/template/execution-policy.md
246
248
  ai/template/prompt.md
247
249
  ai/template/reconcile.md
248
250
  ai/template/protocol.md
@@ -390,12 +392,13 @@ npx -y @wnlen/agent-execution-template doctor
390
392
  ```text
391
393
  Agent Execution Template 检查
392
394
 
393
- 模板版本: 0.8.16
395
+ 模板版本: 0.8.18
394
396
  模板语言: zh
395
397
 
396
398
  [通过] ai/template/LANG
397
399
  [通过] ai/template/VERSION
398
400
  [通过] ai/template/bootstrap.md
401
+ [通过] ai/template/execution-policy.md
399
402
  [通过] ai/template/prompt.md
400
403
  [通过] ai/template/reconcile.md
401
404
  [通过] ai/template/protocol.md
@@ -648,10 +651,11 @@ apply_strategy_update
648
651
 
649
652
  ## 14. 执行授权策略
650
653
 
651
- 执行策略写在:
654
+ 执行策略入口写在:
652
655
 
653
656
  ```text
654
657
  ai/project/task.md.execution_policy
658
+ ai/template/execution-policy.md
655
659
  ```
656
660
 
657
661
  默认模式是 `auto`。AI 每次执行前先做任务分解和风险判断,再决定使用
@@ -665,12 +669,13 @@ ai/project/task.md.execution_policy
665
669
  - L1 为 2 个或更多时自动使用 `bounded_continuous`;
666
670
  - 任一 L1 为 Red 时停止等待人类确认;Green 和 Yellow 不阻塞启动。
667
671
 
668
- `bounded_continuous` 规则:
672
+ `bounded_continuous` 规则集中在 `ai/template/execution-policy.md`。核心要求:
669
673
 
670
674
  - 按 L1 -> L2 -> L3 执行,执行 L1 前规划 L2,执行 L2 前按需规划 L3;
671
675
  - 默认最多 3 层,只有当 L3 仍过大、不可验证或不可回退时才动态增加 L4;
672
676
  - 每个任务节点必须有风险评级、预期改动范围、验收方式和证据要求;
673
677
  - L1 清单必须用待办列表展示,每完成一个 L1 就打勾并划掉;
678
+ - 执行前和执行中必须把任务树写回 `ai/project/task.md.execution_policy.task_tree`;
674
679
  - 默认按 `vertical_slice` 推进,每轮都要产生可检查增量;
675
680
  - 每个 Checkpoint 必须包含证据:已改文件、已运行命令、验证结果或无法验证原因;
676
681
  - Green 可自动继续;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wnlen/agent-execution-template",
3
- "version": "0.8.16",
3
+ "version": "0.8.18",
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"
@@ -14,7 +14,8 @@
14
14
  ],
15
15
  "scripts": {
16
16
  "doctor": "node bin/agent-execution-template.js doctor",
17
- "test": "node test/selftest.js"
17
+ "check:release": "node test/check-release.js",
18
+ "test": "node test/selftest.js && node test/check-release.js"
18
19
  },
19
20
  "keywords": [
20
21
  "ai",
@@ -11,6 +11,7 @@ project is the field workspace
11
11
 
12
12
  - `template/prompt.md`: AI startup prompt.
13
13
  - `template/bootstrap.md`: project discovery and context bootstrap prompt.
14
+ - `template/execution-policy.md`: automatic continuous execution, task tree, risk rubric, and checkpoint rules.
14
15
  - `template/reconcile.md`: merge new authoritative material into existing project context.
15
16
  - `template/VERSION`: installed template version.
16
17
  - `template/protocol.md`: bootstrap flow, execution flow, model division, sync rules.
@@ -113,22 +114,5 @@ From a real project back into the template repo:
113
114
  - Return only `ai/template/**`.
114
115
  - Never return `ai/project/**`.
115
116
 
116
- ## Bootstrap Rule
117
-
118
- - The human provides intent, hard constraints, and final acceptance.
119
- - The agent drafts `project/project.md` and relevant `project/refs/*` from existing docs, manifests, refs, and project files.
120
- - The agent drafts `project/task.md` after the human provides the current task goal.
121
- - The human reviews and confirms project and task drafts before execution.
122
- - Bootstrap may write only project context files, plus `project/task.md` when a current task is provided.
123
- - Bootstrap must not edit source code, tests, configuration, dependency files, generated files, runtime files, result files, or metrics files.
124
- - Ask at most 3 clarification questions.
125
- - Ask only when the answer changes scope, risk, permission, or acceptance.
126
- - Repeated assumptions should become `project/runtime.md` update proposals.
127
-
128
- ## Model Division Protocol
129
-
130
- - Model policy lives in `project/task.md.model_policy`.
131
- - Use `cheap` by default for routine execution.
132
- - Use `standard` for moderate implementation complexity.
133
- - Use `strong` only for planning, risk judgment, architecture review, failure review, or acceptance judgment.
134
- - Record actual tier, trigger, role, and escalation reason in `project/metrics.json`.
117
+ Detailed execution rules live in `template/protocol.md`,
118
+ `template/bootstrap.md`, `template/execution-policy.md`, and `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
@@ -70,8 +81,11 @@ This file is the current execution contract. Prefer generating it in Bootstrap
70
81
  Mode from a short human goal plus repository context, then have a human review
71
82
  it before execution.
72
83
 
73
- Prefer safe assumptions over extra questions, but do not guess scope, risk,
74
- permissions, or acceptance.
84
+ Prefer safe assumptions over extra questions. The AI should infer scope, risk,
85
+ permissions, and acceptance from the human goal, project context, and repository
86
+ facts. If inference would cross permission or safety boundaries, or acceptance
87
+ cannot be defined, set `readiness` to `blocked` or mark the relevant task node
88
+ `Red` and wait for human confirmation.
75
89
 
76
90
  ## Goal
77
91
 
@@ -123,6 +137,13 @@ fewer than 2 L1 tasks, use `normal`; if it finds 2 or more L1 tasks, use
123
137
  - The AI infers goal, scope, acceptance, permissions, and risk from the human
124
138
  goal, project context, and repository facts; the human does not need to
125
139
  provide each field upfront.
140
+ - `readiness = ready_to_execute` means no Red preflight item exists and the task
141
+ may execute.
142
+ - `readiness = draft_for_confirmation` means human confirmation is required
143
+ before execution.
144
+ - `readiness = blocked` means the task cannot execute and must produce a
145
+ blocked result.
146
+ - Before execution, write the L1 checklist to `execution_policy.task_tree`.
126
147
  - Before execution, list the L1 task checklist; mark each L1 complete with a
127
148
  checked and struck-through item.
128
149
  - Before executing an L1, plan the naturally derived L2 tasks; if an L2 still
@@ -140,6 +161,8 @@ fewer than 2 L1 tasks, use `normal`; if it finds 2 or more L1 tasks, use
140
161
  review is about to start.
141
162
  - Every checkpoint must include evidence: changed files, commands run,
142
163
  verification results, or why verification was not possible.
164
+ - During execution, update `task_tree` node status: `pending`, `running`,
165
+ `done`, or `blocked`.
143
166
  - After completion, run one final review; only re-check Yellow, Red, failed
144
167
  verification, or high-impact modules.
145
168
  - Continuous execution does not change model policy; escalate through
@@ -1 +1 @@
1
- 0.8.16
1
+ 0.8.18
@@ -0,0 +1,109 @@
1
+ # Execution Policy
2
+
3
+ Do not summarize this file.
4
+ During task execution, use this file to choose `normal` or `bounded_continuous`.
5
+
6
+ ## Default Policy
7
+
8
+ The default execution policy is `auto`: before each execution, the AI first
9
+ decomposes the task and judges risk, then chooses `normal` or
10
+ `bounded_continuous`. Continuous execution does not depend on a human keyword.
11
+
12
+ Pre-execution planning must:
13
+
14
+ - Infer goal, scope, acceptance, permissions, and verification method from the
15
+ human goal, project context, and repository facts.
16
+ - List the L1 task checklist and assign Green / Yellow / Red risk to each L1.
17
+ - Use `normal` if there are fewer than 2 L1 tasks.
18
+ - Automatically use `bounded_continuous` if there are 2 or more L1 tasks.
19
+ - Stop for human confirmation first if any L1 is Red; Green and Yellow do not
20
+ block startup.
21
+ - Write the task tree to `execution_policy.task_tree` in `ai/project/task.md`.
22
+
23
+ ## Task Tree
24
+
25
+ Execute the task tree in L1 -> L2 -> L3 order.
26
+
27
+ - Before executing an L1, plan its naturally derived L2 tasks.
28
+ - Before executing an L2, plan L3 tasks if it still needs decomposition.
29
+ - Default to at most 3 levels. Add L4 dynamically only when L3 would otherwise
30
+ be too large, unverifiable, or hard to revert.
31
+ - Every L1/L2/L3/L4 node must have risk, expected edit scope, acceptance method,
32
+ and evidence requirements.
33
+ - Show the L1 checklist as task items; when an L1 is complete, check it off and
34
+ strike it through.
35
+ - During execution, update each `task_tree` node status: `pending`, `running`,
36
+ `done`, or `blocked`.
37
+
38
+ Recommended node shape:
39
+
40
+ ```yaml
41
+ id: "L1-1"
42
+ title: ""
43
+ risk: "Green | Yellow | Red"
44
+ status: "pending | running | done | blocked"
45
+ scope:
46
+ allowed: []
47
+ denied: []
48
+ acceptance: []
49
+ evidence: []
50
+ children: []
51
+ ```
52
+
53
+ ## Risk Rubric
54
+
55
+ Green:
56
+
57
+ - Inside current task scope;
58
+ - no new permission, command, network access, or destructive action is needed;
59
+ - acceptance is clear;
60
+ - no product direction, core architecture, data structure, security boundary,
61
+ payment, account, or permission change is needed.
62
+
63
+ Yellow:
64
+
65
+ - Still inside current task scope;
66
+ - local uncertainty or local verification failure exists;
67
+ - a low-risk local correction can continue the work;
68
+ - no permission, scope, command, or acceptance expansion is needed.
69
+
70
+ Red:
71
+
72
+ - Permission expansion, unallowed command, network access, or destructive action
73
+ is needed;
74
+ - product direction, core architecture, data structure, security boundary,
75
+ payment, account, or permission would change;
76
+ - many files must be deleted, a core module must be rewritten, or multiple
77
+ high-cost options require judgment;
78
+ - acceptance cannot be defined, or task goal materially conflicts with project direction.
79
+
80
+ Only Red stops for human confirmation. Green continues automatically. Yellow
81
+ continues after local low-risk correction.
82
+
83
+ ## Checkpoint
84
+
85
+ Emit checkpoints only when risk rises, a boundary is about to change, a vertical
86
+ slice is complete, or final review is about to start. Do not report just to
87
+ spend checkpoint budget.
88
+
89
+ Every checkpoint must include:
90
+
91
+ ```text
92
+ ## Checkpoint
93
+ ### Task Tree
94
+ ### Progress
95
+ ### Completed
96
+ ### Evidence
97
+ ### Drift Risk: Green / Yellow / Red
98
+ ### Recommended Next Step
99
+ ### Auto-Continue Decision
100
+ ```
101
+
102
+ Evidence must include changed files, commands run, verification results, or why
103
+ verification was not possible. A purely subjective Green is not valid.
104
+
105
+ ## Model Policy
106
+
107
+ Continuous execution does not change `model_policy`. Still escalate through
108
+ `model_policy` for planning, architecture, failure review, or acceptance
109
+ disputes, and record the reason in `ai/project/metrics.json`.
@@ -9,6 +9,7 @@ First read:
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
  Then choose the mode:
14
15
 
@@ -64,13 +65,17 @@ In Task Draft Mode:
64
65
  risk from the user's current goal, project context, and repository facts; do
65
66
  not require the human to provide each field upfront.
66
67
  3. Draft `ai/project/task.md` and set `execution_policy.mode` to `auto`.
67
- 4. Before execution, list the L1 checklist and mark each L1 Green / Yellow /
68
- Red. Use `normal` if there are fewer than 2 L1 tasks; automatically use
69
- `bounded_continuous` if there are 2 or more L1 tasks.
70
- 5. Stop for human confirmation only when a Red preflight item appears. If the
68
+ 4. Before execution, list the L1 checklist, mark each L1 Green / Yellow / Red,
69
+ and write it to `execution_policy.task_tree`. Use `normal` if there are
70
+ fewer than 2 L1 tasks; automatically use `bounded_continuous` if there are 2
71
+ or more L1 tasks.
72
+ 5. If no Red preflight item exists, set `readiness` to `ready_to_execute`; if
73
+ human confirmation is needed, set it to `draft_for_confirmation`; if the task
74
+ cannot execute, set it to `blocked`.
75
+ 6. Stop for human confirmation only when a Red preflight item appears. If the
71
76
  human asked to execute or continue, and preflight contains only Green /
72
77
  Yellow, proceed directly to Execution Mode.
73
- 6. Do not modify source or business files in Task Draft Mode.
78
+ 7. Do not modify source or business files in Task Draft Mode.
74
79
 
75
80
  End Task Draft Mode with:
76
81
 
@@ -121,13 +126,15 @@ In Execution Mode, read:
121
126
  2. `ai/project/runtime.md`
122
127
  3. `ai/project/task.md`
123
128
 
124
- Then perform pre-execution planning: list the L1 checklist, mark each L1 Green
125
- / Yellow / Red, and automatically choose `normal` or `bounded_continuous` from
126
- the L1 count. Plan L2 before executing an L1, and plan L3 as needed before
127
- executing an L2; default to at most 3 levels, with L4 allowed when needed. When
128
- an L1 is complete, check it off and strike it through. Only Red stops for human
129
- confirmation; Green continues automatically, and Yellow continues after local
130
- low-risk correction. Write results to:
129
+ Then follow `ai/template/execution-policy.md` for pre-execution planning: list
130
+ the L1 checklist, mark each L1 Green / Yellow / Red, and write it to
131
+ `execution_policy.task_tree`. Automatically choose `normal` or
132
+ `bounded_continuous` from the L1 count. Plan L2 before executing an L1, and
133
+ plan L3 as needed before executing an L2; default to at most 3 levels, with L4
134
+ allowed when needed. When an L1 is complete, check it off, strike it through,
135
+ and update the `task_tree` node status. Only Red stops for human confirmation;
136
+ Green continues automatically, and Yellow continues after local low-risk
137
+ correction. Write results to:
131
138
 
132
139
  - `ai/project/result.json`
133
140
  - `ai/project/result.md`