@fitlab-ai/agent-infra 0.6.2 → 0.6.4

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 (90) hide show
  1. package/README.md +13 -3
  2. package/README.zh-CN.md +10 -3
  3. package/bin/cli.ts +6 -1
  4. package/dist/bin/cli.js +6 -1
  5. package/dist/lib/sandbox/clipboard/bridge.js +218 -0
  6. package/dist/lib/sandbox/clipboard/darwin.js +66 -0
  7. package/dist/lib/sandbox/clipboard/index.js +9 -0
  8. package/dist/lib/sandbox/clipboard/keys.js +58 -0
  9. package/dist/lib/sandbox/clipboard/node-pty.js +13 -0
  10. package/dist/lib/sandbox/clipboard/paths.js +59 -0
  11. package/dist/lib/sandbox/commands/create.js +15 -2
  12. package/dist/lib/sandbox/commands/enter.js +14 -3
  13. package/dist/lib/sandbox/commands/ls.js +19 -4
  14. package/dist/lib/sandbox/commands/prune.js +176 -0
  15. package/dist/lib/sandbox/commands/rm.js +27 -33
  16. package/dist/lib/sandbox/config.js +1 -0
  17. package/dist/lib/sandbox/constants.js +6 -0
  18. package/dist/lib/sandbox/host-timezone.js +33 -0
  19. package/dist/lib/sandbox/index.js +7 -1
  20. package/dist/lib/sandbox/managed-fs.js +25 -0
  21. package/dist/lib/sandbox/runtimes/base.dockerfile +21 -16
  22. package/dist/lib/sandbox/tools.js +1 -1
  23. package/dist/lib/version.js +9 -2
  24. package/lib/sandbox/clipboard/bridge.ts +286 -0
  25. package/lib/sandbox/clipboard/darwin.ts +91 -0
  26. package/lib/sandbox/clipboard/index.ts +13 -0
  27. package/lib/sandbox/clipboard/keys.ts +78 -0
  28. package/lib/sandbox/clipboard/node-pty.d.ts +19 -0
  29. package/lib/sandbox/clipboard/node-pty.ts +34 -0
  30. package/lib/sandbox/clipboard/paths.ts +71 -0
  31. package/lib/sandbox/commands/create.ts +19 -2
  32. package/lib/sandbox/commands/enter.ts +15 -3
  33. package/lib/sandbox/commands/ls.ts +28 -4
  34. package/lib/sandbox/commands/prune.ts +211 -0
  35. package/lib/sandbox/commands/rm.ts +30 -32
  36. package/lib/sandbox/config.ts +2 -0
  37. package/lib/sandbox/constants.ts +9 -0
  38. package/lib/sandbox/host-timezone.ts +42 -0
  39. package/lib/sandbox/index.ts +7 -1
  40. package/lib/sandbox/managed-fs.ts +27 -0
  41. package/lib/sandbox/runtimes/base.dockerfile +21 -16
  42. package/lib/sandbox/tools.ts +1 -1
  43. package/lib/version.ts +11 -4
  44. package/package.json +10 -6
  45. package/templates/.agents/README.en.md +19 -0
  46. package/templates/.agents/README.zh-CN.md +19 -0
  47. package/templates/.agents/rules/create-issue.github.en.md +19 -1
  48. package/templates/.agents/rules/create-issue.github.zh-CN.md +19 -1
  49. package/templates/.agents/rules/milestone-inference.github.en.md +12 -0
  50. package/templates/.agents/rules/milestone-inference.github.zh-CN.md +12 -0
  51. package/templates/.agents/rules/testing-discipline.en.md +44 -0
  52. package/templates/.agents/rules/testing-discipline.zh-CN.md +44 -0
  53. package/templates/.agents/skills/analyze-task/SKILL.en.md +26 -0
  54. package/templates/.agents/skills/analyze-task/SKILL.zh-CN.md +26 -0
  55. package/templates/.agents/skills/analyze-task/config/verify.en.json +51 -0
  56. package/templates/.agents/skills/analyze-task/config/{verify.json → verify.zh-CN.json} +6 -2
  57. package/templates/.agents/skills/complete-task/SKILL.en.md +15 -0
  58. package/templates/.agents/skills/complete-task/SKILL.zh-CN.md +15 -0
  59. package/templates/.agents/skills/complete-task/config/{verify.json → verify.en.json} +10 -0
  60. package/templates/.agents/skills/complete-task/config/verify.zh-CN.json +48 -0
  61. package/templates/.agents/skills/create-task/SKILL.en.md +2 -0
  62. package/templates/.agents/skills/create-task/SKILL.zh-CN.md +2 -0
  63. package/templates/.agents/skills/create-task/config/verify.json +1 -0
  64. package/templates/.agents/skills/implement-task/SKILL.en.md +14 -0
  65. package/templates/.agents/skills/implement-task/SKILL.zh-CN.md +14 -0
  66. package/templates/.agents/skills/implement-task/config/verify.en.json +51 -0
  67. package/templates/.agents/skills/implement-task/config/{verify.json → verify.zh-CN.json} +7 -2
  68. package/templates/.agents/skills/implement-task/reference/report-template.en.md +15 -0
  69. package/templates/.agents/skills/implement-task/reference/report-template.zh-CN.md +15 -0
  70. package/templates/.agents/skills/import-issue/SKILL.en.md +1 -1
  71. package/templates/.agents/skills/import-issue/SKILL.zh-CN.md +1 -1
  72. package/templates/.agents/skills/plan-task/SKILL.en.md +22 -0
  73. package/templates/.agents/skills/plan-task/SKILL.zh-CN.md +22 -0
  74. package/templates/.agents/skills/plan-task/config/verify.en.json +52 -0
  75. package/templates/.agents/skills/plan-task/config/{verify.json → verify.zh-CN.json} +6 -2
  76. package/templates/.agents/skills/post-release/SKILL.en.md +1 -0
  77. package/templates/.agents/skills/post-release/SKILL.zh-CN.md +1 -0
  78. package/templates/.agents/skills/refine-task/SKILL.en.md +14 -0
  79. package/templates/.agents/skills/refine-task/SKILL.zh-CN.md +14 -0
  80. package/templates/.agents/skills/refine-task/config/verify.en.json +47 -0
  81. package/templates/.agents/skills/refine-task/config/{verify.json → verify.zh-CN.json} +7 -2
  82. package/templates/.agents/skills/refine-task/reference/report-template.en.md +15 -0
  83. package/templates/.agents/skills/refine-task/reference/report-template.zh-CN.md +15 -0
  84. package/templates/.agents/skills/review-task/SKILL.en.md +14 -0
  85. package/templates/.agents/skills/review-task/SKILL.zh-CN.md +14 -0
  86. package/templates/.agents/skills/review-task/config/verify.en.json +50 -0
  87. package/templates/.agents/skills/review-task/config/{verify.json → verify.zh-CN.json} +5 -2
  88. package/templates/.agents/skills/review-task/reference/report-template.en.md +15 -0
  89. package/templates/.agents/skills/review-task/reference/report-template.zh-CN.md +15 -0
  90. package/dist/package.json +0 -5
@@ -116,6 +116,8 @@ date "+%Y-%m-%d %H:%M:%S%:z"
116
116
  - 支持 Issue 创建的平台:包含完整的认证检测、模板检测、label/Issue Type/milestone 推断、Issue 创建调用、`task.md` 回写流程
117
117
  - 自定义或空平台(未提供平台变体规则文件):内容为 no-op 说明,本步骤直接跳过
118
118
 
119
+ > **强约束**:`.agents/rules/create-issue.md` §4 中的 milestone 子步骤为必须执行项;漏设会被步骤 5 的 gate(`verify_milestone: true`)截停,导致 create-task 失败。
120
+
119
121
  处理结果:
120
122
  - 规则成功创建 Issue:`issue_number` 已按规则回写到 task.md;继续读取 `.agents/rules/issue-sync.md`,完成 upstream 仓库检测和权限检测,然后同步 task 评论并按规则设置 `status: waiting-for-triage`
121
123
  - 规则失败(认证 / 网络 / 模板解析等):不回滚 task.md;不追加额外 Activity Log;按"场景 C:Issue 创建失败"输出向用户透出 `error_code` 与 `error_message`,让用户决定后续是否手动重试或写入 `issue_number`
@@ -25,6 +25,7 @@
25
25
  "when": "issue_number_exists",
26
26
  "issue_must_exist": true,
27
27
  "verify_task_comment_content": true,
28
+ "verify_milestone": true,
28
29
  "expected_status_label_key": "waitingForTriage"
29
30
  }
30
31
  }
@@ -27,6 +27,20 @@ Before implementing, stop if any of these thoughts appear. They are violations:
27
27
  | "This plan is flawed, so I will improve it as I go." | Deviations from `{plan-artifact}` must be recorded in the report; if the direction is questionable, stop and confirm instead of changing it silently. |
28
28
  | "The tests passed, so I can commit this too." | This skill never runs `git add` or `git commit`; committing is a separate step explicitly requested by the user. |
29
29
 
30
+ ## Step 0: State Check (pre-execution hard gate)
31
+
32
+ After loading workflow / skill / rules instructions, and before any task-state judgment or user-visible conclusion, run the state check first. Reading instruction files does not count as an external-state action or conclusion.
33
+
34
+ Run these commands and paste the raw output into both the user-facing reply and this round's `## State Check` section:
35
+
36
+ ```bash
37
+ git status -s
38
+ ls -la .agents/workspace/active/{task-id}/
39
+ tail .agents/workspace/active/{task-id}/task.md
40
+ ```
41
+
42
+ Before the state check is complete, do not make external-state assertions such as "the code is unchanged", "tests passed", or "there are no other references", including in reasoning. This gate is only a structural floor; evidence pairing and authenticity still require the report template and review discipline.
43
+
30
44
  ## Steps
31
45
 
32
46
  ### 1. Verify Prerequisites
@@ -27,6 +27,20 @@ description: "根据技术方案实施任务并输出报告"
27
27
  | 「方案这里不合理,顺手改更好」 | 偏离 `{plan-artifact}` 必须在报告中记录原因;有异议先停下确认,不擅自改方向。 |
28
28
  | 「测试过了,顺便提交一下」 | 本技能绝不执行 `git add`/`git commit`,提交是用户显式发起的独立步骤。 |
29
29
 
30
+ ## 第 0 步:状态核对(执行前硬约束)
31
+
32
+ 在加载 workflow / skill / rules 指令之后、做任何任务状态判断或用户可见结论之前,必须先执行状态核对。指令类文件读取不算对外动作或结论。
33
+
34
+ 运行以下命令,并把原文粘贴到回复正文和本轮产物的 `## 状态核对` 段:
35
+
36
+ ```bash
37
+ git status -s
38
+ ls -la .agents/workspace/active/{task-id}/
39
+ tail .agents/workspace/active/{task-id}/task.md
40
+ ```
41
+
42
+ 状态核对完成前,禁止任何关于外部状态的断言(例如“代码没变”“测试已通过”“没有其他引用”),包括思考阶段。本门禁只提供结构下限;逐条证据配对和真实性仍需按报告模板与审查要求核对。
43
+
30
44
  ## 执行步骤
31
45
 
32
46
  ### 1. 验证前置条件
@@ -0,0 +1,51 @@
1
+ {
2
+ "skill": "implement-task",
3
+ "checks": {
4
+ "task-meta": {
5
+ "required_fields": [
6
+ "id",
7
+ "type",
8
+ "workflow",
9
+ "status",
10
+ "created_at",
11
+ "updated_at",
12
+ "agent_infra_version",
13
+ "current_step",
14
+ "assigned_to"
15
+ ],
16
+ "expected_step": "implementation"
17
+ },
18
+ "artifact": {
19
+ "file_pattern": "implementation.md|implementation-r{N}.md",
20
+ "required_sections": [
21
+ "Modified Files",
22
+ "Key Code Explanation",
23
+ "Test Results",
24
+ "Differences from Plan",
25
+ "Items for Review",
26
+ "State Check",
27
+ "Evidence"
28
+ ],
29
+ "freshness_minutes": 30,
30
+ "required_patterns": [
31
+ "^\\$ "
32
+ ]
33
+ },
34
+ "activity-log": {
35
+ "expected_action_pattern": "Implementation \\(Round \\d+\\)",
36
+ "freshness_minutes": 30
37
+ },
38
+ "platform-sync": {
39
+ "when": "issue_number_exists",
40
+ "expected_status_label": "status: in-progress",
41
+ "expected_comment_marker": "<!-- sync-issue:{task-id}:{artifact-stem} -->",
42
+ "verify_comment_content": true,
43
+ "verify_task_comment_content": true,
44
+ "verify_issue_type": true,
45
+ "verify_issue_fields": false,
46
+ "verify_milestone": true,
47
+ "expected_status_label_key": "inProgress",
48
+ "expected_comment_marker_key": "artifact"
49
+ }
50
+ }
51
+ }
@@ -22,9 +22,14 @@
22
22
  "关键代码说明",
23
23
  "测试结果",
24
24
  "与方案的差异",
25
- "供审查关注的内容"
25
+ "供审查关注的内容",
26
+ "状态核对",
27
+ "证据原文"
26
28
  ],
27
- "freshness_minutes": 30
29
+ "freshness_minutes": 30,
30
+ "required_patterns": [
31
+ "^\\$ "
32
+ ]
28
33
  },
29
34
  "activity-log": {
30
35
  "expected_action_pattern": "Implementation \\(Round \\d+\\)",
@@ -10,6 +10,10 @@ Use this structure when creating `implementation.md` or `implementation-r{N}.md`
10
10
  - **Implementation Round**: Round {implementation-round}
11
11
  - **Artifact File**: `{implementation-artifact}`
12
12
 
13
+ ## State Check
14
+
15
+ > Paste the raw state-check command output; each command starts with `$ `.
16
+
13
17
  ## Modified Files
14
18
 
15
19
  ### New Files
@@ -43,6 +47,17 @@ Use this structure when creating `implementation.md` or `implementation-r{N}.md`
43
47
  {test-run-output}
44
48
  ```
45
49
 
50
+
51
+ ## Evidence
52
+
53
+ > 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.
54
+
55
+ - Claim: {verified claim}
56
+ ```text
57
+ $ {command}
58
+ {raw output}
59
+ ```
60
+
46
61
  ## Differences from Plan
47
62
 
48
63
  {describe any deviation from the approved plan}
@@ -10,6 +10,10 @@
10
10
  - **实现轮次**: Round {implementation-round}
11
11
  - **产物文件**: `{implementation-artifact}`
12
12
 
13
+ ## 状态核对
14
+
15
+ > 粘贴状态核对命令原文;每条命令以 `$ ` 开头。
16
+
13
17
  ## 变更文件
14
18
 
15
19
  ### 新建文件
@@ -43,6 +47,17 @@
43
47
  {test-run-output}
44
48
  ```
45
49
 
50
+
51
+ ## 证据原文
52
+
53
+ > 每条“我验证了 X”断言都要配对对应 tool output 原文;gate 仅校验本段存在和至少一行 `$ `。
54
+
55
+ - 断言:{verified claim}
56
+ ```text
57
+ $ {command}
58
+ {raw output}
59
+ ```
60
+
46
61
  ## 与方案的差异
47
62
 
48
63
  {describe any deviation from the approved plan}
@@ -114,7 +114,7 @@ If task.md contains a valid `issue_number`, use the Issue update command from `.
114
114
 
115
115
  If task.md contains a valid `issue_number`, perform these sync actions (skip and continue on any failure):
116
116
  - Read `.agents/rules/issue-sync.md` before syncing, and complete upstream repository detection plus permission detection
117
- - Check the Issue's current milestone; if it is unset, read `.agents/rules/milestone-inference.md` and infer plus set the milestone using "Phase 1: `create-task` (when the platform rule creates an Issue)". If `has_triage=false` or the inference is uncertain, skip and continue
117
+ - Check the Issue's current milestone; if it is unset, read `.agents/rules/milestone-inference.md`, infer a release line using "Phase 1: `create-task` (when the platform rule creates an Issue)", and run its "Backfill when called from `import-issue`" subsection to write back to the remote Issue. If inference fails, permissions are insufficient, or write-back fails, skip and continue without blocking the import
118
118
  - After every scenario, task comment sync is mandatory: create or update the task comment marker defined in `.agents/rules/issue-sync.md` so the remote `:task` comment exists and matches the local `task.md` content (follow the task.md comment sync rule in issue-sync.md)
119
119
 
120
120
  ### 7. Verification Gate
@@ -114,7 +114,7 @@ date "+%Y-%m-%d %H:%M:%S%:z"
114
114
 
115
115
  如果 task.md 中存在有效的 `issue_number`,执行以下同步操作(任一失败则跳过并继续):
116
116
  - 执行前先读取 `.agents/rules/issue-sync.md`,完成 upstream 仓库检测和权限检测
117
- - 检查 Issue 当前 milestone;如果未设置,先读取 `.agents/rules/milestone-inference.md`,按其中的「阶段 1:`create-task`(平台规则创建 Issue 时)」规则推断并设置 milestone;如果 `has_triage=false` 或推断不确定,跳过并继续
117
+ - 检查 Issue 当前 milestone;如果未设置,先读取 `.agents/rules/milestone-inference.md`,按其中的「阶段 1:`create-task`(平台规则创建 Issue 时)」推断版本线,并按其「`import-issue` 调用时的兜底」子节执行远端回写;推断失败、权限不足或回写失败均跳过并继续,不阻断导入
118
118
  - 所有场景结束后,必须执行一次 task 留言同步,创建或更新 `.agents/rules/issue-sync.md` 中定义的 task 评论标记,确保远端 `:task` 评论存在且内容与本地 `task.md` 一致(按 issue-sync.md 的 task.md 评论同步规则)
119
119
 
120
120
  ### 7. 完成校验
@@ -13,6 +13,20 @@ description: "Design a technical plan for a task"
13
13
 
14
14
  Version stamp rule: when creating or updating `task.md` frontmatter, read `.agents/rules/version-stamp.md` first and write or refresh `agent_infra_version`.
15
15
 
16
+ ## Step 0: State Check (pre-execution hard gate)
17
+
18
+ After loading workflow / skill / rules instructions, and before any task-state judgment or user-visible conclusion, run the state check first. Reading instruction files does not count as an external-state action or conclusion.
19
+
20
+ Run these commands and paste the raw output into both the user-facing reply and this round's `## State Check` section:
21
+
22
+ ```bash
23
+ git status -s
24
+ ls -la .agents/workspace/active/{task-id}/
25
+ tail .agents/workspace/active/{task-id}/task.md
26
+ ```
27
+
28
+ Before the state check is complete, do not make external-state assertions such as "the code is unchanged", "tests passed", or "there are no other references", including in reasoning. This gate is only a structural floor; evidence pairing and authenticity still require the report template and review discipline.
29
+
16
30
  ## Steps
17
31
 
18
32
  ### 1. Verify Prerequisites
@@ -95,6 +109,14 @@ Update `.agents/workspace/active/{task-id}/task.md`:
95
109
  - Record the plan artifact for this round: `{plan-artifact}` (Round `{plan-round}`)
96
110
  - If the task template contains a `## Design` section, update it to link to `{plan-artifact}`
97
111
  - Mark technical-design as complete in workflow progress and include the actual round when the task template supports it
112
+ - Before appending the workflow Activity Log entry, re-estimate `effort` based on the technical plan (number of implementation steps, files touched, test matrix scope, integration surface). If the re-estimated value differs from the current value in `task.md`:
113
+ - Overwrite the `effort` field in frontmatter with the new value
114
+ - Prepend an Activity Log entry recording the transition (placed before the `Technical Design (Round N)` entry):
115
+ ```
116
+ - {YYYY-MM-DD HH:mm:ss±HH:MM} — **Plan Re-estimate** by {agent} — effort {old} → {new} (rationale: {short basis grounded in this plan})
117
+ ```
118
+ Both entries may share the same timestamp; ordering is conveyed by list position only.
119
+ If the re-estimated value matches the current value, skip the Re-estimate entry. The Flow A sync that follows reads the possibly updated frontmatter and propagates the new value to the Issue automatically.
98
120
  - **Append** to `## Activity Log` (do NOT overwrite previous entries):
99
121
  ```
100
122
  - {YYYY-MM-DD HH:mm:ss±HH:MM} — **Technical Design (Round {N})** by {agent} — Plan completed, awaiting human review → {artifact-filename}
@@ -13,6 +13,20 @@ description: "为任务设计技术方案和实施计划"
13
13
 
14
14
  版本戳规则:创建或更新 `task.md` frontmatter 时,先读取 `.agents/rules/version-stamp.md`,并写入或刷新 `agent_infra_version`。
15
15
 
16
+ ## 第 0 步:状态核对(执行前硬约束)
17
+
18
+ 在加载 workflow / skill / rules 指令之后、做任何任务状态判断或用户可见结论之前,必须先执行状态核对。指令类文件读取不算对外动作或结论。
19
+
20
+ 运行以下命令,并把原文粘贴到回复正文和本轮产物的 `## 状态核对` 段:
21
+
22
+ ```bash
23
+ git status -s
24
+ ls -la .agents/workspace/active/{task-id}/
25
+ tail .agents/workspace/active/{task-id}/task.md
26
+ ```
27
+
28
+ 状态核对完成前,禁止任何关于外部状态的断言(例如“代码没变”“测试已通过”“没有其他引用”),包括思考阶段。本门禁只提供结构下限;逐条证据配对和真实性仍需按报告模板与审查要求核对。
29
+
16
30
  ## 执行步骤
17
31
 
18
32
  ### 1. 验证前置条件
@@ -95,6 +109,14 @@ date "+%Y-%m-%d %H:%M:%S%:z"
95
109
  - 记录本轮方案产物:`{plan-artifact}`(Round `{plan-round}`)
96
110
  - 如任务模板包含 `## 设计` 段落,更新为指向 `{plan-artifact}` 的链接
97
111
  - 在工作流进度中标记 technical-design 为已完成,并注明实际轮次(如果任务模板支持)
112
+ - 在追加工作流 Activity Log 条目之前,基于技术方案(实施步骤数、涉及文件、测试矩阵范围、集成面)重估 `effort`。若重估值与 `task.md` 当前值不一致:
113
+ - 用新值覆盖 frontmatter 的 `effort` 字段
114
+ - 在 `Technical Design (Round N)` 条目之前追加一条转移记录:
115
+ ```
116
+ - {YYYY-MM-DD HH:mm:ss±HH:MM} — **Plan Re-estimate** by {agent} — effort {old} → {new} (rationale: {基于本轮方案的简短依据})
117
+ ```
118
+ 两条条目可共用同一时间戳,顺序仅通过列表位置表达。
119
+ 若重估值与当前值一致,跳过 Re-estimate 条目。后续 Flow A 同步会读取可能更新过的 frontmatter,并自动把新值同步到 Issue。
98
120
  - **追加**到 `## Activity Log`(不要覆盖之前的记录):
99
121
  ```
100
122
  - {YYYY-MM-DD HH:mm:ss±HH:MM} — **Technical Design (Round {N})** by {agent} — Plan completed, awaiting human review → {artifact-filename}
@@ -0,0 +1,52 @@
1
+ {
2
+ "skill": "plan-task",
3
+ "checks": {
4
+ "task-meta": {
5
+ "required_fields": [
6
+ "id",
7
+ "type",
8
+ "workflow",
9
+ "status",
10
+ "created_at",
11
+ "updated_at",
12
+ "agent_infra_version",
13
+ "current_step",
14
+ "assigned_to"
15
+ ],
16
+ "expected_step": "technical-design"
17
+ },
18
+ "artifact": {
19
+ "file_pattern": "plan.md|plan-r{N}.md",
20
+ "required_sections": [
21
+ "Problem Understanding",
22
+ "Constraints",
23
+ "Option Comparison",
24
+ "Technical Approach",
25
+ "Implementation Steps",
26
+ "File List",
27
+ "Verification Strategy",
28
+ "State Check"
29
+ ],
30
+ "freshness_minutes": 30,
31
+ "required_patterns": [
32
+ "^\\$ "
33
+ ]
34
+ },
35
+ "activity-log": {
36
+ "expected_action_pattern": "Technical Design \\(Round \\d+\\)",
37
+ "freshness_minutes": 30
38
+ },
39
+ "platform-sync": {
40
+ "when": "issue_number_exists",
41
+ "expected_status_label": "status: pending-design-work",
42
+ "expected_comment_marker": "<!-- sync-issue:{task-id}:{artifact-stem} -->",
43
+ "verify_comment_content": true,
44
+ "verify_task_comment_content": true,
45
+ "verify_issue_type": true,
46
+ "verify_issue_fields": false,
47
+ "verify_milestone": true,
48
+ "expected_status_label_key": "pendingDesignWork",
49
+ "expected_comment_marker_key": "artifact"
50
+ }
51
+ }
52
+ }
@@ -24,9 +24,13 @@
24
24
  "技术方法",
25
25
  "实施步骤",
26
26
  "文件清单",
27
- "验证策略"
27
+ "验证策略",
28
+ "状态核对"
28
29
  ],
29
- "freshness_minutes": 30
30
+ "freshness_minutes": 30,
31
+ "required_patterns": [
32
+ "^\\$ "
33
+ ]
30
34
  },
31
35
  "activity-log": {
32
36
  "expected_action_pattern": "Technical Design \\(Round \\d+\\)",
@@ -54,6 +54,7 @@ git status --short
54
54
  <!-- TODO: Add project-specific follow-up tasks such as demo capture, docs publishing, or downstream notifications -->
55
55
 
56
56
  - Examples: record a terminal demo, refresh a docs site, notify downstream teams, update release dashboards
57
+ - If a task here displays or captures the just-released version (e.g., recording a CLI demo), move it **before** Step 3 — otherwise it will reflect the next development version, not the release
57
58
  - If there are no extra tasks, remove this step in the project-specific copy
58
59
 
59
60
  ### 6. Create the Follow-up Commit
@@ -54,6 +54,7 @@ git status --short
54
54
  <!-- TODO: 添加项目特定的发布后任务,例如录制演示、发布文档站或通知下游 -->
55
55
 
56
56
  - 示例:录制终端演示、刷新文档站、通知下游团队、更新发布面板
57
+ - 如果这一步里的任务需要显示或捕获刚发布的版本号(例如录制 CLI 演示),把它挪到**第 3 步「准备下一个开发版本」之前**——否则会反映下一个开发版本号,而不是 released 版本号
57
58
  - 如果没有额外任务,请在项目特化版本中删除此步骤
58
59
 
59
60
  ### 6. 创建后处理提交
@@ -24,6 +24,20 @@ Version stamp rule: when creating or updating `task.md` frontmatter, read `.agen
24
24
  | "I can clean up nearby code while I am here." | Scope is limited to review findings; changes outside that scope are out of bounds. |
25
25
  | "Clearing env-blocked items makes the report look better." | env-blocked findings are outside the repair scope; preserve and label them truthfully, and never use no-op edits to pad the fix count. |
26
26
 
27
+ ## Step 0: State Check (pre-execution hard gate)
28
+
29
+ After loading workflow / skill / rules instructions, and before any task-state judgment or user-visible conclusion, run the state check first. Reading instruction files does not count as an external-state action or conclusion.
30
+
31
+ Run these commands and paste the raw output into both the user-facing reply and this round's `## State Check` section:
32
+
33
+ ```bash
34
+ git status -s
35
+ ls -la .agents/workspace/active/{task-id}/
36
+ tail .agents/workspace/active/{task-id}/task.md
37
+ ```
38
+
39
+ Before the state check is complete, do not make external-state assertions such as "the code is unchanged", "tests passed", or "there are no other references", including in reasoning. This gate is only a structural floor; evidence pairing and authenticity still require the report template and review discipline.
40
+
27
41
  ## Steps
28
42
 
29
43
  ### 1. Verify Prerequisites
@@ -24,6 +24,20 @@ description: "处理代码审查反馈并修复问题"
24
24
  | 「顺手把旁边也优化了」 | 范围严格限定在审查项内,范围外改动属于越界。 |
25
25
  | 「env-blocked 项清掉报告好看」 | env-blocked 不在修复范围,必须如实保留并标注,禁止 no-op 改动充数。 |
26
26
 
27
+ ## 第 0 步:状态核对(执行前硬约束)
28
+
29
+ 在加载 workflow / skill / rules 指令之后、做任何任务状态判断或用户可见结论之前,必须先执行状态核对。指令类文件读取不算对外动作或结论。
30
+
31
+ 运行以下命令,并把原文粘贴到回复正文和本轮产物的 `## 状态核对` 段:
32
+
33
+ ```bash
34
+ git status -s
35
+ ls -la .agents/workspace/active/{task-id}/
36
+ tail .agents/workspace/active/{task-id}/task.md
37
+ ```
38
+
39
+ 状态核对完成前,禁止任何关于外部状态的断言(例如“代码没变”“测试已通过”“没有其他引用”),包括思考阶段。本门禁只提供结构下限;逐条证据配对和真实性仍需按报告模板与审查要求核对。
40
+
27
41
  ## 执行步骤
28
42
 
29
43
  ### 1. 验证前置条件
@@ -0,0 +1,47 @@
1
+ {
2
+ "skill": "refine-task",
3
+ "checks": {
4
+ "task-meta": {
5
+ "required_fields": [
6
+ "id",
7
+ "type",
8
+ "workflow",
9
+ "status",
10
+ "created_at",
11
+ "updated_at",
12
+ "agent_infra_version",
13
+ "current_step",
14
+ "assigned_to"
15
+ ]
16
+ },
17
+ "artifact": {
18
+ "file_pattern": "refinement.md|refinement-r{N}.md",
19
+ "required_sections": [
20
+ "Review Feedback Handling",
21
+ "Test Results After Refinement",
22
+ "State Check",
23
+ "Evidence"
24
+ ],
25
+ "freshness_minutes": 30,
26
+ "required_patterns": [
27
+ "^\\$ "
28
+ ]
29
+ },
30
+ "activity-log": {
31
+ "expected_action_pattern": "Refinement \\(Round \\d+, for .+\\)",
32
+ "freshness_minutes": 30
33
+ },
34
+ "platform-sync": {
35
+ "when": "issue_number_exists",
36
+ "expected_status_label": "status: in-progress",
37
+ "expected_comment_marker": "<!-- sync-issue:{task-id}:{artifact-stem} -->",
38
+ "verify_comment_content": true,
39
+ "verify_task_comment_content": true,
40
+ "verify_issue_type": true,
41
+ "verify_issue_fields": false,
42
+ "verify_milestone": true,
43
+ "expected_status_label_key": "inProgress",
44
+ "expected_comment_marker_key": "artifact"
45
+ }
46
+ }
47
+ }
@@ -18,9 +18,14 @@
18
18
  "file_pattern": "refinement.md|refinement-r{N}.md",
19
19
  "required_sections": [
20
20
  "审查反馈处理",
21
- "修复后的测试结果"
21
+ "修复后的测试结果",
22
+ "状态核对",
23
+ "证据原文"
22
24
  ],
23
- "freshness_minutes": 30
25
+ "freshness_minutes": 30,
26
+ "required_patterns": [
27
+ "^\\$ "
28
+ ]
24
29
  },
25
30
  "activity-log": {
26
31
  "expected_action_pattern": "Refinement \\(Round \\d+, for .+\\)",
@@ -12,6 +12,10 @@ Use this structure when writing `refinement.md` or `refinement-r{N}.md`.
12
12
  - **Review Input**: `{review-artifact}`
13
13
  - **Implementation Context**: `{implementation-artifact}`
14
14
 
15
+ ## State Check
16
+
17
+ > Paste the raw state-check command output; each command starts with `$ `.
18
+
15
19
  ### Review Feedback Handling
16
20
 
17
21
  #### Blocker Fixes
@@ -43,6 +47,17 @@ Use this structure when writing `refinement.md` or `refinement-r{N}.md`.
43
47
  #### Unresolved Issues
44
48
  - {issue}: {reason}
45
49
 
50
+
51
+ ## Evidence
52
+
53
+ > 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.
54
+
55
+ - Claim: {verified claim}
56
+ ```text
57
+ $ {command}
58
+ {raw output}
59
+ ```
60
+
46
61
  ### Test Results After Refinement
47
62
  - All tests passing: {yes/no}
48
63
  - Test output: {summary}
@@ -12,6 +12,10 @@
12
12
  - **审查输入**: `{review-artifact}`
13
13
  - **实现上下文**: `{implementation-artifact}`
14
14
 
15
+ ## 状态核对
16
+
17
+ > 粘贴状态核对命令原文;每条命令以 `$ ` 开头。
18
+
15
19
  ### 审查反馈处理
16
20
 
17
21
  #### 阻塞项修复
@@ -43,6 +47,17 @@
43
47
  #### 未解决问题
44
48
  - {issue}: {reason}
45
49
 
50
+
51
+ ## 证据原文
52
+
53
+ > 每条“我验证了 X”断言都要配对对应 tool output 原文;gate 仅校验本段存在和至少一行 `$ `。
54
+
55
+ - 断言:{verified claim}
56
+ ```text
57
+ $ {command}
58
+ {raw output}
59
+ ```
60
+
46
61
  ### 修复后的测试结果
47
62
  - 所有测试通过: {yes/no}
48
63
  - 测试输出: {summary}
@@ -22,6 +22,20 @@ Version stamp rule: when creating or updating `task.md` frontmatter, read `.agen
22
22
  | "It looks mostly fine, so approve it." | The verdict must be backed by blocker/major/minor counts, and every finding must cite file:line; do not approve from impression. |
23
23
  | "The test change looks reasonable, so I can skim it." | Before reviewing test changes, check `.agents/rules/testing-discipline.md` item by item (see the step 4 gate). |
24
24
 
25
+ ## Step 0: State Check (pre-execution hard gate)
26
+
27
+ After loading workflow / skill / rules instructions, and before any task-state judgment or user-visible conclusion, run the state check first. Reading instruction files does not count as an external-state action or conclusion.
28
+
29
+ Run these commands and paste the raw output into both the user-facing reply and this round's `## State Check` section:
30
+
31
+ ```bash
32
+ git status -s
33
+ ls -la .agents/workspace/active/{task-id}/
34
+ tail .agents/workspace/active/{task-id}/task.md
35
+ ```
36
+
37
+ Before the state check is complete, do not make external-state assertions such as "the code is unchanged", "tests passed", or "there are no other references", including in reasoning. This gate is only a structural floor; evidence pairing and authenticity still require the report template and review discipline.
38
+
25
39
  ## Steps
26
40
 
27
41
  ### 1. Verify Prerequisites
@@ -22,6 +22,20 @@ description: "审查任务实现并输出代码审查报告"
22
22
  | 「大体没问题,给个 Approved」 | 结论必须由 blocker/major/minor 计数支撑,每个问题引用文件:行号,不能凭印象放行。 |
23
23
  | 「测试改动看着合理,跳过细看」 | 审查测试变更前必须逐条核对 `.agents/rules/testing-discipline.md`(见步骤 4 门禁)。 |
24
24
 
25
+ ## 第 0 步:状态核对(执行前硬约束)
26
+
27
+ 在加载 workflow / skill / rules 指令之后、做任何任务状态判断或用户可见结论之前,必须先执行状态核对。指令类文件读取不算对外动作或结论。
28
+
29
+ 运行以下命令,并把原文粘贴到回复正文和本轮产物的 `## 状态核对` 段:
30
+
31
+ ```bash
32
+ git status -s
33
+ ls -la .agents/workspace/active/{task-id}/
34
+ tail .agents/workspace/active/{task-id}/task.md
35
+ ```
36
+
37
+ 状态核对完成前,禁止任何关于外部状态的断言(例如“代码没变”“测试已通过”“没有其他引用”),包括思考阶段。本门禁只提供结构下限;逐条证据配对和真实性仍需按报告模板与审查要求核对。
38
+
25
39
  ## 执行步骤
26
40
 
27
41
  ### 1. 验证前置条件
@@ -0,0 +1,50 @@
1
+ {
2
+ "skill": "review-task",
3
+ "checks": {
4
+ "task-meta": {
5
+ "required_fields": [
6
+ "id",
7
+ "type",
8
+ "workflow",
9
+ "status",
10
+ "created_at",
11
+ "updated_at",
12
+ "agent_infra_version",
13
+ "current_step",
14
+ "assigned_to"
15
+ ]
16
+ },
17
+ "artifact": {
18
+ "file_pattern": "review.md|review-r{N}.md",
19
+ "required_sections": [
20
+ "Review Summary",
21
+ "Findings",
22
+ "Environment-Blocked Findings",
23
+ "Conclusion and Recommendation",
24
+ "State Check",
25
+ "Evidence"
26
+ ],
27
+ "required_patterns": [
28
+ "^### Approval Decision$",
29
+ "^\\$ "
30
+ ],
31
+ "freshness_minutes": 30
32
+ },
33
+ "activity-log": {
34
+ "expected_action_pattern": "Code Review \\(Round \\d+\\)",
35
+ "freshness_minutes": 30
36
+ },
37
+ "platform-sync": {
38
+ "when": "issue_number_exists",
39
+ "expected_status_label": "status: in-progress",
40
+ "expected_comment_marker": "<!-- sync-issue:{task-id}:{artifact-stem} -->",
41
+ "verify_comment_content": true,
42
+ "verify_task_comment_content": true,
43
+ "verify_issue_type": true,
44
+ "verify_issue_fields": false,
45
+ "verify_milestone": true,
46
+ "expected_status_label_key": "inProgress",
47
+ "expected_comment_marker_key": "artifact"
48
+ }
49
+ }
50
+ }
@@ -20,10 +20,13 @@
20
20
  "审查摘要",
21
21
  "问题清单",
22
22
  "环境性遗留",
23
- "结论与建议"
23
+ "结论与建议",
24
+ "状态核对",
25
+ "证据原文"
24
26
  ],
25
27
  "required_patterns": [
26
- "^### 审查决定$"
28
+ "^### 审查决定$",
29
+ "^\\$ "
27
30
  ],
28
31
  "freshness_minutes": 30
29
32
  },