@fitlab-ai/agent-infra 0.9.0 → 0.9.1

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 (82) hide show
  1. package/README.md +6 -1
  2. package/README.zh-CN.md +5 -1
  3. package/dist/bin/internal-cli.js +5 -0
  4. package/dist/lib/internal/platform-release-notes.js +53 -0
  5. package/dist/lib/internal/release-workflow.js +105 -2
  6. package/dist/lib/platform/github-release-notes.js +96 -0
  7. package/dist/lib/platform/issues.js +4 -2
  8. package/dist/lib/platform/merged-pr-equivalence.js +54 -0
  9. package/dist/lib/platform/pr-checks.js +6 -6
  10. package/dist/lib/platform/pull-requests.js +3 -1
  11. package/dist/lib/platform/release-notes.js +143 -0
  12. package/dist/lib/platform/verification-required.js +29 -5
  13. package/dist/lib/sandbox/build-proxy.js +63 -0
  14. package/dist/lib/sandbox/commands/create.js +57 -9
  15. package/dist/lib/sandbox/commands/rebuild.js +24 -7
  16. package/dist/lib/sandbox/image-build.js +2 -1
  17. package/dist/lib/sandbox/runtimes/ai-tools.dockerfile +24 -3
  18. package/dist/lib/sandbox/runtimes/base.dockerfile +8 -1
  19. package/dist/lib/sandbox/runtimes/java17.dockerfile +8 -1
  20. package/dist/lib/sandbox/runtimes/java21.dockerfile +8 -1
  21. package/dist/lib/sandbox/runtimes/node20.dockerfile +8 -1
  22. package/dist/lib/sandbox/runtimes/node22.dockerfile +8 -1
  23. package/dist/lib/sandbox/runtimes/python3.dockerfile +8 -1
  24. package/dist/lib/sandbox/shell.js +2 -1
  25. package/dist/lib/task/commands/issue-body.js +10 -5
  26. package/dist/lib/task/events.js +1 -1
  27. package/dist/lib/task/issue-form.js +2 -0
  28. package/dist/lib/task/review-fingerprint.js +9 -0
  29. package/dist/lib/task/verification-engine.js +34 -17
  30. package/dist/lib/task/verification-review.js +1 -1
  31. package/dist/lib/task/verification.js +1 -1
  32. package/lib/internal/platform-release-notes.ts +55 -0
  33. package/lib/internal/release-workflow.ts +105 -3
  34. package/lib/platform/github-release-notes.ts +132 -0
  35. package/lib/platform/issues.ts +6 -4
  36. package/lib/platform/merged-pr-equivalence.ts +70 -0
  37. package/lib/platform/pr-checks.ts +8 -7
  38. package/lib/platform/pull-requests.ts +9 -3
  39. package/lib/platform/release-notes.ts +167 -0
  40. package/lib/platform/verification-required.ts +31 -5
  41. package/lib/sandbox/build-proxy.ts +94 -0
  42. package/lib/sandbox/commands/create.ts +77 -11
  43. package/lib/sandbox/commands/rebuild.ts +29 -7
  44. package/lib/sandbox/image-build.ts +4 -1
  45. package/lib/sandbox/runtimes/ai-tools.dockerfile +24 -3
  46. package/lib/sandbox/runtimes/base.dockerfile +8 -1
  47. package/lib/sandbox/runtimes/java17.dockerfile +8 -1
  48. package/lib/sandbox/runtimes/java21.dockerfile +8 -1
  49. package/lib/sandbox/runtimes/node20.dockerfile +8 -1
  50. package/lib/sandbox/runtimes/node22.dockerfile +8 -1
  51. package/lib/sandbox/runtimes/python3.dockerfile +8 -1
  52. package/lib/sandbox/shell.ts +3 -1
  53. package/lib/task/commands/issue-body.ts +10 -5
  54. package/lib/task/events.ts +1 -1
  55. package/lib/task/issue-form.ts +4 -0
  56. package/lib/task/review-fingerprint.ts +10 -1
  57. package/lib/task/verification-engine.ts +33 -17
  58. package/lib/task/verification-review.ts +1 -0
  59. package/lib/task/verification.ts +1 -1
  60. package/package.json +1 -1
  61. package/templates/.agents/rules/release-commands.en.md +2 -2
  62. package/templates/.agents/rules/release-commands.github.en.md +10 -40
  63. package/templates/.agents/rules/release-commands.github.zh-CN.md +9 -39
  64. package/templates/.agents/rules/release-commands.zh-CN.md +2 -2
  65. package/templates/.agents/rules/review-handshake.en.md +2 -1
  66. package/templates/.agents/rules/review-handshake.zh-CN.md +2 -1
  67. package/templates/.agents/rules/testing-discipline.en.md +20 -2
  68. package/templates/.agents/rules/testing-discipline.zh-CN.md +20 -2
  69. package/templates/.agents/skills/analyze-task/SKILL.en.md +4 -1
  70. package/templates/.agents/skills/analyze-task/SKILL.zh-CN.md +4 -1
  71. package/templates/.agents/skills/complete-task/SKILL.en.md +3 -3
  72. package/templates/.agents/skills/complete-task/SKILL.zh-CN.md +3 -3
  73. package/templates/.agents/skills/complete-task/config/verify.en.json +0 -1
  74. package/templates/.agents/skills/complete-task/config/verify.zh-CN.json +0 -1
  75. package/templates/.agents/skills/create-release-note/SKILL.en.md +17 -38
  76. package/templates/.agents/skills/create-release-note/SKILL.zh-CN.md +16 -37
  77. package/templates/.agents/skills/create-task/SKILL.en.md +4 -0
  78. package/templates/.agents/skills/create-task/SKILL.zh-CN.md +4 -0
  79. package/templates/.agents/skills/create-task/reference/context-capture.en.md +29 -0
  80. package/templates/.agents/skills/create-task/reference/context-capture.zh-CN.md +29 -0
  81. package/templates/.agents/templates/task.en.md +18 -0
  82. package/templates/.agents/templates/task.zh-CN.md +18 -0
@@ -11,7 +11,7 @@ description: >
11
11
  ## 行为边界 / 关键规则
12
12
 
13
13
  - 本技能仅产出需求分析文档(`analysis.md` 或 `analysis-r{N}.md`)—— 不修改任何业务代码
14
- - 严格基于 `task.md` 中已有的需求、上下文和来源信息展开分析
14
+ - 严格基于 `task.md` 中已有的任务输入、需求、上下文和来源信息展开分析
15
15
  - 执行本技能后,你**必须**立即更新 task.md 中的任务状态
16
16
 
17
17
  版本戳规则:创建或更新 `task.md` frontmatter 时,先读取 `.agents/rules/version-stamp.md`,并写入或刷新 `agent_infra_version`。
@@ -59,6 +59,7 @@ agent-infra-internal task-event {task-id} analyze.started --agent {agent}
59
59
  ### 3. 阅读任务上下文
60
60
 
61
61
  仔细阅读 `task.md` 以理解:
62
+ - `## 任务输入` 中已捕获的来源、事实与证据、约束、决策状态、验收标准和未决事项(栏目不存在时兼容回退)
62
63
  - 任务标题、描述和需求列表
63
64
  - 上下文信息(Issue、PR、分支、告警编号等)
64
65
  - 当前已知的受影响文件和约束
@@ -92,6 +93,8 @@ agent-infra-internal task-event {task-id} analyze.started --agent {agent}
92
93
  - 未携带答案 → 复述 `pending_question`,按下文场景 B 提问早退(不增加 `question_count`)。
93
94
 
94
95
  **4.3 充分性判定**(客观清单,命中任一缺口即判为不足):
96
+ - 先聚合 `## 任务输入`、描述、上下文、需求及远端来源;分析阶段尚未填写 `## 需求` 本身不构成不足;
97
+ - 已在任务输入中记录的目标、范围、约束或验收标准视为已提供,不得重复询问;
95
98
  - 描述/需求为空,或仅一句话且无可验证的验收标准;
96
99
  - 缺少目标或受影响范围(不知道要改什么 / 影响谁);
97
100
  - 需求条目自相矛盾,或关键名词未定义而无法分析。
@@ -87,7 +87,7 @@ Before marking complete, verify ALL of these:
87
87
  - [ ] Code has been reviewed (`review-code.md` or `review-code-r{N}.md` exists, and the latest review verdict is Approved; or review was done externally)
88
88
  - [ ] Code has been committed (no uncommitted changes related to this task)
89
89
  - [ ] Tests are passing
90
- - [ ] The disagreement ledger has no unclosed disagreements, there are no un-re-reviewed post-review commits, and local HEAD, `last_reviewed_commit`, and PR head match under the latest required-checks snapshot (mechanically checked below)
90
+ - [ ] The disagreement ledger has no unclosed disagreements or un-re-reviewed post-review commits; local HEAD, `last_reviewed_commit`, and PR head either match strictly or a merged squash has complete platform identity, Git topology, and content-equivalence evidence
91
91
 
92
92
  > **⚠️ Prerequisite Branch Check — you must decide whether to continue or stop before proceeding:**
93
93
  >
@@ -146,9 +146,9 @@ After platform writes succeed and before moving the directory or releasing the s
146
146
  agent-infra-internal task-verify {task-id} complete-task.preflight --format text
147
147
  ```
148
148
 
149
- This event runs `review-ledger`, `post-review-commit`, `required-checks`, then `platform-sync-preflight`. On any non-zero exit (fail/blocked), keep the task active, derive the stable code/target from the gate result, record it through `task-warning ... add --step complete-task ...`, and stop. For a review/head mismatch, rerun `commit` or `review-code`; for pending/failed/cancelled checks, run `watch-pr`; never fall back to the review baseline.
149
+ This event runs `review-ledger`, `post-review-commit`, then `platform-sync-preflight`. On any non-zero exit (fail/blocked), keep the task active, derive the stable code/target from the gate result, record it through `task-warning ... add --step complete-task ...`, and stop. For a review/head mismatch, rerun `commit` or `review-code`; never fall back to the review baseline.
150
150
 
151
- `--force` does not lift this hard gate: close ledger disagreements, re-review or exempt post-review commits, pass required-checks with three-way head alignment, and pass platform preflight first.
151
+ `--force` does not lift this hard gate: close ledger disagreements; re-review or exempt post-review commits, or prove a content-equivalent single-parent squash merge from the bound PR snapshot and local Git objects; then pass platform preflight. Missing platform facts, Git objects, topology, or content evidence fails closed. Required checks remain enforced before merge by branch protection / rulesets and the `review-code` / `watch-pr` routes.
152
152
 
153
153
  ### 6. Apply the Local Lifecycle Intent and Verify the Move
154
154
 
@@ -86,7 +86,7 @@ agent-infra-internal task-snapshot {task-id} --format text
86
86
  - [ ] 代码已审查(`review-code.md` 或 `review-code-r{N}.md` 存在,且最新审查结论为 Approved;或已在外部完成审查)
87
87
  - [ ] 代码已提交(没有与此任务相关的未提交变更)
88
88
  - [ ] 测试通过
89
- - [ ] 审查分歧账本无未关闭分歧、无未复审的 post-review 提交,且本地 HEAD、`last_reviewed_commit`、PR head 一致并由最新 required checks 覆盖(由下方「预完成硬门禁」机械校验)
89
+ - [ ] 审查分歧账本无未关闭分歧、无未复审的 post-review 提交;本地 HEAD、`last_reviewed_commit`、PR head 严格一致,或已合并 squash 的平台身份、Git 拓扑与内容等价证据完整
90
90
 
91
91
  > **⚠️ 前置条件分支判断 — 你必须先判断“继续”还是“停止”:**
92
92
  >
@@ -145,9 +145,9 @@ agent-infra-internal task-warning {task-id} add --step complete-task --severity
145
145
  agent-infra-internal task-verify {task-id} complete-task.preflight --format text
146
146
  ```
147
147
 
148
- 该事件依次执行 `review-ledger`、`post-review-commit`、`required-checks`、`platform-sync-preflight`。任一退出码非 0(fail/blocked)时,任务必须继续留在 active;从 gate 结果取稳定 code/target,通过 `task-warning ... add --step complete-task ...` 落账后停止。若审查基线或 head 不一致,必须先重新 `commit` / `review-code`;checks pending/failed/cancelled 时运行 `watch-pr`;不得回退审查基线。
148
+ 该事件依次执行 `review-ledger`、`post-review-commit`、`platform-sync-preflight`。任一退出码非 0(fail/blocked)时,任务必须继续留在 active;从 gate 结果取稳定 code/target,通过 `task-warning ... add --step complete-task ...` 落账后停止。若审查基线或 head 不一致,必须先重新 `commit` / `review-code`;不得回退审查基线。
149
149
 
150
- `--force` 不解除本硬门禁:未关闭分歧必须先在账本闭合,未复审提交必须重新审查或具备有效豁免,required checks 与三重 head 对齐必须通过,平台 preflight 必须通过。
150
+ `--force` 不解除本硬门禁:未关闭分歧必须先在账本闭合,未复审提交必须重新审查、具备有效豁免,或由绑定 PR 的权威合并快照与本地 Git 对象证明为内容等价的单父 squash merge;平台 preflight 必须通过。平台事实、Git 对象、拓扑或内容证据缺失时 fail closed。required checks 由合并前的分支保护 / ruleset 以及 `review-code` / `watch-pr` 路由承担。
151
151
 
152
152
  ### 6. 执行本地生命周期意图并验证转移
153
153
 
@@ -26,7 +26,6 @@
26
26
  },
27
27
  "review-ledger": {},
28
28
  "post-review-commit": {},
29
- "required-checks": {},
30
29
  "platform-sync-preflight": {
31
30
  "when": "issue_number_exists",
32
31
  "expected_comment_marker": "<!-- sync-issue:{task-id}:summary -->",
@@ -26,7 +26,6 @@
26
26
  },
27
27
  "review-ledger": {},
28
28
  "post-review-commit": {},
29
- "required-checks": {},
30
29
  "platform-sync-preflight": {
31
30
  "when": "issue_number_exists",
32
31
  "expected_comment_marker": "<!-- sync-issue:{task-id}:summary -->",
@@ -35,12 +35,14 @@ git rev-parse v<prev-version>
35
35
 
36
36
  ### 3. Reference Historical Release Notes Format and Categories
37
37
 
38
- Fetch multiple published release notes as format references, then use a predefined complete category list:
38
+ Load one typed release-note context, then use a predefined complete category list:
39
39
 
40
40
  Read `.agents/rules/release-commands.md` before this step.
41
41
 
42
42
  ```bash
43
- # Part A: fetch the latest 3 published release bodies by following the release query commands in `.agents/rules/release-commands.md`
43
+ agent-infra-internal platform-release-notes context \
44
+ --from-tag "v<prev-version>" --to-tag "v<version>" \
45
+ --branch "<base-branch>" --history-limit 3
44
46
  ```
45
47
 
46
48
  **Part B: Complete Category List**
@@ -58,38 +60,11 @@ Read `.agents/rules/release-commands.md` before this step.
58
60
 
59
61
  ### 4. Collect Merged PRs and Contributors
60
62
 
61
- Get the date range between tags, then query merged PRs:
62
-
63
- ```bash
64
- # Get tag dates
65
- git log v<prev-version> --format=%aI -1
66
- git log v<version> --format=%aI -1
67
-
68
- # Get merged PRs in range by following the merged-PR query command in `.agents/rules/release-commands.md`
69
- ```
70
-
71
- Also collect direct commits without PRs:
72
- ```bash
73
- git log v<prev-version>..v<version> --format="%H %s" --no-merges
74
- ```
75
-
76
- Collect collaborative contributors from commit `Co-authored-by` trailers:
77
-
78
- ```bash
79
- git log v<prev-version>..v<version> \
80
- --no-merges \
81
- --format='%(trailers:key=Co-authored-by,valueonly,unfold)' \
82
- | grep -v '^$' | sort | uniq -c | sort -rn
83
- ```
84
-
85
- Each output line is `Name <email>` and `uniq -c` provides the number of commits where that identity appeared as a co-author within the range.
63
+ Use `pullRequests` and `commits` from Step 3. Each commit's `authors` are normalized platform facts containing the git author and co-authors; the skill does not interpret raw platform fields or email rules.
86
64
 
87
65
  ### 5. Collect Related Issues
88
66
 
89
- From each PR body, extract linked Issues:
90
- - Match patterns: `Closes #N`, `Fixes #N`, `Resolves #N` (case-insensitive)
91
-
92
- Read linked Issues by following `.agents/rules/release-commands.md`.
67
+ Use each PR's `closingIssues` from Step 3. Do not parse platform-specific reference syntax in this generic skill.
93
68
 
94
69
  ### 6. Classify Changes
95
70
 
@@ -130,14 +105,13 @@ If no historical release notes exist, use the following default Markdown format:
130
105
  3. Description: Use PR title, remove `type(scope):` prefix, capitalize first letter
131
106
  4. **Contributor collection**:
132
107
  - **Data sources**:
133
- - PR authors returned by the merged-PR query rule in `.agents/rules/release-commands.md`
134
- - Commit co-authors from Step 4 `git log ... --format='%(trailers:key=Co-authored-by,valueonly,unfold)'`
135
- - Issue reporters from linked Issues collected in Step 5 (author login returned by `.agents/rules/release-commands.md`)
108
+ - PR authors from the typed context
109
+ - Commit co-authors from the typed context's commit `authors`
110
+ - Issue reporters from typed `closingIssues[].author`
136
111
  - **Contribution count**: `PR count + co-authored commit count` for the same identity, merged across both sources
137
112
  - **Name -> `@login` mapping**:
138
- - Raw `Co-authored-by` values are `Name <email>` and must be mapped to a platform `@login`
139
- - Prefer email extraction: if it matches the platform no-reply email rule in `.agents/rules/release-commands.md`, use that rule to derive the lowercased login
140
- - Otherwise use a Name heuristic: take the first token before a space and lowercase it, for example `Claude Opus 4.6 (1M context)` -> `@claude`, `Codex` -> `@codex`, `Gemini` -> `@gemini`
113
+ - For `platform-user` or `platform-noreply`, use the lowercased `login`
114
+ - Only for `unresolved`, use the Name heuristic: take the first token before a space and lowercase it
141
115
  - If the login already appears in the PR author list, merge counts into that login so `Claude` and `@claude` do not become separate entries
142
116
  - Merge all Name variants that map to the same login before counting and sorting; for example, `Claude` and `Claude Opus 4.6 (1M context)` should both collapse into `@claude`
143
117
  - Preserve bot identities as-is, for example `dependabot[bot]`
@@ -170,7 +144,12 @@ NOTES_FILE="$(mktemp "${TMPDIR:-/tmp}/agent-infra-release-notes.XXXXXX")"
170
144
 
171
145
  Write the notes content to `$NOTES_FILE`.
172
146
 
173
- 9.2 Publish by following the "Publish the Release Notes" command in `.agents/rules/release-commands.md` (use `$NOTES_FILE` for `{notes-file}`; it updates the Release already created and published by the release workflow, falling back to creating it if missing).
147
+ 9.2 Call the typed publish intent (use `$NOTES_FILE` for `{notes-file}`); it updates an existing Release or creates a missing one:
148
+
149
+ ```bash
150
+ agent-infra-internal platform-release-notes publish \
151
+ --tag "v<version>" --title "v<version>" --notes-file "$NOTES_FILE"
152
+ ```
174
153
 
175
154
  9.3 Remove the temp file whether publishing succeeds or fails:
176
155
 
@@ -35,12 +35,14 @@ git rev-parse v<prev-version>
35
35
 
36
36
  ### 3. 参考历史发布说明格式与分类
37
37
 
38
- 获取最近多条已发布的 Release Note 作为格式参考,并参考预定义的完整分类清单:
38
+ 读取一次 typed 发布说明上下文,并参考预定义的完整分类清单:
39
39
 
40
40
  执行前先读取 `.agents/rules/release-commands.md`。
41
41
 
42
42
  ```bash
43
- # Part A:按 `.agents/rules/release-commands.md` 的 release 查询命令逐条获取最近 3 条 Release 的 body
43
+ agent-infra-internal platform-release-notes context \
44
+ --from-tag "v<prev-version>" --to-tag "v<version>" \
45
+ --branch "<base-branch>" --history-limit 3
44
46
  ```
45
47
 
46
48
  **Part B:完整分类清单**
@@ -58,38 +60,11 @@ git rev-parse v<prev-version>
58
60
 
59
61
  ### 4. 收集已合并的 PR 与贡献者
60
62
 
61
- 获取标签之间的日期范围,然后查询已合并的 PR:
62
-
63
- ```bash
64
- # 获取标签日期
65
- git log v<prev-version> --format=%aI -1
66
- git log v<version> --format=%aI -1
67
-
68
- # 获取范围内已合并的 PR(按 `.agents/rules/release-commands.md` 的 merged PR 查询命令执行)
69
- ```
70
-
71
- 同时收集没有 PR 的直接提交:
72
- ```bash
73
- git log v<prev-version>..v<version> --format="%H %s" --no-merges
74
- ```
75
-
76
- 从 commit `Co-authored-by` trailer 中收集协作贡献者:
77
-
78
- ```bash
79
- git log v<prev-version>..v<version> \
80
- --no-merges \
81
- --format='%(trailers:key=Co-authored-by,valueonly,unfold)' \
82
- | grep -v '^$' | sort | uniq -c | sort -rn
83
- ```
84
-
85
- 输出每行一个 `Name <email>`(`uniq -c` 给出该身份在范围内作为 co-author 的 commit 数)。
63
+ 使用步骤 3 返回的 `pullRequests` 与 `commits`。每个 commit 的 `authors` 已按平台事实规范化并包含 git author 与 co-author;技能不读取平台原始字段或邮箱规则。
86
64
 
87
65
  ### 5. 收集关联 Issue
88
66
 
89
- 从每个 PR body 中提取关联的 Issue:
90
- - 匹配模式:`Closes #N`、`Fixes #N`、`Resolves #N`(不区分大小写)
91
-
92
- 按 `.agents/rules/release-commands.md` 的关联 Issue 查询命令读取。
67
+ 使用步骤 3 中每个 PR 的 `closingIssues`,不在通用技能中解析平台专有引用语法。
93
68
 
94
69
  ### 6. 分类变更
95
70
 
@@ -131,13 +106,12 @@ git log v<prev-version>..v<version> \
131
106
  4. **贡献者搜集**:
132
107
  - **数据源**:
133
108
  - PR author:来自 `.agents/rules/release-commands.md` 中已合并 PR 查询规则
134
- - Commit co-authors:来自步骤 4 的 `git log ... --format='%(trailers:key=Co-authored-by,valueonly,unfold)'`
135
- - Issue reporters:来自步骤 5 收集的关联 Issue author(由 `.agents/rules/release-commands.md` 返回)
109
+ - Commit co-authors:来自步骤 3 typed context 的 commit `authors`
110
+ - Issue reporters:来自步骤 3 typed context 的 `closingIssues[].author`
136
111
  - **贡献数定义**:`该人的 PR 数 + 该人作为 co-author 的 commit 数`(同一身份跨来源合并计数)
137
112
  - **Name → `@login` 映射**:
138
- - `Co-authored-by` 原始格式为 `Name <email>`,需要推断对应的 platform `@login`
139
- - 优先从 email 提取:匹配 `.agents/rules/release-commands.md` 中的平台 no-reply 邮箱规则时,按该规则推导小写 login
140
- - 否则按 Name 启发式:取首个空格前的 token 并转为小写(例如 `Claude Opus 4.6 (1M context)` → `@claude`、`Codex` → `@codex`、`Gemini` → `@gemini`)
113
+ - `resolution` 为 `platform-user` 或 `platform-noreply` 时直接采用小写 `login`
114
+ - 仅当 `resolution` 为 `unresolved` 时按 Name 启发式:取首个空格前的 token 并转为小写
141
115
  - 已出现在 PR author 列表中的 login,必须按该 login 合并计数,避免把 `Claude` 和 `@claude` 拆成两个条目
142
116
  - 同一 login 的所有 Name 变体都必须归并后再计数与排序;例如 `Claude` 与 `Claude Opus 4.6 (1M context)` 都映射到 `@claude` 时,应先合并为同一个贡献者
143
117
  - Bot 身份保留原样(如 `dependabot[bot]`)
@@ -170,7 +144,12 @@ NOTES_FILE="$(mktemp "${TMPDIR:-/tmp}/agent-infra-release-notes.XXXXXX")"
170
144
 
171
145
  把 notes 内容写入 `$NOTES_FILE`。
172
146
 
173
- 9.2 按 `.agents/rules/release-commands.md` 的「发布 Release notes」命令执行(命令中的 `{notes-file}` 用 `$NOTES_FILE`;写入已由 release 工作流自动创建/发布的 Release,不存在时兜底创建)。
147
+ 9.2 调用 typed publish intent(命令中的 `{notes-file}` 用 `$NOTES_FILE`);它会更新已存在的 Release,不存在时创建:
148
+
149
+ ```bash
150
+ agent-infra-internal platform-release-notes publish \
151
+ --tag "v<version>" --title "v<version>" --notes-file "$NOTES_FILE"
152
+ ```
174
153
 
175
154
  9.3 无论发布成功或失败,都删除临时文件:
176
155
 
@@ -53,6 +53,8 @@ Extract from the natural-language description:
53
53
  - `<slug>` is a kebab-case slug built from 3-6 English keywords extracted from the task title
54
54
  - **Detailed description**: the cleaned-up original user request
55
55
 
56
+ Before this step, read `reference/context-capture.md`. Classify the information already present in the current request and necessary prior discussion by source and state, ready to write under task.md `## Task Input`; leave missing categories empty and do not infer or analyze them.
57
+
56
58
  If the description is unclear, **ask the user to clarify first**.
57
59
 
58
60
  **Type inference**: choose the best matching type from the following candidates based on the semantics of the task description:
@@ -78,6 +80,7 @@ date +%Y%m%d-%H%M%S
78
80
 
79
81
  - Create the task directory: `.agents/workspace/active/TASK-{yyyyMMdd-HHmmss}/`
80
82
  - Use the `.agents/templates/task.md` template to create the task file: `task.md`
83
+ - Write the structured context captured in step 1 under `## Task Input` so the task remains understandable outside the original conversation
81
84
 
82
85
  **Important**:
83
86
  - Directory naming: `TASK-{yyyyMMdd-HHmmss}` (**must** include the `TASK-` prefix)
@@ -240,6 +243,7 @@ For later platform sync: after fixing auth / network / template issues, manually
240
243
  ## Completion Checklist
241
244
 
242
245
  - [ ] Created the task file `.agents/workspace/active/{task-id}/task.md`
246
+ - [ ] Wrote and checked `## Task Input` source and state semantics according to `reference/context-capture.md`
243
247
  - [ ] Updated `current_step` to requirement-analysis in task.md
244
248
  - [ ] Updated `updated_at` to the current time in task.md
245
249
  - [ ] Updated `assigned_to` in task.md
@@ -52,6 +52,8 @@ description: >
52
52
  - `<slug>` 从任务标题提取 3-6 个英文关键词并转为 kebab-case
53
53
  - **详细描述**:整理后的用户原始描述
54
54
 
55
+ 执行本步骤前,先读取 `reference/context-capture.md`。把当前请求及必要前序讨论中已有的信息按来源与状态分类,准备写入 task.md 的 `## 任务输入`;缺失类别保持为空,不执行推导或分析。
56
+
55
57
  如果描述不清晰,**先向用户确认**再继续。
56
58
 
57
59
  **类型推断**:根据任务描述的语义,从以下候选值中选择最匹配的类型:
@@ -77,6 +79,7 @@ date +%Y%m%d-%H%M%S
77
79
 
78
80
  - 创建任务目录:`.agents/workspace/active/TASK-{yyyyMMdd-HHmmss}/`
79
81
  - 使用 `.agents/templates/task.md` 模板创建任务文件:`task.md`
82
+ - 将步骤 1 捕获的结构化上下文写入 `## 任务输入`,确保任务文件脱离原会话后仍可理解
80
83
 
81
84
  **重要**:
82
85
  - 目录命名:`TASK-{yyyyMMdd-HHmmss}`(**必须**包含 `TASK-` 前缀)
@@ -239,6 +242,7 @@ Issue 创建失败:
239
242
  ## 完成检查清单
240
243
 
241
244
  - [ ] 创建了任务文件 `.agents/workspace/active/{task-id}/task.md`
245
+ - [ ] 已按 `reference/context-capture.md` 写入并复核 `## 任务输入` 的来源与状态语义
242
246
  - [ ] 更新了 task.md 中的 `current_step` 为 requirement-analysis
243
247
  - [ ] 更新了 task.md 中的 `updated_at` 为当前时间
244
248
  - [ ] 更新了 task.md 中的 `assigned_to`
@@ -0,0 +1,29 @@
1
+ # Context Capture Protocol
2
+
3
+ ## Scope
4
+
5
+ Capture only the current natural-language request and the necessary prior discussion that is visible in the current context and directly relevant to the task. Do not read outside the available context, preserve a full transcript, perform requirements analysis, analyze code impact, or design a solution.
6
+
7
+ ## Classification
8
+
9
+ Faithfully condense existing information into task.md under `## Task Input`:
10
+
11
+ - `### Sources`: identify the current user request, an earlier user statement, user confirmation, or an agent suggestion.
12
+ - `### Confirmed Facts and Evidence`: include only user-provided or verified facts, reproduction steps, errors, and observations.
13
+ - `### Constraints`: preserve explicit user limits, security boundaries, and compatibility requirements.
14
+ - `### Confirmed Decisions`: include only directions explicitly confirmed by the user; never promote an agent suggestion to an approved decision.
15
+ - `### Candidate and Rejected Options`: label each item as a candidate, agent suggestion, tentative assumption, or rejected option and preserve its source.
16
+ - `### Acceptance Criteria`: retain user-provided observable inputs, actions, and expected results.
17
+ - `### Open Questions`: retain unanswered questions and choices that still require a decision.
18
+
19
+ Leave missing categories empty rather than inferring content. Deduplicate repeated information without losing its source or state.
20
+
21
+ ## Safety and Compression
22
+
23
+ - Exclude secrets, tokens, credentials, and unrelated personal information.
24
+ - Write a self-contained summary instead of copying the full transcript.
25
+ - Preserve commands, error text, paths, or identifiers only when necessary for reproduction or acceptance.
26
+
27
+ ## Completion Check
28
+
29
+ A reader with only the generated task.md must be able to distinguish confirmed information, candidates or assumptions, rejected content, and open questions, and understand the task goal and existing acceptance criteria.
@@ -0,0 +1,29 @@
1
+ # 上下文捕获协议
2
+
3
+ ## 范围
4
+
5
+ 只捕获当前自然语言请求及当前上下文中可见、与任务直接相关的必要前序讨论。不读取上下文之外的信息,不保存完整聊天记录,也不执行需求分析、代码影响分析或技术设计。
6
+
7
+ ## 分类
8
+
9
+ 将已有信息忠实压缩并写入 task.md 的 `## 任务输入`:
10
+
11
+ - `### 来源`:注明用户当次请求、用户前序陈述、用户确认或 Agent 建议等来源。
12
+ - `### 已确认事实与证据`:只写用户提供或已核实的事实、复现步骤、错误和观察结果。
13
+ - `### 约束`:保留用户明确限制、安全边界和兼容要求。
14
+ - `### 已确认决策`:只写用户明确确认的方向;不得把 Agent 建议升级为已批准决策。
15
+ - `### 候选与否决方案`:注明每项是候选、Agent 建议、暂定假设或已否决方案,并保留来源。
16
+ - `### 验收标准`:保存用户已给出的可观察输入、动作和预期结果。
17
+ - `### 未决事项`:保存尚未回答的问题或仍需裁定的选择。
18
+
19
+ 缺失类别保持为空,不推导补齐。相同信息去重,但不得丢失来源或状态语义。
20
+
21
+ ## 安全与压缩
22
+
23
+ - 排除密钥、Token、凭据和与任务无关的个人信息。
24
+ - 使用自足摘要,不逐字复制完整 transcript。
25
+ - 保留命令、错误文本、路径或标识符时,只保留复现和验收所必需的部分。
26
+
27
+ ## 完成检查
28
+
29
+ 仅阅读生成的 task.md 时,应能区分已确认内容、候选或假设、否决内容和未决事项,并能理解任务目标与已有验收标准。
@@ -22,6 +22,24 @@ pr_status: pending # PR status: pending (default) | created (PR crea
22
22
 
23
23
  [Describe the task clearly and concisely.]
24
24
 
25
+ ## Task Input
26
+
27
+ <!-- Populated by create-task from information already present in the current request and necessary prior discussion. Leave missing categories empty; do not infer them. -->
28
+
29
+ ### Sources
30
+
31
+ ### Confirmed Facts and Evidence
32
+
33
+ ### Constraints
34
+
35
+ ### Confirmed Decisions
36
+
37
+ ### Candidate and Rejected Options
38
+
39
+ ### Acceptance Criteria
40
+
41
+ ### Open Questions
42
+
25
43
  ## Context
26
44
 
27
45
  - **Related Issue**: #XXX
@@ -22,6 +22,24 @@ pr_status: pending # PR 状态:pending(默认)| created(已
22
22
 
23
23
  [清晰简洁地描述任务。]
24
24
 
25
+ ## 任务输入
26
+
27
+ <!-- 由 create-task 忠实记录当前请求及必要前序讨论中已有的信息;缺失项保持为空,不推导补齐。 -->
28
+
29
+ ### 来源
30
+
31
+ ### 已确认事实与证据
32
+
33
+ ### 约束
34
+
35
+ ### 已确认决策
36
+
37
+ ### 候选与否决方案
38
+
39
+ ### 验收标准
40
+
41
+ ### 未决事项
42
+
25
43
  ## 上下文
26
44
 
27
45
  - **关联 Issue**:#XXX