@fitlab-ai/agent-infra 0.7.5 → 0.7.7

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 (123) hide show
  1. package/bin/cli.ts +11 -3
  2. package/dist/bin/cli.js +10 -3
  3. package/dist/lib/sandbox/commands/create.js +26 -4
  4. package/dist/lib/sandbox/commands/ls.js +4 -33
  5. package/dist/lib/sandbox/commands/show.js +67 -0
  6. package/dist/lib/sandbox/index.js +7 -0
  7. package/dist/lib/sandbox/tools.js +20 -1
  8. package/dist/lib/task/commands/issue-body.js +94 -0
  9. package/dist/lib/task/commands/log.js +139 -6
  10. package/dist/lib/task/index.js +8 -0
  11. package/dist/lib/task/issue-form.js +66 -0
  12. package/dist/lib/task/sections.js +44 -0
  13. package/lib/sandbox/commands/create.ts +33 -4
  14. package/lib/sandbox/commands/ls.ts +4 -36
  15. package/lib/sandbox/commands/show.ts +80 -0
  16. package/lib/sandbox/index.ts +7 -0
  17. package/lib/sandbox/tools.ts +28 -1
  18. package/lib/task/commands/issue-body.ts +102 -0
  19. package/lib/task/commands/log.ts +146 -6
  20. package/lib/task/index.ts +8 -0
  21. package/lib/task/issue-form.ts +77 -0
  22. package/lib/task/sections.ts +44 -0
  23. package/package.json +3 -2
  24. package/templates/.agents/README.en.md +3 -1
  25. package/templates/.agents/README.zh-CN.md +3 -1
  26. package/templates/.agents/rules/create-issue.github.en.md +20 -29
  27. package/templates/.agents/rules/create-issue.github.zh-CN.md +20 -29
  28. package/templates/.agents/rules/issue-pr-commands.github.en.md +6 -0
  29. package/templates/.agents/rules/issue-pr-commands.github.zh-CN.md +6 -0
  30. package/templates/.agents/rules/next-step-output.en.md +26 -1
  31. package/templates/.agents/rules/next-step-output.zh-CN.md +26 -1
  32. package/templates/.agents/rules/no-mid-flow-questions.en.md +11 -0
  33. package/templates/.agents/rules/no-mid-flow-questions.zh-CN.md +11 -0
  34. package/templates/.agents/rules/review-handshake.en.md +15 -1
  35. package/templates/.agents/rules/review-handshake.zh-CN.md +15 -1
  36. package/templates/.agents/rules/task-management.en.md +27 -0
  37. package/templates/.agents/rules/task-management.zh-CN.md +31 -0
  38. package/templates/.agents/scripts/validate-artifact.js +11 -2
  39. package/templates/.agents/skills/analyze-task/SKILL.en.md +14 -1
  40. package/templates/.agents/skills/analyze-task/SKILL.zh-CN.md +14 -1
  41. package/templates/.agents/skills/archive-tasks/SKILL.en.md +3 -1
  42. package/templates/.agents/skills/archive-tasks/SKILL.zh-CN.md +3 -1
  43. package/templates/.agents/skills/block-task/SKILL.en.md +13 -1
  44. package/templates/.agents/skills/block-task/SKILL.zh-CN.md +13 -1
  45. package/templates/.agents/skills/cancel-task/SKILL.en.md +13 -1
  46. package/templates/.agents/skills/cancel-task/SKILL.zh-CN.md +14 -2
  47. package/templates/.agents/skills/check-task/SKILL.en.md +30 -81
  48. package/templates/.agents/skills/check-task/SKILL.zh-CN.md +30 -80
  49. package/templates/.agents/skills/close-codescan/SKILL.en.md +13 -1
  50. package/templates/.agents/skills/close-codescan/SKILL.zh-CN.md +13 -1
  51. package/templates/.agents/skills/close-dependabot/SKILL.en.md +13 -1
  52. package/templates/.agents/skills/close-dependabot/SKILL.zh-CN.md +13 -1
  53. package/templates/.agents/skills/code-task/SKILL.en.md +14 -1
  54. package/templates/.agents/skills/code-task/SKILL.zh-CN.md +14 -1
  55. package/templates/.agents/skills/code-task/reference/dual-mode.en.md +7 -2
  56. package/templates/.agents/skills/code-task/reference/dual-mode.zh-CN.md +7 -2
  57. package/templates/.agents/skills/code-task/scripts/detect-mode.js +6 -14
  58. package/templates/.agents/skills/commit/SKILL.en.md +37 -5
  59. package/templates/.agents/skills/commit/SKILL.zh-CN.md +37 -5
  60. package/templates/.agents/skills/complete-task/SKILL.en.md +13 -1
  61. package/templates/.agents/skills/complete-task/SKILL.zh-CN.md +13 -1
  62. package/templates/.agents/skills/create-pr/SKILL.en.md +23 -2
  63. package/templates/.agents/skills/create-pr/SKILL.zh-CN.md +23 -2
  64. package/templates/.agents/skills/create-release-note/SKILL.en.md +19 -2
  65. package/templates/.agents/skills/create-release-note/SKILL.zh-CN.md +19 -2
  66. package/templates/.agents/skills/create-task/SKILL.en.md +14 -1
  67. package/templates/.agents/skills/create-task/SKILL.zh-CN.md +17 -4
  68. package/templates/.agents/skills/import-codescan/SKILL.en.md +14 -1
  69. package/templates/.agents/skills/import-codescan/SKILL.zh-CN.md +14 -1
  70. package/templates/.agents/skills/import-dependabot/SKILL.en.md +14 -1
  71. package/templates/.agents/skills/import-dependabot/SKILL.zh-CN.md +14 -1
  72. package/templates/.agents/skills/import-issue/SKILL.en.md +35 -2
  73. package/templates/.agents/skills/import-issue/SKILL.zh-CN.md +35 -2
  74. package/templates/.agents/skills/init-labels/SKILL.en.md +3 -1
  75. package/templates/.agents/skills/init-labels/SKILL.zh-CN.md +3 -1
  76. package/templates/.agents/skills/init-milestones/SKILL.en.md +3 -1
  77. package/templates/.agents/skills/init-milestones/SKILL.zh-CN.md +3 -1
  78. package/templates/.agents/skills/plan-task/SKILL.en.md +15 -1
  79. package/templates/.agents/skills/plan-task/SKILL.zh-CN.md +15 -1
  80. package/templates/.agents/skills/post-release/SKILL.en.md +3 -1
  81. package/templates/.agents/skills/post-release/SKILL.zh-CN.md +3 -1
  82. package/templates/.agents/skills/refine-title/SKILL.en.md +3 -1
  83. package/templates/.agents/skills/refine-title/SKILL.zh-CN.md +3 -1
  84. package/templates/.agents/skills/release/SKILL.en.md +3 -1
  85. package/templates/.agents/skills/release/SKILL.zh-CN.md +3 -1
  86. package/templates/.agents/skills/restore-task/SKILL.en.md +13 -1
  87. package/templates/.agents/skills/restore-task/SKILL.zh-CN.md +13 -1
  88. package/templates/.agents/skills/review-analysis/SKILL.en.md +16 -2
  89. package/templates/.agents/skills/review-analysis/SKILL.zh-CN.md +16 -2
  90. package/templates/.agents/skills/review-analysis/reference/output-templates.en.md +1 -1
  91. package/templates/.agents/skills/review-analysis/reference/output-templates.zh-CN.md +1 -1
  92. package/templates/.agents/skills/review-analysis/reference/report-template.en.md +1 -1
  93. package/templates/.agents/skills/review-analysis/reference/report-template.zh-CN.md +1 -2
  94. package/templates/.agents/skills/review-analysis/reference/review-criteria.en.md +1 -0
  95. package/templates/.agents/skills/review-analysis/reference/review-criteria.zh-CN.md +1 -0
  96. package/templates/.agents/skills/review-code/SKILL.en.md +15 -2
  97. package/templates/.agents/skills/review-code/SKILL.zh-CN.md +15 -2
  98. package/templates/.agents/skills/review-code/reference/output-templates.en.md +1 -1
  99. package/templates/.agents/skills/review-code/reference/output-templates.zh-CN.md +1 -1
  100. package/templates/.agents/skills/review-code/reference/report-template.en.md +1 -1
  101. package/templates/.agents/skills/review-code/reference/report-template.zh-CN.md +1 -2
  102. package/templates/.agents/skills/review-code/reference/review-criteria.en.md +1 -0
  103. package/templates/.agents/skills/review-code/reference/review-criteria.zh-CN.md +1 -0
  104. package/templates/.agents/skills/review-plan/SKILL.en.md +16 -2
  105. package/templates/.agents/skills/review-plan/SKILL.zh-CN.md +16 -2
  106. package/templates/.agents/skills/review-plan/reference/output-templates.en.md +1 -1
  107. package/templates/.agents/skills/review-plan/reference/output-templates.zh-CN.md +1 -1
  108. package/templates/.agents/skills/review-plan/reference/report-template.en.md +1 -1
  109. package/templates/.agents/skills/review-plan/reference/report-template.zh-CN.md +1 -2
  110. package/templates/.agents/skills/review-plan/reference/review-criteria.en.md +1 -0
  111. package/templates/.agents/skills/review-plan/reference/review-criteria.zh-CN.md +1 -0
  112. package/templates/.agents/skills/test/SKILL.en.md +3 -1
  113. package/templates/.agents/skills/test/SKILL.zh-CN.md +1 -1
  114. package/templates/.agents/skills/test-integration/SKILL.en.md +3 -1
  115. package/templates/.agents/skills/test-integration/SKILL.zh-CN.md +3 -1
  116. package/templates/.agents/skills/update-agent-infra/SKILL.en.md +3 -1
  117. package/templates/.agents/skills/update-agent-infra/SKILL.zh-CN.md +3 -1
  118. package/templates/.agents/skills/upgrade-dependency/SKILL.en.md +3 -1
  119. package/templates/.agents/skills/upgrade-dependency/SKILL.zh-CN.md +3 -1
  120. package/templates/.agents/skills/watch-pr/SKILL.en.md +13 -1
  121. package/templates/.agents/skills/watch-pr/SKILL.zh-CN.md +13 -1
  122. package/templates/.agents/templates/task.en.md +5 -0
  123. package/templates/.agents/templates/task.zh-CN.md +5 -0
@@ -1,6 +1,8 @@
1
1
  ---
2
2
  name: check-task
3
- description: "查看任务的当前状态和进度"
3
+ description: >
4
+ 查看任务的当前状态和进度。
5
+ 当想快速查看某个任务当前状态与进度时使用。
4
6
  ---
5
7
 
6
8
  # 查看任务状态
@@ -8,103 +10,51 @@ description: "查看任务的当前状态和进度"
8
10
  ## 行为边界 / 关键规则
9
11
 
10
12
  - 本技能是**只读**操作 —— 不修改任何文件
11
- - 始终检查 active、blocked completed 目录
13
+ - 机械数据(frontmatter 元数据、产物分组、Git/Platform 状态,以及跨 active、blocked、completed 三目录定位任务)一律委托给确定性的 `ai task status` 命令。本技能只负责 CLI 无法产出的语义层:工作流阶段解读、审查结论解析、下一步建议。
12
14
 
13
15
  ## 任务入参短号别名
14
16
 
15
17
  > 如果 `{task-id}` 入参匹配 `^[#]?[0-9]+$`(裸数字或带 `#` 前缀),先读取 `.agents/rules/task-short-id.md` 的「SKILL 入参解析」段执行解析;后续命令视 `{task-id}` 为解析后的全长 `TASK-YYYYMMDD-HHMMSS` 形式。
16
18
 
17
19
  ## 执行步骤
18
- ### 1. 查找任务
19
20
 
20
- 按以下优先顺序搜索任务:
21
- 1. `.agents/workspace/active/{task-id}/task.md`
22
- 2. `.agents/workspace/blocked/{task-id}/task.md`
23
- 3. `.agents/workspace/completed/{task-id}/task.md`
21
+ ### 1. 通过 `ai task status` 收集事实
24
22
 
25
- 注意:`{task-id}` 格式为 `TASK-{yyyyMMdd-HHmmss}`,例如 `TASK-20260306-143022`
23
+ 运行确定性 CLI 收集全部机械数据,并以其 stdout 作为状态报告的事实基底:
26
24
 
27
- 如果在任何目录中都未找到,提示 "Task {task-id} not found"。
28
-
29
- ### 2. 读取任务元数据
25
+ ```bash
26
+ ai task status {task-id}
27
+ ```
30
28
 
31
- `task.md` 中提取:
32
- - `id`、`title`、`type`、`status`、`workflow`
33
- - `current_step`、`assigned_to`
34
- - `created_at`、`updated_at`
35
- - `issue_number`、`pr_number`(如适用)
29
+ 该命令会跨 active、blocked、completed 三目录解析任务,并输出五段:任务头(`id`、短号、标题)、`Metadata`(frontmatter 字段)、`Artifacts`(按工作流阶段分组的产物)、`Git`(分支匹配、未提交数、ahead/behind)、`Platform`(Issue/PR 状态)。把该输出视为权威事实 —— 不要再手工复述其中任何内容。
36
30
 
37
- ### 3. 检查上下文文件
31
+ 降级处理:
32
+ - 若命令不可用(如 `ai` 不在 PATH 或 `dist/` 未构建)或非零退出,回退到降级读取:展示 `task.md` frontmatter 并 `ls` 任务目录,同时告知用户本次为降级输出(建议先构建或安装 CLI,如 `ai init`)。
33
+ - 若在任何目录都未找到任务,提示 "Task {task-id} not found"。
38
34
 
39
- 按产物类型扫描并记录以下文件的存在、轮次和状态:
40
- - `analysis.md`、`analysis-r{N}.md` - 需求分析
41
- - `plan.md`、`plan-r{N}.md` - 技术方案
42
- - `code.md`、`code-r2.md`、... - 实现报告
43
- - `review-analysis.md`、`review-analysis-r{N}.md` - 需求分析审查报告
44
- - `review-plan.md`、`review-plan-r{N}.md` - 技术方案审查报告
45
- - `review-code.md`、`review-code-r{N}.md` - 代码审查报告
35
+ ### 2. 解读工作流阶段与审查结论
46
36
 
47
- 对于版本化产物(`analysis`、`review-analysis`、`plan`、`review-plan`、`code`、`review-code`):
48
- - 扫描任务目录中的所有同类版本化文件
49
- - 记录每类产物的最新轮次、最新文件路径和总轮次数
50
- - 如果 `task.md` 的 Activity Log 记录了最新轮次,优先核对其与实际文件是否一致
37
+ 这是 CLI 不产出的语义层。基于步骤 1 的 `Artifacts` 分组与 `task.md` 的活动日志:
51
38
 
52
- ### 4. 输出状态报告
39
+ - 把每个工作流阶段映射为状态指示器,并标注其最新产物与轮次:
40
+ - `[done]` - 步骤已完成
41
+ - `[current]` - 当前进行中
42
+ - `[pending]` - 尚未开始
43
+ - `[blocked]` - 被阻塞
44
+ - `[skipped]` - 已跳过
45
+ - 对各阶段最新的审查产物(`review-analysis`、`review-plan`、`review-code`),读取报告正文并解析结论:总体结论(通过 / 需要修改 / 拒绝)与阻塞项 / 主要问题 / 次要问题计数。CLI 不解析审查正文,因此这一步是步骤 3 选择下一步操作的必要输入。
53
46
 
54
- 以清晰的结构和状态指示器格式化输出:
47
+ 把工作流进度作为 CLI 输出之上的叠加层呈现,标注最新轮次与解析出的审查结论,例如:
55
48
 
56
49
  ```
57
- 任务状态:{task-id}(短号 {task-ref})
58
- =======================
59
-
60
- 基本信息:
61
- - 标题:{title}
62
- - 类型:{type}
63
- - 状态:{status}
64
- - 工作流:{workflow}
65
- - 分配给:{assigned_to}
66
- - 创建时间:{created_at}
67
- - 更新时间:{updated_at}
68
-
69
50
  工作流进度:
70
- [已完成] 需求分析 analysis-r2.md (Round 2, latest)
71
- [已完成] 需求分析审查 review-analysis.md (Round 1, latest)
72
- [已完成] 技术设计 plan.md (Round 1)
73
- [已完成] 技术方案审查 review-plan.md (Round 1, latest)
74
- [进行中] 实现 code.md (Round 1)
75
- [待处理] 代码审查 review-code.md (Round 1 will be created next)
76
- [待处理] 最终提交
77
-
78
- 上下文文件:
79
- - analysis.md: 已存在 (Round 1)
80
- - analysis-r2.md: 已存在 (Round 2, latest)
81
- - review-analysis.md: 已存在 (Round 1, latest)
82
- - plan.md: 已存在 (Round 1, latest)
83
- - review-plan.md: 已存在 (Round 1, latest)
84
- - code.md: 已存在 (Round 1, latest)
85
- - review-code.md: 未开始
86
-
87
- 如果存在多轮产物,显示所有轮次,并标记最新版本,例如:
88
- - plan.md: 已存在 (Round 1)
89
- - plan-r2.md: 已存在 (Round 2, latest)
90
- - review-plan.md: 已存在 (Round 1)
91
- - code.md: 已存在 (Round 1)
92
- - code-r2.md: 已存在 (Round 2, latest)
93
- - review-code.md: 已存在 (Round 1)
94
- - review-code-r2.md: 已存在 (Round 2, latest)
95
-
96
- 下一步:
97
- 完成实现,然后执行代码审查
51
+ [done] 需求分析 analysis.md (Round 1, latest)
52
+ [done] 需求分析审查 review-analysis.md (Round 1, latest, 通过)
53
+ [current] 技术设计 plan.md (Round 1)
54
+ [pending] 技术方案审查
98
55
  ```
99
56
 
100
- **状态指示器**:
101
- - `[done]` - 步骤已完成
102
- - `[current]` - 当前进行中
103
- - `[pending]` - 尚未开始
104
- - `[blocked]` - 被阻塞
105
- - `[skipped]` - 已跳过
106
-
107
- ### 5. 建议下一步操作
57
+ ### 3. 建议下一步操作
108
58
 
109
59
  根据当前工作流状态,建议合适的下一个技能。必须展示下表中所有 TUI 列的命令格式,不要只展示当前 AI 代理对应的列。如果 `.agents/.airc.json` 中配置了自定义 TUI(`customTUIs`),读取每个工具的 `name` 和 `invoke`,按同样格式补充对应命令行(`${skillName}` 替换为技能名,`${projectName}` 替换为项目名):
110
60
 
@@ -143,6 +93,6 @@ description: "查看任务的当前状态和进度"
143
93
  ## 注意事项
144
94
 
145
95
  1. **只读**:本技能仅读取和报告 —— 不修改任何文件
146
- 2. **多目录搜索**:始终检查 active、blocked completed 目录
96
+ 2. **CLI 委托**:机械数据(元数据、产物分组、Git/Platform 状态、多目录定位)来自 `ai task status`;本技能在其之上叠加语义解读
147
97
  3. **快速参考**:随时可以使用本技能检查任务在工作流中的位置
148
- 4. **版本化产物**:`analysis`、`review-analysis`、`plan`、`review-plan`、`code`、`review-code` 都需要报告实际轮次,而不是只报告固定文件名
98
+ 4. **版本化产物**:`ai task status` 已按实际轮次分组产物;语义层仍需报告 `review-analysis`、`review-plan`、`review-code` 的最新审查结论
@@ -1,6 +1,8 @@
1
1
  ---
2
2
  name: close-codescan
3
- description: "Close a Code Scanning alert with a documented reason"
3
+ description: >
4
+ Close a Code Scanning alert with a documented reason.
5
+ Use when a Code Scanning alert has been handled or dismissed and needs closing with a reason.
4
6
  ---
5
7
 
6
8
  # Dismiss Code Scanning Alert
@@ -11,6 +13,16 @@ Dismiss the specified Code Scanning (CodeQL) alert and record a justified reason
11
13
 
12
14
  > If `{task-id}` matches `^[#]?[0-9]+$` (bare numeric or `#`-prefixed), follow the "SKILL parameter resolver" section of `.agents/rules/task-short-id.md`; treat `{task-id}` as the resolved full `TASK-YYYYMMDD-HHMMSS` form for every downstream command.
13
15
 
16
+ ## Step Start: Write the started Marker
17
+
18
+ After prerequisites pass and before this step's first artifact action, append a started marker to task.md `## Activity Log` (same base action as this step's done entry plus a ` [started]` suffix, note `started`):
19
+
20
+ ```
21
+ - {YYYY-MM-DD HH:mm:ss±HH:MM} — **Close Codescan [started]** by {agent} — started
22
+ ```
23
+
24
+ `ai task log` pairs it with the done entry written on completion onto one row (in progress → done). See the "Activity Log started / done dual-marker convention" in `.agents/rules/task-management.md`.
25
+
14
26
  ## Execution Flow
15
27
 
16
28
  ### 1. Retrieve Alert Information
@@ -1,6 +1,8 @@
1
1
  ---
2
2
  name: close-codescan
3
- description: "关闭 Code Scanning 告警并记录理由"
3
+ description: >
4
+ 关闭 Code Scanning 告警并记录理由。
5
+ 当某条 Code Scanning 告警已处理或需按理由关闭时使用。
4
6
  ---
5
7
 
6
8
  # 关闭 Code Scanning 告警
@@ -11,6 +13,16 @@ description: "关闭 Code Scanning 告警并记录理由"
11
13
 
12
14
  > 如果 `{task-id}` 入参匹配 `^[#]?[0-9]+$`(裸数字或带 `#` 前缀),先读取 `.agents/rules/task-short-id.md` 的「SKILL 入参解析」段执行解析;后续命令视 `{task-id}` 为解析后的全长 `TASK-YYYYMMDD-HHMMSS` 形式。
13
15
 
16
+ ## 步骤开始:写入 started 标记
17
+
18
+ 确认前置条件后、本步骤第一个产出动作之前,向 task.md `## 活动日志` 追加一条 started 标记(与本步骤 done 条目同基名 + ` [started]` 后缀,note 用 `started`):
19
+
20
+ ```
21
+ - {YYYY-MM-DD HH:mm:ss±HH:MM} — **Close Codescan [started]** by {agent} — started
22
+ ```
23
+
24
+ `ai task log` 会把它与完成时写入的 done 条目配对成一行(进行中 → 已完成)。约定见 `.agents/rules/task-management.md` 的「Activity Log started / done 双标记约定」。
25
+
14
26
  ## 执行流程
15
27
 
16
28
  ### 1. 获取告警信息
@@ -1,6 +1,8 @@
1
1
  ---
2
2
  name: close-dependabot
3
- description: "Close a Dependabot alert with a documented reason"
3
+ description: >
4
+ Close a Dependabot alert with a documented reason.
5
+ Use when a Dependabot alert has been handled or dismissed and needs closing with a reason.
4
6
  ---
5
7
 
6
8
  # Dismiss Dependabot Alert
@@ -11,6 +13,16 @@ Dismiss the specified Dependabot security alert and record a justified reason.
11
13
 
12
14
  > If `{task-id}` matches `^[#]?[0-9]+$` (bare numeric or `#`-prefixed), follow the "SKILL parameter resolver" section of `.agents/rules/task-short-id.md`; treat `{task-id}` as the resolved full `TASK-YYYYMMDD-HHMMSS` form for every downstream command.
13
15
 
16
+ ## Step Start: Write the started Marker
17
+
18
+ After prerequisites pass and before this step's first artifact action, append a started marker to task.md `## Activity Log` (same base action as this step's done entry plus a ` [started]` suffix, note `started`):
19
+
20
+ ```
21
+ - {YYYY-MM-DD HH:mm:ss±HH:MM} — **Close Dependabot [started]** by {agent} — started
22
+ ```
23
+
24
+ `ai task log` pairs it with the done entry written on completion onto one row (in progress → done). See the "Activity Log started / done dual-marker convention" in `.agents/rules/task-management.md`.
25
+
14
26
  ## Execution Flow
15
27
 
16
28
  ### 1. Retrieve Alert Information
@@ -1,6 +1,8 @@
1
1
  ---
2
2
  name: close-dependabot
3
- description: "关闭 Dependabot 安全告警并记录理由"
3
+ description: >
4
+ 关闭 Dependabot 安全告警并记录理由。
5
+ 当某条 Dependabot 安全告警已处理或需按理由关闭时使用。
4
6
  ---
5
7
 
6
8
  # 关闭 Dependabot 告警
@@ -11,6 +13,16 @@ description: "关闭 Dependabot 安全告警并记录理由"
11
13
 
12
14
  > 如果 `{task-id}` 入参匹配 `^[#]?[0-9]+$`(裸数字或带 `#` 前缀),先读取 `.agents/rules/task-short-id.md` 的「SKILL 入参解析」段执行解析;后续命令视 `{task-id}` 为解析后的全长 `TASK-YYYYMMDD-HHMMSS` 形式。
13
15
 
16
+ ## 步骤开始:写入 started 标记
17
+
18
+ 确认前置条件后、本步骤第一个产出动作之前,向 task.md `## 活动日志` 追加一条 started 标记(与本步骤 done 条目同基名 + ` [started]` 后缀,note 用 `started`):
19
+
20
+ ```
21
+ - {YYYY-MM-DD HH:mm:ss±HH:MM} — **Close Dependabot [started]** by {agent} — started
22
+ ```
23
+
24
+ `ai task log` 会把它与完成时写入的 done 条目配对成一行(进行中 → 已完成)。约定见 `.agents/rules/task-management.md` 的「Activity Log started / done 双标记约定」。
25
+
14
26
  ## 执行流程
15
27
 
16
28
  ### 1. 获取告警信息
@@ -1,6 +1,8 @@
1
1
  ---
2
2
  name: code-task
3
- description: "Implement code from the technical plan and output a report"
3
+ description: >
4
+ Implement code from the technical plan and output a report.
5
+ Use when an approved technical plan needs implementing, or code review found issues to fix.
4
6
  ---
5
7
 
6
8
  # Code Task
@@ -11,6 +13,7 @@ Implement the approved plan and produce `code.md` or `code-r{N}.md`. This skill
11
13
 
12
14
  - Follow the latest plan artifact: `plan.md` or `plan-r{N}.md`
13
15
  - Fix mode verifies each finding of the latest `review-code` one by one: fix it if it holds, or rebut it and record it under unresolved if it is unfounded/hallucinated; do not expand to issues the review did not list; env-blocked items are out of scope
16
+ - If implementation encounters a key design decision not covered by the plan, record `[needs-human-decision]` / `HD-` rows according to `.agents/rules/no-mid-flow-questions.md` instead of asking mid-flow or expanding scope silently
14
17
  - Never auto-run `git add` or `git commit`
15
18
  - Create a new code artifact for each round and never overwrite an older one
16
19
  - After executing this skill, you **must** immediately update task.md
@@ -33,6 +36,16 @@ tail .agents/workspace/active/{task-id}/task.md
33
36
 
34
37
  > If `{task-id}` matches `^[#]?[0-9]+$` (bare numeric or `#`-prefixed), follow the "SKILL parameter resolver" section of `.agents/rules/task-short-id.md`; treat `{task-id}` as the resolved full `TASK-YYYYMMDD-HHMMSS` form for every downstream command.
35
38
 
39
+ ## Step Start: Write the started Marker
40
+
41
+ After prerequisites (step 1) and mode/round (step 4) are confirmed and before this round's first artifact action, append a started marker to task.md `## Activity Log` (same base action as this round's done entry plus a ` [started]` suffix, note `started`):
42
+
43
+ ```
44
+ - {YYYY-MM-DD HH:mm:ss±HH:MM} — **Code Task (Round {N}) [started]** by {agent} — started
45
+ ```
46
+
47
+ In fix mode the base must match this round's done entry, i.e. `Code Task (Round {N}, fix for {review-artifact}) [started]`. `ai task log` pairs it with the done entry written on completion (step 10) onto one row (in progress → done). Format and pairing rules: see the "Activity Log started / done dual-marker convention" in `.agents/rules/task-management.md`.
48
+
36
49
  ## Steps
37
50
 
38
51
  ### 1. Verify Prerequisites
@@ -1,6 +1,8 @@
1
1
  ---
2
2
  name: code-task
3
- description: "根据技术方案编码任务并输出报告"
3
+ description: >
4
+ 根据技术方案编码任务并输出报告。
5
+ 当技术方案已批准需要落地实现,或代码审查发现问题需要修复时使用。
4
6
  ---
5
7
 
6
8
  # 编码任务
@@ -11,6 +13,7 @@ description: "根据技术方案编码任务并输出报告"
11
13
 
12
14
  - 严格遵循最新方案产物:`plan.md` 或 `plan-r{N}.md`
13
15
  - 修复模式逐条核实最新 `review-code` 的发现:成立则修复,判定为不成立/幻觉则在报告中反驳并记入 unresolved;不擅自扩大到审查未列出的问题;env-blocked 项不在修复范围
16
+ - 实现中遇到方案未覆盖的关键设计决策时,按 `.agents/rules/no-mid-flow-questions.md` 判据记录 `[needs-human-decision]` / `HD-` 行,不中途提问或擅自扩范围
14
17
  - 绝不自动执行 `git add` 或 `git commit`
15
18
  - 每轮实现都创建新的实现产物,不覆盖旧文件
16
19
  - 执行本技能后,你**必须**立即更新 task.md
@@ -47,6 +50,16 @@ tail .agents/workspace/active/{task-id}/task.md
47
50
 
48
51
  > 如果 `{task-id}` 入参匹配 `^[#]?[0-9]+$`(裸数字或带 `#` 前缀),先读取 `.agents/rules/task-short-id.md` 的「SKILL 入参解析」段执行解析;后续命令视 `{task-id}` 为解析后的全长 `TASK-YYYYMMDD-HHMMSS` 形式。
49
52
 
53
+ ## 步骤开始:写入 started 标记
54
+
55
+ 确认前置条件(步骤 1)与模式/轮次(步骤 4)后、本轮第一个产出动作之前,向 task.md `## 活动日志` 追加一条 started 标记(与本轮 done 条目同基名 + ` [started]` 后缀,note 用 `started`):
56
+
57
+ ```
58
+ - {YYYY-MM-DD HH:mm:ss±HH:MM} — **Code Task (Round {N}) [started]** by {agent} — started
59
+ ```
60
+
61
+ 修复模式的基名须与本轮 done 一致,即 `Code Task (Round {N}, fix for {review-artifact}) [started]`。`ai task log` 会把它与步骤完成时(步骤 10)写入的 done 条目配对成一行(进行中 → 已完成)。格式与配对规则见 `.agents/rules/task-management.md` 的「Activity Log started / done 双标记约定」。
62
+
50
63
  ## 执行步骤
51
64
  ### 1. 验证前置条件
52
65
 
@@ -10,7 +10,7 @@ node .agents/skills/code-task/scripts/detect-mode.js .agents/workspace/active/{t
10
10
 
11
11
  The script scans `plan.md` / `plan-r{N}.md`, `review-plan.md` / `review-plan-r{N}.md`, `code.md` / `code-r{N}.md`, and `review-code.md` / `review-code-r{N}.md` in the task directory.
12
12
 
13
- ## Eight Branches
13
+ ## Seven Branches
14
14
 
15
15
  > Branches are evaluated top-down in this table; the first match returns and skips later rows.
16
16
 
@@ -19,12 +19,17 @@ The script scans `plan.md` / `plan-r{N}.md`, `review-plan.md` / `review-plan-r{N
19
19
  | no code artifact | `init` | 0 | initial implementation, output `code.md` |
20
20
  | latest review-plan is approved (`Approved` or `Approved-with-issues`, i.e. `Overall Verdict: Approved` regardless of findings counts), its "Review Input" / "审查输入" entry names the same plan file as the latest `plan(-r{N})?.md` in the task directory, and its mtime is newer than the latest code artifact | `init` | 0 | plan has been approved after the latest code; enter a new implementation round, `next_round = code_max + 1`, `next_artifact = code-r{next_round}.md`. This branch fires regardless of whether review-code exists or passes. Plan and review-plan rounds are independent counters (e.g. `plan-r5` may be approved by `review-plan-r4`); the link is established via the review-plan's "Review Input" entry, not by matching round numbers. |
21
21
  | `rev_max < code_max` | `error` | 2 | latest code round is unreviewed; run `review-code` first |
22
- | `rev_max > code_max` | `error` | 2 | inconsistent state; manual inspection required |
23
22
  | latest review-code is Approved with 0/0/0 | `refused` | 1 | already approved; do not run `code-task` again |
24
23
  | latest review-code is Approved with major/minor findings | `fix` | 0 | optional fix mode |
25
24
  | latest review-code is Changes Requested | `fix` | 0 | required fix mode |
26
25
  | latest review-code is Rejected | `refused` | 1 | re-plan instead of local fixing |
27
26
 
27
+ > The four verdict branches above fire when `rev_max >= code_max`, decided by the latest `review-code-r{rev_max}` verdict:
28
+ > - `rev_max == code_max`: AI fix round (`review-code` reviews the same-numbered code artifact produced by `code-task`).
29
+ > - `rev_max > code_max`: human-supplemented review round — after a PR is opened a maintainer appends a `review-code-r{N}` round against the existing latest code. `fix` mode then uses `next_round = code_max + 1`.
30
+ >
31
+ > If the latest `review-code` verdict cannot be parsed, the script still returns `error` (exit 2) as the retained anomaly guard.
32
+
28
33
  ## Verdict Parsing
29
34
 
30
35
  The script supports zh-CN and English review-code reports:
@@ -10,7 +10,7 @@ node .agents/skills/code-task/scripts/detect-mode.js .agents/workspace/active/{t
10
10
 
11
11
  脚本扫描任务目录中的 `plan.md` / `plan-r{N}.md`、`review-plan.md` / `review-plan-r{N}.md`、`code.md` / `code-r{N}.md` 和 `review-code.md` / `review-code-r{N}.md`。
12
12
 
13
- ## 8 个分支
13
+ ## 7 个分支
14
14
 
15
15
  > 分支按表中自上而下的顺序评估,命中即返回;后续分支不再判定。
16
16
 
@@ -19,12 +19,17 @@ node .agents/skills/code-task/scripts/detect-mode.js .agents/workspace/active/{t
19
19
  | 无 code 产物 | `init` | 0 | 初次实现,产物为 `code.md` |
20
20
  | 最新 review-plan 已批准(`通过` 或 `通过 + major/minor 建议`,即 `Approved` 或 `Approved-with-issues`),且其「审查输入」/「Review Input」字段引用的 plan 文件 == 任务目录中最新的 `plan(-r{N})?.md`,且最新 review-plan 的 mtime > 最新 code 的 mtime | `init` | 0 | plan 已在 code 之后被批准;进入新一轮实现,`next_round = code_max + 1`、`next_artifact = code-r{next_round}.md`。**不论 review-code 是否已审**,本分支均先命中。plan 与 review-plan 的轮次独立递增(如 `plan-r5` 可被 `review-plan-r4` 批准),通过 review-plan 的「审查输入」字段建立批准关系,不要求同号 |
21
21
  | `rev_max < code_max` | `error` | 2 | 最新代码未审查,先运行 `review-code` |
22
- | `rev_max > code_max` | `error` | 2 | 数据状态异常,需要人工检查 |
23
22
  | 最新 review-code 为 Approved 且 0/0/0 | `refused` | 1 | 已通过,无需再次运行 `code-task` |
24
23
  | 最新 review-code 为 Approved 但有 major/minor | `fix` | 0 | 可选修复模式 |
25
24
  | 最新 review-code 为 Changes Requested | `fix` | 0 | 必需修复模式 |
26
25
  | 最新 review-code 为 Rejected | `refused` | 1 | 需要重新设计,不进入局部修复 |
27
26
 
27
+ > 上表 4 个 verdict 分支在 `rev_max >= code_max` 时命中,均以最新 `review-code-r{rev_max}` 的结论决定:
28
+ > - `rev_max == code_max`:AI 修复轮(`code-task` 产出代码后由 `review-code` 审查同号产物)。
29
+ > - `rev_max > code_max`:人工补审轮——PR 创建后维护者追加一轮 `review-code-r{N}` 审查既有最新代码。此时 `fix` 模式的 `next_round = code_max + 1`。
30
+ >
31
+ > 若最新 `review-code` 的 verdict 无法解析,仍返回 `error`(exit 2),作为保留的异常拦截。
32
+
28
33
  ## verdict 解析
29
34
 
30
35
  脚本支持中文和英文 review-code 报告:
@@ -84,20 +84,12 @@ function main() {
84
84
  return;
85
85
  }
86
86
 
87
- if (revMax > codeMax) {
88
- writeResult({
89
- mode: "error",
90
- code_max: codeMax,
91
- rev_max: revMax,
92
- verdict: null,
93
- next_round: null,
94
- next_artifact: null,
95
- review_artifact: artifactName("review-code", revMax),
96
- message: `Inconsistent state: review-code round ${revMax} > code round ${codeMax}. Manual inspection required.`
97
- }, 2);
98
- return;
99
- }
100
-
87
+ // human-supplemented review: after a PR is opened, a maintainer may append a
88
+ // review-code-r{N} round against the existing latest code, so rev_max > code_max.
89
+ // This is NOT corruption — defer to the latest review's verdict instead of erroring.
90
+ // rev_max === code_max (AI fix round) and rev_max > code_max (human review round)
91
+ // both fall through to the verdict dispatch below; fix mode uses next_round = code_max + 1.
92
+ // An unparsable verdict still returns error (exit 2) as the retained anomaly guard.
101
93
  const reviewArtifact = artifactName("review-code", revMax);
102
94
  const verdictResult = parseVerdict(path.join(resolvedTaskDir, reviewArtifact));
103
95
  if (!verdictResult.ok) {
@@ -1,6 +1,8 @@
1
1
  ---
2
2
  name: commit
3
- description: "Commit the current changes to Git"
3
+ description: >
4
+ Commit the current changes to Git.
5
+ Use when finished work needs to be turned into a Git commit.
4
6
  ---
5
7
 
6
8
  # Commit Changes
@@ -21,6 +23,16 @@ When updating related `task.md` frontmatter, read `.agents/rules/version-stamp.m
21
23
 
22
24
  > If `{task-id}` matches `^[#]?[0-9]+$` (bare numeric or `#`-prefixed), follow the "SKILL parameter resolver" section of `.agents/rules/task-short-id.md`; treat `{task-id}` as the resolved full `TASK-YYYYMMDD-HHMMSS` form for every downstream command.
23
25
 
26
+ ## Step Start: Write the started Marker
27
+
28
+ Before checking local modifications, append a started marker to task.md `## Activity Log` (same base action as this step's done entry plus a ` [started]` suffix, note `started`):
29
+
30
+ ```
31
+ - {YYYY-MM-DD HH:mm:ss±HH:MM} — **Commit [started]** by {agent} — started
32
+ ```
33
+
34
+ `ai task log` pairs it with the done entry written when the commit completes onto one row (in progress → done). Format and pairing rules: see the "Activity Log started / done dual-marker convention" in `.agents/rules/task-management.md`. Only write it when this task has a task.md (a bare commit with no task context may skip it).
35
+
24
36
  ## 1. Check Local Modifications (CRITICAL)
25
37
 
26
38
  Before any edit, inspect:
@@ -54,7 +66,27 @@ If this commit is associated with a task and a `review-code` artifact exists, re
54
66
  - After committing, write `last_reviewed_commit: <new_head>` to task.md frontmatter only when `pre_head == R` and `S == F`; otherwise do not advance that field
55
67
  - Do not scan backward to earlier Approved artifacts; the highest-round `review-code` artifact is the only authoritative source
56
68
 
57
- ## 5. Update Task Status When Applicable
69
+ ## 5. Push to the Existing PR When Applicable
70
+
71
+ After the commit is created, if the current branch already has an open Pull Request, push the new commit so the PR updates automatically. Otherwise keep the current behavior (the first push is still handled by `create-pr`). This is the push wrap-up of a user-initiated `commit`: it adds no extra commit and never pushes when there is no PR; it applies whether or not a task is associated.
72
+
73
+ > Detect whether the current branch has an open PR — and authenticate to the platform — per `.agents/rules/issue-pr-commands.md`; if that rule is unavailable or detection fails, follow the degradation below.
74
+
75
+ a. Detect whether the current branch (head) has an open PR per `.agents/rules/issue-pr-commands.md`.
76
+
77
+ b. On an open PR -> push the current branch:
78
+
79
+ ```bash
80
+ git push
81
+ ```
82
+
83
+ c. Safe degradation (never block an already completed `git commit`; only warn the user):
84
+ - Platform unavailable / unauthenticated / detection failed / no open PR -> do not push; continue.
85
+ - `git push` fails (needs `git pull --rebase`, no upstream, network error) -> keep the local commit and tell the user to push manually.
86
+
87
+ Fold the push outcome (pushed / skipped(no PR) / failed) into the next step's "Update Task Status" Activity Log note or user output.
88
+
89
+ ## 6. Update Task Status When Applicable
58
90
 
59
91
  Get the current time:
60
92
 
@@ -71,7 +103,7 @@ Append the Commit Activity Log entry and choose exactly one next-step case:
71
103
  - more work remains -> update task.md and stop
72
104
  - ready for review -> `review-code {task-id}`
73
105
 
74
- ## 6. Sync Issue Metadata When Applicable
106
+ ## 7. Sync Issue Metadata When Applicable
75
107
 
76
108
  When `{task-id}` exists and task.md contains a valid `issue_number`, sync the linked Issue `in:` labels and requirement checkboxes. Otherwise, skip this step.
77
109
 
@@ -81,7 +113,7 @@ When `{task-id}` exists and task.md contains a valid `issue_number`, sync the li
81
113
 
82
114
  Failure handling matches "Update Task Status When Applicable": warn, but do **not** block an already completed `git commit`.
83
115
 
84
- ## 7. Sync PR Summary When Applicable
116
+ ## 8. Sync PR Summary When Applicable
85
117
 
86
118
  When `{task-id}` exists and task.md contains a valid `pr_number`, refresh the PR summary comment marked with the PR summary marker defined in `.agents/rules/pr-sync.md` on the PR. Otherwise, skip this step.
87
119
 
@@ -91,7 +123,7 @@ When `{task-id}` exists and task.md contains a valid `pr_number`, refresh the PR
91
123
 
92
124
  Failure handling matches "Update Task Status When Applicable": warn, but do **not** block an already completed `git commit`.
93
125
 
94
- ## 8. Verification Gate
126
+ ## 9. Verification Gate
95
127
 
96
128
  If this operation is associated with `{task-id}`, run the verification gate to confirm task metadata and sync state. If there is no task context, skip this step.
97
129
 
@@ -1,6 +1,8 @@
1
1
  ---
2
2
  name: commit
3
- description: "提交当前变更到 Git"
3
+ description: >
4
+ 提交当前变更到 Git。
5
+ 当需要把已完成的工作落为一次 Git 提交时使用。
4
6
  ---
5
7
 
6
8
  # 提交代码
@@ -21,6 +23,16 @@ description: "提交当前变更到 Git"
21
23
 
22
24
  > 如果 `{task-id}` 入参匹配 `^[#]?[0-9]+$`(裸数字或带 `#` 前缀),先读取 `.agents/rules/task-short-id.md` 的「SKILL 入参解析」段执行解析;后续命令视 `{task-id}` 为解析后的全长 `TASK-YYYYMMDD-HHMMSS` 形式。
23
25
 
26
+ ## 步骤开始:写入 started 标记
27
+
28
+ 开始检查本地修改之前,向 task.md `## 活动日志` 追加一条 started 标记(与本步骤 done 条目同基名 + ` [started]` 后缀,note 用 `started`):
29
+
30
+ ```
31
+ - {YYYY-MM-DD HH:mm:ss±HH:MM} — **Commit [started]** by {agent} — started
32
+ ```
33
+
34
+ `ai task log` 会把它与提交完成时写入的 done 条目配对成一行(进行中 → 已完成)。格式与配对规则见 `.agents/rules/task-management.md` 的「Activity Log started / done 双标记约定」。仅当本任务存在 task.md 时写入(无任务上下文的纯提交可跳过)。
35
+
24
36
  ## 1. 检查本地修改(关键)
25
37
 
26
38
  在任何编辑前先检查:
@@ -54,7 +66,27 @@ git diff
54
66
  - 提交后仅当 `pre_head == R` 且 `S == F` 时,在 task.md frontmatter 写入 `last_reviewed_commit: <new_head>`;否则不推进该字段
55
67
  - 不向后扫描更早的 Approved 产物;最高轮 `review-code` 产物是唯一权威来源
56
68
 
57
- ## 5. 按需更新任务状态
69
+ ## 5. 推送到已有 PR(按需)
70
+
71
+ 提交完成后,如果当前分支已存在开放的 Pull Request,则把本次提交推送上去让 PR 自动更新;否则保持现状(首次推送仍由 `create-pr` 负责)。本步骤是用户已发起 `commit` 的推送收尾,不新增自动提交,也不在无 PR 时推送;与是否关联任务无关。
72
+
73
+ > 检测当前分支是否有开放 PR、以及平台认证,统一按 `.agents/rules/issue-pr-commands.md` 执行;该规则不可用或检测失败时,按下方降级处理。
74
+
75
+ a. 按 `.agents/rules/issue-pr-commands.md` 检测当前分支(head)是否存在开放 PR。
76
+
77
+ b. 命中开放 PR -> 推送当前分支:
78
+
79
+ ```bash
80
+ git push
81
+ ```
82
+
83
+ c. 安全降级(不阻塞已完成的 `git commit`,仅提示用户):
84
+ - 平台不可用 / 未认证 / 检测失败 / 未命中开放 PR -> 不推送,继续后续步骤。
85
+ - `git push` 失败(如需 `git pull --rebase`、无 upstream、网络异常)-> 保留本地提交,提示用户手动推送。
86
+
87
+ 把推送结果(pushed / skipped(no PR) / failed)并入下一步「更新任务状态」的 Activity Log 说明或用户输出。
88
+
89
+ ## 6. 按需更新任务状态
58
90
 
59
91
  获取当前时间:
60
92
 
@@ -71,7 +103,7 @@ date "+%Y-%m-%d %H:%M:%S%:z"
71
103
  - 还有后续工作 -> 更新 task.md 后停止
72
104
  - 准备审查 -> `review-code {task-id}`
73
105
 
74
- ## 6. 同步 Issue 元数据(按需)
106
+ ## 7. 同步 Issue 元数据(按需)
75
107
 
76
108
  当 `{task-id}` 存在且 task.md 包含有效 `issue_number` 时,同步 `in:` label 和需求复选框到关联 Issue;否则跳过。
77
109
 
@@ -81,7 +113,7 @@ date "+%Y-%m-%d %H:%M:%S%:z"
81
113
 
82
114
  失败处理与「按需更新任务状态」一致:警告但**不**阻塞已完成的 `git commit`。
83
115
 
84
- ## 7. 同步 PR 摘要(按需)
116
+ ## 8. 同步 PR 摘要(按需)
85
117
 
86
118
  当 `{task-id}` 存在且 task.md 包含有效 `pr_number` 时,刷新 PR 上由 `.agents/rules/pr-sync.md` 中定义的 PR 摘要评论标记对应的摘要评论;否则跳过。
87
119
 
@@ -91,7 +123,7 @@ date "+%Y-%m-%d %H:%M:%S%:z"
91
123
 
92
124
  失败处理与「按需更新任务状态」一致:警告但**不**阻塞已完成的 `git commit`。
93
125
 
94
- ## 8. 完成校验
126
+ ## 9. 完成校验
95
127
 
96
128
  如果本次操作关联了 `{task-id}`,运行完成校验,确认任务元数据和同步状态符合规范;如果没有任务上下文,跳过本步骤。
97
129
 
@@ -1,6 +1,8 @@
1
1
  ---
2
2
  name: complete-task
3
- description: "Mark a task as completed and archive it"
3
+ description: >
4
+ Mark a task as completed and archive it.
5
+ Use when a task's work is done and verified and you want to close and archive it.
4
6
  ---
5
7
 
6
8
  # Complete Task
@@ -30,6 +32,16 @@ Before the state check is complete, do not make external-state assertions such a
30
32
 
31
33
  > If `{task-id}` matches `^[#]?[0-9]+$` (bare numeric or `#`-prefixed), follow the "SKILL parameter resolver" section of `.agents/rules/task-short-id.md`; treat `{task-id}` as the resolved full `TASK-YYYYMMDD-HHMMSS` form for every downstream command.
32
34
 
35
+ ## Step Start: Write the started Marker
36
+
37
+ After confirming the task exists and before this round's first artifact action, append a started marker to task.md `## Activity Log` (same base action as this round's done entry plus a ` [started]` suffix, note `started`):
38
+
39
+ ```
40
+ - {YYYY-MM-DD HH:mm:ss±HH:MM} — **Complete Task [started]** by {agent} — started
41
+ ```
42
+
43
+ `ai task log` pairs it with the done entry written on completion onto one row (in progress → done). Format and pairing rules: see the "Activity Log started / done dual-marker convention" in `.agents/rules/task-management.md`.
44
+
33
45
  ## Steps
34
46
 
35
47
  ### 1. Verify Task Exists
@@ -1,6 +1,8 @@
1
1
  ---
2
2
  name: complete-task
3
- description: "标记任务完成并归档"
3
+ description: >
4
+ 标记任务完成并归档。
5
+ 当任务工作已完成并验证、需要收尾归档时使用。
4
6
  ---
5
7
 
6
8
  # 完成任务
@@ -30,6 +32,16 @@ tail .agents/workspace/active/{task-id}/task.md
30
32
 
31
33
  > 如果 `{task-id}` 入参匹配 `^[#]?[0-9]+$`(裸数字或带 `#` 前缀),先读取 `.agents/rules/task-short-id.md` 的「SKILL 入参解析」段执行解析;后续命令视 `{task-id}` 为解析后的全长 `TASK-YYYYMMDD-HHMMSS` 形式。
32
34
 
35
+ ## 步骤开始:写入 started 标记
36
+
37
+ 确认任务存在后、本轮第一个产出动作之前,向 task.md `## 活动日志` 追加一条 started 标记(与本轮 done 条目同基名 + ` [started]` 后缀,note 用 `started`):
38
+
39
+ ```
40
+ - {YYYY-MM-DD HH:mm:ss±HH:MM} — **Complete Task [started]** by {agent} — started
41
+ ```
42
+
43
+ `ai task log` 会把它与完成时写入的 done 条目配对成一行(进行中 → 已完成)。格式与配对规则见 `.agents/rules/task-management.md` 的「Activity Log started / done 双标记约定」。
44
+
33
45
  ## 执行步骤
34
46
  ### 1. 验证任务存在
35
47