@fitlab-ai/agent-infra 0.11.0 → 0.11.2

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 (146) hide show
  1. package/dist/lib/internal/cli-route-inventory.js +1 -1
  2. package/dist/lib/internal/manual-validation.js +6 -2
  3. package/dist/lib/internal/platform-comment.js +59 -0
  4. package/dist/lib/internal/sandbox-control.js +4 -131
  5. package/dist/lib/internal/task-artifact.js +1 -1
  6. package/dist/lib/internal/task-operation-registry.js +1 -0
  7. package/dist/lib/internal/task-review.js +5 -5
  8. package/dist/lib/internal/task-validate.js +0 -6
  9. package/dist/lib/platform/comment-safety.js +7 -1
  10. package/dist/lib/platform/github-provider.js +13 -3
  11. package/dist/lib/platform/issue-comments.js +120 -13
  12. package/dist/lib/platform/issues.js +3 -4
  13. package/dist/lib/platform/provider-contract.d.ts +2 -0
  14. package/dist/lib/platform/provider-validation.js +7 -2
  15. package/dist/lib/platform/verification-sync.js +161 -156
  16. package/dist/lib/sandbox/control/executor.js +0 -38
  17. package/dist/lib/sandbox/control/finalization-response.js +10 -2
  18. package/dist/lib/sandbox/control/task-view.js +3 -1
  19. package/dist/lib/sandbox/control/workflow-executor.js +32 -41
  20. package/dist/lib/task/artifact-command.js +6 -6
  21. package/dist/lib/task/artifact-lifecycle.js +15 -52
  22. package/dist/lib/task/artifact-operations.js +27 -1
  23. package/dist/lib/task/capabilities.js +0 -2
  24. package/dist/lib/task/codex-orchestration.js +10 -208
  25. package/dist/lib/task/commit-operation.js +3 -18
  26. package/dist/lib/task/control-authority.js +1 -8
  27. package/dist/lib/task/delegation-receipts.js +14 -76
  28. package/dist/lib/task/events.js +147 -278
  29. package/dist/lib/task/finalization-state.js +2 -1
  30. package/dist/lib/task/finalization.js +273 -49
  31. package/dist/lib/task/gate-policy.js +94 -0
  32. package/dist/lib/task/lifecycle-execution.js +2 -11
  33. package/dist/lib/task/local-artifact-finalization.js +31 -245
  34. package/dist/lib/task/orchestration.js +8 -24
  35. package/dist/lib/task/review-artifacts.js +12 -6
  36. package/dist/lib/task/review-command.js +0 -1
  37. package/dist/lib/task/review-finalization.js +47 -218
  38. package/dist/lib/task/verification-engine.js +28 -17
  39. package/dist/lib/task/verification.js +25 -9
  40. package/dist/lib/task/workflow-command.js +4 -1
  41. package/dist/lib/task/workflow-dispatch.js +55 -3
  42. package/dist/lifecycle-build-manifest.json +3 -3
  43. package/lib/internal/cli-route-inventory.ts +1 -1
  44. package/lib/internal/manual-validation.ts +6 -2
  45. package/lib/internal/platform-comment.ts +38 -0
  46. package/lib/internal/sandbox-control.ts +3 -145
  47. package/lib/internal/task-artifact.ts +1 -1
  48. package/lib/internal/task-operation-registry.ts +1 -0
  49. package/lib/internal/task-review.ts +5 -5
  50. package/lib/internal/task-validate.ts +0 -5
  51. package/lib/platform/comment-safety.ts +8 -0
  52. package/lib/platform/github-provider.ts +11 -2
  53. package/lib/platform/issue-comments.ts +132 -13
  54. package/lib/platform/issues.ts +3 -4
  55. package/lib/platform/provider-contract.ts +2 -0
  56. package/lib/platform/provider-validation.ts +6 -2
  57. package/lib/platform/verification-sync.ts +178 -179
  58. package/lib/sandbox/control/executor.ts +0 -44
  59. package/lib/sandbox/control/finalization-response.ts +10 -2
  60. package/lib/sandbox/control/task-view.ts +3 -1
  61. package/lib/sandbox/control/workflow-executor.ts +31 -48
  62. package/lib/task/artifact-command.ts +6 -7
  63. package/lib/task/artifact-lifecycle.ts +12 -49
  64. package/lib/task/artifact-operations.ts +27 -1
  65. package/lib/task/capabilities.ts +0 -1
  66. package/lib/task/codex-orchestration.ts +8 -241
  67. package/lib/task/commit-operation.ts +3 -23
  68. package/lib/task/control-authority.ts +1 -8
  69. package/lib/task/delegation-receipts.ts +12 -79
  70. package/lib/task/events.ts +155 -287
  71. package/lib/task/finalization-state.ts +2 -1
  72. package/lib/task/finalization.ts +277 -57
  73. package/lib/task/gate-policy.ts +133 -0
  74. package/lib/task/lifecycle-execution.ts +10 -21
  75. package/lib/task/local-artifact-finalization.ts +29 -285
  76. package/lib/task/orchestration.ts +12 -41
  77. package/lib/task/review-artifacts.ts +8 -2
  78. package/lib/task/review-command.ts +0 -1
  79. package/lib/task/review-finalization.ts +46 -200
  80. package/lib/task/verification-engine.ts +24 -14
  81. package/lib/task/verification-types.ts +7 -0
  82. package/lib/task/verification.ts +25 -9
  83. package/lib/task/workflow-command.ts +4 -1
  84. package/lib/task/workflow-dispatch.ts +46 -3
  85. package/package.json +2 -2
  86. package/templates/.agents/rules/issue-sync.en.md +2 -0
  87. package/templates/.agents/rules/issue-sync.zh-CN.md +5 -8
  88. package/templates/.agents/rules/lifecycle-orchestration.en.md +7 -7
  89. package/templates/.agents/rules/lifecycle-orchestration.zh-CN.md +7 -7
  90. package/templates/.agents/rules/local-artifact-repair.en.md +14 -52
  91. package/templates/.agents/rules/local-artifact-repair.zh-CN.md +13 -52
  92. package/templates/.agents/skills/analyze-task/SKILL.en.md +3 -3
  93. package/templates/.agents/skills/analyze-task/SKILL.zh-CN.md +3 -3
  94. package/templates/.agents/skills/analyze-task/config/verify.en.json +1 -10
  95. package/templates/.agents/skills/analyze-task/config/verify.zh-CN.json +1 -10
  96. package/templates/.agents/skills/block-task/config/verify.json +1 -3
  97. package/templates/.agents/skills/cancel-task/config/verify.json +1 -4
  98. package/templates/.agents/skills/code-task/SKILL.en.md +3 -3
  99. package/templates/.agents/skills/code-task/SKILL.zh-CN.md +3 -3
  100. package/templates/.agents/skills/code-task/config/verify.en.json +1 -12
  101. package/templates/.agents/skills/code-task/config/verify.zh-CN.json +1 -12
  102. package/templates/.agents/skills/code-task/reference/dual-mode.en.md +1 -1
  103. package/templates/.agents/skills/code-task/reference/dual-mode.zh-CN.md +1 -1
  104. package/templates/.agents/skills/code-task/reference/report-template.en.md +11 -0
  105. package/templates/.agents/skills/code-task/reference/report-template.zh-CN.md +11 -0
  106. package/templates/.agents/skills/commit/config/verify.json +1 -5
  107. package/templates/.agents/skills/complete-manual-validation/config/verify.en.json +6 -6
  108. package/templates/.agents/skills/complete-manual-validation/config/verify.zh-CN.json +6 -6
  109. package/templates/.agents/skills/complete-task/SKILL.en.md +3 -3
  110. package/templates/.agents/skills/complete-task/SKILL.zh-CN.md +3 -3
  111. package/templates/.agents/skills/complete-task/config/verify.en.json +3 -14
  112. package/templates/.agents/skills/complete-task/config/verify.zh-CN.json +3 -14
  113. package/templates/.agents/skills/create-pr/config/verify.json +1 -10
  114. package/templates/.agents/skills/create-task/config/verify.json +1 -4
  115. package/templates/.agents/skills/import-issue/config/verify.json +1 -2
  116. package/templates/.agents/skills/plan-task/SKILL.en.md +3 -3
  117. package/templates/.agents/skills/plan-task/SKILL.zh-CN.md +3 -3
  118. package/templates/.agents/skills/plan-task/config/verify.en.json +1 -10
  119. package/templates/.agents/skills/plan-task/config/verify.zh-CN.json +1 -10
  120. package/templates/.agents/skills/restore-task/SKILL.zh-CN.md +4 -4
  121. package/templates/.agents/skills/review-analysis/SKILL.en.md +2 -2
  122. package/templates/.agents/skills/review-analysis/SKILL.zh-CN.md +2 -2
  123. package/templates/.agents/skills/review-analysis/config/verify.en.json +1 -10
  124. package/templates/.agents/skills/review-analysis/config/verify.zh-CN.json +1 -10
  125. package/templates/.agents/skills/review-analysis/reference/report-template.en.md +2 -0
  126. package/templates/.agents/skills/review-analysis/reference/report-template.zh-CN.md +2 -0
  127. package/templates/.agents/skills/review-code/SKILL.en.md +3 -3
  128. package/templates/.agents/skills/review-code/SKILL.zh-CN.md +3 -3
  129. package/templates/.agents/skills/review-code/config/verify.en.json +1 -10
  130. package/templates/.agents/skills/review-code/config/verify.zh-CN.json +1 -10
  131. package/templates/.agents/skills/review-code/reference/report-template.en.md +2 -0
  132. package/templates/.agents/skills/review-code/reference/report-template.zh-CN.md +2 -0
  133. package/templates/.agents/skills/review-plan/SKILL.en.md +2 -2
  134. package/templates/.agents/skills/review-plan/SKILL.zh-CN.md +2 -2
  135. package/templates/.agents/skills/review-plan/config/verify.en.json +1 -10
  136. package/templates/.agents/skills/review-plan/config/verify.zh-CN.json +1 -10
  137. package/templates/.agents/skills/review-plan/reference/report-template.en.md +2 -0
  138. package/templates/.agents/skills/review-plan/reference/report-template.zh-CN.md +2 -0
  139. package/templates/.agents/skills/review-pr/config/verify.en.json +1 -8
  140. package/templates/.agents/skills/review-pr/config/verify.zh-CN.json +1 -8
  141. package/templates/.agents/skills/run-manual-validation/config/verify.en.json +38 -13
  142. package/templates/.agents/skills/run-manual-validation/config/verify.zh-CN.json +38 -13
  143. package/templates/.agents/skills/run-task/SKILL.en.md +6 -6
  144. package/templates/.agents/skills/run-task/SKILL.zh-CN.md +6 -6
  145. package/templates/.agents/skills/run-task/reference/host-validation.en.md +2 -2
  146. package/templates/.agents/skills/run-task/reference/host-validation.zh-CN.md +2 -2
@@ -39,6 +39,8 @@ PR event `in:` synchronization uses `agent-infra-internal platform-pr sync-in-la
39
39
 
40
40
  `planned|applied|no-op|degraded` exit 0; `failed` exits 1; `blocked` exits 2.
41
41
 
42
+ Lifecycle verification treats Issue Type, milestones, labels, requirement anchors, and noncritical comments as platform audits. Each audit retains its check id, raw status, reason, and action; missing structure, unavailable optional capability, or a value mismatch does not block a gate. Identity ambiguity, protocol conflicts, actual write failures, and unknown post-write state remain hard failures.
43
+
42
44
  Map material degraded/failed/blocked results to workflow warnings through the structured intent; callers must not edit warning rows directly:
43
45
 
44
46
  ```bash
@@ -13,9 +13,6 @@
13
13
  | `artifactChunk` | `<!-- sync-issue:{task-id}:{artifact-stem}:{part}/{total} -->` |
14
14
  | `summary` | `<!-- sync-issue:{task-id}:summary -->` |
15
15
  | `cancel` | `<!-- sync-issue:{task-id}:cancel -->` |
16
- | `recoveryAction` | `<!-- sync-issue:{task-id}:recovery-action:{action-id} -->` |
17
- | `recoveryPrepare` | `<!-- sync-issue:{task-id}:recovery-prepare:{commit-id} -->` |
18
- | `recoveryCommit` | `<!-- sync-issue:{task-id}:recovery-commit:{commit-id} -->` |
19
16
 
20
17
  `prSummary` 属于 `.agents/rules/pr-sync.md`,本规则不实现 PR 聚合。
21
18
 
@@ -32,15 +29,15 @@ agent-infra-internal platform-comment recover --issue <issue-token> --task-id <T
32
29
  --output <.agents/workspace/.restore-staging-*/task.md> [--cwd <path>]
33
30
  agent-infra-internal platform-comment owner <task-ref>
34
31
  agent-infra-internal platform-comment sync <task-ref> \
35
- --kind task|artifact|summary|cancel|recovery-action|recovery-prepare|recovery-commit --agent {standard-agent-token} \
32
+ --kind task|artifact|summary|cancel --agent {standard-agent-token} \
36
33
  [--artifact <canonical.md>] [--body-file <path|->] [--backfill]
37
34
  ```
38
35
 
39
36
  - `applied|no-op|degraded` → exit 0;`failed` → exit 1;`blocked` → exit 2。
40
- - task 评论保持 `<details>` frontmatter 可逆格式,只同步确定性的当前任务投影;活动日志、产物生命周期收据、失效记录等过程章节由 recovery 事务保存。artifact 原文内联并在超过 profile 上限时使用 `artifactChunk`。
41
- - 长度预检与 platform verification 使用同一最终渲染正文的 UTF-8 字节数。正文超限时失败关闭;本地 task 文件不会被截断。
42
-
43
- 恢复评论使用 `recovery-action`、`recovery-prepare` 和 `recovery-commit` marker,并携带稳定 recovery id 和 body file。task 同步按 prepare、action、task snapshot 写入并复读、commit 的顺序发布。相同内容重放返回 `no-op`;已有恢复 marker 的正文不同返回 `RECOVERY_IMMUTABLE_CONFLICT`。restore 只接受作者一致、分片完整、phase/摘要/marker 匹配且绑定当前 task 评论正文 SHA-256 的完整事务。
37
+ - 生命周期验证把 Issue Type、milestone、labels、需求锚点和非关键评论作为平台审计。每条审计保留 check id、原始状态、reason 和 action;缺失、权限不足或值不一致不会阻塞 gate。身份歧义、协议冲突、实际写入失败和写后状态未知仍为硬失败。
38
+ - task 评论保持 `<details>` frontmatter 可逆格式,只同步确定性的当前任务投影,并折叠保留创建任务、人工决策等关联动作。artifact 评论在正文前折叠显示该产物动作及其提交记录;交付摘要保留创建 PR 与完成任务记录。每条评论的元数据可包含多条日志。恢复核心从这些元数据重建活动日志,绝不把完整 `task.md` 作为评论载荷保存。artifact 原文内联并在超过 profile 上限时使用 `artifactChunk`。
39
+ - 长度预检与 platform verification 使用同一最终渲染正文的 UTF-8 字节数。正文超限时失败关闭;本地 `task.md` 不会被截断。
40
+ - 恢复元数据包含动作关联的日志条目和校验摘要。restore 只接受与 task 评论同作者、任务身份匹配且校验通过的元数据;缺失或损坏的记录不得推测。
44
41
  - 相同 intent 重放必须收敛为 `no-op`;重复 marker 返回 `COMMENT_MARKER_CONFLICT` 且不写入。
45
42
  - 外部贡献者锁定统一使用 `platform-comment owner`;不同作者且无 triage 时返回 `COMMENT_OWNER_CONFLICT`。
46
43
 
@@ -5,18 +5,18 @@
5
5
  - The orchestrator only routes and delegates. Stage skills remain the single source of truth for behavior and artifacts.
6
6
  - Every stage and rework round uses a fresh executor. Every review uses a fresh reviewer; follow-up reuse is forbidden.
7
7
  - A reviewer may only write its review artifact and core-generated task metadata. Business-code, HEAD, or index changes invalidate the receipt.
8
- - An active run has one pending delegation. The child must pass the activation barrier before any stage side effect. Missing, late, mismatched, forked, replayed, hook-less, or drifted evidence pauses the run (on the claude-code path, missing or mismatched model/effort evidence, and fork/spawn-mode evidence this host structurally does not provide, follow the recording rules in `.agents/skills/run-task/reference/host-validation.md` instead and are exempt from this; missing or mismatched `parentId`/`childId` still pauses). Cross-root package/build/contract or hook/profile content drift is a deliverable warning; the current receipt's hook/evidence binding remains hard.
8
+ - An active run has one pending delegation. Keep the stage associated with the observed child and report actual start and terminal failures.
9
9
  - The first release ends after one existing safely gated `commit`; it does not create a PR, monitor checks, or complete the task.
10
10
 
11
- ## Recovery
11
+ ## Current Execution Records
12
12
 
13
- `orchestration.json` is the detailed state source. A current run persists complete policy, append-only recovery, build/contract/hook-source/controller provenance, and activation monotonic timestamps. Readers accept only the complete structure emitted by the current writer; unknown fields, missing fields, invalid provenance, and old runs fail closed without rewriting. If the state cannot be recognized, preserve the file, advise rebuilding the sandbox or manually repairing it, do not migrate it, and do not create a follow-up task. Finish or clear every active run before upgrading agent-infra. An expired prepared orphan may be explicitly recovered only with the exact task fingerprint, no consumed authorization, and no matching unconsumed active lifecycle evidence.
13
+ `orchestration.json` records stages, model policy, child identity, and actual outcomes. Records use the current structure; trusted local operators may correct them and rerun validation. Existing task write locks and atomic writes protect updates.
14
14
 
15
- ## Codex Host and Capability
15
+ ## Codex Host
16
16
 
17
- - Direct-host accepts only trusted project or managed lifecycle hooks. A task-bound sandbox requires a controlled nested controller and isolated `CODEX_HOME`; only user hooks bound to that controller context are accepted. Ordinary user/plugin hooks are not evidence. The actual hook/profile used by the run is the source of record; content drift is reported as a warning with rebuild guidance.
18
- - The controller starts a nested loop only after control generation, task binding, protocol version, profiles, and hook discovery pass. Build/contract and content drift is reported as a structured warning with rebuild guidance instead of blocking natural evolution. Both bypass flags are restricted to this task-bound launch path.
19
- - Every prepare arms a one-use capability attested by the current loop's real PostToolUse. Atomic consumption binds task/session/build/controller and retains only a redacted tombstone.
17
+ - Use native spawn, wait, and App Server results from the current host; forward task operations through the existing broker.
18
+ - Prepare validates the current task, model policy, and host preflight. Start and terminal records associate observed parent/child identity; failure must not be recorded as success.
19
+ - Local execution does not require capability, controller attestation, or one-use consumption authority. Do not add automatic child discovery, spawn under a new lock protocol, orphan recovery, or a dedicated recovery protocol.
20
20
 
21
21
  ## Model Policy
22
22
 
@@ -5,18 +5,18 @@
5
5
  - 总控只路由和委派;阶段技能仍是业务规则与产物格式的单一事实源。
6
6
  - 每个阶段和每轮返工都创建 fresh executor;每轮审查创建 fresh reviewer,禁止 follow-up 复用。
7
7
  - reviewer 只能写当前审查产物和核心生成的任务元数据。业务代码、HEAD 或暂存区变化会使 receipt 失效。
8
- - active run 中只有一个 pending delegation。child 必须在任何阶段副作用前通过 activation barrier;缺失、超时、错配、fork、重放、hook 不可用或工作区漂移一律暂停(claude-code 路径下 model/effort 证据的缺失或错配、以及该宿主结构上不提供的 fork/spawn-mode 证据,按 `.agents/skills/run-task/reference/host-validation.md` 的记录规则处理,不在此列;`parentId`/`childId` 的缺失或错配仍然暂停)。跨根 package/build/contract 或 hook/profile 内容漂移只输出可交付 warning;本轮 receipt 的 hook/evidence 绑定仍硬校验。
8
+ - active run 中只有一个 pending delegation;阶段与实际 child 身份保持一致,启动和终态失败如实记录。
9
9
  - 首版成功终点是一次通过既有安全门禁的 `commit`;不创建 PR、不监控 checks、不执行 `complete-task`。
10
10
 
11
- ## 恢复语义
11
+ ## 当前执行记录
12
12
 
13
- `orchestration.json` 是详细状态源。current run 保存完整策略、append-only 恢复历史、build/contract/hook source/controller provenance 与 activation 单调时钟。读取时只接受当前 writer 的完整结构;未知字段、缺失字段、非法 provenance 或旧 run 一律失败关闭且不改写。遇到无法识别的 `orchestration.json`,保留原文件并提示重建 sandbox 或人工修复后重试,不做 schema 迁移,也不创建 follow-up task。升级 agent-infra 前必须完成或清空所有 active run。prepared orphan 只允许在 deadline 已过、task fingerprint 精确不变、无 authorization 消耗且无匹配的未消费 active lifecycle evidence 时显式恢复。
13
+ `orchestration.json` 记录阶段、模型策略、child 身份及实际执行结果。记录必须符合当前结构;本地操作者可直接修正后重新校验。已有任务写锁与原子写入继续保护写操作。
14
14
 
15
- ## Codex 宿主与 capability
15
+ ## Codex 宿主
16
16
 
17
- - direct-host 只接受 trusted project 或 managed lifecycle hooks。task-bound sandbox 必须由受控 nested controller 建立隔离 `CODEX_HOME`,仅接受绑定 controller context 的 user hooks;普通 user/plugin hook 不得成为证据源。使用本轮实际加载的 hook/profile,内容漂移只记录 warning 并提示重建 sandbox。
18
- - controller 只有在 control generation、task binding、协议版本、profile 与 hook discovery 全部通过后才能启动 nested loop;build/contract 及内容漂移通过结构化 warning 告知并建议重建 sandbox,不阻塞自然演进。两个 bypass 参数只允许出现在该 task-bound 启动路径。
19
- - 每次 prepare 前必须 arm 一次性 capability,并由同一当前 loop 的真实 PostToolUse attestation;token 原子消费后保留去敏 tombstone,不能重放或跨 task/session/build/controller 使用。
17
+ - 使用当前宿主的原生 spawn、wait 与 App Server 结果;任务操作通过现有 broker 转发。
18
+ - prepare 校验当前任务、模型策略与宿主 preflight。启动和完成记录关联实际 parent/child 身份,失败不得写成成功。
19
+ - 不要求 capability、controller attestation 或一次性消费授权本地实现;不新增 child 自动发现、锁内启动交接、孤立 child 恢复或专用恢复协议。
20
20
 
21
21
  ## 模型策略
22
22
 
@@ -1,65 +1,27 @@
1
- # General Rule - Model-Driven Local Artifact Recovery
1
+ # Shared Rule - Current Local Artifact Revalidation
2
2
 
3
- This rule covers the pre-completion gate for `analyze-task`, `plan-task`, and `code-task`, plus the summary finalizers for the three review skills. It handles one canonical artifact in the current task directory only. It does not authorize changes to `task.md`, ledgers, receipts, source code, Git, platform resources, or lifecycle state.
3
+ This rule applies to lifecycle artifact validation. Finalizers read the canonical artifact directly and do not create recovery candidates, generations, baselines, journals, or recovery identities.
4
4
 
5
- ## Pre-completion gate
5
+ ## Current validation
6
6
 
7
- - Run the applicable finalizer before a completed event; pass only that invocation's `artifactSha256` and `semanticDigest` to the event.
8
- - When artifact content is invalid, the finalizer returns a controlled `recovery` with a `recoveryId`, `candidatePath`, and baseline digests. The formal artifact remains unchanged until recovery commit.
9
- - After the mechanical safety gates pass, the model may edit only the returned `candidatePath`. After each byte-changing edit, rerun the complete finalizer with the same task, stage/family, artifact, and `--recovery-id`. Never edit the formal artifact directly and call it a candidate.
10
- - Preflight stable-reads and validates candidate `S`, then seals immutable digest-addressed generation `R`; candidate SHA is an observation rather than an edit guard.
11
- - Preflight publishes active `R` through `preflight-ready → preflight-commit-started → preflight-passed`; the business finalizer publishes `F` through `full-finalizer-ready → commit-started → passed` and reuses `R` when `F=R`.
12
- - Candidate-only is a protocol authorization boundary, not OS isolation: a same-UID process with arbitrary host filesystem write access may tamper with recovery internals. Identity, fingerprint, and state checks detect such anomalies and fail closed, but the protocol does not claim an independent security principal or cross-platform isolation.
7
+ 1. Run the applicable finalizer before a completed event and use its returned `artifactSha256` and `semanticDigest`.
8
+ 2. On failure, read diagnostics, make one minimal repair to the canonical artifact, and rerun with the same task, family/stage, and artifact.
9
+ 3. Every rerun validates structure, qualification, upstream relations, ledger state, and current digests. Stop without publishing completed when there is no progress or repair is unsafe.
13
10
 
14
- ## Authorization boundary
11
+ ## Editing boundary
15
12
 
16
- - The finalizer and recovery core validate identity, state, permissions, stable reads, complete artifact semantics, and fingerprints. They do not infer repairability or expose a text-operation allow-list.
17
- - The model may edit only the one ordinary artifact declared by the current skill. It must not edit `task.md`, ledgers, receipts, source code, other reports, or remote resources.
18
- - `changed=false`, an error code, or a format shape is diagnostic evidence, not edit authorization. Stop on unproven human-decision semantics, concurrency, permission, I/O, identity, provenance, or unknown state.
13
+ Agents may edit only the artifact declared by the current skill.
19
14
 
20
- ## Non-bypassable mechanical gates
15
+ ## Completed events
21
16
 
22
- Before every candidate edit, confirm that:
17
+ Completed events still validate current digests, rounds, inputs, and external facts.
23
18
 
24
- 1. the finalizer failed with the same controlled recovery context and nothing formal was committed;
25
- 2. task, family/stage, round, artifact, request/authority, and baseline fingerprints still match;
26
- 3. `candidatePath` is the ordinary file generated by the recovery core and the formal target has not changed externally;
27
- 4. the edit does not change human-decision semantics, detail or ledger identity, and introduces no other side effect.
28
-
29
- If any condition fails, stop without editing or publishing a completed event.
30
-
31
- ## Durable recovery states
32
-
33
- | State | Formal artifact | Allowed action |
34
- | --- | --- | --- |
35
- | `awaiting-preflight-recovery` | baseline `B` | Edit `S`; stable-read, validate, and create `R` |
36
- | `preflight-ready` / `preflight-commit-started` | `B` or `R` | Reconcile/publish only active immutable `R` |
37
- | `preflight-passed` | `R` | Run the business finalizer for `F` |
38
- | `full-finalizer-ready` / `commit-started` | `R` or `F` | Reconcile/publish only pending immutable `F` |
39
- | `passed` | `F` | Completed event validates the final digest and consumes the intent |
40
- | `consumed` | `F` | Cleanup may reclaim the controlled staging and backup |
41
- | `aborted` | verified restored `B` | Preserve diagnostics; never fabricate success |
42
-
43
- The intent is current-only schema version 4. Legacy schemas fail closed; do not add migration, adapters, or dual writes. Candidate, baseline, generation, and intent files live in controlled repo-local directories and use canonical recovery IDs, regular-file checks, stable reads, the task lock, and expected-value CAS. No cross-file atomicity is claimed; unknown combinations remain indeterminate and retain their evidence.
44
-
45
- ## Dynamic convergence loop
46
-
47
- 1. Run the finalizer with the fixed invocation.
48
- 2. If it fails and the gates pass, read the structured diagnostic and `candidatePath`, then make one minimal, explainable candidate edit.
49
- 3. Confirm byte-level progress and rerun every finalizer check with the same `--recovery-id`.
50
- 4. Stop on repeated diagnostics or fingerprints, no byte progress, unknown recovery state, or the eight-edit limit for the current invocation. Do not publish a completed event or generate a cross-stage next step.
51
-
52
- ## Shared entry points
53
-
54
- The current entry points are `task-artifact ... inspect|init|finalize-local` and `task-review ... finalize-summary`. Recovery retries use the `recoveryId` returned by the finalizer, for example:
19
+ ## Shared entry point
55
20
 
56
21
  ```text
57
- agent-infra-internal task-artifact {task-id} finalize-local --family code --artifact {code-artifact} --recovery-id {recovery-id}
58
- agent-infra-internal task-review {task-id} finalize-summary --stage code --artifact {review-artifact} --recovery-id {recovery-id}
22
+ agent-infra-internal task-artifact {task-id} finalize-local --family code --artifact {code-artifact}
59
23
  ```
60
24
 
61
- There is no `task-artifact repair`, `replace-line`, `insert-section`, or `repairable` authorization. The structural engine returns diagnostics and digests only; the current skill's gates and the model decide whether and how to edit the candidate.
62
-
63
- ## Lifecycle isolation
25
+ ## Stop conditions
64
26
 
65
- A completed event may legitimately modify `task.md`, but only after finalizer recovery is `passed` and digest, round, request, and authority all match. If authority consumption fails after the event write, retain the formal artifact and use the existing lifecycle recovery compensation; do not replay the completed write or roll back a passed artifact.
27
+ Stop when repair is unsafe or makes no progress.
@@ -1,66 +1,27 @@
1
- # 通用规则 - 模型驱动的本地产物恢复
1
+ # 通用规则 - 当前本地产物重验
2
2
 
3
- 本规则适用于 `analyze-task`、`plan-task`、`code-task` 的本地产物完成前门禁,以及三个 review skill 的 summary finalizer。它只处理当前 task 目录内的一个 canonical artifact;不适用于 `task.md`、账本、receipt、源码、Git、平台资源或生命周期状态。
3
+ 本规则适用于生命周期产物的当前校验。finalizer 直接读取正式 artifact,不创建 recovery candidate、generation、baseline、journal 或 recovery identity。
4
4
 
5
- ## 完成前门禁
5
+ ## 当前校验
6
6
 
7
- - 完成事件前必须运行对应 finalizer;只有同一次返回的 `artifactSha256` 和 `semanticDigest` 才能传给 completed event。
8
- - preflight 先对当前 stable-read candidate 完整验证,并将验证的 `R` 写入 digest-addressed、只读的 generation;在 journal CAS 前正式 artifact 必须保持 baseline `B`。
9
- - candidate SHA 是 awaiting 状态的最后一次 stable-read 观测值,不是下一次编辑的 guard。合法 `S` 编辑必须重新验证并在成功后 CAS 为 `R`。
10
- - 只有在机械安全门通过后,模型才可编辑返回的 `candidatePath`;每次实际字节变化后,用同一 task、stage/family、artifact 和 `--recovery-id` 完整重跑 finalizer。不得直接编辑正式 artifact 后假设它属于候选。
11
- - preflight 按 `preflight-ready → preflight-commit-started → preflight-passed` 发布 immutable `R`;业务 finalizer 再按 `full-finalizer-ready → commit-started → passed` 将 `F` 发布。`F=R` 复用 active generation。
12
- - preflight-ready 后 publish 只读取 active/pending generation,绝不再读取可编辑 candidate。
13
- - candidate-only 是协议授权边界,不是操作系统隔离:拥有同一 UID 且可任意写入宿主文件系统的进程可能篡改 recovery 内部文件;协议会通过身份、指纹和状态校验发现异常并失败关闭,但不承诺独立权限主体或跨平台隔离。
7
+ 1. completed event 前运行对应 finalizer,并使用该次返回的 `artifactSha256` 和 `semanticDigest`。
8
+ 2. 失败时读取诊断,对正式 artifact 作一次最小修正,再以相同 task、family/stage 和 artifact 重跑。
9
+ 3. 每次重跑重新校验结构、资格、上游关系、账本和当前摘要;没有进展或无法安全修正时停止,不发布 completed。
14
10
 
15
- ## 授权边界
11
+ ## 编辑边界
16
12
 
17
- - finalizer 和 recovery core 只校验身份、状态、权限、稳定读取、完整 artifact 语义和指纹;不根据错误码猜测“可修复”,也不提供文本操作白名单。
18
- - 模型只能修改当前 skill 声明的一个普通 artifact。不得修改 task.md、账本、receipt、源码、其他报告或远端资源。
19
- - `changed=false`、错误码和格式形状只是诊断事实,不是编辑授权。人工裁决、并发、权限、I/O、身份、provenance 或未知状态无法证明安全时,立即停止。
13
+ 模型只能修改当前 skill 声明的 artifact。
20
14
 
21
- ## 不可绕过的机械安全门
15
+ ## 完成事件
22
16
 
23
- 每次编辑候选前确认:
24
-
25
- 1. finalizer 返回失败并提供同一 recovery context,且没有正式提交;
26
- 2. task、family/stage、round、artifact、request/authority 和 baseline 指纹仍匹配;
27
- 3. `candidatePath` 是 recovery core 生成的受控普通文件,formal target 没有外部变化;
28
- 4. 修改不改变人工裁决语义、详情或账本身份,也不引入其他副作用。
29
-
30
- 任一条件不满足,停止,不编辑、不发布 completed。
31
-
32
- ## Durable recovery 状态
33
-
34
- | 状态 | formal artifact | 允许动作 |
35
- | --- | --- | --- |
36
- | `awaiting-preflight-recovery` | baseline `B` | 只编辑 candidate `S`,稳定读取、验证并生成 `R` |
37
- | `preflight-ready` / `preflight-commit-started` | `B` 或 `R` | 只可从 active immutable `R` reconcile/publish |
38
- | `preflight-passed` | `R` | 执行业务 finalizer,生成或复用 `F` |
39
- | `full-finalizer-ready` / `commit-started` | `R` 或 `F` | 只可从 pending immutable `F` reconcile/publish |
40
- | `passed` | `F` | completed event 校验 final digest 后消费 |
41
- | `consumed` | `F` | 可由中间产物清理流程回收受控 staging/backup |
42
- | `aborted` | 已确认恢复的 `B` | 只保留诊断,不得伪造成功 |
43
-
44
- intent 使用 current-only schema version 4。旧 schema 直接失败关闭;不添加迁移、adapter 或双写。candidate、baseline、generation 和 intent 位于 repo-local 受控目录,使用 canonical recovery ID、普通文件检查、stable read、task lock 和 expected-value CAS。跨文件不宣称原子性;未知组合返回 indeterminate 并保留现场。
45
-
46
- ## 动态收敛循环
47
-
48
- 1. 用固定 invocation 运行 finalizer。
49
- 2. 失败且安全门通过时,读取结构化诊断和 `candidatePath`,只作一次最小、可解释的候选编辑。
50
- 3. 确认字节变化后,使用同一 `--recovery-id` 完整重跑全部 finalizer 校验。
51
- 4. 诊断或指纹重复、无字节进展、恢复状态未知或达到当前 invocation 的 8 次编辑上限时停止;不发布 completed,不生成跨阶段 next-step。
17
+ completed event 仍校验当前 digest、round、输入和外部事实。
52
18
 
53
19
  ## 共享入口
54
20
 
55
- `task-artifact ... inspect|init|preflight|finalize-local` 和 `task-review ... finalize-summary` 是当前入口。preflight 不发布 task metadata、ledger、formal provenance、completed event 或平台状态;恢复重试使用 finalizer 返回的 `recoveryId`,例如:
56
-
57
21
  ```text
58
- agent-infra-internal task-artifact {task-id} finalize-local --family code --artifact {code-artifact} --recovery-id {recovery-id}
59
- agent-infra-internal task-review {task-id} finalize-summary --stage code --artifact {review-artifact} --recovery-id {recovery-id}
22
+ agent-infra-internal task-artifact {task-id} finalize-local --family code --artifact {code-artifact}
60
23
  ```
61
24
 
62
- 不再存在 `task-artifact repair`、`replace-line`、`insert-section` 或 `repairable` 授权。结构引擎只返回诊断和 digest;候选是否安全、如何修改以及何时停止由当前 skill 的机械门和模型逐例判断。
63
-
64
- ## 生命周期隔离
25
+ ## 停止条件
65
26
 
66
- completed event 合法地修改 task.md,但必须发生在 finalizer recovery 已 `passed` 且 digest、round、request/authority 全部匹配之后。若 event 写入后 authority 消费失败,保留正式 artifact,使用既有 lifecycle recovery compensation;不得重放 completed 写入或回滚已通过的 artifact。
27
+ 无法安全修正或没有进展时停止。
@@ -140,7 +140,7 @@ Before writing this round's `{analysis-artifact}`, create the controlled report
140
140
  agent-infra-internal task-artifact {task-id} init --family analysis --artifact {analysis-artifact} --locale en
141
141
  ```
142
142
 
143
- The skeleton contains identity metadata, stable section markers, and required headings only; real analysis content is required before the completion gate can pass. If the finalizer returns one provably safe structural error, it returns a controlled recovery candidate; edit only its `candidatePath`, then rerun `task-artifact {task-id} finalize-local --family analysis --artifact {analysis-artifact} --recovery-id {recovery-id}` with the same `recoveryId`. Candidate-only is a protocol authorization boundary, not OS isolation; arbitrary same-UID host writers are outside the protocol's protection claim, and fingerprint/state checks fail closed on anomalies.
143
+ The skeleton contains identity metadata, stable section markers, and required headings only; real analysis content is required before the completion gate can pass. On a structural error, correct the formal artifact directly and rerun `task-artifact {task-id} finalize-local --family analysis --artifact {analysis-artifact}`; current structure, qualification, and summary facts are the only gate.
144
144
 
145
145
  > Steps 6–9 are the **Scenario A (normal output)** path. **Scenario B (ask and early-exit)** already finished its state update, task-comment sync, and verification inside step 4 and STOPped, so it does not enter these steps.
146
146
 
@@ -223,8 +223,8 @@ agent-infra-internal task-artifact {task-id} finalize-local --family analysis --
223
223
  ```
224
224
 
225
225
  - On `status=passed`, save that result's `artifactSha256` and `semanticDigest`; the finalizer has recorded the matching one-shot local provenance intent.
226
- - On `status=failed` with recovery context, edit only the returned `candidatePath` once after the completion gates pass, then rerun the finalizer completely with the same `recoveryId`; the formal artifact must remain unchanged until commit.
227
- - The recovery candidate must match the recorded task, round, artifact, baseline, and request identity. On baseline conflict, unknown state, no progress, or repeated failure, stop without publishing a completed event.
226
+ - On `status=failed`, correct the formal artifact directly and rerun the finalizer completely; if the current diagnostic remains unresolved, continue to the next attempt.
227
+ - On an external formal-artifact change, an unsafe repair, repeated diagnostics or fingerprints, no progress, or the shared edit limit, stop without publishing a completed event.
228
228
 
229
229
  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.
230
230
  - {YYYY-MM-DD HH:mm:ss±HH:MM} — **Analyze Task (Round {N})** by {agent} — Analysis completed → {analysis-artifact}
@@ -143,7 +143,7 @@ agent-infra-internal task-event {task-id} analyze.started --agent {standard-agen
143
143
  agent-infra-internal task-artifact {task-id} init --family analysis --artifact {analysis-artifact}
144
144
  ```
145
145
 
146
- 骨架只包含身份元数据、稳定 section marker 和必需标题;必须填入真实分析内容后才能通过完成门禁。finalizer 返回可证明的单个结构错误时,会返回受控 recovery candidate;只能编辑返回的 `candidatePath`,然后使用同一个 `recoveryId` 重跑 `task-artifact {task-id} finalize-local --family analysis --artifact {analysis-artifact} --recovery-id {recovery-id}`。candidate-only 是协议授权边界,不是操作系统隔离;同 UID 的任意宿主写入者不在本协议的防护承诺内,异常由指纹/状态校验失败关闭。
146
+ 骨架只包含身份元数据、稳定 section marker 和必需标题;必须填入真实分析内容后才能通过完成门禁。finalizer 返回结构错误时,直接修正正式产物后重跑 `task-artifact {task-id} finalize-local --family analysis --artifact {analysis-artifact}`;当前结构、资格和摘要事实是唯一门禁。
147
147
 
148
148
  > 步骤 6–9 属**场景 A(正常产出)**路径。**场景 B(提问早退)**已在步骤 4 内完成状态更新、task 评论同步与校验并 STOP,不进入这些步骤。
149
149
 
@@ -226,8 +226,8 @@ agent-infra-internal task-artifact {task-id} init --family analysis --artifact {
226
226
  agent-infra-internal task-artifact {task-id} finalize-local --family analysis --artifact {analysis-artifact}
227
227
  ```
228
228
  - `status=passed`:保存本次返回的 `artifactSha256` 和 `semanticDigest`;finalizer 已记录对应的一次性本地 provenance intent。
229
- - `status=failed` 且返回 recovery context:完成门禁通过后,只编辑返回的 `candidatePath` 一次,然后使用同一个 `recoveryId` 完整重跑 finalizer;formal artifact 在 commit 前必须保持不变。
230
- - recovery candidate 必须与记录的任务、轮次、产物、baseline 和 request identity 匹配;基线冲突、未知状态、无进展或重复失败:停止,不发布 completed 事件。
229
+ - `status=failed`:直接修正正式产物并完整重跑 finalizer;若仍失败且诊断未解决,继续下一轮。
230
+ - 当前正式产物发生外部变化、无法安全修复、诊断或指纹重复、无进展,或达到共享规则的编辑上限时停止,不发布 completed 事件。
231
231
  - 使用同一次 `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。
232
232
 
233
233
  如果 task.md 中存在有效的 `platform_issue_identity`,执行以下同步操作(任一失败则跳过并继续):
@@ -24,16 +24,7 @@
24
24
  "expected_action_pattern": "(Analyze Task|Requirement Analysis) \\(Round \\d+\\)"
25
25
  },
26
26
  "platform-sync": {
27
- "when": "platform_issue_identity_exists",
28
- "expected_status_label": "status: pending-design-work",
29
- "expected_comment_marker": "<!-- sync-issue:{task-id}:{artifact-stem} -->",
30
- "verify_comment_content": true,
31
- "verify_task_comment_content": true,
32
- "verify_issue_type": true,
33
- "verify_issue_fields": false,
34
- "verify_milestone": true,
35
- "expected_status_label_key": "pendingDesignWork",
36
- "expected_comment_marker_key": "artifact"
27
+ "when": "platform_issue_identity_exists"
37
28
  }
38
29
  }
39
30
  }
@@ -24,16 +24,7 @@
24
24
  "expected_action_pattern": "(Analyze Task|Requirement Analysis) \\(Round \\d+\\)"
25
25
  },
26
26
  "platform-sync": {
27
- "when": "platform_issue_identity_exists",
28
- "expected_status_label": "status: pending-design-work",
29
- "expected_comment_marker": "<!-- sync-issue:{task-id}:{artifact-stem} -->",
30
- "verify_comment_content": true,
31
- "verify_task_comment_content": true,
32
- "verify_issue_type": true,
33
- "verify_issue_fields": false,
34
- "verify_milestone": true,
35
- "expected_status_label_key": "pendingDesignWork",
36
- "expected_comment_marker_key": "artifact"
27
+ "when": "platform_issue_identity_exists"
37
28
  }
38
29
  }
39
30
  }
@@ -21,9 +21,7 @@
21
21
  "expected_action_pattern": "(Block Task|Blocked)"
22
22
  },
23
23
  "platform-sync": {
24
- "when": "platform_issue_identity_exists",
25
- "expected_status_label": "status: blocked",
26
- "expected_status_label_key": "blocked"
24
+ "when": "platform_issue_identity_exists"
27
25
  }
28
26
  }
29
27
  }
@@ -22,10 +22,7 @@
22
22
  "expected_action_pattern": "(Cancel Task|Cancelled)"
23
23
  },
24
24
  "platform-sync": {
25
- "when": "platform_issue_identity_exists",
26
- "expected_comment_marker": "<!-- sync-issue:{task-id}:cancel -->",
27
- "verify_task_comment_content": true,
28
- "expected_comment_marker_key": "cancel"
25
+ "when": "platform_issue_identity_exists"
29
26
  }
30
27
  }
31
28
  }
@@ -122,7 +122,7 @@ Before writing this round's `{code-artifact}`, create the controlled report skel
122
122
  agent-infra-internal task-artifact {task-id} init --family code --artifact {code-artifact} --locale en
123
123
  ```
124
124
 
125
- The skeleton contains identity metadata, stable section markers, and required headings only; real implementation and verification content is required before the completion gate can pass. If the finalizer returns one provably safe structural error, it returns a controlled recovery candidate; edit only its `candidatePath`, then rerun `task-artifact {task-id} finalize-local --family code --artifact {code-artifact} --recovery-id {recovery-id}` with the same `recoveryId`. Candidate-only is a protocol authorization boundary, not OS isolation; arbitrary same-UID host writers are outside the protocol's protection claim, and fingerprint/state checks fail closed on anomalies.
125
+ The skeleton contains identity metadata, stable section markers, and required headings only; real implementation and verification content is required before the completion gate can pass. On a preflight or finalization structural error, follow `.agents/rules/local-artifact-repair.md` to correct the formal artifact directly and rerun the same entry point; current structure, qualification, and summary facts are the only gate.
126
126
 
127
127
  Create `.agents/workspace/active/{task-id}/{code-artifact}`.
128
128
 
@@ -139,8 +139,8 @@ echo "$finalizer"
139
139
  ```
140
140
 
141
141
  - `status=0` with `finalizer.status="passed"`: bind `{artifact-sha256}` and `{semantic-digest}` from this result.
142
- - `status=1` with recovery context: confirm task, round, artifact, baseline, and request identity are unchanged; edit only the returned `candidatePath` once, confirm the bytes changed, then rerun the same finalizer completely with the same `recoveryId`; `baseline`, `final`, `publish`, and `intent` remain framework-internal state and must not be edited.
143
- - For any other failure, external formal-artifact change, lack of progress, or recovery identity mismatch, stop without publishing `code.completed`.
142
+ - `status=1`: correct the formal artifact directly and rerun the entry point completely; a failed preflight reruns preflight and a failed finalizer reruns that finalizer. If the current diagnostic remains unresolved, continue to the next attempt.
143
+ - For any other failure, external formal-artifact change, an unsafe repair, repeated diagnostics or fingerprints, lack of progress, or the shared edit limit, stop without publishing `code.completed`.
144
144
 
145
145
  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.
146
146
 
@@ -162,7 +162,7 @@ checkpoint 成功后,若任务存在 `platform_issue_identity`,调用 `agent
162
162
  agent-infra-internal task-artifact {task-id} init --family code --artifact {code-artifact}
163
163
  ```
164
164
 
165
- 骨架只包含身份元数据、稳定 section marker 和必需标题;必须填入真实实现与验证内容后才能通过完成门禁。finalizer 返回可证明的单个结构错误时,会返回受控 recovery candidate;只能编辑返回的 `candidatePath`,然后使用同一个 `recoveryId` 重跑 `task-artifact {task-id} finalize-local --family code --artifact {code-artifact} --recovery-id {recovery-id}`。candidate-only 是协议授权边界,不是操作系统隔离;同 UID 的任意宿主写入者不在本协议的防护承诺内,异常由指纹/状态校验失败关闭。
165
+ 骨架只包含身份元数据、稳定 section marker 和必需标题;必须填入真实实现与验证内容后才能通过完成门禁。preflight 或 finalizer 返回结构错误时,按 `.agents/rules/local-artifact-repair.md` 直接修正正式产物并重跑原入口;当前结构、资格和摘要事实是唯一门禁。
166
166
 
167
167
  创建 `.agents/workspace/active/{task-id}/{code-artifact}`。
168
168
 
@@ -179,8 +179,8 @@ echo "$finalizer"
179
179
  ```
180
180
 
181
181
  - `status=0` 且 `finalizer.status="passed"`:绑定这一次返回的 `{artifact-sha256}` 和 `{semantic-digest}`。
182
- - `status=1` 且返回 recovery context:确认任务、轮次、产物、baseline 和 request identity 未变化后,只编辑返回的 `candidatePath` 一次,确认字节确实变化,再使用同一个 `recoveryId` 完整重跑同一 finalizer;baseline、final、publish 和 intent 均属于框架内部状态,不得编辑。
183
- - 其他失败、formal artifact 外部变化、无进展或 recovery identity 不匹配:停止,不发布 `code.completed`。
182
+ - `status=1`:直接修正正式产物后重跑同一入口;preflight 失败必须重跑 preflight,finalizer 失败必须重跑 finalizer。若仍失败且当前诊断未解决,继续下一轮。
183
+ - 其他失败、formal artifact 外部变化、无法安全修复、诊断或指纹重复、无进展或达到共享规则的编辑上限:停止,不发布 `code.completed`。
184
184
 
185
185
  不得重新扫描或手工补写摘要;完成事件必须携带本次 `passed` 结果的 `--artifact-sha256 {artifact-sha256} --semantic-digest {semantic-digest}`。
186
186
 
@@ -30,18 +30,7 @@
30
30
  ]
31
31
  },
32
32
  "platform-sync": {
33
- "when": "platform_issue_identity_exists",
34
- "expected_status_label": "status: in-progress",
35
- "expected_comment_marker": "<!-- sync-issue:{task-id}:{artifact-stem} -->",
36
- "verify_comment_content": true,
37
- "verify_task_comment_content": true,
38
- "verify_issue_type": true,
39
- "verify_issue_fields": false,
40
- "verify_in_labels_computed": true,
41
- "verify_milestone": true,
42
- "verify_milestone_specific": true,
43
- "expected_status_label_key": "inProgress",
44
- "expected_comment_marker_key": "artifact"
33
+ "when": "platform_issue_identity_exists"
45
34
  }
46
35
  }
47
36
  }
@@ -30,18 +30,7 @@
30
30
  ]
31
31
  },
32
32
  "platform-sync": {
33
- "when": "platform_issue_identity_exists",
34
- "expected_status_label": "status: in-progress",
35
- "expected_comment_marker": "<!-- sync-issue:{task-id}:{artifact-stem} -->",
36
- "verify_comment_content": true,
37
- "verify_task_comment_content": true,
38
- "verify_issue_type": true,
39
- "verify_issue_fields": false,
40
- "verify_in_labels_computed": true,
41
- "verify_milestone": true,
42
- "verify_milestone_specific": true,
43
- "expected_status_label_key": "inProgress",
44
- "expected_comment_marker_key": "artifact"
33
+ "when": "platform_issue_identity_exists"
45
34
  }
46
35
  }
47
36
  }
@@ -10,7 +10,7 @@ agent-infra-internal task-artifact {task-id} inspect --family code
10
10
 
11
11
  The core scans `plan.md` / `plan-r{N}.md`, `review-plan.md` / `review-plan-r{N}.md`, `code.md` / `code-r{N}.md`, and `review-code.md` / `review-code-r{N}.md` in the task directory.
12
12
 
13
- `code.started` persists the plan identity and SHA-256 for the round in task.md frontmatter. `code.completed` must read the canonical plan from the implementation report's `Plan Input` field and match both that start context and the current latest plan; missing, mismatched, or changed input fails closed.
13
+ `code.started` persists the plan identity and SHA-256 for the round in task.md frontmatter. `code.completed` uses that start context and verifies the current latest plan; changed input fails closed. The implementation report's `Plan Input` field is reader-facing traceability, not lifecycle identity validation.
14
14
 
15
15
  ## Eight Branches
16
16
 
@@ -10,7 +10,7 @@ agent-infra-internal task-artifact {task-id} inspect --family code
10
10
 
11
11
  核心扫描任务目录中的 `plan.md` / `plan-r{N}.md`、`review-plan.md` / `review-plan-r{N}.md`、`code.md` / `code-r{N}.md` 和 `review-code.md` / `review-code-r{N}.md`。
12
12
 
13
- `code.started` 会在 task.md frontmatter 中绑定本轮方案文件及其 SHA-256。`code.completed` 必须从实现报告的“方案输入”/“Plan Input”字段读取 canonical plan,并同时匹配该开始上下文和当前最新 plan;缺失、身份不一致或内容变化均失败关闭。
13
+ `code.started` 会在 task.md frontmatter 中绑定本轮方案文件及其 SHA-256。`code.completed` 使用该开始上下文并校验当前最新 plan;内容变化失败关闭。实现报告的“方案输入”/“Plan Input”仅供读者追溯,不参与生命周期身份校验。
14
14
 
15
15
  ## 8 个分支
16
16
 
@@ -4,6 +4,8 @@
4
4
 
5
5
  Use this structure when creating `code.md` or `code-r{N}.md`.
6
6
 
7
+ > Implementation-input fields provide reader-facing traceability. Lifecycle identity uses the input frozen by `code.started` and the completion receipt; it is not parsed from this report body.
8
+
7
9
  ## Output Template
8
10
 
9
11
  ```markdown
@@ -103,6 +105,15 @@ Use this structure when creating `code.md` or `code-r{N}.md`.
103
105
  > Record the state-check command, task/artifact scope, key result, and uncovered parts; each command starts with `$ `.
104
106
  > Follow `.agents/rules/evidence-reporting.md`: record task/artifact scope, key result, and uncovered parts; do not paste complete successful stdout.
105
107
 
108
+ Record at least one actually executed `$ ` command and its result summary; prose-only status is insufficient. An implementation-stage report normally includes:
109
+
110
+ ```text
111
+ $ agent-infra-internal task-snapshot {task-id} --format text
112
+ {task state, implementation-artifact scope, and uncovered-area summary}
113
+ $ agent-infra-internal task-artifact {task-id} inspect --family code
114
+ {code artifact, upstream input, and next-step summary}
115
+ ```
116
+
106
117
  ## Raw Evidence
107
118
 
108
119
  > Follow `.agents/rules/evidence-reporting.md`: pair each claim with a `$ ` command and proportionate result summary; include a decisive raw excerpt only for failures, blocking conditions, or disputes.
@@ -4,6 +4,8 @@
4
4
 
5
5
  创建 `code.md` 或 `code-r{N}.md` 时,使用以下结构。
6
6
 
7
+ > “实现输入”字段用于读者追溯。生命周期身份以 `code.started` 冻结的输入和完成 receipt 为准,不从本报告正文解析。
8
+
7
9
  ## 输出模板
8
10
 
9
11
  ```markdown
@@ -103,6 +105,15 @@
103
105
  > 记录状态核对命令、任务/产物范围、关键结果和未覆盖部分;每条命令以 `$ ` 开头。
104
106
  > 按 `.agents/rules/evidence-reporting.md` 同时记录任务/产物范围、关键结果和未覆盖部分;正常成功不粘贴完整 stdout。
105
107
 
108
+ 必须记录至少一条实际执行的 `$ ` 命令及其结果摘要,不能只写自然语言状态。实现阶段通常包括:
109
+
110
+ ```text
111
+ $ agent-infra-internal task-snapshot {task-id} --format text
112
+ {任务状态、实现产物范围和未覆盖项摘要}
113
+ $ agent-infra-internal task-artifact {task-id} inspect --family code
114
+ {code artifact、上游输入和下一步摘要}
115
+ ```
116
+
106
117
  ## 证据原文
107
118
 
108
119
  > 遵循 `.agents/rules/evidence-reporting.md`:每条断言配对 `$ ` 命令和相称结果摘要;仅为失败、阻塞或争议附决定性原文摘录。
@@ -18,11 +18,7 @@
18
18
  "expected_action_pattern": "Commit"
19
19
  },
20
20
  "platform-sync": {
21
- "when": "pr_fact_bound",
22
- "expected_pr_comment_marker": "<!-- sync-pr:{task-id}:summary -->",
23
- "verify_in_labels_computed": true,
24
- "verify_pr_comment_last_commit_matches_head": true,
25
- "expected_pr_comment_marker_key": "prSummary"
21
+ "when": "pr_fact_bound"
26
22
  }
27
23
  }
28
24
  }
@@ -31,17 +31,17 @@
31
31
  "expected_action_pattern": "Complete Manual Validation"
32
32
  },
33
33
  "review-ledger": {
34
- "stage_scope": ["analysis", "plan", "code"]
34
+ "stage_scope": [
35
+ "analysis",
36
+ "plan",
37
+ "code"
38
+ ]
35
39
  },
36
40
  "platform-sync": {
37
41
  "when": "pr_fact_bound",
38
- "expected_pr_comment_marker_key": "prSummary",
39
42
  "expected_pr_comment_required_patterns": [
40
43
  "^### ✅ (?:人工验证已通过|Manual Validation Passed)$"
41
- ],
42
- "verify_task_comment_content": true,
43
- "verify_issue_type": true,
44
- "verify_issue_fields": false
44
+ ]
45
45
  }
46
46
  }
47
47
  }