agentplane 0.3.9 → 0.3.11

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 (404) hide show
  1. package/assets/AGENTS.md +4 -2
  2. package/assets/agents/CODER.json +1 -1
  3. package/assets/policy/dod.core.md +1 -1
  4. package/assets/policy/governance.md +5 -3
  5. package/assets/policy/incidents.md +19 -77
  6. package/assets/policy/workflow.branch_pr.md +2 -0
  7. package/assets/policy/workflow.direct.md +3 -1
  8. package/bin/agentplane.js +56 -1
  9. package/bin/runtime-watch.js +1 -0
  10. package/bin/stale-dist-policy.d.ts +1 -1
  11. package/bin/stale-dist-policy.js +13 -0
  12. package/dist/.build-manifest.json +462 -202
  13. package/dist/cli/bootstrap-guide.d.ts +1 -0
  14. package/dist/cli/bootstrap-guide.d.ts.map +1 -1
  15. package/dist/cli/bootstrap-guide.js +20 -1
  16. package/dist/cli/command-guide.d.ts.map +1 -1
  17. package/dist/cli/command-guide.js +2 -1
  18. package/dist/cli/command-invocations.d.ts.map +1 -1
  19. package/dist/cli/command-invocations.js +6 -1
  20. package/dist/cli/command-snippets.d.ts +2 -0
  21. package/dist/cli/command-snippets.d.ts.map +1 -1
  22. package/dist/cli/command-snippets.js +2 -0
  23. package/dist/cli/run-cli/command-catalog/core.d.ts +1 -1
  24. package/dist/cli/run-cli/command-catalog/core.d.ts.map +1 -1
  25. package/dist/cli/run-cli/command-catalog/core.js +10 -0
  26. package/dist/cli/run-cli/command-catalog/project.d.ts +1 -1
  27. package/dist/cli/run-cli/command-catalog/project.d.ts.map +1 -1
  28. package/dist/cli/run-cli/command-catalog/project.js +3 -1
  29. package/dist/cli/run-cli/command-catalog/task.d.ts +1 -1
  30. package/dist/cli/run-cli/command-catalog/task.d.ts.map +1 -1
  31. package/dist/cli/run-cli/command-catalog/task.js +10 -0
  32. package/dist/cli/run-cli/command-catalog.d.ts +1 -1
  33. package/dist/cli/run-cli/command-catalog.d.ts.map +1 -1
  34. package/dist/cli/run-cli/commands/config.d.ts.map +1 -1
  35. package/dist/cli/run-cli/commands/config.js +13 -0
  36. package/dist/cli/run-cli/commands/core/preflight.d.ts.map +1 -1
  37. package/dist/cli/run-cli/commands/core/preflight.js +44 -1
  38. package/dist/cli/run-cli.js +2 -2
  39. package/dist/cli/run-cli.test-helpers.d.ts.map +1 -1
  40. package/dist/cli/run-cli.test-helpers.js +12 -0
  41. package/dist/commands/backend.d.ts.map +1 -1
  42. package/dist/commands/backend.js +4 -0
  43. package/dist/commands/branch/cleanup-merged.d.ts +2 -0
  44. package/dist/commands/branch/cleanup-merged.d.ts.map +1 -1
  45. package/dist/commands/branch/cleanup-merged.js +132 -28
  46. package/dist/commands/branch/work-start.d.ts.map +1 -1
  47. package/dist/commands/branch/work-start.js +60 -1
  48. package/dist/commands/cleanup/merged.command.d.ts +2 -0
  49. package/dist/commands/cleanup/merged.command.d.ts.map +1 -1
  50. package/dist/commands/cleanup/merged.command.js +24 -0
  51. package/dist/commands/doctor/branch-pr.d.ts +4 -0
  52. package/dist/commands/doctor/branch-pr.d.ts.map +1 -0
  53. package/dist/commands/doctor/branch-pr.js +96 -0
  54. package/dist/commands/doctor/fixes.d.ts +5 -0
  55. package/dist/commands/doctor/fixes.d.ts.map +1 -1
  56. package/dist/commands/doctor/fixes.js +70 -0
  57. package/dist/commands/doctor.run.d.ts.map +1 -1
  58. package/dist/commands/doctor.run.js +6 -1
  59. package/dist/commands/finish.run.d.ts.map +1 -1
  60. package/dist/commands/finish.run.js +11 -0
  61. package/dist/commands/finish.spec.d.ts +11 -0
  62. package/dist/commands/finish.spec.d.ts.map +1 -1
  63. package/dist/commands/finish.spec.js +51 -0
  64. package/dist/commands/guard/impl/close-message.d.ts.map +1 -1
  65. package/dist/commands/guard/impl/close-message.js +23 -6
  66. package/dist/commands/guard/impl/commands.d.ts.map +1 -1
  67. package/dist/commands/guard/impl/commands.js +24 -2
  68. package/dist/commands/guard/impl/env.d.ts +1 -0
  69. package/dist/commands/guard/impl/env.d.ts.map +1 -1
  70. package/dist/commands/guard/impl/env.js +1 -0
  71. package/dist/commands/hooks/index.d.ts.map +1 -1
  72. package/dist/commands/hooks/index.js +98 -1
  73. package/dist/commands/incidents/advise.command.d.ts +15 -0
  74. package/dist/commands/incidents/advise.command.d.ts.map +1 -0
  75. package/dist/commands/incidents/advise.command.js +139 -0
  76. package/dist/commands/incidents/collect.command.d.ts +11 -0
  77. package/dist/commands/incidents/collect.command.d.ts.map +1 -0
  78. package/dist/commands/incidents/collect.command.js +72 -0
  79. package/dist/commands/incidents/incidents.command.d.ts +5 -0
  80. package/dist/commands/incidents/incidents.command.d.ts.map +1 -0
  81. package/dist/commands/incidents/incidents.command.js +21 -0
  82. package/dist/commands/incidents/shared.d.ts +76 -0
  83. package/dist/commands/incidents/shared.d.ts.map +1 -0
  84. package/dist/commands/incidents/shared.js +261 -0
  85. package/dist/commands/pr/check.d.ts.map +1 -1
  86. package/dist/commands/pr/check.js +249 -75
  87. package/dist/commands/pr/close-superseded.d.ts +9 -0
  88. package/dist/commands/pr/close-superseded.d.ts.map +1 -0
  89. package/dist/commands/pr/close-superseded.js +129 -0
  90. package/dist/commands/pr/close.d.ts +11 -0
  91. package/dist/commands/pr/close.d.ts.map +1 -0
  92. package/dist/commands/pr/close.js +116 -0
  93. package/dist/commands/pr/index.d.ts +2 -0
  94. package/dist/commands/pr/index.d.ts.map +1 -1
  95. package/dist/commands/pr/index.js +2 -0
  96. package/dist/commands/pr/integrate/artifacts.d.ts +7 -0
  97. package/dist/commands/pr/integrate/artifacts.d.ts.map +1 -1
  98. package/dist/commands/pr/integrate/artifacts.js +66 -1
  99. package/dist/commands/pr/integrate/cmd.d.ts.map +1 -1
  100. package/dist/commands/pr/integrate/cmd.js +20 -0
  101. package/dist/commands/pr/integrate/internal/bootstrap-guidance.d.ts +8 -0
  102. package/dist/commands/pr/integrate/internal/bootstrap-guidance.d.ts.map +1 -0
  103. package/dist/commands/pr/integrate/internal/bootstrap-guidance.js +59 -0
  104. package/dist/commands/pr/integrate/internal/finalize.d.ts.map +1 -1
  105. package/dist/commands/pr/integrate/internal/finalize.js +40 -12
  106. package/dist/commands/pr/integrate/internal/merge.d.ts +4 -0
  107. package/dist/commands/pr/integrate/internal/merge.d.ts.map +1 -1
  108. package/dist/commands/pr/integrate/internal/merge.js +59 -15
  109. package/dist/commands/pr/integrate/internal/post-integrate-bootstrap.d.ts +13 -0
  110. package/dist/commands/pr/integrate/internal/post-integrate-bootstrap.d.ts.map +1 -0
  111. package/dist/commands/pr/integrate/internal/post-integrate-bootstrap.js +25 -0
  112. package/dist/commands/pr/integrate/internal/prepare.d.ts +3 -2
  113. package/dist/commands/pr/integrate/internal/prepare.d.ts.map +1 -1
  114. package/dist/commands/pr/integrate/internal/prepare.js +107 -19
  115. package/dist/commands/pr/internal/freshness.d.ts +20 -0
  116. package/dist/commands/pr/internal/freshness.d.ts.map +1 -0
  117. package/dist/commands/pr/internal/freshness.js +50 -0
  118. package/dist/commands/pr/internal/gh-api.d.ts +6 -0
  119. package/dist/commands/pr/internal/gh-api.d.ts.map +1 -0
  120. package/dist/commands/pr/internal/gh-api.js +80 -0
  121. package/dist/commands/pr/internal/note-store.d.ts +18 -0
  122. package/dist/commands/pr/internal/note-store.d.ts.map +1 -0
  123. package/dist/commands/pr/internal/note-store.js +66 -0
  124. package/dist/commands/pr/internal/pr-paths.d.ts +13 -0
  125. package/dist/commands/pr/internal/pr-paths.d.ts.map +1 -1
  126. package/dist/commands/pr/internal/pr-paths.js +13 -0
  127. package/dist/commands/pr/internal/review-template.d.ts +24 -4
  128. package/dist/commands/pr/internal/review-template.d.ts.map +1 -1
  129. package/dist/commands/pr/internal/review-template.js +221 -33
  130. package/dist/commands/pr/internal/sync.d.ts +41 -0
  131. package/dist/commands/pr/internal/sync.d.ts.map +1 -0
  132. package/dist/commands/pr/internal/sync.js +598 -0
  133. package/dist/commands/pr/note.d.ts.map +1 -1
  134. package/dist/commands/pr/note.js +37 -4
  135. package/dist/commands/pr/open.d.ts +1 -0
  136. package/dist/commands/pr/open.d.ts.map +1 -1
  137. package/dist/commands/pr/open.js +18 -54
  138. package/dist/commands/pr/pr.command.d.ts +15 -0
  139. package/dist/commands/pr/pr.command.d.ts.map +1 -1
  140. package/dist/commands/pr/pr.command.js +124 -5
  141. package/dist/commands/pr/update.d.ts.map +1 -1
  142. package/dist/commands/pr/update.js +58 -74
  143. package/dist/commands/recipes/impl/commands/cache-prune.d.ts.map +1 -1
  144. package/dist/commands/recipes/impl/commands/cache-prune.js +14 -0
  145. package/dist/commands/recipes/impl/commands/install.js +1 -1
  146. package/dist/commands/recipes/impl/commands/list-remote.d.ts.map +1 -1
  147. package/dist/commands/recipes/impl/commands/list-remote.js +1 -0
  148. package/dist/commands/recipes/impl/commands/remove.d.ts.map +1 -1
  149. package/dist/commands/recipes/impl/commands/remove.js +9 -1
  150. package/dist/commands/release/apply.command.d.ts.map +1 -1
  151. package/dist/commands/release/apply.command.js +12 -17
  152. package/dist/commands/release/apply.preflight.d.ts.map +1 -1
  153. package/dist/commands/release/apply.preflight.js +1 -1
  154. package/dist/commands/shared/approval-requirements.d.ts +5 -7
  155. package/dist/commands/shared/approval-requirements.d.ts.map +1 -1
  156. package/dist/commands/shared/approval-requirements.js +3 -73
  157. package/dist/commands/shared/gh-transport.d.ts +16 -0
  158. package/dist/commands/shared/gh-transport.d.ts.map +1 -0
  159. package/dist/commands/shared/gh-transport.js +71 -0
  160. package/dist/commands/shared/git-diff.d.ts +3 -1
  161. package/dist/commands/shared/git-diff.d.ts.map +1 -1
  162. package/dist/commands/shared/git-diff.js +10 -2
  163. package/dist/commands/shared/git-ops.d.ts +1 -0
  164. package/dist/commands/shared/git-ops.d.ts.map +1 -1
  165. package/dist/commands/shared/git-ops.js +15 -0
  166. package/dist/commands/shared/git-worktree.d.ts +2 -0
  167. package/dist/commands/shared/git-worktree.d.ts.map +1 -1
  168. package/dist/commands/shared/git-worktree.js +22 -2
  169. package/dist/commands/shared/network-approval.d.ts +2 -0
  170. package/dist/commands/shared/network-approval.d.ts.map +1 -1
  171. package/dist/commands/shared/network-approval.js +1 -1
  172. package/dist/commands/shared/post-commit-pr-artifacts.d.ts +9 -0
  173. package/dist/commands/shared/post-commit-pr-artifacts.d.ts.map +1 -0
  174. package/dist/commands/shared/post-commit-pr-artifacts.js +22 -0
  175. package/dist/commands/shared/pr-meta.d.ts +29 -0
  176. package/dist/commands/shared/pr-meta.d.ts.map +1 -1
  177. package/dist/commands/shared/pr-meta.js +152 -3
  178. package/dist/commands/shared/task-backend.d.ts +9 -0
  179. package/dist/commands/shared/task-backend.d.ts.map +1 -1
  180. package/dist/commands/shared/task-backend.js +34 -22
  181. package/dist/commands/shared/task-local-freshness.d.ts +13 -0
  182. package/dist/commands/shared/task-local-freshness.d.ts.map +1 -0
  183. package/dist/commands/shared/task-local-freshness.js +20 -0
  184. package/dist/commands/shared/task-mutation.d.ts +2 -0
  185. package/dist/commands/shared/task-mutation.d.ts.map +1 -1
  186. package/dist/commands/shared/task-mutation.js +7 -0
  187. package/dist/commands/task/block.d.ts.map +1 -1
  188. package/dist/commands/task/block.js +1 -0
  189. package/dist/commands/task/close-duplicate.d.ts.map +1 -1
  190. package/dist/commands/task/close-duplicate.js +34 -1
  191. package/dist/commands/task/close-shared.d.ts.map +1 -1
  192. package/dist/commands/task/close-shared.js +1 -0
  193. package/dist/commands/task/derive.js +1 -1
  194. package/dist/commands/task/doc-template.d.ts.map +1 -1
  195. package/dist/commands/task/doc-template.js +7 -11
  196. package/dist/commands/task/findings-add.command.d.ts +20 -0
  197. package/dist/commands/task/findings-add.command.d.ts.map +1 -0
  198. package/dist/commands/task/findings-add.command.js +165 -0
  199. package/dist/commands/task/findings.command.d.ts +7 -0
  200. package/dist/commands/task/findings.command.d.ts.map +1 -0
  201. package/dist/commands/task/findings.command.js +20 -0
  202. package/dist/commands/task/findings.d.ts +63 -0
  203. package/dist/commands/task/findings.d.ts.map +1 -0
  204. package/dist/commands/task/findings.js +188 -0
  205. package/dist/commands/task/finish-shared.d.ts +1 -0
  206. package/dist/commands/task/finish-shared.d.ts.map +1 -1
  207. package/dist/commands/task/finish-shared.js +60 -3
  208. package/dist/commands/task/finish.d.ts +10 -0
  209. package/dist/commands/task/finish.d.ts.map +1 -1
  210. package/dist/commands/task/finish.js +143 -0
  211. package/dist/commands/task/hosted-close-pr.command.d.ts +11 -0
  212. package/dist/commands/task/hosted-close-pr.command.d.ts.map +1 -0
  213. package/dist/commands/task/hosted-close-pr.command.js +414 -0
  214. package/dist/commands/task/hosted-close.command.d.ts.map +1 -1
  215. package/dist/commands/task/hosted-close.command.js +49 -1
  216. package/dist/commands/task/hosted-merge-sync.d.ts +38 -0
  217. package/dist/commands/task/hosted-merge-sync.d.ts.map +1 -1
  218. package/dist/commands/task/hosted-merge-sync.js +249 -17
  219. package/dist/commands/task/index.d.ts +1 -0
  220. package/dist/commands/task/index.d.ts.map +1 -1
  221. package/dist/commands/task/index.js +1 -0
  222. package/dist/commands/task/new.d.ts +1 -0
  223. package/dist/commands/task/new.d.ts.map +1 -1
  224. package/dist/commands/task/new.js +140 -30
  225. package/dist/commands/task/new.spec.d.ts.map +1 -1
  226. package/dist/commands/task/new.spec.js +7 -0
  227. package/dist/commands/task/normalize.command.d.ts +2 -0
  228. package/dist/commands/task/normalize.command.d.ts.map +1 -1
  229. package/dist/commands/task/normalize.command.js +45 -0
  230. package/dist/commands/task/normalize.d.ts +2 -0
  231. package/dist/commands/task/normalize.d.ts.map +1 -1
  232. package/dist/commands/task/normalize.js +85 -8
  233. package/dist/commands/task/plan.d.ts.map +1 -1
  234. package/dist/commands/task/plan.js +7 -10
  235. package/dist/commands/task/set-status.d.ts.map +1 -1
  236. package/dist/commands/task/set-status.js +1 -0
  237. package/dist/commands/task/shared/docs.d.ts +6 -0
  238. package/dist/commands/task/shared/docs.d.ts.map +1 -1
  239. package/dist/commands/task/shared/docs.js +14 -0
  240. package/dist/commands/task/shared/transition-command.d.ts +2 -0
  241. package/dist/commands/task/shared/transition-command.d.ts.map +1 -1
  242. package/dist/commands/task/shared/transition-command.js +1 -0
  243. package/dist/commands/task/shared/transitions.d.ts.map +1 -1
  244. package/dist/commands/task/shared/transitions.js +11 -1
  245. package/dist/commands/task/shared.d.ts +1 -1
  246. package/dist/commands/task/shared.d.ts.map +1 -1
  247. package/dist/commands/task/shared.js +1 -1
  248. package/dist/commands/task/start-ready.d.ts.map +1 -1
  249. package/dist/commands/task/start-ready.js +98 -1
  250. package/dist/commands/task/start.d.ts.map +1 -1
  251. package/dist/commands/task/start.js +18 -10
  252. package/dist/commands/task/task.command.d.ts.map +1 -1
  253. package/dist/commands/task/task.command.js +4 -0
  254. package/dist/commands/task/verify-command-shared.d.ts +19 -0
  255. package/dist/commands/task/verify-command-shared.d.ts.map +1 -1
  256. package/dist/commands/task/verify-command-shared.js +152 -1
  257. package/dist/commands/task/verify-ok.command.d.ts.map +1 -1
  258. package/dist/commands/task/verify-ok.command.js +15 -2
  259. package/dist/commands/task/verify-record.d.ts +36 -0
  260. package/dist/commands/task/verify-record.d.ts.map +1 -1
  261. package/dist/commands/task/verify-record.js +193 -11
  262. package/dist/commands/task/verify-rework.command.d.ts.map +1 -1
  263. package/dist/commands/task/verify-rework.command.js +15 -2
  264. package/dist/commands/task/verify-show.command.d.ts +1 -1
  265. package/dist/commands/task/verify-show.command.d.ts.map +1 -1
  266. package/dist/commands/task/verify-show.command.js +28 -1
  267. package/dist/commands/upgrade.d.ts.map +1 -1
  268. package/dist/commands/upgrade.js +6 -1
  269. package/dist/commands/verify.run.d.ts.map +1 -1
  270. package/dist/commands/verify.run.js +12 -0
  271. package/dist/commands/verify.spec.d.ts +2 -6
  272. package/dist/commands/verify.spec.d.ts.map +1 -1
  273. package/dist/commands/verify.spec.js +30 -3
  274. package/dist/policy/engine.d.ts +3 -1
  275. package/dist/policy/engine.d.ts.map +1 -1
  276. package/dist/policy/engine.js +5 -6
  277. package/dist/policy/taxonomy.d.ts +17 -0
  278. package/dist/policy/taxonomy.d.ts.map +1 -0
  279. package/dist/policy/taxonomy.js +302 -0
  280. package/dist/policy/types.d.ts +2 -1
  281. package/dist/policy/types.d.ts.map +1 -1
  282. package/dist/runner/artifacts.d.ts.map +1 -1
  283. package/dist/runner/artifacts.js +2 -0
  284. package/dist/runner/context/base-prompts.d.ts +25 -0
  285. package/dist/runner/context/base-prompts.d.ts.map +1 -1
  286. package/dist/runner/context/base-prompts.js +182 -54
  287. package/dist/runner/context/recipe-context.d.ts.map +1 -1
  288. package/dist/runner/context/recipe-context.js +5 -0
  289. package/dist/runner/types.d.ts +12 -0
  290. package/dist/runner/types.d.ts.map +1 -1
  291. package/dist/runner/usecases/scenario-materialize-task.d.ts.map +1 -1
  292. package/dist/runner/usecases/scenario-materialize-task.js +81 -11
  293. package/dist/runner/usecases/task-run-inspect.d.ts.map +1 -1
  294. package/dist/runner/usecases/task-run-inspect.js +9 -7
  295. package/dist/runner/usecases/task-run-lifecycle-shared.d.ts.map +1 -1
  296. package/dist/runner/usecases/task-run-lifecycle-shared.js +8 -6
  297. package/dist/runner/usecases/task-run.d.ts.map +1 -1
  298. package/dist/runner/usecases/task-run.js +59 -12
  299. package/dist/runtime/approvals/index.d.ts +3 -0
  300. package/dist/runtime/approvals/index.d.ts.map +1 -0
  301. package/dist/runtime/approvals/index.js +1 -0
  302. package/dist/runtime/approvals/runtime.d.ts +12 -0
  303. package/dist/runtime/approvals/runtime.d.ts.map +1 -0
  304. package/dist/runtime/approvals/runtime.js +154 -0
  305. package/dist/runtime/approvals/types.d.ts +31 -0
  306. package/dist/runtime/approvals/types.d.ts.map +1 -0
  307. package/dist/runtime/approvals/types.js +1 -0
  308. package/dist/runtime/behavior/index.d.ts +3 -0
  309. package/dist/runtime/behavior/index.d.ts.map +1 -0
  310. package/dist/runtime/behavior/index.js +1 -0
  311. package/dist/runtime/behavior/resolve.d.ts +7 -0
  312. package/dist/runtime/behavior/resolve.d.ts.map +1 -0
  313. package/dist/runtime/behavior/resolve.js +66 -0
  314. package/dist/runtime/behavior/types.d.ts +25 -0
  315. package/dist/runtime/behavior/types.d.ts.map +1 -0
  316. package/dist/runtime/behavior/types.js +1 -0
  317. package/dist/runtime/capabilities/backend.d.ts +7 -0
  318. package/dist/runtime/capabilities/backend.d.ts.map +1 -0
  319. package/dist/runtime/capabilities/backend.js +104 -0
  320. package/dist/runtime/capabilities/index.d.ts +6 -0
  321. package/dist/runtime/capabilities/index.d.ts.map +1 -0
  322. package/dist/runtime/capabilities/index.js +4 -0
  323. package/dist/runtime/capabilities/recipe.d.ts +10 -0
  324. package/dist/runtime/capabilities/recipe.d.ts.map +1 -0
  325. package/dist/runtime/capabilities/recipe.js +123 -0
  326. package/dist/runtime/capabilities/registry.d.ts +6 -0
  327. package/dist/runtime/capabilities/registry.d.ts.map +1 -0
  328. package/dist/runtime/capabilities/registry.js +69 -0
  329. package/dist/runtime/capabilities/runner.d.ts +8 -0
  330. package/dist/runtime/capabilities/runner.d.ts.map +1 -0
  331. package/dist/runtime/capabilities/runner.js +73 -0
  332. package/dist/runtime/capabilities/types.d.ts +28 -0
  333. package/dist/runtime/capabilities/types.d.ts.map +1 -0
  334. package/dist/runtime/capabilities/types.js +1 -0
  335. package/dist/runtime/execution-profile/index.d.ts +3 -0
  336. package/dist/runtime/execution-profile/index.d.ts.map +1 -0
  337. package/dist/runtime/execution-profile/index.js +1 -0
  338. package/dist/runtime/execution-profile/resolve.d.ts +9 -0
  339. package/dist/runtime/execution-profile/resolve.d.ts.map +1 -0
  340. package/dist/runtime/execution-profile/resolve.js +80 -0
  341. package/dist/runtime/execution-profile/types.d.ts +27 -0
  342. package/dist/runtime/execution-profile/types.d.ts.map +1 -0
  343. package/dist/runtime/execution-profile/types.js +1 -0
  344. package/dist/runtime/explain/index.d.ts +3 -0
  345. package/dist/runtime/explain/index.d.ts.map +1 -0
  346. package/dist/runtime/explain/index.js +1 -0
  347. package/dist/runtime/explain/resolve.d.ts +14 -0
  348. package/dist/runtime/explain/resolve.d.ts.map +1 -0
  349. package/dist/runtime/explain/resolve.js +50 -0
  350. package/dist/runtime/explain/types.d.ts +28 -0
  351. package/dist/runtime/explain/types.d.ts.map +1 -0
  352. package/dist/runtime/explain/types.js +1 -0
  353. package/dist/runtime/harness/index.d.ts +4 -0
  354. package/dist/runtime/harness/index.d.ts.map +1 -0
  355. package/dist/runtime/harness/index.js +2 -0
  356. package/dist/runtime/harness/resolve-from-command-context.d.ts +4 -0
  357. package/dist/runtime/harness/resolve-from-command-context.d.ts.map +1 -0
  358. package/dist/runtime/harness/resolve-from-command-context.js +11 -0
  359. package/dist/runtime/harness/resolve.d.ts +13 -0
  360. package/dist/runtime/harness/resolve.d.ts.map +1 -0
  361. package/dist/runtime/harness/resolve.js +146 -0
  362. package/dist/runtime/harness/types.d.ts +65 -0
  363. package/dist/runtime/harness/types.d.ts.map +1 -0
  364. package/dist/runtime/harness/types.js +1 -0
  365. package/dist/runtime/incidents/index.d.ts +3 -0
  366. package/dist/runtime/incidents/index.d.ts.map +1 -0
  367. package/dist/runtime/incidents/index.js +1 -0
  368. package/dist/runtime/incidents/resolve.d.ts +26 -0
  369. package/dist/runtime/incidents/resolve.d.ts.map +1 -0
  370. package/dist/runtime/incidents/resolve.js +683 -0
  371. package/dist/runtime/incidents/types.d.ts +84 -0
  372. package/dist/runtime/incidents/types.d.ts.map +1 -0
  373. package/dist/runtime/incidents/types.js +1 -0
  374. package/dist/runtime/protocol/index.d.ts +3 -0
  375. package/dist/runtime/protocol/index.d.ts.map +1 -0
  376. package/dist/runtime/protocol/index.js +2 -0
  377. package/dist/runtime/protocol/resolve.d.ts +16 -0
  378. package/dist/runtime/protocol/resolve.d.ts.map +1 -0
  379. package/dist/runtime/protocol/resolve.js +36 -0
  380. package/dist/runtime/protocol/types.d.ts +36 -0
  381. package/dist/runtime/protocol/types.d.ts.map +1 -0
  382. package/dist/runtime/protocol/types.js +1 -0
  383. package/dist/runtime/task-intake/index.d.ts +3 -0
  384. package/dist/runtime/task-intake/index.d.ts.map +1 -0
  385. package/dist/runtime/task-intake/index.js +1 -0
  386. package/dist/runtime/task-intake/resolve.d.ts +48 -0
  387. package/dist/runtime/task-intake/resolve.d.ts.map +1 -0
  388. package/dist/runtime/task-intake/resolve.js +316 -0
  389. package/dist/runtime/task-intake/types.d.ts +117 -0
  390. package/dist/runtime/task-intake/types.d.ts.map +1 -0
  391. package/dist/runtime/task-intake/types.js +1 -0
  392. package/dist/shared/env.d.ts +1 -0
  393. package/dist/shared/env.d.ts.map +1 -1
  394. package/dist/shared/env.js +22 -1
  395. package/dist/shared/protected-paths.d.ts +4 -0
  396. package/dist/shared/protected-paths.d.ts.map +1 -1
  397. package/dist/shared/protected-paths.js +8 -4
  398. package/dist/usecases/context/resolve-context.d.ts +55 -6
  399. package/dist/usecases/context/resolve-context.d.ts.map +1 -1
  400. package/dist/usecases/context/resolve-context.js +96 -6
  401. package/dist/usecases/task/task-list-usecase.d.ts.map +1 -1
  402. package/dist/usecases/task/task-list-usecase.js +8 -2
  403. package/dist/usecases/task/task-new-usecase.js +4 -4
  404. package/package.json +2 -2
package/assets/AGENTS.md CHANGED
@@ -17,7 +17,7 @@ Detailed procedures live in canonical modules from `## CANONICAL DOCS`.
17
17
  - Repository type: user project initialized with `agentplane`.
18
18
  - Gateway role: keep this file compact and deterministic; move scenario-specific details to policy modules.
19
19
  - CLI rule: use `agentplane` from `PATH`; if unavailable, stop and request installation guidance (do not invent repo-local entrypoints).
20
- - Startup shortcut: run `## COMMANDS -> Preflight`, then use `agentplane quickstart`; activate `agentplane role ORCHESTRATOR` for planning and `agentplane role <ROLE>` for the active owner before owner-scoped execution; then apply `## LOAD RULES` before any mutation. In this repository, `workflow_mode=branch_pr`, so the normal guarded route starts from `agentplane work start ... --worktree` on the base branch; treat `direct` as an explicit alternative only when intentionally selected.
20
+ - Startup shortcut: run `## COMMANDS -> Preflight`, then use `agentplane quickstart`; activate `agentplane role ORCHESTRATOR` for planning and `agentplane role <ROLE>` for the active owner before owner-scoped execution; then apply `## LOAD RULES` before any mutation. The guarded route is determined by `workflow_mode` in `.agentplane/config.json`; use `agentplane quickstart` as the canonical summary of the active path before mutating. In `branch_pr`, start from `agentplane work start ... --worktree`; in `direct`, stay in the current checkout and use the task lifecycle route.
21
21
 
22
22
  ---
23
23
 
@@ -84,6 +84,8 @@ agentplane finish <task-id> --author INTEGRATOR --body "Verified: ..." --result
84
84
  ```bash
85
85
  agentplane task verify-show <task-id>
86
86
  agentplane verify <task-id> --ok|--rework --by <ROLE> --note "..."
87
+ agentplane incidents advise <task-id>
88
+ agentplane incidents collect <task-id> --check
87
89
  agentplane doctor
88
90
  node .agentplane/policy/check-routing.mjs
89
91
  ```
@@ -207,5 +209,5 @@ Detailed DoD rules are in `.agentplane/policy/dod.core.md`, `.agentplane/policy/
207
209
  ## CHANGE CONTROL
208
210
 
209
211
  - Follow incident-log, immutability, and policy-budget rules in `.agentplane/policy/governance.md`.
210
- - Record situational incident rules only in `.agentplane/policy/incidents.md`; do not load/read that file during normal startup unless the task directly touches it or recovery/incident handling requires it.
212
+ - Record situational incident rules only in `.agentplane/policy/incidents.md`; use targeted lookup/promotion (`task start-ready`, `incidents advise`, `incidents collect`, `finish`) instead of bulk-loading it during normal startup.
211
213
  - Keep `AGENTS.md` as a gateway; move detailed procedures to canonical modules.
@@ -24,7 +24,7 @@
24
24
  "Document edits with exact file paths and concise before/after rationale.",
25
25
  "Run the smallest sufficient local commands (tests/linters/formatters) and summarize only the output lines that change a decision.",
26
26
  "Prefer declared verify commands; treat `Verify Steps` as the acceptance contract and request PLANNER updates when the contract itself drifts.",
27
- "Record local deviations, follow-ups, and incident candidates in the task-local observation section (`Notes` for v2, `Findings` for v3); do not promote directly into policy incidents.",
27
+ "Record local deviations, follow-ups, and incident candidates in the task-local observation section (`Notes` for v2, `Findings` for v3); use structured `incident-candidate` blocks for external/unfixable-in-repo incidents and let `finish` or `agentplane incidents collect` promote them.",
28
28
  "Separate confirmed facts, inferred risks, and open questions in handoff summaries.",
29
29
  "Coordinate handoffs to TESTER/REVIEWER/DOCS only when those roles already have explicit executable tasks; otherwise keep findings and verification in the same task.",
30
30
  "Avoid task closure in branch_pr; keep commits task-scoped and update status via agentplane."
@@ -34,7 +34,7 @@ Target `doc_version=3` tasks use:
34
34
  - `Rollback Plan`
35
35
  - `Findings`
36
36
 
37
- `Findings` is task-local. Policy incidents are curated separately in `.agentplane/policy/incidents.md`.
37
+ `Findings` is task-local. Reusable external incident advice stays there first, then is promoted into `.agentplane/policy/incidents.md` through `finish` or `agentplane incidents collect <task-id>`.
38
38
 
39
39
  ## Material drift criteria
40
40
 
@@ -5,13 +5,15 @@
5
5
  - `.agentplane/policy/incidents.md` is the single incident registry.
6
6
  - Incident-derived and situational rules MUST be added only to `incidents.md`.
7
7
  - MUST NOT create additional incident policy files under `.agentplane/policy/`.
8
+ - New reusable operational incidents SHOULD be promoted from task `Findings` via `agentplane finish` or `agentplane incidents collect <task-id>`.
9
+ - Auto-promotion is reserved for resolved reusable findings marked `Fixability: external` or `Fixability: repo-fixable` (or the compatibility markers `IncidentExternal: true` / `IncidentInternal: true`); optional `IncidentScope`, `IncidentAdvice`, `IncidentRule`, `IncidentTags`, and `IncidentMatch` fields override the inferred registry entry when needed.
10
+ - Normal startup MUST NOT bulk-load `incidents.md`; targeted lookup for analogous work is allowed through `task start-ready` and `agentplane incidents advise`.
8
11
 
9
12
  ## Stabilization criteria
10
13
 
11
- Use `stabilized` only when one of these is true:
14
+ Use `stabilized` only when the same failure class recurs at least 2 times in 30 days.
12
15
 
13
- 1. The same failure class recurs at least 2 times in 30 days.
14
- 2. A single Sev-1 / production-blocking failure has reproducible steps and evidence.
16
+ First auto-promoted external incidents may stay `open`, but targeted advice lookup is still allowed to use them so analogous work can reuse the recovery guidance before the second recurrence.
15
17
 
16
18
  Promotion from `incidents.md` into canonical policy modules is allowed only when:
17
19
 
@@ -1,79 +1,21 @@
1
1
  # Policy Incidents Log
2
2
 
3
- This is the single file for incident-derived and situational policy rules.
4
-
5
- ## Entry contract
6
-
7
- - Add entries append-only.
8
- - Every entry MUST include: `id`, `date`, `scope`, `failure`, `rule`, `evidence`, `enforcement`, `state`.
9
- - `rule` MUST be concrete and testable (`MUST` / `MUST NOT`).
10
- - `state` values: `open`, `stabilized`, `promoted`.
11
-
12
- ## Entry template
13
-
14
- - id: `INC-YYYYMMDD-NN`
15
- - date: `YYYY-MM-DD`
16
- - scope: `<affected scope>`
17
- - failure: `<observed failure mode>`
18
- - rule: `<new or refined MUST/MUST NOT>`
19
- - evidence: `<task ids / logs / links>`
20
- - enforcement: `<CI|test|lint|script|manual>`
21
- - state: `<open|stabilized|promoted>`
22
-
23
- <!-- example:start
24
- - id: INC-20260305-01
25
- - date: 2026-03-05
26
- - scope: commit-msg hook in repo development mode
27
- - failure: commit-msg rejected valid commits because stale-dist check blocked src_dirty/git_head_changed
28
- - rule: commit-msg MUST validate subject semantics and MUST NOT block on stale dist freshness checks
29
- - evidence: task 20260305-HOOKS-FIX, commit 9fe55c73
30
- - enforcement: test + hook script
31
- - state: open
32
- example:end -->
33
-
34
- ## Entries
35
-
36
- - id: INC-20260308-01
37
- date: 2026-03-08
38
- scope: release apply internal push path
39
- failure: release apply re-entered local pre-push hooks and could stall after creating the local release commit and tag
40
- rule: Release orchestration MUST push its own release refs without recursively re-entering local pre-push hooks.
41
- evidence: task 202603061532-9Y41NM; docs/developer/cli-bug-ledger-v0-3-x.mdx entry 4
42
- enforcement: test + command implementation
43
- state: stabilized
44
-
45
- - id: INC-20260308-02
46
- date: 2026-03-08
47
- scope: stale-dist guard in framework checkout
48
- failure: stale-dist enforcement treated git dirtiness as stale runtime and blocked diagnostics or rebuilt checkouts incorrectly
49
- rule: Stale-dist freshness MUST compare current runtime inputs against the recorded build snapshot, and read-only diagnostics MUST warn-and-run instead of hard-failing on dirty runtime trees.
50
- evidence: tasks 202603072032-2M0V8V, 202603072032-1BC7VQ, 202603072032-V9VGT2, 202603072032-4D9ASG
51
- enforcement: test + runtime guard
52
- state: stabilized
53
-
54
- - id: INC-20260308-03
55
- date: 2026-03-08
56
- scope: framework checkout PATH resolution
57
- failure: contributors inside the framework repo could execute an older global agentplane binary instead of the checkout they were editing
58
- rule: Inside the framework checkout, agentplane resolved from PATH MUST hand off to the repo-local runtime by default unless an explicit global opt-out is set.
59
- evidence: tasks 202603071647-M0Q79C, 202603071647-Y4BZ1T, 202603071647-25WS52
60
- enforcement: test + wrapper logic
61
- state: stabilized
62
-
63
- - id: INC-20260308-04
64
- date: 2026-03-08
65
- scope: release mutation generated surfaces
66
- failure: release apply could leave version-sensitive generated docs stale until later parity checks failed
67
- rule: Release mutation MUST regenerate and stage generated docs that encode released package versions as part of the release commit itself.
68
- evidence: task 202603071745-T3QE04; docs/developer/cli-bug-ledger-v0-3-x.mdx entry 5
69
- enforcement: test + release mutation
70
- state: stabilized
71
-
72
- - id: INC-20260308-05
73
- date: 2026-03-08
74
- scope: release mutation repository CLI expectation
75
- failure: repository-owned framework.cli.expected_version could drift behind the actual released version because release apply did not persist it
76
- rule: Release mutation MUST keep framework.cli.expected_version aligned with the released package version whenever repository config is present.
77
- evidence: tasks 202603081315-Y4D6AE, 202603081538-GF7P9C; docs/developer/cli-bug-ledger-v0-3-x.mdx entry 3
78
- enforcement: test + release mutation
79
- state: stabilized
3
+ - Append-only. Required fields: `id`, `date`, `scope`, `failure`, `rule`, `evidence`, `enforcement`, `state`; optional: `tags`, `match`, `advice`, `source_task`, `fixability`.
4
+ - id: INC-20260308-01 | date: 2026-03-08 | scope: release apply internal push path | failure: release apply re-entered local pre-push hooks and could stall after creating the local release commit and tag | rule: Release orchestration MUST push its own release refs without recursively re-entering local pre-push hooks. | evidence: task 202603061532-9Y41NM; docs/developer/cli-bug-ledger-v0-3-x.mdx entry 4 | enforcement: test + command implementation | state: stabilized
5
+ - id: INC-20260308-02 | date: 2026-03-08 | scope: stale-dist guard in framework checkout | failure: stale-dist enforcement treated git dirtiness as stale runtime and blocked diagnostics or rebuilt checkouts incorrectly | rule: Stale-dist freshness MUST compare current runtime inputs against the recorded build snapshot, and read-only diagnostics MUST warn-and-run instead of hard-failing on dirty runtime trees. | evidence: tasks 202603072032-2M0V8V, 202603072032-1BC7VQ, 202603072032-V9VGT2, 202603072032-4D9ASG | enforcement: test + runtime guard | state: stabilized
6
+ - id: INC-20260308-03 | date: 2026-03-08 | scope: framework checkout PATH resolution | failure: contributors inside the framework repo could execute an older global agentplane binary instead of the checkout they were editing | rule: Inside the framework checkout, agentplane resolved from PATH MUST hand off to the repo-local runtime by default unless an explicit global opt-out is set. | evidence: tasks 202603071647-M0Q79C, 202603071647-Y4BZ1T, 202603071647-25WS52 | enforcement: test + wrapper logic | state: stabilized
7
+ - id: INC-20260308-04 | date: 2026-03-08 | scope: release mutation generated surfaces | failure: release apply could leave version-sensitive generated docs stale until later parity checks failed | rule: Release mutation MUST regenerate and stage generated docs that encode released package versions as part of the release commit itself. | evidence: task 202603071745-T3QE04; docs/developer/cli-bug-ledger-v0-3-x.mdx entry 5 | enforcement: test + release mutation | state: stabilized
8
+ - id: INC-20260308-05 | date: 2026-03-08 | scope: release mutation repository CLI expectation | failure: repository-owned framework.cli.expected_version could drift behind the actual released version because release apply did not persist it | rule: Release mutation MUST keep framework.cli.expected_version aligned with the released package version whenever repository config is present. | evidence: tasks 202603081315-Y4D6AE, 202603081538-GF7P9C; docs/developer/cli-bug-ledger-v0-3-x.mdx entry 3 | enforcement: test + release mutation | state: stabilized
9
+ - id: INC-20260407-01 | date: 2026-04-07 | scope: branch_pr GitHub transport helpers | failure: GitHub transport intermittently failed with GraphQL EOF, TLS handshake errors, and SSL_ERROR_SYSCALL during PR creation, remote-check waiting, and reconcile helpers | advice: treat transient GitHub transport failures as retriable, prefer bounded polling or REST fallbacks over single-shot watch flows, and surface auth or usage failures immediately | rule: GitHub-dependent workflow helpers MUST classify EOF/TLS/SSL transport failures as transient and retry with bounded backoff; they MUST surface auth and usage failures immediately instead of looping or failing opaquely. | evidence: tasks 202604062101-XYXG7Y, 202604062309-QE4CX6, 202604050745-18JJ5E | enforcement: test + workflow helper | state: open
10
+ - id: INC-20260407-02 | date: 2026-04-07 | scope: protected-main branch_pr closure permissions | failure: hosted branch_pr closure could not create follow-up PRs when the GitHub App or Actions token lacked PR creation rights, leaving manual closure tails after the task PR was already merged | advice: preserve deterministic closure metadata in task artifacts and complete the closure PR from an authenticated local session when hosted automation lacks create-PR permission | rule: Protected-main branch_pr closure MUST preserve enough task metadata for deterministic manual reconciliation when hosted automation cannot create the closure PR due to external GitHub permission limits. | evidence: tasks 202604032235-G375FB, 202604050745-18JJ5E, 202604062153-RSJFC2 | enforcement: manual + workflow | state: open
11
+ - id: INC-20260407-03 | date: 2026-04-07 | scope: task findings incident promotion | failure: Structured findings needed hidden promote/external flags before incidents collection could see them. | advice: Use task findings add defaults for reusable incident candidates; use --local-only only for task-scoped notes. | rule: Structured findings intended as reusable workflow advice MUST promote by default; task-local-only notes MUST opt out explicitly with --local-only. | evidence: task 202604070754-ZD0ZAZ | enforcement: manual | state: open
12
+ - id: INC-20260407-04 | date: 2026-04-07 | scope: task normalize hosted reconcile target selection | failure: GitHub EOF or TLS transport failures during hosted branch_pr reconcile could abort task normalize before it reached the known stale task because the command scanned every candidate task. | advice: When GitHub transport is flaky, reconcile only the known task ids instead of scanning the full branch_pr history. | rule: Hosted reconcile commands MUST support explicit task-id scoping so known drift can be resolved without depending on unrelated GitHub lookups. | evidence: task 202604071853-XGX2YJ; commit 5fd312cceb20 | enforcement: manual | state: open
13
+ - id: INC-20260409-01 | date: 2026-04-09 | scope: branch_pr work-start base task README cleanup | failure: work start --worktree left untracked .agentplane/tasks/<task-id>/README.md copies in the base checkout and later git pull could block once upstream tracked the same paths | rule: branch_pr work start MUST remove base-checkout task README copies that were only materialized for the worktree, while keeping the worktree-local copies intact. | evidence: task 202604081931-77V6J5 | enforcement: test + command implementation | state: stabilized
14
+ - id: INC-20260409-02 | date: 2026-04-09 | scope: branch_pr follow-up orchestration helpers | match: branch_pr, integrate, pr artifacts, pr meta, wait-remote-checks, remote checks, multi pr | failure: integrate recovery assumed PR artifacts already existed and the remote-check wait helper only accepted one PR target, forcing manual base-side hydration and serial closure-wave waiting. | advice: keep integrate able to recover PR metadata without a pre-hydrated base checkout and let remote-check waiting accept explicit PR batches during closure waves. | rule: branch_pr follow-up helpers MUST recover missing PR artifacts from available branch or hosted metadata and MUST accept explicit multi-PR batches so integrate and remote-check waiting stay runnable during closure waves. | evidence: tasks 202604091136-SR7Z25, 202604091136-V5N3P8; fixes 202604091218-WWSX2G, 202604091218-8S07FZ | enforcement: test + command implementation | state: open
15
+ - id: INC-20260409-03 | date: 2026-04-09 | scope: Make branch_pr hosted-merge reconcile and task normalize resolve GitHub auth from the user's existing gh login, without requiring a manual GH_TOKEN export in the shell. | tags: code, github, workflow | match: code, github, workflow, make, branch, hosted, merge, reconcile, and, task, normalize, resolve, auth, from, the, user | failure: Repo dotenv loading could inject GITHUB_TOKEN into gh subprocesses and override a valid gh keyring session during hosted merge sync. | advice: Track auth vars loaded only from repo dotenv and strip them from gh child env, while preserving explicit shell or CI auth tokens and HOME-based gh sessions. | rule: Analogous Make branch_pr hosted-merge reconcile and task normalize resolve GitHub auth from the user's existing gh login, without requiring a manual GH_TOKEN export in the shell. work MUST review and apply the recorded external incident advice before retrying. | evidence: task 202604091841-2ZX1MQ; commit 3f71884dad3e | enforcement: manual | fixability: external | state: open
16
+ - id: INC-20260409-04 | date: 2026-04-09 | scope: Make merged branch_pr tasks land in tracked main history as DONE with reconciled PR metadata, so pulling origin/main does not reopen them as DOING or require local normalize dirt. | tags: code, tasks, workflow | match: code, tasks, workflow, make, merged, branch, land, tracked, main, history, done, with, reconciled, metadata, pulling, origin | failure: Hosted-close recovery had to be driven one task at a time even when multiple remote task-close branches were already waiting, so merged tasks stayed DOING on main longer than necessary. | advice: Allow task hosted-close-pr to accept multiple task ids in one invocation so closure PR batches can be materialized deterministically from the existing remote task-close branches. | rule: Analogous Make merged branch_pr tasks land in tracked main history as DONE with reconciled PR metadata, so pulling origin/main does not reopen them as DOING or require local normalize dirt. work MUST review and apply the recorded external incident advice before retrying. | evidence: task 202604091841-PX5WAV | enforcement: manual | fixability: external | state: open
17
+ - id: INC-20260409-05 | date: 2026-04-09 | scope: branch_pr verify/finish incident no-op messaging | tags: incidents, workflow, ux | match: incidents, workflow, ux, branch, verify, finish, incident, messaging, explain, registry, outcome, explicitly, and, operators, still, misread | failure: Lifecycle no-op output for verify and finish looked indistinguishable from a broken incidents pipeline, so operators could not tell when incidents.md stayed unchanged only because the note/body was plain text. | advice: Print context-specific verify and finish messages that explicitly name incidents.md, explain that plain notes stay task-local, and point operators at observation/impact/resolution fields or explicit collection on base. | rule: Analogous branch_pr verify/finish incident no-op messaging work MUST review and apply the recorded external incident advice before retrying. | evidence: task 202604092105-RF8TWW | enforcement: manual | fixability: repo-fixable | state: open
18
+ - id: INC-20260410-01 | date: 2026-04-10 | scope: Preflight hides cross-task workflow artifact drift when tracked status looks clean. | tags: workflow, git, ux, code | match: workflow, git, ux, code, preflight, hides, cross, task, artifact, drift, when, tracked, status, looks, clean, expose | failure: Preflight could report a tracked-clean working tree while untracked .agentplane/tasks artifacts from other task ids were still present and capable of breaking later integrate or close flows. | advice: Preflight now inspects full changed paths under the workflow task directory, reports task artifact drift explicitly in JSON/text output, and points operators at git status --short --untracked-files=all -- .agentplane/tasks. | rule: Analogous Preflight hides cross-task workflow artifact drift when tracked status looks clean. work MUST review and apply the recorded external incident advice before retrying. | evidence: task 202604100023-MFGFK9; commit a2b9ccf1e12e | enforcement: manual | fixability: repo-fixable | state: open
19
+ - id: INC-20260410-02 | date: 2026-04-10 | scope: Integrate leaves framework runtime stale after watched-source merges. | tags: workflow, runtime, git, code | match: workflow, runtime, git, code, integrate, leaves, framework, stale, after, watched, source, merges, auto, bootstrap, touches, sources | failure: Base-side integrate could land watched runtime source changes in the framework checkout, but the repo-local runtime stayed stale until the operator manually ran framework bootstrap before finish closeout. | advice: Integrate now auto-runs bun run framework:dev:bootstrap in framework checkouts when watched runtime sources changed, and falls back to explicit manual guidance only if the refresh fails. | rule: Analogous Integrate leaves framework runtime stale after watched-source merges. work MUST review and apply the recorded external incident advice before retrying. | evidence: task 202604100023-EVJWDM; commit 0f4d2f9a92e0 | enforcement: manual | fixability: repo-fixable | state: open
20
+ - id: INC-20260410-03 | date: 2026-04-10 | scope: Integrate currently can apply task code onto the base branch and only then discover that the task branch never committed .agentplane/tasks/<task-id>/pr artifacts. Validate the branch-backed task/PR artifact set before any merge-side mutation so base never advances when closeout metadata is absent. | tags: code, workflow | match: code, workflow, integrate, currently, can, apply, task, onto, the, base, branch, and, only, then, discover, that | failure: Integrate validated task/PR metadata too late: a task branch could omit committed .agentplane/tasks/<task-id>/pr artifacts and still reach merge-side mutation before failing. | advice: Added committed-artifact validation before merge-side mutation, covered the missing-artifact and post-merge-removal regressions, and updated prepare.test mocks for the new contract. | rule: Analogous Integrate currently can apply task code onto the base branch and only then discover that the task branch never committed .agentplane/tasks/<task-id>/pr artifacts. Validate the branch-backed task/PR artifact set before any merge-side mutation so base never advances when closeout metadata is absent. work MUST review and apply the recorded external incident advice before retrying. | evidence: task 202604100213-MVAGSD | enforcement: manual | fixability: external | state: open
21
+ - id: INC-20260410-04 | date: 2026-04-10 | scope: Verify-required task scaffolds currently seed a placeholder Verify Steps block that immediately fails plan approval. Generate concrete acceptance steps from the primary tag and any explicit verify commands so a freshly scaffolded task is reviewable without manual README surgery. | tags: code, workflow | match: code, workflow, verify, required, task, scaffolds, currently, seed, placeholder, steps, block, that, immediately, fails, plan, approval | failure: Verify-required task scaffolds could seed a placeholder Verify Steps block when no explicit verify command was supplied, so plan approval failed on a fresh task before any human refinement. | advice: Removed the placeholder path for verify-required scaffolds without explicit verify commands, updated warning text to reflect concrete seeded acceptance steps, and added regression coverage for task new, task derive, and plan approve. | rule: Analogous Verify-required task scaffolds currently seed a placeholder Verify Steps block that immediately fails plan approval. Generate concrete acceptance steps from the primary tag and any explicit verify commands so a freshly scaffolded task is reviewable without manual README surgery. work MUST review and apply the recorded external incident advice before retrying. | evidence: task 202604100213-1AAPW1 | enforcement: manual | fixability: external | state: open
@@ -29,6 +29,8 @@ agentplane finish <task-id> --author INTEGRATOR --body "Verified: ..." --result
29
29
  - MUST NOT perform mutating actions before explicit user approval.
30
30
  - Task documentation updates MAY be batched within one turn before approval.
31
31
  - MUST run `task plan approve` then `task start-ready` as `Step 1 -> wait -> Step 2` (never parallel).
32
+ - `task start-ready` MAY surface targeted incident advice for analogous scope/tags; follow it before widening scope.
33
+ - Keep structured resolved external findings in the task README; mark reusable ones with `Fixability: external` (or `IncidentExternal: true`) and let base-branch `finish` or `agentplane incidents collect <task-id>` promote them into `.agentplane/policy/incidents.md`, using optional `Incident*` fields only when the inferred scope/advice needs refinement. Plain `Findings` text remains task-local and does not update the shared incident registry.
32
34
  - MUST stop and request re-approval on material drift.
33
35
  - Planning and closure happen on base checkout.
34
36
  - Do not export task snapshots from task branches.
@@ -38,14 +38,16 @@ If any step fails:
38
38
  - `doc_version=3`: task `Findings`
39
39
  3. Mark task blocked: `agentplane block <task-id> --author <ROLE> --body "Blocked: ..."`.
40
40
  4. Request re-approval before scope/risk changes.
41
- 5. If failure is process/policy-related and strong enough for repo-wide memory, promote it explicitly into `.agentplane/policy/incidents.md`.
41
+ 5. If failure is external/process-related and should become reusable advice, record a structured `Observation` / `Impact` / `Resolution` block in `Findings` and mark it with `Fixability: external` (or `IncidentExternal: true`); plain prose in `Findings` stays task-local and does not update `.agentplane/policy/incidents.md`.
42
42
 
43
43
  ## Constraints
44
44
 
45
45
  - MUST NOT perform mutating actions before explicit user approval.
46
46
  - Task documentation updates MAY be batched within one turn before approval.
47
47
  - MUST run `task plan approve` then `task start-ready` as `Step 1 -> wait -> Step 2` (never parallel).
48
+ - `task start-ready` MAY surface targeted incident advice for analogous scope/tags; follow it before widening scope.
48
49
  - In direct mode, `finish` auto-creates the deterministic close commit by default; use `--no-close-commit` only for explicit manual handling.
50
+ - `finish` evaluates structured resolved external findings, auto-derives incident advice when only `Observation` / `Impact` / `Resolution` plus `Fixability: external` are present, and appends valid entries to `.agentplane/policy/incidents.md`; plain `Findings` text remains task-local.
49
51
  - MUST stop and request re-approval on material drift.
50
52
  - Do not use worktrees in direct mode.
51
53
  - Do not perform `branch_pr`-only operations.
package/bin/agentplane.js CHANGED
@@ -2,6 +2,7 @@
2
2
  import { spawnSync } from "node:child_process";
3
3
  import path from "node:path";
4
4
  import { stat } from "node:fs/promises";
5
+ import { createRequire } from "node:module";
5
6
  import { fileURLToPath } from "node:url";
6
7
  import { distExists, isPackageBuildFresh } from "./dist-guard.js";
7
8
  import {
@@ -122,6 +123,42 @@ function isHooksRunCommitMsgInvocation(argv) {
122
123
  return false;
123
124
  }
124
125
 
126
+ function renderStalePolicyWarning(reason) {
127
+ if (reason === "task_artifact_mutation") {
128
+ return "warning: allowing task-artifact lifecycle command to run with a stale repo build inside the framework checkout.\n";
129
+ }
130
+ return "warning: allowing read-only diagnostic command to run with a stale repo build inside the framework checkout.\n";
131
+ }
132
+
133
+ function missingRepoRuntimeDependencies(agentplaneRoot) {
134
+ const requireFromAgentplane = createRequire(path.join(agentplaneRoot, "package.json"));
135
+ let packageJson = null;
136
+ try {
137
+ packageJson = requireFromAgentplane("./package.json");
138
+ } catch {
139
+ return [];
140
+ }
141
+ const declaredDeps = {};
142
+ if (packageJson?.dependencies && typeof packageJson.dependencies === "object") {
143
+ Object.assign(declaredDeps, packageJson.dependencies);
144
+ }
145
+ if (packageJson?.optionalDependencies && typeof packageJson.optionalDependencies === "object") {
146
+ Object.assign(declaredDeps, packageJson.optionalDependencies);
147
+ }
148
+ if (!("@agentplaneorg/core" in declaredDeps)) {
149
+ return [];
150
+ }
151
+ const requiredSpecifiers = ["@agentplaneorg/core"];
152
+ return requiredSpecifiers.filter((specifier) => {
153
+ try {
154
+ requireFromAgentplane.resolve(specifier);
155
+ return false;
156
+ } catch {
157
+ return true;
158
+ }
159
+ });
160
+ }
161
+
125
162
  async function assertDistUpToDate() {
126
163
  const here = path.dirname(fileURLToPath(import.meta.url));
127
164
  const agentplaneRoot = path.resolve(here, "..");
@@ -144,6 +181,24 @@ async function assertDistUpToDate() {
144
181
  return false;
145
182
  }
146
183
 
184
+ const missingDeps = missingRepoRuntimeDependencies(agentplaneRoot);
185
+ if (missingDeps.length > 0) {
186
+ process.stderr.write(
187
+ "error: repo-local runtime dependencies are missing for this framework checkout.\n" +
188
+ "This worktree is not bootstrapped yet.\n" +
189
+ "Missing module resolution:\n" +
190
+ missingDeps.map((specifier) => ` ${specifier}\n`).join("") +
191
+ "Fix:\n" +
192
+ ` ${FRAMEWORK_DEV_BOOTSTRAP_COMMAND}\n` +
193
+ "Manual fallback:\n" +
194
+ FRAMEWORK_DEV_MANUAL_REPAIR_COMMANDS.map((command) => ` ${command}\n`).join("") +
195
+ "Supported global override when you intentionally want the installed binary:\n" +
196
+ ` ${FRAMEWORK_DEV_FORCE_GLOBAL_EXAMPLE}\n`,
197
+ );
198
+ process.exitCode = 2;
199
+ return false;
200
+ }
201
+
147
202
  const repoRoot = path.resolve(agentplaneRoot, "..", "..");
148
203
  const coreRoot = path.join(repoRoot, "packages", "core");
149
204
  const checks = [
@@ -193,7 +248,7 @@ async function assertDistUpToDate() {
193
248
  .filter(Boolean)
194
249
  .join(" ");
195
250
  process.stderr.write(
196
- "warning: allowing read-only diagnostic command to run with a stale repo build inside the framework checkout.\n" +
251
+ renderStalePolicyWarning(commandPolicy.reason) +
197
252
  `command: ${commandText || "<unknown>"}\n` +
198
253
  `detected: ${staleReasons.join(", ")}\n` +
199
254
  "rebuild recommended:\n" +
@@ -23,6 +23,7 @@ export function isRuntimeRelevantWatchedFile(filePath) {
23
23
  if (!inSourceTree) return true;
24
24
  if (normalized.includes("/__snapshots__/")) return false;
25
25
  const baseName = path.posix.basename(normalized);
26
+ if (baseName.startsWith(".")) return false;
26
27
  return !/\.(?:test)\.[cm]?[jt]sx?$/u.test(baseName);
27
28
  }
28
29
 
@@ -1,6 +1,6 @@
1
1
  export type StaleDistPolicy = {
2
2
  mode: "warn_and_run" | "strict";
3
- reason: "read_only_diagnostic" | "default";
3
+ reason: "read_only_diagnostic" | "task_artifact_mutation" | "default";
4
4
  };
5
5
 
6
6
  export function classifyStaleDistPolicy(argv?: string[]): StaleDistPolicy;
@@ -38,6 +38,16 @@ function isPreflightCommand(args) {
38
38
  return args[0] === "preflight";
39
39
  }
40
40
 
41
+ function isTaskArtifactMutationCommand(args) {
42
+ if (args[0] === "verify") return true;
43
+ if (args[0] === "finish") return true;
44
+ if (args[0] !== "task") return false;
45
+ if (args[1] === "doc" && args[2] === "set") return true;
46
+ if (args[1] === "plan" && ["set", "approve", "reject"].includes(args[2] ?? "")) return true;
47
+ if (args[1] === "start-ready") return true;
48
+ return args[1] === "verify" && ["ok", "rework"].includes(args[2] ?? "");
49
+ }
50
+
41
51
  export function classifyStaleDistPolicy(argv = process.argv) {
42
52
  const args = normalizeArgs(argv);
43
53
  if (
@@ -52,5 +62,8 @@ export function classifyStaleDistPolicy(argv = process.argv) {
52
62
  ) {
53
63
  return { mode: "warn_and_run", reason: "read_only_diagnostic" };
54
64
  }
65
+ if (isTaskArtifactMutationCommand(args)) {
66
+ return { mode: "warn_and_run", reason: "task_artifact_mutation" };
67
+ }
55
68
  return { mode: "strict", reason: "default" };
56
69
  }