agentplane 0.3.2 → 0.3.3

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 (190) hide show
  1. package/assets/AGENTS.md +1 -1
  2. package/assets/agents/CODER.json +4 -3
  3. package/assets/agents/DOCS.json +1 -1
  4. package/assets/agents/INTEGRATOR.json +1 -1
  5. package/assets/agents/ORCHESTRATOR.json +1 -0
  6. package/assets/agents/PLANNER.json +1 -0
  7. package/assets/agents/TESTER.json +3 -1
  8. package/assets/policy/dod.code.md +2 -2
  9. package/assets/policy/dod.core.md +16 -2
  10. package/assets/policy/dod.docs.md +2 -2
  11. package/assets/policy/incidents.md +44 -1
  12. package/assets/policy/workflow.direct.md +8 -4
  13. package/bin/agentplane.js +59 -9
  14. package/bin/dist-guard.js +78 -10
  15. package/bin/runtime-context.d.ts +3 -0
  16. package/bin/runtime-context.js +13 -0
  17. package/bin/runtime-watch.d.ts +26 -0
  18. package/bin/runtime-watch.js +116 -0
  19. package/bin/stale-dist-policy.d.ts +6 -0
  20. package/bin/stale-dist-policy.js +44 -0
  21. package/dist/.build-manifest.json +2480 -5
  22. package/dist/backends/task-backend/local-backend.d.ts.map +1 -1
  23. package/dist/backends/task-backend/local-backend.js +9 -12
  24. package/dist/backends/task-backend/redmine-backend.d.ts.map +1 -1
  25. package/dist/backends/task-backend/redmine-backend.js +23 -18
  26. package/dist/backends/task-backend/shared/constants.d.ts +1 -0
  27. package/dist/backends/task-backend/shared/constants.d.ts.map +1 -1
  28. package/dist/backends/task-backend/shared/constants.js +1 -0
  29. package/dist/backends/task-backend/shared/doc.d.ts +1 -0
  30. package/dist/backends/task-backend/shared/doc.d.ts.map +1 -1
  31. package/dist/backends/task-backend/shared/doc.js +4 -1
  32. package/dist/backends/task-backend/shared/export.js +3 -3
  33. package/dist/cli/bootstrap-guide.d.ts +1 -3
  34. package/dist/cli/bootstrap-guide.d.ts.map +1 -1
  35. package/dist/cli/bootstrap-guide.js +13 -33
  36. package/dist/cli/command-guide.d.ts.map +1 -1
  37. package/dist/cli/command-guide.js +27 -34
  38. package/dist/cli/run-cli/catalog.d.ts +7 -0
  39. package/dist/cli/run-cli/catalog.d.ts.map +1 -0
  40. package/dist/cli/run-cli/catalog.js +22 -0
  41. package/dist/cli/run-cli/command-catalog.d.ts +1 -1
  42. package/dist/cli/run-cli/command-catalog.d.ts.map +1 -1
  43. package/dist/cli/run-cli/command-catalog.js +11 -0
  44. package/dist/cli/run-cli/commands/init/write-config.d.ts.map +1 -1
  45. package/dist/cli/run-cli/commands/init/write-config.js +2 -0
  46. package/dist/cli/run-cli/commands/init.js +5 -14
  47. package/dist/cli/run-cli/error-guidance.d.ts +9 -0
  48. package/dist/cli/run-cli/error-guidance.d.ts.map +1 -0
  49. package/dist/cli/run-cli/error-guidance.js +180 -0
  50. package/dist/cli/run-cli/globals.d.ts +22 -0
  51. package/dist/cli/run-cli/globals.d.ts.map +1 -0
  52. package/dist/cli/run-cli/globals.js +197 -0
  53. package/dist/cli/run-cli/update-warning.d.ts +6 -0
  54. package/dist/cli/run-cli/update-warning.d.ts.map +1 -0
  55. package/dist/cli/run-cli/update-warning.js +64 -0
  56. package/dist/cli/run-cli.d.ts.map +1 -1
  57. package/dist/cli/run-cli.js +5 -476
  58. package/dist/cli/spec/docs-render.d.ts.map +1 -1
  59. package/dist/cli/spec/docs-render.js +14 -1
  60. package/dist/commands/doctor/archive.d.ts +4 -0
  61. package/dist/commands/doctor/archive.d.ts.map +1 -0
  62. package/dist/commands/doctor/archive.js +211 -0
  63. package/dist/commands/doctor/fixes.d.ts +9 -0
  64. package/dist/commands/doctor/fixes.d.ts.map +1 -0
  65. package/dist/commands/doctor/fixes.js +40 -0
  66. package/dist/commands/doctor/layering.d.ts +2 -0
  67. package/dist/commands/doctor/layering.d.ts.map +1 -0
  68. package/dist/commands/doctor/layering.js +87 -0
  69. package/dist/commands/doctor/runtime.d.ts +4 -0
  70. package/dist/commands/doctor/runtime.d.ts.map +1 -0
  71. package/dist/commands/doctor/runtime.js +56 -0
  72. package/dist/commands/doctor/workflow.d.ts +6 -0
  73. package/dist/commands/doctor/workflow.d.ts.map +1 -0
  74. package/dist/commands/doctor/workflow.js +62 -0
  75. package/dist/commands/doctor/workspace.d.ts +2 -0
  76. package/dist/commands/doctor/workspace.d.ts.map +1 -0
  77. package/dist/commands/doctor/workspace.js +165 -0
  78. package/dist/commands/doctor.run.d.ts.map +1 -1
  79. package/dist/commands/doctor.run.js +16 -342
  80. package/dist/commands/doctor.spec.d.ts +1 -0
  81. package/dist/commands/doctor.spec.d.ts.map +1 -1
  82. package/dist/commands/doctor.spec.js +15 -1
  83. package/dist/commands/guard/impl/commands.d.ts.map +1 -1
  84. package/dist/commands/guard/impl/commands.js +19 -0
  85. package/dist/commands/release/apply.command.d.ts +2 -8
  86. package/dist/commands/release/apply.command.d.ts.map +1 -1
  87. package/dist/commands/release/apply.command.js +158 -387
  88. package/dist/commands/release/apply.mutation.d.ts +7 -0
  89. package/dist/commands/release/apply.mutation.d.ts.map +1 -0
  90. package/dist/commands/release/apply.mutation.js +107 -0
  91. package/dist/commands/release/apply.preflight.d.ts +25 -0
  92. package/dist/commands/release/apply.preflight.d.ts.map +1 -0
  93. package/dist/commands/release/apply.preflight.js +338 -0
  94. package/dist/commands/release/apply.reporting.d.ts +4 -0
  95. package/dist/commands/release/apply.reporting.d.ts.map +1 -0
  96. package/dist/commands/release/apply.reporting.js +24 -0
  97. package/dist/commands/release/apply.types.d.ts +46 -0
  98. package/dist/commands/release/apply.types.d.ts.map +1 -0
  99. package/dist/commands/release/apply.types.js +1 -0
  100. package/dist/commands/runtime.command.d.ts +28 -0
  101. package/dist/commands/runtime.command.d.ts.map +1 -0
  102. package/dist/commands/runtime.command.js +169 -0
  103. package/dist/commands/shared/task-store.d.ts.map +1 -1
  104. package/dist/commands/shared/task-store.js +7 -3
  105. package/dist/commands/task/add.d.ts.map +1 -1
  106. package/dist/commands/task/add.js +3 -33
  107. package/dist/commands/task/block.d.ts.map +1 -1
  108. package/dist/commands/task/block.js +2 -2
  109. package/dist/commands/task/close-duplicate.d.ts.map +1 -1
  110. package/dist/commands/task/close-duplicate.js +2 -2
  111. package/dist/commands/task/close-noop.d.ts.map +1 -1
  112. package/dist/commands/task/close-noop.js +2 -2
  113. package/dist/commands/task/comment.js +2 -2
  114. package/dist/commands/task/derive.d.ts.map +1 -1
  115. package/dist/commands/task/derive.js +3 -3
  116. package/dist/commands/task/doc-template.d.ts +10 -0
  117. package/dist/commands/task/doc-template.d.ts.map +1 -0
  118. package/dist/commands/task/doc-template.js +104 -0
  119. package/dist/commands/task/doc.d.ts.map +1 -1
  120. package/dist/commands/task/doc.js +36 -1
  121. package/dist/commands/task/finish.d.ts.map +1 -1
  122. package/dist/commands/task/finish.js +7 -4
  123. package/dist/commands/task/migrate-doc.command.d.ts.map +1 -1
  124. package/dist/commands/task/migrate-doc.command.js +5 -1
  125. package/dist/commands/task/migrate-doc.d.ts.map +1 -1
  126. package/dist/commands/task/migrate-doc.js +136 -2
  127. package/dist/commands/task/new.d.ts.map +1 -1
  128. package/dist/commands/task/new.js +4 -110
  129. package/dist/commands/task/new.spec.js +3 -3
  130. package/dist/commands/task/plan.d.ts.map +1 -1
  131. package/dist/commands/task/plan.js +5 -4
  132. package/dist/commands/task/scaffold.d.ts.map +1 -1
  133. package/dist/commands/task/scaffold.js +7 -52
  134. package/dist/commands/task/set-status.d.ts.map +1 -1
  135. package/dist/commands/task/set-status.js +2 -2
  136. package/dist/commands/task/shared/dependencies.d.ts +15 -0
  137. package/dist/commands/task/shared/dependencies.d.ts.map +1 -0
  138. package/dist/commands/task/shared/dependencies.js +143 -0
  139. package/dist/commands/task/shared/docs.d.ts +21 -0
  140. package/dist/commands/task/shared/docs.d.ts.map +1 -0
  141. package/dist/commands/task/shared/docs.js +121 -0
  142. package/dist/commands/task/shared/listing.d.ts +20 -0
  143. package/dist/commands/task/shared/listing.d.ts.map +1 -0
  144. package/dist/commands/task/shared/listing.js +127 -0
  145. package/dist/commands/task/shared/tags.d.ts +24 -0
  146. package/dist/commands/task/shared/tags.d.ts.map +1 -0
  147. package/dist/commands/task/shared/tags.js +177 -0
  148. package/dist/commands/task/shared/transitions.d.ts +42 -0
  149. package/dist/commands/task/shared/transitions.d.ts.map +1 -0
  150. package/dist/commands/task/shared/transitions.js +175 -0
  151. package/dist/commands/task/shared.d.ts +5 -106
  152. package/dist/commands/task/shared.d.ts.map +1 -1
  153. package/dist/commands/task/shared.js +5 -681
  154. package/dist/commands/task/start.d.ts.map +1 -1
  155. package/dist/commands/task/start.js +7 -5
  156. package/dist/commands/task/verify-record.d.ts.map +1 -1
  157. package/dist/commands/task/verify-record.js +9 -25
  158. package/dist/commands/task/verify-show.command.d.ts.map +1 -1
  159. package/dist/commands/task/verify-show.command.js +5 -1
  160. package/dist/commands/upgrade/apply.d.ts +44 -0
  161. package/dist/commands/upgrade/apply.d.ts.map +1 -0
  162. package/dist/commands/upgrade/apply.js +180 -0
  163. package/dist/commands/upgrade/report.d.ts +21 -0
  164. package/dist/commands/upgrade/report.d.ts.map +1 -0
  165. package/dist/commands/upgrade/report.js +81 -0
  166. package/dist/commands/upgrade/source.d.ts +35 -0
  167. package/dist/commands/upgrade/source.d.ts.map +1 -0
  168. package/dist/commands/upgrade/source.js +109 -0
  169. package/dist/commands/upgrade/types.d.ts +31 -0
  170. package/dist/commands/upgrade/types.d.ts.map +1 -0
  171. package/dist/commands/upgrade/types.js +1 -0
  172. package/dist/commands/upgrade.d.ts +1 -35
  173. package/dist/commands/upgrade.d.ts.map +1 -1
  174. package/dist/commands/upgrade.js +46 -331
  175. package/dist/shared/diagnostics.d.ts +23 -0
  176. package/dist/shared/diagnostics.d.ts.map +1 -0
  177. package/dist/shared/diagnostics.js +57 -0
  178. package/dist/shared/errors.d.ts +2 -0
  179. package/dist/shared/errors.d.ts.map +1 -1
  180. package/dist/shared/errors.js +2 -0
  181. package/dist/shared/repo-cli-version.d.ts +13 -0
  182. package/dist/shared/repo-cli-version.d.ts.map +1 -0
  183. package/dist/shared/repo-cli-version.js +63 -0
  184. package/dist/shared/runtime-source.d.ts +33 -0
  185. package/dist/shared/runtime-source.d.ts.map +1 -0
  186. package/dist/shared/runtime-source.js +156 -0
  187. package/dist/shared/version-compare.d.ts +7 -0
  188. package/dist/shared/version-compare.d.ts.map +1 -0
  189. package/dist/shared/version-compare.js +30 -0
  190. package/package.json +2 -2
package/assets/AGENTS.md CHANGED
@@ -195,5 +195,5 @@ Detailed DoD rules are in `.agentplane/policy/dod.core.md`, `.agentplane/policy/
195
195
  ## CHANGE CONTROL
196
196
 
197
197
  - Follow incident-log, immutability, and policy-budget rules in `.agentplane/policy/governance.md`.
198
- - Record situational incident rules only in `.agentplane/policy/incidents.md`.
198
+ - 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.
199
199
  - Keep `AGENTS.md` as a gateway; move detailed procedures to canonical modules.
@@ -9,7 +9,7 @@
9
9
  "outputs": [
10
10
  "Code and config updates describing exact hunks, commands run, and rationale.",
11
11
  "Transition guidance for the referenced task (status suggestions, blockers, follow-ups).",
12
- "Verification notes highlighting command outputs, test coverage, and remaining questions."
12
+ "Task README updates aligned with the active doc contract, including acceptance-oriented Verify Steps and task-local Findings when needed."
13
13
  ],
14
14
  "permissions": [
15
15
  "Project files: read + write within the active task scope.",
@@ -21,8 +21,9 @@
21
21
  "Confirm task context and readiness before editing; keep diffs minimal and task-scoped.",
22
22
  "Document edits with before/after snippets and cite the exact files touched.",
23
23
  "Run necessary commands (tests/linters/formatters) and summarize key output lines only.",
24
- "Prefer declared verify commands; record ad-hoc results via PR notes or request PLANNER to update verify lists.",
25
- "Coordinate handoffs to TESTER/REVIEWER/DOCS only when those roles already have explicit executable tasks; otherwise keep notes and verification in the same task.",
24
+ "Prefer declared verify commands; treat `Verify Steps` as the acceptance contract and request PLANNER updates when the contract itself drifts.",
25
+ "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.",
26
+ "Coordinate handoffs to TESTER/REVIEWER/DOCS only when those roles already have explicit executable tasks; otherwise keep findings and verification in the same task.",
26
27
  "Avoid task closure in branch_pr; keep commits task-scoped and update status via agentplane."
27
28
  ]
28
29
  }
@@ -17,7 +17,7 @@
17
17
  ],
18
18
  "workflow": [
19
19
  "Follow shared workflow rules in AGENTS.md and `agentplane quickstart` / `agentplane role <ROLE>` output.",
20
- "Create/update task README content via agentplane task doc set; required sections are config-driven (check config if they differ).",
20
+ "Create/update task README content via agentplane task doc set; keep the active doc_version contract explicit and treat v3 `Findings` as task-local observation memory, not policy incidents.",
21
21
  "Update user/developer docs minimally to reflect behavior and match existing tone.",
22
22
  "Keep PR artifact docs and notes current when required; add handoff notes for INTEGRATOR.",
23
23
  "Avoid extra commits and standalone docs-only tasks unless documentation itself is the independent deliverable."
@@ -20,7 +20,7 @@
20
20
  "Follow shared workflow rules in AGENTS.md and `agentplane quickstart` / `agentplane role <ROLE>` output.",
21
21
  "Operate from the repo root on the pinned base branch; run pr check -> integrate -> finish via agentplane.",
22
22
  "Use configured base branch and task branch prefix when referencing branches; check config if uncertain.",
23
- "Ensure verify commands are run/recorded; update PR artifacts and task README as needed.",
23
+ "Ensure verify commands are run/recorded against the declared Verify Steps contract; update PR artifacts and task README findings as needed.",
24
24
  "When closing multiple tasks, use batch finish so the same commit metadata and verification note apply.",
25
25
  "Check `closure_commit_requires_approval` in .agentplane/config.json; ask for user approval before the final closure commit when true, otherwise proceed without confirmation. Optionally clean task branches/worktrees after closure."
26
26
  ]
@@ -19,6 +19,7 @@
19
19
  "Convert the first user message into an execution plan; do not create tasks until the user approves it.",
20
20
  "Restate the user goal and constraints, then draft a numbered execution plan with agent assignments and expected outcomes.",
21
21
  "Build a task graph from the approved plan: split into atomic tasks, each with one specific owner from existing agent IDs; schedule CREATOR if a required agent is missing.",
22
+ "When task artifacts are part of scope, keep the active README contract explicit: Verify Steps define acceptance, and task-local observations stay in Notes/Findings rather than policy incidents.",
22
23
  "For development work, select the minimal role set needed for risk and workflow mode; do not split work by role labels alone.",
23
24
  "Use TESTER/REVIEWER/INTEGRATOR as independent tasks only when risk, mode (`branch_pr`), or a hard verification/integration boundary requires it; otherwise keep work in one executable task.",
24
25
  "If the user explicitly requests agent optimization, invoke UPDATER and pause until its analysis is complete.",
@@ -21,6 +21,7 @@
21
21
  "If task graph planning yields exactly one work item, create exactly one task and keep full traceability there.",
22
22
  "Split goals into atomic tasks with one specific owner each; set depends_on explicitly (use [] for none).",
23
23
  "Create tasks with valid parameters: non-empty title/description/owner, at least one meaningful tag, deduped depends_on/verify.",
24
+ "Write Plans as executable steps and treat Verify Steps as concrete acceptance checks; keep task-local observations in Notes/Findings rather than policy incidents.",
24
25
  "Before creating a new task, check open tasks (`TODO|DOING|BLOCKED`) and reuse/update a matching task when scope and owner align.",
25
26
  "Do not create separate tasks for role handoffs unless there is an independent deliverable, a different required owner, or an explicit dependency boundary.",
26
27
  "Do not create standalone tasks for scaffolding/doc bookkeeping/status transitions; keep those updates inside the executable task unless there is a real deliverable boundary.",
@@ -10,7 +10,7 @@
10
10
  "outputs": [
11
11
  "New or updated tests covering relevant behavior and edge cases.",
12
12
  "A short list of executed local commands with key pass/fail lines only.",
13
- "Notes on remaining coverage gaps or required follow-ups."
13
+ "Verification outcomes mapped to Verify Steps plus task-local findings on remaining gaps or follow-ups."
14
14
  ],
15
15
  "permissions": [
16
16
  "Project files: read + write for tests and minimal supporting code.",
@@ -22,6 +22,8 @@
22
22
  "Add the smallest set of high-value tests (happy path + edge/regression).",
23
23
  "Keep tests deterministic and fast; avoid network calls and time-based flakiness.",
24
24
  "Run targeted tests first and summarize only the key output lines.",
25
+ "Check results against `Verify Steps` as the acceptance contract, not just against ad-hoc commands.",
26
+ "Record residual gaps in the task-local observation section (`Notes` for v2, `Findings` for v3) rather than escalating them directly into policy incidents.",
25
27
  "If test infrastructure is missing, document the blocker in the same task first; request a PLANNER task only if it is a separate, independent deliverable."
26
28
  ]
27
29
  }
@@ -8,9 +8,9 @@ Apply when task changes implementation/source code.
8
8
  - Run all checks listed in task `## Verify Steps` (or record approved skips)
9
9
  - `agentplane verify <task-id> --ok|--rework --by <ROLE> --note "..."`
10
10
 
11
- ## Verification notes contract
11
+ ## Verification evidence contract
12
12
 
13
- Record verification in task notes using this compact template:
13
+ Record verification via `agentplane verify ...` and keep residual gaps or follow-ups in the task-local observation section (`Notes` in `doc_version=2`, `Findings` in `doc_version=3`) using this compact template:
14
14
 
15
15
  - `Command`: exact command string.
16
16
  - `Result`: `pass` or `fail`.
@@ -10,9 +10,11 @@ The task is complete only if all core checks are true:
10
10
  6. Drift was either absent or explicitly re-approved.
11
11
  7. Final repo state contains no unintended tracked changes.
12
12
 
13
- ## Required task notes template
13
+ ## Required task README contract
14
14
 
15
- Every non-trivial task README must contain non-empty sections:
15
+ Every non-trivial task README must satisfy the active `doc_version` contract.
16
+
17
+ Legacy `doc_version=2` tasks use:
16
18
 
17
19
  - `Summary`
18
20
  - `Scope`
@@ -22,6 +24,18 @@ Every non-trivial task README must contain non-empty sections:
22
24
  - `Rollback Plan`
23
25
  - `Notes`
24
26
 
27
+ Target `doc_version=3` tasks use:
28
+
29
+ - `Summary`
30
+ - `Scope`
31
+ - `Plan`
32
+ - `Verify Steps`
33
+ - `Verification`
34
+ - `Rollback Plan`
35
+ - `Findings`
36
+
37
+ `Findings` is task-local. Policy incidents are curated separately in `.agentplane/policy/incidents.md`.
38
+
25
39
  ## Material drift criteria
26
40
 
27
41
  Treat drift as material and require re-approval when at least one is true:
@@ -8,9 +8,9 @@ Apply when task changes docs or policy files only.
8
8
  - `agentplane doctor`
9
9
  - Targeted lint/tests if docs generation or scripts were changed.
10
10
 
11
- ## Verification notes contract
11
+ ## Verification evidence contract
12
12
 
13
- Record docs/policy verification in task notes using this template:
13
+ Record docs/policy verification via `agentplane verify ...` and keep residual deviations or follow-ups in the task-local observation section (`Notes` in `doc_version=2`, `Findings` in `doc_version=3`) using this template:
14
14
 
15
15
  - `Command`: exact command string.
16
16
  - `Result`: `pass` or `fail`.
@@ -33,4 +33,47 @@ example:end -->
33
33
 
34
34
  ## Entries
35
35
 
36
- - None yet.
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
@@ -7,8 +7,10 @@ Use this module when `workflow_mode=direct`.
7
7
  1. CHECKPOINT A: run preflight and publish summary.
8
8
  2. CHECKPOINT B: build task graph and obtain explicit user approval.
9
9
  3. Create/reuse task ID.
10
- 4. Fill task docs (`Summary/Scope/Plan/Risks/Verify Steps/Rollback/Notes`).
11
- Batched doc updates are allowed: sections may be updated in one turn/message via one full-doc payload or multiple `task doc set` operations, as long as approval has not started yet.
10
+ 4. Fill task docs for the active README contract.
11
+ - `doc_version=2`: `Summary/Scope/Plan/Risks/Verify Steps/Rollback/Notes`
12
+ - `doc_version=3`: `Summary/Scope/Plan/Verify Steps/Verification/Rollback/Findings`
13
+ Batched doc updates are allowed: sections may be updated in one turn/message via one full-doc payload or multiple `task doc set` operations, as long as approval has not started yet.
12
14
  5. Approve plan (if required), then start task sequentially.
13
15
  6. Implement changes in current checkout.
14
16
  7. Run verification commands from loaded DoD modules.
@@ -31,10 +33,12 @@ agentplane finish <task-id> --author <ROLE> --body "Verified: ..." --result "...
31
33
  If any step fails:
32
34
 
33
35
  1. Stop mutation immediately.
34
- 2. Record failure details in task `Notes` (`what failed`, `where`, `impact`).
36
+ 2. Record failure details in the task-local observation section.
37
+ - `doc_version=2`: task `Notes`
38
+ - `doc_version=3`: task `Findings`
35
39
  3. Mark task blocked: `agentplane block <task-id> --author <ROLE> --body "Blocked: ..."`.
36
40
  4. Request re-approval before scope/risk changes.
37
- 5. If failure is process/policy-related, append entry to `.agentplane/policy/incidents.md`.
41
+ 5. If failure is process/policy-related and strong enough for repo-wide memory, promote it explicitly into `.agentplane/policy/incidents.md`.
38
42
 
39
43
  ## Constraints
40
44
 
package/bin/agentplane.js CHANGED
@@ -4,7 +4,9 @@ import path from "node:path";
4
4
  import { stat } from "node:fs/promises";
5
5
  import { fileURLToPath } from "node:url";
6
6
  import { distExists, isPackageBuildFresh } from "./dist-guard.js";
7
- import { resolveFrameworkBinaryContext } from "./runtime-context.js";
7
+ import { getWatchedRuntimePathsForPackage } from "./runtime-watch.js";
8
+ import { classifyStaleDistPolicy } from "./stale-dist-policy.js";
9
+ import { isPathInside, resolveFrameworkBinaryContext } from "./runtime-context.js";
8
10
 
9
11
  async function exists(p) {
10
12
  try {
@@ -43,6 +45,27 @@ function isRepoLocalHandoffInvocation() {
43
45
  return (process.env.AGENTPLANE_REPO_LOCAL_HANDOFF ?? "").trim() === "1";
44
46
  }
45
47
 
48
+ function inferRuntimeMode(context) {
49
+ if (context.inFrameworkCheckout && context.isRepoLocalRuntime) {
50
+ return isRepoLocalHandoffInvocation() ? "repo-local-handoff" : "repo-local";
51
+ }
52
+ if (context.inFrameworkCheckout && shouldUseGlobalBinaryInFramework()) {
53
+ return "global-forced-in-framework";
54
+ }
55
+ if (context.inFrameworkCheckout) {
56
+ return "global-in-framework";
57
+ }
58
+ return "global-installed";
59
+ }
60
+
61
+ function primeRuntimeEnv(context) {
62
+ process.env.AGENTPLANE_RUNTIME_ACTIVE_BIN = context.thisBin;
63
+ process.env.AGENTPLANE_RUNTIME_MODE = inferRuntimeMode(context);
64
+ if (!isRepoLocalHandoffInvocation()) {
65
+ delete process.env.AGENTPLANE_RUNTIME_HANDOFF_FROM;
66
+ }
67
+ }
68
+
46
69
  function handoffToRepoLocalBinary(context) {
47
70
  const repoBin = context.checkout?.repoBin;
48
71
  if (!repoBin) return false;
@@ -57,6 +80,9 @@ function handoffToRepoLocalBinary(context) {
57
80
  env: {
58
81
  ...process.env,
59
82
  AGENTPLANE_REPO_LOCAL_HANDOFF: "1",
83
+ AGENTPLANE_RUNTIME_MODE: "repo-local-handoff",
84
+ AGENTPLANE_RUNTIME_ACTIVE_BIN: path.resolve(repoBin),
85
+ AGENTPLANE_RUNTIME_HANDOFF_FROM: context.thisBin,
60
86
  },
61
87
  });
62
88
 
@@ -91,11 +117,6 @@ function isHooksRunCommitMsgInvocation(argv) {
91
117
  return false;
92
118
  }
93
119
 
94
- function isPathInside(baseDir, targetPath) {
95
- const rel = path.relative(path.resolve(baseDir), path.resolve(targetPath));
96
- return rel === "" || (!rel.startsWith("..") && !path.isAbsolute(rel));
97
- }
98
-
99
120
  async function assertDistUpToDate() {
100
121
  const here = path.dirname(fileURLToPath(import.meta.url));
101
122
  const agentplaneRoot = path.resolve(here, "..");
@@ -120,11 +141,16 @@ async function assertDistUpToDate() {
120
141
  {
121
142
  name: "agentplane",
122
143
  root: agentplaneRoot,
123
- watchedPaths: ["src", "bin/agentplane.js", "bin/dist-guard.js"],
144
+ watchedPaths: getWatchedRuntimePathsForPackage("agentplane"),
124
145
  },
125
146
  ];
126
- if (await exists(path.join(coreRoot, "src")))
127
- checks.push({ name: "core", root: coreRoot, watchedPaths: ["src"] });
147
+ if (await exists(path.join(coreRoot, "src"))) {
148
+ checks.push({
149
+ name: "core",
150
+ root: coreRoot,
151
+ watchedPaths: getWatchedRuntimePathsForPackage("@agentplaneorg/core"),
152
+ });
153
+ }
128
154
 
129
155
  const staleReasons = [];
130
156
  for (const check of checks) {
@@ -150,6 +176,24 @@ async function assertDistUpToDate() {
150
176
  return true;
151
177
  }
152
178
 
179
+ const commandPolicy = classifyStaleDistPolicy(process.argv);
180
+ if (commandPolicy.mode === "warn_and_run") {
181
+ const commandText = process.argv
182
+ .slice(2)
183
+ .map((value) => String(value ?? "").trim())
184
+ .filter(Boolean)
185
+ .join(" ");
186
+ process.stderr.write(
187
+ "warning: allowing read-only diagnostic command to run with a stale repo build inside the framework checkout.\n" +
188
+ `command: ${commandText || "<unknown>"}\n` +
189
+ `detected: ${staleReasons.join(", ")}\n` +
190
+ "rebuild recommended:\n" +
191
+ " bun run --filter=@agentplaneorg/core build\n" +
192
+ " bun run --filter=agentplane build\n",
193
+ );
194
+ return true;
195
+ }
196
+
153
197
  process.stderr.write(
154
198
  "error: refusing to run a stale repo build (manifest/git quick-check failed).\n" +
155
199
  "Fix:\n" +
@@ -165,6 +209,12 @@ async function assertDistUpToDate() {
165
209
  return true;
166
210
  }
167
211
 
212
+ const runtimeContext = resolveFrameworkBinaryContext({
213
+ cwd: process.cwd(),
214
+ thisBin: fileURLToPath(import.meta.url),
215
+ });
216
+ primeRuntimeEnv(runtimeContext);
217
+
168
218
  if (!maybeHandoffToRepoLocalBinary()) {
169
219
  await maybeWarnGlobalBinaryInRepoCheckout();
170
220
  const ok = isHooksRunCommitMsgInvocation(process.argv) ? true : await assertDistUpToDate();
package/bin/dist-guard.js CHANGED
@@ -1,6 +1,7 @@
1
1
  import { execFileSync } from "node:child_process";
2
2
  import path from "node:path";
3
3
  import { readFile, stat } from "node:fs/promises";
4
+ import { collectWatchedRuntimeSnapshot, compareWatchedRuntimeSnapshots } from "./runtime-watch.js";
4
5
 
5
6
  async function exists(p) {
6
7
  try {
@@ -33,12 +34,13 @@ function resolveGitHead(cwd) {
33
34
  }
34
35
  }
35
36
 
36
- function listGitPaths(cwd, args) {
37
+ function listGitPaths(cwd, args, options = {}) {
38
+ const trimLines = options.trimLines ?? true;
37
39
  try {
38
40
  const out = execFileSync("git", args, { cwd, encoding: "utf8" });
39
41
  return out
40
42
  .split(/\r?\n/u)
41
- .map((line) => line.trim())
43
+ .map((line) => (trimLines ? line.trim() : line))
42
44
  .filter(Boolean);
43
45
  } catch {
44
46
  return [];
@@ -50,14 +52,19 @@ function uniqueSorted(values) {
50
52
  }
51
53
 
52
54
  function workingTreeChangedPaths(cwd, watchedPaths) {
53
- const lines = listGitPaths(cwd, [
54
- "status",
55
- "--porcelain",
56
- "--untracked-files=all",
57
- "--",
58
- ...watchedPaths,
59
- ]);
60
- return uniqueSorted(lines.map((line) => line.slice(3).trim()).filter(Boolean));
55
+ const lines = listGitPaths(
56
+ cwd,
57
+ ["status", "--porcelain", "--untracked-files=all", "--", ...watchedPaths],
58
+ { trimLines: false },
59
+ );
60
+ return uniqueSorted(
61
+ lines
62
+ .map((line) => {
63
+ const normalized = String(line ?? "");
64
+ return normalized.length > 3 ? normalized.slice(3).trim() : "";
65
+ })
66
+ .filter(Boolean),
67
+ );
61
68
  }
62
69
 
63
70
  function committedChangedPathsSince(cwd, fromGitHead, watchedPaths) {
@@ -77,6 +84,45 @@ async function fileMtimeMs(p) {
77
84
  }
78
85
  }
79
86
 
87
+ function parseManifestSnapshot(manifest) {
88
+ if (
89
+ !Array.isArray(manifest?.watched_runtime_paths) ||
90
+ !Array.isArray(manifest?.watched_runtime_files) ||
91
+ typeof manifest?.watched_runtime_snapshot_hash !== "string"
92
+ ) {
93
+ return null;
94
+ }
95
+
96
+ const watchedPaths = manifest.watched_runtime_paths.filter((value) => typeof value === "string");
97
+ const files = manifest.watched_runtime_files
98
+ .filter(
99
+ (value) =>
100
+ value &&
101
+ typeof value === "object" &&
102
+ typeof value.path === "string" &&
103
+ typeof value.sha256 === "string" &&
104
+ typeof value.size_bytes === "number",
105
+ )
106
+ .map((value) => ({
107
+ path: value.path,
108
+ sha256: value.sha256,
109
+ size_bytes: value.size_bytes,
110
+ }));
111
+
112
+ if (
113
+ watchedPaths.length !== manifest.watched_runtime_paths.length ||
114
+ files.length !== manifest.watched_runtime_files.length
115
+ ) {
116
+ return null;
117
+ }
118
+
119
+ return {
120
+ watchedPaths,
121
+ files,
122
+ snapshotHash: manifest.watched_runtime_snapshot_hash,
123
+ };
124
+ }
125
+
80
126
  export async function isPackageBuildFresh(packageRoot, options = {}) {
81
127
  const watchedPaths = options.watchedPaths ?? ["src"];
82
128
  const manifestPath = path.join(packageRoot, "dist", ".build-manifest.json");
@@ -86,6 +132,28 @@ export async function isPackageBuildFresh(packageRoot, options = {}) {
86
132
  }
87
133
 
88
134
  const currentHead = resolveGitHead(packageRoot);
135
+ const manifestSnapshot = parseManifestSnapshot(manifest);
136
+ if (manifestSnapshot) {
137
+ const currentSnapshot = await collectWatchedRuntimeSnapshot(
138
+ packageRoot,
139
+ manifestSnapshot.watchedPaths,
140
+ );
141
+ const comparison = compareWatchedRuntimeSnapshots(manifestSnapshot, currentSnapshot);
142
+ if (!comparison.ok) {
143
+ return {
144
+ ok: false,
145
+ reason: "watched_runtime_snapshot_changed",
146
+ changedPaths: comparison.changedPaths,
147
+ };
148
+ }
149
+
150
+ if (manifest.git_head && currentHead && manifest.git_head !== currentHead) {
151
+ return { ok: true, reason: "fresh_after_snapshot_match", changedPaths: [] };
152
+ }
153
+
154
+ return { ok: true, reason: "fresh", changedPaths: [] };
155
+ }
156
+
89
157
  const changedPaths = uniqueSorted([
90
158
  ...committedChangedPathsSince(packageRoot, manifest.git_head, watchedPaths),
91
159
  ...workingTreeChangedPaths(packageRoot, watchedPaths),
@@ -8,12 +8,15 @@ export type FrameworkCheckout = {
8
8
  export type FrameworkBinaryContext = {
9
9
  inFrameworkCheckout: boolean;
10
10
  isRepoLocalBinary: boolean;
11
+ isRepoLocalRuntime: boolean;
11
12
  checkout: FrameworkCheckout | null;
12
13
  thisBin: string;
13
14
  };
14
15
 
15
16
  export function findFrameworkCheckout(startDir: string): FrameworkCheckout | null;
16
17
 
18
+ export function isPathInside(baseDir: string, targetPath: string): boolean;
19
+
17
20
  export function resolveFrameworkBinaryContext(options: {
18
21
  cwd: string;
19
22
  thisBin: string;
@@ -21,6 +21,7 @@ import path from "node:path";
21
21
  * @typedef {{
22
22
  * inFrameworkCheckout: boolean;
23
23
  * isRepoLocalBinary: boolean;
24
+ * isRepoLocalRuntime: boolean;
24
25
  * checkout: FrameworkCheckout | null;
25
26
  * thisBin: string;
26
27
  * }} FrameworkBinaryContext
@@ -55,6 +56,16 @@ export function findFrameworkCheckout(startDir) {
55
56
  }
56
57
  }
57
58
 
59
+ /**
60
+ * @param {string} baseDir
61
+ * @param {string} targetPath
62
+ * @returns {boolean}
63
+ */
64
+ export function isPathInside(baseDir, targetPath) {
65
+ const rel = path.relative(path.resolve(baseDir), path.resolve(targetPath));
66
+ return rel === "" || (!rel.startsWith("..") && !path.isAbsolute(rel));
67
+ }
68
+
58
69
  /**
59
70
  * @param {FrameworkBinaryContextOptions} options
60
71
  * @returns {FrameworkBinaryContext}
@@ -67,6 +78,7 @@ export function resolveFrameworkBinaryContext(options) {
67
78
  return {
68
79
  inFrameworkCheckout: false,
69
80
  isRepoLocalBinary: false,
81
+ isRepoLocalRuntime: false,
70
82
  checkout: null,
71
83
  thisBin,
72
84
  };
@@ -75,6 +87,7 @@ export function resolveFrameworkBinaryContext(options) {
75
87
  return {
76
88
  inFrameworkCheckout: true,
77
89
  isRepoLocalBinary: path.resolve(checkout.repoBin) === thisBin,
90
+ isRepoLocalRuntime: isPathInside(checkout.packageRoot, thisBin),
78
91
  checkout,
79
92
  thisBin,
80
93
  };
@@ -0,0 +1,26 @@
1
+ export type WatchedRuntimeSnapshotFile = {
2
+ path: string;
3
+ sha256: string;
4
+ size_bytes: number;
5
+ };
6
+
7
+ export type WatchedRuntimeSnapshot = {
8
+ watchedPaths: string[];
9
+ files: WatchedRuntimeSnapshotFile[];
10
+ snapshotHash: string;
11
+ };
12
+
13
+ export type WatchedRuntimeSnapshotComparison = {
14
+ ok: boolean;
15
+ changedPaths: string[];
16
+ };
17
+
18
+ export function getWatchedRuntimePathsForPackage(packageName: string): string[];
19
+ export function collectWatchedRuntimeSnapshot(
20
+ packageDir: string,
21
+ watchedPaths: string[],
22
+ ): Promise<WatchedRuntimeSnapshot>;
23
+ export function compareWatchedRuntimeSnapshots(
24
+ recordedSnapshot: WatchedRuntimeSnapshot,
25
+ currentSnapshot: WatchedRuntimeSnapshot,
26
+ ): WatchedRuntimeSnapshotComparison;