@fitlab-ai/agent-infra 0.9.13 → 0.9.14

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 (280) hide show
  1. package/bin/cli.ts +26 -9
  2. package/dist/bin/cli.js +173 -157
  3. package/dist/bin/internal-cli.js +42 -21
  4. package/dist/lib/agent-client.js +5 -0
  5. package/dist/lib/internal/agent-client.js +5 -2
  6. package/dist/lib/internal/cli-route-inventory.js +152 -0
  7. package/dist/lib/internal/codex-lifecycle.js +9 -6
  8. package/dist/lib/internal/codex-sandbox-controller.js +8 -2
  9. package/dist/lib/internal/git-workflow.js +10 -6
  10. package/dist/lib/internal/platform-checks.js +16 -4
  11. package/dist/lib/internal/platform-comment.js +16 -4
  12. package/dist/lib/internal/platform-context.js +4 -1
  13. package/dist/lib/internal/platform-issue.js +12 -4
  14. package/dist/lib/internal/platform-metadata.js +88 -0
  15. package/dist/lib/internal/platform-pr-review.js +16 -3
  16. package/dist/lib/internal/platform-pr.js +24 -10
  17. package/dist/lib/internal/platform-release-notes.js +6 -3
  18. package/dist/lib/internal/platform-security.js +93 -0
  19. package/dist/lib/internal/pr-review-grade.js +14 -3
  20. package/dist/lib/internal/release-workflow.js +19 -5
  21. package/dist/lib/internal/sandbox-control.js +22 -5
  22. package/dist/lib/internal/task-activity.js +13 -4
  23. package/dist/lib/internal/task-artifact.js +186 -27
  24. package/dist/lib/internal/task-context.js +4 -1
  25. package/dist/lib/internal/task-create.js +48 -15
  26. package/dist/lib/internal/task-delivery.js +4 -1
  27. package/dist/lib/internal/task-event.js +4 -1
  28. package/dist/lib/internal/task-finalization.js +4 -1
  29. package/dist/lib/internal/task-invalidation.js +4 -1
  30. package/dist/lib/internal/task-ledger.js +12 -1
  31. package/dist/lib/internal/task-lifecycle.js +4 -1
  32. package/dist/lib/internal/task-operation-registry.js +421 -0
  33. package/dist/lib/internal/task-orchestration.js +12 -0
  34. package/dist/lib/internal/task-override.js +10 -3
  35. package/dist/lib/internal/task-qualification.js +90 -0
  36. package/dist/lib/internal/task-review.js +4 -1
  37. package/dist/lib/internal/task-short-id.js +11 -1
  38. package/dist/lib/internal/task-snapshot.js +4 -1
  39. package/dist/lib/internal/task-validate.js +7 -2
  40. package/dist/lib/internal/task-verify.js +5 -1
  41. package/dist/lib/internal/task-warning.js +8 -1
  42. package/dist/lib/platform/comment-safety.js +226 -0
  43. package/dist/lib/platform/github-provider.js +233 -6
  44. package/dist/lib/platform/issue-comments.js +146 -34
  45. package/dist/lib/platform/pr-change-report.js +6 -12
  46. package/dist/lib/platform/pr-summary.js +28 -7
  47. package/dist/lib/platform/provider-contract.d.ts +67 -1
  48. package/dist/lib/platform/provider-contract.js +6 -2
  49. package/dist/lib/platform/provider-validation.js +76 -3
  50. package/dist/lib/platform/pull-requests.js +115 -170
  51. package/dist/lib/platform/repository-metadata.js +377 -0
  52. package/dist/lib/platform/security-alerts.js +155 -0
  53. package/dist/lib/platform/verification-sync.js +33 -26
  54. package/dist/lib/process-data/index.js +7 -0
  55. package/dist/lib/run/index.js +5 -0
  56. package/dist/lib/sandbox/commands/control-status.js +22 -0
  57. package/dist/lib/sandbox/commands/create.js +32 -6
  58. package/dist/lib/sandbox/commands/ls.js +5 -0
  59. package/dist/lib/sandbox/commands/rm.js +827 -120
  60. package/dist/lib/sandbox/commands/show.js +16 -0
  61. package/dist/lib/sandbox/control/client.js +83 -9
  62. package/dist/lib/sandbox/control/completed-reentry.js +85 -0
  63. package/dist/lib/sandbox/control/container-identity.js +28 -31
  64. package/dist/lib/sandbox/control/executor.js +149 -14
  65. package/dist/lib/sandbox/control/lifecycle.js +621 -127
  66. package/dist/lib/sandbox/control/native-file-lock.js +177 -0
  67. package/dist/lib/sandbox/control/server.js +305 -35
  68. package/dist/lib/sandbox/control/state.js +5 -3
  69. package/dist/lib/sandbox/control/task-view.js +183 -0
  70. package/dist/lib/sandbox/engines/authority.js +289 -0
  71. package/dist/lib/sandbox/engines/docker-exact-discovery.js +97 -0
  72. package/dist/lib/sandbox/index.js +5 -0
  73. package/dist/lib/sandbox/recovery.js +21 -1
  74. package/dist/lib/sandbox/workspace-view.js +2 -1
  75. package/dist/lib/sandbox/worktree-safety.js +4 -1
  76. package/dist/lib/server/index.js +8 -0
  77. package/dist/lib/task/artifact-lifecycle.js +42 -13
  78. package/dist/lib/task/artifact-operations.js +520 -0
  79. package/dist/lib/task/artifact-repair-intent.js +59 -0
  80. package/dist/lib/task/artifact-schema.js +135 -0
  81. package/dist/lib/task/capabilities.js +72 -1
  82. package/dist/lib/task/control-authority.js +4 -0
  83. package/dist/lib/task/create-service.js +103 -4
  84. package/dist/lib/task/create.js +25 -0
  85. package/dist/lib/task/events.js +186 -67
  86. package/dist/lib/task/index.js +11 -3
  87. package/dist/lib/task/local-artifact-finalization.js +75 -150
  88. package/dist/lib/task/orchestration.js +192 -52
  89. package/dist/lib/task/qualification-audit.js +490 -0
  90. package/dist/lib/task/qualification-confirmation.js +109 -0
  91. package/dist/lib/task/qualification-intents.js +148 -0
  92. package/dist/lib/task/review-artifacts.js +22 -23
  93. package/dist/lib/task/review-finalization.js +121 -4
  94. package/dist/lib/task/sections.js +6 -4
  95. package/dist/lib/task/verification-config.js +11 -0
  96. package/dist/lib/task/verification-engine.js +54 -4
  97. package/dist/lifecycle-build-manifest.json +3 -3
  98. package/lib/agent-client.ts +9 -0
  99. package/lib/internal/agent-client.ts +4 -2
  100. package/lib/internal/cli-route-inventory.ts +140 -0
  101. package/lib/internal/codex-lifecycle.ts +8 -6
  102. package/lib/internal/codex-sandbox-controller.ts +7 -2
  103. package/lib/internal/git-workflow.ts +9 -6
  104. package/lib/internal/platform-checks.ts +12 -4
  105. package/lib/internal/platform-comment.ts +12 -4
  106. package/lib/internal/platform-context.ts +3 -1
  107. package/lib/internal/platform-issue.ts +11 -4
  108. package/lib/internal/platform-metadata.ts +70 -0
  109. package/lib/internal/platform-pr-review.ts +14 -3
  110. package/lib/internal/platform-pr.ts +23 -10
  111. package/lib/internal/platform-release-notes.ts +5 -3
  112. package/lib/internal/platform-security.ts +83 -0
  113. package/lib/internal/pr-review-grade.ts +10 -3
  114. package/lib/internal/release-workflow.ts +17 -5
  115. package/lib/internal/sandbox-control.ts +19 -5
  116. package/lib/internal/task-activity.ts +12 -4
  117. package/lib/internal/task-artifact.ts +164 -25
  118. package/lib/internal/task-context.ts +3 -1
  119. package/lib/internal/task-create.ts +76 -15
  120. package/lib/internal/task-delivery.ts +3 -1
  121. package/lib/internal/task-event.ts +3 -1
  122. package/lib/internal/task-finalization.ts +3 -1
  123. package/lib/internal/task-invalidation.ts +3 -1
  124. package/lib/internal/task-ledger.ts +11 -1
  125. package/lib/internal/task-lifecycle.ts +3 -1
  126. package/lib/internal/task-operation-registry.ts +482 -0
  127. package/lib/internal/task-orchestration.ts +12 -0
  128. package/lib/internal/task-override.ts +9 -3
  129. package/lib/internal/task-qualification.ts +61 -0
  130. package/lib/internal/task-review.ts +3 -1
  131. package/lib/internal/task-short-id.ts +10 -1
  132. package/lib/internal/task-snapshot.ts +3 -1
  133. package/lib/internal/task-validate.ts +6 -2
  134. package/lib/internal/task-verify.ts +4 -1
  135. package/lib/internal/task-warning.ts +7 -1
  136. package/lib/platform/comment-safety.ts +250 -0
  137. package/lib/platform/github-provider.ts +229 -7
  138. package/lib/platform/issue-comments.ts +160 -35
  139. package/lib/platform/pr-change-report.ts +6 -12
  140. package/lib/platform/pr-summary.ts +27 -6
  141. package/lib/platform/provider-contract.ts +78 -3
  142. package/lib/platform/provider-validation.ts +85 -3
  143. package/lib/platform/pull-requests.ts +126 -178
  144. package/lib/platform/repository-metadata.ts +453 -0
  145. package/lib/platform/security-alerts.ts +191 -0
  146. package/lib/platform/verification-sync.ts +32 -28
  147. package/lib/process-data/index.ts +7 -0
  148. package/lib/run/index.ts +5 -0
  149. package/lib/sandbox/commands/control-status.ts +26 -0
  150. package/lib/sandbox/commands/create.ts +46 -6
  151. package/lib/sandbox/commands/ls.ts +7 -0
  152. package/lib/sandbox/commands/rm.ts +1000 -87
  153. package/lib/sandbox/commands/show.ts +16 -0
  154. package/lib/sandbox/control/client.ts +103 -9
  155. package/lib/sandbox/control/completed-reentry.ts +98 -0
  156. package/lib/sandbox/control/container-identity.ts +27 -43
  157. package/lib/sandbox/control/executor.ts +177 -12
  158. package/lib/sandbox/control/lifecycle.ts +629 -17
  159. package/lib/sandbox/control/native-file-lock.ts +209 -0
  160. package/lib/sandbox/control/protocol.ts +5 -2
  161. package/lib/sandbox/control/server.ts +319 -37
  162. package/lib/sandbox/control/state.ts +6 -3
  163. package/lib/sandbox/control/task-view.ts +240 -0
  164. package/lib/sandbox/engines/authority.ts +365 -0
  165. package/lib/sandbox/engines/docker-exact-discovery.ts +132 -0
  166. package/lib/sandbox/index.ts +7 -0
  167. package/lib/sandbox/recovery.ts +21 -1
  168. package/lib/sandbox/workspace-view.ts +9 -3
  169. package/lib/sandbox/worktree-safety.ts +4 -1
  170. package/lib/server/index.ts +10 -0
  171. package/lib/task/artifact-lifecycle.ts +38 -16
  172. package/lib/task/artifact-operations.ts +626 -0
  173. package/lib/task/artifact-repair-intent.ts +71 -0
  174. package/lib/task/artifact-schema.ts +192 -0
  175. package/lib/task/capabilities.ts +70 -1
  176. package/lib/task/control-authority.ts +11 -1
  177. package/lib/task/create-service.ts +131 -6
  178. package/lib/task/create.ts +27 -0
  179. package/lib/task/events.ts +161 -65
  180. package/lib/task/index.ts +16 -3
  181. package/lib/task/local-artifact-finalization.ts +87 -218
  182. package/lib/task/orchestration.ts +172 -49
  183. package/lib/task/qualification-audit.ts +599 -0
  184. package/lib/task/qualification-confirmation.ts +117 -0
  185. package/lib/task/qualification-intents.ts +150 -0
  186. package/lib/task/review-artifacts.ts +21 -22
  187. package/lib/task/review-finalization.ts +133 -4
  188. package/lib/task/sections.ts +6 -4
  189. package/lib/task/verification-config.ts +12 -0
  190. package/lib/task/verification-engine.ts +55 -4
  191. package/package.json +6 -1
  192. package/templates/.agents/rules/README.en.md +2 -0
  193. package/templates/.agents/rules/README.zh-CN.md +2 -0
  194. package/templates/.agents/rules/decision-qualification.en.md +22 -0
  195. package/templates/.agents/rules/decision-qualification.zh-CN.md +22 -0
  196. package/templates/.agents/rules/evidence-reporting.en.md +28 -0
  197. package/templates/.agents/rules/evidence-reporting.zh-CN.md +28 -0
  198. package/templates/.agents/rules/label-milestone-setup.en.md +7 -7
  199. package/templates/.agents/rules/label-milestone-setup.zh-CN.md +7 -7
  200. package/templates/.agents/rules/local-artifact-repair.en.md +5 -1
  201. package/templates/.agents/rules/local-artifact-repair.zh-CN.md +5 -1
  202. package/templates/.agents/rules/security-alerts.en.md +8 -8
  203. package/templates/.agents/rules/security-alerts.zh-CN.md +8 -8
  204. package/templates/.agents/skills/analyze-task/SKILL.en.md +15 -2
  205. package/templates/.agents/skills/analyze-task/SKILL.zh-CN.md +19 -2
  206. package/templates/.agents/skills/analyze-task/config/verify.en.json +1 -12
  207. package/templates/.agents/skills/analyze-task/config/verify.zh-CN.json +1 -12
  208. package/templates/.agents/skills/close-codescan/SKILL.en.md +2 -2
  209. package/templates/.agents/skills/close-codescan/SKILL.zh-CN.md +2 -2
  210. package/templates/.agents/skills/close-dependabot/SKILL.en.md +2 -2
  211. package/templates/.agents/skills/close-dependabot/SKILL.zh-CN.md +2 -2
  212. package/templates/.agents/skills/code-task/SKILL.en.md +14 -1
  213. package/templates/.agents/skills/code-task/SKILL.zh-CN.md +14 -1
  214. package/templates/.agents/skills/code-task/config/verify.en.json +5 -14
  215. package/templates/.agents/skills/code-task/config/verify.zh-CN.json +5 -14
  216. package/templates/.agents/skills/code-task/reference/code-rules.en.md +5 -4
  217. package/templates/.agents/skills/code-task/reference/code-rules.zh-CN.md +5 -4
  218. package/templates/.agents/skills/code-task/reference/dual-mode.en.md +1 -1
  219. package/templates/.agents/skills/code-task/reference/dual-mode.zh-CN.md +1 -1
  220. package/templates/.agents/skills/code-task/reference/fix-mode.en.md +3 -1
  221. package/templates/.agents/skills/code-task/reference/fix-mode.zh-CN.md +3 -1
  222. package/templates/.agents/skills/code-task/reference/report-template.en.md +42 -15
  223. package/templates/.agents/skills/code-task/reference/report-template.zh-CN.md +39 -12
  224. package/templates/.agents/skills/complete-manual-validation/SKILL.en.md +5 -1
  225. package/templates/.agents/skills/complete-manual-validation/SKILL.zh-CN.md +5 -1
  226. package/templates/.agents/skills/complete-manual-validation/reference/report-template.en.md +2 -0
  227. package/templates/.agents/skills/complete-manual-validation/reference/report-template.zh-CN.md +2 -0
  228. package/templates/.agents/skills/complete-task/SKILL.en.md +9 -22
  229. package/templates/.agents/skills/complete-task/SKILL.zh-CN.md +9 -22
  230. package/templates/.agents/skills/create-task/SKILL.en.md +8 -0
  231. package/templates/.agents/skills/create-task/SKILL.zh-CN.md +7 -0
  232. package/templates/.agents/skills/import-codescan/SKILL.en.md +1 -1
  233. package/templates/.agents/skills/import-codescan/SKILL.zh-CN.md +1 -1
  234. package/templates/.agents/skills/import-dependabot/SKILL.en.md +1 -1
  235. package/templates/.agents/skills/import-dependabot/SKILL.zh-CN.md +1 -1
  236. package/templates/.agents/skills/init-labels/SKILL.en.md +8 -8
  237. package/templates/.agents/skills/init-labels/SKILL.zh-CN.md +8 -8
  238. package/templates/.agents/skills/init-milestones/SKILL.en.md +9 -11
  239. package/templates/.agents/skills/init-milestones/SKILL.zh-CN.md +9 -11
  240. package/templates/.agents/skills/plan-task/SKILL.en.md +14 -1
  241. package/templates/.agents/skills/plan-task/SKILL.zh-CN.md +16 -1
  242. package/templates/.agents/skills/plan-task/config/verify.en.json +4 -14
  243. package/templates/.agents/skills/plan-task/config/verify.zh-CN.json +4 -14
  244. package/templates/.agents/skills/review-analysis/SKILL.en.md +14 -1
  245. package/templates/.agents/skills/review-analysis/SKILL.zh-CN.md +14 -1
  246. package/templates/.agents/skills/review-analysis/config/verify.en.json +1 -18
  247. package/templates/.agents/skills/review-analysis/config/verify.zh-CN.json +1 -18
  248. package/templates/.agents/skills/review-analysis/reference/report-template.en.md +50 -23
  249. package/templates/.agents/skills/review-analysis/reference/report-template.zh-CN.md +45 -18
  250. package/templates/.agents/skills/review-code/SKILL.en.md +14 -1
  251. package/templates/.agents/skills/review-code/SKILL.zh-CN.md +14 -1
  252. package/templates/.agents/skills/review-code/config/verify.en.json +1 -23
  253. package/templates/.agents/skills/review-code/config/verify.zh-CN.json +1 -23
  254. package/templates/.agents/skills/review-code/reference/report-template.en.md +49 -22
  255. package/templates/.agents/skills/review-code/reference/report-template.zh-CN.md +45 -18
  256. package/templates/.agents/skills/review-plan/SKILL.en.md +14 -1
  257. package/templates/.agents/skills/review-plan/SKILL.zh-CN.md +14 -1
  258. package/templates/.agents/skills/review-plan/config/verify.en.json +1 -18
  259. package/templates/.agents/skills/review-plan/config/verify.zh-CN.json +1 -18
  260. package/templates/.agents/skills/review-plan/reference/report-template.en.md +49 -22
  261. package/templates/.agents/skills/review-plan/reference/report-template.zh-CN.md +45 -18
  262. package/templates/.agents/skills/review-pr/SKILL.en.md +5 -1
  263. package/templates/.agents/skills/review-pr/SKILL.zh-CN.md +5 -1
  264. package/templates/.agents/skills/review-pr/reference/report-template.en.md +4 -3
  265. package/templates/.agents/skills/review-pr/reference/report-template.zh-CN.md +4 -3
  266. package/templates/.agents/skills/run-manual-validation/SKILL.en.md +5 -1
  267. package/templates/.agents/skills/run-manual-validation/SKILL.zh-CN.md +5 -1
  268. package/templates/.agents/skills/run-manual-validation/reference/report-template.en.md +3 -1
  269. package/templates/.agents/skills/run-manual-validation/reference/report-template.zh-CN.md +3 -1
  270. package/templates/.agents/skills/test/SKILL.en.md +13 -2
  271. package/templates/.agents/skills/test/SKILL.zh-CN.md +13 -2
  272. package/templates/.agents/skills/update-agent-infra/scripts/sync-templates.js +14 -0
  273. package/templates/.agents/templates/task.en.md +6 -0
  274. package/templates/.agents/templates/task.zh-CN.md +6 -0
  275. package/templates/.agents/scripts/security-alerts.github.sh +0 -151
  276. package/templates/.agents/scripts/security-alerts.sh +0 -31
  277. package/templates/.agents/skills/init-labels/scripts/init-labels.github.sh +0 -146
  278. package/templates/.agents/skills/init-labels/scripts/init-labels.sh +0 -32
  279. package/templates/.agents/skills/init-milestones/scripts/init-milestones.github.sh +0 -294
  280. package/templates/.agents/skills/init-milestones/scripts/init-milestones.sh +0 -6
@@ -35,6 +35,9 @@ import { OrchestrationStateError, readRun } from "./orchestration.ts";
35
35
  import { resolveDeliveryTarget } from "./delivery-target.ts";
36
36
  import { readPrDeliveryFact } from "./pr-delivery-fact.ts";
37
37
  import { validateLocalArtifact } from "./local-artifact-finalization.ts";
38
+ import { validateQualificationAudit } from "./qualification-audit.ts";
39
+ import { getArtifactSchema } from "./artifact-schema.ts";
40
+ import { inspectArtifactContract } from "./artifact-operations.ts";
38
41
 
39
42
  const TASK_ENUMS = {
40
43
  type: ["feature", "bugfix", "refactor", "docs", "chore"],
@@ -600,15 +603,45 @@ function checkArtifact({ taskDir, config, artifactFile, skillName }: any): any {
600
603
  }
601
604
 
602
605
  const content = fs.readFileSync(artifactPath, "utf8");
603
- const requiredSections = config.required_sections || [];
606
+ let taskContent = "";
607
+ const taskPath = path.join(taskDir, "task.md");
608
+ if (fs.existsSync(taskPath)) {
609
+ try {
610
+ taskContent = fs.readFileSync(taskPath, "utf8");
611
+ } catch (error) {
612
+ return failResult("artifact", `Cannot read task qualification contract: ${error instanceof Error ? error.message : String(error)}`);
613
+ }
614
+ }
615
+ if (taskContent && /^review-(?:analysis|plan|code)$/.test(skillName)) {
616
+ const qualification = validateQualificationAudit(taskContent, content, { artifact: path.basename(artifactPath) });
617
+ if (!qualification.ok) return failResult("artifact", `${path.basename(artifactPath)} has qualification audit errors: ${qualification.code}: ${qualification.message}`);
618
+ }
619
+ const schemaFamily = skillName === "analyze-task"
620
+ ? "analysis"
621
+ : skillName === "review-analysis"
622
+ ? "review-analysis"
623
+ : skillName === "plan-task"
624
+ ? "plan"
625
+ : skillName === "review-plan"
626
+ ? "review-plan"
627
+ : skillName === "code-task"
628
+ ? "code"
629
+ : skillName === "review-code" ? "review-code" : null;
630
+ const schema = schemaFamily ? getArtifactSchema(schemaFamily) : null;
604
631
  const localFamily = skillName === "analyze-task"
605
632
  ? "analysis"
606
633
  : skillName === "plan-task" ? "plan" : skillName === "code-task" ? "code" : null;
634
+ if (schema) {
635
+ const structure = inspectArtifactContract(content, schema);
636
+ if (!structure.ok && !localFamily) {
637
+ return failResult("artifact", `${path.basename(artifactPath)} has shared structural errors: ${structure.diagnostics.map((item) => `${item.code}: ${item.message}`).join('; ')}`);
638
+ }
639
+ }
607
640
  if (localFamily) {
608
641
  const local = validateLocalArtifact(content, {
609
642
  family: localFamily,
610
- requiredSections: requiredSections.filter((section: unknown): section is string => typeof section === "string"),
611
- requiredPatterns: (config.required_patterns || []).filter((pattern: unknown): pattern is string => typeof pattern === "string")
643
+ ...(taskContent ? { taskContent } : {}),
644
+ artifact: path.basename(artifactPath)
612
645
  });
613
646
  if (!local.ok) {
614
647
  return failResult(
@@ -618,9 +651,16 @@ function checkArtifact({ taskDir, config, artifactFile, skillName }: any): any {
618
651
  }
619
652
  return passResult(
620
653
  "artifact",
621
- `${path.basename(artifactPath)} passed (${requiredSections.length} sections)`
654
+ `${path.basename(artifactPath)} passed (${schema?.sections.length ?? 0} sections)`
622
655
  );
623
656
  }
657
+ if (schema) {
658
+ return passResult(
659
+ "artifact",
660
+ `${path.basename(artifactPath)} passed (${schema.sections.length} sections)`
661
+ );
662
+ }
663
+ const requiredSections = config.required_sections || [];
624
664
  const missingSections = requiredSections.filter(
625
665
  (section: any) => !new RegExp(`^##\\s+${escapeRegExp(section)}\\s*$`, "m").test(content)
626
666
  );
@@ -786,6 +826,7 @@ function checkActivityLog({ taskDir, config }: any): any {
786
826
  let previousTimestamp = "";
787
827
  let latestAction = "";
788
828
  let latestTimestamp = "";
829
+ const doneActions: string[] = [];
789
830
 
790
831
  for (const entry of entries) {
791
832
  const match = entry.match(ACTIVITY_LOG_PATTERN);
@@ -805,6 +846,16 @@ function checkActivityLog({ taskDir, config }: any): any {
805
846
  if (!ACTIVITY_LOG_STARTED_RE.test(action)) {
806
847
  latestTimestamp = timestamp;
807
848
  latestAction = action;
849
+ doneActions.push(action);
850
+ }
851
+ }
852
+
853
+ if (config.expected_action_pattern && !new RegExp(config.expected_action_pattern).test(latestAction)) {
854
+ const expected = new RegExp(config.expected_action_pattern);
855
+ let index = doneActions.length - 1;
856
+ while (index >= 0 && doneActions[index] === 'Commit' && !expected.test(doneActions[index]!)) index -= 1;
857
+ if (index >= 0 && expected.test(doneActions[index]!)) {
858
+ latestAction = doneActions[index]!;
808
859
  }
809
860
  }
810
861
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fitlab-ai/agent-infra",
3
- "version": "0.9.13",
3
+ "version": "0.9.14",
4
4
  "description": "Bootstrap tool for AI multi-tool collaboration infrastructure — works with Claude Code, Codex, Antigravity CLI, and OpenCode",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -54,6 +54,7 @@
54
54
  "@clack/prompts": "1.7.0",
55
55
  "@larksuiteoapi/node-sdk": "^1.68.0",
56
56
  "cross-spawn": "^7.0.6",
57
+ "fs-ext-extra-prebuilt": "2.2.13",
57
58
  "picocolors": "1.1.1",
58
59
  "semver": "^7.8.1",
59
60
  "smol-toml": "^1.6.1",
@@ -65,6 +66,7 @@
65
66
  "prepare": "git config core.hooksPath .git-hooks || true",
66
67
  "typecheck": "tsc -p tsconfig.test.json --noEmit && tsc -p tsconfig.jschecks.json --noEmit",
67
68
  "test:smoke": "node scripts/run-tests.js \"tests/unit/**/*.test.ts\"",
69
+ "test:smoke:fast": "node scripts/run-tests.js --skip-build \"tests/unit/**/*.test.ts\"",
68
70
  "test:core": "node scripts/run-tests.js \"tests/unit/**/*.test.ts\" \"tests/integration/**/*.test.ts\"",
69
71
  "test:integration": "node scripts/run-tests.js \"tests/integration/**/*.test.ts\" \"tests/e2e/**/*.test.ts\"",
70
72
  "check": "npm run typecheck && npm test",
@@ -83,5 +85,8 @@
83
85
  },
84
86
  "overrides": {
85
87
  "axios": "1.18.1"
88
+ },
89
+ "allowScripts": {
90
+ "fs-ext-extra-prebuilt@2.2.13": true
86
91
  }
87
92
  }
@@ -13,7 +13,9 @@ so you can quickly find "which ones to read" without opening each file.
13
13
  - [`version-stamp.md`](version-stamp.md) — How and when to stamp `agent_infra_version`.
14
14
  - [`debugging-guide.md`](debugging-guide.md) — Structured debugging flow: gather evidence → form hypothesis → verify hypothesis → fix the root cause; no blind patch-and-retry.
15
15
  - [`compatibility-policy.md`](compatibility-policy.md) — Compatibility by exception: admission evidence, implementation boundaries, exit conditions, and lifecycle review requirements.
16
+ - [`evidence-reporting.md`](evidence-reporting.md) — Minimum evidence semantics for state checks, successful summaries, exceptional results, identity fields, and sensitive data boundaries.
16
17
  - [`sync-content-generation.md`](sync-content-generation.md) — Producer-side Markdown constraints for task and lifecycle content synchronized to Issues.
18
+ - [`decision-qualification.md`](decision-qualification.md) — Constraint, candidate, human-confirmation, and six-artifact qualification-audit contract.
17
19
 
18
20
  ## Issue / PR
19
21
 
@@ -12,7 +12,9 @@
12
12
  - [`version-stamp.md`](version-stamp.md) — `agent_infra_version` 版本戳的取值命令与写入时机。
13
13
  - [`debugging-guide.md`](debugging-guide.md) — 结构化调试流程:收集证据→形成假设→验证假设→修复根因,禁止盲目改代码重试。
14
14
  - [`compatibility-policy.md`](compatibility-policy.md) — 兼容性默认关闭:准入证据、实现边界、退出条件与生命周期审查要求。
15
+ - [`evidence-reporting.md`](evidence-reporting.md) — 生命周期报告的状态核对、成功摘要、异常证据、身份字段和敏感信息边界。
15
16
  - [`sync-content-generation.md`](sync-content-generation.md) — 同步到 Issue 的任务和生命周期 Markdown 生成约束。
17
+ - [`decision-qualification.md`](decision-qualification.md) — 约束、候选、人工确认和六类 artifact 资格审计契约。
16
18
 
17
19
  ## Issue / PR
18
20
 
@@ -0,0 +1,22 @@
1
+ # Decision Qualification and Constraint Audit
2
+
3
+ Any analysis, plan, implementation, or review that decides whether a human decision is needed must audit qualification from the normalized constraints and candidates in `task.md` before creating `HD-N`.
4
+
5
+ ## Single source of truth
6
+
7
+ - The `### Constraints` and `### Candidate and Rejected Options` tables in `task.md` are the only constraint and candidate fact source.
8
+ - The constraint table uses `constraint_id`, `statement`, `status`, `authority`, `source`, `evidence`, `derived_from`, and `approval_evidence`; the candidate table uses `candidate_id`, `statement`, `status`, `constraint_ids`, `impact`, and `evidence`.
9
+ - All six artifact families must include `## Qualification Audit` with actual constraint dependencies, candidate qualification, classification results, upstream relations, and a dependency snapshot. Each upstream relation records family, file name, round, and SHA-256.
10
+
11
+ ## Status and confirmation
12
+
13
+ - A `confirmed` constraint requires source evidence, the current semantic digest, and a qualification confirmation record; a confirmation for an old digest cannot be reused.
14
+ - `derived`, `assumption`, `open`, `conflicted`, and `superseded` are pending facts and cannot automatically exclude a candidate.
15
+ - The internal proposal entry point may write only non-confirmed constraints and `pending` candidates. It cannot write actor, QCR, confirmed, or approval fields.
16
+ - `agent-infra-internal task-qualification` is the internal confirmation, supersession, and revocation entry point for agents and skills; ordinary users are not exposed to the constraint-digest protocol. `human-declared` is an audit label, not identity authentication. On confirmation, the core generates the QCR and binds it to the current post-write per-constraint digest, request id, time, and a single-line rationale. Supersession and revocation move the constraint to `superseded` and `open`, respectively, clear current approval evidence, and retain historical QCRs.
17
+
18
+ ## Invalidation and review
19
+
20
+ When a constraint changes, only artifacts declaring the affected `C-N` can be direct invalidation seeds; the change then follows the real downstream closure. All six families, including reviews, are symmetric. If snapshots, relations, or change classification cannot prove a pure constraint change, use the existing full invalidation path. The newly completed source artifact, its receipt, and its derived snapshot are excluded from the old target graph.
21
+
22
+ Missing or unknown references, digest mismatches, dangling relations, and cycles fail closed. Formatting-only changes must not change semantic digests; changes to meaning, provenance, status, candidates, or upstream identity require a new audit.
@@ -0,0 +1,22 @@
1
+ # 决策资格与约束审计
2
+
3
+ 涉及“是否需要人工裁决”的分析、方案、实现或审查,必须先基于 `task.md` 的规范化约束和候选表完成资格审计,再决定是否创建 `HD-N`。
4
+
5
+ ## 唯一事实源
6
+
7
+ - `task.md` 的 `### 约束` 和 `### 候选与否决方案` 是唯一约束/候选事实源。
8
+ - 约束表必须使用 `constraint_id`、`statement`、`status`、`authority`、`source`、`evidence`、`derived_from`、`approval_evidence`;候选表必须使用 `candidate_id`、`statement`、`status`、`constraint_ids`、`impact`、`evidence`。
9
+ - 六类阶段产物都要在 `## 资格审计` 中声明实际约束依赖、候选资格、分类结果、上游关系和依赖快照。上游关系必须保存 artifact 的 family、文件名、round 和 SHA-256。
10
+
11
+ ## 状态与确认
12
+
13
+ - `confirmed` 约束必须有来源证据、当前语义 digest 和 `资格确认记录`;旧 digest 的确认不能复用。
14
+ - `derived`、`assumption`、`open`、`conflicted`、`superseded` 只能作为待审事实,不能自动排除候选。
15
+ - 内部 proposal 入口只能写入非 confirmed 约束和 `pending` 候选,不能写 actor、QCR、confirmed 或 approval 字段。
16
+ - `agent-infra-internal task-qualification` 是供 Agent/skill 使用的内部确认、替代和撤销入口,不向普通用户暴露 constraint digest 协议;`human-declared` 是审计标签,不是身份认证。确认时 QCR 由核心生成并绑定确认写入后的当前单约束 digest、request id、时间和单行理由;替代与撤销分别把约束转为 `superseded` 与 `open`,清空当前 approval evidence,并保留历史 QCR。
17
+
18
+ ## 失效与审查
19
+
20
+ 约束变化时,只有声明受影响 `C-N` 的 artifact 才能成为直接失效种子,并沿真实上游关系的下游闭包传播;六类 artifact(含 review)对等处理。快照、关系图或变化分类无法证明为纯约束变化时,回退既有全量失效路径。新完成的 source artifact、自身 receipt 和派生快照不作为旧图目标。
21
+
22
+ 缺失、未知引用、digest 不匹配、悬空关系或环都必须 fail closed。排版变化不应改变语义 digest;语义、来源、状态、候选或上游 identity 变化必须触发重新审计。
@@ -0,0 +1,28 @@
1
+ # Lifecycle Evidence Reporting
2
+
3
+ This rule governs lifecycle reports persisted in the task workspace or synchronized to an Issue. It defines the minimum evidence semantics without changing artifact identity, receipts, synchronization, or restore protocols.
4
+
5
+ ## State Check
6
+
7
+ - Record the `task-snapshot` command and its task, artifact, and scope.
8
+ - For normal results, record the key conclusion and exceptions; do not repeat the full directory listing or `task.md` tail.
9
+ - For identity mismatches, failures, blocking conditions, or disputes, retain the decisive raw lines that support the judgment.
10
+
11
+ ## Successful Checks
12
+
13
+ Every successful check records the command or an allowed public command name, target and scope, exit status or structured result, actual result, and uncovered parts. Do not write only “passed” or “tests passed”, and do not paste complete successful stdout by default.
14
+
15
+ ## Failures, Blocking Conditions, and Disputes
16
+
17
+ Record a reproducible command or entry point, the exact file/line/object/version location, exit status, and the smallest decisive excerpt supporting the conclusion. If reproduction is unavailable, state the limitation explicitly rather than presenting incomplete evidence as success.
18
+
19
+ ## Preserved Identity and Security Boundaries
20
+
21
+ - Preserve artifact SHA-256, semantic digest, review head, receipt, request-id, snapshot tree, and platform marker exactly.
22
+ - The Issue continues to mirror the complete report; the report must not depend on logs accessible only on the local machine.
23
+ - Manual validation keeps its stricter basename-only and sanitized-result rules; this shared rule does not expand public fields.
24
+ - A `$ ` command line satisfies the structural gate but does not require complete successful output.
25
+
26
+ ## Evidence Pairing
27
+
28
+ Pair every verification claim with a `$ ` command and a proportionate result summary. Include a decisive raw excerpt only for failure, blocking, or dispute conclusions. When a command contains sensitive arguments, use its allowed public name or a redacted command.
@@ -0,0 +1,28 @@
1
+ # 生命周期报告证据记录规则
2
+
3
+ 本规则约束会持久化到任务目录或同步到 Issue 的生命周期报告。它统一报告的最低证据语义,不改变 artifact 身份、receipt、同步或恢复协议。
4
+
5
+ ## 状态核对
6
+
7
+ - 记录 `task-snapshot` 命令及任务、产物和检查范围。
8
+ - 正常结果记录关键结论和异常;不要重复粘贴完整目录清单或 `task.md` 尾部。
9
+ - 身份不一致、失败、阻塞或争议时,保留能支持判断的决定性原文行。
10
+
11
+ ## 成功检查
12
+
13
+ 成功路径至少记录:命令或允许公开的命令名称、目标与检查范围、退出状态或结构化结果、实际结果、未覆盖部分。不能只写“通过”或“测试通过”,也不默认粘贴完整成功 stdout。
14
+
15
+ ## 失败、阻塞和争议
16
+
17
+ 记录可复现的命令或调用入口、准确的文件/行号/对象/版本位置、退出状态,以及决定结论的最小决定性摘录。无法复现时明确写出限制,不把不完整证据写成成功。
18
+
19
+ ## 不变的身份与安全边界
20
+
21
+ - artifact SHA-256、semantic digest、review head、receipt、request-id、快照树和平台 marker 必须精确保留。
22
+ - Issue 继续镜像报告全文;报告不得依赖只有本机可访问的日志。
23
+ - 人工验证继续使用 basename-only、sanitized result 等更严格规则;共享规则不扩大可公开字段。
24
+ - `$ ` 命令行标记满足结构门禁,但不要求附带完整成功输出。
25
+
26
+ ## 证据配对
27
+
28
+ 报告中的每个验证断言都应配一个 `$ ` 命令和相称结果摘要;只有失败、阻塞或争议结论才附决定性原文摘录。命令含敏感参数时使用允许公开的命令名或脱敏命令。
@@ -2,17 +2,17 @@
2
2
 
3
3
  Read this rule before initializing labels or milestones, or before changing milestone metadata during release work.
4
4
 
5
- ## Entry points
5
+ ## Runtime intent entry points
6
6
 
7
- Use the shared scripts rather than composing provider commands in a skill:
7
+ Use the internal runtime intents rather than composing platform commands in a skill:
8
8
 
9
9
  ```text
10
- bash .agents/skills/init-labels/scripts/init-labels.sh [--cleanup-stale-in]
11
- bash .agents/skills/init-milestones/scripts/init-milestones.sh "$ARGUMENTS"
10
+ agent-infra-internal platform-metadata init-labels [--cleanup-stale-in]
11
+ agent-infra-internal platform-metadata init-milestones [--history]
12
12
  ```
13
13
 
14
- `init-labels.sh` reads the repository's `labels.in` configuration, creates or updates the declared `in:` labels, and preserves unrelated labels. `--cleanup-stale-in` is destructive and may only be passed after explicit confirmation; it removes stale `in:` labels that are no longer declared.
14
+ The `init-labels` runtime intent reads the repository's `labels.in` configuration, creates or updates the declared `in:` labels, and preserves unrelated labels. `--cleanup-stale-in` is destructive and may only be passed after explicit confirmation; it removes stale `in:` labels that are no longer declared.
15
15
 
16
- `init-milestones.sh` owns milestone inference and the provider-specific write path. Callers must pass the requested arguments through unchanged and must not rebuild milestone discovery, ordering, branch ancestry, or write logic.
16
+ The `init-milestones` runtime intent owns milestone planning and result reporting. Callers must pass the requested arguments through unchanged and must not rebuild milestone discovery, ordering, or write logic.
17
17
 
18
- Both scripts return a stable status. A successful no-op is still success; a degraded result must be reported without claiming that remote metadata was changed. Failed or cancelled operations must not be reported as completed.
18
+ Both intents return a stable status. A successful no-op is still success; a degraded result must be reported without claiming that remote metadata was changed. Failed or cancelled operations must not be reported as completed.
@@ -2,17 +2,17 @@
2
2
 
3
3
  在初始化 label、milestone,或在发布工作中修改 milestone 元数据前,先阅读本规则。
4
4
 
5
- ## 入口
5
+ ## Runtime intent 入口
6
6
 
7
- SKILL 应调用共享脚本,不得自行拼装 provider 命令:
7
+ SKILL 应调用内部 runtime intent,不得自行拼装平台命令:
8
8
 
9
9
  ```text
10
- bash .agents/skills/init-labels/scripts/init-labels.sh [--cleanup-stale-in]
11
- bash .agents/skills/init-milestones/scripts/init-milestones.sh "$ARGUMENTS"
10
+ agent-infra-internal platform-metadata init-labels [--cleanup-stale-in]
11
+ agent-infra-internal platform-metadata init-milestones [--history]
12
12
  ```
13
13
 
14
- `init-labels.sh` 读取仓库的 `labels.in` 配置,创建或更新声明的 `in:` label,并保留无关 label。`--cleanup-stale-in` 具有破坏性,只有在得到明确确认后才能传入;它会删除不再声明的过期 `in:` label。
14
+ `init-labels` runtime intent 读取仓库的 `labels.in` 配置,创建或更新声明的 `in:` label,并保留无关 label。`--cleanup-stale-in` 具有破坏性,只有在得到明确确认后才能传入;它会删除不再声明的过期 `in:` label。
15
15
 
16
- `init-milestones.sh` 负责 milestone 推断和 provider 写入路径。调用方应原样传递请求参数,不得重新实现 milestone 发现、排序、分支祖先判断或写入逻辑。
16
+ `init-milestones` runtime intent 负责 milestone 规划和结果报告。调用方应原样传递请求参数,不得重新实现 milestone 发现、排序或写入逻辑。
17
17
 
18
- 两个脚本都返回稳定状态。成功的 no-op 仍算成功;degraded 结果必须如实报告,不能声称远端元数据已变更。失败或取消的操作不得报告为已完成。
18
+ 两个 intent 都返回稳定状态。成功的 no-op 仍算成功;degraded 结果必须如实报告,不能声称远端元数据已变更。失败或取消的操作不得报告为已完成。
@@ -5,7 +5,7 @@ This rule applies when `analyze-task`, `plan-task`, or `code-task` handles **the
5
5
  ## Pre-completion gate for analysis, plan, and code artifacts
6
6
 
7
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.
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 one provably safe structural operation (the current shared engine operations are `replace-line` and `insert-section`), then rerun the same call completely; count each byte-changing edit, up to 8.
9
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
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.
11
11
 
@@ -40,6 +40,10 @@ If any condition fails, stop immediately without invoking a model edit. The mode
40
40
 
41
41
  The repair count exists only in the in-memory context of the current skill invocation. Do not write it to `task.md`, the ledger, or a public receipt. Do not create different normal budgets by error code, skill, or problem type.
42
42
 
43
+ ## Shared Structural Engine
44
+
45
+ The report skeleton is created by `agent-infra-internal task-artifact {task-id} init --family {family} --artifact {artifact}`. The skeleton writes only identity, headings, and `artifact-section:{family}:{section-id}` markers; it does not represent semantic completion. The current skill must fill each slot with real content. When the finalizer returns one provably safe structural operation, use that result's SHA and semantic digest with `task-artifact {task-id} repair --family {family} --artifact {artifact} --expected-sha256 {artifact-sha256} --expected-semantic-digest {semantic-digest}`. Repair executes only the one operation from the shared engine, does not write `task.md`, the ledger, receipts, Git, or platform resources, and must be followed by a complete rerun of the original finalizer.
46
+
43
47
  ## Completion Events and User Output
44
48
 
45
49
  - After the final complete finalizer result succeeds, publish the review completed event using that same result's provenance, ledger state, verdict, and counts. Generate cross-stage next-step commands only when `stageStatus.canAdvance=true` and the verdict is Approved; when `canAdvance=false`, still record the result and route to same-stage revision/review.
@@ -5,7 +5,7 @@
5
5
  ## 分析、方案和代码产物完成前门禁
6
6
 
7
7
  - `analyze-task`、`plan-task` 和 `code-task` 必须在发布 completed 事件前调用 `task-artifact ... finalize-local`;只有同一次返回的 `artifactSha256` 和 `semanticDigest` 才能传给 completed 事件。
8
- - `finalize-local` 不修改产物或任务状态,但会在仓库工作区写入一次性的本地 provenance intent。返回 `failed` 时,只有 `repairable=true` 且诊断明确为单行替换,模型才可在同一产物中执行一次最小编辑,然后完整重跑同一调用;每次实际字节修改计一次,最多 8 次。
8
+ - `finalize-local` 不修改产物或任务状态,但会在仓库工作区写入一次性的本地 provenance intent。返回 `failed` 时,只有 `repairable=true` 且诊断明确为一个可证明安全的结构操作(当前共享引擎操作为 `replace-line` 或 `insert-section`),模型才可在同一产物中执行一次最小编辑,然后完整重跑同一调用;每次实际字节修改计一次,最多 8 次。
9
9
  - 首次可修复失败的 semantic digest 会保存在该 intent 中;后续 `passed` 必须匹配该基线,completed event 还必须在任务锁内验证并在写 task.md 前原子转换为 `consumed` 状态。消费失败时不得写任务;转换后的 intent 是可重试的 durable 记录,成功写入后不再执行可能失败的后置删除。不得用重新计算的新摘要替换失败基线,也不得绕过 finalizer 直接发布 completed event。
10
10
  - 返回 `failed`、无进展、诊断或指纹重复时不得发布 completed 事件;返回 `passed` 后也不得重新扫描或手工补写摘要。
11
11
 
@@ -40,6 +40,10 @@
40
40
 
41
41
  修复次数只存在于当前 skill invocation 的内存上下文,不写入 task.md、ledger 或公共 receipt。不得按错误码、技能或问题类型设置不同的正常预算。
42
42
 
43
+ ## 共享结构引擎
44
+
45
+ 报告骨架由 `agent-infra-internal task-artifact {task-id} init --family {family} --artifact {artifact}` 创建。骨架只写身份、标题和 `artifact-section:{family}:{section-id}` marker,不代表语义完成;槽位必须由当前 skill 填入真实内容。finalizer 返回单一可证明结构操作时,使用同一返回值的 SHA 和 semantic digest 调用 `task-artifact {task-id} repair --family {family} --artifact {artifact} --expected-sha256 {artifact-sha256} --expected-semantic-digest {semantic-digest}`。repair 只执行共享引擎给出的一个结构操作,不写 task.md、ledger、receipt、Git 或平台资源,之后必须完整重跑原 finalizer。
46
+
43
47
  ## 完成事件与用户输出
44
48
 
45
49
  - 最终一次完整 finalizer 成功后,必须使用同一次返回的 provenance、账本状态、verdict 和计数发布 review completed 事件;`stageStatus.canAdvance=true` 且结论为 Approved 时才可生成跨阶段 next-step 命令,`canAdvance=false` 时仍须登记结果并路由到同阶段修订/复审。
@@ -2,19 +2,19 @@
2
2
 
3
3
  Read this rule before importing or dismissing dependency or code-scanning alerts.
4
4
 
5
- ## Shared entry point
5
+ ## Shared runtime intent
6
6
 
7
- All callers use the shared security script and parse its single JSON result:
7
+ All callers use the runtime security intent and parse its single JSON result:
8
8
 
9
9
  ```text
10
- bash .agents/scripts/security-alerts.sh read-dependabot --number {number}
11
- bash .agents/scripts/security-alerts.sh dismiss-dependabot --number {number} --reason {api-reason} --comment-file {file}
12
- bash .agents/scripts/security-alerts.sh read-codescan --number {number}
13
- bash .agents/scripts/security-alerts.sh dismiss-codescan --number {number} --reason {api-reason} --comment-file {file}
10
+ agent-infra-internal platform-security read --kind dependabot --number {number}
11
+ agent-infra-internal platform-security dismiss --kind dependabot --number {number} --reason {reason} --comment-file {file}
12
+ agent-infra-internal platform-security read --kind code-scanning --number {number}
13
+ agent-infra-internal platform-security dismiss --kind code-scanning --number {number} --reason {reason} --comment-file {file}
14
14
  ```
15
15
 
16
16
  The result contains `status`, `operation`, and either `data` or `error.code` plus `error.message`. The status is one of `applied`, `no-op`, `degraded`, or `failed`. Diagnostics belong on stderr; stdout must contain exactly one JSON object.
17
17
 
18
- Read the current alert before any dismiss operation. A dismiss reason must use the provider API reason value, and the generated task or Issue comment must be passed through `--comment-file`.
18
+ Read the current alert before any dismiss operation. The runtime intent validates the structured reason, and the generated task or Issue comment must be passed through `--comment-file`.
19
19
 
20
- Do not invoke a provider CLI directly from a SKILL. A degraded or failed result must be reported accurately, and cancelled or failed operations must not be recorded as successful.
20
+ Do not execute platform commands or implement the platform state machine directly from a SKILL. A degraded or failed result must be reported accurately, and cancelled or failed operations must not be recorded as successful.
@@ -2,19 +2,19 @@
2
2
 
3
3
  在导入或关闭依赖告警、代码扫描告警前,先阅读本规则。
4
4
 
5
- ## 共享入口
5
+ ## 共享 runtime intent 入口
6
6
 
7
- 所有调用方都使用共享安全脚本,并解析其单个 JSON 结果:
7
+ 所有调用方都使用 runtime security intent,并解析其单个 JSON 结果:
8
8
 
9
9
  ```text
10
- bash .agents/scripts/security-alerts.sh read-dependabot --number {number}
11
- bash .agents/scripts/security-alerts.sh dismiss-dependabot --number {number} --reason {api-reason} --comment-file {file}
12
- bash .agents/scripts/security-alerts.sh read-codescan --number {number}
13
- bash .agents/scripts/security-alerts.sh dismiss-codescan --number {number} --reason {api-reason} --comment-file {file}
10
+ agent-infra-internal platform-security read --kind dependabot --number {number}
11
+ agent-infra-internal platform-security dismiss --kind dependabot --number {number} --reason {reason} --comment-file {file}
12
+ agent-infra-internal platform-security read --kind code-scanning --number {number}
13
+ agent-infra-internal platform-security dismiss --kind code-scanning --number {number} --reason {reason} --comment-file {file}
14
14
  ```
15
15
 
16
16
  结果包含 `status`、`operation`,以及 `data` 或 `error.code` 与 `error.message`。`status` 只能是 `applied`、`no-op`、`degraded` 或 `failed`。诊断信息写入 stderr;stdout 必须只包含一个 JSON 对象。
17
17
 
18
- 任何关闭操作前都必须先读取当前告警。关闭原因必须使用 provider API 的 reason 值,生成的任务或 Issue 评论必须通过 `--comment-file` 传入。
18
+ 任何关闭操作前都必须先读取当前告警。关闭原因由 runtime intent 作为结构化输入校验,生成的任务或 Issue 评论必须通过 `--comment-file` 传入。
19
19
 
20
- SKILL 不得直接调用 provider CLI。degraded 或 failed 结果必须如实报告,取消或失败的操作不得记录为成功。
20
+ SKILL 不得直接执行平台命令或实现平台状态机。degraded 或 failed 结果必须如实报告,取消或失败的操作不得记录为成功。
@@ -13,6 +13,11 @@ If the entry operands contain `--orchestrated`, bind `{execution-flag}` to `--or
13
13
 
14
14
  ## Boundary / Critical Rules
15
15
 
16
+ ### Persisted Report Evidence
17
+
18
+ Before generating the analysis report, read `.agents/rules/evidence-reporting.md`. Record the command, target scope, status or structured result, actual result, and uncovered parts for state checks and successful checks; include decisive raw excerpts only for failures, blocking conditions, or disputes.
19
+
20
+ - When evaluating candidate qualification or `HD-N`, read `.agents/rules/decision-qualification.md`, audit normalized task constraints/candidates, and record the five qualification-audit tables in the analysis artifact; unknown or unconfirmed constraints must not automatically exclude a candidate
16
21
  - This skill only outputs a requirements analysis document (`analysis.md` or `analysis-r{N}.md`) and does not modify any business code
17
22
  - Base the analysis strictly on the existing task input, requirements, context, and source information in `task.md`
18
23
  - 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
@@ -25,7 +30,7 @@ Version stamp rule: when creating or updating `task.md` frontmatter, read `.agen
25
30
 
26
31
  After loading workflow / skill / rules instructions, and before any task-state judgment or user-visible conclusion, run the state check first. Reading instruction files does not count as an external-state action or conclusion.
27
32
 
28
- Run these commands and paste the raw output into this round's `## State Check` section:
33
+ Run these commands and record the task/artifact scope, key result, and uncovered parts in this round's `## State Check` section; do not paste complete directory listings or task tails on normal success. Retain decisive raw lines only for failures, blocking conditions, identity mismatches, or disputes:
29
34
 
30
35
  ```bash
31
36
  agent-infra-internal task-snapshot {task-id} --format text
@@ -129,6 +134,14 @@ Follow the `analysis` step in `.agents/workflows/feature-development.yaml`:
129
134
 
130
135
  ### 6. Output Analysis Document
131
136
 
137
+ Before writing this round's `{analysis-artifact}`, create the controlled report skeleton:
138
+
139
+ ```bash
140
+ agent-infra-internal task-artifact {task-id} init --family analysis --artifact {analysis-artifact} --locale en
141
+ ```
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, call `task-artifact {task-id} repair --family analysis --artifact {analysis-artifact} --expected-sha256 {artifact-sha256} --expected-semantic-digest {semantic-digest}`, then rerun the same finalizer.
144
+
132
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.
133
146
 
134
147
  Create `.agents/workspace/active/{task-id}/{analysis-artifact}`.
@@ -143,7 +156,7 @@ Create `.agents/workspace/active/{task-id}/{analysis-artifact}`.
143
156
 
144
157
  ## State Check
145
158
 
146
- > Paste the raw Step 0 state-check command output; each command starts with `$ `.
159
+ > Record the Step 0 state-check command, task/artifact scope, key result, and uncovered parts; each command starts with `$ `. Do not paste complete directory listings or task tails on normal success; retain decisive raw lines only for failures, blocking conditions, identity mismatches, or disputes.
147
160
 
148
161
  ## Requirement Source
149
162
 
@@ -13,6 +13,11 @@ description: >
13
13
 
14
14
  ## 行为边界 / 关键规则
15
15
 
16
+ ### 持久化报告证据
17
+
18
+ 生成分析报告时,先读取 `.agents/rules/evidence-reporting.md`。状态核对和成功检查记录命令、目标范围、状态/结构化结果、实际结果和未覆盖部分;失败、阻塞或争议才附决定性原文摘录。
19
+
20
+ - 涉及候选资格或 `HD-N` 判断时,先读取 `.agents/rules/decision-qualification.md`,基于 task.md 规范化约束/候选完成资格审计,并在分析产物记录五张资格审计表;不得把来源不明或未确认约束自动升级为排除条件
16
21
  - 本技能仅产出需求分析文档(`analysis.md` 或 `analysis-r{N}.md`)—— 不修改任何业务代码
17
22
  - 严格基于 `task.md` 中已有的任务输入、需求、上下文和来源信息展开分析
18
23
  - 生成会同步到 Issue 的任务或生命周期 Markdown 前,先读取 `.agents/rules/sync-content-generation.md` 并遵循其中的生成端约束;同步端不解析或改写正文
@@ -25,7 +30,7 @@ description: >
25
30
 
26
31
  在加载 workflow / skill / rules 指令之后、做任何任务状态判断或用户可见结论之前,必须先执行状态核对。指令类文件读取不算对外动作或结论。
27
32
 
28
- 运行以下命令,并把原文粘贴到本轮产物的 `## 状态核对` 段:
33
+ 运行以下命令,并在本轮产物的 `## 状态核对` 段记录任务/产物范围、关键结果和未覆盖部分;正常成功不粘贴完整目录清单或 `task.md` 尾部。失败、阻塞、身份不一致或争议时,附决定性原文行:
29
34
 
30
35
  ```bash
31
36
  agent-infra-internal task-snapshot {task-id} --format text
@@ -132,6 +137,14 @@ agent-infra-internal task-event {task-id} analyze.started --agent {standard-agen
132
137
 
133
138
  ### 6. 输出分析文档
134
139
 
140
+ 在首次写入本轮 `{analysis-artifact}` 前,先创建受控报告骨架:
141
+
142
+ ```bash
143
+ agent-infra-internal task-artifact {task-id} init --family analysis --artifact {analysis-artifact}
144
+ ```
145
+
146
+ 骨架只包含身份元数据、稳定 section marker 和必需标题;必须填入真实分析内容后才能通过完成门禁。finalizer 返回可证明的单个结构错误时,使用其 SHA 和 semantic digest 调用 `task-artifact {task-id} repair --family analysis --artifact {analysis-artifact} --expected-sha256 {artifact-sha256} --expected-semantic-digest {semantic-digest}`,然后完整重跑 finalizer。
147
+
135
148
  > 步骤 6–9 属**场景 A(正常产出)**路径。**场景 B(提问早退)**已在步骤 4 内完成状态更新、task 评论同步与校验并 STOP,不进入这些步骤。
136
149
 
137
150
  创建 `.agents/workspace/active/{task-id}/{analysis-artifact}`。
@@ -146,7 +159,7 @@ agent-infra-internal task-event {task-id} analyze.started --agent {standard-agen
146
159
 
147
160
  ## 状态核对
148
161
 
149
- > 粘贴第 0 步状态核对命令原文;每条命令以 `$ ` 开头。
162
+ > 记录第 0 步状态核对命令、任务/产物范围、关键结果和未覆盖部分;每条命令以 `$ ` 开头。正常成功不粘贴完整目录清单或 `task.md` 尾部,失败、阻塞、身份不一致或争议时附决定性原文行。
150
163
 
151
164
  ## 需求来源
152
165
 
@@ -173,6 +186,10 @@ agent-infra-internal task-event {task-id} analyze.started --agent {standard-agen
173
186
  ## 依赖关系
174
187
  - {需要的依赖和与其他模块的协调}
175
188
 
189
+ ## 资格审计
190
+
191
+ > 按 `.agents/rules/decision-qualification.md` 填写约束依赖、候选资格、分类结果、上游关系、依赖快照五张表;没有 artifact 上游时保留空表头,不虚构关系。
192
+
176
193
  ## 假设
177
194
 
178
195
  > 如本次分析依赖某些假设,列在此处;没有则可省略本段。
@@ -18,18 +18,7 @@
18
18
  },
19
19
  "artifact": {
20
20
  "file_pattern": "analysis.md|analysis-r{N}.md",
21
- "required_sections": [
22
- "Requirement Source",
23
- "Requirement Understanding",
24
- "Related Files",
25
- "Impact Assessment",
26
- "Technical Risks",
27
- "Effort and Complexity Assessment",
28
- "State Check"
29
- ],
30
- "required_patterns": [
31
- "^\\$ "
32
- ]
21
+ "schema": "analysis"
33
22
  },
34
23
  "activity-log": {
35
24
  "expected_action_pattern": "(Analyze Task|Requirement Analysis) \\(Round \\d+\\)"
@@ -18,18 +18,7 @@
18
18
  },
19
19
  "artifact": {
20
20
  "file_pattern": "analysis.md|analysis-r{N}.md",
21
- "required_sections": [
22
- "需求来源",
23
- "需求理解",
24
- "相关文件",
25
- "影响评估",
26
- "技术风险",
27
- "工作量和复杂度评估",
28
- "状态核对"
29
- ],
30
- "required_patterns": [
31
- "^\\$ "
32
- ]
21
+ "schema": "analysis"
33
22
  },
34
23
  "activity-log": {
35
24
  "expected_action_pattern": "(Analyze Task|Requirement Analysis) \\(Round \\d+\\)"
@@ -23,7 +23,7 @@ The skill still owns the security-alert API. When a related task exists, Step 7
23
23
 
24
24
  ### 1. Retrieve Alert Information
25
25
 
26
- Read `.agents/rules/security-alerts.md` before this step, then run `bash .agents/scripts/security-alerts.sh read-codescan --number {alert-number}` and parse its JSON result to fetch the alert details.
26
+ Read `.agents/rules/security-alerts.md` before this step, then run `agent-infra-internal platform-security read --kind code-scanning --number {alert-number}` and parse its JSON result to fetch the alert details.
27
27
 
28
28
  Verify that the alert is in the `open` state. If it is already dismissed or fixed, inform the user and exit.
29
29
 
@@ -71,7 +71,7 @@ Confirm? (y/N)
71
71
 
72
72
  ### 6. Execute the Dismissal
73
73
 
74
- Write the user's explanation to `{comment-file}`, then run `bash .agents/scripts/security-alerts.sh dismiss-codescan --number {alert-number} --reason {api-reason} --comment-file {comment-file}`. Parse the JSON result and continue only when the dismissal is `applied` or `no-op`.
74
+ Write the user's explanation to `{comment-file}`, then run `agent-infra-internal platform-security dismiss --kind code-scanning --number {alert-number} --reason {api-reason} --comment-file {comment-file}`. Parse the JSON result and continue only when the dismissal is `applied` or `no-op`.
75
75
 
76
76
  **API reason mapping** (per the Code Scanning API):
77
77
  - False Positive -> `false positive`
@@ -23,7 +23,7 @@ description: >
23
23
 
24
24
  ### 1. 获取告警信息
25
25
 
26
- 执行前先读取 `.agents/rules/security-alerts.md`,然后运行 `bash .agents/scripts/security-alerts.sh read-codescan --number {alert-number}`,解析其 JSON 结果获取告警详情。
26
+ 执行前先读取 `.agents/rules/security-alerts.md`,然后运行 `agent-infra-internal platform-security read --kind code-scanning --number {alert-number}`,解析其 JSON 结果获取告警详情。
27
27
 
28
28
  验证告警处于 `open` 状态。如果已被关闭/修复,告知用户并退出。
29
29
 
@@ -71,7 +71,7 @@ Code Scanning 告警 #{alert-number}
71
71
 
72
72
  ### 6. 执行关闭
73
73
 
74
- 将用户说明写入 `{comment-file}`,然后运行 `bash .agents/scripts/security-alerts.sh dismiss-codescan --number {alert-number} --reason {api-reason} --comment-file {comment-file}`。解析 JSON 结果,仅当关闭状态为 `applied` 或 `no-op` 时继续。
74
+ 将用户说明写入 `{comment-file}`,然后运行 `agent-infra-internal platform-security dismiss --kind code-scanning --number {alert-number} --reason {api-reason} --comment-file {comment-file}`。解析 JSON 结果,仅当关闭状态为 `applied` 或 `no-op` 时继续。
75
75
 
76
76
  **API reason 映射**(按 Code Scanning API):
77
77
  - 误报 -> `false positive`