@fitlab-ai/agent-infra 0.9.12 → 0.9.13
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.
- package/README.md +11 -11
- package/README.zh-CN.md +11 -11
- package/dist/bin/internal-cli.js +24 -19
- package/dist/lib/agent-clients/next-steps.js +6 -1
- package/dist/lib/decide.js +3 -3
- package/dist/lib/internal/platform-checks.js +3 -3
- package/dist/lib/internal/platform-comment.js +9 -9
- package/dist/lib/internal/platform-context.js +2 -2
- package/dist/lib/internal/platform-issue.js +8 -9
- package/dist/lib/internal/platform-pr-review.js +10 -10
- package/dist/lib/internal/platform-pr.js +63 -24
- package/dist/lib/internal/platform-release-notes.js +3 -3
- package/dist/lib/internal/pr-review-grade.js +11 -9
- package/dist/lib/internal/release-workflow.js +4 -4
- package/dist/lib/internal/sandbox-control.js +30 -4
- package/dist/lib/internal/task-activity.js +3 -3
- package/dist/lib/internal/task-artifact.js +76 -24
- package/dist/lib/internal/task-create.js +2 -2
- package/dist/lib/internal/task-event.js +6 -3
- package/dist/lib/internal/task-finalization.js +2 -2
- package/dist/lib/internal/task-invalidation.js +60 -0
- package/dist/lib/internal/task-ledger.js +9 -6
- package/dist/lib/internal/task-lifecycle.js +2 -2
- package/dist/lib/internal/task-override.js +4 -4
- package/dist/lib/internal/task-review.js +3 -3
- package/dist/lib/internal/task-verify.js +6 -6
- package/dist/lib/internal/task-warning.js +3 -3
- package/dist/lib/platform/adapters.js +1 -3
- package/dist/lib/platform/change-request-git-evidence.js +27 -7
- package/dist/lib/platform/completion-backfill.js +6 -5
- package/dist/lib/platform/context.js +70 -130
- package/dist/lib/platform/github-client.js +1 -1
- package/dist/lib/platform/github-provider.js +903 -0
- package/dist/lib/platform/in-label-sync.js +143 -0
- package/dist/lib/platform/issue-comments.js +94 -41
- package/dist/lib/platform/issues.js +335 -189
- package/dist/lib/platform/metadata-labels.js +6 -2
- package/dist/lib/platform/none-provider.js +28 -0
- package/dist/lib/platform/pr-change-report.js +551 -0
- package/dist/lib/platform/pr-checks.js +119 -104
- package/dist/lib/platform/pr-review.js +88 -72
- package/dist/lib/platform/pr-summary.js +520 -50
- package/dist/lib/platform/provider-bridge.js +45 -0
- package/dist/lib/platform/provider-contract.d.ts +487 -0
- package/dist/lib/platform/provider-contract.js +95 -0
- package/dist/lib/platform/provider-loader.js +251 -0
- package/dist/lib/platform/provider-validation.js +504 -0
- package/dist/lib/platform/pull-request-metadata.js +8 -6
- package/dist/lib/platform/pull-requests.js +783 -537
- package/dist/lib/platform/release-notes.js +78 -55
- package/dist/lib/platform/releases.js +79 -50
- package/dist/lib/platform/resource-identity.d.ts +26 -0
- package/dist/lib/platform/resource-identity.js +92 -0
- package/dist/lib/platform/task-identities.js +31 -0
- package/dist/lib/platform/verification-required.js +11 -12
- package/dist/lib/platform/verification-sync.js +112 -238
- package/dist/lib/pr-review/evidence-grading.js +19 -6
- package/dist/lib/run/index.js +63 -23
- package/dist/lib/sandbox/control/client.js +96 -15
- package/dist/lib/sandbox/control/executor.js +3 -3
- package/dist/lib/sandbox/control/protocol.js +77 -0
- package/dist/lib/sandbox/control/server.js +398 -25
- package/dist/lib/sandbox/control/state.js +204 -1
- package/dist/lib/server/protocol.js +38 -1
- package/dist/lib/task/activity-log.js +8 -1
- package/dist/lib/task/artifact-lifecycle.js +33 -5
- package/dist/lib/task/capabilities.js +239 -0
- package/dist/lib/task/commands/status.js +32 -0
- package/dist/lib/task/commit-operation.js +12 -1
- package/dist/lib/task/control-authority.js +8 -5
- package/dist/lib/task/create-service.js +8 -8
- package/dist/lib/task/current-contract.js +5 -1
- package/dist/lib/task/decision-details.js +1 -1
- package/dist/lib/task/events.js +297 -17
- package/dist/lib/task/finalization.js +37 -13
- package/dist/lib/task/human-override.js +58 -36
- package/dist/lib/task/invalidation-command.js +86 -0
- package/dist/lib/task/invalidation.js +260 -0
- package/dist/lib/task/ledger-intents.js +37 -0
- package/dist/lib/task/local-artifact-finalization.js +374 -0
- package/dist/lib/task/orchestration.js +49 -93
- package/dist/lib/task/pr-delivery-fact.js +102 -101
- package/dist/lib/task/review-fingerprint.js +24 -2
- package/dist/lib/task/rework-intent.js +138 -0
- package/dist/lib/task/skill-scope.js +23 -0
- package/dist/lib/task/task-execution-lock.js +27 -17
- package/dist/lib/task/verification-engine.js +43 -16
- package/dist/lib/task/verification.js +3 -3
- package/dist/lib/task/workflow-warning-intents.js +1 -1
- package/dist/lib/task/write.js +11 -0
- package/dist/lib/version.js +11 -1
- package/dist/lifecycle-build-manifest.json +3 -3
- package/lib/agent-clients/next-steps.ts +6 -1
- package/lib/decide.ts +3 -3
- package/lib/init.ts +1 -1
- package/lib/internal/platform-checks.ts +3 -3
- package/lib/internal/platform-comment.ts +8 -8
- package/lib/internal/platform-context.ts +2 -2
- package/lib/internal/platform-issue.ts +7 -8
- package/lib/internal/platform-pr-review.ts +9 -9
- package/lib/internal/platform-pr.ts +47 -22
- package/lib/internal/platform-release-notes.ts +3 -3
- package/lib/internal/pr-review-grade.ts +10 -8
- package/lib/internal/release-workflow.ts +4 -4
- package/lib/internal/sandbox-control.ts +27 -3
- package/lib/internal/task-activity.ts +3 -3
- package/lib/internal/task-artifact.ts +65 -22
- package/lib/internal/task-create.ts +2 -2
- package/lib/internal/task-event.ts +6 -3
- package/lib/internal/task-finalization.ts +3 -3
- package/lib/internal/task-invalidation.ts +39 -0
- package/lib/internal/task-ledger.ts +11 -8
- package/lib/internal/task-lifecycle.ts +2 -2
- package/lib/internal/task-override.ts +6 -6
- package/lib/internal/task-review.ts +3 -3
- package/lib/internal/task-verify.ts +6 -6
- package/lib/internal/task-warning.ts +3 -3
- package/lib/platform/adapters.ts +3 -2
- package/lib/platform/change-request-git-evidence.ts +36 -9
- package/lib/platform/completion-backfill.ts +9 -8
- package/lib/platform/context.ts +97 -134
- package/lib/platform/github-client.ts +2 -2
- package/lib/platform/github-provider.ts +910 -0
- package/lib/platform/in-label-sync.ts +208 -0
- package/lib/platform/issue-comments.ts +97 -47
- package/lib/platform/issues.ts +344 -174
- package/lib/platform/metadata-labels.ts +5 -2
- package/lib/platform/none-provider.ts +35 -0
- package/lib/platform/pr-change-report.ts +645 -0
- package/lib/platform/pr-checks.ts +126 -106
- package/lib/platform/pr-review.ts +88 -85
- package/lib/platform/pr-summary.ts +560 -53
- package/lib/platform/provider-bridge.ts +82 -0
- package/lib/platform/provider-contract.ts +536 -0
- package/lib/platform/provider-loader.ts +307 -0
- package/lib/platform/provider-validation.ts +529 -0
- package/lib/platform/pull-request-metadata.ts +10 -7
- package/lib/platform/pull-requests.ts +826 -543
- package/lib/platform/release-notes.ts +76 -59
- package/lib/platform/releases.ts +77 -43
- package/lib/platform/resource-identity.ts +121 -0
- package/lib/platform/task-identities.ts +40 -0
- package/lib/platform/types.ts +4 -2
- package/lib/platform/verification-required.ts +11 -13
- package/lib/platform/verification-sync.ts +112 -292
- package/lib/pr-review/evidence-grading.ts +25 -8
- package/lib/run/index.ts +57 -22
- package/lib/sandbox/control/client.ts +105 -15
- package/lib/sandbox/control/executor.ts +4 -4
- package/lib/sandbox/control/protocol.ts +113 -0
- package/lib/sandbox/control/server.ts +431 -23
- package/lib/sandbox/control/state.ts +251 -1
- package/lib/server/protocol.ts +36 -1
- package/lib/task/activity-log.ts +8 -0
- package/lib/task/artifact-lifecycle.ts +32 -6
- package/lib/task/capabilities.ts +262 -0
- package/lib/task/commands/status.ts +38 -0
- package/lib/task/commit-operation.ts +12 -1
- package/lib/task/control-authority.ts +11 -8
- package/lib/task/create-service.ts +8 -8
- package/lib/task/current-contract.ts +6 -1
- package/lib/task/decision-details.ts +6 -2
- package/lib/task/events.ts +296 -16
- package/lib/task/finalization.ts +50 -14
- package/lib/task/human-override.ts +70 -46
- package/lib/task/invalidation-command.ts +86 -0
- package/lib/task/invalidation.ts +332 -0
- package/lib/task/ledger-intents.ts +35 -1
- package/lib/task/local-artifact-finalization.ts +563 -0
- package/lib/task/orchestration.ts +52 -85
- package/lib/task/pr-delivery-fact.ts +131 -148
- package/lib/task/review-fingerprint.ts +23 -2
- package/lib/task/rework-intent.ts +165 -0
- package/lib/task/skill-scope.ts +24 -0
- package/lib/task/task-execution-lock.ts +23 -14
- package/lib/task/verification-engine.ts +52 -17
- package/lib/task/verification.ts +4 -4
- package/lib/task/workflow-warning-intents.ts +1 -1
- package/lib/task/write.ts +19 -0
- package/lib/update.ts +1 -1
- package/lib/version.ts +15 -1
- package/package.json +7 -1
- package/templates/.agents/rules/README.en.md +1 -1
- package/templates/.agents/rules/README.zh-CN.md +1 -1
- package/templates/.agents/rules/issue-pr-commands.en.md +1 -1
- package/templates/.agents/rules/issue-pr-commands.zh-CN.md +1 -1
- package/templates/.agents/rules/issue-sync.en.md +2 -0
- package/templates/.agents/rules/issue-sync.zh-CN.md +2 -0
- package/templates/.agents/rules/local-artifact-repair.en.md +9 -2
- package/templates/.agents/rules/local-artifact-repair.zh-CN.md +9 -2
- package/templates/.agents/rules/pr-sync.en.md +10 -4
- package/templates/.agents/rules/pr-sync.zh-CN.md +17 -4
- package/templates/.agents/rules/task-short-id.en.md +1 -4
- package/templates/.agents/rules/task-short-id.zh-CN.md +1 -3
- package/templates/.agents/skills/analyze-task/SKILL.en.md +13 -3
- package/templates/.agents/skills/analyze-task/SKILL.zh-CN.md +10 -3
- package/templates/.agents/skills/check-task/SKILL.en.md +16 -37
- package/templates/.agents/skills/check-task/SKILL.zh-CN.md +16 -37
- package/templates/.agents/skills/code-task/SKILL.en.md +27 -8
- package/templates/.agents/skills/code-task/SKILL.zh-CN.md +29 -10
- package/templates/.agents/skills/code-task/config/verify.en.json +1 -0
- package/templates/.agents/skills/code-task/config/verify.zh-CN.json +1 -0
- package/templates/.agents/skills/commit/reference/issue-metadata-sync.en.md +2 -0
- package/templates/.agents/skills/commit/reference/issue-metadata-sync.zh-CN.md +2 -0
- package/templates/.agents/skills/commit/reference/pr-summary-sync.en.md +3 -3
- package/templates/.agents/skills/commit/reference/pr-summary-sync.zh-CN.md +3 -3
- package/templates/.agents/skills/complete-manual-validation/SKILL.en.md +5 -3
- package/templates/.agents/skills/complete-manual-validation/SKILL.zh-CN.md +5 -3
- package/templates/.agents/skills/complete-manual-validation/reference/summary-update.en.md +4 -3
- package/templates/.agents/skills/complete-manual-validation/reference/summary-update.zh-CN.md +4 -3
- package/templates/.agents/skills/complete-task/SKILL.en.md +21 -3
- package/templates/.agents/skills/complete-task/SKILL.zh-CN.md +20 -3
- package/templates/.agents/skills/create-pr/SKILL.en.md +7 -6
- package/templates/.agents/skills/create-pr/SKILL.zh-CN.md +7 -7
- package/templates/.agents/skills/create-pr/config/verify.json +1 -0
- package/templates/.agents/skills/create-pr/reference/change-report.en.md +16 -4
- package/templates/.agents/skills/create-pr/reference/change-report.zh-CN.md +16 -4
- package/templates/.agents/skills/create-pr/reference/comment-publish.en.md +5 -3
- package/templates/.agents/skills/create-pr/reference/comment-publish.zh-CN.md +5 -3
- package/templates/.agents/skills/create-pr/reference/pr-body-template.en.md +1 -1
- package/templates/.agents/skills/create-pr/reference/pr-body-template.zh-CN.md +1 -1
- package/templates/.agents/skills/create-pr/scripts/change-report.mjs +3 -0
- package/templates/.agents/skills/plan-task/SKILL.en.md +13 -3
- package/templates/.agents/skills/plan-task/SKILL.zh-CN.md +10 -3
- package/templates/.agents/skills/review-analysis/SKILL.en.md +3 -3
- package/templates/.agents/skills/review-analysis/SKILL.zh-CN.md +3 -3
- package/templates/.agents/skills/review-code/SKILL.en.md +4 -4
- package/templates/.agents/skills/review-code/SKILL.zh-CN.md +4 -4
- package/templates/.agents/skills/review-plan/SKILL.en.md +3 -3
- package/templates/.agents/skills/review-plan/SKILL.zh-CN.md +3 -3
- package/templates/.agents/skills/run-manual-validation/SKILL.en.md +4 -2
- package/templates/.agents/skills/run-manual-validation/SKILL.zh-CN.md +4 -2
- package/templates/.agents/skills/watch-pr/SKILL.en.md +2 -2
- package/templates/.agents/skills/watch-pr/SKILL.zh-CN.md +2 -2
- package/templates/.agents/skills/watch-pr/reference/monitor-and-heal.en.md +6 -0
- package/templates/.agents/skills/watch-pr/reference/monitor-and-heal.zh-CN.md +6 -0
- package/templates/.agents/templates/task.en.md +18 -1
- package/templates/.agents/templates/task.zh-CN.md +18 -1
- package/templates/.github/workflows/pr-label.yml +7 -26
|
@@ -25,6 +25,8 @@ agent-infra-internal platform-issue sync {task-id} --agent {standard-agent-token
|
|
|
25
25
|
|
|
26
26
|
The core owns status/in labels, assignees, milestones, Issue Type, pinned fields, requirements, state, capabilities, dry-run, retries, errors, and idempotency. Omitted flags preserve values; `none` explicitly clears them. Status labels converge to at most one, and ambiguous requirement identity fails closed.
|
|
27
27
|
|
|
28
|
+
PR event `in:` synchronization uses `agent-infra-internal platform-pr sync-in-labels --pr <N> [--cwd <path>]`. PR files are the event evidence; a unique closing Issue is written and re-read before the PR. Zero or multiple closing Issues update only the PR and return `degraded`; unknown side effects or failed convergence return `blocked` with `IN_LABEL_SYNC_PARTIAL`.
|
|
29
|
+
|
|
28
30
|
`planned|applied|no-op|degraded` exit 0; `failed` exits 1; `blocked` exits 2.
|
|
29
31
|
|
|
30
32
|
Map material degraded/failed/blocked results to workflow warnings through the structured intent; callers must not edit warning rows directly:
|
|
@@ -71,6 +71,8 @@ agent-infra-internal platform-issue sync {task-id} --agent {standard-agent-token
|
|
|
71
71
|
|
|
72
72
|
status labels 始终至多一个;关闭后不保留 status label。`in:` labels 只从项目允许映射与仓库实际 labels 交集产生。需求复选框以 task.md 原文为身份,歧义时 fail closed。
|
|
73
73
|
|
|
74
|
+
PR event 的 `in:` 同步使用 `agent-infra-internal platform-pr sync-in-labels --pr <N> [--cwd <path>]`。PR files 是事件证据;唯一 closing Issue 按 Issue→PR 顺序写入并复读,零或多个 closing Issue 只写 PR 并返回 `degraded`。写入后副作用不明或复读未收敛必须返回 `blocked` 与 `IN_LABEL_SYNC_PARTIAL`。
|
|
75
|
+
|
|
74
76
|
## 补发
|
|
75
77
|
|
|
76
78
|
complete-task 按 artifact catalog 时间线遍历本地已有产物:task 使用 `--kind task`,其余使用 `--kind artifact --artifact <file> --backfill`;最后用 `--kind summary --body-file <path>` 原地同步交付摘要。artifact backfill 在远端缺少 marker 时创建带“历史产物补发”提示的评论;已存在合法 marker 集合时保持原评论和分片不变并返回 `no-op`;marker 冲突仍失败。该判定由 core 完成,不由 Skill 扫描评论或拼标题。
|
|
@@ -1,12 +1,19 @@
|
|
|
1
1
|
# General Rule - Model-Driven Local Artifact Repair
|
|
2
2
|
|
|
3
|
-
This rule applies
|
|
3
|
+
This rule applies when `analyze-task`, `plan-task`, or `code-task` handles **the same controlled local artifact** before its completed event, and when `review-analysis`, `review-plan`, or `review-code` handles a finalizer failure for **the same controlled review artifact**. It does not apply to `task.md`, the ledger, receipts, source code, Git, platform resources, or lifecycle state.
|
|
4
|
+
|
|
5
|
+
## Pre-completion gate for analysis, plan, and code artifacts
|
|
6
|
+
|
|
7
|
+
- `analyze-task`, `plan-task`, and `code-task` must call `task-artifact ... finalize-local` before publishing a completed event; pass only that call's `artifactSha256` and `semanticDigest` to the completed event.
|
|
8
|
+
- `finalize-local` does not modify the artifact or task state, but it writes a one-shot local provenance intent in the repository workspace. After `failed`, the model may make one minimal edit in the same artifact only when `repairable=true` and the diagnostic explicitly describes a one-line replacement, then rerun the same call completely; count each byte-changing edit, up to 8.
|
|
9
|
+
- The first repairable failure's semantic digest is retained in that intent; a later `passed` result must match the baseline, and the completed event must verify and atomically transition the same intent to `consumed` before writing `task.md` under the task lock. A consumption failure must not write the task; the consumed intent is durable and retryable, so no failure-prone post-write deletion is attempted. Do not replace a failed baseline with a newly computed digest or publish a completed event without the finalizer.
|
|
10
|
+
- After `failed`, no progress, or a repeated diagnostic or fingerprint, do not publish a completed event. After `passed`, do not rescan or manually write summary data.
|
|
4
11
|
|
|
5
12
|
## Authorization Boundary
|
|
6
13
|
|
|
7
14
|
- The finalizer only reads facts, validates state, normalizes successful results, and performs atomic writes. It does not maintain a recoverable-error allowlist, infer repairability, or choose report content to delete.
|
|
8
15
|
- The initial finalizer call is not counted as a repair attempt. Editing is allowed only after the mechanical safety gates pass and the model explicitly determines that the current problem can be solved by a minimal, explainable artifact change.
|
|
9
|
-
- The model may edit only the one ordinary
|
|
16
|
+
- The model may edit only the one ordinary local artifact declared by the current skill, and the file must be inside the current task directory. It must not edit `task.md`, the review disagreement ledger, receipts, source code, other reports, or remote resources.
|
|
10
17
|
- `changed=false`, an error code, or a format shape is diagnostic evidence, not automatic authorization. The model must judge each case using the complete diagnostic, artifact content, and context.
|
|
11
18
|
|
|
12
19
|
## Non-bypassable Mechanical Safety Gates
|
|
@@ -1,12 +1,19 @@
|
|
|
1
1
|
# 通用规则 - 模型驱动的本地产物修复
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
本规则适用于 `analyze-task`、`plan-task`、`code-task` 在 completed 事件前处理**同一个受控本地产物**,以及 `review-analysis`、`review-plan`、`review-code` 在 finalizer 失败后处理**同一个受控 review artifact** 的场景。它不适用于 task.md、账本、receipt、源码、Git、平台资源或生命周期状态。
|
|
4
|
+
|
|
5
|
+
## 分析、方案和代码产物完成前门禁
|
|
6
|
+
|
|
7
|
+
- `analyze-task`、`plan-task` 和 `code-task` 必须在发布 completed 事件前调用 `task-artifact ... finalize-local`;只有同一次返回的 `artifactSha256` 和 `semanticDigest` 才能传给 completed 事件。
|
|
8
|
+
- `finalize-local` 不修改产物或任务状态,但会在仓库工作区写入一次性的本地 provenance intent。返回 `failed` 时,只有 `repairable=true` 且诊断明确为单行替换,模型才可在同一产物中执行一次最小编辑,然后完整重跑同一调用;每次实际字节修改计一次,最多 8 次。
|
|
9
|
+
- 首次可修复失败的 semantic digest 会保存在该 intent 中;后续 `passed` 必须匹配该基线,completed event 还必须在任务锁内验证并在写 task.md 前原子转换为 `consumed` 状态。消费失败时不得写任务;转换后的 intent 是可重试的 durable 记录,成功写入后不再执行可能失败的后置删除。不得用重新计算的新摘要替换失败基线,也不得绕过 finalizer 直接发布 completed event。
|
|
10
|
+
- 返回 `failed`、无进展、诊断或指纹重复时不得发布 completed 事件;返回 `passed` 后也不得重新扫描或手工补写摘要。
|
|
4
11
|
|
|
5
12
|
## 授权边界
|
|
6
13
|
|
|
7
14
|
- finalizer 只负责读取事实、校验状态、规范化成功结果和原子写入;它不维护可修复错误码白名单,不推断 repairability,也不自动选择要删除的报告内容。
|
|
8
15
|
- 首次 finalizer 调用不计入修复次数。只有在机械安全门通过后,模型明确判断当前问题能通过最小、可解释的 artifact 修改解决时,才允许编辑。
|
|
9
|
-
- 模型只能修改当前
|
|
16
|
+
- 模型只能修改当前 skill 声明的一个普通本地产物,且该文件必须位于当前 task 目录。不得修改 task.md、审查分歧账本、receipt、源码、其他报告或远端资源。
|
|
10
17
|
- `changed=false`、错误码或某个格式形状只是诊断事实,不是自动批准。模型必须结合完整诊断、artifact 内容和上下文逐例判断。
|
|
11
18
|
|
|
12
19
|
## 不可绕过的机械安全门
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
> `--agent` values are defined in `.agents/rules/task-management.md` under “Collaborator Token Specification”.
|
|
4
4
|
|
|
5
|
-
The model writes the semantic reviewer summary. Typed core owns canonical
|
|
5
|
+
The model writes the semantic reviewer summary. Typed core owns the task-intent digest, complete three-dot diff, canonical `pr-change-report.json` sidecar, report rendering, authoritative PR-head wrapping, paginated comment lookup, and reconciliation.
|
|
6
6
|
|
|
7
7
|
## Three-Layer Isolation
|
|
8
8
|
|
|
@@ -15,11 +15,17 @@ The three never cross: a regular PR comment does not carry the full process copy
|
|
|
15
15
|
```bash
|
|
16
16
|
agent-infra-internal platform-pr summary-context {task-id}
|
|
17
17
|
|
|
18
|
+
agent-infra-internal platform-pr change-report {task-id} \
|
|
19
|
+
--agent {standard-agent-token} --mechanical-file {mechanical-report-file} \
|
|
20
|
+
--precheck-file {precheck-candidate-file}
|
|
21
|
+
|
|
18
22
|
agent-infra-internal platform-pr summary-sync {task-id} \
|
|
19
|
-
--agent {standard-agent-token} --body-file {summary-body-file}
|
|
23
|
+
--agent {standard-agent-token} --body-file {summary-body-file} \
|
|
24
|
+
--change-report-file .agents/workspace/active/{task-id}/pr-change-report.json \
|
|
25
|
+
--result {primary-result}
|
|
20
26
|
```
|
|
21
27
|
|
|
22
|
-
Use only canonical inputs returned by the context command. Write the plain body without marker or SHA. The core owns `<!-- sync-pr:{task-id}:summary -->`,
|
|
28
|
+
Use only canonical inputs returned by the context command. The precheck must contain file evidence for six fixed checks; `formalReview` is always false and `needs-review` routes to `review-code`. Write the plain body with exactly one `<!-- canonical-pr-change-report -->` placeholder, without a report heading/JSON, marker, or SHA. The core validates the task-intent digest, bound PR identity, complete patch SHA, and mechanical totals before rendering the report, then owns `<!-- sync-pr:{task-id}:summary -->`, authoritative `<!-- last-commit: ... -->`, create/update/no-op behavior, and duplicate-marker conflicts. Missing, stale, invalid, or bypassed report input never publishes; summary failure never rolls back a PR or commit.
|
|
23
29
|
|
|
24
30
|
The canonical comment envelope produced by the core is:
|
|
25
31
|
|
|
@@ -34,7 +40,7 @@ The canonical comment envelope produced by the core is:
|
|
|
34
40
|
### PR Code Changes
|
|
35
41
|
```
|
|
36
42
|
|
|
37
|
-
Canonical inputs include `manual-validation.md`. The manual-validation section is one of `### ✅ Manual Validation Passed`, `### ⚠️ Manual Verification Required`, or `### ✅ No Manual Verification Needed`; `complete-manual-validation` refreshes the same summary in place. The PR code-change section uses authoritative base/head facts from `platform-pr inspect` and the complete `git diff --find-renames --numstat base...head`, reconciles runtime, test, skill/rule, template, documentation, and other categories, and explains renames, mechanical mirrors, and potentially unnecessary changes.
|
|
43
|
+
Canonical inputs include `manual-validation.md`. The manual-validation section is one of `### ✅ Manual Validation Passed`, `### ⚠️ Manual Verification Required`, or `### ✅ No Manual Verification Needed`; `complete-manual-validation` refreshes the same summary in place. The PR code-change section uses authoritative base/head facts from `platform-pr inspect` and the complete `git diff --find-renames --numstat base...head`, reconciles runtime, test, skill/rule, template, documentation, and other categories, and explains renames, mechanical mirrors, and potentially unnecessary changes. The caller supplies the placeholder; the core renderer supplies the canonical `### PR Code Changes` section.
|
|
38
44
|
|
|
39
45
|
```bash
|
|
40
46
|
agent-infra-internal task-warning {task-id} add --step {step} --severity WARNING \
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
> `--agent` 取值见 `.agents/rules/task-management.md`「合作者 token 规范」。
|
|
4
4
|
|
|
5
|
-
PR
|
|
5
|
+
PR 摘要的语义聚合由模型完成;任务意图 digest、完整三点 diff、canonical `pr-change-report.json` sidecar、报告渲染、marker、权威 PR head、分页评论查找和 create/update/no-op 由 typed core 负责。
|
|
6
6
|
|
|
7
7
|
## 三层隔离
|
|
8
8
|
|
|
@@ -24,7 +24,8 @@ agent-infra-internal platform-pr summary-context {task-id}
|
|
|
24
24
|
- 测试结果
|
|
25
25
|
- 审查历程与当前结论
|
|
26
26
|
- 人工校验三态:`### ⚠️ 需人工校验`、`### ✅ 人工验证已通过` 或 `### ✅ 无需人工校验`
|
|
27
|
-
-
|
|
27
|
+
- 变更摘要、实现范围、测试结果、审查历程和人工校验三态
|
|
28
|
+
- 一个 `<!-- canonical-pr-change-report -->` 占位符;`### PR 代码增减` 由 core renderer 基于权威 diff 生成,调用方不自行写标题或统计
|
|
28
29
|
|
|
29
30
|
保留人工校验项时,每条写明校验内容、定位和只能人工完成的原因。
|
|
30
31
|
|
|
@@ -41,16 +42,28 @@ core 最终包装出的 canonical 评论结构为:
|
|
|
41
42
|
### PR 代码增减
|
|
42
43
|
```
|
|
43
44
|
|
|
45
|
+
先用机械脚本和模型预检生成输入,再写入任务目录固定 sidecar:
|
|
46
|
+
|
|
47
|
+
```bash
|
|
48
|
+
agent-infra-internal platform-pr change-report {task-id} \
|
|
49
|
+
--agent {standard-agent-token} --mechanical-file {mechanical-report-file} \
|
|
50
|
+
--precheck-file {precheck-candidate-file}
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
precheck 必须覆盖六项固定检查并提供文件证据;`formalReview` 固定为 `false`,`needs-review` 路由到 `review-code`。sidecar 是当前 head 的可丢弃派生缓存,不是 lifecycle artifact 或 Issue artifact。
|
|
54
|
+
|
|
44
55
|
## 发布
|
|
45
56
|
|
|
46
57
|
把聚合后的纯正文写入 `{summary-body-file}`,不要自行添加 marker 或 commit SHA:
|
|
47
58
|
|
|
48
59
|
```bash
|
|
49
60
|
agent-infra-internal platform-pr summary-sync {task-id} \
|
|
50
|
-
--agent {standard-agent-token} --body-file {summary-body-file}
|
|
61
|
+
--agent {standard-agent-token} --body-file {summary-body-file} \
|
|
62
|
+
--change-report-file .agents/workspace/active/{task-id}/pr-change-report.json \
|
|
63
|
+
--result {primary-result}
|
|
51
64
|
```
|
|
52
65
|
|
|
53
|
-
core
|
|
66
|
+
正文必须恰好包含一次 `<!-- canonical-pr-change-report -->`,不得自行拼接报告标题/JSON、marker 或 last-commit。core 会重新校验任务意图 digest、绑定 PR identity、完整 patch SHA 和机械统计,由 renderer 生成报告段,再包装唯一 `<!-- sync-pr:{task-id}:summary -->` 和权威 `<!-- last-commit: ... -->`,分页查找 PR 普通评论:不存在则创建、正文变化则原地更新、无差异则 no-op、重复 marker 或报告失配则稳定失败。正文通过文件输入,调用方不得拼 shell/heredoc。
|
|
54
67
|
|
|
55
68
|
## 结果回传
|
|
56
69
|
|
|
@@ -123,7 +123,4 @@ repair hint.
|
|
|
123
123
|
## Cross-TUI use
|
|
124
124
|
|
|
125
125
|
Bare numeric `N` is safe in every shell and TUI without quoting:
|
|
126
|
-
`ai sandbox exec 11 'npm test'`, `/review-analysis 11`.
|
|
127
|
-
|
|
128
|
-
Starting with the next major version, migrate the old `#NN` form to `NN`;
|
|
129
|
-
even a quoted value delivered intact to the CLI is rejected.
|
|
126
|
+
`ai sandbox exec 11 'npm test'`, `/review-analysis --task 11`.
|
|
@@ -9,7 +9,7 @@ description: >
|
|
|
9
9
|
# Analyze Task
|
|
10
10
|
> `--agent` values are defined in `.agents/rules/task-management.md` under “Collaborator Token Specification”.
|
|
11
11
|
|
|
12
|
-
If the entry operands contain `--orchestrated`, bind `{execution-flag}` to `--orchestrated` and forward it unchanged to the completed event; otherwise bind it to an empty value. Never infer it from `orchestration.json`, environment variables, or prior artifacts.
|
|
12
|
+
If the entry operands contain `--orchestrated`, bind `{execution-flag}` to `--orchestrated` and forward it unchanged to the completed event; otherwise bind it to an empty value. Never infer it from `orchestration.json`, environment variables, or prior artifacts. Lifecycle events also require explicit trigger data: use `{trigger-initiator}=orchestrator` for orchestration and `model` otherwise; `{request-id}` is a stable single-line identifier for this task and artifact round, and `{reason-code}` is `user-request`, `new-requirement`, or `upstream-fact-doubt`. Reuse the same values for started and completed.
|
|
13
13
|
|
|
14
14
|
## Boundary / Critical Rules
|
|
15
15
|
|
|
@@ -41,7 +41,7 @@ Before the state check is complete, do not make external-state assertions such a
|
|
|
41
41
|
|
|
42
42
|
## Step Start: Declare the started Event
|
|
43
43
|
|
|
44
|
-
After resolving the artifact context and before this round's first artifact action, run `agent-infra-internal task-event {task-id} analyze.started --agent {standard-agent-token}` and verify the returned `artifactContext`.
|
|
44
|
+
After resolving the artifact context and before this round's first artifact action, run `agent-infra-internal task-event {task-id} analyze.started --agent {standard-agent-token} --initiator {trigger-initiator} --request-id {request-id} --reason-code {reason-code}` and verify the returned `artifactContext`.
|
|
45
45
|
|
|
46
46
|
## Steps
|
|
47
47
|
|
|
@@ -203,7 +203,17 @@ Update `.agents/workspace/active/{task-id}/task.md`:
|
|
|
203
203
|
- Overwrite the `priority` field in frontmatter with the new value
|
|
204
204
|
- Append a `## Priority Re-estimate` section to this round's analysis artifact `{analysis-artifact}`, recording: `priority {old} → {new} (rationale: {short basis grounded in this analysis})`
|
|
205
205
|
If the re-estimated value matches the current value, skip it: do not write the `## Priority Re-estimate` section. The Flow A sync that follows reads the possibly updated frontmatter and propagates the new value to the Issue automatically.
|
|
206
|
-
After the
|
|
206
|
+
After writing the local artifact, run the pre-completion gate:
|
|
207
|
+
|
|
208
|
+
```bash
|
|
209
|
+
agent-infra-internal task-artifact {task-id} finalize-local --family analysis --artifact {analysis-artifact}
|
|
210
|
+
```
|
|
211
|
+
|
|
212
|
+
- On `status=passed`, save that result's `artifactSha256` and `semanticDigest`; the finalizer has recorded the matching one-shot local provenance intent.
|
|
213
|
+
- On `status=failed` with `repairable=true`, apply only the diagnostic's `replace-line` operation once, then rerun the same command completely; count an attempt only after bytes change, up to 8 attempts.
|
|
214
|
+
- The first repairable failure's `semanticDigest` is retained as the baseline; a retried `status=passed` result must match it. On baseline mismatch, any other failure, no progress, or a repeated diagnostic, stop without publishing a completed event.
|
|
215
|
+
|
|
216
|
+
Use the digests from that same `status=passed` result in `agent-infra-internal task-event {task-id} analyze.completed --agent {standard-agent-token} --initiator {trigger-initiator} --request-id {request-id} --reason-code {reason-code} --artifact {analysis-artifact} --artifact-sha256 {artifact-sha256} --semantic-digest {semantic-digest} {execution-flag}` so the core records the link, stage, agent, metadata, and Activity Log atomically.
|
|
207
217
|
- {YYYY-MM-DD HH:mm:ss±HH:MM} — **Analyze Task (Round {N})** by {agent} — Analysis completed → {analysis-artifact}
|
|
208
218
|
```
|
|
209
219
|
|
|
@@ -9,7 +9,7 @@ description: >
|
|
|
9
9
|
# 分析任务
|
|
10
10
|
> `--agent` 取值见 `.agents/rules/task-management.md`「合作者 token 规范」。
|
|
11
11
|
|
|
12
|
-
若入口业务操作数包含 `--orchestrated`,绑定 `{execution-flag}` = `--orchestrated` 并原样转发给 completed 事件;否则绑定为空。不得从 `orchestration.json
|
|
12
|
+
若入口业务操作数包含 `--orchestrated`,绑定 `{execution-flag}` = `--orchestrated` 并原样转发给 completed 事件;否则绑定为空。不得从 `orchestration.json`、环境变量或历史产物推断该标记。生命周期事件还必须携带显式触发信息:编排调用使用 `{trigger-initiator}=orchestrator`,否则使用 `model`;`{request-id}` 是本任务与本轮产物的稳定单行标识,`{reason-code}` 使用 `user-request`、`new-requirement` 或 `upstream-fact-doubt`;started 与 completed 使用同一组值。
|
|
13
13
|
|
|
14
14
|
## 行为边界 / 关键规则
|
|
15
15
|
|
|
@@ -44,7 +44,7 @@ agent-infra-internal task-snapshot {task-id} --format text
|
|
|
44
44
|
确认前置条件和轮次后、本轮第一个产出动作之前执行:
|
|
45
45
|
|
|
46
46
|
```bash
|
|
47
|
-
agent-infra-internal task-event {task-id} analyze.started --agent {standard-agent-token}
|
|
47
|
+
agent-infra-internal task-event {task-id} analyze.started --agent {standard-agent-token} --initiator {trigger-initiator} --request-id {request-id} --reason-code {reason-code}
|
|
48
48
|
```
|
|
49
49
|
|
|
50
50
|
## 执行步骤
|
|
@@ -204,7 +204,14 @@ agent-infra-internal task-event {task-id} analyze.started --agent {standard-agen
|
|
|
204
204
|
- 用新值覆盖 frontmatter 的 `priority` 字段
|
|
205
205
|
- 在本轮分析产物 `{analysis-artifact}` 中追加 `## 优先级重估` 段,记录一条:`priority {old} → {new} (rationale: {基于本轮分析的简短依据})`
|
|
206
206
|
若重估值与当前值一致,跳过:不写入 `## 优先级重估` 段。后续 Flow A 同步会读取可能更新过的 frontmatter,并自动把新值同步到 Issue。
|
|
207
|
-
-
|
|
207
|
+
- 完成本地产物后,先执行本地完成前门禁:
|
|
208
|
+
```bash
|
|
209
|
+
agent-infra-internal task-artifact {task-id} finalize-local --family analysis --artifact {analysis-artifact}
|
|
210
|
+
```
|
|
211
|
+
- `status=passed`:保存本次返回的 `artifactSha256` 和 `semanticDigest`;finalizer 已记录对应的一次性本地 provenance intent。
|
|
212
|
+
- `status=failed` 且 `repairable=true`:仅按诊断中的 `replace-line` 操作做一次最小修改,然后完整重跑同一命令;实际字节发生变化才计一次 `repairAttempts`,最多 8 次。
|
|
213
|
+
- 首次可修复失败的 `semanticDigest` 由 finalizer 保留为基线;重试后的 `status=passed` 必须匹配该基线。基线不匹配、其他失败、无进展或重复诊断:停止,不发布 completed 事件。
|
|
214
|
+
- 使用同一次 `status=passed` 返回的摘要执行 `agent-infra-internal task-event {task-id} analyze.completed --agent {standard-agent-token} --initiator {trigger-initiator} --request-id {request-id} --reason-code {reason-code} --artifact {analysis-artifact} --artifact-sha256 {artifact-sha256} --semantic-digest {semantic-digest} {execution-flag}`,由核心登记链接、阶段、代理、时间、版本和 Activity Log。
|
|
208
215
|
|
|
209
216
|
如果 task.md 中存在有效的 `issue_number`,执行以下同步操作(任一失败则跳过并继续):
|
|
210
217
|
- 调用 `agent-infra-internal platform-issue sync {task-id} --agent {standard-agent-token} --status pending-design-work --fields`
|
|
@@ -11,7 +11,7 @@ description: >
|
|
|
11
11
|
## Boundary / Critical Rules
|
|
12
12
|
|
|
13
13
|
- This skill is **read-only** -- do not modify any files
|
|
14
|
-
- Mechanical facts (frontmatter metadata, artifact grouping, git/platform state, and locating the task across the active, blocked, and completed directories) are delegated to the deterministic `ai task status` command. This skill only adds the semantic layer the CLI cannot produce: workflow-stage interpretation
|
|
14
|
+
- Mechanical facts (frontmatter metadata, artifact grouping, git/platform state, and locating the task across the active, blocked, and completed directories) are delegated to the deterministic `ai task status` command. This skill only adds the semantic layer the CLI cannot produce: workflow-stage interpretation and review-verdict parsing; the next action comes directly from the CLI's canonical recommendation.
|
|
15
15
|
|
|
16
16
|
## Task Context Resolution
|
|
17
17
|
|
|
@@ -45,7 +45,7 @@ This is the semantic layer the CLI does not produce. Using the `Artifacts` group
|
|
|
45
45
|
- `[pending]` - not started yet
|
|
46
46
|
- `[blocked]` - blocked
|
|
47
47
|
- `[skipped]` - skipped
|
|
48
|
-
- For the latest review artifact of each stage (`review-analysis`, `review-plan`, `review-code`), read the report body and parse its conclusion: the overall verdict (Approved / Changes Requested / Rejected) and the blocker / major / minor counts.
|
|
48
|
+
- For the latest review artifact of each stage (`review-analysis`, `review-plan`, `review-code`), read the report body and parse its conclusion: the overall verdict (Approved / Changes Requested / Rejected) and the blocker / major / minor counts. Use these conclusions only to explain stage status; do not recompute the next action from them.
|
|
49
49
|
|
|
50
50
|
Present the workflow progress as an overlay on top of the CLI output, marking the latest round and the parsed review verdict, for example:
|
|
51
51
|
|
|
@@ -57,41 +57,20 @@ Workflow progress:
|
|
|
57
57
|
[pending] Plan Review
|
|
58
58
|
```
|
|
59
59
|
|
|
60
|
-
### 3.
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
> - The latest code artifact exists and there is still no latest code review artifact -> choose "Code Complete"
|
|
75
|
-
> - `current_step = code-review` and the latest code review artifact exists, the verdict is `Approved`, and `Blocker = 0`, `Major = 0`, `Minor = 0` -> choose "Code Review Passed"
|
|
76
|
-
> - `current_step = code-review` and the latest code review artifact exists, but any `Blocker`, `Major`, or `Minor` issue remains, or the verdict is not a clean approval -> choose "Code Review Has Issues"
|
|
77
|
-
>
|
|
78
|
-
> **Important: if the latest review report contains any issue at all, do not use the corresponding review-passed row. Use the corresponding has-issues row instead.**
|
|
79
|
-
>
|
|
80
|
-
> Before rendering the final output, read `.agents/rules/next-step-output.md`. After selecting an actionable row, invoke `agent-infra-internal agent-client next-steps --skill {next-skill} [--task-ref {task-ref}]` exactly once and render stdout verbatim as `{next-step-commands}`. Do not invoke the helper for `Task Blocked` or `Task Completed`. Append the `Completed at` trailing line last.
|
|
81
|
-
|
|
82
|
-
| Current State | next skill | task ref |
|
|
83
|
-
|----------------------------|-------------------|----------|
|
|
84
|
-
| Analysis Complete | `review-analysis` | required |
|
|
85
|
-
| Analysis Review Passed | `plan-task` | required |
|
|
86
|
-
| Analysis Review Has Issues | `analyze-task` | required |
|
|
87
|
-
| Plan Complete | `review-plan` | required |
|
|
88
|
-
| Plan Review Passed | `code-task` | required |
|
|
89
|
-
| Plan Review Has Issues | `plan-task` | required |
|
|
90
|
-
| Code Complete | `review-code` | required |
|
|
91
|
-
| Code Review Passed | `commit` | omitted |
|
|
92
|
-
| Code Review Has Issues | `code-task` | required |
|
|
93
|
-
| Task Blocked | — | — |
|
|
94
|
-
| Task Completed | — | — |
|
|
60
|
+
### 3. Display the canonical recommendation
|
|
61
|
+
|
|
62
|
+
Read only `Recommendation.action` from the `ai task status --task {task-id}` output and use it as the sole source of the next action. Do not recompute an action from `current_step`, the latest files, review prose, or the Activity Log.
|
|
63
|
+
|
|
64
|
+
When the action is non-empty, perform only this literal action-to-skill conversion, then invoke the shared helper once:
|
|
65
|
+
|
|
66
|
+
| Recommendation.action | next skill |
|
|
67
|
+
|-----------------------|------------|
|
|
68
|
+
| `analysis` | `analyze-task` |
|
|
69
|
+
| `plan` | `plan-task` |
|
|
70
|
+
| `code` | `code-task` |
|
|
71
|
+
| any other action | same-named skill |
|
|
72
|
+
|
|
73
|
+
When the action is empty, do not invoke the helper; state that no next skill is currently recommended. Before rendering the final output, read `.agents/rules/next-step-output.md`; invoke `agent-infra-internal agent-client next-steps --skill {next-skill} --task-ref {task-ref}` and render stdout verbatim as `{next-step-commands}`. Append the `Completed at` trailing line last.
|
|
95
74
|
|
|
96
75
|
## Notes
|
|
97
76
|
|
|
@@ -11,7 +11,7 @@ description: >
|
|
|
11
11
|
## 行为边界 / 关键规则
|
|
12
12
|
|
|
13
13
|
- 本技能是**只读**操作 —— 不修改任何文件
|
|
14
|
-
- 机械数据(frontmatter 元数据、产物分组、Git/Platform 状态,以及跨 active、blocked、completed 三目录定位任务)一律委托给确定性的 `ai task status` 命令。本技能只负责 CLI
|
|
14
|
+
- 机械数据(frontmatter 元数据、产物分组、Git/Platform 状态,以及跨 active、blocked、completed 三目录定位任务)一律委托给确定性的 `ai task status` 命令。本技能只负责 CLI 无法产出的语义层:工作流阶段解读和审查结论解析;下一步 action 直接使用 CLI 的 canonical recommendation。
|
|
15
15
|
|
|
16
16
|
## 任务上下文解析
|
|
17
17
|
|
|
@@ -45,7 +45,7 @@ ai task status --task {task-id}
|
|
|
45
45
|
- `[pending]` - 尚未开始
|
|
46
46
|
- `[blocked]` - 被阻塞
|
|
47
47
|
- `[skipped]` - 已跳过
|
|
48
|
-
- 对各阶段最新的审查产物(`review-analysis`、`review-plan`、`review-code`),读取报告正文并解析结论:总体结论(通过 / 需要修改 / 拒绝)与阻塞项 / 主要问题 /
|
|
48
|
+
- 对各阶段最新的审查产物(`review-analysis`、`review-plan`、`review-code`),读取报告正文并解析结论:总体结论(通过 / 需要修改 / 拒绝)与阻塞项 / 主要问题 / 次要问题计数。这些结论只用于阶段状态展示和解释,不得用于重算下一步 action。
|
|
49
49
|
|
|
50
50
|
把工作流进度作为 CLI 输出之上的叠加层呈现,标注最新轮次与解析出的审查结论,例如:
|
|
51
51
|
|
|
@@ -57,41 +57,20 @@ ai task status --task {task-id}
|
|
|
57
57
|
[pending] 技术方案审查
|
|
58
58
|
```
|
|
59
59
|
|
|
60
|
-
### 3.
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
> - 最新实现产物已存在,且尚无最新审查产物 → 选择「实现完成」
|
|
75
|
-
> - `current_step = code-review` 且最新代码审查产物存在,且结论为 `Approved`,同时 `Blocker = 0`、`Major = 0`、`Minor = 0` → 选择「代码审查通过」
|
|
76
|
-
> - `current_step = code-review` 且最新代码审查产物存在,但仍有任何 `Blocker`、`Major` 或 `Minor` 问题,或结论不是无问题通过 → 选择「代码审查有问题」
|
|
77
|
-
>
|
|
78
|
-
> **特别注意:只要最新审查报告中存在任何问题,就不能使用对应「审查通过」行。必须改用对应「审查有问题」行。**
|
|
79
|
-
>
|
|
80
|
-
> 渲染最终输出前先读取 `.agents/rules/next-step-output.md`。选中可执行行后只调用一次 `agent-infra-internal agent-client next-steps --skill {next-skill} [--task-ref {task-ref}]`,将 stdout 原样输出为 `{next-step-commands}`;`任务被阻塞` 与 `任务已完成` 不调用 helper。最后追加 `Completed at` 收尾行。
|
|
81
|
-
|
|
82
|
-
| 当前状态 | next skill | task ref |
|
|
83
|
-
|--------------------|-------------------|----------|
|
|
84
|
-
| 分析完成 | `review-analysis` | required |
|
|
85
|
-
| 需求分析审查通过 | `plan-task` | required |
|
|
86
|
-
| 需求分析审查有问题 | `analyze-task` | required |
|
|
87
|
-
| 计划完成 | `review-plan` | required |
|
|
88
|
-
| 技术方案审查通过 | `code-task` | required |
|
|
89
|
-
| 技术方案审查有问题 | `plan-task` | required |
|
|
90
|
-
| 实现完成 | `review-code` | required |
|
|
91
|
-
| 代码审查通过 | `commit` | omitted |
|
|
92
|
-
| 代码审查有问题 | `code-task` | required |
|
|
93
|
-
| 任务被阻塞 | — | — |
|
|
94
|
-
| 任务已完成 | — | — |
|
|
60
|
+
### 3. 展示 canonical recommendation
|
|
61
|
+
|
|
62
|
+
只读取 `ai task status --task {task-id}` 输出中的 `Recommendation.action`,将其作为唯一下一步来源。不要根据 `current_step`、目录中的最新产物、审查正文或 Activity Log 再计算 action。
|
|
63
|
+
|
|
64
|
+
当 action 非空时,仅做以下 action 到 skill 的字面转换,然后调用一次统一 helper:
|
|
65
|
+
|
|
66
|
+
| Recommendation.action | next skill |
|
|
67
|
+
|-----------------------|------------|
|
|
68
|
+
| `analysis` | `analyze-task` |
|
|
69
|
+
| `plan` | `plan-task` |
|
|
70
|
+
| `code` | `code-task` |
|
|
71
|
+
| 其他 action | 同名 skill |
|
|
72
|
+
|
|
73
|
+
`action` 为空时不调用 helper,只说明当前没有可推荐的下一技能。渲染最终输出前先读取 `.agents/rules/next-step-output.md`;helper 命令为 `agent-infra-internal agent-client next-steps --skill {next-skill} --task-ref {task-ref}`,stdout 原样作为 `{next-step-commands}` 下一步命令。最后追加 `Completed at` 收尾行。
|
|
95
74
|
|
|
96
75
|
## 注意事项
|
|
97
76
|
|
|
@@ -9,7 +9,7 @@ description: >
|
|
|
9
9
|
# Code Task
|
|
10
10
|
> `--agent` values are defined in `.agents/rules/task-management.md` under “Collaborator Token Specification”.
|
|
11
11
|
|
|
12
|
-
If the entry operands contain `--orchestrated`, bind `{execution-flag}` to `--orchestrated` and forward it unchanged to the completed event; otherwise bind it to an empty value. Never infer it from `orchestration.json`, environment variables, or prior artifacts.
|
|
12
|
+
If the entry operands contain `--orchestrated`, bind `{execution-flag}` to `--orchestrated` and forward it unchanged to the completed event; otherwise bind it to an empty value. Never infer it from `orchestration.json`, environment variables, or prior artifacts. Lifecycle events also require explicit trigger data: use `{trigger-initiator}=orchestrator` for orchestration and `model` otherwise; `{request-id}` is a stable single-line identifier for this task and artifact round, and `{reason-code}` is `user-request` for initial work and `review-finding` for fixes or decisions. Reuse the same values for started and completed.
|
|
13
13
|
|
|
14
14
|
Implement the approved plan and produce `code.md` or `code-r{N}.md`. This skill supports initial implementation, fix mode based on `review-code` feedback, and human-decision-driven implementation.
|
|
15
15
|
|
|
@@ -19,6 +19,7 @@ Implement the approved plan and produce `code.md` or `code-r{N}.md`. This skill
|
|
|
19
19
|
- Before generating task or lifecycle Markdown that will be synchronized to an Issue, read `.agents/rules/sync-content-generation.md` and apply its producer-side constraints; the sync path does not parse or rewrite the body
|
|
20
20
|
- Read `.agents/rules/compatibility-policy.md` before implementation. Implement only the compatibility budget explicitly approved by the plan; never retain old branches, result contracts, or migration shims merely to be “safe”
|
|
21
21
|
- Fix mode verifies each finding of the latest `review-code` one by one: fix it if it holds, or rebut it and record it under unresolved if it is unfounded/hallucinated; do not expand to issues the review did not list; manual-validation items are out of scope
|
|
22
|
+
- Before `code.completed`, the implementation report must pass `task-artifact ... finalize-local --family code`; follow `.agents/rules/local-artifact-repair.md` for any provably safe minimal structural repair in that same report, and pass only that successful call's digests to the completion event
|
|
22
23
|
- If implementation encounters a key design decision not covered by the plan, run `agent-infra-internal task-ledger {task-id} decision-next-id`, write the returned `HD-N` detail block per `.agents/rules/human-decision-context.md` and determine whether implementation is required, then run `decision-upsert --id {HD-N} --stage code --artifact {code-artifact} --needs-implementation {true|false}`. Do not scan ids, assemble ledger rows, ask mid-flow, or silently expand scope
|
|
23
24
|
- Do not invoke the `commit` skill or push to a remote; after tests pass, call the shared commit core with `delivery: { mode: 'local' }` to create the local checkpoint. The durable intent must close only after the checkpoint and task state sync succeed; only then emit `code.completed`
|
|
24
25
|
- Create a new code artifact for each round and never overwrite an older one
|
|
@@ -44,7 +45,7 @@ agent-infra-internal task-snapshot {task-id} --format text
|
|
|
44
45
|
|
|
45
46
|
## Step Start: Write the started Marker
|
|
46
47
|
|
|
47
|
-
After prerequisites and mode are confirmed and before this round's first artifact action, run `agent-infra-internal task-event {task-id} code.started --agent {standard-agent-token}`. Append `--fix-for {review-artifact}` in fix mode or `--implementation-input {input-id}` in decision mode. The core derives and validates the round and input identity; record the returned `artifactContext`.
|
|
48
|
+
After prerequisites and mode are confirmed and before this round's first artifact action, run `agent-infra-internal task-event {task-id} code.started --agent {standard-agent-token} --initiator {trigger-initiator} --request-id {request-id} --reason-code {reason-code}`. Append `--fix-for {review-artifact}` in fix mode or `--implementation-input {input-id}` in decision mode. The core derives and validates the round and input identity; record the returned `artifactContext`.
|
|
48
49
|
|
|
49
50
|
## Steps
|
|
50
51
|
|
|
@@ -60,7 +61,7 @@ Read `reference/branch-management.md`, ensure the current branch matches the tas
|
|
|
60
61
|
|
|
61
62
|
**Mandatory; do not skip.** If task.md has a valid `issue_number`, run `agent-infra-internal platform-issue sync {task-id} --agent {standard-agent-token} --milestone specific`.
|
|
62
63
|
|
|
63
|
-
> If the milestone remains `X.Y.x`, step
|
|
64
|
+
> If the milestone remains `X.Y.x`, step 12 `task-verify code.completed` blocks through the typed milestone check.
|
|
64
65
|
|
|
65
66
|
### 4. Determine Mode and Round
|
|
66
67
|
|
|
@@ -106,28 +107,46 @@ When triaging a test failure or unexpected behavior, first read `.agents/rules/d
|
|
|
106
107
|
|
|
107
108
|
After tests pass, call the shared commit core with `agent-infra-internal git-workflow commit --input {checkpoint-input}`. Pass `delivery: { "mode": "local" }`, explicit paths, expected HEAD/tree, task ref, agent, and the code round. This creates only a local checkpoint and does not contact a remote. The core writes a durable intent before committing and removes it after task-writer synchronization; do not emit `code.completed` if either checkpoint or task synchronization fails.
|
|
108
109
|
|
|
110
|
+
After the checkpoint succeeds, when task.md has an `issue_number`, run `agent-infra-internal platform-issue sync {task-id} --agent {standard-agent-token} --in-labels from-diff --base {delivery-base-ref}`. The task-bound `delivery_base_ref` is the only source for Issue `in:` evidence; record a warning and stop this round without emitting `code.completed` if this sync fails.
|
|
111
|
+
|
|
109
112
|
### 9. Write the Code Report
|
|
110
113
|
|
|
111
114
|
Create `.agents/workspace/active/{task-id}/{code-artifact}`.
|
|
112
115
|
|
|
113
116
|
> Read `reference/report-template.md` before writing the report.
|
|
114
117
|
|
|
115
|
-
### 10.
|
|
118
|
+
### 10. Pre-completion Report Gate
|
|
119
|
+
|
|
120
|
+
After writing the report and before publishing `code.completed`, read and follow `.agents/rules/local-artifact-repair.md` and run:
|
|
121
|
+
|
|
122
|
+
```bash
|
|
123
|
+
finalizer=$(agent-infra-internal task-artifact {task-id} finalize-local --family code --artifact {code-artifact})
|
|
124
|
+
status=$?
|
|
125
|
+
echo "$finalizer"
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
- `status=0` with `finalizer.status="passed"`: bind `{artifact-sha256}` and `{semantic-digest}` from this result.
|
|
129
|
+
- `status=1` with `repairable=true` and a diagnostic explicitly describing a one-line replacement: confirm task, round, artifact, and provenance are unchanged; edit only that `code*.md` once, confirm the bytes changed, then rerun the same command completely.
|
|
130
|
+
- For any other failure, lack of progress, repeated diagnostic, or eight actual report edits, stop without publishing `code.completed`.
|
|
131
|
+
|
|
132
|
+
Do not rescan or manually write digest data; the completion event must include `--artifact-sha256 {artifact-sha256} --semantic-digest {semantic-digest}` from the successful finalizer result.
|
|
133
|
+
|
|
134
|
+
### 11. Update Task Status
|
|
116
135
|
|
|
117
|
-
After requirement checkboxes are updated, run the initial event `agent-infra-internal task-event {task-id} code.completed --agent {standard-agent-token} --artifact {code-artifact} --files-modified {n} --tests-passed {n} {execution-flag}`; in fix mode
|
|
136
|
+
After requirement checkboxes are updated, run the initial event `agent-infra-internal task-event {task-id} code.completed --agent {standard-agent-token} --initiator {trigger-initiator} --request-id {request-id} --reason-code {reason-code} --artifact {code-artifact} --artifact-sha256 {artifact-sha256} --semantic-digest {semantic-digest} --files-modified {n} --tests-passed {n} {execution-flag}`; in fix mode add `--fix-for {review-artifact} --blockers {n} --major {n} --minor {n} --manual-validation {n} {execution-flag}` instead; in decision mode add `--implementation-input {input-id}` to the initial counts. The core atomically records the artifact link, stage, metadata, done log, and decision-input consumption.
|
|
118
137
|
|
|
119
|
-
If task.md has a valid `issue_number`, read `.agents/rules/issue-sync.md`, then:
|
|
138
|
+
If task.md has a valid `issue_number`, read `.agents/rules/issue-sync.md`, then (status/comment failures follow the warning rules; an Issue `in:` evidence failure must not emit `code.completed`):
|
|
120
139
|
- Run `agent-infra-internal platform-issue sync {task-id} --agent {standard-agent-token} --status in-progress`
|
|
121
140
|
- Run `agent-infra-internal platform-comment sync {task-id} --kind task --agent {standard-agent-token}`
|
|
122
141
|
- Run `agent-infra-internal platform-comment sync {task-id} --kind artifact --artifact {code-artifact} --agent {standard-agent-token}`
|
|
123
142
|
|
|
124
|
-
###
|
|
143
|
+
### 12. Run Completion Gate
|
|
125
144
|
|
|
126
145
|
```bash
|
|
127
146
|
agent-infra-internal task-verify {task-id} code.completed --artifact {code-artifact} --format text
|
|
128
147
|
```
|
|
129
148
|
|
|
130
|
-
###
|
|
149
|
+
### 13. Tell the User
|
|
131
150
|
|
|
132
151
|
Use `reference/output-template.md` (or `reference/fix-mode.md` in fix mode) and render the selected next-step commands through the shared helper. Do not push, create a PR, or invoke the `commit` skill here.
|
|
133
152
|
|
|
@@ -9,7 +9,7 @@ description: >
|
|
|
9
9
|
# 编码任务
|
|
10
10
|
> `--agent` 取值见 `.agents/rules/task-management.md`「合作者 token 规范」。
|
|
11
11
|
|
|
12
|
-
若入口业务操作数包含 `--orchestrated`,绑定 `{execution-flag}` = `--orchestrated` 并原样转发给 completed 事件;否则绑定为空。不得从 `orchestration.json
|
|
12
|
+
若入口业务操作数包含 `--orchestrated`,绑定 `{execution-flag}` = `--orchestrated` 并原样转发给 completed 事件;否则绑定为空。不得从 `orchestration.json`、环境变量或历史产物推断该标记。生命周期事件还必须携带显式触发信息:编排调用使用 `{trigger-initiator}=orchestrator`,否则使用 `model`;`{request-id}` 是本任务与本轮产物的稳定单行标识,`{reason-code}` 初次实现使用 `user-request`,修复或裁决使用 `review-finding`;started 与 completed 使用同一组值。
|
|
13
13
|
|
|
14
14
|
根据已批准的技术方案编码任务,并产出 `code.md` 或 `code-r{N}.md`。本技能支持初次实现、基于 `review-code` 反馈的修复,以及人工裁决驱动实现三种模式。
|
|
15
15
|
|
|
@@ -19,6 +19,7 @@ description: >
|
|
|
19
19
|
- 生成会同步到 Issue 的任务或生命周期 Markdown 前,先读取 `.agents/rules/sync-content-generation.md` 并遵循其中的生成端约束;同步端不解析或改写正文
|
|
20
20
|
- 实现前读取 `.agents/rules/compatibility-policy.md`;只实现方案明确批准的兼容预算,不以“稳妥”为由保留旧分支、旧结果契约或迁移 shim
|
|
21
21
|
- 修复模式逐条核实最新 `review-code` 的发现:成立则修复,判定为不成立/幻觉则在报告中反驳并记入 unresolved;不擅自扩大到审查未列出的问题;manual-validation 项不在修复范围
|
|
22
|
+
- 实现报告在 `code.completed` 前必须通过 `task-artifact ... finalize-local --family code`;按 `.agents/rules/local-artifact-repair.md` 处理同一报告内可证明安全的最小结构修复,并只把同一次通过结果的摘要传给完成事件
|
|
22
23
|
- 实现中遇到方案未覆盖的关键设计决策时,先调用 `agent-infra-internal task-ledger {task-id} decision-next-id` 取得 `HD-N`,按 `.agents/rules/human-decision-context.md` 写入实现报告的 `## 人工裁决待办` 详情块并判断是否需要实现,再调用 `decision-upsert --id {HD-N} --stage code --artifact {code-artifact} --needs-implementation {true|false}`;不得扫描编号、手写账本行、中途提问或擅自扩范围
|
|
23
24
|
- 不调用 `commit` 技能,也不推送远端;测试通过后直接调用共享 commit core 的 `delivery: { mode: 'local' }` 创建本地 checkpoint。checkpoint 使用 durable intent,只有 checkpoint 与 task 状态同步成功后才发送 `code.completed`
|
|
24
25
|
- 每轮实现都创建新的实现产物,不覆盖旧文件
|
|
@@ -59,7 +60,7 @@ agent-infra-internal task-snapshot {task-id} --format text
|
|
|
59
60
|
|
|
60
61
|
## 步骤开始:声明 started 事件
|
|
61
62
|
|
|
62
|
-
确认前置条件与模式后、本轮第一个产出动作之前执行 `agent-infra-internal task-event {task-id} code.started --agent {standard-agent-token}`。修复模式追加 `--fix-for {review-artifact}`,裁决模式追加 `--implementation-input {input-id}`。核心根据 artifact context 推导并校验轮次与输入身份;以返回的 `artifactContext` 记录本轮身份。
|
|
63
|
+
确认前置条件与模式后、本轮第一个产出动作之前执行 `agent-infra-internal task-event {task-id} code.started --agent {standard-agent-token} --initiator {trigger-initiator} --request-id {request-id} --reason-code {reason-code}`。修复模式追加 `--fix-for {review-artifact}`,裁决模式追加 `--implementation-input {input-id}`。核心根据 artifact context 推导并校验轮次与输入身份;以返回的 `artifactContext` 记录本轮身份。
|
|
63
64
|
|
|
64
65
|
## 执行步骤
|
|
65
66
|
### 1. 验证前置条件
|
|
@@ -87,7 +88,7 @@ agent-infra-internal task-snapshot {task-id} --format text
|
|
|
87
88
|
|
|
88
89
|
**必须执行,不得跳过。** 如果 task.md 中存在有效的 `issue_number`,调用 `agent-infra-internal platform-issue sync {task-id} --agent {standard-agent-token} --milestone specific`;里程碑推断、权限降级与幂等写入由 internal core 处理。
|
|
89
90
|
|
|
90
|
-
> 若跳过或收窄后仍为 `X.Y.x`,步骤
|
|
91
|
+
> 若跳过或收窄后仍为 `X.Y.x`,步骤 12 的 `task-verify code.completed` 会通过 typed milestone check 截停本轮。
|
|
91
92
|
|
|
92
93
|
### 4. 确定模式与轮次
|
|
93
94
|
|
|
@@ -144,6 +145,8 @@ echo "$result"
|
|
|
144
145
|
|
|
145
146
|
测试通过后,通过 `agent-infra-internal git-workflow commit --input {checkpoint-input}` 调用共享 commit core,输入 `delivery: { "mode": "local" }`、明确 paths、expected HEAD/tree、task ref、agent 和 code round。该调用只创建本地 checkpoint,不访问远端;core 会在 commit 前写入 durable intent,并在 task writer 成功后清理 intent。checkpoint 失败或 task 状态未闭合时,不得发送 `code.completed`。
|
|
146
147
|
|
|
148
|
+
checkpoint 成功后,若任务存在 `issue_number`,调用 `agent-infra-internal platform-issue sync {task-id} --agent {standard-agent-token} --in-labels from-diff --base {delivery-base-ref}`,由 task-bound `delivery_base_ref` 产生 Issue 的 `in:` target;该同步失败时记录 warning 并停止本轮,不发送 `code.completed`。
|
|
149
|
+
|
|
147
150
|
排查测试失败或行为不符合预期时,先读取 `.agents/rules/debugging-guide.md`,按其四阶段流程定位根因,禁止盲目改代码重试。
|
|
148
151
|
|
|
149
152
|
### 9. 编写实现报告
|
|
@@ -152,22 +155,38 @@ echo "$result"
|
|
|
152
155
|
|
|
153
156
|
> 报告结构、必填章节和完整模板见 `reference/report-template.md`。写报告前先读取 `reference/report-template.md`。
|
|
154
157
|
|
|
155
|
-
### 10.
|
|
158
|
+
### 10. 报告完成前门禁
|
|
159
|
+
|
|
160
|
+
报告写入后、发布 `code.completed` 前,读取并遵循 `.agents/rules/local-artifact-repair.md`,执行:
|
|
161
|
+
|
|
162
|
+
```bash
|
|
163
|
+
finalizer=$(agent-infra-internal task-artifact {task-id} finalize-local --family code --artifact {code-artifact})
|
|
164
|
+
status=$?
|
|
165
|
+
echo "$finalizer"
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
- `status=0` 且 `finalizer.status="passed"`:绑定这一次返回的 `{artifact-sha256}` 和 `{semantic-digest}`。
|
|
169
|
+
- `status=1` 且返回 `repairable=true`、诊断明确为当前报告中的单行替换:确认任务、轮次、产物和 provenance 未变化后,只编辑该 `code*.md` 一次,确认字节确实变化,再完整重跑同一命令。
|
|
170
|
+
- 其他失败、无进展、诊断重复或达到 8 次实际报告编辑:停止,不发布 `code.completed`。
|
|
171
|
+
|
|
172
|
+
不得重新扫描或手工补写摘要;完成事件必须携带本次 `passed` 结果的 `--artifact-sha256 {artifact-sha256} --semantic-digest {semantic-digest}`。
|
|
173
|
+
|
|
174
|
+
### 11. 更新任务状态
|
|
156
175
|
|
|
157
176
|
更新 `.agents/workspace/active/{task-id}/task.md`:
|
|
158
177
|
- 审查 `## 需求` 段落,仅把本轮已由代码实现且有测试通过支撑的条目从 `- [ ]` 勾为 `- [x]`
|
|
159
178
|
- 产物链接、阶段与完成日志由 completed 事件统一登记
|
|
160
179
|
- 完成业务内容更新后声明完成事件:
|
|
161
|
-
- 初次实现:`agent-infra-internal task-event {task-id} code.completed --agent {standard-agent-token} --artifact {code-artifact} --files-modified {n} --tests-passed {n} {execution-flag}`
|
|
162
|
-
- 修复模式:`agent-infra-internal task-event {task-id} code.completed --agent {standard-agent-token} --artifact {code-artifact} --fix-for {review-artifact} --blockers {n} --major {n} --minor {n} --manual-validation {n} {execution-flag}`
|
|
163
|
-
- 裁决模式:`agent-infra-internal task-event {task-id} code.completed --agent {standard-agent-token} --artifact {code-artifact} --implementation-input {input-id} --files-modified {n} --tests-passed {n} {execution-flag}`
|
|
180
|
+
- 初次实现:`agent-infra-internal task-event {task-id} code.completed --agent {standard-agent-token} --initiator {trigger-initiator} --request-id {request-id} --reason-code {reason-code} --artifact {code-artifact} --artifact-sha256 {artifact-sha256} --semantic-digest {semantic-digest} --files-modified {n} --tests-passed {n} {execution-flag}`
|
|
181
|
+
- 修复模式:`agent-infra-internal task-event {task-id} code.completed --agent {standard-agent-token} --initiator {trigger-initiator} --request-id {request-id} --reason-code {reason-code} --artifact {code-artifact} --artifact-sha256 {artifact-sha256} --semantic-digest {semantic-digest} --fix-for {review-artifact} --blockers {n} --major {n} --minor {n} --manual-validation {n} {execution-flag}`
|
|
182
|
+
- 裁决模式:`agent-infra-internal task-event {task-id} code.completed --agent {standard-agent-token} --initiator {trigger-initiator} --request-id {request-id} --reason-code {reason-code} --artifact {code-artifact} --artifact-sha256 {artifact-sha256} --semantic-digest {semantic-digest} --implementation-input {input-id} --files-modified {n} --tests-passed {n} {execution-flag}`
|
|
164
183
|
|
|
165
|
-
如果 task.md 中存在有效的 `issue_number
|
|
184
|
+
如果 task.md 中存在有效的 `issue_number`,执行以下同步操作(状态/评论失败按规则记录 warning;Issue `in:` evidence 同步失败不得发送 `code.completed`;边界见 `.agents/rules/issue-sync.md`):
|
|
166
185
|
- 调用 `agent-infra-internal platform-issue sync {task-id} --agent {standard-agent-token} --status in-progress`
|
|
167
186
|
- 调用 `agent-infra-internal platform-comment sync {task-id} --kind task --agent {standard-agent-token}`
|
|
168
187
|
- 调用 `agent-infra-internal platform-comment sync {task-id} --kind artifact --artifact {code-artifact} --agent {standard-agent-token}`
|
|
169
188
|
|
|
170
|
-
###
|
|
189
|
+
### 12. 完成校验
|
|
171
190
|
|
|
172
191
|
运行完成校验,确认任务产物和同步状态符合规范:
|
|
173
192
|
|
|
@@ -182,7 +201,7 @@ agent-infra-internal task-verify {task-id} code.completed --artifact {code-artif
|
|
|
182
201
|
|
|
183
202
|
将校验输出保留在回复中作为当次验证输出。没有当次校验输出,不得声明完成。
|
|
184
203
|
|
|
185
|
-
###
|
|
204
|
+
### 13. 告知用户
|
|
186
205
|
|
|
187
206
|
> 仅在校验通过后执行本步骤。
|
|
188
207
|
|