aodw-skill 0.7.26 → 0.7.27

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.
@@ -26,6 +26,41 @@
26
26
 
27
27
  ---
28
28
 
29
+ ## RT 创建:执行模式确认(强制)
30
+
31
+ 在**任何** RT 立项动作之前(含 `aodw-skill new`、手工建目录、AI 代建 `RT/RT-XXX/`),必须先向用户确认执行模式:
32
+
33
+ - **A. 人工干预模式(协作)** → `execution_mode: collaborative`
34
+ - **B. 全自动模式(Autopilot)** → `execution_mode: autopilot`
35
+
36
+ 规则:
37
+ - 必须使用决策型问题(2 选项 + Recommended + 理由)
38
+ - 用户未明确回复前,**不得**创建 RT 目录或文件
39
+ - 不得静默默认任一模式;历史 RT 若无 `execution_mode` 字段,须补问后再继续
40
+
41
+ 详见 `02-workflow/rt-manager.md` § 3.2。
42
+
43
+ ### Autopilot:完成标准二次确认(友好但强制)
44
+
45
+ 用户已选 **B. 全自动** 且 `rt-lite.md` §7 起草完成后,AI 必须用 **3–5 条自然语言**复述完成标准,并问:
46
+
47
+ ```
48
+ Q. 以上完成标准是否正确?
49
+
50
+ A. 是,按此 Autopilot 执行
51
+ B. 否,需要调整(请说明)
52
+
53
+ Recommended: A(若 §7 已与用户讨论一致)
54
+
55
+ 请回复:A/B
56
+ ```
57
+
58
+ - 用户选 **B** 或提出修改 → 修订 §7 后再次确认
59
+ - 用户选 **A** 前 → **禁止** 进入 Ralph 循环(`autopilot-protocol.md` Phase E)
60
+ - 定稿后写入 rt-lite §7「用户确认摘要」
61
+
62
+ ---
63
+
29
64
  1. 问题类型(两大类)
30
65
  AI 所提出的所有问题必须明确属于:
31
66
  1. 决策型(Decision Question)
@@ -0,0 +1,167 @@
1
+ ---
2
+ id: aodw-autopilot-goal-spec
3
+ version: 1.0.0
4
+ category: aodw/execution-profile
5
+ trigger: "Autopilot 开工前编写或审查 rt-lite.md §7 时加载"
6
+ description: >
7
+ 完成条件书写标准:范围 + 证据 + 测试。决定 Autopilot 能否收敛,比循环机制更重要。
8
+ ---
9
+
10
+ # Autopilot Goal Spec(完成条件标准)
11
+
12
+ > 借鉴:Task Platform `goal-specification-standard.md`、Ralph Loop(Huntley)、Claude Goal Mode(Scope + Evidence + Fuse)
13
+
14
+ **核心结论**:同样的 Ralph 循环,目标写得精确可快 62% 收敛且零 scope creep;目标模糊则过度实现或无限振荡。
15
+
16
+ ---
17
+
18
+ ## 1. 双层文档结构(AODW 映射)
19
+
20
+ | 层级 | 文件 | 角色 | 谁维护 |
21
+ |------|------|------|--------|
22
+ | **Goal(静态)** | `rt-lite.md` §1-§4、§7 | 定义「完成长什么样」「改什么/不改什么」 | 人 + AI 开工前共同定稿 |
23
+ | **Plan(动态)** | `rt-plan.md` + `state.json` | 记录「做到哪了」、阻塞、决策 | AI 每轮迭代更新 |
24
+
25
+ ```
26
+ rt-lite.md (Goal) → 不变的目标与边界
27
+ rt-plan.md (Plan) → 每轮更新的步骤清单
28
+ state.json → 机器可读的 checklist + 信号
29
+ loop-prompt.md → 每轮注入的执行指令
30
+ execution-log.md → 人可读的迭代时间线(防黑盒)
31
+ ```
32
+
33
+ ---
34
+
35
+ ## 2. 三要素公式(每条完成条件必备)
36
+
37
+ 对齐 Task Platform / Goal Mode:**Scope + Evidence + Test**;任务级还需 **Fuse(熔断)**。
38
+
39
+ | 要素 | 含义 | 示例 |
40
+ |------|------|------|
41
+ | **Scope(范围)** | 改哪些文件/模块;明确排除项 | `src/auth/login.ts` 及测试;不改 `register.ts` |
42
+ | **Evidence(证据)** | 完成时日志/输出/diff 中可见什么 | `execution-log` 记录 tests exit 0;diff 仅 §2.1 文件 |
43
+ | **Test(测试)** | 可执行 shell 命令,exit 0 = 通过 | `npm test -- auth`;`npx aodw-skill guard` |
44
+ | **Fuse(熔断)** | 轮次/时间上限,防无限循环 | `state.json.max_iterations: 20`;达上限必须停并交还人工 |
45
+
46
+ **判断标准**:能否写进 shell 脚本让机器自动检查?不能 = 条件太模糊。
47
+
48
+ **机械完成判定(双条件,缺一不可)**——对齐 Ralph「计划清空 + 测试通过」:
49
+
50
+ 1. `rt-plan.md` 进度区 **全部 `[x]`**(无未完成步骤)
51
+ 2. `state.json.checklist` **全 `true`**,且 §5.4 的 tests/lint/guard **均已 exit 0**
52
+
53
+ ### 2.1 好坏对比
54
+
55
+ | ❌ 坏条件 | ✅ 好条件 |
56
+ |----------|----------|
57
+ | 功能做完 | `curl -X POST /api/x` 返回 201 且 body 含 `id` |
58
+ | 代码改好 | `npm run lint` exit 0 |
59
+ | 测试差不多通过 | `pytest tests/auth -q` 0 failed |
60
+ | 优化性能 | `pytest tests/bench_login.py` p95 < 200ms |
61
+
62
+ ### 2.2 §7 表格写法(rt-lite.md)
63
+
64
+ | ID | 条件(Scope + Evidence) | 验证命令(Test) | state.json 字段 |
65
+ |----|--------------------------|------------------|-----------------|
66
+ | C1 | … | `...` | `plan_complete` |
67
+
68
+ ---
69
+
70
+ ## 3. 「不改什么」强制节(§1.3 / §2.1 旁)
71
+
72
+ 至少列出 **3 项**排除,典型类别:
73
+
74
+ - 明确不修改的文件/目录
75
+ - 明确不添加的功能
76
+ - 明确不变的行为(兼容性、API 契约)
77
+
78
+ 无边界 = 最大 scope creep 来源(Ralph 过度烘焙的首要诱因)。
79
+
80
+ ---
81
+
82
+ ## 4. 长度与可读性
83
+
84
+ - **Goal 核心块**(§1.2 目标 + §2.1 改什么 + §1.3.1 不改什么 + §7)建议 **≤ 60 行**(对齐 HumanLayer / Task Platform PROMPT.md 上限;过长会被模型忽略)
85
+ - 完整 `rt-lite.md` 可含 §3–§6,但注入 `loop-prompt.md` 时优先摘录 Goal 核心块
86
+ - §7 checklist **3–8 条**为宜;过多拆成多个 RT
87
+ - 禁止主观词:适当、合理、较好、差不多
88
+
89
+ ## 4.1 机械 Stop(AODW 映射 Task Platform Stop Hook)
90
+
91
+ Task Platform 用 Claude **Stop Hook**(shell exit 0/2)判定能否结束。AODW 等价链路:
92
+
93
+ | 机制 | 作用 |
94
+ |------|------|
95
+ | `npx aodw-skill guard` | 提交前痕迹检查(RT/文档是否齐全) |
96
+ | pre-commit guard hook | 与 Stop Hook 同思路:不通过则不允许结束本轮 |
97
+ | §5.4 tests/lint | Backpressure,非「感觉完成」 |
98
+
99
+ **禁止**仅用对话里的「我做完了」作为 Done 依据(Goal Mode Evaluator 盲区同理)。
100
+
101
+ ---
102
+
103
+ ## 5. Goal 质量自检(AI 在开工前必须跑)
104
+
105
+ | # | 检查项 | 不通过则 |
106
+ |---|--------|----------|
107
+ | 1 | 目标一句话说清 | 与用户澄清后再写 §7 |
108
+ | 2 | §2.1 改动文件 checklist | 补全路径 |
109
+ | 3 | 「不改什么」≥ 3 项 | 补边界 |
110
+ | 4 | §7 每条可机械验证 | 改写为 Scope+Evidence+Test |
111
+ | 5 | §5.4 tests/lint/guard 可运行 | 填真实命令 |
112
+ | 6 | 无模糊词 | 重写 |
113
+ | 7 | Autopilot 适配度(见下) | 建议改协作模式或升级 Spec-Full |
114
+
115
+ **任一项不通过 → 禁止进入 Ralph 循环**,只能做 Goal 修订或与用户确认。
116
+
117
+ ---
118
+
119
+ ## 6. Autopilot 适配度(AI 自主判断)
120
+
121
+ AI 在确认 `execution_mode: autopilot` 后、写 §7 前,用以下清单评估(不必全满足,但 **≥ 4/6 为推荐开工**):
122
+
123
+ | # | 条件 | 权重 |
124
+ |---|------|------|
125
+ | 1 | Spec-Lite 范围(单模块/低风险) | 高 |
126
+ | 2 | 完成条件可全部用命令验证 | 高 |
127
+ | 3 | 无未决架构/产品二选一 | 高 |
128
+ | 4 | 预计 ≤ max_iterations(默认 20)可完成 | 中 |
129
+ | 5 | 有现成 tests/lint | 中 |
130
+ | 6 | 不涉及数据模型/API 契约变更 | 高 |
131
+
132
+ - **< 4 分**:向用户建议改为 `collaborative` 或升级 Spec-Full,并说明理由(决策型问题 A/B)。
133
+ - **4–5 分**:可 Autopilot,但收紧 §7、降低 `max_iterations`。
134
+ - **6 分**:理想 Autopilot 场景。
135
+
136
+ **现实预期(FeatureBench)**:复杂端到端功能 Agent 成功率远低于修 bug(约 7–12% vs 70%+)。若适配度偏低或 §7 条目多且跨模块,应优先 **协作模式** 或 **拆 RT**,而非提高 `max_iterations` 硬跑。
137
+
138
+ ---
139
+
140
+ ## 7. 与执行模式的关系
141
+
142
+ ### 7.0 命名对照(Task Platform ↔ AODW)
143
+
144
+ | Task Platform(Job) | AODW(RT) | 说明 |
145
+ |---------------------|------------|------|
146
+ | `single` | `collaborative` + 单次实现 | 无循环 |
147
+ | `ralph-loop` | `autopilot` + `execution_submode: ralph-loop` | 默认 Autopilot |
148
+ | `goal` | `autopilot` + `execution_submode: goal-session` | 单 session,仍机械验收 |
149
+
150
+ ---
151
+
152
+ ## 7.1 与执行子模式的关系
153
+
154
+ | AODW 模式 | 对应 Task Platform | 完成判定 |
155
+ |-----------|------------------|----------|
156
+ | Autopilot + 多轮(默认) | Ralph Loop | `rt-plan` 全 `[x]` + checklist 全 true + §5.4 通过 |
157
+ | Autopilot + 单 session(可选) | Goal Mode 思想 | 同上;禁止纯对话判定完成 |
158
+
159
+ 详见 `autopilot-protocol.md` §4 模式选择。
160
+
161
+ ---
162
+
163
+ ## 8. 参考
164
+
165
+ - `02-workflow/autopilot-protocol.md` — 完整执行协议
166
+ - `02-workflow/spec-lite-autopilot-profile.md` — Gate 与循环
167
+ - Task Platform: `docs/goal-specification-standard.md`
@@ -0,0 +1,251 @@
1
+ ---
2
+ id: aodw-autopilot-protocol
3
+ version: 1.0.0
4
+ category: aodw/execution-profile
5
+ trigger: "meta.yaml execution_mode=autopilot 时加载(与 spec-lite-autopilot-profile 一并)"
6
+ description: >
7
+ AODW 全自动模式总协议:Goal Spec + Ralph 循环 + 机械 Gate + AI 研判 + 可观测 + 熔断。
8
+ priority: high
9
+ ---
10
+
11
+ # AODW Autopilot 执行协议
12
+
13
+ > 版本 1.0 | 融合 Task Platform 持续编程实践与 AODW RT 体系
14
+ > 关联:`autopilot-goal-spec.md`、`spec-lite-autopilot-profile.md`、`rt-manager.md` §3.2
15
+
16
+ ---
17
+
18
+ ## 0. 设计原则
19
+
20
+ | 原则 | 含义 |
21
+ |------|------|
22
+ | **规格驱动** | `rt-lite.md` + `rt-plan.md` 是每轮迭代的「大脑」,从磁盘重读,不靠对话记忆 |
23
+ | **文件系统即记忆** | `state.json` 跨轮持久化;每次迭代可全新 AI 上下文 |
24
+ | **机械 Backpressure** | 改动后必须跑 tests/lint/guard,禁止凭感觉声称完成 |
25
+ | **可观测** | `execution-log.md` 每轮一条,避免 RT-002 式黑盒 |
26
+ | **智能但可熔断** | LLM 负责研判与拆解;卡住/超轮/无进展则交还人工 |
27
+ | **用户已确认模式** | `execution_mode` 仅在创建 RT 时由用户选定,AI 不得静默默认 |
28
+
29
+ ---
30
+
31
+ ## 1. 生命周期总览
32
+
33
+ ```mermaid
34
+ flowchart TD
35
+ A[用户确认 Autopilot] --> B[创建 RT 脚手架]
36
+ B --> C[AI: 适配度研判 + Goal 质量自检]
37
+ C -->|不通过| D[修订 rt-lite / 改协作模式]
38
+ C -->|通过| E[Preflight 勾选]
39
+ E --> F[机械 Gate-Plan]
40
+ F --> G[Ralph 循环]
41
+ G --> H{Done?}
42
+ H -->|否| G
43
+ H -->|是| I[机械 Gate-Commit]
44
+ I --> J[机械 Gate-Done]
45
+ J --> K[RT done + 文档同步]
46
+ G -->|熔断| L[请求人工]
47
+ ```
48
+
49
+ ---
50
+
51
+ ## 2. 阶段说明
52
+
53
+ ### Phase A — 模式确认(强制,RT 创建时)
54
+
55
+ 见 `rt-manager.md` §3.2、`ai-interaction-rules.md`。未获用户 A/B 答复前不得创建 `RT/RT-XXX/`。
56
+
57
+ ### Phase B — Goal 定稿(AI + 用户,可 1–2 轮对话)
58
+
59
+ 1. AI 根据 intake 起草 `rt-lite.md` §1-§4、§7、§5.4
60
+ 2. 运行 `autopilot-goal-spec.md` §5 质量自检 + §6 适配度
61
+ 3. 不通过 → 用决策型问题请用户收窄范围或改协作模式
62
+ 4. 通过 → 初始化 `state.json`、`rt-plan.md`(空计划)
63
+
64
+ **友好行为**:用自然语言向用户展示 §7 摘要(3–5 条),请用户确认「是否就是这些完成标准」;仅确认后写入终稿。
65
+
66
+ ### Phase C — Preflight
67
+
68
+ 完成 `rt-autopilot-preflight.template.md` 或 `rt-autopilot-readiness.md` 全部勾选。
69
+
70
+ ### Phase D — 机械 Gate-Plan(替代协作 Gate 3)
71
+
72
+ | 条件 | 检查方式 |
73
+ |------|----------|
74
+ | §1-§4、§7 非空且通过 Goal 自检 | 文档 + AI 清单 |
75
+ | §5.4 三条命令已填且可执行 | 试跑或 `--help` 可解释 |
76
+ | 已在 `feature/RT-XXX-*` 分支 | `git branch --show-current` |
77
+
78
+ 通过 → `state.json.checklist.plan_complete=true`,`phase=implementing`。
79
+
80
+ ### Phase E — Ralph 实现循环
81
+
82
+ 每轮四步(与 Task Platform §4.2 对齐):
83
+
84
+ 1. **Read** — `state.json` + `rt-plan.md` + `loop-prompt.md`(注入当前 iteration)
85
+ 2. **Execute** — 完成 `rt-plan.md` 中 1–2 个未完成步骤;对应推进 §7 checklist
86
+ 3. **Backpressure** — 跑 §5.4 tests → lint → guard;更新 checklist 布尔值
87
+ 4. **Write** — 更新 `state.json`、`rt-plan.md`、`execution-log.md`;必要时 `rt-lite.md` §5-§6
88
+
89
+ **迭代上限**:`max_iterations` 默认 **20**(与 Task Platform `MAX_ITERATIONS` 一致;Spec-Lite 单 RT 可协商降为 15)。写在 `state.json`,创建 RT 时可与用户确认。
90
+
91
+ **冷却**:连续 API/工具失败时,记录 `blockers`,下一轮再试(不在单轮内死磕 >3 次同一错误)。
92
+
93
+ ### Phase F — 机械 Gate-Commit(替代协作 Gate 4)
94
+
95
+ 全部满足才允许 `git commit`:
96
+
97
+ - `tests_pass` && `lint_pass` && `guard_pass`
98
+ - 本轮 diff 与 §2.1 范围一致(guard 辅助)
99
+
100
+ ### Phase G — 机械 Gate-Done(替代协作 Gate 5)
101
+
102
+ **双条件完成**(对齐 Task Platform Goal Spec §三、Ralph「计划清空 + 验证通过」):
103
+
104
+ 1. `rt-plan.md`「进度」区全部 `[x]`(无 `[ ]` 步骤)
105
+ 2. `state.json.checklist` 全 `true`,且 §5.4 tests/lint/guard 均已在本轮或上一轮验证通过
106
+
107
+ 另需:
108
+
109
+ - development auditor 无 P0
110
+ - `meta.yaml.status=done`,`state.json.phase=done`
111
+ - 输出 `DONE`(对齐 Ralph 完成信号,便于外部脚本检测)
112
+
113
+ **机械 Stop 映射**:`guard` + pre-commit hook ≈ Task Platform Stop Hook;不得以纯对话判定替代上述双条件。
114
+
115
+ ---
116
+
117
+ ## 3. 质量控制
118
+
119
+ ### 3.1 每轮 Quality Gate
120
+
121
+ - [ ] 代码可解析/编译
122
+ - [ ] 相关测试通过
123
+ - [ ] lint/type 无新增错误
124
+ - [ ] 改动范围 ≤ 本轮 `rt-plan.md` 目标
125
+ - [ ] `state.json` 已更新
126
+ - [ ] `execution-log.md` 已追加本条
127
+
128
+ ### 3.2 Final Gate
129
+
130
+ - [ ] 所有 §7 条件已验证
131
+ - [ ] 完整测试套件(非抽样)通过
132
+ - [ ] 无临时 debug / 大范围 commented-out
133
+ - [ ] 无新增未说明的 TODO(除非原有问题)
134
+ - [ ] `phase=done`
135
+
136
+ ### 3.3 反模式检测(AI 每轮自检)
137
+
138
+ | 信号 | 含义 | 处理 |
139
+ |------|------|------|
140
+ | 同一文件修改 > 3 次 | 方案可能错误 | 换实现,记入 `decisions` |
141
+ | 同一测试点连续失败 | 理解有误 | 重读 §1、模块 README,更新 `blockers` |
142
+ | checklist 2 轮无进展 | 任务过大 | 拆 `rt-plan.md` 子步骤或 `phase=blocked` |
143
+ | diff 出现 §2.1 外文件 | scope creep | 回滚无关改动,收紧 prompt |
144
+ | 新增「过度烘焙」功能 | 循环过久/目标模糊 | 停止迭代,收紧 §7 或改协作模式 |
145
+
146
+ ---
147
+
148
+ ## 4. 执行子模式(AI 自主选用)
149
+
150
+ 在 **已确认 Autopilot** 的前提下,AI 根据任务特征选择子模式(**无需再次问用户**,但须写入 `state.json.execution_submode`):
151
+
152
+ ```
153
+ 任务评估
154
+
155
+ ├─ 预计多轮、>100K token、需跨重启续接?
156
+ │ └─ 是 → ralph-loop(默认):每轮新上下文,读 state.json
157
+
158
+ ├─ 可在单 session 内完成且 §7 ≤5 条?
159
+ │ └─ 是 → goal-session:单 session 推进,仍须机械验收
160
+
161
+ └─ 默认 → ralph-loop
162
+ ```
163
+
164
+ | 子模式 | 适用 | 风险缓解 |
165
+ |--------|------|----------|
166
+ | `ralph-loop` | 多步骤、长任务、需断点续跑 | `state.json` + `execution-log` |
167
+ | `goal-session` | 小改动、明确终点 | 仍跑 §5.4;避免「Evaluator 式」纯对话判定 |
168
+
169
+ ---
170
+
171
+ ## 5. 与用户交互边界(智能友好)
172
+
173
+ ### 5.1 不打断用户
174
+
175
+ - 每轮实现、测试、更新 state
176
+ - 自动 commit(Gate-Commit 通过后)
177
+ - 文档 §5-§6 同步
178
+
179
+ ### 5.2 必须打断用户
180
+
181
+ 1. `blockers` 非空且 **2 轮**无法消除
182
+ 2. 产品/架构 **二选一**(无默认安全项)
183
+ 3. 熔断:无进展 2 轮 / 达 `max_iterations` / 适配度中途恶化(如出现 schema 变更)
184
+ 4. Goal 自检失败且用户不愿收窄范围
185
+
186
+ ### 5.3 进度友好(推荐)
187
+
188
+ 每 **3 轮**或 **phase 变化**时,向用户发送简短进度(非请求确认):
189
+
190
+ ```
191
+ [RT-012 Autopilot] 迭代 3/15 | phase=implementing
192
+ ✓ C2 tests ✓ C3 lint ○ C5 docs
193
+ 下一步:更新 §6 changelog
194
+ ```
195
+
196
+ ---
197
+
198
+ ## 6. 错误恢复
199
+
200
+ | 场景 | 行为 |
201
+ |------|------|
202
+ | 单轮工具/测试失败 | 记入 `blockers`,下轮续接;**不**整 RT 失败 |
203
+ | 上下文耗尽 | 下轮全新上下文,读 `state.json` |
204
+ | 用户中断 | 保留 `state.json`,下次从 checklist 续跑 |
205
+ | 需改协作模式 | 更新 `meta.yaml.execution_mode=collaborative`,记录 `decisions`,交还 Gate 3/4/5 |
206
+
207
+ ---
208
+
209
+ ## 7. 配置参考
210
+
211
+ | 参数 | 默认 | 说明 |
212
+ |------|------|------|
213
+ | `max_iterations` | 20 | 防无限循环 / 过度烘焙(可对小型 RT 降为 15) |
214
+ | `stall_threshold` | 2 | 连续无进展轮数 → blocked |
215
+ | `same_file_edit_limit` | 3 | 反模式熔断 |
216
+ | `progress_notify_every` | 3 | 可选进度摘要间隔 |
217
+
218
+ ---
219
+
220
+ ## 8. 开工自检(AI)
221
+
222
+ - [ ] 用户已确认 `execution_mode: autopilot`
223
+ - [ ] Goal 质量自检 7/7 通过
224
+ - [ ] Autopilot 适配度 ≥ 4/6(或用户坚持并已知晓风险)
225
+ - [ ] Preflight 完成
226
+ - [ ] `feature/RT-XXX` 分支
227
+ - [ ] `loop-prompt.md` iteration 已设为 1
228
+
229
+ ---
230
+
231
+ ## 9. 文件清单
232
+
233
+ ```
234
+ RT/RT-XXX/
235
+ meta.yaml # execution_mode: autopilot
236
+ decision.md # 含模式确认记录
237
+ rt-lite.md # Goal:§1-§7
238
+ rt-plan.md # Plan:动态步骤
239
+ state.json # 机器状态
240
+ loop-prompt.md # 轮次 prompt
241
+ execution-log.md # 人读时间线
242
+ autopilot-preflight.md # 开工许可
243
+ ```
244
+
245
+ ---
246
+
247
+ ## 10. 参考
248
+
249
+ - Task Platform: `docs/continuous-programming-protocol.md`
250
+ - Task Platform: `docs/goal-specification-standard.md`
251
+ - AODW: `spec-lite-autopilot-profile.md`、`autopilot-goal-spec.md`
@@ -0,0 +1,55 @@
1
+ # RT Autopilot 开工前准备(必读)
2
+
3
+ > `execution_mode: autopilot` 时,实现循环前必须完成。
4
+ > 总协议:`02-workflow/autopilot-protocol.md` | Goal 标准:`02-workflow/autopilot-goal-spec.md`
5
+
6
+ ---
7
+
8
+ ## A. 项目级(一次性)
9
+
10
+ - [ ] `aodw-skill init` 且 `06-project/` 已深度初始化
11
+ - [ ] §5.4 tests / lint / guard 命令本地可执行
12
+ - [ ] pre-commit guard 已启用
13
+
14
+ ---
15
+
16
+ ## B. RT 级(每个 RT)
17
+
18
+ - [ ] 用户创建 RT 时已确认 **Autopilot**(`decision.md` 有记录)
19
+ - [ ] `rt-lite.md` §1-§4、§1.3.1、§7、§5.4 已填写
20
+ - [ ] Goal 质量自检 7/7(见 `autopilot-goal-spec.md` §5)
21
+ - [ ] Autopilot 适配度 ≥ 4/6(见 §6);不足则已改协作或用户知情
22
+ - [ ] §7 用户已确认「完成标准摘要」
23
+ - [ ] `state.json.checklist` 与 §7 对齐
24
+ - [ ] `rt-plan.md` 已创建并拆解步骤
25
+ - [ ] `feature/RT-XXX-*` 分支
26
+
27
+ ---
28
+
29
+ ## C. 禁止开工
30
+
31
+ - 完成条件含模糊词或不可机械验证
32
+ - 「不改什么」少于 3 项
33
+ - 跨模块高风险未升级 Spec-Full
34
+ - main/master 上改业务代码
35
+ - Goal 自检未通过
36
+
37
+ ---
38
+
39
+ ## D. 每轮固定动作
40
+
41
+ 1. 读 `state.json` + `rt-plan.md` + `loop-prompt.md`
42
+ 2. 完成 1–2 个 plan 步骤
43
+ 3. tests → lint → guard(Backpressure)
44
+ 4. 更新 `state.json`、`rt-plan.md`、`execution-log.md`
45
+ 5. 反模式自检(见 `autopilot-protocol.md` §3.3)
46
+
47
+ ---
48
+
49
+ ## E. 关联规则
50
+
51
+ | 文档 | 用途 |
52
+ |------|------|
53
+ | `autopilot-protocol.md` | 总协议、熔断、子模式 |
54
+ | `autopilot-goal-spec.md` | 三要素、适配度 |
55
+ | `spec-lite-autopilot-profile.md` | Gate 速查 |
@@ -56,12 +56,41 @@ RT-Manager 统一管理全局状态机更新。
56
56
  - 改进
57
57
  - 重构
58
58
 
59
- ### 3.2 执行步骤
60
- 1. 生成 RT-ID(固定本地生成)
61
- 2. 创建 RT 目录结构
62
- 3. 执行交互式澄清(选项化提问)
63
- 4. 记录立项信息到 `intake.md`
64
- 5. 决定使用 Spec-Full 还是 Spec-Lite profile
59
+ ### 3.2 执行模式确认(强制,最先执行)
60
+
61
+ **在生成 RT-ID、创建目录或写入任何 RT 文件之前**,AI 必须与用户确认执行模式,并获得**明确答复**。
62
+
63
+ | 模式 | `execution_mode` | 含义 |
64
+ |------|------------------|------|
65
+ | 人工干预(协作) | `collaborative` | Gate 3/4/5 需用户确认后再推进 |
66
+ | 全自动(Autopilot) | `autopilot` | 机械 Gate + `state.json` 循环;仅熔断时打断用户 |
67
+
68
+ **提问格式**(决策型,见 `01-core/ai-interaction-rules.md`):
69
+
70
+ ```
71
+ Q. 本 RT 采用哪种执行模式?
72
+
73
+ A. 人工干预模式(协作)— Gate 3/4/5 需我确认
74
+ B. 全自动模式(Autopilot)— 机械验收 + 循环推进
75
+
76
+ Recommended: A(首次使用 AODW 或需求/风险尚不清晰时)
77
+
78
+ 请回复:A/B
79
+ ```
80
+
81
+ **强制规则**:
82
+ - 🚫 用户未明确选择 A 或 B(或等价 custom)前,**禁止**创建 `RT/RT-XXX/`、禁止写 `meta.yaml`、禁止进入 intake/decision/实现
83
+ - 🚫 **禁止** AI 自行默认 `collaborative` 或 `autopilot` 并继续
84
+ - ✅ 用户确认后,立即写入 `meta.yaml.execution_mode` 与 `decision.md` 的「Execution Mode」节,并记录确认时间
85
+ - ✅ CLI:`aodw-skill new` 会在创建前交互选择;非交互须显式 `--execution-mode`
86
+
87
+ ### 3.3 执行步骤
88
+ 1. **确认执行模式**(§ 3.2,未完成则停止)
89
+ 2. 生成 RT-ID(固定本地生成)
90
+ 3. 创建 RT 目录结构(`execution_mode` 已写入 `meta.yaml`)
91
+ 4. 执行交互式澄清(选项化提问)
92
+ 5. 记录立项信息到 `intake.md`
93
+ 6. 决定使用 Spec-Full 还是 Spec-Lite profile
65
94
 
66
95
  ---
67
96
 
@@ -116,7 +145,27 @@ RT/RT-XXX/
116
145
  AI 根据决策结果,加载对应的 Profile:
117
146
 
118
147
  - Spec-Full → 加载 `02-workflow/spec-full-profile.md`
119
- - Spec-Lite 加载 `02-workflow/spec-lite-profile.md`
148
+ - Spec-Lite + `execution_mode=collaborative`(默认)→ 加载 `02-workflow/spec-lite-profile.md`
149
+ - Spec-Lite + `execution_mode=autopilot` → 加载 `02-workflow/spec-lite-autopilot-profile.md`
150
+
151
+ ### 7.1 Autopilot RT 附加文件(Spec-Lite)
152
+
153
+ 当 `meta.yaml.execution_mode: autopilot` 时:
154
+
155
+ | 文档 | 角色 |
156
+ |------|------|
157
+ | `rt-lite.md` | Goal(静态):§7 完成条件,三要素写法见 `autopilot-goal-spec.md` |
158
+ | `rt-plan.md` | Plan(动态):每轮更新的步骤清单 |
159
+ | `state.json` | 机器状态:checklist、phase、熔断信号 |
160
+ | `loop-prompt.md` | 每轮 Ralph 执行指令 |
161
+ | `execution-log.md` | 人读时间线(防黑盒) |
162
+ | `autopilot-preflight.md` | 开工许可 |
163
+
164
+ **总协议**:`02-workflow/autopilot-protocol.md`(Ralph 循环、机械 Gate、反模式、子模式、进度友好)。
165
+
166
+ Autopilot 流程摘要:
167
+ 1. 用户确认模式(§3.2)→ 2. Goal 定稿 + 自检 → 3. Preflight → 4. Gate-Plan → 5. Ralph 循环 → 6. Gate-Commit/Done
168
+ 熔断时交还人工;不得跳过 Goal 自检进入循环。
120
169
 
121
170
  ---
122
171
 
@@ -0,0 +1,101 @@
1
+ ---
2
+ id: aodw-spec-lite-autopilot
3
+ version: 2.0.0
4
+ category: aodw/execution-profile
5
+ trigger: "当 meta.yaml 中 execution_mode=autopilot 时加载"
6
+ description: >
7
+ Spec-Lite 全自动变体:机械 Gate + Ralph 循环 + Goal Spec。完整协议见 autopilot-protocol.md。
8
+ requires_files:
9
+ - RT/RT-XXX/rt-lite.md
10
+ - RT/RT-XXX/rt-plan.md
11
+ - RT/RT-XXX/state.json
12
+ - RT/RT-XXX/loop-prompt.md
13
+ - RT/RT-XXX/execution-log.md
14
+ ---
15
+
16
+ # Skill: aodw-spec-lite-autopilot
17
+ AODW Spec-Lite Autopilot 执行规范 v2.0
18
+
19
+ > **总协议**:`02-workflow/autopilot-protocol.md`
20
+ > **Goal 标准**:`02-workflow/autopilot-goal-spec.md`
21
+ > **开工清单**:`02-workflow/rt-autopilot-readiness.md`
22
+
23
+ 将协作模式的 Gate 3/4/5 替换为机械 Gate;用 `state.json` + `rt-plan.md` 驱动 Ralph 循环直至 DONE。
24
+
25
+ ---
26
+
27
+ ## 1. 前置条件
28
+
29
+ 1. 用户创建 RT 时已**明确确认** `execution_mode: autopilot`(见 `rt-manager.md` §3.2)
30
+ 2. 通过 `autopilot-goal-spec.md` Goal 质量自检与适配度研判(≥4/6 或用户知情坚持)
31
+ 3. 完成 Preflight(`autopilot-preflight.md`)
32
+
33
+ 不满足 → 回退 `spec-lite-profile.md`(`collaborative`)。
34
+
35
+ ---
36
+
37
+ ## 2. RT 必备文件
38
+
39
+ ```
40
+ RT/RT-XXX/
41
+ meta.yaml
42
+ rt-lite.md # Goal(静态)
43
+ rt-plan.md # Plan(每轮更新)
44
+ state.json
45
+ loop-prompt.md
46
+ execution-log.md
47
+ autopilot-preflight.md
48
+ ```
49
+
50
+ ---
51
+
52
+ ## 3. 执行流程(摘要)
53
+
54
+ | 阶段 | 动作 | Gate |
55
+ |------|------|------|
56
+ | 0 | `feature/RT-XXX` 分支 | 强制 |
57
+ | B | 定稿 rt-lite §1-§7;用户确认完成标准摘要 | Goal 自检 |
58
+ | C | Preflight 全勾 | 人工清单 |
59
+ | D | `plan_complete=true` | 机械 Gate-Plan |
60
+ | E | Ralph 循环(读 state → 做 1-2 项 → tests/lint/guard → 写 state/plan/log) | 每轮 Quality Gate |
61
+ | F | commit | 机械 Gate-Commit |
62
+ | G | `status=done` | 机械 Gate-Done |
63
+
64
+ 细节、反模式、子模式、熔断:**见 `autopilot-protocol.md`**。
65
+
66
+ ---
67
+
68
+ ## 4. 机械 Gate 条件(速查)
69
+
70
+ **Gate-Plan**:§1-§4、§7、§5.4 就绪;Goal 自检通过;`plan_complete=true`。
71
+
72
+ **Gate-Commit**:`tests_pass` && `lint_pass` && `guard_pass`。
73
+
74
+ **Gate-Done**:§7 全部验证;checklist 全 true;auditor 无 P0;`phase=done`。
75
+
76
+ ---
77
+
78
+ ## 5. 熔断(交还人工)
79
+
80
+ - 同一文件修改 > 3 次
81
+ - checklist 连续 2 轮无进展 → `phase=blocked`
82
+ - 达到 `max_iterations`(默认 20)
83
+ - 出现 schema/API/多模块架构决策
84
+
85
+ ---
86
+
87
+ ## 6. Red Lines
88
+
89
+ - 🚫 未确认 execution_mode 即创建 RT
90
+ - 🚫 跳过 Goal 自检进入循环
91
+ - 🚫 用主观判断替代 §7 机械验收
92
+ - 🚫 无 `state.json` / `execution-log` 更新进入下一轮
93
+ - 🚫 在 Autopilot 中等待人工 Gate 3/4/5(除非熔断)
94
+
95
+ ---
96
+
97
+ ## 7. 参考
98
+
99
+ - `autopilot-protocol.md` — 总协议
100
+ - `autopilot-goal-spec.md` — 三要素与适配度
101
+ - `spec-lite-profile.md` — 协作模式对照
@@ -205,8 +205,25 @@ git branch --show-current
205
205
  ### 6.2 用户可感知变化
206
206
 
207
207
  ### 6.3 内部重要变化
208
+
209
+ ---
210
+
211
+ ## § 7. 完成条件清单 (Done Checklist)
212
+
213
+ > Autopilot 模式必填;协作模式建议填写,便于验收。
214
+
215
+ | ID | 条件 | 验证方式 | state.json 字段 |
216
+ |----|------|----------|-----------------|
217
+ | C1 | 计划完整 | §1-§4 非空 | `plan_complete` |
218
+ | C2 | 测试通过 | §5.4 tests 命令 exit 0 | `tests_pass` |
219
+ | C3 | lint 通过 | §5.4 lint 命令 exit 0 | `lint_pass` |
220
+ | C4 | 流程痕迹完整 | `aodw-skill guard` 通过 | `guard_pass` |
221
+ | C5 | 文档同步 | §5-§6 已更新 | `docs_synced` |
222
+ | C6 | 审计通过 | development auditor 无 P0 | `auditor_pass` |
208
223
  ```
209
224
 
225
+ > 完整模板见:`.aodw-next/templates/rt-lite.template.md`
226
+
210
227
  ---
211
228
 
212
229
  ## 4. 禁止行为(Red Lines)
@@ -220,7 +237,21 @@ git branch --show-current
220
237
 
221
238
  ---
222
239
 
223
- ## 5. Skill 升级路径
240
+ ## 5. 执行模式选择
241
+
242
+ | 模式 | 适用 | 规则文件 |
243
+ |------|------|----------|
244
+ | **协作模式** | 需要人工 Gate 3/4/5 | 本文件 |
245
+ | **Autopilot** | 可机械验收、低风险、希望 AI 循环推进至 DONE | `spec-lite-autopilot-profile.md` |
246
+
247
+ **创建 RT 时必选**(见 `rt-manager.md` § 3.2):AI 须先获用户明确选择,再写入 `meta.yaml.execution_mode`;未经确认不得继续。
248
+
249
+ - 协作:`execution_mode: collaborative`(`aodw-skill new` 或 AI 代建时由用户选 A)
250
+ - Autopilot:`execution_mode: autopilot`;按 `autopilot-protocol.md` 初始化 `rt-plan.md`、`state.json` 等;开工前完成 `autopilot-goal-spec.md` 自检
251
+
252
+ ---
253
+
254
+ ## 6. Skill 升级路径
224
255
 
225
256
  - **如遇以下情况,立即建议升级至 `aodw-spec-full`**:
226
257
  - 影响数据模型或对外 API
@@ -39,6 +39,34 @@ rules:
39
39
  description: Lightweight workflow for low-risk changes.
40
40
  path: 02-workflow/spec-lite-profile.md
41
41
 
42
+ - id: autopilot-protocol
43
+ name: Autopilot Protocol
44
+ description: Full autonomous RT protocol (Ralph loop, gates, observability, circuit breakers).
45
+ path: 02-workflow/autopilot-protocol.md
46
+ load_when: [autopilot, execution_mode]
47
+ priority: high
48
+
49
+ - id: autopilot-goal-spec
50
+ name: Autopilot Goal Spec
51
+ description: Done criteria standard (Scope + Evidence + Test) and suitability triage.
52
+ path: 02-workflow/autopilot-goal-spec.md
53
+ load_when: [autopilot, goal, checklist]
54
+ priority: high
55
+
56
+ - id: spec-lite-autopilot-profile
57
+ name: Spec-Lite Autopilot Profile
58
+ description: Autonomous Spec-Lite workflow with mechanical gates and state.json loop.
59
+ path: 02-workflow/spec-lite-autopilot-profile.md
60
+ load_when: [autopilot, execution_mode]
61
+ priority: high
62
+
63
+ - id: rt-autopilot-readiness
64
+ name: RT Autopilot Readiness
65
+ description: Pre-flight checklist before starting autonomous RT execution.
66
+ path: 02-workflow/rt-autopilot-readiness.md
67
+ load_when: [autopilot, preflight]
68
+ priority: high
69
+
42
70
  - id: ui-workflow-rules
43
71
  name: UI Workflow Rules
44
72
  description: UI-specific process requirements and gates.
@@ -0,0 +1,27 @@
1
+ # RT Execution Log: RT-XXX
2
+
3
+ > 每轮 Autopilot 迭代追加一条,解决「黑盒执行」问题(对齐 Task Platform iteration 事件)。
4
+
5
+ ## 格式
6
+
7
+ ```markdown
8
+ ## Iteration N — <phase>
9
+ - **time**: ISO8601
10
+ - **focus**: 本轮完成的 plan 步骤
11
+ - **checklist**: C2✓ C3✓ C5○ …
12
+ - **commands**: tests/lint/guard 结果摘要
13
+ - **diff_scope**: 改动文件列表(应与 §2.1 一致)
14
+ - **blockers**: 无 | …
15
+ - **next**: 下轮焦点 1 句
16
+ ```
17
+
18
+ ---
19
+
20
+ ## Iteration 0 — initialized
21
+ - **time**:
22
+ - **focus**: RT scaffold created
23
+ - **checklist**: 全部 false
24
+ - **commands**: —
25
+ - **diff_scope**: —
26
+ - **blockers**: 无
27
+ - **next**: 完成 Goal 定稿与 Preflight
@@ -0,0 +1,36 @@
1
+ # Autopilot Preflight - RT-XXX
2
+
3
+ > 复制本清单到 RT 目录,开工前逐项勾选。全部完成后才开始 Autopilot 循环。
4
+
5
+ ## 1) 项目准备
6
+
7
+ - [ ] `.aodw-next/06-project/ai-overview.md` 已深度初始化
8
+ - [ ] `.aodw-next/06-project/modules-index.yaml` 已深度初始化
9
+ - [ ] tests 命令:`________________`(可执行,exit 0/非0 可解释)
10
+ - [ ] lint 命令:`________________`
11
+ - [ ] guard 命令:`npx aodw-skill guard`
12
+
13
+ ## 2) RT 准备
14
+
15
+ - [ ] `meta.yaml.execution_mode = autopilot`(创建 RT 时用户已确认)
16
+ - [ ] `rt-lite.md` §1-§4、§1.3.1、§7、§5.4 已填写
17
+ - [ ] Goal 质量自检通过(`autopilot-goal-spec.md` §5)
18
+ - [ ] Autopilot 适配度 ≥ 4/6 或用户已知情
19
+ - [ ] §7「用户确认摘要」已勾选
20
+ - [ ] `state.json` + `rt-plan.md` 已初始化且 checklist 对齐
21
+ - [ ] 当前分支:`feature/RT-XXX-________`
22
+
23
+ ## 3) 边界锁定
24
+
25
+ - [ ] §2.1 修改文件清单已列出
26
+ - [ ] §1.3.1「不改什么」≥ 3 项
27
+ - [ ] §4 invariants 已列出
28
+ - [ ] 无范围外改动计划
29
+
30
+ ## 4) 开工许可
31
+
32
+ - [ ] 以上全部勾选
33
+ - [ ] 负责人:________
34
+ - [ ] 时间:________
35
+
36
+ **许可后开始**:按 `loop-prompt.md` 进入第 1 轮迭代。
@@ -0,0 +1,117 @@
1
+ # RT-Lite: RT-XXX - <任务标题>
2
+
3
+ <!-- 元数据行(单行,勿删) -->
4
+ > profile: Spec-Lite | execution_mode: collaborative | status: in-progress | branch: feature/RT-XXX
5
+
6
+ ---
7
+
8
+ ## § 1. 背景与目标 (Context & Goal)
9
+
10
+ ### 1.1 问题描述
11
+ <!-- 当前存在的问题或需求 -->
12
+
13
+ ### 1.2 目标
14
+ <!-- 本次改动希望达成的效果(用户视角) -->
15
+
16
+ ### 1.3 影响范围
17
+ <!-- 涉及的模块/文件 -->
18
+
19
+ ### 1.3.1 不改什么(Autopilot 必填,至少 3 项)
20
+ <!-- 明确排除的文件、功能、行为;防止 scope creep -->
21
+ - [ ] 不修改:
22
+ - [ ] 不添加:
23
+ - [ ] 不改变:
24
+
25
+ ### 1.4 实现前对齐 (Implementation Alignment)
26
+ - **关键假设**:
27
+ - **歧义点与推荐选项**:
28
+ - **最小必要改动**:
29
+ - **可验证成功标准**:
30
+
31
+ ---
32
+
33
+ ## § 2. 方案设计 (Solution & Design)
34
+
35
+ ### 2.1 修改点(checklist,对齐 Goal Spec「改什么」)
36
+ - [ ] `path/to/file` — 具体改什么
37
+ - [ ] `path/to/file` — 具体改什么
38
+
39
+ ### 2.2 方案描述
40
+ <!-- 技术方案简述 -->
41
+
42
+ ### 2.3 风险与注意事项
43
+ <!-- 边界情况、隐含耦合 -->
44
+
45
+ ---
46
+
47
+ ## § 3. 影响分析 (Impact Analysis)
48
+
49
+ ### 3.1 直接影响
50
+
51
+ ### 3.2 间接影响
52
+
53
+ ### 3.3 风险评估
54
+
55
+ ---
56
+
57
+ ## § 4. 不可破坏边界 (Invariants)
58
+
59
+ ### 4.1 业务行为边界
60
+
61
+ ### 4.2 接口边界
62
+
63
+ ### 4.3 技术结构边界
64
+
65
+ ---
66
+
67
+ ## § 5. 验证计划 (Verification Plan)
68
+
69
+ ### 5.1 本次新增测试
70
+ - [ ] 测试用例 1:
71
+
72
+ ### 5.2 回归测试
73
+ - [ ] 回归场景 1:
74
+
75
+ ### 5.3 手动验证步骤
76
+ - [ ] 手动步骤 1:
77
+
78
+ ### 5.4 机械验证命令(Autopilot 必填)
79
+ - tests: `<例如: npm test / pytest>`
80
+ - lint: `<例如: npm run lint / ruff check>`
81
+ - guard: `npx aodw-skill guard --auto-fix --stage-audit`
82
+
83
+ ---
84
+
85
+ ## § 6. 变更记录 (Changelog)
86
+
87
+ ### 6.1 变更摘要
88
+
89
+ ### 6.2 用户可感知变化
90
+
91
+ ### 6.3 内部重要变化
92
+
93
+ ---
94
+
95
+ ## § 7. 完成条件清单 (Done Checklist)
96
+
97
+ > 标准见 `02-workflow/autopilot-goal-spec.md`
98
+ > 每条必须:**Scope(范围)+ Evidence(证据)+ Test(shell 命令,exit 0)**
99
+
100
+ | ID | 条件(Scope + Evidence) | 验证命令(Test) | state.json |
101
+ |----|--------------------------|------------------|------------|
102
+ | C1 | §1-§4、本节、§1.3.1 已填写且可执行 | 人工/AI 字段检查 | `plan_complete` |
103
+ | C2 | 相关测试全部通过 | `§5.4 tests` | `tests_pass` |
104
+ | C3 | lint/type 无错误 | `§5.4 lint` | `lint_pass` |
105
+ | C4 | 提交含 RT 痕迹 | `§5.4 guard` | `guard_pass` |
106
+ | C5 | §5-§6 与实现一致 | diff 与文档对照 | `docs_synced` |
107
+ | C6 | 开发审计无 P0 | development auditor | `auditor_pass` |
108
+
109
+ **Fuse(熔断,任务级)**:
110
+ - `max_iterations`: 20(默认,见 `state.json`)
111
+ - 达上限或连续 2 轮无进展 → `phase=blocked`,交还人工
112
+
113
+ **用户确认摘要**(Autopilot 定稿后填写,创建循环前须用户点头):
114
+ - 完成标准摘要:(AI 用 3–5 条自然语言列出,对应上表)
115
+ - 用户确认:是 / 否 / 日期
116
+
117
+ **反例(禁止)**:~~功能做完~~、~~代码改好~~、~~差不多通过~~
@@ -0,0 +1,45 @@
1
+ 你正在以 **AODW Autopilot** 模式自主推进 RT:{RT_ID}(第 **{ITERATION}** / **{MAX_ITERATIONS}** 次迭代)。
2
+
3
+ ## 任务目标
4
+ {GOAL_SUMMARY}
5
+
6
+ ## 完成条件(机械验收,rt-lite.md §7)
7
+ {CHECKLIST_ITEMS}
8
+
9
+ ## 当前进度
10
+
11
+ ### state.json
12
+ ```json
13
+ {STATE_JSON}
14
+ ```
15
+
16
+ ### rt-plan.md(只处理未完成步骤)
17
+ > 开工前读取 `RT/{RT_ID}/rt-plan.md`,本轮完成后更新勾选与「当前焦点」。
18
+
19
+ ## 本轮规则(Ralph Loop)
20
+
21
+ 1. **续接而非重做**:`state.json` 与 `rt-plan.md` 中已 true/已勾选的项不要重复
22
+ 2. **小步前进**:本轮只完成 1–2 个未完成 plan 步骤,并推进对应 §7 条件
23
+ 3. **验证驱动(Backpressure)**:每项改动后立即运行 §5.4 对应命令(tests → lint → guard)
24
+ 4. **如实写状态**:更新 `state.json`、`rt-plan.md`、`execution-log.md`;决策写入 `decisions`
25
+ 5. **范围锁定**:不修改 rt-lite §1.3「不改什么」所列路径;不引入 §2 范围外功能
26
+
27
+ ## 反模式(出现则换方案或 blocked)
28
+
29
+ | 信号 | 处理 |
30
+ |------|------|
31
+ | 同一文件第 4 次修改 | 换实现,记入 decisions |
32
+ | 同一测试连续 2 轮失败 | 重读代码与 §1,写入 blockers |
33
+ | checklist 与上轮完全相同 | `stall_count++`;≥2 则 `phase=blocked` 并说明原因 |
34
+
35
+ ## 机械 Gate
36
+
37
+ - **Plan**:`plan_complete` ← §1-§4、§7、§5.4 就绪
38
+ - **Commit**:tests + lint + guard 全 pass
39
+ - **Done**:checklist 全 true + auditor 无 P0
40
+
41
+ ## 本轮结束
42
+
43
+ 1. 更新上述文件
44
+ 2. 若全部完成: `phase=done`,`meta.yaml.status=done`,输出 **`DONE`**
45
+ 3. 否则输出 **`CONTINUE`** 与 1 句下轮焦点
@@ -12,6 +12,12 @@ type: Bug
12
12
  # 可选值:Spec-Full | Spec-Lite
13
13
  profile: Spec-Lite
14
14
 
15
+ # 执行模式(Spec-Lite 专用)— 创建 RT 时由用户明确确认,禁止 AI 静默默认
16
+ # collaborative: 人工 Gate 3/4/5
17
+ # autopilot: 机械 Gate + state.json 循环推进
18
+ # 未确认前不得创建本 RT;见 rt-manager.md § 3.2
19
+ execution_mode: <user-confirmed: collaborative | autopilot>
20
+
15
21
  # 当前状态
16
22
  # 可选值:created | intaking | decided | in-progress | reviewing | done
17
23
  status: created
@@ -0,0 +1,35 @@
1
+ # Plan: {RT_ID} — <任务标题>
2
+
3
+ > 动态实现计划(对应 Ralph 的 IMPLEMENTATION_PLAN)。每轮迭代更新;AI 只处理未完成项。
4
+
5
+ ## 进度
6
+
7
+ - [ ] 步骤 1 — (从 rt-lite §2 拆解)
8
+ - [ ] 步骤 2 —
9
+ - [ ] 步骤 3 —
10
+
11
+ ## 当前焦点
12
+
13
+ - 本轮目标:(1-2 个步骤)
14
+ - 对应 §7 条件:C?
15
+
16
+ ## 阻塞(blockers)
17
+
18
+ - (无则留空)
19
+
20
+ ## 决策(decisions)
21
+
22
+ - (技术选型及理由,避免下轮重复讨论)
23
+
24
+ ## 完成判定(与 state.json 双条件)
25
+
26
+ 仅当 **同时** 满足才可输出 `DONE`:
27
+
28
+ 1. 本节「进度」全部 `[x]`
29
+ 2. `state.json.checklist` 全 `true`,且 §5.4 tests/lint/guard 已通过
30
+
31
+ ## 迭代记录
32
+
33
+ | 轮次 | 完成步骤 | 验证结果 | 备注 |
34
+ |------|----------|----------|------|
35
+ | 0 | scaffold | — | RT 创建 |
@@ -0,0 +1,26 @@
1
+ {
2
+ "rt": "RT-XXX",
3
+ "execution_mode": "autopilot",
4
+ "execution_submode": "ralph-loop",
5
+ "phase": "initialized",
6
+ "iteration": 0,
7
+ "max_iterations": 20,
8
+ "stall_count": 0,
9
+ "goal": "见 rt-lite.md §7 完成条件清单",
10
+ "checklist": {
11
+ "plan_complete": false,
12
+ "tests_pass": false,
13
+ "lint_pass": false,
14
+ "guard_pass": false,
15
+ "docs_synced": false,
16
+ "auditor_pass": false
17
+ },
18
+ "signals": {
19
+ "same_file_edits": {},
20
+ "last_checklist_snapshot": null
21
+ },
22
+ "blockers": [],
23
+ "decisions": [],
24
+ "started_at": "<ISO8601>",
25
+ "updated_at": "<ISO8601>"
26
+ }
package/bin/aodw.js CHANGED
@@ -703,6 +703,7 @@ program
703
703
  .description('Create a new Request Ticket (RT)')
704
704
  .option('--project <name>', 'Project identifier')
705
705
  .option('--title <string>', 'Title of the RT')
706
+ .option('--execution-mode <mode>', 'Execution mode: collaborative | autopilot (skips interactive prompt)')
706
707
  .action(createNewRT);
707
708
 
708
709
  program
@@ -1,9 +1,30 @@
1
1
  import fs from 'fs-extra';
2
2
  import path from 'path';
3
+ import { fileURLToPath } from 'url';
3
4
  import inquirer from 'inquirer';
4
5
  import chalk from 'chalk';
5
6
  import { getProjectConfig } from '../utils/config.js';
6
7
 
8
+ const CORE_DIR = process.env.AODW_CORE_DIR || '.aodw-next';
9
+
10
+ function getTemplatePath(name) {
11
+ const local = path.join(process.cwd(), CORE_DIR, 'templates', name);
12
+ if (fs.existsSync(local)) return local;
13
+ const pkg = path.join(path.dirname(fileURLToPath(import.meta.url)), '../../.aodw-next/templates', name);
14
+ if (fs.existsSync(pkg)) return pkg;
15
+ return null;
16
+ }
17
+
18
+ function loadTemplate(name, replacements = {}) {
19
+ const templatePath = getTemplatePath(name);
20
+ if (!templatePath) return null;
21
+ let content = fs.readFileSync(templatePath, 'utf8');
22
+ for (const [key, value] of Object.entries(replacements)) {
23
+ content = content.split(key).join(value);
24
+ }
25
+ return content;
26
+ }
27
+
7
28
  function getProjectName() {
8
29
  // 1. Try .aodw/project.yaml
9
30
  const projectConfig = getProjectConfig();
@@ -45,6 +66,40 @@ function getLocalNextId() {
45
66
  return `RT-${String(maxSeq + 1).padStart(3, '0')}`;
46
67
  }
47
68
 
69
+ const EXECUTION_MODES = ['collaborative', 'autopilot'];
70
+
71
+ async function resolveExecutionMode(options) {
72
+ if (options.executionMode) {
73
+ const mode = String(options.executionMode).toLowerCase();
74
+ if (!EXECUTION_MODES.includes(mode)) {
75
+ console.error(chalk.red(`错误: execution_mode 必须是 ${EXECUTION_MODES.join(' 或 ')}`));
76
+ process.exit(1);
77
+ }
78
+ console.log(chalk.cyan(`执行模式(命令行指定): ${mode}`));
79
+ return mode;
80
+ }
81
+
82
+ console.log(chalk.yellow('\n⚠️ 创建 RT 前必须确认执行模式,未选择将无法继续。\n'));
83
+
84
+ const { executionMode } = await inquirer.prompt([{
85
+ type: 'list',
86
+ name: 'executionMode',
87
+ message: '请选择本 RT 的执行模式(必选):',
88
+ choices: [
89
+ {
90
+ name: '人工干预模式(协作)— Gate 3/4/5 需用户确认后再推进',
91
+ value: 'collaborative',
92
+ },
93
+ {
94
+ name: '全自动模式(Autopilot)— 机械验收 + 循环推进,仅熔断时请求人工',
95
+ value: 'autopilot',
96
+ },
97
+ ],
98
+ }]);
99
+
100
+ return executionMode;
101
+ }
102
+
48
103
  export async function createNewRT(options) {
49
104
  // Determine Project Name: Flag > Config/Package/Dir
50
105
  const project = options.project || getProjectName();
@@ -61,6 +116,8 @@ export async function createNewRT(options) {
61
116
  title = answers.title;
62
117
  }
63
118
 
119
+ const executionMode = await resolveExecutionMode(options);
120
+
64
121
  // 固定独立模式:始终本地生成 RT-ID
65
122
  const id = getLocalNextId();
66
123
  console.log(chalk.yellow(`Using local ID generation: ${id}`));
@@ -79,6 +136,7 @@ export async function createNewRT(options) {
79
136
  title: "${title}"
80
137
  type: Feature # Default, update after intake
81
138
  profile: Spec-Lite # Default, update after decision
139
+ execution_mode: ${executionMode} # 用户创建时已确认: collaborative | autopilot
82
140
  status: created
83
141
  created_at: "${now}"
84
142
  updated_at: "${now}"
@@ -102,9 +160,16 @@ modules: []
102
160
  `;
103
161
  fs.writeFileSync(path.join(rtPath, 'intake.md'), intakeContent);
104
162
 
163
+ const modeLabel = executionMode === 'autopilot' ? '全自动(Autopilot)' : '人工干预(协作)';
164
+
105
165
  // Create decision.md
106
166
  const decisionContent = `# Decision: ${id}
107
167
 
168
+ ## Execution Mode(用户已确认,创建时必选)
169
+ - [x] ${executionMode} — ${modeLabel}
170
+ - 确认时间: ${now}
171
+ - 说明: 创建 RT 时由用户明确选择;未经确认不得修改 execution_mode
172
+
108
173
  ## Profile Selection
109
174
  - [ ] Spec-Lite (Recommended for most tasks)
110
175
  - [ ] Spec-Full (For complex/risky tasks)
@@ -114,6 +179,56 @@ modules: []
114
179
  `;
115
180
  fs.writeFileSync(path.join(rtPath, 'decision.md'), decisionContent);
116
181
 
182
+ const replacements = {
183
+ 'RT-XXX': id,
184
+ '<任务标题>': title,
185
+ '<ISO8601>': now,
186
+ 'feature/RT-XXX': `feature/${id}`,
187
+ '{RT_ID}': id,
188
+ };
189
+
190
+ let rtLite = loadTemplate('rt-lite.template.md', replacements);
191
+ if (rtLite) {
192
+ rtLite = rtLite.replace('execution_mode: collaborative', `execution_mode: ${executionMode}`);
193
+ fs.writeFileSync(path.join(rtPath, 'rt-lite.md'), rtLite);
194
+ }
195
+
196
+ if (executionMode === 'autopilot') {
197
+ const rtPlan = loadTemplate('rt-plan.template.md', replacements);
198
+ if (rtPlan) fs.writeFileSync(path.join(rtPath, 'rt-plan.md'), rtPlan);
199
+
200
+ let stateJson = loadTemplate('rt-state.template.json', replacements);
201
+ if (stateJson) {
202
+ stateJson = stateJson.replace('"execution_mode": "autopilot"', `"execution_mode": "${executionMode}"`);
203
+ fs.writeFileSync(path.join(rtPath, 'state.json'), stateJson);
204
+ }
205
+
206
+ const loopPrompt = loadTemplate('rt-loop-prompt.template.md', {
207
+ ...replacements,
208
+ '{ITERATION}': '1',
209
+ '{MAX_ITERATIONS}': '20',
210
+ '{GOAL_SUMMARY}': title,
211
+ '{CHECKLIST_ITEMS}': '见 rt-lite.md §7',
212
+ '{STATE_JSON}': stateJson || '{}',
213
+ });
214
+ if (loopPrompt) fs.writeFileSync(path.join(rtPath, 'loop-prompt.md'), loopPrompt);
215
+
216
+ const executionLog = loadTemplate('execution-log.template.md', replacements);
217
+ if (executionLog) {
218
+ const logWithTime = executionLog.replace('**time**: \n', `**time**: ${now}\n`);
219
+ fs.writeFileSync(path.join(rtPath, 'execution-log.md'), logWithTime);
220
+ }
221
+
222
+ const preflight = loadTemplate('rt-autopilot-preflight.template.md', replacements);
223
+ if (preflight) fs.writeFileSync(path.join(rtPath, 'autopilot-preflight.md'), preflight);
224
+ }
225
+
117
226
  console.log(chalk.green(`\n✔ Created RT ${id} at ./RT/${id}`));
118
- console.log(chalk.white(`Next step: Open ./RT/${id}/intake.md and start the intake process.`));
227
+ console.log(chalk.white(`执行模式: ${executionMode}(${modeLabel})`));
228
+ console.log(chalk.white('Next step: Open ./RT/' + id + '/intake.md and complete intake/decision.'));
229
+ if (executionMode === 'autopilot') {
230
+ console.log(chalk.cyan('Autopilot: 定稿 rt-lite §7 → Goal 自检 → preflight → 见 .aodw-next/02-workflow/autopilot-protocol.md'));
231
+ } else {
232
+ console.log(chalk.cyan('协作模式: 按 spec-lite-profile.md,Gate 3/4/5 需用户确认'));
233
+ }
119
234
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "aodw-skill",
3
- "version": "0.7.26",
3
+ "version": "0.7.27",
4
4
  "description": "Next-channel CLI tool to scaffold AODW in your project",
5
5
  "main": "bin/aodw.js",
6
6
  "files": [