@fitlab-ai/agent-infra 0.7.1 → 0.7.3

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 (165) hide show
  1. package/README.md +7 -1
  2. package/README.zh-CN.md +9 -3
  3. package/bin/cli.ts +11 -0
  4. package/dist/bin/cli.js +12 -0
  5. package/dist/lib/defaults.json +0 -1
  6. package/dist/lib/init.js +0 -3
  7. package/dist/lib/sandbox/commands/create.js +10 -2
  8. package/dist/lib/sandbox/commands/enter.js +17 -18
  9. package/dist/lib/sandbox/commands/list-running.js +56 -32
  10. package/dist/lib/sandbox/commands/ls.js +27 -24
  11. package/dist/lib/sandbox/commands/start.js +36 -0
  12. package/dist/lib/sandbox/index.js +15 -3
  13. package/dist/lib/sandbox/task-resolver.js +1 -1
  14. package/dist/lib/sandbox/tools.js +1 -1
  15. package/dist/lib/table.js +38 -0
  16. package/dist/lib/task/commands/ls.js +122 -0
  17. package/dist/lib/task/commands/show.js +135 -0
  18. package/dist/lib/task/frontmatter.js +32 -0
  19. package/dist/lib/task/index.js +41 -0
  20. package/dist/lib/task/short-id.js +90 -0
  21. package/dist/lib/update.js +25 -8
  22. package/lib/defaults.json +0 -1
  23. package/lib/init.ts +0 -10
  24. package/lib/sandbox/commands/create.ts +11 -2
  25. package/lib/sandbox/commands/enter.ts +40 -20
  26. package/lib/sandbox/commands/list-running.ts +65 -37
  27. package/lib/sandbox/commands/ls.ts +35 -27
  28. package/lib/sandbox/commands/start.ts +61 -0
  29. package/lib/sandbox/index.ts +15 -3
  30. package/lib/sandbox/task-resolver.ts +1 -1
  31. package/lib/sandbox/tools.ts +1 -1
  32. package/lib/table.ts +44 -0
  33. package/lib/task/commands/ls.ts +138 -0
  34. package/lib/task/commands/show.ts +139 -0
  35. package/lib/task/frontmatter.ts +30 -0
  36. package/lib/task/index.ts +44 -0
  37. package/lib/task/short-id.ts +107 -0
  38. package/lib/update.ts +28 -10
  39. package/package.json +1 -1
  40. package/templates/.agents/hooks/auto-resume.sh +104 -0
  41. package/templates/.agents/rules/create-issue.github.en.md +1 -1
  42. package/templates/.agents/rules/create-issue.github.zh-CN.md +1 -1
  43. package/templates/.agents/rules/milestone-inference.github.en.md +4 -1
  44. package/templates/.agents/rules/milestone-inference.github.zh-CN.md +4 -1
  45. package/templates/.agents/rules/next-step-output.en.md +62 -0
  46. package/templates/.agents/rules/next-step-output.zh-CN.md +62 -0
  47. package/templates/.agents/rules/pr-checks-commands.en.md +5 -0
  48. package/templates/.agents/rules/pr-checks-commands.github.en.md +62 -0
  49. package/templates/.agents/rules/pr-checks-commands.github.zh-CN.md +62 -0
  50. package/templates/.agents/rules/pr-checks-commands.zh-CN.md +5 -0
  51. package/templates/.agents/rules/pr-sync.github.en.md +7 -0
  52. package/templates/.agents/rules/pr-sync.github.zh-CN.md +7 -0
  53. package/templates/.agents/rules/task-short-id.en.md +54 -62
  54. package/templates/.agents/rules/task-short-id.zh-CN.md +35 -54
  55. package/templates/.agents/scripts/platform-adapters/platform-sync.github.js +17 -0
  56. package/templates/.agents/scripts/task-short-id.js +32 -189
  57. package/templates/.agents/skills/analyze-task/SKILL.en.md +10 -12
  58. package/templates/.agents/skills/analyze-task/SKILL.zh-CN.md +10 -12
  59. package/templates/.agents/skills/analyze-task/config/verify.en.json +1 -1
  60. package/templates/.agents/skills/analyze-task/config/verify.zh-CN.json +1 -1
  61. package/templates/.agents/skills/block-task/SKILL.en.md +13 -6
  62. package/templates/.agents/skills/block-task/SKILL.zh-CN.md +13 -6
  63. package/templates/.agents/skills/block-task/config/verify.json +1 -1
  64. package/templates/.agents/skills/cancel-task/SKILL.en.md +13 -6
  65. package/templates/.agents/skills/cancel-task/SKILL.zh-CN.md +13 -6
  66. package/templates/.agents/skills/cancel-task/config/verify.json +1 -1
  67. package/templates/.agents/skills/check-task/SKILL.en.md +12 -10
  68. package/templates/.agents/skills/check-task/SKILL.zh-CN.md +12 -10
  69. package/templates/.agents/skills/close-codescan/SKILL.en.md +13 -6
  70. package/templates/.agents/skills/close-codescan/SKILL.zh-CN.md +13 -6
  71. package/templates/.agents/skills/close-dependabot/SKILL.en.md +13 -6
  72. package/templates/.agents/skills/close-dependabot/SKILL.zh-CN.md +13 -6
  73. package/templates/.agents/skills/code-task/SKILL.en.md +10 -6
  74. package/templates/.agents/skills/code-task/SKILL.zh-CN.md +11 -6
  75. package/templates/.agents/skills/code-task/config/verify.en.json +2 -1
  76. package/templates/.agents/skills/code-task/config/verify.zh-CN.json +2 -1
  77. package/templates/.agents/skills/code-task/reference/fix-mode.en.md +10 -5
  78. package/templates/.agents/skills/code-task/reference/fix-mode.zh-CN.md +10 -5
  79. package/templates/.agents/skills/code-task/reference/output-template.en.md +3 -3
  80. package/templates/.agents/skills/code-task/reference/output-template.zh-CN.md +3 -3
  81. package/templates/.agents/skills/code-task/reference/report-template.en.md +8 -0
  82. package/templates/.agents/skills/code-task/reference/report-template.zh-CN.md +8 -0
  83. package/templates/.agents/skills/commit/SKILL.en.md +3 -4
  84. package/templates/.agents/skills/commit/SKILL.zh-CN.md +3 -4
  85. package/templates/.agents/skills/commit/reference/task-status-update.en.md +37 -29
  86. package/templates/.agents/skills/commit/reference/task-status-update.zh-CN.md +37 -29
  87. package/templates/.agents/skills/complete-task/SKILL.en.md +41 -4
  88. package/templates/.agents/skills/complete-task/SKILL.zh-CN.md +41 -4
  89. package/templates/.agents/skills/complete-task/config/verify.en.json +1 -1
  90. package/templates/.agents/skills/complete-task/config/verify.zh-CN.json +1 -1
  91. package/templates/.agents/skills/create-pr/SKILL.en.md +20 -11
  92. package/templates/.agents/skills/create-pr/SKILL.zh-CN.md +20 -11
  93. package/templates/.agents/skills/create-pr/config/verify.json +2 -1
  94. package/templates/.agents/skills/create-pr/reference/comment-publish.en.md +2 -1
  95. package/templates/.agents/skills/create-pr/reference/comment-publish.zh-CN.md +2 -1
  96. package/templates/.agents/skills/create-pr/reference/pr-body-template.en.md +3 -3
  97. package/templates/.agents/skills/create-pr/reference/pr-body-template.zh-CN.md +3 -3
  98. package/templates/.agents/skills/create-task/SKILL.en.md +17 -17
  99. package/templates/.agents/skills/create-task/SKILL.zh-CN.md +17 -17
  100. package/templates/.agents/skills/create-task/config/verify.json +1 -1
  101. package/templates/.agents/skills/import-codescan/SKILL.en.md +8 -8
  102. package/templates/.agents/skills/import-codescan/SKILL.zh-CN.md +8 -8
  103. package/templates/.agents/skills/import-codescan/config/verify.json +1 -1
  104. package/templates/.agents/skills/import-dependabot/SKILL.en.md +8 -8
  105. package/templates/.agents/skills/import-dependabot/SKILL.zh-CN.md +8 -8
  106. package/templates/.agents/skills/import-dependabot/config/verify.json +1 -1
  107. package/templates/.agents/skills/import-issue/SKILL.en.md +7 -7
  108. package/templates/.agents/skills/import-issue/SKILL.zh-CN.md +7 -7
  109. package/templates/.agents/skills/plan-task/SKILL.en.md +10 -12
  110. package/templates/.agents/skills/plan-task/SKILL.zh-CN.md +10 -12
  111. package/templates/.agents/skills/plan-task/config/verify.en.json +1 -1
  112. package/templates/.agents/skills/plan-task/config/verify.zh-CN.json +1 -1
  113. package/templates/.agents/skills/restore-task/SKILL.en.md +1 -1
  114. package/templates/.agents/skills/restore-task/SKILL.zh-CN.md +1 -1
  115. package/templates/.agents/skills/review-analysis/SKILL.en.md +4 -2
  116. package/templates/.agents/skills/review-analysis/SKILL.zh-CN.md +4 -2
  117. package/templates/.agents/skills/review-analysis/config/verify.en.json +3 -2
  118. package/templates/.agents/skills/review-analysis/config/verify.zh-CN.json +3 -2
  119. package/templates/.agents/skills/review-analysis/reference/output-templates.en.md +15 -15
  120. package/templates/.agents/skills/review-analysis/reference/output-templates.zh-CN.md +15 -15
  121. package/templates/.agents/skills/review-analysis/reference/report-template.en.md +7 -1
  122. package/templates/.agents/skills/review-analysis/reference/report-template.zh-CN.md +7 -1
  123. package/templates/.agents/skills/review-analysis/reference/review-criteria.en.md +2 -0
  124. package/templates/.agents/skills/review-analysis/reference/review-criteria.zh-CN.md +2 -0
  125. package/templates/.agents/skills/review-code/SKILL.en.md +5 -2
  126. package/templates/.agents/skills/review-code/SKILL.zh-CN.md +5 -2
  127. package/templates/.agents/skills/review-code/config/verify.en.json +3 -2
  128. package/templates/.agents/skills/review-code/config/verify.zh-CN.json +3 -2
  129. package/templates/.agents/skills/review-code/reference/output-templates.en.md +9 -9
  130. package/templates/.agents/skills/review-code/reference/output-templates.zh-CN.md +9 -9
  131. package/templates/.agents/skills/review-code/reference/report-template.en.md +7 -1
  132. package/templates/.agents/skills/review-code/reference/report-template.zh-CN.md +7 -1
  133. package/templates/.agents/skills/review-code/reference/review-criteria.en.md +2 -0
  134. package/templates/.agents/skills/review-code/reference/review-criteria.zh-CN.md +2 -0
  135. package/templates/.agents/skills/review-plan/SKILL.en.md +4 -2
  136. package/templates/.agents/skills/review-plan/SKILL.zh-CN.md +4 -2
  137. package/templates/.agents/skills/review-plan/config/verify.en.json +3 -2
  138. package/templates/.agents/skills/review-plan/config/verify.zh-CN.json +3 -2
  139. package/templates/.agents/skills/review-plan/reference/output-templates.en.md +15 -15
  140. package/templates/.agents/skills/review-plan/reference/output-templates.zh-CN.md +15 -15
  141. package/templates/.agents/skills/review-plan/reference/report-template.en.md +7 -1
  142. package/templates/.agents/skills/review-plan/reference/report-template.zh-CN.md +7 -1
  143. package/templates/.agents/skills/review-plan/reference/review-criteria.en.md +2 -0
  144. package/templates/.agents/skills/review-plan/reference/review-criteria.zh-CN.md +2 -0
  145. package/templates/.agents/skills/update-agent-infra/scripts/sync-templates.js +0 -1
  146. package/templates/.agents/skills/watch-pr/SKILL.en.md +131 -0
  147. package/templates/.agents/skills/watch-pr/SKILL.zh-CN.md +131 -0
  148. package/templates/.agents/skills/watch-pr/config/verify.json +22 -0
  149. package/templates/.agents/skills/watch-pr/reference/monitor-and-heal.en.md +43 -0
  150. package/templates/.agents/skills/watch-pr/reference/monitor-and-heal.zh-CN.md +43 -0
  151. package/templates/.agents/templates/task.en.md +1 -1
  152. package/templates/.agents/templates/task.zh-CN.md +1 -1
  153. package/templates/.agents/workflows/bug-fix.en.yaml +7 -5
  154. package/templates/.agents/workflows/bug-fix.zh-CN.yaml +6 -5
  155. package/templates/.agents/workflows/feature-development.en.yaml +7 -5
  156. package/templates/.agents/workflows/feature-development.zh-CN.yaml +6 -5
  157. package/templates/.agents/workflows/refactoring.en.yaml +7 -5
  158. package/templates/.agents/workflows/refactoring.zh-CN.yaml +6 -5
  159. package/templates/.claude/commands/watch-pr.en.md +8 -0
  160. package/templates/.claude/commands/watch-pr.zh-CN.md +8 -0
  161. package/templates/.claude/settings.json +11 -0
  162. package/templates/.gemini/commands/_project_/watch-pr.en.toml +8 -0
  163. package/templates/.gemini/commands/_project_/watch-pr.zh-CN.toml +8 -0
  164. package/templates/.opencode/commands/watch-pr.en.md +11 -0
  165. package/templates/.opencode/commands/watch-pr.zh-CN.md +11 -0
@@ -43,9 +43,9 @@
43
43
  - 审查报告:.agents/workspace/active/{task-id}/{review-artifact}
44
44
 
45
45
  下一步 - 修复问题后提交(推荐):
46
- - Claude Code / OpenCode:/code-task {task-id}
47
- - Gemini CLI:/agent-infra:code-task {task-id}
48
- - Codex CLI:$code-task {task-id}
46
+ - Claude Code / OpenCode:/code-task {task-ref}
47
+ - Gemini CLI:/agent-infra:code-task {task-ref}
48
+ - Codex CLI:$code-task {task-ref}
49
49
 
50
50
  或直接提交(跳过修复):
51
51
  - Claude Code / OpenCode:/commit
@@ -64,9 +64,9 @@
64
64
  - 审查报告:.agents/workspace/active/{task-id}/{review-artifact}
65
65
 
66
66
  下一步 - 修复问题:
67
- - Claude Code / OpenCode:/code-task {task-id}
68
- - Gemini CLI:/agent-infra:code-task {task-id}
69
- - Codex CLI:$code-task {task-id}
67
+ - Claude Code / OpenCode:/code-task {task-ref}
68
+ - Gemini CLI:/agent-infra:code-task {task-ref}
69
+ - Codex CLI:$code-task {task-ref}
70
70
 
71
71
  [当 env-blocked > 0 时,在最后附加一行:]
72
72
  提醒:env-blocked 项需在 PR description 的「待人工验证」清单中承接,不应触发 /code-task。
@@ -80,9 +80,9 @@
80
80
  - 审查报告:.agents/workspace/active/{task-id}/{review-artifact}
81
81
 
82
82
  下一步 - 重新设计技术方案:
83
- - Claude Code / OpenCode:/plan-task {task-id}
84
- - Gemini CLI:/agent-infra:plan-task {task-id}
85
- - Codex CLI:$plan-task {task-id}
83
+ - Claude Code / OpenCode:/plan-task {task-ref}
84
+ - Gemini CLI:/agent-infra:plan-task {task-ref}
85
+ - Codex CLI:$plan-task {task-ref}
86
86
 
87
87
  > 注意:Rejected 表示实现方向需要整体重做,不是局部修复。`code-task/scripts/detect-mode.js` 分支 #7 会拒绝直接 `/code-task`,要求先重新方案设计。
88
88
 
@@ -61,7 +61,7 @@ Use this template when writing `review-code.md` or `review-code-r{N}.md`.
61
61
 
62
62
  ## Evidence
63
63
 
64
- > Pair each "I verified X" claim with the corresponding raw tool output; the gate only checks that this section exists and at least one `$ ` line is present.
64
+ > Pair each "I verified X" claim with the corresponding raw tool output; the gate only checks that this section exists and at least one `$ ` line is present. Every Blocker must be backed by a reproducible command (rg/grep/sed/nl) and its raw output; a judgment that cannot be reproduced must be downgraded or moved to Self-Doubt.
65
65
 
66
66
  - Claim: {verified claim}
67
67
  ```text
@@ -69,6 +69,12 @@ $ {command}
69
69
  {raw output}
70
70
  ```
71
71
 
72
+ ## Self-Doubt
73
+
74
+ > Explicitly declare conclusions, inferences, and assumptions in this review that were **not directly verified**; downstream can rebut them on this basis. Write "None" if there are none.
75
+
76
+ - {an unverified conclusion or inference; note why it was not verified and the impact if it is overturned}
77
+
72
78
  ## Highlights
73
79
 
74
80
  - {what went well}
@@ -62,7 +62,7 @@
62
62
 
63
63
  ## 证据原文
64
64
 
65
- > 每条“我验证了 X”断言都要配对对应 tool output 原文;gate 仅校验本段存在和至少一行 `$ `。
65
+ > 每条“我验证了 X”断言都要配对对应 tool output 原文;gate 仅校验本段存在和至少一行 `$ `。每条 Blocker 必须配可复现命令(rg/grep/sed/nl)及其原文;无法复现的判断须降级或移入「自我质疑」。
66
66
 
67
67
  - 断言:{verified claim}
68
68
  ```text
@@ -70,6 +70,12 @@ $ {command}
70
70
  {raw output}
71
71
  ```
72
72
 
73
+ ## 自我质疑
74
+
75
+ > 显式声明本轮审查中**未直接验证**的结论、推断项与所作假设;下游据此可反驳。无则写「(无)」。
76
+
77
+ - {未直接验证的结论或推断;说明为何未验证、若被推翻的影响}
78
+
73
79
  ## 亮点
74
80
 
75
81
  - {what went well}
@@ -14,11 +14,13 @@ Follow the `code-review` step in `.agents/workflows/feature-development.yaml`.
14
14
  - [ ] Performance and security risks
15
15
  - [ ] Comments and documentation
16
16
  - [ ] Consistency with the approved technical plan
17
+ - [ ] Every blocker is backed by reproducible grep/sed/nl evidence; conclusions not directly verified are declared under Self-Doubt
17
18
 
18
19
  **Common anti-examples**:
19
20
  - Checking only whether tests pass without reading the actual diff
20
21
  - Treating wording preferences as reproducible code problems
21
22
  - Misclassifying environment-limited verification gaps as blockers
23
+ - Asserting a `file:line` or behavior from memory or impression without verifying via rg/nl
22
24
 
23
25
  ## Common Review Principles
24
26
 
@@ -14,11 +14,13 @@
14
14
  - [ ] 性能与安全风险
15
15
  - [ ] 代码注释和文档
16
16
  - [ ] 与已批准技术方案的一致性
17
+ - [ ] 每条 blocker 都配可复现的 grep/sed/nl 证据,未直接验证的结论已在「自我质疑」声明
17
18
 
18
19
  **常见反例**:
19
20
  - 只检查测试是否通过,没有阅读实际 diff
20
21
  - 用自然语言措辞偏好替代可复现的代码问题
21
22
  - 把环境缺失导致无法验证的事项误归类为 blocker
23
+ - 凭印象或记忆断言 `file:line`/行为,没有用 rg/nl 复核就下结论
22
24
 
23
25
  ## 通用审查原则
24
26
 
@@ -28,7 +28,7 @@ tail .agents/workspace/active/{task-id}/task.md
28
28
 
29
29
  ## Task id short ref
30
30
 
31
- > If `{task-id}` begins with `#`, 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.
31
+ > 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
32
 
33
33
  ## Steps
34
34
 
@@ -65,7 +65,7 @@ date "+%Y-%m-%d %H:%M:%S%:z"
65
65
  ```
66
66
 
67
67
  Set `current_step` to `technical-design-review`, refresh task metadata, and append:
68
- `- {YYYY-MM-DD HH:mm:ss±HH:MM} — **Plan Review (Round {N})** by {agent} — Verdict: {Approved/Changes Requested/Rejected}, blockers: {n}, major: {n}, minor: {n}[ (+ {n} env-blocked)] → {review-artifact}`
68
+ `- {YYYY-MM-DD HH:mm:ss±HH:MM} — **Review Plan (Round {N})** by {agent} — Verdict: {Approved/Changes Requested/Rejected}, blockers: {n}, major: {n}, minor: {n}[ (+ {n} env-blocked)] → {review-artifact}`
69
69
 
70
70
  If task.md has a valid `issue_number`, read `.agents/rules/issue-sync.md`, sync the task comment, and publish the `{review-artifact}` comment.
71
71
 
@@ -78,3 +78,5 @@ node .agents/scripts/validate-artifact.js gate review-plan .agents/workspace/act
78
78
  ### 8. Tell the User
79
79
 
80
80
  Use the conclusion branch in `reference/output-templates.md` and show all TUI command formats.
81
+
82
+ > Before rendering the final output, read `.agents/rules/next-step-output.md` and apply both of its rules: (1) render `{task-ref}` in the "Next steps" commands as the current task's short id `#NN` (see that file for lookup and fallback), while other `{task-id}` placeholders (report titles, paths) keep the full TASK-id form; (2) append the `Completed at` line as the very last line of the user-facing output (this applies to every user-facing output — success, error, and early-return paths alike, not only the success path).
@@ -30,7 +30,7 @@ tail .agents/workspace/active/{task-id}/task.md
30
30
 
31
31
  ## 任务入参短号别名
32
32
 
33
- > 如果 `{task-id}` 入参以 `#` 开头,先读取 `.agents/rules/task-short-id.md` 的「SKILL 入参解析」段执行解析;后续命令视 `{task-id}` 为解析后的全长 `TASK-YYYYMMDD-HHMMSS` 形式。
33
+ > 如果 `{task-id}` 入参匹配 `^[#]?[0-9]+$`(裸数字或带 `#` 前缀),先读取 `.agents/rules/task-short-id.md` 的「SKILL 入参解析」段执行解析;后续命令视 `{task-id}` 为解析后的全长 `TASK-YYYYMMDD-HHMMSS` 形式。
34
34
 
35
35
  ## 执行步骤
36
36
  ### 1. 验证前置条件
@@ -76,7 +76,7 @@ date "+%Y-%m-%d %H:%M:%S%:z"
76
76
  - `updated_at`:{当前时间}
77
77
  - `agent_infra_version`:按 `.agents/rules/version-stamp.md` 取值
78
78
  - 追加:
79
- `- {YYYY-MM-DD HH:mm:ss±HH:MM} — **Plan Review (Round {N})** by {agent} — Verdict: {Approved/Changes Requested/Rejected}, blockers: {n}, major: {n}, minor: {n}[ (+ {n} env-blocked)] → {review-artifact}`
79
+ `- {YYYY-MM-DD HH:mm:ss±HH:MM} — **Review Plan (Round {N})** by {agent} — Verdict: {Approved/Changes Requested/Rejected}, blockers: {n}, major: {n}, minor: {n}[ (+ {n} env-blocked)] → {review-artifact}`
80
80
 
81
81
  如果 task.md 中存在有效的 `issue_number`,执行前先读取 `.agents/rules/issue-sync.md`,完成 upstream 仓库检测和权限检测,然后同步 task 评论并发布 `{review-artifact}` 评论。
82
82
 
@@ -92,6 +92,8 @@ node .agents/scripts/validate-artifact.js gate review-plan .agents/workspace/act
92
92
 
93
93
  按 `reference/output-templates.md` 的结论分支输出,并展示所有 TUI 的下一步命令。
94
94
 
95
+ > 渲染最终输出前先读取 `.agents/rules/next-step-output.md` 并落实其两类规则:(1) 「下一步」命令的 `{task-ref}` 渲染为当前任务短号 `#NN`(取值与回退见该文件),其他 `{task-id}` 占位(报告标题、路径)保持完整 TASK-id 形式;(2) 在面向用户输出的绝对最后一行追加 `Completed at` 收尾行(成功、错误、早退等任何面向用户输出都适用,不限于校验通过的成功态)。
96
+
95
97
  ## 完成检查清单
96
98
 
97
99
  - [ ] 已审查最新方案上下文
@@ -23,7 +23,8 @@
23
23
  "Environment-Blocked Findings",
24
24
  "Conclusion and Recommendations",
25
25
  "State Check",
26
- "Evidence"
26
+ "Evidence",
27
+ "Self-Doubt"
27
28
  ],
28
29
  "required_patterns": [
29
30
  "^### Approval Decision$",
@@ -32,7 +33,7 @@
32
33
  "freshness_minutes": 30
33
34
  },
34
35
  "activity-log": {
35
- "expected_action_pattern": "Plan Review \\(Round \\d+\\)",
36
+ "expected_action_pattern": "(Review Plan|Plan Review) \\(Round \\d+\\)",
36
37
  "freshness_minutes": 30
37
38
  },
38
39
  "platform-sync": {
@@ -23,7 +23,8 @@
23
23
  "环境性遗留",
24
24
  "结论与建议",
25
25
  "状态核对",
26
- "证据原文"
26
+ "证据原文",
27
+ "自我质疑"
27
28
  ],
28
29
  "required_patterns": [
29
30
  "^### 审查决定$",
@@ -32,7 +33,7 @@
32
33
  "freshness_minutes": 30
33
34
  },
34
35
  "activity-log": {
35
- "expected_action_pattern": "Plan Review \\(Round \\d+\\)",
36
+ "expected_action_pattern": "(Review Plan|Plan Review) \\(Round \\d+\\)",
36
37
  "freshness_minutes": 30
37
38
  },
38
39
  "platform-sync": {
@@ -25,9 +25,9 @@ Task {task-id} technical plan review completed. Verdict: approved.
25
25
  [- Review report: .agents/workspace/active/{task-id}/{review-artifact}]
26
26
 
27
27
  Next step - write code:
28
- - Claude Code / OpenCode: /code-task {task-id}
29
- - Gemini CLI: /agent-infra:code-task {task-id}
30
- - Codex CLI: $code-task {task-id}
28
+ - Claude Code / OpenCode: /code-task {task-ref}
29
+ - Gemini CLI: /agent-infra:code-task {task-ref}
30
+ - Codex CLI: $code-task {task-ref}
31
31
 
32
32
  [When env-blocked > 0, append:]
33
33
  Reminder: env-blocked items belong in the PR description manual verification checklist and should not trigger /plan-task.
@@ -41,14 +41,14 @@ Task {task-id} technical plan review completed. Verdict: approved.
41
41
  - Review report: .agents/workspace/active/{task-id}/{review-artifact}
42
42
 
43
43
  Next step - revise plan before coding (recommended):
44
- - Claude Code / OpenCode: /plan-task {task-id}
45
- - Gemini CLI: /agent-infra:plan-task {task-id}
46
- - Codex CLI: $plan-task {task-id}
44
+ - Claude Code / OpenCode: /plan-task {task-ref}
45
+ - Gemini CLI: /agent-infra:plan-task {task-ref}
46
+ - Codex CLI: $plan-task {task-ref}
47
47
 
48
48
  Or proceed directly to coding:
49
- - Claude Code / OpenCode: /code-task {task-id}
50
- - Gemini CLI: /agent-infra:code-task {task-id}
51
- - Codex CLI: $code-task {task-id}
49
+ - Claude Code / OpenCode: /code-task {task-ref}
50
+ - Gemini CLI: /agent-infra:code-task {task-ref}
51
+ - Codex CLI: $code-task {task-ref}
52
52
 
53
53
  [When env-blocked > 0, append:]
54
54
  Reminder: env-blocked items belong in the PR description manual verification checklist and should not trigger /plan-task.
@@ -62,9 +62,9 @@ Task {task-id} technical plan review completed. Verdict: changes requested.
62
62
  - Review report: .agents/workspace/active/{task-id}/{review-artifact}
63
63
 
64
64
  Next step - revise technical plan:
65
- - Claude Code / OpenCode: /plan-task {task-id}
66
- - Gemini CLI: /agent-infra:plan-task {task-id}
67
- - Codex CLI: $plan-task {task-id}
65
+ - Claude Code / OpenCode: /plan-task {task-ref}
66
+ - Gemini CLI: /agent-infra:plan-task {task-ref}
67
+ - Codex CLI: $plan-task {task-ref}
68
68
 
69
69
  [When env-blocked > 0, append:]
70
70
  Reminder: env-blocked items belong in the PR description manual verification checklist and should not trigger /plan-task.
@@ -78,9 +78,9 @@ Task {task-id} technical plan review completed. Verdict: rejected, redesign requ
78
78
  - Review report: .agents/workspace/active/{task-id}/{review-artifact}
79
79
 
80
80
  Next step - redesign:
81
- - Claude Code / OpenCode: /plan-task {task-id}
82
- - Gemini CLI: /agent-infra:plan-task {task-id}
83
- - Codex CLI: $plan-task {task-id}
81
+ - Claude Code / OpenCode: /plan-task {task-ref}
82
+ - Gemini CLI: /agent-infra:plan-task {task-ref}
83
+ - Codex CLI: $plan-task {task-ref}
84
84
 
85
85
  [When env-blocked > 0, append:]
86
86
  Reminder: env-blocked items belong in the PR description manual verification checklist and should not trigger /plan-task.
@@ -25,9 +25,9 @@
25
25
  [- 审查报告:.agents/workspace/active/{task-id}/{review-artifact}]
26
26
 
27
27
  下一步 - 编写代码:
28
- - Claude Code / OpenCode:/code-task {task-id}
29
- - Gemini CLI:/agent-infra:code-task {task-id}
30
- - Codex CLI:$code-task {task-id}
28
+ - Claude Code / OpenCode:/code-task {task-ref}
29
+ - Gemini CLI:/agent-infra:code-task {task-ref}
30
+ - Codex CLI:$code-task {task-ref}
31
31
 
32
32
  [当 env-blocked > 0 时,在最后附加一行:]
33
33
  提醒:env-blocked 项需在 PR description 的「待人工验证」清单中承接,不应触发 /plan-task。
@@ -41,14 +41,14 @@
41
41
  - 审查报告:.agents/workspace/active/{task-id}/{review-artifact}
42
42
 
43
43
  下一步 - 修订方案后编码(推荐):
44
- - Claude Code / OpenCode:/plan-task {task-id}
45
- - Gemini CLI:/agent-infra:plan-task {task-id}
46
- - Codex CLI:$plan-task {task-id}
44
+ - Claude Code / OpenCode:/plan-task {task-ref}
45
+ - Gemini CLI:/agent-infra:plan-task {task-ref}
46
+ - Codex CLI:$plan-task {task-ref}
47
47
 
48
48
  或直接进入编码:
49
- - Claude Code / OpenCode:/code-task {task-id}
50
- - Gemini CLI:/agent-infra:code-task {task-id}
51
- - Codex CLI:$code-task {task-id}
49
+ - Claude Code / OpenCode:/code-task {task-ref}
50
+ - Gemini CLI:/agent-infra:code-task {task-ref}
51
+ - Codex CLI:$code-task {task-ref}
52
52
 
53
53
  [当 env-blocked > 0 时,在最后附加一行:]
54
54
  提醒:env-blocked 项需在 PR description 的「待人工验证」清单中承接,不应触发 /plan-task。
@@ -62,9 +62,9 @@
62
62
  - 审查报告:.agents/workspace/active/{task-id}/{review-artifact}
63
63
 
64
64
  下一步 - 修订技术方案:
65
- - Claude Code / OpenCode:/plan-task {task-id}
66
- - Gemini CLI:/agent-infra:plan-task {task-id}
67
- - Codex CLI:$plan-task {task-id}
65
+ - Claude Code / OpenCode:/plan-task {task-ref}
66
+ - Gemini CLI:/agent-infra:plan-task {task-ref}
67
+ - Codex CLI:$plan-task {task-ref}
68
68
 
69
69
  [当 env-blocked > 0 时,在最后附加一行:]
70
70
  提醒:env-blocked 项需在 PR description 的「待人工验证」清单中承接,不应触发 /plan-task。
@@ -78,9 +78,9 @@
78
78
  - 审查报告:.agents/workspace/active/{task-id}/{review-artifact}
79
79
 
80
80
  下一步 - 重新设计:
81
- - Claude Code / OpenCode:/plan-task {task-id}
82
- - Gemini CLI:/agent-infra:plan-task {task-id}
83
- - Codex CLI:$plan-task {task-id}
81
+ - Claude Code / OpenCode:/plan-task {task-ref}
82
+ - Gemini CLI:/agent-infra:plan-task {task-ref}
83
+ - Codex CLI:$plan-task {task-ref}
84
84
 
85
85
  [当 env-blocked > 0 时,在最后附加一行:]
86
86
  提醒:env-blocked 项需在 PR description 的「待人工验证」清单中承接,不应触发 /plan-task。
@@ -61,7 +61,7 @@ Use this template when writing `review-plan.md` or `review-plan-r{N}.md`.
61
61
 
62
62
  ## Evidence
63
63
 
64
- > Pair each "I verified X" claim with the corresponding raw tool output; the gate only checks that this section exists and at least one `$ ` line is present.
64
+ > Pair each "I verified X" claim with the corresponding raw tool output; the gate only checks that this section exists and at least one `$ ` line is present. Every Blocker must be backed by a reproducible command (rg/grep/sed/nl) and its raw output; a judgment that cannot be reproduced must be downgraded or moved to Self-Doubt.
65
65
 
66
66
  - Claim: {verified claim}
67
67
  ```text
@@ -69,6 +69,12 @@ $ {command}
69
69
  {raw output}
70
70
  ```
71
71
 
72
+ ## Self-Doubt
73
+
74
+ > Explicitly declare conclusions, inferences, and assumptions in this review that were **not directly verified**; downstream can rebut them on this basis. Write "None" if there are none.
75
+
76
+ - {an unverified conclusion or inference; note why it was not verified and the impact if it is overturned}
77
+
72
78
  ## Highlights
73
79
 
74
80
  - {what went well}
@@ -62,7 +62,7 @@
62
62
 
63
63
  ## 证据原文
64
64
 
65
- > 每条“我验证了 X”断言都要配对对应 tool output 原文;gate 仅校验本段存在和至少一行 `$ `。
65
+ > 每条“我验证了 X”断言都要配对对应 tool output 原文;gate 仅校验本段存在和至少一行 `$ `。每条 Blocker 必须配可复现命令(rg/grep/sed/nl)及其原文;无法复现的判断须降级或移入「自我质疑」。
66
66
 
67
67
  - 断言:{verified claim}
68
68
  ```text
@@ -70,6 +70,12 @@ $ {command}
70
70
  {raw output}
71
71
  ```
72
72
 
73
+ ## 自我质疑
74
+
75
+ > 显式声明本轮审查中**未直接验证**的结论、推断项与所作假设;下游据此可反驳。无则写「(无)」。
76
+
77
+ - {未直接验证的结论或推断;说明为何未验证、若被推翻的影响}
78
+
73
79
  ## 亮点
74
80
 
75
81
  - {what went well}
@@ -13,11 +13,13 @@ Follow the `design-review` step in `.agents/workflows/feature-development.yaml`.
13
13
  - [ ] Test strategy covers critical paths, regression risks, and edge cases
14
14
  - [ ] Risks, migration, rollback, or compatibility handling are sufficient
15
15
  - [ ] The plan avoids over-design and unrelated scope expansion
16
+ - [ ] Every blocker is backed by reproducible grep/sed/nl evidence; conclusions not directly verified are declared under Self-Doubt
16
17
 
17
18
  **Common anti-examples**:
18
19
  - Saying "modify related code" without executable steps and verification points
19
20
  - Ignoring risks or constraints listed in the analysis
20
21
  - Introducing unnecessary abstractions, configuration, or frameworks for a single-use requirement
22
+ - Asserting a `file:line` or behavior from memory or impression without verifying via rg/nl
21
23
 
22
24
  ## Common Review Principles
23
25
 
@@ -13,11 +13,13 @@
13
13
  - [ ] 测试策略是否覆盖关键路径、回归风险和边界情况
14
14
  - [ ] 风险、迁移、回滚或兼容性处理是否充分
15
15
  - [ ] 方案是否避免过度设计和无关扩张
16
+ - [ ] 每条 blocker 都配可复现的 grep/sed/nl 证据,未直接验证的结论已在「自我质疑」声明
16
17
 
17
18
  **常见反例**:
18
19
  - 方案只写“修改相关代码”,没有可执行步骤和验证点
19
20
  - 设计没有回应分析中列出的风险或约束
20
21
  - 为单次需求引入不必要的新抽象、配置或框架
22
+ - 凭印象或记忆断言 `file:line`/行为,没有用 rg/nl 复核就下结论
21
23
 
22
24
  ## 通用审查原则
23
25
 
@@ -23,7 +23,6 @@ const DEFAULTS = {
23
23
  "platform": {
24
24
  "type": "github"
25
25
  },
26
- "requiresPullRequest": true,
27
26
  "sandbox": {
28
27
  "engine": null,
29
28
  "runtimes": [
@@ -0,0 +1,131 @@
1
+ ---
2
+ name: watch-pr
3
+ description: "Watch a PR's required checks and self-heal on failure"
4
+ ---
5
+
6
+ # Watch Pull Request
7
+
8
+ After `create-pr`, continuously watch the PR's required CI checks: when everything is green, guide toward merge; when a required check fails, pull the logs, fix and push locally, then re-poll; when the fix attempt limit is reached or the failure is non-code / unlocatable, stop and ask the user for help. Platform-specific commands live in `.agents/rules/pr-checks-commands.md`; this skill body stays platform-agnostic.
9
+
10
+ ## Behavior Boundaries / Key Rules
11
+
12
+ - Only watch + self-heal the current PR's required checks; make no changes unrelated to the failing check.
13
+ - Self-heal modifies code and `git push`es to the PR branch, but **local tests for the affected area must pass before pushing**; fix attempts have a hard cap (default 2); only self-heal locatable code-layer failures (lint / format / test / type / build), and always route non-code failures (network / permission / external service / flaky) to the help exit.
14
+ - The help exit is "produce-then-stop": end this round, output the blocker explanation, and wait for the user to trigger the next step — **never** ask mid-flow.
15
+ - Bare numbers / `#NN` / `TASK-id` arguments are always resolved as task short ids (see `.agents/rules/task-short-id.md`); a PR number is passed only via `--pr <number>` / a PR URL / omission (current branch), never reusing the bare-number syntax.
16
+ - After running this skill (task-anchored path), you must update task.md.
17
+
18
+ Version stamp rule: before creating or updating `task.md` frontmatter, read `.agents/rules/version-stamp.md` and write or refresh `agent_infra_version`.
19
+
20
+ ## Task Argument Short-ID Alias
21
+
22
+ > If the `{task-id}` argument matches `^[#]?[0-9]+$` (a bare number or `#`-prefixed), first read the "SKILL argument parsing" section of `.agents/rules/task-short-id.md` to resolve it; subsequent commands treat `{task-id}` as the resolved full `TASK-YYYYMMDD-HHMMSS` form.
23
+
24
+ ## Steps
25
+
26
+ ### 1. Resolve Arguments
27
+
28
+ Resolve the target PR number `{pr#}` and an optional `{task-id}` via these deterministic branches:
29
+
30
+ - Scenario A (argument omitted): use the current branch's PR number per `.agents/rules/pr-checks-commands.md`; then determine `{task-id}` via "Reverse-lookup task" below.
31
+ - Scenario B (`#NN` / bare number / `TASK-id`, **task-anchored primary path**): when matching `^[#]?[0-9]+$`, resolve to the full `{task-id}` via "Task Argument Short-ID Alias" (on failure pass through the exit code; do not rewrite error handling); a `TASK-id` is used directly. Read `.agents/workspace/active/{task-id}/task.md` for `pr_number` as `{pr#}`; if `pr_number` is empty, follow "Error Handling" to prompt running `create-pr` first, then stop.
32
+ - Scenario C (`--pr <number>` or a PR URL): use that PR number directly as `{pr#}`; then determine `{task-id}` via "Reverse-lookup task".
33
+ - Reverse-lookup task (scenarios A / C): search `.agents/workspace/active/*/task.md` for a task whose `pr_number == {pr#}`; on a hit, take that `{task-id}` (task-anchored); on a miss, enter the "watch-only" degraded path (no `{task-id}`, skip steps 5/6).
34
+
35
+ ### 2. Watch Required Checks
36
+
37
+ Before running this step, read `reference/monitor-and-heal.md` and `.agents/rules/pr-checks-commands.md`.
38
+
39
+ Using the watch command in `.agents/rules/pr-checks-commands.md`, poll `{pr#}`'s required checks (with an overall time cap, default 30 minutes), and classify the outcome per the "Outcome Classification" of `reference/monitor-and-heal.md` into the "all green" / "failure" / "pending" scenarios, routing to step 7 (green exit), step 3 (self-heal), or step 4 (help exit) respectively.
40
+
41
+ ### 3. Failure Self-Heal Loop
42
+
43
+ Before running this step, read the "Self-Heal Decision Tree" of `reference/monitor-and-heal.md` and "Resolve a Failing Run id and Pull Logs" of `.agents/rules/pr-checks-commands.md`.
44
+
45
+ For a failing check: first deterministically resolve its failing run and pull the failure logs per the rule, then classify the failure; only when it is a locatable code-layer failure, make a minimal local fix, run the relevant tests until they pass, then **stage, commit, and push the fix** (`git add` only the related files → `git commit` per `.agents/rules/commit-and-pr.md` → `git push` to the current PR branch, recording the commit SHA), and return to step 2 to re-watch. Count fix attempts; on reaching the hard cap (default 2) or when the run is unlocatable, go to step 4.
46
+
47
+ ### 4. Help Exit (Produce-Then-Stop)
48
+
49
+ When self-heal hits the cap, the failure is non-code, the run id is unlocatable, or step 2 times out while pending, stop this round and summarize for the user: the blocker, the fixes attempted (including each fix commit), and the relevant failing job and run/log links (report shape in the "Help report template" of `reference/monitor-and-heal.md`). Do **not** render a next-step command; wait for the user. Then, on the task-anchored path, run steps 5/6 to record this round's outcome.
50
+
51
+ ### 5. Update Task State
52
+
53
+ > Task-anchored path only; the "watch-only" degraded path skips this step and step 6.
54
+
55
+ Get the current time:
56
+
57
+ ```bash
58
+ date "+%Y-%m-%d %H:%M:%S%:z"
59
+ ```
60
+
61
+ Update `.agents/workspace/active/{task-id}/task.md`:
62
+ - `assigned_to`: {current agent}
63
+ - `updated_at`: {current time}
64
+ - `agent_infra_version`: per `.agents/rules/version-stamp.md`
65
+ - **Do not change** `pr_status` (keep `created`) or `current_step`
66
+ - **Append** to `## Activity Log` (do not overwrite prior entries; `{N}` = number of existing Watch PR entries for this task + 1):
67
+ ```
68
+ - {YYYY-MM-DD HH:mm:ss±HH:MM} — **Watch PR (Round {N})** by {agent} — {green: all required checks green / blocked: blocked: {summary}}
69
+ ```
70
+
71
+ ### 6. Verification Gate
72
+
73
+ > Task-anchored path only.
74
+
75
+ Run the verification gate:
76
+
77
+ ```bash
78
+ node .agents/scripts/validate-artifact.js gate watch-pr .agents/workspace/active/{task-id} --format text
79
+ ```
80
+
81
+ Handle the result:
82
+ - exit code 0 (all passed) -> continue to "Inform User"
83
+ - exit code 1 (verification failed) -> fix per the output and re-run the gate
84
+ - exit code 2 (network interruption) -> stop and tell the user manual intervention is needed
85
+
86
+ Keep the gate output in your reply as the verification evidence. Without current gate output, do not declare completion.
87
+
88
+ ### 7. Inform User
89
+
90
+ > On the task-anchored path, execute this step only after the gate passes.
91
+
92
+ > **IMPORTANT**: All TUI command formats listed below must be output in full. Do not show only the format for the current AI agent. If `.agents/.airc.json` configures custom TUIs (via `customTUIs`), read each tool's `name` and `invoke`, then add the matching command line in the same format (`${skillName}` becomes the skill name and `${projectName}` becomes the project name). Before rendering the final output, read `.agents/rules/next-step-output.md` and apply both of its rules: (1) render `{task-ref}` in the "Next steps" commands as the short id `#NN` (falling back to the full TASK-id when unallocated or released); (2) append the `Completed at` line as the very last line of the user-facing output (this applies to every user-facing output — success, error, and early-return paths alike, not only the success path).
93
+
94
+ Output per scenario:
95
+ - "All green" + task-anchored: state that all required checks passed and the PR is ready to merge, then render the next step from the template below (`{task-ref}` becomes the short id):
96
+
97
+ ```
98
+ Next step - Complete and archive the task:
99
+ - Claude Code / OpenCode: /complete-task {task-ref}
100
+ - Gemini CLI: /agent-infra:complete-task {task-ref}
101
+ - Codex CLI: $complete-task {task-ref}
102
+ ```
103
+
104
+ - "All green" + watch-only: state the PR is ready to merge; there is no linked task this run, so run `complete-task` against the relevant task (do not force a short-id command block when no `{task-ref}` is available).
105
+ - "Blocked": output only the step 4 blocker explanation; do not recommend a next-step command.
106
+
107
+ ## Completion Checklist
108
+
109
+ - [ ] Resolved the target PR (and any task context)
110
+ - [ ] Completed required-checks watching with an all-green / blocked conclusion
111
+ - [ ] Self-heal limited to locatable code-layer failures, with local tests passing before push and within the fix cap
112
+ - [ ] Task-anchored path: updated task.md and appended the Watch PR Activity Log entry
113
+ - [ ] Task-anchored path: verification gate passed
114
+ - [ ] Showed the user all TUI next-step command formats (green exit; the blocked exit renders no next step)
115
+
116
+ ## Stop
117
+
118
+ Stop immediately after the checklist. The green exit waits for the user to run `complete-task`; the blocked exit waits for the user's decision.
119
+
120
+ ## Notes
121
+
122
+ 1. **Precondition**: the PR exists (created by `create-pr`, or locatable via explicit `--pr` / the current branch).
123
+ 2. **Bare numbers are always task short ids**: do not treat a bare number as a PR number; use `--pr <number>` for a PR number.
124
+ 3. **Self-heal safety**: local tests must pass before pushing; always ask for help on non-code / unlocatable failures rather than blindly retrying.
125
+ 4. **Re-runnable**: watch-pr may run multiple times within a task lifecycle; the Round count increments by the number of existing Watch PR Activity Log entries.
126
+
127
+ ## Error Handling
128
+
129
+ - Cannot locate a PR (task short id resolves but task.md has no `pr_number`, and no `--pr` was passed and the current branch has no PR): prompt "Run `create-pr` first, or specify the PR with `--pr <number>`", then stop.
130
+ - Platform CLI not authenticated or API unavailable: prompt that manual intervention is needed, then stop.
131
+ - Short-id resolution failure: pass through `task-short-id.js`'s exit code and error message; do not rewrite it.