@jun133/athlete 0.0.3 → 0.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (34) hide show
  1. package/README.md +17 -12
  2. package/dist/cli.js +7475 -4084
  3. package/dist/cli.js.map +1 -1
  4. package/package.json +4 -1
  5. package/scripts/postinstall-playwright.mjs +10 -10
  6. package/spec/architecture//346/200/273/344/275/223/346/236/266/346/236/204.md +25 -21
  7. package/spec/architecture//347/212/266/346/200/201/344/270/216/347/234/237/347/233/270/346/272/220.md +20 -17
  8. package/spec/architecture//350/277/220/350/241/214/346/227/266/345/276/252/347/216/257.md +105 -48
  9. package/spec/implementation//347/233/256/345/275/225/347/273/223/346/236/204/345/210/260/344/273/243/347/240/201/346/226/207/344/273/266/346/230/240/345/260/204/350/241/250.md +141 -66
  10. package/spec/interfaces/InteractionShell.md +15 -7
  11. package/spec/modules/config-system.md +45 -19
  12. package/spec/modules/interactive-terminal.md +49 -22
  13. package/spec/modules/lightweight-context-runtime.md +34 -17
  14. package/spec/modules/provider-adapter.md +45 -20
  15. package/spec/modules/runtime-metrics.md +54 -24
  16. package/spec/modules/runtime-rules.md +52 -20
  17. package/spec/modules/session-resume-compact.md +20 -14
  18. package/spec/modules/task-state.md +25 -18
  19. package/spec/modules/telegram-private-chat.md +2 -1
  20. package/spec/modules/tool-registry.md +93 -35
  21. package/spec/modules//346/211/251/345/261/225/346/234/272/345/210/266.md +65 -29
  22. package/spec/overview/v0/350/214/203/345/233/264.md +7 -6
  23. package/spec/overview//344/272/247/345/223/201/345/256/232/344/271/211.md +14 -12
  24. package/spec/principles/P06-/344/270/212/344/270/213/346/226/207/350/246/201/350/203/275/345/216/213/347/274/251.md +5 -5
  25. package/spec/principles/P13-session/346/230/257/344/273/273/345/212/241/347/216/260/345/234/272.md +5 -5
  26. package/spec/principles/P15-provider/345/277/205/351/241/273/345/217/257/346/233/277/346/215/242.md +12 -10
  27. package/spec/principles/P18-/344/270/273/345/276/252/347/216/257/345/222/214/346/226/207/344/273/266/351/203/275/344/270/215/350/203/275/351/225/277/350/203/226.md +37 -36
  28. package/spec/principles/P20-/345/244/226/351/203/250/344/272/213/345/256/236/345/277/205/351/241/273/347/273/221/345/256/232/350/257/201/346/215/256.md +48 -0
  29. package/spec/principles/P21-/346/262/241/351/252/214/350/277/207/345/260/261/344/270/215/350/203/275/346/224/266/345/217/243.md +46 -0
  30. package/spec/principles/P22-/351/230/266/346/256/265/346/216/250/350/277/233/345/277/205/351/241/273/346/234/211/346/234/272/345/231/250/347/212/266/346/200/201.md +40 -0
  31. package/spec/principles/P23-/346/226/207/346/234/254/351/223/276/350/267/257/345/277/205/351/241/273/347/250/263/345/256/232/345/217/257/350/257/273.md +38 -0
  32. package/spec/principles/P24-/351/224/231/350/257/257/345/205/274/345/256/271/344/270/215/350/203/275/351/253/230/344/272/216/346/255/243/347/241/256/346/200/247.md +37 -0
  33. package/spec/principles/README.md +47 -39
  34. package/spec/testing//346/265/213/350/257/225/347/255/226/347/225/245.md +27 -16
@@ -4,12 +4,12 @@
4
4
 
5
5
  配置系统负责统一读取 Athlete 的运行参数,并把项目级默认值、用户配置和环境变量合并成最终 runtime config。
6
6
 
7
- ## 当前范围
8
-
9
- - API key / base URL / model
10
- - mode
11
- - paths
12
- - MCP 总开关与 server 配置
7
+ ## 当前范围
8
+
9
+ - provider / API key / base URL / model
10
+ - mode
11
+ - paths
12
+ - MCP 总开关与 server 配置
13
13
  - Playwright MCP repo 级默认值
14
14
  - context / continuation / read limits 等运行阈值
15
15
 
@@ -18,9 +18,21 @@
18
18
  1. 配置入口统一。
19
19
  2. 业务模块不直接散读环境变量。
20
20
  3. 用户能从 runtime config 理解当前行为从哪来。
21
- 4. 项目级默认值允许放在 `.athlete/.env`,但仍由统一配置入口解析。
22
-
23
- ## Playwright MCP 当前事实
21
+ 4. 项目级默认值允许放在 `.athlete/.env`,但仍由统一配置入口解析。
22
+
23
+ ## provider 当前事实
24
+
25
+ 当前统一入口会解析:
26
+
27
+ - `ATHLETE_PROVIDER`
28
+ - `ATHLETE_API_KEY`
29
+ - `ATHLETE_BASE_URL`
30
+ - `ATHLETE_MODEL`
31
+
32
+ 代码默认值与模板示例仍以 DeepSeek 系列为起点,但这只是默认配置/示例,不是 runtime kernel 绑定。
33
+ 项目本地 `.athlete/.env` 可以把有效 provider / base URL / model 覆盖到别的 OpenAI-compatible 服务。
34
+
35
+ ## Playwright MCP 当前事实
24
36
 
25
37
  当前支持的 repo 级 Playwright MCP 环境变量:
26
38
 
@@ -31,15 +43,20 @@
31
43
  - `ATHLETE_MCP_PLAYWRIGHT_OUTPUT_MODE`
32
44
  - `ATHLETE_MCP_PLAYWRIGHT_SAVE_SESSION`
33
45
 
34
- 当前仓库默认行为:
35
-
36
- - Playwright MCP 在项目级 `.athlete/.env` 中默认启用
37
- - 默认浏览器为 `chrome`
38
- - 默认不是 headless
39
- - 默认 output mode 为 `file`
40
- - 默认 save session 为开启
41
-
42
- ## 路径约定
46
+ 当前代码默认值:
47
+
48
+ - 代码默认值是关闭
49
+ - 默认浏览器为 `chromium`
50
+ - 默认不是 headless
51
+ - 默认 output mode 为 `stdout`
52
+ - 默认 save session 为开启
53
+
54
+ 当前项目模板行为:
55
+
56
+ - `src/config/init.ts` 生成的 `.athlete/.env` / `.athlete/.env.example` 会给出一组 repo 级 Playwright MCP 示例开关
57
+ - 项目本地真实 `.athlete/.env` 可以进一步覆盖这些有效值
58
+
59
+ ## 路径约定
43
60
 
44
61
  当前 Playwright MCP 状态目录:
45
62
 
@@ -48,4 +65,13 @@
48
65
  - `.athlete/playwright-mcp/output/`
49
66
  - `.athlete/playwright-mcp/legacy-root-artifacts/`
50
67
 
51
- 这些路径由配置系统和 `src/mcp/playwright/` 统一导出,不允许在调用侧随意拼接。
68
+ 这些路径由配置系统和 `src/mcp/playwright/` 统一导出,不允许在调用侧随意拼接。
69
+
70
+ ## 当前代码落点
71
+
72
+ - `src/config/store.ts`
73
+ - runtime config 合并入口
74
+ - `src/config/init.ts`
75
+ - `.athlete/.env` / `.athlete/.env.example` 模板
76
+ - `src/agent/provider.ts`
77
+ - provider capability profile 消费 config 中的 provider/model
@@ -12,14 +12,15 @@
12
12
  - `src/shell/cli/`: CLI shell 适配层
13
13
  - `src/ui/`: CLI 文本格式化、runtime summary 和兼容导出
14
14
 
15
- ### 共享交互控制层职责
16
-
17
- - 驱动交互 session loop
18
- - 处理普通输入和 multiline 分支
19
- - 处理本地命令路由
20
- - 管理 turn in-flight 状态与 abort controller 生命周期
21
- - 接线 `runManagedAgentTurn`
22
- - 维护当前 session 的内存态,并在 turn 完成后接收最新 session
15
+ ### 共享交互控制层职责
16
+
17
+ - 驱动交互 session loop
18
+ - 处理普通输入和 multiline 分支
19
+ - 处理本地命令路由
20
+ - `quit / q / exit` 时检查当前项目仍在运行的后台进程,并做退出确认
21
+ - 管理 turn in-flight 状态与 abort controller 生命周期
22
+ - 接线 `runManagedAgentTurn`
23
+ - 维护当前 session 的内存态,并在 turn 完成后接收最新 session
23
24
 
24
25
  ### 当前 CLI shell 职责
25
26
 
@@ -38,7 +39,26 @@
38
39
  4. `/runtime`、`/stats`、`/仪表盘` 只是 `SessionRecord.runtimeStats` 的只读 summary 视图。
39
40
  5. UI 可以读取并展示真相源,但不能绕过真相源另造状态。
40
41
  6. 交互 session loop 不能直接绑死 `readline`、`process.stdin/stdout`、`chalk` 这类 CLI 细节。
41
- 7. shell 只能提供输入、输出和 turn 展示适配,不能自己发明 task / protocol / runtime 真相。
42
+ 7. shell 只能提供输入、输出和 turn 展示适配,不能自己发明 task / protocol / runtime 真相。
43
+
44
+ ## Quit Boundary
45
+
46
+ - `quit / q / exit` 不是“无条件立刻退出”。
47
+ - 共享交互层会先检查当前项目仍在运行的后台进程:
48
+ - `background job`
49
+ - `teammate worker`
50
+ - 如果没有运行中的后台进程:
51
+ - 直接退出会话
52
+ - 如果有运行中的后台进程:
53
+ - 先把它们列出来
54
+ - 只允许两个结果:
55
+ - 确认退出:杀掉全部后台进程,再退出
56
+ - 取消退出:保持当前 CLI 和后台进程继续运行
57
+ - kill 失败时必须 fail-closed:
58
+ - 不退出
59
+ - 明确告诉用户哪些 PID 还活着
60
+
61
+ 这个规则属于共享交互控制层,不属于单个 shell 外壳。
42
62
  ## 当前本地命令入口
43
63
 
44
64
  - `/session`
@@ -85,25 +105,32 @@
85
105
  - `ShellOutputPort`: info / warn / plain / dim / interrupt 等展示输出
86
106
  - `InteractionTurnDisplay`: turn 期间的流式展示适配
87
107
 
88
- ### 当前 CLI 接线
89
-
90
- - `src/ui/interactive.ts`: CLI 入口薄壳,只负责组装 shell、打印 intro、启动 driver
91
- - `src/shell/cli/readlineInput.ts`: CLI 输入适配
92
- - `src/shell/cli/output.ts`: `chalk` + stdio 输出适配
93
- - `src/shell/cli/turnDisplay.ts`: spinner + stream renderer 适配
94
- - `src/interaction/localCommands.ts`: 共享本地命令语义
108
+ ### 当前 CLI 接线
109
+
110
+ - `src/ui/interactive.ts`: CLI 入口薄壳,只负责组装 shell、打印 intro、启动 driver
111
+ - `src/shell/cli/readlineInput.ts`: CLI 输入适配
112
+ - `src/shell/cli/output.ts`: `chalk` + stdio 输出适配
113
+ - `src/shell/cli/turnDisplay.ts`: spinner + stream renderer 适配
114
+ - `src/interaction/localCommands.ts`: 共享本地命令语义
115
+ - `src/interaction/exitGuard.ts`: 退出前后台进程检查与 kill-or-continue 语义
95
116
 
96
117
  ## 当前展示边界
97
118
 
98
- 交互终端当前只负责把这些状态展示清楚:
99
-
100
- - task board
101
- - teammate 状态
102
- - background 状态
119
+ 交互终端当前只负责把这些状态展示清楚:
120
+
121
+ - task board
122
+ - teammate 状态
123
+ - background 状态
103
124
  - skill load 状态
104
125
  - runtime summary
105
126
 
106
- 但它不负责发明这些状态。
127
+ 但它不负责发明这些状态。
128
+
129
+ 交互终端当前还负责把退出确认展示清楚:
130
+
131
+ - 哪些后台进程仍在运行
132
+ - 用户当前是在“继续运行”还是“kill 后退出”的分支
133
+ - kill 失败时哪些 PID 仍未退出
107
134
 
108
135
  ## 未来方向
109
136
 
@@ -4,14 +4,29 @@
4
4
 
5
5
  这一层负责让 Athlete 在长任务里继续跑,但不要把 prompt 和 session 越跑越重。
6
6
 
7
- ## 运行时约定
8
-
9
- 1. system prompt 按两层正式组装:
10
- - `Static operating layer`
11
- - `Dynamic runtime layer`
12
- 2. 静态层放稳定规则、模式规则、身份规则、项目说明。
13
- 3. 动态层放 cwd / root / date / taskState / todo / verification / task board / team / worktree / protocol / background / skill runtime。
14
- 4. 压缩后的会话总结不再直接拼回静态层,而是追加为 `Compressed conversation memory`。
7
+ ## 运行时约定
8
+
9
+ 1. system prompt 按两层正式组装:
10
+ - `Static operating layer`
11
+ - `Dynamic runtime layer`
12
+ 2. 静态层只放高层 operating contract:
13
+ - identity / role contract
14
+ - work loop contract
15
+ - tool-use contract
16
+ - communication / output contract
17
+ - external content boundary
18
+ - project instructions
19
+ 3. 动态层放 cwd / root / date / taskState / todo / verification / checkpoint / task board / team / worktree / protocol / background / skill runtime 的紧凑摘要。
20
+ 4. 动态层应省略空状态和低价值 `No ...` 噪音,但要保留 checkpoint、verification pending paths、externalized tool refs 这些恢复锚点。
21
+ 5. 压缩后的会话总结不再直接拼回静态层,而是追加为 `Compressed conversation memory`。
22
+ 6. request context 构建可以派生 prompt diagnostics,用于诊断但不落盘:
23
+ - static / dynamic / memory chars
24
+ - static / dynamic / memory block counts
25
+ - block hotspot
26
+ - total prompt chars
27
+ - initial / final estimated request chars
28
+ - 当前这次 compression 是否由 prompt 膨胀触发
29
+ 这些都只是派生观测,不是新的持久化真相源。
15
30
 
16
31
  ## 大 tool result 外置化
17
32
 
@@ -31,10 +46,11 @@
31
46
  ## 闭环要求
32
47
 
33
48
  1. continuation 继续使用 session 中的轻量 tool message,而不是重新塞回原始大正文。
34
- 2. contextBuilder 在压缩历史时继续保留 `storagePath` 和预览信息。
35
- 3. recovery context shrink 也要保住结构化引用,不能把它打回不可追踪的大字符串。
36
- 4. session 保存和加载后,外置化引用仍然可以恢复到落盘文件。
37
- 5. 已通过 streaming delta 发出的 assistant 文本不会在 finalize 阶段再次整段重放。
49
+ 2. contextBuilder 在压缩历史时继续保留 `storagePath` 和预览信息。
50
+ 3. contextBuilder 产出的 prompt diagnostics 必须只存在于当次 request 构建结果里,不能写回 session。
51
+ 4. recovery 的 context shrink 也要保住结构化引用,不能把它打回不可追踪的大字符串。
52
+ 5. session 保存和加载后,外置化引用仍然可以恢复到落盘文件。
53
+ 6. 已通过 streaming delta 发出的 assistant 文本不会在 finalize 阶段再次整段重放。
38
54
 
39
55
  ## 验证方式
40
56
 
@@ -56,8 +72,9 @@
56
72
  - recentToolBatch
57
73
  - flow phase (`active / continuation / resume / recovery`)
58
74
  - priorityArtifacts (externalized tool-result refs, previews, pending paths)
59
- - continuation, reload/resume, and dynamic prompt rendering must all consume the same checkpoint instead of inventing separate recovery hints.
60
- - objective changes reset checkpoint progress so old work does not pollute the new task.
61
- - externalized tool results remain the preferred recoverable context, and checkpoint keeps the references lightweight.
62
- - fail-first test for this layer: `tests/runtime-checkpoint-resume.test.ts`
63
- - real API verification entry for this layer: `npm run verify:runtime-checkpoint-api`
75
+ - continuation, reload/resume, and dynamic prompt rendering must all consume the same checkpoint instead of inventing separate recovery hints.
76
+ - objective changes reset checkpoint progress so old work does not pollute the new task.
77
+ - externalized tool results remain the preferred recoverable context, and checkpoint keeps the references lightweight.
78
+ - verification 文案必须与 runtime 能力一致:targeted verification、lightweight readback、auto-readback 都是合法路径,不把所有改动都描述成必须全量 build/test
79
+ - fail-first test for this layer: `tests/runtime-checkpoint-resume.test.ts`
80
+ - real API verification entry for this layer: `npm run verify:runtime-checkpoint-api`
@@ -1,20 +1,45 @@
1
- # provider adapter
2
-
3
- ## 作用
4
-
5
- provider adapter 负责把 Athlete 的请求发送到具体模型服务。
6
-
7
- ## 当前策略
8
-
9
- - 优先 OpenAI-compatible
10
- - 运行时对网络错误、超时、上下文过长有恢复策略
11
-
12
- ## 规则
13
-
14
- 1. provider 能换,主循环不跟着重写。
15
- 2. provider 问题先在 adapter 层处理,不外溢到任务语义层。
16
- 3. 模型 fallback 属于运行时策略,不属于业务模块。
17
-
18
- ## 下一阶段要求
19
-
20
- 总指挥层不依赖某一家 provider 特性。
1
+ # provider adapter
2
+
3
+ ## 作用
4
+
5
+ provider adapter 负责把 Athlete 的请求发送到具体模型服务,并把 provider-specific 能力差异收敛成稳定的 capability profile。
6
+
7
+ ## 当前策略
8
+
9
+ - 优先 OpenAI-compatible
10
+ - provider-specific fallback、reasoning 能力、request body 差异、recovery model 选择都下沉到 provider 层
11
+ - 运行时对网络错误、超时、上下文过长仍有恢复策略,但主循环只消费 provider capability,不再写死某家模型名
12
+
13
+ ## 规则
14
+
15
+ 1. provider 能换,主循环不跟着重写。
16
+ 2. provider 问题先在 adapter 层处理,不外溢到任务语义层。
17
+ 3. 模型 fallback 属于运行时策略,不属于业务模块。
18
+ 4. kernel 可以知道“当前 request model 是什么”,但不应该知道“某个具体 provider 为什么要这样切”。
19
+ 5. reasoning request body、tool 兼容 fallback、failure streak recovery model 都属于 provider capability。
20
+
21
+ ## 当前实现落点
22
+
23
+ - `src/agent/provider.ts`
24
+ - `resolveProviderCapabilities()`
25
+ - `buildProviderRequestBody()`
26
+ - `selectProviderRequestModel()`
27
+ - `src/agent/api.ts`
28
+ - 只消费 provider capability,不再直接判断 `deepseek-reasoner -> deepseek-chat`
29
+ - `src/agent/retryPolicy.ts`
30
+ - 通过 provider 层选择 recovery request model
31
+ - `src/agent/session/messages.ts`
32
+ - reasoning content 是否参与请求,也通过 provider capability 决定
33
+ - `src/config/store.ts`
34
+ - 统一解析 `provider / baseUrl / model`
35
+
36
+ ## 当前状态说明
37
+
38
+ - 代码默认配置与模板示例仍以 DeepSeek 系列为起点
39
+ - 项目本地 `.athlete/.env` 可以把有效 provider / base URL / model 覆盖到其他 OpenAI-compatible 服务
40
+ - 但 DeepSeek-specific 行为已经不在 kernel 主干里硬编码
41
+ - adapter 层允许出现具体 provider 名词;主循环和业务规则层不允许依赖这些名字
42
+
43
+ ## 下一阶段要求
44
+
45
+ 总指挥层、closeout、workflow guard、acceptance gate 都不依赖某一家 provider 特性。
@@ -1,9 +1,11 @@
1
1
  # runtime metrics
2
2
 
3
- ## 作用
4
-
5
- 这一层开始,Athlete 的 session 会持久化结构化 `runtimeStats`,
6
- 作为正式运行态仪表盘的真相源。
3
+ ## 作用
4
+
5
+ 这一层开始,Athlete 的 session 会持久化结构化 `runtimeStats`,
6
+ 作为正式运行态仪表盘的真相源。
7
+
8
+ prompt layer metrics / context diagnostics 不属于这里的持久化真相源;它们只是在 request 构建阶段即时派生,用于诊断 prompt 体积、分层占比、hotspot 与压缩触发原因。
7
9
 
8
10
  它回答的是:
9
11
 
@@ -58,22 +60,22 @@
58
60
  - 统计粒度:真实 runtime tool execution
59
61
  - `tools.byName` 记录每个 tool 的调用次数、累计耗时、成功次数、失败次数
60
62
 
61
- ### yield / continuation / recovery
62
-
63
- - 来源:`src/agent/turnPersistence.ts`
64
- - continuation 包括:
65
- - managed continuation 的内部续跑输入
66
- - 用户显式 `continue` / `resume` 这类恢复输入
63
+ ### yield / continuation / recovery
64
+
65
+ - 来源:`src/agent/turn/persistence.ts`
66
+ - continuation 包括:
67
+ - managed continuation 的内部续跑输入
68
+ - 用户显式 `continue` / `resume` 这类恢复输入
67
69
 
68
70
  ### compression
69
71
 
70
72
  - 来源:`src/agent/runTurn.ts`
71
73
  - 当 `buildRequestContext(...)` 返回 `compressed = true` 时记一次
72
74
 
73
- ### externalized tool results
74
-
75
- - 来源:`src/agent/runTurn.ts` + `src/agent/toolResultStorage.ts`
76
- - 只在 tool result 实际被 externalize 时累计
75
+ ### externalized tool results
76
+
77
+ - 来源:`src/agent/runTurn.ts` + `src/agent/toolResults/storage.ts`
78
+ - 只在 tool result 实际被 externalize 时累计
77
79
 
78
80
  ## 用户入口
79
81
 
@@ -83,21 +85,49 @@
83
85
  - `/stats`
84
86
  - `/仪表盘`
85
87
 
86
- 这些命令只读取并格式化当前 session summary,
87
- 不发明新的运行态事实。
88
-
89
- ## 当前 summary 最少包含
88
+ 这些命令读取既有 session 真相源,并在命令执行当下即时派生 prompt diagnostics。
89
+ 它们可以解释 runtime,但不会把这些诊断结果反写成新的 session 真相。
90
90
 
91
- - model request 次数
92
- - model wait 总耗时
91
+ ## 当前 summary 最少包含
92
+
93
+ - model request 次数
94
+ - model wait 总耗时
93
95
  - tool call 次数
94
96
  - tool 总耗时
95
97
  - yields / continuations / recoveries / compressions
96
98
  - externalized result count / bytes
97
- - top tools
98
- - slowest step
99
- - usage availability
100
- - session health
99
+ - top tools
100
+ - slowest step
101
+ - usage availability
102
+ - session health
103
+ - durable truth 区块:
104
+ - `runtimeStats.updatedAt`
105
+ - `checkpoint.flow.phase`
106
+ - `checkpoint.flow.lastTransition`
107
+ - `verificationState.status`
108
+ - derived diagnostics 区块:
109
+ - why continue / why recovery / why compression
110
+ - why slow
111
+ - flaky tool hotspot
112
+ - prompt layer / hotspot / slimming 诊断
113
+
114
+ ## durable truth vs derived diagnostics
115
+
116
+ ### durable truth
117
+
118
+ - `SessionRecord.runtimeStats`
119
+ - `SessionRecord.checkpoint`
120
+ - `SessionRecord.verificationState`
121
+
122
+ ### derived diagnostics
123
+
124
+ - runtime summary 文本
125
+ - why slow / why continue / why recovery / why compression 的诊断结论
126
+ - prompt layer chars / block counts / hotspots
127
+ - request-time context diagnostics(如 initial / final estimated chars)
128
+
129
+ derived diagnostics 必须来自既有真相源和当前 request 构建结果,
130
+ 不能反过来变成新的持久化 truth。
101
131
 
102
132
  ## usage 规则
103
133
 
@@ -4,14 +4,15 @@
4
4
 
5
5
  运行时规则是 Athlete 的机器约束层。
6
6
 
7
- ## 当前包含
8
-
9
- - 计划先行
10
- - inbox 注入
11
- - verification 状态机
12
- - finalize / closeout gating
13
- - continuation / compression
14
- - tool error recovery
7
+ ## 当前包含
8
+
9
+ - 计划先行
10
+ - inbox 注入
11
+ - verification 状态机
12
+ - finalize / closeout gating
13
+ - continuation / compression
14
+ - tool error recovery
15
+ - runtime transition 模型
15
16
 
16
17
  ## 不该放进来的东西
17
18
 
@@ -19,15 +20,46 @@
19
20
  - 具体 skill 内容
20
21
  - 某个单一工具的内部实现
21
22
 
22
- ## 当前与收口直接相关的规则
23
-
24
- - 变更型动作默认要求先 `todo_write`
25
- - 文件改动和 mutating shell 会把 session 推进到 verification required
26
- - 轻量交付物允许用定向 `read_file` / auto-readback 完成轻量验证
27
- - continuation 后仍然读取持久化的 `pendingPaths`,不会因为 slice 切换就忘记“还有哪些输出待验”
28
- - 当收口条件已满足时,task board closeout 工具会被隐藏,避免 `task_list` / `task_get` / `task_update` 无意义循环
29
- - todo 已全部完成时,runtime 不再继续鼓励补写 `todo_write`
30
-
31
- ## 下一阶段要求
32
-
33
- 总指挥层可以提出“下一步做什么”,但运行时规则仍决定“现在允不允许这样做”。
23
+ ## 当前与收口直接相关的规则
24
+
25
+ - 变更型动作默认要求先 `todo_write`
26
+ - 文件改动和 mutating shell 会把 session 推进到 verification required
27
+ - 轻量交付物允许用定向 `read_file` / auto-readback 完成轻量验证
28
+ - acceptance / verification 统一消费机器 signal,而不是分散反推某个工具名
29
+ - continuation 后仍然读取持久化的 `pendingPaths`,不会因为 slice 切换就忘记“还有哪些输出待验”
30
+ - 当收口条件已满足时,task board closeout 工具会被隐藏,避免 `task_list` / `task_get` / `task_update` 无意义循环
31
+ - 当 todo 已全部完成时,runtime 不再继续鼓励补写 `todo_write`
32
+ - continue / recover / yield / pause / finalize 必须带结构化 reason code,而不是只靠零散字符串
33
+ - 最近一次关键 runtime 决策持久化到既有 checkpoint 真相源,不新增平行 JSON
34
+ - one-shot CLI 收尾输出必须带稳定 machine closeout contract,而不是只打印 session id
35
+ - 交互式 `quit` 如果发现运行中的后台进程,必须先进入 kill-or-continue 二次确认
36
+
37
+ ## 当前 signal 规则
38
+
39
+ acceptance / verification 当前统一识别的结果类型至少包括:
40
+
41
+ - `http_endpoint_verified`
42
+ - `web_page_verified`
43
+ - `document_read_completed`
44
+ - `structured_artifact_valid`
45
+
46
+ 换 browser 实现、换 document 引擎、换 provider 时,不应重写 acceptance gate 主体,只能换 adapter 或 signal 生产方式。
47
+
48
+ ## 当前代码落点
49
+
50
+ - `src/agent/acceptance/signals.ts`
51
+ - acceptance signal 归一化
52
+ - `src/agent/acceptance/evaluate.ts`
53
+ - 只消费 signal、file checks、command checks
54
+ - `src/agent/verification/state.ts`
55
+ - verification 真相源
56
+ - `src/agent/verification/signals.ts`
57
+ - lightweight verification / auto-readback
58
+ - `src/cli/support.ts`
59
+ - one-shot closeout report
60
+ - `src/cli.ts`
61
+ - CLI 终态输出
62
+
63
+ ## 下一阶段要求
64
+
65
+ 总指挥层可以提出“下一步做什么”,但运行时规则仍决定“现在允不允许这样做”。
@@ -24,20 +24,26 @@ Athlete 当前的记忆重点是:
24
24
 
25
25
  它不是跨项目的人格记忆。
26
26
 
27
- ## 当前实现约束
28
-
29
- - continuation 会复用已有 session,而不是重新发明 todo / verification 状态。
30
- - compact 只压缩请求上下文,不抹掉任务板、todo、verification 这些真相源。
31
- - 收口判断可以依赖持久化的 `verificationState.pendingPaths`,不能只看当前 slice 的临时 `changedPaths`。
32
-
33
- ## Resume / Reset Contract
34
-
35
- - `resume` 的语义是继续现有任务现场。
36
- - `quit` 只是退出当前聊天窗口,不主动清空项目运行时状态。
37
- - 显式 `reset` 会清空当前项目 `.athlete/` 下的运行时状态,并删除当前项目相关的持久化 session。
38
- - 一旦 `reset` 成功,`resume` 不应恢复已经 reset 掉的运行时。
39
- - 如果 objective 明确变化,checkpoint 进度必须重置,避免旧任务进度污染新任务。
40
- - externalized tool-result references 和 verification pending paths 仍然是优先的可恢复锚点,但 reset 会主动销毁这一层锚点。
27
+ ## 当前实现约束
28
+
29
+ - continuation 会复用已有 session,而不是重新发明 todo / verification 状态。
30
+ - compact 只压缩请求上下文,不抹掉任务板、todo、verification 这些真相源。
31
+ - 收口判断可以依赖持久化的 `verificationState.pendingPaths`,不能只看当前 slice 的临时 `changedPaths`。
32
+ - `checkpoint.flow.lastTransition` 会随 session 持久化,保留最近一次关键 runtime 决策的结构化原因。
33
+
34
+ ## Resume / Reset Contract
35
+
36
+ - `resume` 的语义是继续现有任务现场。
37
+ - `quit` 会先检查当前项目仍在运行的后台进程。
38
+ - 如果没有运行中的后台进程,`quit` 只是退出当前聊天窗口,不主动清空项目运行时状态。
39
+ - 如果有运行中的后台进程,`quit` 必须先进入二次确认:
40
+ - 确认退出:kill 全部后台进程,再退出
41
+ - 取消退出:继续留在当前会话
42
+ - 显式 `reset` 会清空当前项目 `.athlete/` 下的运行时状态,并删除当前项目相关的持久化 session。
43
+ - 一旦 `reset` 成功,`resume` 不应恢复已经 reset 掉的运行时。
44
+ - 如果 objective 明确变化,checkpoint 进度必须重置,避免旧任务进度污染新任务。
45
+ - externalized tool-result references 和 verification pending paths 仍然是优先的可恢复锚点,但 reset 会主动销毁这一层锚点。
46
+ - runtime transition reason code 也属于 checkpoint 真相源的一部分,resume / continuation 读取它,而不是再造平行恢复提示。
41
47
 
42
48
  ## 下一阶段要求
43
49
 
@@ -14,21 +14,28 @@
14
14
  - `checklist`
15
15
  - `worktree`
16
16
 
17
- ## 当前规则
18
-
19
- 1. `assignee` 表示应该谁做。
20
- 2. `owner` 表示现在谁正在做。
21
- 3. 被阻塞任务不能启动。
22
- 4. 已完成任务不能随意重开。
23
-
24
- ## 下一阶段演进方向
25
-
26
- 任务系统要支持总指挥层,优先考虑增加:
27
-
28
- - 优先级
29
- - 父子任务
30
- - 重试次数
31
- - 产物引用
32
- - review / verify 要求
33
-
34
- 这些演进必须建立在现有持久化任务板上,而不是另起一套任务宇宙。
17
+ ## 当前规则
18
+
19
+ 1. `assignee` 表示应该谁做。
20
+ 2. `owner` 表示现在谁正在做。
21
+ 3. 被阻塞任务不能启动。
22
+ 4. 已完成任务不能随意重开。
23
+ 5. `status / blockedBy / assignee / owner / worktree` 不是孤立看的,lead orchestrator 会联合 `TeamStore`、`BackgroundJobStore`、`WorktreeStore` 派生任务 lifecycle。
24
+ 6. 同一个任务的 machine lifecycle 至少要能区分:
25
+ - `blocked`
26
+ - `ready`
27
+ - `active`
28
+ - `completed`
29
+ 7. `ready` 还要继续区分是谁能接:
30
+ - lead
31
+ - 指定 teammate
32
+ - nobody(缺失或冲突时 fail-closed)
33
+ 8. 如果 task 仍绑定失效 worktree、指向缺失 background job、或保留了不存在 teammate 的 handoff,系统必须阻断继续派工。
34
+
35
+ ## 下一阶段演进方向
36
+
37
+ 任务系统后续如要继续长:
38
+
39
+ - 优先先扩现有 task truth
40
+ - 不新造平行 orchestration plane
41
+ - 继续让 lifecycle / ownership / handoff 由机器从既有真相源派生
@@ -228,7 +228,8 @@ Telegram 过程输出要更接近终端工作感知,但遵守“可见段按
228
228
 
229
229
  过程消息按实际事件顺序发送,不做机械固定轮换,也不做最终汇总:
230
230
 
231
- - `onToolCall` 一次,就发一条 tool call 消息
231
+ - `onToolCall` 不直接发聊天消息,避免把工具名刷进聊天框
232
+ - 非 `todo_write` 的 tool result 只发送一条可见 preview,并截断到 150 个字符
232
233
  - `todo_write` 对应的可见 preview 一次,就发一条 todo preview 消息
233
234
  - `onAssistantDelta` 只作为阶段内缓冲信号,不直接发聊天消息
234
235
  - `onAssistantText` 表示拿到了完整 assistant 文本时,发一条 assistant 消息