@fitlab-ai/agent-infra 0.11.15 → 0.12.0

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 (253) hide show
  1. package/bin/cli.ts +1 -1
  2. package/dist/bin/cli.js +1 -1
  3. package/dist/bin/internal-cli.js +6 -1
  4. package/dist/lib/agent-clients/adapters/codex-lifecycle/recovery.js +6 -6
  5. package/dist/lib/agent-clients/adapters/codex-lifecycle/store.js +8 -18
  6. package/dist/lib/agent-clients/adapters/codex-orchestration.js +1 -1
  7. package/dist/lib/decide.js +2 -7
  8. package/dist/lib/internal/cli-route-inventory.js +3 -0
  9. package/dist/lib/internal/manual-validation.js +8 -16
  10. package/dist/lib/internal/platform-comment.js +3 -2
  11. package/dist/lib/internal/task-activity.js +1 -12
  12. package/dist/lib/internal/task-event.js +1 -12
  13. package/dist/lib/internal/task-ledger.js +1 -12
  14. package/dist/lib/internal/task-operation-registry.js +2 -1
  15. package/dist/lib/internal/task-qualification.js +6 -15
  16. package/dist/lib/internal/task-review.js +3 -16
  17. package/dist/lib/internal/task-short-id.js +2 -1
  18. package/dist/lib/internal/task-verify.js +1 -11
  19. package/dist/lib/internal/task-warning.js +1 -12
  20. package/dist/lib/internal/task-workspace.js +43 -0
  21. package/dist/lib/merge.js +4 -3
  22. package/dist/lib/platform/pr-summary.js +6 -15
  23. package/dist/lib/platform/pull-requests.js +3 -15
  24. package/dist/lib/pr-review/evidence-grading.js +3 -2
  25. package/dist/lib/process-data/index.js +5 -4
  26. package/dist/lib/process-data/sources.js +6 -0
  27. package/dist/lib/run/index.js +3 -2
  28. package/dist/lib/sandbox/commands/create.js +5 -1
  29. package/dist/lib/sandbox/commands/enter.js +1 -1
  30. package/dist/lib/sandbox/commands/list-running.js +2 -1
  31. package/dist/lib/sandbox/control/client.js +8 -13
  32. package/dist/lib/sandbox/control/completed-reentry.js +2 -1
  33. package/dist/lib/sandbox/control/task-view.js +4 -2
  34. package/dist/lib/sandbox/mounts.js +4 -4
  35. package/dist/lib/sandbox/recovery.js +26 -16
  36. package/dist/lib/sandbox/removal.js +3 -10
  37. package/dist/lib/sandbox/task-resolver.js +9 -6
  38. package/dist/lib/sandbox/workspace-identity.js +6 -5
  39. package/dist/lib/sandbox/workspace-view.js +29 -22
  40. package/dist/lib/task/activity-intent.js +2 -12
  41. package/dist/lib/task/artifact-lifecycle.js +17 -11
  42. package/dist/lib/task/artifact-operations.js +41 -49
  43. package/dist/lib/task/capabilities.js +2 -2
  44. package/dist/lib/task/commands/ls.js +4 -3
  45. package/dist/lib/task/commands/status.js +1 -1
  46. package/dist/lib/task/commit-operation.js +6 -6
  47. package/dist/lib/task/control-authority.js +32 -32
  48. package/dist/lib/task/create-service.js +2 -4
  49. package/dist/lib/task/create.js +12 -65
  50. package/dist/lib/task/delegation-receipts.js +1 -1
  51. package/dist/lib/task/delivery.js +2 -8
  52. package/dist/lib/task/events.js +5 -31
  53. package/dist/lib/task/finalization.js +17 -22
  54. package/dist/lib/task/lifecycle.js +9 -48
  55. package/dist/lib/task/local-artifact-finalization.js +1 -2
  56. package/dist/lib/task/orchestration.js +24 -57
  57. package/dist/lib/task/platform-operation-recovery.js +1 -2
  58. package/dist/lib/task/resolve-ref.js +17 -12
  59. package/dist/lib/task/review-finalization.js +2 -35
  60. package/dist/lib/task/review-identity.js +3 -1
  61. package/dist/lib/task/short-id.js +10 -8
  62. package/dist/lib/task/verification-engine.js +19 -58
  63. package/dist/lib/task/workspace-root.js +59 -0
  64. package/dist/lib/task/workspace-snapshot.js +4 -3
  65. package/dist/lifecycle-build-manifest.json +3 -3
  66. package/lib/agent-clients/adapters/codex-lifecycle/recovery.ts +6 -6
  67. package/lib/agent-clients/adapters/codex-lifecycle/store.ts +8 -34
  68. package/lib/agent-clients/adapters/codex-orchestration.ts +1 -1
  69. package/lib/decide.ts +2 -7
  70. package/lib/internal/cli-route-inventory.ts +2 -0
  71. package/lib/internal/manual-validation.ts +8 -19
  72. package/lib/internal/platform-comment.ts +3 -2
  73. package/lib/internal/task-activity.ts +1 -10
  74. package/lib/internal/task-event.ts +1 -10
  75. package/lib/internal/task-ledger.ts +1 -10
  76. package/lib/internal/task-operation-registry.ts +2 -1
  77. package/lib/internal/task-qualification.ts +5 -11
  78. package/lib/internal/task-review.ts +3 -14
  79. package/lib/internal/task-short-id.ts +2 -1
  80. package/lib/internal/task-verify.ts +1 -9
  81. package/lib/internal/task-warning.ts +1 -10
  82. package/lib/internal/task-workspace.ts +39 -0
  83. package/lib/merge.ts +4 -3
  84. package/lib/platform/pr-summary.ts +7 -16
  85. package/lib/platform/pull-requests.ts +3 -24
  86. package/lib/pr-review/evidence-grading.ts +3 -2
  87. package/lib/process-data/index.ts +4 -3
  88. package/lib/process-data/sources.ts +6 -0
  89. package/lib/run/index.ts +3 -2
  90. package/lib/sandbox/commands/create.ts +5 -1
  91. package/lib/sandbox/commands/enter.ts +1 -1
  92. package/lib/sandbox/commands/list-running.ts +2 -1
  93. package/lib/sandbox/control/client.ts +7 -12
  94. package/lib/sandbox/control/completed-reentry.ts +2 -1
  95. package/lib/sandbox/control/task-view.ts +4 -2
  96. package/lib/sandbox/mounts.ts +4 -4
  97. package/lib/sandbox/recovery.ts +26 -18
  98. package/lib/sandbox/removal.ts +3 -26
  99. package/lib/sandbox/task-resolver.ts +9 -6
  100. package/lib/sandbox/workspace-identity.ts +6 -5
  101. package/lib/sandbox/workspace-view.ts +28 -20
  102. package/lib/task/activity-intent.ts +3 -17
  103. package/lib/task/artifact-lifecycle.ts +39 -11
  104. package/lib/task/artifact-operations.ts +28 -35
  105. package/lib/task/capabilities.ts +2 -2
  106. package/lib/task/commands/ls.ts +4 -3
  107. package/lib/task/commands/status.ts +1 -1
  108. package/lib/task/commit-operation.ts +5 -6
  109. package/lib/task/control-authority.ts +29 -35
  110. package/lib/task/create-service.ts +2 -4
  111. package/lib/task/create.ts +10 -51
  112. package/lib/task/delegation-receipts.ts +1 -1
  113. package/lib/task/delivery.ts +2 -10
  114. package/lib/task/events.ts +5 -32
  115. package/lib/task/finalization.ts +16 -24
  116. package/lib/task/lifecycle.ts +9 -50
  117. package/lib/task/local-artifact-finalization.ts +1 -4
  118. package/lib/task/orchestration.ts +31 -80
  119. package/lib/task/platform-operation-recovery.ts +1 -2
  120. package/lib/task/resolve-ref.ts +18 -12
  121. package/lib/task/review-finalization.ts +2 -52
  122. package/lib/task/review-identity.ts +3 -1
  123. package/lib/task/short-id.ts +10 -8
  124. package/lib/task/verification-engine.ts +20 -62
  125. package/lib/task/workspace-root.ts +78 -0
  126. package/lib/task/workspace-snapshot.ts +4 -3
  127. package/package.json +1 -1
  128. package/templates/.agents/QUICKSTART.en.md +19 -8
  129. package/templates/.agents/QUICKSTART.zh-CN.md +19 -8
  130. package/templates/.agents/README.en.md +10 -15
  131. package/templates/.agents/README.zh-CN.md +9 -13
  132. package/templates/.agents/rules/issue-sync.en.md +1 -1
  133. package/templates/.agents/rules/issue-sync.zh-CN.md +1 -1
  134. package/templates/.agents/rules/lifecycle-orchestration.en.md +1 -1
  135. package/templates/.agents/rules/lifecycle-orchestration.zh-CN.md +1 -1
  136. package/templates/.agents/rules/next-step-output.en.md +2 -2
  137. package/templates/.agents/rules/next-step-output.zh-CN.md +2 -2
  138. package/templates/.agents/rules/pr-sync.en.md +1 -1
  139. package/templates/.agents/rules/pr-sync.zh-CN.md +1 -1
  140. package/templates/.agents/rules/release-commands.en.md +3 -0
  141. package/templates/.agents/rules/release-commands.zh-CN.md +3 -0
  142. package/templates/.agents/rules/task-management.en.md +0 -2
  143. package/templates/.agents/rules/task-management.zh-CN.md +0 -2
  144. package/templates/.agents/rules/task-short-id.en.md +2 -2
  145. package/templates/.agents/rules/task-short-id.zh-CN.md +2 -2
  146. package/templates/.agents/scripts/task-short-id.js +2 -8
  147. package/templates/.agents/skills/analyze-task/SKILL.en.md +6 -6
  148. package/templates/.agents/skills/analyze-task/SKILL.zh-CN.md +6 -6
  149. package/templates/.agents/skills/analyze-task/config/verify.en.json +0 -1
  150. package/templates/.agents/skills/analyze-task/config/verify.zh-CN.json +0 -1
  151. package/templates/.agents/skills/archive-tasks/SKILL.en.md +5 -5
  152. package/templates/.agents/skills/archive-tasks/SKILL.zh-CN.md +5 -5
  153. package/templates/.agents/skills/archive-tasks/scripts/archive-tasks.sh +10 -2
  154. package/templates/.agents/skills/block-task/SKILL.en.md +4 -4
  155. package/templates/.agents/skills/block-task/SKILL.zh-CN.md +5 -5
  156. package/templates/.agents/skills/block-task/config/verify.json +0 -1
  157. package/templates/.agents/skills/cancel-task/SKILL.en.md +6 -6
  158. package/templates/.agents/skills/cancel-task/SKILL.zh-CN.md +6 -6
  159. package/templates/.agents/skills/cancel-task/config/verify.json +0 -1
  160. package/templates/.agents/skills/code-task/SKILL.en.md +1 -1
  161. package/templates/.agents/skills/code-task/SKILL.zh-CN.md +3 -3
  162. package/templates/.agents/skills/code-task/config/verify.en.json +0 -1
  163. package/templates/.agents/skills/code-task/config/verify.zh-CN.json +0 -1
  164. package/templates/.agents/skills/code-task/reference/output-template.en.md +1 -1
  165. package/templates/.agents/skills/code-task/reference/output-template.zh-CN.md +1 -1
  166. package/templates/.agents/skills/commit/SKILL.en.md +1 -1
  167. package/templates/.agents/skills/commit/SKILL.zh-CN.md +1 -1
  168. package/templates/.agents/skills/commit/config/verify.json +0 -1
  169. package/templates/.agents/skills/commit/reference/commit-orchestration.en.md +2 -2
  170. package/templates/.agents/skills/commit/reference/commit-orchestration.zh-CN.md +2 -2
  171. package/templates/.agents/skills/commit/reference/pr-summary-sync.en.md +1 -1
  172. package/templates/.agents/skills/commit/reference/pr-summary-sync.zh-CN.md +1 -1
  173. package/templates/.agents/skills/complete-manual-validation/SKILL.en.md +2 -2
  174. package/templates/.agents/skills/complete-manual-validation/SKILL.zh-CN.md +2 -2
  175. package/templates/.agents/skills/complete-manual-validation/config/verify.en.json +0 -1
  176. package/templates/.agents/skills/complete-manual-validation/config/verify.zh-CN.json +0 -1
  177. package/templates/.agents/skills/complete-manual-validation/reference/summary-update.en.md +1 -1
  178. package/templates/.agents/skills/complete-manual-validation/reference/summary-update.zh-CN.md +1 -1
  179. package/templates/.agents/skills/complete-task/SKILL.en.md +7 -7
  180. package/templates/.agents/skills/complete-task/SKILL.zh-CN.md +8 -8
  181. package/templates/.agents/skills/complete-task/config/verify.en.json +0 -1
  182. package/templates/.agents/skills/complete-task/config/verify.zh-CN.json +0 -1
  183. package/templates/.agents/skills/create-pr/SKILL.en.md +3 -3
  184. package/templates/.agents/skills/create-pr/SKILL.zh-CN.md +3 -3
  185. package/templates/.agents/skills/create-pr/config/verify.json +0 -1
  186. package/templates/.agents/skills/create-pr/reference/change-report.en.md +1 -1
  187. package/templates/.agents/skills/create-pr/reference/change-report.zh-CN.md +1 -1
  188. package/templates/.agents/skills/create-pr/reference/comment-publish.en.md +1 -1
  189. package/templates/.agents/skills/create-pr/reference/comment-publish.zh-CN.md +1 -1
  190. package/templates/.agents/skills/create-release-note/SKILL.en.md +2 -2
  191. package/templates/.agents/skills/create-release-note/SKILL.zh-CN.md +2 -2
  192. package/templates/.agents/skills/create-task/SKILL.en.md +4 -4
  193. package/templates/.agents/skills/create-task/SKILL.zh-CN.md +4 -4
  194. package/templates/.agents/skills/create-task/config/verify.json +0 -1
  195. package/templates/.agents/skills/import-codescan/SKILL.en.md +1 -1
  196. package/templates/.agents/skills/import-codescan/SKILL.zh-CN.md +1 -1
  197. package/templates/.agents/skills/import-codescan/config/verify.json +0 -1
  198. package/templates/.agents/skills/import-dependabot/SKILL.en.md +3 -3
  199. package/templates/.agents/skills/import-dependabot/SKILL.zh-CN.md +3 -3
  200. package/templates/.agents/skills/import-dependabot/config/verify.json +0 -1
  201. package/templates/.agents/skills/import-issue/SKILL.en.md +5 -5
  202. package/templates/.agents/skills/import-issue/SKILL.zh-CN.md +5 -5
  203. package/templates/.agents/skills/import-issue/config/verify.json +0 -1
  204. package/templates/.agents/skills/plan-task/SKILL.en.md +5 -5
  205. package/templates/.agents/skills/plan-task/SKILL.zh-CN.md +5 -5
  206. package/templates/.agents/skills/plan-task/config/verify.en.json +0 -1
  207. package/templates/.agents/skills/plan-task/config/verify.zh-CN.json +0 -1
  208. package/templates/.agents/skills/restore-task/SKILL.en.md +2 -2
  209. package/templates/.agents/skills/restore-task/SKILL.zh-CN.md +3 -3
  210. package/templates/.agents/skills/restore-task/config/verify.json +0 -1
  211. package/templates/.agents/skills/review-analysis/SKILL.en.md +1 -1
  212. package/templates/.agents/skills/review-analysis/SKILL.zh-CN.md +2 -2
  213. package/templates/.agents/skills/review-analysis/config/verify.en.json +0 -1
  214. package/templates/.agents/skills/review-analysis/config/verify.zh-CN.json +0 -1
  215. package/templates/.agents/skills/review-analysis/reference/output-templates.en.md +5 -5
  216. package/templates/.agents/skills/review-analysis/reference/output-templates.zh-CN.md +5 -5
  217. package/templates/.agents/skills/review-code/SKILL.en.md +2 -2
  218. package/templates/.agents/skills/review-code/SKILL.zh-CN.md +2 -2
  219. package/templates/.agents/skills/review-code/reference/output-templates.en.md +4 -4
  220. package/templates/.agents/skills/review-code/reference/output-templates.zh-CN.md +4 -4
  221. package/templates/.agents/skills/review-plan/SKILL.en.md +1 -1
  222. package/templates/.agents/skills/review-plan/SKILL.zh-CN.md +2 -2
  223. package/templates/.agents/skills/review-plan/config/verify.en.json +0 -1
  224. package/templates/.agents/skills/review-plan/config/verify.zh-CN.json +0 -1
  225. package/templates/.agents/skills/review-plan/reference/output-templates.en.md +5 -5
  226. package/templates/.agents/skills/review-plan/reference/output-templates.zh-CN.md +5 -5
  227. package/templates/.agents/skills/review-pr/SKILL.en.md +2 -2
  228. package/templates/.agents/skills/review-pr/SKILL.zh-CN.md +2 -2
  229. package/templates/.agents/skills/review-pr/config/verify.en.json +0 -1
  230. package/templates/.agents/skills/review-pr/config/verify.zh-CN.json +0 -1
  231. package/templates/.agents/skills/review-pr/reference/output-guidance.en.md +1 -1
  232. package/templates/.agents/skills/review-pr/reference/output-guidance.zh-CN.md +1 -1
  233. package/templates/.agents/skills/run-manual-validation/config/verify.en.json +0 -1
  234. package/templates/.agents/skills/run-manual-validation/config/verify.zh-CN.json +0 -1
  235. package/templates/.agents/skills/run-task/SKILL.en.md +1 -1
  236. package/templates/.agents/skills/run-task/SKILL.zh-CN.md +1 -1
  237. package/templates/.agents/skills/test/SKILL.en.md +0 -3
  238. package/templates/.agents/skills/test/SKILL.zh-CN.md +0 -3
  239. package/templates/.agents/skills/test-integration/SKILL.en.md +0 -3
  240. package/templates/.agents/skills/test-integration/SKILL.zh-CN.md +0 -3
  241. package/templates/.agents/skills/update-agent-infra/scripts/sync-templates.js +13 -6
  242. package/templates/.agents/skills/upgrade-dependency/SKILL.en.md +0 -3
  243. package/templates/.agents/skills/upgrade-dependency/SKILL.zh-CN.md +0 -3
  244. package/templates/.agents/skills/watch-pr/SKILL.en.md +3 -3
  245. package/templates/.agents/skills/watch-pr/SKILL.zh-CN.md +3 -3
  246. package/templates/.agents/skills/watch-pr/config/verify.json +0 -1
  247. package/templates/.agents/templates/handoff.en.md +1 -1
  248. package/templates/.agents/templates/handoff.zh-CN.md +1 -1
  249. package/templates/.agents/workflows/bug-fix.en.yaml +1 -1
  250. package/templates/.agents/workflows/feature-development.en.yaml +1 -1
  251. package/templates/.agents/workflows/refactoring.en.yaml +1 -1
  252. package/dist/lib/task/task-execution-lock.js +0 -250
  253. package/lib/task/task-execution-lock.ts +0 -320
@@ -69,9 +69,7 @@ const DEFAULT_REQUIRED_FIELDS = [
69
69
  ];
70
70
 
71
71
  const DATE_TIME_PATTERN = /^\d{4}-\d{2}-\d{2}[T ]\d{2}:\d{2}:\d{2}(?:[+-]\d{2}:\d{2})?$/;
72
- // Start markers (action suffixed with ` [started]`) are excluded from the
73
- // "latest action" / freshness computation so a step's in-flight marker never
74
- // satisfies a skill's expected_action_pattern; the matching done entry does.
72
+ // Started rows do not represent completed lifecycle actions.
75
73
  const ACTIVITY_LOG_STARTED_RE = /\s*\[started\]\s*$/;
76
74
  const BRANCH_SLUG_PATTERN = /^[a-z0-9]+(?:-[a-z0-9]+)*$/;
77
75
 
@@ -358,16 +356,10 @@ function checkTaskMeta({ taskDir, config, repositoryRoot, skillName, artifactFil
358
356
  if (expectedStep && metadata.current_step !== expectedStep) {
359
357
  let validLifecycleArtifact = false;
360
358
  if (currentTask) {
361
- const activityConfig = loadVerificationConfig(repositoryRoot, skillName).checks?.["activity-log"];
362
359
  const { section, invalidEntries } = inspectActivityLog(task.content);
363
- if (activityConfig && section && invalidEntries.length === 0) {
364
- let latestAction = "";
365
- for (const entry of section.entries) {
366
- if (!ACTIVITY_LOG_STARTED_RE.test(entry.step)) latestAction = entry.step;
367
- }
360
+ if (section && invalidEntries.length === 0) {
368
361
  validLifecycleArtifact = checkArtifactLifecycleActivityLog(
369
- taskDir, artifactFile, skillName,
370
- activityConfig, task, section.entries, latestAction
362
+ taskDir, artifactFile, skillName, task, section.entries
371
363
  )?.status === "pass";
372
364
  }
373
365
  }
@@ -725,16 +717,16 @@ function checkImplementationInput({ taskDir, artifactFile }: any): any {
725
717
  return passResult("implementation-input", `${actionDecision} matches Activity Log, report, and task table`);
726
718
  }
727
719
 
728
- const ARTIFACT_ACTIVITY_STAGES: Readonly<Record<string, { family: string; event: string }>> = {
729
- "analyze-task": { family: "analysis", event: "analyze.completed" },
730
- "plan-task": { family: "plan", event: "plan.completed" },
731
- "review-analysis": { family: "review-analysis", event: "review-analysis.completed" },
732
- "review-plan": { family: "review-plan", event: "review-plan.completed" },
733
- "code-task": { family: "code", event: "code.completed" },
734
- "review-code": { family: "review-code", event: "review-code.completed" }
720
+ const ARTIFACT_ACTIVITY_STAGES: Readonly<Record<string, { family: string; event: string; action: string }>> = {
721
+ "analyze-task": { family: "analysis", event: "analyze.completed", action: "Analyze Task" },
722
+ "plan-task": { family: "plan", event: "plan.completed", action: "Plan Task" },
723
+ "review-analysis": { family: "review-analysis", event: "review-analysis.completed", action: "Review Analysis" },
724
+ "review-plan": { family: "review-plan", event: "review-plan.completed", action: "Review Plan" },
725
+ "code-task": { family: "code", event: "code.completed", action: "Code Task" },
726
+ "review-code": { family: "review-code", event: "review-code.completed", action: "Review Code" }
735
727
  };
736
728
 
737
- function checkArtifactLifecycleActivityLog(taskDir: string, artifactFile: string | undefined, skillName: string, config: any, task: any, entries: any[], latestAction: string): any {
729
+ function checkArtifactLifecycleActivityLog(taskDir: string, artifactFile: string | undefined, skillName: string, task: any, entries: any[]): any {
738
730
  const stage = ARTIFACT_ACTIVITY_STAGES[skillName];
739
731
  if (!stage) return null;
740
732
  const inventory = inspectArtifactDirectory(taskDir, stage.family as any);
@@ -772,25 +764,19 @@ function checkArtifactLifecycleActivityLog(taskDir: string, artifactFile: string
772
764
  }
773
765
  }
774
766
 
775
- const expectedAction = new RegExp(config.expected_action_pattern);
767
+ const roundActionPattern = new RegExp(`^${stage.action} \\(Round ${identity.round}(?:, [^)]+)?\\)$`);
776
768
  const roundAction = entries.find((entry) => {
777
- if (ACTIVITY_LOG_STARTED_RE.test(entry.step)) return false;
778
- if (!expectedAction.test(entry.step)) return false;
779
- expectedAction.lastIndex = 0;
780
- const actionRound = /\(Round (\d+)/.exec(entry.step)?.[1];
781
- return actionRound === String(identity.round) && entry.note.includes(`→ ${output}`);
769
+ return !ACTIVITY_LOG_STARTED_RE.test(entry.step)
770
+ && roundActionPattern.test(entry.step)
771
+ && entry.note.includes(`→ ${output}`);
782
772
  });
783
773
  if (!roundAction) {
784
774
  return failResult("activity-log", `No completed Activity Log row records '${output}' for ${skillName} Round ${identity.round}`);
785
775
  }
786
- if (skillName === "plan-task" && /^(?:Human Decision|Decision)\b/.test(latestAction)
787
- && expectedAction.test(latestAction)) {
788
- return passResult("activity-log", `Plan completion '${output}' is current; latest action '${latestAction}' is a human decision`);
789
- }
790
776
  return passResult("activity-log", `Current ${stage.family} completion '${output}' is valid for Round ${identity.round}`);
791
777
  }
792
778
 
793
- function checkActivityLog({ taskDir, config, skillName, artifactFile }: any): any {
779
+ function checkActivityLog({ taskDir, skillName, artifactFile }: any): any {
794
780
  const task = loadTask(taskDir);
795
781
  if (!task.ok) {
796
782
  return failResult("activity-log", task.message);
@@ -802,44 +788,16 @@ function checkActivityLog({ taskDir, config, skillName, artifactFile }: any): an
802
788
  const entries = section.entries;
803
789
  if (entries.length === 0) return failResult("activity-log", "Activity Log has no entries");
804
790
 
805
- let latestAction = "";
806
- let latestTimestamp = "";
807
- const doneActions: string[] = [];
808
-
809
791
  for (const entry of entries) {
810
792
  if (!entry.note.trim()) return failResult("activity-log", "Activity Log entry note is required");
811
- const { time: timestamp, step: action } = entry;
812
- // A `[started]` marker is not a terminal action: keep latestAction/latestTimestamp
813
- // on the most recent done entry so expected_action_pattern sees it.
814
- if (!ACTIVITY_LOG_STARTED_RE.test(action)) {
815
- latestTimestamp = timestamp;
816
- latestAction = action;
817
- doneActions.push(action);
818
- }
819
793
  }
820
794
 
821
795
  const artifactLifecycleResult = checkArtifactLifecycleActivityLog(
822
- taskDir, artifactFile, skillName, config, task, entries, latestAction
796
+ taskDir, artifactFile, skillName, task, entries
823
797
  );
824
798
  if (artifactLifecycleResult) return artifactLifecycleResult;
825
799
 
826
- if (config.expected_action_pattern && !new RegExp(config.expected_action_pattern).test(latestAction)) {
827
- const expected = new RegExp(config.expected_action_pattern);
828
- let index = doneActions.length - 1;
829
- while (index >= 0 && doneActions[index] === 'Commit' && !expected.test(doneActions[index]!)) index -= 1;
830
- if (index >= 0 && expected.test(doneActions[index]!)) {
831
- latestAction = doneActions[index]!;
832
- }
833
- }
834
-
835
- if (config.expected_action_pattern && !new RegExp(config.expected_action_pattern).test(latestAction)) {
836
- return failResult(
837
- "activity-log",
838
- `Latest action '${latestAction}' does not match '${config.expected_action_pattern}'`
839
- );
840
- }
841
-
842
- return passResult("activity-log", `Latest entry '${latestAction}' at ${latestTimestamp}`);
800
+ return passResult("activity-log", "Activity Log is valid");
843
801
  }
844
802
 
845
803
  function checkCompletionChecklist({ taskDir, config }: any): any {
@@ -1042,9 +1000,9 @@ async function checkPostReviewCommit({ taskDir, config, repositoryRoot }: any):
1042
1000
 
1043
1001
  let gitRoot;
1044
1002
  try {
1045
- gitRoot = execFileSync("git", ["-C", taskDir, "rev-parse", "--show-toplevel"], { encoding: "utf8" }).trim();
1003
+ gitRoot = execFileSync("git", ["-C", repositoryRoot, "rev-parse", "--show-toplevel"], { encoding: "utf8" }).trim();
1046
1004
  } catch {
1047
- return blockedResult("post-review-commit", "git unavailable or task directory is not inside a git repository");
1005
+ return blockedResult("post-review-commit", "git unavailable or repository root is not inside a git repository");
1048
1006
  }
1049
1007
 
1050
1008
  const task = loadTask(taskDir);
@@ -0,0 +1,78 @@
1
+ import path from 'node:path';
2
+ import fs from 'node:fs';
3
+ import os from 'node:os';
4
+ import { isSandbox } from '../sandbox/environment.ts';
5
+
6
+ export type ExecutionBoundary = 'host' | 'container';
7
+
8
+ /**
9
+ * Resolve the physical task-workspace boundary from the verified process
10
+ * execution context. Sandbox mode (task-bound / branch-only) does not affect
11
+ * the task workspace mount location.
12
+ */
13
+ export function resolveTaskWorkspaceExecutionBoundary(
14
+ env: NodeJS.ProcessEnv = process.env
15
+ ): ExecutionBoundary {
16
+ if (env.AGENT_INFRA_SANDBOX !== '1') return 'host';
17
+ const statusMountPath = env.AGENT_INFRA_CONTROL_STATUS_DIR;
18
+ if (!statusMountPath || !isSandbox(env, { statusMountPath })) {
19
+ throw new Error('task workspace boundary requires a verified sandbox execution context');
20
+ }
21
+ return 'container';
22
+ }
23
+
24
+ export interface TaskWorkspaceLayout {
25
+ projectKey: string;
26
+ boundary: ExecutionBoundary;
27
+ root: string;
28
+ active: string;
29
+ blocked: string;
30
+ completed: string;
31
+ archive: string;
32
+ shortIds: string;
33
+ }
34
+
35
+ export function resolveTaskWorkspaceLayout(input: {
36
+ project: string;
37
+ boundary: ExecutionBoundary;
38
+ home?: string;
39
+ }): TaskWorkspaceLayout {
40
+ const { project, boundary } = input;
41
+ if (!project || project === '.' || project === '..' || /[\\/\u0000-\u001f\u007f]/u.test(project)) {
42
+ throw new TypeError('project must be a safe single path segment');
43
+ }
44
+ let root: string;
45
+ if (boundary === 'container') {
46
+ root = '/task-workspace';
47
+ } else if (boundary === 'host') {
48
+ if (!input.home) throw new TypeError('home is required for host task workspace resolution');
49
+ if (!path.isAbsolute(input.home)) throw new TypeError('home must be an absolute path for host task workspace resolution');
50
+ root = path.join(input.home, '.agent-infra', 'task-workspaces', project);
51
+ } else {
52
+ throw new TypeError(`unsupported task workspace boundary: ${String(boundary)}`);
53
+ }
54
+ return {
55
+ projectKey: project,
56
+ boundary,
57
+ root,
58
+ active: path.join(root, 'active'),
59
+ blocked: path.join(root, 'blocked'),
60
+ completed: path.join(root, 'completed'),
61
+ archive: path.join(root, 'archive'),
62
+ shortIds: path.join(root, 'active', '.short-ids.json')
63
+ };
64
+ }
65
+
66
+ export function resolveProjectTaskWorkspaceLayout(
67
+ repoRoot: string,
68
+ boundary: ExecutionBoundary = resolveTaskWorkspaceExecutionBoundary()
69
+ ): TaskWorkspaceLayout {
70
+ const configPath = path.join(repoRoot, '.agents', '.airc.json');
71
+ const config = JSON.parse(fs.readFileSync(configPath, 'utf8')) as { project?: unknown };
72
+ if (typeof config.project !== 'string') throw new TypeError(`project is missing from ${configPath}`);
73
+ return resolveTaskWorkspaceLayout({ project: config.project, boundary, home: process.env.HOME || os.homedir() });
74
+ }
75
+
76
+ export function resolveProjectTaskWorkspaceRoot(repoRoot: string): string {
77
+ return resolveProjectTaskWorkspaceLayout(repoRoot).root;
78
+ }
@@ -3,6 +3,7 @@ import fs from 'node:fs';
3
3
  import os from 'node:os';
4
4
  import path from 'node:path';
5
5
  import { spawnSync } from 'node:child_process';
6
+ import { resolveProjectTaskWorkspaceRoot } from './workspace-root.ts';
6
7
 
7
8
  function git(repoRoot: string, indexFile: string | null, args: string[]): string {
8
9
  const env = indexFile ? { ...process.env, GIT_INDEX_FILE: indexFile } : process.env;
@@ -55,7 +56,7 @@ function captureWorktreeTree(repoRoot: string, forcedPath: string | null): strin
55
56
  }
56
57
 
57
58
  function taskFileFingerprints(stateRoot: string, taskId: string | null): TaskFileFingerprint[] {
58
- const activeRoot = path.join(stateRoot, '.agents', 'workspace', 'active');
59
+ const activeRoot = path.join(resolveProjectTaskWorkspaceRoot(stateRoot), 'active');
59
60
  const roots = taskId ? [path.join(activeRoot, taskId)] : [activeRoot];
60
61
  const records: TaskFileFingerprint[] = [];
61
62
  const visit = (absolute: string, relative: string): void => {
@@ -67,7 +68,7 @@ function taskFileFingerprints(stateRoot: string, taskId: string | null): TaskFil
67
68
  return;
68
69
  }
69
70
  if (!stat.isFile() && !stat.isSymbolicLink()) return;
70
- if (/^\.agents\/workspace\/(?:active|blocked|completed)\/TASK-[0-9]{8}-[0-9]{6}\/\.runtime\/orchestration\.json$/u.test(relative)) return;
71
+ if (/^task-workspace\/(?:active|blocked|completed)\/TASK-[0-9]{8}-[0-9]{6}\/\.runtime\/orchestration\.json$/u.test(relative)) return;
71
72
  const content = stat.isSymbolicLink()
72
73
  ? Buffer.from(fs.readlinkSync(absolute))
73
74
  : fs.readFileSync(absolute);
@@ -80,7 +81,7 @@ function taskFileFingerprints(stateRoot: string, taskId: string | null): TaskFil
80
81
  };
81
82
  for (const root of roots) {
82
83
  if (!fs.existsSync(root)) continue;
83
- const relative = path.posix.join('.agents/workspace/active', path.relative(activeRoot, root).split(path.sep).join('/'));
84
+ const relative = path.posix.join('task-workspace/active', path.relative(activeRoot, root).split(path.sep).join('/'));
84
85
  visit(root, relative.replace(/\/$/, ''));
85
86
  }
86
87
  return records.sort((left, right) => left.path.localeCompare(right.path));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fitlab-ai/agent-infra",
3
- "version": "0.11.15",
3
+ "version": "0.12.0",
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",
@@ -53,16 +53,23 @@ Built-in templates take priority over external templates. Later external templat
53
53
 
54
54
  ## Creating Your First Task
55
55
 
56
+ Resolve the host task root once for these examples:
57
+
58
+ ```bash
59
+ TASK_WORKSPACE_ROOT=$(agent-infra-internal task-workspace resolve --boundary host | node -e 'let input="";process.stdin.setEncoding("utf8");process.stdin.on("data",chunk=>input+=chunk);process.stdin.on("end",()=>process.stdout.write(JSON.parse(input).root));')
60
+ ```
61
+
56
62
  1. Copy the task template to the active workspace:
57
63
 
58
64
  ```bash
59
- cp .agents/templates/task.md .agents/workspace/active/task-001.md
65
+ mkdir -p "$TASK_WORKSPACE_ROOT/active/TASK-20260101-120000"
66
+ cp .agents/templates/task.md "$TASK_WORKSPACE_ROOT/active/TASK-20260101-120000/task.md"
60
67
  ```
61
68
 
62
69
  2. Fill in the task metadata:
63
70
 
64
71
  ```yaml
65
- id: task-001
72
+ id: TASK-20260101-120000
66
73
  type: feature # feature | bugfix | refactor | docs | review
67
74
  status: open # open | in-progress | review | blocked | completed
68
75
  assigned_to: claude # claude | codex | antigravity | opencode | human
@@ -92,7 +99,7 @@ Claude Code excels at codebase exploration and understanding complex relationshi
92
99
  agy
93
100
 
94
101
  # Example prompt:
95
- # "Based on the analysis in .agents/workspace/active/task-001.md,
102
+ # "Based on the analysis in $TASK_WORKSPACE_ROOT/active/TASK-20260101-120000/task.md,
96
103
  # create a technical design. Define interfaces and outline the approach."
97
104
  ```
98
105
 
@@ -103,7 +110,7 @@ agy
103
110
  codex
104
111
 
105
112
  # Example prompt:
106
- # "Implement the changes described in .agents/workspace/active/task-001.md.
113
+ # "Implement the changes described in $TASK_WORKSPACE_ROOT/active/TASK-20260101-120000/task.md.
107
114
  # Follow the design section. Create a new branch for this work."
108
115
  ```
109
116
 
@@ -130,7 +137,8 @@ claude
130
137
 
131
138
  ```bash
132
139
  # Quick bug fix workflow
133
- cp .agents/templates/task.md .agents/workspace/active/bugfix-001.md
140
+ mkdir -p "$TASK_WORKSPACE_ROOT/active/TASK-20260101-120000"
141
+ cp .agents/templates/task.md "$TASK_WORKSPACE_ROOT/active/TASK-20260101-120000/task.md"
134
142
  # Edit the task, then:
135
143
  # 1. Use Claude Code to analyze
136
144
  # 2. Use Codex/OpenCode to fix
@@ -144,7 +152,8 @@ cp .agents/templates/task.md .agents/workspace/active/bugfix-001.md
144
152
  3. **Report**: Generate review report from template.
145
153
 
146
154
  ```bash
147
- cp .agents/templates/review-report.md .agents/workspace/active/review-pr-42.md
155
+ mkdir -p "$TASK_WORKSPACE_ROOT/active/TASK-20260101-120001"
156
+ cp .agents/templates/review-report.md "$TASK_WORKSPACE_ROOT/active/TASK-20260101-120001/review-report.md"
148
157
  # Use Claude Code to fill in the review
149
158
  ```
150
159
 
@@ -156,7 +165,8 @@ cp .agents/templates/review-report.md .agents/workspace/active/review-pr-42.md
156
165
  4. **Verify** (Claude Code): Ensure no regressions, run tests.
157
166
 
158
167
  ```bash
159
- cp .agents/templates/task.md .agents/workspace/active/refactor-001.md
168
+ mkdir -p "$TASK_WORKSPACE_ROOT/active/TASK-20260101-120002"
169
+ cp .agents/templates/task.md "$TASK_WORKSPACE_ROOT/active/TASK-20260101-120002/task.md"
160
170
  # Follow the refactoring workflow in .agents/workflows/refactoring.yaml
161
171
  ```
162
172
 
@@ -165,7 +175,8 @@ cp .agents/templates/task.md .agents/workspace/active/refactor-001.md
165
175
  When switching between AI tools, create a handoff document:
166
176
 
167
177
  ```bash
168
- cp .agents/templates/handoff.md .agents/workspace/active/handoff-task-001-phase2.md
178
+ mkdir -p "$TASK_WORKSPACE_ROOT/active/TASK-20260101-120003"
179
+ cp .agents/templates/handoff.md "$TASK_WORKSPACE_ROOT/active/TASK-20260101-120003/handoff.md"
169
180
  ```
170
181
 
171
182
  Fill in:
@@ -53,16 +53,23 @@ node -p "'v' + require('./package.json').version"
53
53
 
54
54
  ## 创建第一个任务
55
55
 
56
+ 先通过统一 resolver 取得宿主任务根,供以下示例使用:
57
+
58
+ ```bash
59
+ TASK_WORKSPACE_ROOT=$(agent-infra-internal task-workspace resolve --boundary host | node -e 'let input="";process.stdin.setEncoding("utf8");process.stdin.on("data",chunk=>input+=chunk);process.stdin.on("end",()=>process.stdout.write(JSON.parse(input).root));')
60
+ ```
61
+
56
62
  1. 将任务模板复制到活跃工作区:
57
63
 
58
64
  ```bash
59
- cp .agents/templates/task.md .agents/workspace/active/task-001.md
65
+ mkdir -p "$TASK_WORKSPACE_ROOT/active/TASK-20260101-120000"
66
+ cp .agents/templates/task.md "$TASK_WORKSPACE_ROOT/active/TASK-20260101-120000/task.md"
60
67
  ```
61
68
 
62
69
  2. 填写任务元数据:
63
70
 
64
71
  ```yaml
65
- id: task-001
72
+ id: TASK-20260101-120000
66
73
  type: feature # feature | bugfix | refactor | docs | chore
67
74
  status: active # active | blocked | completed
68
75
  assigned_to: claude # claude | codex | antigravity | opencode | human
@@ -92,7 +99,7 @@ Claude Code 擅长代码库探索和理解文件间的复杂关系。
92
99
  agy
93
100
 
94
101
  # 示例提示:
95
- # "基于 .agents/workspace/active/task-001.md 中的分析结果,
102
+ # "基于 $TASK_WORKSPACE_ROOT/active/TASK-20260101-120000/task.md 中的分析结果,
96
103
  # 创建技术设计方案。定义接口并概述实现思路。"
97
104
  ```
98
105
 
@@ -103,7 +110,7 @@ agy
103
110
  codex
104
111
 
105
112
  # 示例提示:
106
- # "实现 .agents/workspace/active/task-001.md 中描述的变更。
113
+ # "实现 $TASK_WORKSPACE_ROOT/active/TASK-20260101-120000/task.md 中描述的变更。
107
114
  # 遵循设计部分。为此工作创建新分支。"
108
115
  ```
109
116
 
@@ -130,7 +137,8 @@ claude
130
137
 
131
138
  ```bash
132
139
  # 快速缺陷修复工作流
133
- cp .agents/templates/task.md .agents/workspace/active/bugfix-001.md
140
+ mkdir -p "$TASK_WORKSPACE_ROOT/active/TASK-20260101-120000"
141
+ cp .agents/templates/task.md "$TASK_WORKSPACE_ROOT/active/TASK-20260101-120000/task.md"
134
142
  # 编辑任务,然后:
135
143
  # 1. 使用 Claude Code 分析
136
144
  # 2. 使用 Codex/OpenCode 修复
@@ -144,7 +152,8 @@ cp .agents/templates/task.md .agents/workspace/active/bugfix-001.md
144
152
  3. **报告**:从模板生成审查报告。
145
153
 
146
154
  ```bash
147
- cp .agents/templates/review-report.md .agents/workspace/active/review-pr-42.md
155
+ mkdir -p "$TASK_WORKSPACE_ROOT/active/TASK-20260101-120001"
156
+ cp .agents/templates/review-report.md "$TASK_WORKSPACE_ROOT/active/TASK-20260101-120001/review-report.md"
148
157
  # 使用 Claude Code 填写审查内容
149
158
  ```
150
159
 
@@ -156,7 +165,8 @@ cp .agents/templates/review-report.md .agents/workspace/active/review-pr-42.md
156
165
  4. **验证**(Claude Code):确保没有回归问题,运行测试。
157
166
 
158
167
  ```bash
159
- cp .agents/templates/task.md .agents/workspace/active/refactor-001.md
168
+ mkdir -p "$TASK_WORKSPACE_ROOT/active/TASK-20260101-120002"
169
+ cp .agents/templates/task.md "$TASK_WORKSPACE_ROOT/active/TASK-20260101-120002/task.md"
160
170
  # 按照 .agents/workflows/refactoring.yaml 中的重构工作流执行
161
171
  ```
162
172
 
@@ -165,7 +175,8 @@ cp .agents/templates/task.md .agents/workspace/active/refactor-001.md
165
175
  在 AI 工具之间切换时,创建交接文档:
166
176
 
167
177
  ```bash
168
- cp .agents/templates/handoff.md .agents/workspace/active/handoff-task-001-phase2.md
178
+ mkdir -p "$TASK_WORKSPACE_ROOT/active/TASK-20260101-120003"
179
+ cp .agents/templates/handoff.md "$TASK_WORKSPACE_ROOT/active/TASK-20260101-120003/handoff.md"
169
180
  ```
170
181
 
171
182
  填写:
@@ -35,24 +35,19 @@ This dual-config approach ensures every AI tool receives appropriate project con
35
35
  code-review.yaml # Code review workflow
36
36
  refactoring.yaml # Refactoring workflow
37
37
  rules/ # Collaboration rule index (see rules/README.md)
38
- workspace/ # Runtime workspace (git-ignored)
39
- active/ # Currently active tasks
40
- blocked/ # Blocked tasks
41
- completed/ # Completed tasks
42
- logs/ # Collaboration logs
43
-
44
38
  .claude/ # Claude Code specific config
45
39
  CLAUDE.md # Project instructions for Claude
46
40
  commands/ # Slash commands
47
41
  settings.json # Claude settings
48
42
  ```
49
43
 
50
- The whole `.agents/workspace/` tree is runtime-only and git-ignored. `active/`
51
- contains current tasks, `blocked/` contains paused tasks, `completed/` contains
52
- finished tasks, and `archive/` stores archived history. Runtime logs and process
53
- evidence may also be created below this root. Do not place content here that must
54
- be shared through Git; collaboration rules, templates, and workflows belong in
55
- the version-controlled `.agents/` tree.
44
+ The host task workspace root is `~/.agent-infra/task-workspaces/<project-key>`;
45
+ the container root is `/task-workspace`. Resolve the current host root with
46
+ `agent-infra-internal task-workspace resolve --boundary host` and a task's exact
47
+ directory with `agent-infra-internal task-context resolve --task <task-id>`.
48
+ `active/`, `blocked/`, `completed/`, `archive/`, and `active/.short-ids.json` live
49
+ under that root and contain runtime data. The `<task-workspace>` placeholder used
50
+ in these guides means the resolver's returned root; it is not a repository path.
56
51
 
57
52
  ## Collaboration Model
58
53
 
@@ -101,7 +96,7 @@ Each AI tool has different strengths. Use them accordingly:
101
96
  ## Quick Start
102
97
 
103
98
  1. **Read the quick start guide**: See `QUICKSTART.md` for step-by-step instructions.
104
- 2. **Create a task**: Copy `.agents/templates/task.md` to `.agents/workspace/active/`.
99
+ 2. **Create a task**: Use the `create-task` workflow; the host writes task data to the project task root.
105
100
  3. **Assign to an AI**: Update the `assigned_to` field in the task metadata.
106
101
  4. **Run the workflow**: Follow the appropriate workflow in `.agents/workflows/`.
107
102
  5. **Hand off**: When switching AIs, create a handoff document from the template.
@@ -386,7 +381,7 @@ No. Claude Code reads from `.claude/CLAUDE.md`, and all other tools read from `A
386
381
 
387
382
  ### Q: How do tasks get passed between AI tools?
388
383
 
389
- Through handoff documents stored in `.agents/workspace/`. Each handoff includes context, progress, and next steps so the receiving AI can continue seamlessly.
384
+ Through handoff documents stored in `<task-workspace>/`. Each handoff includes context, progress, and next steps so the receiving AI can continue seamlessly.
390
385
 
391
386
  ### Q: What if an AI tool doesn't support AGENTS.md?
392
387
 
@@ -398,4 +393,4 @@ It's not recommended. The workflow model is sequential -- one AI per phase. Para
398
393
 
399
394
  ### Q: Where are runtime files stored?
400
395
 
401
- In `.agents/workspace/`, which is git-ignored. Only templates and workflow definitions in `.agents/` are version-controlled.
396
+ In `<task-workspace>/`, which is git-ignored. Only templates and workflow definitions in `.agents/` are version-controlled.
@@ -35,22 +35,18 @@
35
35
  code-review.yaml # 代码审查工作流
36
36
  refactoring.yaml # 重构工作流
37
37
  rules/ # 协作规则索引(见 rules/README.md)
38
- workspace/ # 运行时工作区(已被 git ignore)
39
- active/ # 当前活跃任务
40
- blocked/ # 被阻塞的任务
41
- completed/ # 已完成的任务
42
- logs/ # 协作日志
43
-
44
38
  .claude/ # Claude Code 专属配置
45
39
  CLAUDE.md # Claude 项目指令
46
40
  commands/ # 斜杠命令
47
41
  settings.json # Claude 设置
48
42
  ```
49
43
 
50
- 整个 `.agents/workspace/` 目录树都只保存运行时数据,并被 git ignore。`active/`
51
- 保存当前任务,`blocked/` 保存暂停任务,`completed/` 保存已完成任务,`archive/`
52
- 保存归档历史;运行时日志和过程证据也可能出现在该根目录下。不要在这里存放必须
53
- 通过 Git 共享的内容;协作规则、模板和工作流应放在受版本控制的 `.agents/` 目录中。
44
+ 宿主任务根为 `~/.agent-infra/task-workspaces/<project-key>`,容器任务根为
45
+ `/task-workspace`。使用 `agent-infra-internal task-workspace resolve --boundary host`
46
+ 取得当前项目的宿主根,使用 `agent-infra-internal task-context resolve --task <task-id>`
47
+ 取得某个任务的精确目录。`active/`、`blocked/`、`completed/`、`archive/` 和
48
+ `active/.short-ids.json` 都位于任务根中;这些路径只保存运行时数据,不通过 Git
49
+ 共享。文中的 `<task-workspace>` 表示由上述 resolver 返回的根,不是仓库内目录。
54
50
 
55
51
  ## 协作模型
56
52
 
@@ -99,7 +95,7 @@
99
95
  ## 快速入门
100
96
 
101
97
  1. **阅读快速入门指南**:参见 `QUICKSTART.md` 获取分步说明。
102
- 2. **创建任务**:将 `.agents/templates/task.md` 复制到 `.agents/workspace/active/`。
98
+ 2. **创建任务**:通过 `create-task` 工作流创建任务;任务数据由宿主写入项目任务根。
103
99
  3. **分配给 AI**:更新任务元数据中的 `assigned_to` 字段。
104
100
  4. **执行工作流**:按照 `.agents/workflows/` 中相应的工作流执行。
105
101
  5. **交接**:切换 AI 时,从模板创建交接文档。
@@ -384,7 +380,7 @@ agent-infra-internal task-verify {task-id} <verification-event> [--artifact <art
384
380
 
385
381
  ### Q:任务如何在 AI 工具之间传递?
386
382
 
387
- 通过存储在 `.agents/workspace/` 中的交接文档。每份交接文档包含上下文、进度和后续步骤,让接收方 AI 能无缝接续。
383
+ 通过存储在 `<task-workspace>/` 中的交接文档。每份交接文档包含上下文、进度和后续步骤,让接收方 AI 能无缝接续。
388
384
 
389
385
  ### Q:如果某个 AI 工具不支持 AGENTS.md 怎么办?
390
386
 
@@ -396,4 +392,4 @@ agent-infra-internal task-verify {task-id} <verification-event> [--artifact <art
396
392
 
397
393
  ### Q:运行时文件存储在哪里?
398
394
 
399
- 在 `.agents/workspace/` 中,该目录已被 git ignore。只有 `.agents/` 中的模板和工作流定义受版本控制。
395
+ 在 `<task-workspace>/` 中,该目录已被 git ignore。只有 `.agents/` 中的模板和工作流定义受版本控制。
@@ -22,7 +22,7 @@ Comments use `platform-comment`; Issue resources use `platform-issue`:
22
22
  ```bash
23
23
  agent-infra-internal platform-comment list --issue <issue-token> [--cwd <path>]
24
24
  agent-infra-internal platform-comment recover --issue <issue-token> --task-id <TASK-id> \
25
- --output <.agents/workspace/.restore-staging-*/task.md> [--cwd <path>]
25
+ --output <<task-workspace>/.restore-staging-*/task.md> [--cwd <path>]
26
26
  agent-infra-internal platform-issue inspect {task-id}
27
27
  agent-infra-internal platform-issue create {task-id} --agent {standard-agent-token}
28
28
  agent-infra-internal platform-issue bind {task-id} --issue {issue-token} --agent {standard-agent-token}
@@ -26,7 +26,7 @@
26
26
  agent-infra-internal platform-context resolve [--cwd <path>]
27
27
  agent-infra-internal platform-comment list --issue <issue-token> [--cwd <path>]
28
28
  agent-infra-internal platform-comment recover --issue <issue-token> --task-id <TASK-id> \
29
- --output <.agents/workspace/.restore-staging-*/task.md> [--cwd <path>]
29
+ --output <<task-workspace>/.restore-staging-*/task.md> [--cwd <path>]
30
30
  agent-infra-internal platform-comment owner <task-ref>
31
31
  agent-infra-internal platform-comment sync <task-ref> \
32
32
  --kind task|artifact|summary|cancel --agent {standard-agent-token} \
@@ -10,7 +10,7 @@
10
10
 
11
11
  ## Current Execution Records
12
12
 
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.
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. Stages for one task run sequentially; atomic writes and identity/state validation continue to protect state updates.
14
14
 
15
15
  ## Current Host
16
16
 
@@ -10,7 +10,7 @@
10
10
 
11
11
  ## 当前执行记录
12
12
 
13
- `orchestration.json` 记录阶段、模型策略、child 身份及实际执行结果。记录必须符合当前结构;本地操作者可直接修正后重新校验。已有任务写锁与原子写入继续保护写操作。
13
+ `orchestration.json` 记录阶段、模型策略、child 身份及实际执行结果。记录必须符合当前结构;本地操作者可直接修正后重新校验。同一任务的阶段按序调用;原子写入、身份校验和状态校验继续保护状态更新。
14
14
 
15
15
  ## 当前宿主
16
16
 
@@ -17,7 +17,7 @@ This file defines three **independent** rules for a skill's "notify-user / Next
17
17
 
18
18
  - **Next-step TUI commands** (`/analyze-task`, `/{{project}}:review-code`, `$create-pr`, etc., including commands inside Markdown table cells) → always use `{task-ref}` (short id).
19
19
  - **"Task info" / "Task status" structured field lines** → show full id and short id together: `- Task ID: {task-id} (short id {task-ref})`.
20
- - **Report titles** (`Task {task-id} ... completed`) and **artifact paths** (`.agents/workspace/active/{task-id}/...`) → keep the full `{task-id}` (physical path and archive key, must not change).
20
+ - **Report titles** (`Task {task-id} ... completed`) and **artifact paths** (`<task-workspace>/active/{task-id}/...`) → keep the full `{task-id}` (physical path and archive key, must not change).
21
21
 
22
22
  ## Unified Client Command Rendering
23
23
 
@@ -39,7 +39,7 @@ agent-infra-internal agent-client next-steps \
39
39
 
40
40
  ## Obtaining the short id (`{task-ref}`)
41
41
 
42
- The single source of truth for short ids is the registry `.agents/workspace/active/.short-ids.json` (via `task-short-id.js`). **Never** read the `short_id` field from task.md frontmatter (that field is not authoritative).
42
+ The single source of truth for short ids is the registry `<task-workspace>/active/.short-ids.json` (via `task-short-id.js`). **Never** read the `short_id` field from task.md frontmatter (that field is not authoritative).
43
43
 
44
44
  Once the full `$task_id` is resolved, use the snippet below to look up the short id; it returns bare `NN` on hit and falls back to the full `TASK-id` on miss:
45
45
 
@@ -17,7 +17,7 @@
17
17
 
18
18
  - **下一步 TUI 命令**(`/analyze-task`、`/{{project}}:review-code`、`$create-pr` 等,含 Markdown 表格单元格内的命令)→ 一律用 `{task-ref}`(短号)。
19
19
  - **「任务信息」/「任务状态」结构化字段行** → 完整 ID 与短号同显:`- 任务 ID:{task-id}(短号 {task-ref})`。
20
- - **报告标题**(`任务 {task-id} ... 完成`)与**产出文件路径**(`.agents/workspace/active/{task-id}/...`)→ 保持完整 `{task-id}`(物理路径与归档键,不可改)。
20
+ - **报告标题**(`任务 {task-id} ... 完成`)与**产出文件路径**(`<task-workspace>/active/{task-id}/...`)→ 保持完整 `{task-id}`(物理路径与归档键,不可改)。
21
21
 
22
22
  ## 统一客户端命令渲染
23
23
 
@@ -39,7 +39,7 @@ agent-infra-internal agent-client next-steps \
39
39
 
40
40
  ## 取短号(`{task-ref}`)
41
41
 
42
- 短号唯一真源是注册表 `.agents/workspace/active/.short-ids.json`(经 `task-short-id.js`)。**禁止**读取 task.md frontmatter 的 `short_id` 字段(该字段不可信)。
42
+ 短号唯一真源是注册表 `<task-workspace>/active/.short-ids.json`(经 `task-short-id.js`)。**禁止**读取 task.md frontmatter 的 `short_id` 字段(该字段不可信)。
43
43
 
44
44
  在已解析出完整 `$task_id` 后,用以下片段反查短号;命中返回裸数字 `NN`,未命中自动回退完整 `TASK-id`:
45
45
 
@@ -21,7 +21,7 @@ agent-infra-internal platform-pr change-report {task-id} \
21
21
 
22
22
  agent-infra-internal platform-pr summary-sync {task-id} \
23
23
  --agent {standard-agent-token} --body-file {summary-body-file} \
24
- --change-report-file .agents/workspace/active/{task-id}/pr-change-report.json \
24
+ --change-report-file <task-workspace>/active/{task-id}/pr-change-report.json \
25
25
  --result {primary-result}
26
26
  ```
27
27
 
@@ -59,7 +59,7 @@ precheck 必须覆盖六项固定检查并提供文件证据;`formalReview`
59
59
  ```bash
60
60
  agent-infra-internal platform-pr summary-sync {task-id} \
61
61
  --agent {standard-agent-token} --body-file {summary-body-file} \
62
- --change-report-file .agents/workspace/active/{task-id}/pr-change-report.json \
62
+ --change-report-file <task-workspace>/active/{task-id}/pr-change-report.json \
63
63
  --result {primary-result}
64
64
  ```
65
65