@unbrained/pm-cli 2026.9.4 → 2026.9.6

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 (277) hide show
  1. package/.agents/skills/HARNESS_COMPATIBILITY.md +1 -1
  2. package/.agents/skills/README.md +2 -2
  3. package/.agents/skills/pm-developer/SKILL.md +4 -1
  4. package/.agents/skills/pm-developer/references/COMMAND_PLAYBOOK.md +10 -0
  5. package/.agents/skills/pm-developer/references/GRAPH_AND_RELATIONSHIPS.md +3 -1
  6. package/.agents/skills/pm-extensions/SKILL.md +2 -2
  7. package/.agents/skills/pm-extensions/references/LIFECYCLE.md +3 -3
  8. package/.agents/skills/pm-extensions/references/TROUBLESHOOTING.md +3 -3
  9. package/.agents/skills/pm-user/SKILL.md +2 -0
  10. package/.agents/skills/pm-user/references/BACKLOG_SHAPING.md +5 -0
  11. package/.agents/skills/pm-user/references/WORKFLOWS.md +20 -5
  12. package/.claude-plugin/marketplace.json +2 -2
  13. package/CHANGELOG.md +58 -3
  14. package/dist/cli/commander-usage.d.ts +2 -0
  15. package/dist/cli/commander-usage.js +15 -12
  16. package/dist/cli/help-json-payload.js +12 -7
  17. package/dist/cli/main.js +22 -11
  18. package/dist/cli/register-list-query.js +4 -2
  19. package/dist/cli/register-mutation.js +4 -2
  20. package/dist/cli/register-operations.js +17 -8
  21. package/dist/cli-bundle/bundle-manifest.json +153 -161
  22. package/dist/cli-bundle/chunks/chunk-AZDFJGH6.js +9 -0
  23. package/dist/cli-bundle/chunks/{chunk-V72UV7QS.js → chunk-BAX2BYUW.js} +73 -73
  24. package/dist/cli-bundle/chunks/{chunk-HI6BHPCU.js → chunk-CKOL5U7J.js} +51 -51
  25. package/dist/cli-bundle/chunks/{chunk-A24WAVE6.js → chunk-JT6XF6GE.js} +2 -2
  26. package/dist/cli-bundle/chunks/{chunk-I2AS367G.js → chunk-JX4DH4WC.js} +2 -2
  27. package/dist/cli-bundle/chunks/{chunk-YW4QK2G7.js → chunk-NPN5I67J.js} +2 -2
  28. package/dist/cli-bundle/chunks/chunk-OF76PSDQ.js +5 -0
  29. package/dist/cli-bundle/chunks/chunk-QUWFABDM.js +232 -0
  30. package/dist/cli-bundle/chunks/{chunk-RI4XNOYS.js → chunk-RWWBOWJ5.js} +2 -2
  31. package/dist/cli-bundle/chunks/chunk-WGAOYSYH.js +40 -0
  32. package/dist/cli-bundle/chunks/{chunk-X6CMGV6L.js → chunk-WI2AYPA7.js} +2 -2
  33. package/dist/cli-bundle/chunks/{register-list-query-Z5YYSJJG.js → register-list-query-5JL52D33.js} +3 -3
  34. package/dist/cli-bundle/chunks/{register-mutation-ELSP6I4I.js → register-mutation-ZPG7KMVP.js} +4 -4
  35. package/dist/cli-bundle/chunks/register-operations-I5W3KMGB.js +2 -0
  36. package/dist/cli-bundle/chunks/{register-setup-E2AE72QG.js → register-setup-H4SVAVX7.js} +2 -2
  37. package/dist/cli-bundle/focused-chunks/{chunk-3646BZ4W.js → chunk-3BZEOXLT.js} +2 -2
  38. package/dist/cli-bundle/focused-chunks/chunk-AL5ON6K6.js +2 -0
  39. package/dist/cli-bundle/focused-chunks/chunk-CHC2IDXA.js +6 -0
  40. package/dist/cli-bundle/focused-chunks/chunk-CK6QFAPZ.js +20 -0
  41. package/dist/cli-bundle/focused-chunks/{chunk-NBMJD6MK.js → chunk-EZR3GHFE.js} +2 -2
  42. package/dist/cli-bundle/focused-chunks/chunk-H2WJWK7L.js +56 -0
  43. package/dist/cli-bundle/focused-chunks/{chunk-53IHPICX.js → chunk-LIJIA4TY.js} +2 -2
  44. package/dist/cli-bundle/focused-chunks/{chunk-25UJBH4M.js → chunk-M6PBRFSH.js} +2 -2
  45. package/dist/cli-bundle/focused-chunks/{chunk-AJR3OP2E.js → chunk-NTPY5GSO.js} +2 -2
  46. package/dist/cli-bundle/focused-chunks/chunk-P5O7MP5Y.js +2 -0
  47. package/dist/cli-bundle/focused-chunks/chunk-PDMW2E36.js +177 -0
  48. package/dist/cli-bundle/focused-chunks/{chunk-MHKUIPJW.js → chunk-PEFABF7E.js} +2 -2
  49. package/dist/cli-bundle/focused-chunks/{chunk-6PWPQKDN.js → chunk-QTVCLMSZ.js} +2 -2
  50. package/dist/cli-bundle/focused-chunks/{chunk-7N2TV7WZ.js → chunk-QTZRBUYA.js} +2 -2
  51. package/dist/cli-bundle/focused-chunks/chunk-SGQST3PQ.js +12 -0
  52. package/dist/cli-bundle/focused-chunks/chunk-UKHASMMP.js +10 -0
  53. package/dist/cli-bundle/focused-chunks/chunk-ZPEKQHOC.js +2 -0
  54. package/dist/cli-bundle/main.js +22 -15
  55. package/dist/cli-bundle/sdk-authoring.js +1 -1
  56. package/dist/cli-bundle/sdk-contracts.js +2 -2
  57. package/dist/cli-bundle/sdk-core.js +37 -37
  58. package/dist/cli-bundle/sdk-governance.js +1 -1
  59. package/dist/cli-bundle/sdk-graph.js +1 -1
  60. package/dist/cli-bundle/sdk-merge.js +42 -39
  61. package/dist/cli-bundle/sdk-query.js +1 -1
  62. package/dist/cli-bundle/sdk-runtime.js +1 -1
  63. package/dist/cli-bundle/sdk-testing.js +1 -1
  64. package/dist/cli-bundle/sdk.js +9 -9
  65. package/dist/core/extensions/extension-types.d.ts +2 -0
  66. package/dist/core/extensions/extension-types.js +2 -2
  67. package/dist/core/extensions/module-graph-snapshot.js +5 -4
  68. package/dist/core/fs/host-environment-errors.d.ts +27 -0
  69. package/dist/core/fs/host-environment-errors.js +142 -0
  70. package/dist/core/history/drift-scan.d.ts +5 -0
  71. package/dist/core/history/drift-scan.js +16 -6
  72. package/dist/core/history/event-classification.d.ts +1 -1
  73. package/dist/core/history/event-classification.js +3 -2
  74. package/dist/core/history/history.js +37 -5
  75. package/dist/core/history/identity.d.ts +15 -0
  76. package/dist/core/history/identity.js +31 -0
  77. package/dist/core/history/projection.js +50 -17
  78. package/dist/core/history/read.js +6 -3
  79. package/dist/core/history/replay.d.ts +1 -2
  80. package/dist/core/history/replay.js +4 -4
  81. package/dist/core/history/version-address.d.ts +13 -0
  82. package/dist/core/history/version-address.js +33 -0
  83. package/dist/core/item/actionability.d.ts +21 -1
  84. package/dist/core/item/actionability.js +45 -10
  85. package/dist/core/item/id.js +8 -4
  86. package/dist/core/item/item-type-definition.d.ts +2 -0
  87. package/dist/core/item/item-type-definition.js +9 -2
  88. package/dist/core/item/type-registry.d.ts +5 -1
  89. package/dist/core/item/type-registry.js +9 -4
  90. package/dist/core/output/mutation-projection.js +12 -5
  91. package/dist/core/shared/errors.d.ts +8 -0
  92. package/dist/core/shared/errors.js +2 -2
  93. package/dist/core/store/item-metadata-query-index.js +13 -10
  94. package/dist/core/store/item-metadata-read-work.d.ts +19 -0
  95. package/dist/core/store/item-metadata-read-work.js +44 -0
  96. package/dist/core/store/item-store.d.ts +14 -0
  97. package/dist/core/store/item-store.js +52 -10
  98. package/dist/core/store/settings-validator.js +3 -2
  99. package/dist/core/validate/fix-planning.d.ts +1 -1
  100. package/dist/core/validate/fix-planning.js +2 -2
  101. package/dist/core/validate/missing-link-owners.d.ts +1 -1
  102. package/dist/core/validate/missing-link-owners.js +5 -3
  103. package/dist/core/validate/stale-file-classification.d.ts +6 -4
  104. package/dist/core/validate/stale-file-classification.js +20 -5
  105. package/dist/mcp/server.js +12 -5
  106. package/dist/sdk/actionability.d.ts +1 -1
  107. package/dist/sdk/actionability.js +3 -3
  108. package/dist/sdk/cli-contracts/command-aliases.js +11 -2
  109. package/dist/sdk/cli-contracts/completeness.js +4 -3
  110. package/dist/sdk/cli-contracts/flag-contracts.d.ts +2 -0
  111. package/dist/sdk/cli-contracts/flag-contracts.js +31 -5
  112. package/dist/sdk/cli-contracts/flag-lexicon-contracts.js +21 -13
  113. package/dist/sdk/cli-contracts/grammar-contracts.js +11 -2
  114. package/dist/sdk/cli-contracts/runtime-contracts.js +5 -2
  115. package/dist/sdk/cli-contracts/schemas/assurance-definition.d.ts +254 -5
  116. package/dist/sdk/cli-contracts/schemas/assurance-definition.js +52 -2
  117. package/dist/sdk/cli-contracts/tool-parameter-tables.js +30 -6
  118. package/dist/sdk/cli-contracts/tool-schema.d.ts +2 -2
  119. package/dist/sdk/cli-contracts/tool-schema.js +32 -7
  120. package/dist/sdk/context/usage-ledger.d.ts +41 -0
  121. package/dist/sdk/context/usage-ledger.js +186 -0
  122. package/dist/sdk/context-intent-contracts.js +3 -3
  123. package/dist/sdk/context-usage.d.ts +18 -9
  124. package/dist/sdk/context-usage.js +44 -121
  125. package/dist/sdk/define.d.ts +1 -1
  126. package/dist/sdk/define.js +2 -2
  127. package/dist/sdk/dependency-provenance.d.ts +7 -0
  128. package/dist/sdk/dependency-provenance.js +14 -4
  129. package/dist/sdk/duplicates.d.ts +2 -0
  130. package/dist/sdk/duplicates.js +3 -2
  131. package/dist/sdk/environment/host-environment-errors.d.ts +5 -27
  132. package/dist/sdk/environment/host-environment-errors.js +4 -137
  133. package/dist/sdk/extension/install-runtime.js +9 -6
  134. package/dist/sdk/extension/install-snapshot.js +7 -6
  135. package/dist/sdk/generated/generated-error-code-catalog-part-1.js +104 -56
  136. package/dist/sdk/generated/generated-error-code-catalog-part-2.js +50 -2
  137. package/dist/sdk/governance/assurance-action.d.ts +3 -2
  138. package/dist/sdk/governance/assurance-action.js +23 -11
  139. package/dist/sdk/governance/assurance-runtime.d.ts +2 -0
  140. package/dist/sdk/governance/assurance-runtime.js +6 -3
  141. package/dist/sdk/governance/defect-recurrence-coverage.d.ts +93 -0
  142. package/dist/sdk/governance/defect-recurrence-coverage.js +189 -0
  143. package/dist/sdk/governance/defect-recurrence-graph.d.ts +33 -0
  144. package/dist/sdk/governance/defect-recurrence-graph.js +121 -0
  145. package/dist/sdk/governance/defect-recurrence.d.ts +8 -0
  146. package/dist/sdk/governance/defect-recurrence.js +118 -17
  147. package/dist/sdk/governance/health.d.ts +17 -2
  148. package/dist/sdk/governance/health.js +31 -10
  149. package/dist/sdk/governance/linked-file-report.d.ts +41 -0
  150. package/dist/sdk/governance/linked-file-report.js +72 -0
  151. package/dist/sdk/governance/validate-history-drift.js +16 -5
  152. package/dist/sdk/governance/validate.d.ts +5 -2
  153. package/dist/sdk/governance/validate.js +21 -37
  154. package/dist/sdk/governance.d.ts +2 -0
  155. package/dist/sdk/governance.js +4 -2
  156. package/dist/sdk/guide-topics.js +116 -2
  157. package/dist/sdk/history/salvage.d.ts +35 -0
  158. package/dist/sdk/history/salvage.js +248 -0
  159. package/dist/sdk/history-compact.js +32 -37
  160. package/dist/sdk/history-read.d.ts +3 -2
  161. package/dist/sdk/history-read.js +6 -3
  162. package/dist/sdk/history-repair.d.ts +12 -0
  163. package/dist/sdk/history-repair.js +60 -13
  164. package/dist/sdk/lifecycle/claim.d.ts +4 -0
  165. package/dist/sdk/lifecycle/claim.js +9 -3
  166. package/dist/sdk/lifecycle/close.d.ts +8 -0
  167. package/dist/sdk/lifecycle/close.js +16 -8
  168. package/dist/sdk/lifecycle/create.js +9 -12
  169. package/dist/sdk/lifecycle/restore.d.ts +1 -0
  170. package/dist/sdk/lifecycle/restore.js +19 -7
  171. package/dist/sdk/lifecycle/update.js +12 -12
  172. package/dist/sdk/lifecycle-policy.d.ts +3 -0
  173. package/dist/sdk/lifecycle-policy.js +2 -2
  174. package/dist/sdk/merge/abandoned-receipts.d.ts +15 -0
  175. package/dist/sdk/merge/abandoned-receipts.js +47 -0
  176. package/dist/sdk/merge/driver.js +4 -2
  177. package/dist/sdk/merge/index.d.ts +1 -0
  178. package/dist/sdk/merge/index.js +2 -2
  179. package/dist/sdk/merge/receipt-operation.d.ts +15 -0
  180. package/dist/sdk/merge/receipt-operation.js +97 -0
  181. package/dist/sdk/merge/receipt-schema.d.ts +20 -0
  182. package/dist/sdk/merge/receipt-schema.js +398 -0
  183. package/dist/sdk/merge/receipts.d.ts +16 -7
  184. package/dist/sdk/merge/receipts.js +54 -340
  185. package/dist/sdk/merge/reconcile.d.ts +2 -0
  186. package/dist/sdk/merge/reconcile.js +11 -4
  187. package/dist/sdk/output-projection.d.ts +3 -1
  188. package/dist/sdk/output-projection.js +11 -3
  189. package/dist/sdk/public-surface.json +1 -0
  190. package/dist/sdk/query/context.d.ts +9 -0
  191. package/dist/sdk/query/context.js +33 -21
  192. package/dist/sdk/query/duplicate-candidates.d.ts +7 -0
  193. package/dist/sdk/query/duplicate-candidates.js +71 -0
  194. package/dist/sdk/query/get.d.ts +2 -2
  195. package/dist/sdk/query/get.js +9 -8
  196. package/dist/sdk/query/history.d.ts +11 -0
  197. package/dist/sdk/query/history.js +34 -10
  198. package/dist/sdk/query/next.d.ts +15 -1
  199. package/dist/sdk/query/next.js +43 -20
  200. package/dist/sdk/query.d.ts +3 -0
  201. package/dist/sdk/query.js +5 -2
  202. package/dist/sdk/read-output-session.js +5 -3
  203. package/dist/sdk/runtime-primitives.d.ts +1 -1
  204. package/dist/sdk/runtime-primitives.js +3 -3
  205. package/dist/sdk/runtime.js +4 -2
  206. package/dist/sdk/similarity.d.ts +24 -3
  207. package/dist/sdk/similarity.js +50 -55
  208. package/dist/types.d.ts +2 -0
  209. package/dist/types.js +2 -2
  210. package/docs/AGENT_GUIDE.md +58 -1
  211. package/docs/BOUNDED_CONTEXT_READS.md +185 -0
  212. package/docs/CLOSE_EVIDENCE_RECOVERY.md +35 -0
  213. package/docs/COMMANDS.md +30 -8
  214. package/docs/CONTEXT_RELEVANCE.md +16 -4
  215. package/docs/DEFECT_RECURRENCE.md +80 -6
  216. package/docs/EXTENSIONS.md +18 -19
  217. package/docs/HISTORY_RECOVERY.md +146 -0
  218. package/docs/MERGE_SAFETY.md +50 -0
  219. package/docs/OUTPUT_PROJECTION_CONTRACTS.md +66 -0
  220. package/docs/PR_REVIEW_LOOP.md +18 -3
  221. package/docs/README.md +19 -1
  222. package/docs/RELEASING.md +31 -13
  223. package/docs/SDK_CONTEXT_TRUTH_CONTRACTS.md +24 -1
  224. package/docs/SDK_EXECUTION_CONTRACTS.md +105 -0
  225. package/docs/SDK_LIFECYCLE.md +27 -0
  226. package/docs/SDK_RUNTIME_BOUNDARIES.md +11 -0
  227. package/docs/TESTING.md +5 -0
  228. package/docs/agent-task-token-baseline.json +17 -17
  229. package/docs/agent-task-transcripts.json +2 -1
  230. package/docs/generated/FLAG_LEXICON_BUDGETS.md +11 -11
  231. package/docs/generated/REFUSAL_CLOSURE_CENSUS.md +11 -3
  232. package/marketplace.json +2 -2
  233. package/package.json +8 -6
  234. package/packages/pm-beads/package.json +1 -1
  235. package/packages/pm-calendar/package.json +1 -1
  236. package/packages/pm-command-kit/package.json +1 -1
  237. package/packages/pm-digital-twin/package.json +1 -1
  238. package/packages/pm-governance-audit/README.md +10 -1
  239. package/packages/pm-governance-audit/extensions/governance-audit/dedupe-audit.ts +50 -65
  240. package/packages/pm-governance-audit/extensions/governance-audit/index.ts +2 -2
  241. package/packages/pm-governance-audit/extensions/governance-audit/sdk.ts +1 -0
  242. package/packages/pm-governance-audit/package.json +1 -1
  243. package/packages/pm-guide-shell/package.json +1 -1
  244. package/packages/pm-kanban/package.json +1 -1
  245. package/packages/pm-lifecycle-hooks/package.json +1 -1
  246. package/packages/pm-linked-test-adapters/package.json +1 -1
  247. package/packages/pm-search-advanced/package.json +1 -1
  248. package/packages/pm-templates/package.json +1 -1
  249. package/packages/pm-todos/package.json +1 -1
  250. package/packages/pm-vcs/package.json +1 -1
  251. package/plugins/pm-claude/.claude-plugin/plugin.json +1 -1
  252. package/plugins/pm-claude/skills/pm-audit/SKILL.md +2 -2
  253. package/plugins/pm-claude/skills/pm-developer/SKILL.md +2 -2
  254. package/plugins/pm-claude/skills/pm-planner/SKILL.md +2 -2
  255. package/plugins/pm-claude/skills/pm-release/SKILL.md +2 -2
  256. package/plugins/pm-claude/skills/pm-workflow/SKILL.md +3 -3
  257. package/plugins/pm-codex/.codex-plugin/plugin.json +1 -1
  258. package/plugins/pm-codex/skills/pm-auditor/SKILL.md +2 -2
  259. package/plugins/pm-codex/skills/pm-native/SKILL.md +3 -4
  260. package/plugins/pm-codex/skills/pm-release/SKILL.md +2 -2
  261. package/scripts/finalize-build.mjs +13 -1
  262. package/dist/cli-bundle/chunks/chunk-6XSKPNCF.js +0 -230
  263. package/dist/cli-bundle/chunks/chunk-OGBVU67G.js +0 -5
  264. package/dist/cli-bundle/chunks/chunk-TXW6VL33.js +0 -38
  265. package/dist/cli-bundle/chunks/chunk-VGLHECAP.js +0 -9
  266. package/dist/cli-bundle/chunks/register-operations-OH7R3ZT4.js +0 -2
  267. package/dist/cli-bundle/focused-chunks/chunk-4YRAVI43.js +0 -12
  268. package/dist/cli-bundle/focused-chunks/chunk-5P4HVOWG.js +0 -176
  269. package/dist/cli-bundle/focused-chunks/chunk-636VVQ7F.js +0 -54
  270. package/dist/cli-bundle/focused-chunks/chunk-B3A6MJYE.js +0 -2
  271. package/dist/cli-bundle/focused-chunks/chunk-BFDDJ2T2.js +0 -2
  272. package/dist/cli-bundle/focused-chunks/chunk-BHUIRZWQ.js +0 -9
  273. package/dist/cli-bundle/focused-chunks/chunk-JADHHPY6.js +0 -6
  274. package/dist/cli-bundle/focused-chunks/chunk-NSKBLHVI.js +0 -20
  275. package/dist/cli-bundle/focused-chunks/chunk-P2GOAOQN.js +0 -2
  276. package/dist/cli-bundle/focused-chunks/chunk-YARWJM2B.js +0 -2
  277. package/sdk/public-surface.json +0 -33034
@@ -6,7 +6,7 @@ This repository supports external automation harnesses through shared docs and `
6
6
 
7
7
  Use the same low-token route in every harness:
8
8
 
9
- 1. `pm install guide-shell --project` (enable optional local guide commands)
9
+ 1. `pm package install guide-shell --project` (enable optional local guide commands)
10
10
  2. `pm guide` (topic index)
11
11
  3. `pm guide <topic>` (focused route)
12
12
  4. `pm guide <topic> --depth standard|deep` (details only when needed)
@@ -41,7 +41,7 @@ pm guide skills
41
41
  pm guide harnesses --depth standard
42
42
  ```
43
43
 
44
- Guide topics: `quickstart`, `commands`, `workflows`, `sdk`, `extensions`,
45
- `skills`, `harnesses`, `release`, `tokens`, `graph`, `assurance`, `merge`.
44
+ Guide topics are declared at runtime: `pm guide` prints the current index and
45
+ `pm guide <topic> --depth brief` expands one topic. Do not copy the list.
46
46
 
47
47
  Compatibility routing: [Harness compatibility matrix](HARNESS_COMPATIBILITY.md)
@@ -60,6 +60,7 @@ pm files <ID> --add path=<path>,scope=project,note="<why>"
60
60
  pm docs <ID> --add path=<doc>,scope=project,note="<why>"
61
61
  pm test <ID> --add command="node scripts/run-tests.mjs test -- <target>",scope=project,timeout_seconds=240
62
62
  pm comments <ID> "Evidence: <what changed and what passed>"
63
+ pm learnings <ID> --add "<lesson that outlives this item>"
63
64
  pm test <ID> --run --progress
64
65
  pm close <ID> "<reason with evidence>" --validate-close warn
65
66
  pm release <ID>
@@ -76,7 +77,9 @@ enters, and use these drift-gated references:
76
77
 
77
78
  `pm help` shows the bounded core tier. Use `pm guide capabilities`, `pm
78
79
  contracts --summary`, or `pm <command> --help --json` for progressive
79
- disclosure into the wider surface.
80
+ disclosure into the wider surface. Durable lessons and history maintenance
81
+ (`pm learnings`, `pm history --verify`, `history-repair`, `history-redact`,
82
+ `history-compact`, `close-many`) are routed by `pm guide evidence`.
80
83
 
81
84
  ## Token Discipline
82
85
 
@@ -29,6 +29,16 @@ pm docs <ID> --add path=docs/<doc>.md,scope=project,note="public docs update"
29
29
  pm test <ID> --add command="node scripts/run-tests.mjs test -- tests/unit/<file>.spec.ts",scope=project,timeout_seconds=240
30
30
  ```
31
31
 
32
+ ## Durable Knowledge And Record Maintenance
33
+
34
+ ```bash
35
+ pm learnings <ID> --add "<lesson that applies beyond this item>"
36
+ pm learnings <ID> --limit 5
37
+ pm history <ID> --verify --strict-exit
38
+ pm history-repair --all --dry-run
39
+ pm close-many --ids <ID>,<ID> --reason "<shared reason>" --dry-run
40
+ ```
41
+
32
42
  ## Close Workflow
33
43
 
34
44
  ```bash
@@ -24,12 +24,14 @@ pm contracts --json --full | jq '.relationship_kind_contracts'
24
24
  | `discovered_from` | This item was found while doing that one | no | no |
25
25
  | `incident_from` | This item originates in that recorded incident | no | no |
26
26
  | `supersedes` | This item replaces that one | no | no |
27
+ | `recurs_from` | This defect recurs from that closed one | no | no |
27
28
  | `commits_to` | This item lands in that changeset or release | yes | no |
28
29
  | `related` | Associative, non-directional | no | no |
29
30
 
30
31
  `related` carries the least information. Prefer a typed kind whenever one
31
32
  applies — `discovered_from`, `implements`, and `verifies` are the three that
32
- most often replace a reflexive `related`.
33
+ most often replace a reflexive `related`. A defect that repeats an earlier
34
+ closed one gets `recurs_from`, which is what the recurrence policy joins on.
33
35
 
34
36
  ## Adding Edges
35
37
 
@@ -57,8 +57,8 @@ pm contracts --runtime-only --availability-only
57
57
 
58
58
  ```bash
59
59
  pm package explore --project # inspect state first
60
- pm package manage --detail summary
61
- pm package doctor --detail deep
60
+ pm package manage --project
61
+ pm package doctor --detail summary
62
62
  pm package install <package> --project # then mutate
63
63
  pm contracts --command <extension-command> --flags-only
64
64
  pm package doctor --detail deep # verify after
@@ -4,8 +4,8 @@
4
4
 
5
5
  ```bash
6
6
  pm package explore --project
7
- pm package manage --detail summary
8
- pm package doctor --detail deep
7
+ pm package manage --project
8
+ pm package doctor --detail summary
9
9
  ```
10
10
 
11
11
  ## Install and Activate
@@ -21,7 +21,7 @@ pm package doctor --detail summary
21
21
  ```bash
22
22
  pm package adopt <name> --project
23
23
  pm package adopt-all --project
24
- pm package manage --detail summary
24
+ pm package manage --project
25
25
  ```
26
26
 
27
27
  ## Deactivate / Uninstall
@@ -2,9 +2,9 @@
2
2
 
3
3
  ## Common Diagnostic Sequence
4
4
 
5
- 1. `pm extension explore --project`
6
- 2. `pm extension manage --detail summary`
7
- 3. `pm extension doctor --detail deep --trace`
5
+ 1. `pm package explore --project`
6
+ 2. `pm package manage --project`
7
+ 3. `pm package doctor --detail deep --trace`
8
8
  4. `pm contracts --runtime-only --availability-only`
9
9
 
10
10
  ## Symptoms and Checks
@@ -86,6 +86,8 @@ the criteria; `--dep` **appends**.
86
86
  | Group and count | `pm aggregate --group-by <field>` | `commands` |
87
87
  | Lineage and ordering | `pm deps`, `pm graph <verb>` | `graph` |
88
88
  | Recent movement | `pm activity`, `pm events`, `pm history` | `assurance` |
89
+ | Durable lessons and records | `pm learnings`, `pm notes`, `pm history` | `evidence` |
90
+ | Deadlines and meetings | `pm remind`, `pm event`, `pm meet` | `automation` |
89
91
  | Data quality | `pm validate`, `pm health` | `assurance` |
90
92
  | Plan a multi-step change | `pm plan` | `workflows` |
91
93
  | Custom types and statuses | `pm schema`, `pm config` | `commands` |
@@ -89,8 +89,13 @@ Record evolution explicitly rather than letting it be inferred:
89
89
  pm update <NEW> --dep "id=<OLD>,kind=supersedes"
90
90
  pm update <FIX> --dep "id=<INCIDENT>,kind=incident_from"
91
91
  pm update <TEST> --dep "id=<FEATURE>,kind=verifies"
92
+ pm update <NEW-DEFECT> --dep "id=<CLOSED-DEFECT>,kind=recurs_from"
92
93
  ```
93
94
 
95
+ Record the lesson where the next agent will read it, on the item that proved
96
+ it, with `pm learnings <ID> --add "..."`; a closed item without its learning
97
+ forces the next reader to rediscover it.
98
+
94
99
  ## Periodic Hygiene
95
100
 
96
101
  ```bash
@@ -24,12 +24,27 @@ pm comments <ID> "Owner update: <state>"
24
24
  pm release <ID>
25
25
  ```
26
26
 
27
- ## Audit-Friendly Collaboration
27
+ ## Recording Durable Knowledge
28
28
 
29
- For non-owner append-only collaboration:
29
+ A comment explains this item; a learning outlives it. Record a lesson the
30
+ moment it is confirmed, on the item that produced it:
30
31
 
31
32
  ```bash
32
- pm comments <ID> --add "audit comment" --allow-audit-comment
33
- pm notes <ID> --add "audit note" --allow-audit-comment
34
- pm update <ID> --dep "id=<id>,kind=related,author=<author>,created_at=now" --allow-audit-dep-update
33
+ pm learnings <ID> --add "<what turned out to be true and how it was proven>"
34
+ pm learnings <ID> --limit 5
35
+ pm guide evidence --depth brief
36
+ ```
37
+
38
+ ## Append-Only Collaboration Between Owners
39
+
40
+ Comments, notes, and typed dependencies append for any author on a bare
41
+ install; no bypass flag is needed. The review-style flags below are provided by
42
+ the `governance-audit` package and are refused as unknown options until it is
43
+ installed:
44
+
45
+ ```bash
46
+ pm package install governance-audit --project
47
+ pm comments <ID> --add "review comment" --allow-audit-comment
48
+ pm notes <ID> --add "review note" --allow-audit-comment
49
+ pm update <ID> --dep "id=<id>,kind=discovered_from" --allow-audit-dep-update
35
50
  ```
@@ -6,14 +6,14 @@
6
6
  },
7
7
  "metadata": {
8
8
  "description": "Official marketplace for pm CLI — native git-based project management for Claude Code and AI coding agents.",
9
- "version": "2026.9.4"
9
+ "version": "2026.9.6"
10
10
  },
11
11
  "plugins": [
12
12
  {
13
13
  "name": "pm-claude",
14
14
  "source": "./plugins/pm-claude",
15
15
  "description": "Native pm CLI integration for Claude Code — 28 MCP tools, 5 workflow skills, 14 slash commands, 4 subagents, hybrid TUI task tracking, session context injection, and coordination subagents for git-based project management without leaving Claude Code.",
16
- "version": "2026.9.4",
16
+ "version": "2026.9.6",
17
17
  "author": {
18
18
  "name": "unbrained",
19
19
  "url": "https://github.com/unbraind/pm-cli"
package/CHANGELOG.md CHANGED
@@ -1,5 +1,63 @@
1
1
  # Changelog
2
2
 
3
+ ## 2026.9.6 - 2026-09-06
4
+
5
+ ### Fixed
6
+
7
+ - GH-1207: Make advisory health checks and strict verdict authority explicit ([pm-fkohe8](https://github.com/unbraind/pm-cli/blob/main/.agents/pm/issues/pm-fkohe8.toon))
8
+ - The tracker's recurrence edges and the CI recurrence policy are two ledgers with no join, so 59 of the 75 items in a recorded recurrence lineage produce no gate anywhere ([pm-7c27ep](https://github.com/unbraind/pm-cli/blob/main/.agents/pm/issues/pm-7c27ep.toon))
9
+ - Refresh review acknowledgements when bot feedback changes ([pm-8we38i](https://github.com/unbraind/pm-cli/blob/main/.agents/pm/issues/pm-8we38i.toon))
10
+ - pm health --check-only, the diagnostic AGENTS.md routes agents to, reduces nothing: it costs 33k tokens where --summary states the same verdict in 142 ([pm-du93sr](https://github.com/unbraind/pm-cli/blob/main/.agents/pm/issues/pm-du93sr.toon))
11
+ - GH-1203: Offer actionable acceptance-evidence backfill after a warning close ([pm-ub1ott](https://github.com/unbraind/pm-cli/blob/main/.agents/pm/issues/pm-ub1ott.toon))
12
+ - GH-1202: Classify abandoned merge receipts without losing durable provenance ([pm-466m0j](https://github.com/unbraind/pm-cli/blob/main/.agents/pm/issues/pm-466m0j.toon))
13
+ - GH-1200: Preview exact receipt proof before merge reconciliation ([pm-ao0bu9](https://github.com/unbraind/pm-cli/blob/main/.agents/pm/issues/pm-ao0bu9.toon))
14
+ - GH-1206: Verify legacy receipt redactions across hash encodings ([pm-v66zir](https://github.com/unbraind/pm-cli/blob/main/.agents/pm/issues/pm-v66zir.toon))
15
+ - GH-1205: Declare root-only versus inherited extension flag reservation scope ([pm-2h8t6y](https://github.com/unbraind/pm-cli/blob/main/.agents/pm/issues/pm-2h8t6y.toon))
16
+ - GH-1201: Recover invalid pending receipt evidence across release upgrades ([pm-2xtv84](https://github.com/unbraind/pm-cli/blob/main/.agents/pm/issues/pm-2xtv84.toon))
17
+ - The linked-file staleness check has no holder-lifecycle partition, so 1,220 links on closed holders warn forever while its worklist truncation hides the actionable subset behind a path count reported as a row count ([pm-zw9188](https://github.com/unbraind/pm-cli/blob/main/.agents/pm/issues/pm-zw9188.toon))
18
+ - 2026.8.1 regression: governance dedupe audit rejects the restored all-lifecycle status sentinel ([pm-449do9](https://github.com/unbraind/pm-cli/blob/main/.agents/pm/issues/pm-449do9.toon))
19
+ - Normalize local parent shorthand consistently with dependency identifiers ([pm-olcoon](https://github.com/unbraind/pm-cli/blob/main/.agents/pm/issues/pm-olcoon.toon))
20
+ - Every pm next and pm context read writes one usage-ledger row per open item under a single global lock, and the compaction trigger is a byte threshold that a count-based retention can never satisfy ([pm-bab3gb](https://github.com/unbraind/pm-cli/blob/main/.agents/pm/issues/pm-bab3gb.toon))
21
+ - Reading one item by its primary key scans the whole workspace: pm get is O(corpus) and the projection flags bound the output but not the work ([pm-ydshl9](https://github.com/unbraind/pm-cli/blob/main/.agents/pm/issues/pm-ydshl9.toon))
22
+ - Telemetry worker permanently retries JSONB-incompatible Unicode events ([pm-xlb6aw](https://github.com/unbraind/pm-cli/blob/main/.agents/pm/issues/pm-xlb6aw.toon))
23
+ - Telemetry worker: no Postgres reconnect — ingestion stalls with events stuck in RabbitMQ after postgres restart ([pm-rj3w](https://github.com/unbraind/pm-cli/blob/main/.agents/pm/issues/pm-rj3w.toon))
24
+ - Metadata index rebuilds and mutations repeatedly scan an unindexed FTS identity column ([pm-gtw5zh](https://github.com/unbraind/pm-cli/blob/main/.agents/pm/issues/pm-gtw5zh.toon))
25
+ - Read sessions emit invalid continuation identities from workspace activity rows ([pm-s8ybl9](https://github.com/unbraind/pm-cli/blob/main/.agents/pm/issues/pm-s8ybl9.toon))
26
+ - Scale fixtures silently omit unregistered Story items from metadata reads ([pm-fx80w2](https://github.com/unbraind/pm-cli/blob/main/.agents/pm/issues/pm-fx80w2.toon))
27
+ - Releases from the default branch are supported with analyzer evidence ([pm-u1baah](https://github.com/unbraind/pm-cli/blob/main/.agents/pm/issues/pm-u1baah.toon))
28
+
29
+ ### Other
30
+
31
+ - Cross-process reproducibility gate: prove CLI and MCP deterministic runs are byte-identical and fail on ambient time leaks ([pm-vklr99](https://github.com/unbraind/pm-cli/blob/main/.agents/pm/tasks/pm-vklr99.toon))
32
+ - The docs gate enforces link resolution but not doc reachability, so orphaned docs pass CI and the advertised docs map silently drifts ([pm-s4y3z4](https://github.com/unbraind/pm-cli/blob/main/.agents/pm/chores/pm-s4y3z4.toon))
33
+ - docs-skills-gate: validate anchor fragments in relative links ([pm-esbt](https://github.com/unbraind/pm-cli/blob/main/.agents/pm/tasks/pm-esbt.toon))
34
+
35
+ ## 2026.9.5 - 2026-09-05
36
+
37
+ ### Fixed
38
+
39
+ - pm next recommends outcome-milestone gates as actionable work, and summary.containers counts a bucket the envelope never emits ([pm-08mt4k](https://github.com/unbraind/pm-cli/blob/main/.agents/pm/issues/pm-08mt4k.toon))
40
+ - Windows published-release verifier test can preempt its own readiness and cleanup contract ([pm-euqm7x](https://github.com/unbraind/pm-cli/blob/main/.agents/pm/issues/pm-euqm7x.toon))
41
+ - Commander usage refusals omit token_accounting even when --token-accounting is parsed ([pm-bfa1ob](https://github.com/unbraind/pm-cli/blob/main/.agents/pm/issues/pm-bfa1ob.toon))
42
+ - flag-invocation-parity only iterates declared flags, so 21 runtime options across 8 core commands have no flag contract ([pm-2bqgs7](https://github.com/unbraind/pm-cli/blob/main/.agents/pm/issues/pm-2bqgs7.toon))
43
+ - pm release leaves the item in_progress with no owner: offer --status open (or hint) so released work does not linger as phantom WIP ([pm-ugld](https://github.com/unbraind/pm-cli/blob/main/.agents/pm/issues/pm-ugld.toon))
44
+ - GH-1169: the unknown-command hint routes to the 15-command root help that hides the target, and test is the only singular collection verb ([pm-u4t9gp](https://github.com/unbraind/pm-cli/blob/main/.agents/pm/issues/pm-u4t9gp.toon))
45
+ - pm context summary counts are denominated in the returned slice, so the canonical orient cold-start reports 4 open items in a 291-item backlog ([pm-79gv6q](https://github.com/unbraind/pm-cli/blob/main/.agents/pm/issues/pm-79gv6q.toon))
46
+ - GH-1171: restore parses the on-disk item before consulting history, so a zero-byte or corrupted item file with an intact stream cannot be rebuilt ([pm-96fsma](https://github.com/unbraind/pm-cli/blob/main/.agents/pm/issues/pm-96fsma.toon))
47
+ - history-compact renumbers version identifiers, so pm get --at N and pm restore N address a different recorded state after compaction with exit 0 and no signal ([pm-m0yjtg](https://github.com/unbraind/pm-cli/blob/main/.agents/pm/issues/pm-m0yjtg.toon))
48
+ - A deleted item's id is immediately re-mintable, so one immutable history stream can hold two unrelated items and every integrity check still reports verified ([pm-e3gn0z](https://github.com/unbraind/pm-cli/blob/main/.agents/pm/issues/pm-e3gn0z.toon))
49
+ - Point-in-time reconstruction crashes with an unstructured runtime error when a history stream opens without a baseline entry, so the restore-any-version guarantee fails with no diagnosable condition ([pm-qw1uw6](https://github.com/unbraind/pm-cli/blob/main/.agents/pm/issues/pm-qw1uw6.toon))
50
+ - Agent skills instruct flags and spellings the runtime refuses, and no guide topic routes the evidence or automation families ([pm-4957pz](https://github.com/unbraind/pm-cli/blob/main/.agents/pm/issues/pm-4957pz.toon))
51
+ - Sentry-injected release artifacts exceed the CI package budget because pre- and post-injection packlists share one ceiling ([pm-llbnua](https://github.com/unbraind/pm-cli/blob/main/.agents/pm/issues/pm-llbnua.toon))
52
+ - GH-1190: Windows nightly can publish the event index after an unlocked fallback append ([pm-a7207g](https://github.com/unbraind/pm-cli/blob/main/.agents/pm/issues/pm-a7207g.toon))
53
+ - Tag-push Release must regenerate the exact-tag changelog before immutable publication ([pm-e63v1x](https://github.com/unbraind/pm-cli/blob/main/.agents/pm/issues/pm-e63v1x.toon))
54
+
55
+ ### Other
56
+
57
+ - Upgrade Greptile review tooling to 3.5.0 with compatible dependency evidence ([pm-o3mczz](https://github.com/unbraind/pm-cli/blob/main/.agents/pm/chores/pm-o3mczz.toon))
58
+ - Point-in-time reconstruction gate: prove every item at every recorded version replays exactly from its history stream alone ([pm-wlqxg3](https://github.com/unbraind/pm-cli/blob/main/.agents/pm/tasks/pm-wlqxg3.toon))
59
+ - Refresh compatible jscpd 5.1.2 and reconcile the 2026-09-04 dependency census ([pm-gredf1](https://github.com/unbraind/pm-cli/blob/main/.agents/pm/chores/pm-gredf1.toon))
60
+
3
61
  ## 2026.9.4 - 2026-09-04
4
62
 
5
63
  ### Added
@@ -8,7 +66,6 @@
8
66
 
9
67
  ### Fixed
10
68
 
11
- - Windows published-release verifier test can preempt its own readiness and cleanup contract ([pm-euqm7x](https://github.com/unbraind/pm-cli/blob/main/.agents/pm/issues/pm-euqm7x.toon))
12
69
  - Packed npx smoke timeout rejects valid slow dependency reification ([pm-8eebb6](https://github.com/unbraind/pm-cli/blob/main/.agents/pm/issues/pm-8eebb6.toon))
13
70
  - GH-1186: unrecoverable legacy merge-receipt references block strict health with diagnostic-only remediation ([pm-cf4t42](https://github.com/unbraind/pm-cli/blob/main/.agents/pm/issues/pm-cf4t42.toon))
14
71
  - GH-1185: hash-only merge receipts make discarded scalar values unreachable to the reviewing agent ([pm-mg13iz](https://github.com/unbraind/pm-cli/blob/main/.agents/pm/issues/pm-mg13iz.toon))
@@ -223,7 +280,6 @@
223
280
  - Structured release-failure causes are preserved in blocked-release alerts ([pm-x63izf](https://github.com/unbraind/pm-cli/blob/main/.agents/pm/issues/pm-x63izf.toon))
224
281
  - Bulk writes accept newline/comma IDs from argv, stdin, and @path with effect-aware exits ([pm-3oq022](https://github.com/unbraind/pm-cli/blob/main/.agents/pm/issues/pm-3oq022.toon))
225
282
  - update-many --dry-run allows filter-only preview for review and bulk-selection workflows ([pm-kexu](https://github.com/unbraind/pm-cli/blob/main/.agents/pm/issues/pm-kexu.toon))
226
- - Releases from the default branch are supported with analyzer evidence ([pm-u1baah](https://github.com/unbraind/pm-cli/blob/main/.agents/pm/issues/pm-u1baah.toon))
227
283
 
228
284
  ### Other
229
285
 
@@ -254,7 +310,6 @@
254
310
 
255
311
  ### Other
256
312
 
257
- - Cross-process reproducibility gate: prove CLI and MCP deterministic runs are byte-identical and fail on ambient time leaks ([pm-vklr99](https://github.com/unbraind/pm-cli/blob/main/.agents/pm/tasks/pm-vklr99.toon))
258
313
  - Expose agent probe controls and versioned legacy-author vocabulary through pm config and SDK mutation APIs ([pm-yds9dt](https://github.com/unbraind/pm-cli/blob/main/.agents/pm/chores/pm-yds9dt.toon))
259
314
  - Diagnostic output budget: errors, warnings, and recovery bundles are the output an agent reads most and the only output with no declared ceiling ([pm-cha95z](https://github.com/unbraind/pm-cli/blob/main/.agents/pm/tasks/pm-cha95z.toon))
260
315
 
@@ -11,6 +11,8 @@ import type { ExtensionCommandHelpDescriptor } from "./extension-command-help.js
11
11
  export declare const BUILTIN_TYPE_HELP_VALUES: string;
12
12
  /** Documents the commander usage context payload exchanged by command, SDK, and package integrations. */
13
13
  export interface CommanderUsageContext extends CommanderGuidanceContext {
14
+ /** Normalized invocation retained for recovery and transport accounting. */
15
+ normalizedInvocationArgs: string[];
14
16
  /** Human-readable explanation suitable for logs and agent-facing output. */
15
17
  message: string;
16
18
  /** Value that configures or reports command name for this contract. */
@@ -1,5 +1,5 @@
1
1
 
2
- !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="8879d491-9158-548c-bfbd-8ab57d8eb936")}catch(e){}}();
2
+ !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="18758585-648f-5422-80e4-fbc7478c3cf3")}catch(e){}}();
3
3
  import { pathExists, resolveItemTypeRegistry, EXIT_CODE, getSettingsPath, resolvePmRoot, readSettings, getActiveExtensionRegistrations, locateItem, runActiveServiceOverride, levenshteinDistanceWithinLimit, } from "../sdk/runtime-primitives.js";
4
4
  import { BUILTIN_ITEM_TYPE_VALUES } from "../types/index.js";
5
5
  import { PM_CORE_COMMAND_NAMES, resolveSubcommandFlagContractsForCommand, } from "../sdk/cli-contracts.js";
@@ -11,6 +11,7 @@ import { extractProvidedOptionFlags, normalizeLongFlag, renderPmCommand, } from
11
11
  import { normalizeExtensionNameForMatch } from "./commands/extension/shared.js";
12
12
  import { rankCommandPaths } from "../sdk/agent/command-suggestions.js";
13
13
  import { renderMissingOptionRetry } from "../sdk/agent/command-recovery.js";
14
+ import { attachOutputTokenAccounting } from "../sdk/output-token-accounting.js";
14
15
  /** Supported values accepted by the builtin type help contract. */
15
16
  export const BUILTIN_TYPE_HELP_VALUES = BUILTIN_ITEM_TYPE_VALUES.join("|");
16
17
  const OPTIONAL_PACKAGE_INSTALL_HINTS = {
@@ -91,8 +92,9 @@ export function appendCommanderExtensionFailures(renderedUsage, json, failures)
91
92
  }
92
93
  if (json) {
93
94
  const primaryFailure = failures.find((entry) => entry.declared_command_match === true);
94
- return JSON.stringify({
95
- ...JSON.parse(renderedUsage),
95
+ const { token_accounting: priorAccounting, ...usage } = JSON.parse(renderedUsage);
96
+ const enriched = {
97
+ ...usage,
96
98
  ...(primaryFailure
97
99
  ? {
98
100
  extension_command_failure: {
@@ -105,7 +107,8 @@ export function appendCommanderExtensionFailures(renderedUsage, json, failures)
105
107
  }
106
108
  : {}),
107
109
  failed_extensions: failures,
108
- }, null, 2);
110
+ };
111
+ return JSON.stringify(priorAccounting === undefined ? enriched : attachOutputTokenAccounting(enriched, (value) => `${JSON.stringify(value, null, 2)}\n`), null, 2);
109
112
  }
110
113
  const details = failures
111
114
  .map((entry) => `- ${entry.layer}:${entry.name}: ${entry.error}`)
@@ -435,9 +438,9 @@ function resolveUnknownCommandFallbacks(commandPaths) {
435
438
  function buildUnknownCommandExamples(suggestedPaths, hasConcreteCandidates) {
436
439
  const suggestedExamples = suggestedPaths.map((path) => `pm ${path} --help`);
437
440
  if (hasConcreteCandidates) {
438
- return [...new Set([...suggestedExamples, "pm --help"])];
441
+ return [...new Set([...suggestedExamples, "pm --help --all"])];
439
442
  }
440
- return [...new Set(["pm --help", ...suggestedExamples])];
443
+ return [...new Set(["pm --help --all", ...suggestedExamples])];
441
444
  }
442
445
  /** Implements build unknown command guidance from runtime for the public runtime surface of this module. */
443
446
  export function buildUnknownCommandGuidanceFromRuntime(rawMessage, root, extensionDescriptors) {
@@ -473,7 +476,7 @@ export function buildUnknownCommandGuidanceFromRuntime(rawMessage, root, extensi
473
476
  unknownCommandExamples: examples,
474
477
  unknownCommandNextSteps: [
475
478
  ...(didYouMean ? [didYouMean] : []),
476
- 'Run "pm --help" to list commands available in this runtime, including active extensions.',
479
+ 'Run "pm --help --all" to list every command available in this runtime, including active extensions.',
477
480
  "Use one of the suggested command paths above with --help to inspect valid flags and usage.",
478
481
  ...(optionalPackageHint ? [optionalPackageHint] : []),
479
482
  ],
@@ -528,11 +531,9 @@ export function isKnownHelpCommandPath(root, commandPathTokens) {
528
531
  for (const [tokenIndex, token] of commandPathTokens.entries()) {
529
532
  const next = resolveChildCommandByToken(current, token);
530
533
  if (!next) {
531
- if (current.commands.some((candidate) => candidate.name() !== "help")) {
532
- return false;
533
- }
534
534
  const declaredArguments = current.registeredArguments;
535
535
  return (declaredArguments.length > 0 &&
536
+ (current.commands.length === 0 || declaredArguments[0]?.required === true) &&
536
537
  (declaredArguments.at(-1)?.variadic === true ||
537
538
  commandPathTokens.length - tokenIndex <= declaredArguments.length));
538
539
  }
@@ -756,7 +757,9 @@ export async function formatCommanderUsageJson(error, rootProgram, extensionDesc
756
757
  verifiedCollectionItemId: usageContext.verifiedCollectionItemId,
757
758
  failedExtensions: usageContext.failedExtensions,
758
759
  });
759
- return JSON.stringify(lean ? projectLeanErrorEnvelope(envelope) : envelope, null, 2);
760
+ const projected = lean ? projectLeanErrorEnvelope(envelope) : envelope;
761
+ const accountingRequested = parseBootstrapGlobalOptions(usageContext.normalizedInvocationArgs).tokenAccounting === true;
762
+ return JSON.stringify(accountingRequested ? attachOutputTokenAccounting(projected, (value) => `${JSON.stringify(value, null, 2)}\n`) : projected, null, 2);
760
763
  }
761
764
  /** Public contract for test only, shared by SDK and presentation-layer consumers. */
762
765
  export const _testOnly = {
@@ -767,4 +770,4 @@ export const _testOnly = {
767
770
  suggestNearestLongFlags,
768
771
  };
769
772
  //# sourceMappingURL=commander-usage.js.map
770
- //# debugId=8879d491-9158-548c-bfbd-8ab57d8eb936
773
+ //# debugId=18758585-648f-5422-80e4-fbc7478c3cf3
@@ -1,14 +1,15 @@
1
1
 
2
- !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="43167bb0-7cc0-599f-8587-8583d398f1ad")}catch(e){}}();
2
+ !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="e4324332-da8f-5ae1-b0e3-b6d0e9674f98")}catch(e){}}();
3
3
  import { hasSubcommandFlagContractsForCommand, PM_COMMAND_ALIAS_CONTRACTS, PM_CORE_COMMAND_NAMES, } from "../sdk/cli-contracts.js";
4
- import { commandOptionFlagLabel, resolveCommandOptionPolicyState, resolveTypeDefinition, EXIT_CODE, printError, writeStdout, } from "../sdk/runtime-primitives.js";
4
+ import { commandOptionFlagLabel, resolveCommandOptionPolicyState, resolveTypeDefinition, EXIT_CODE, writeStderr, writeStdout, } from "../sdk/runtime-primitives.js";
5
5
  import { buildDynamicExtensionHelpOptionSummaries, mergeHelpOptionSummaries, findCommandByPath, findDirectChildCommand, commandAliases, } from "./extension-command-help.js";
6
6
  import { getPmCommandHelpVisibilityTier, isFullHelpDiscovery, normalizeHelpCommandPath, resolveHelpDetailMode, resolveHelpNarrative, } from "./help-content.js";
7
7
  import { getCommandPath } from "./registration-helpers.js";
8
8
  import { parseBootstrapGlobalOptions, parseBootstrapHelpRequest, parseBootstrapCommandName, parseBootstrapTypeValue, } from "./bootstrap-args.js";
9
9
  import { extractProvidedOptionFlags, renderPmCommand } from "./argv-utils.js";
10
10
  import { formatCommanderErrorForJson } from "./error-guidance.js";
11
- import { BUILTIN_TYPE_HELP_VALUES, buildUnknownCommandGuidanceFromRuntime, } from "./commander-usage.js";
11
+ import { BUILTIN_TYPE_HELP_VALUES, buildUnknownCommandGuidanceFromRuntime, isKnownHelpCommandPath, } from "./commander-usage.js";
12
+ import { attachOutputTokenAccounting } from "../sdk/output-token-accounting.js";
12
13
  import { resolveCreateExplicitEmptyFlag } from "../sdk/agent/create-option-policy.js";
13
14
  import { formatPmPositionalActionFlagTip, PM_POSITIONAL_ACTION_CONTRACTS, resolvePmPositionalActionContract, } from "../sdk/cli-contracts/grammar-contracts.js";
14
15
  import { resolvePmCommandCapabilityFamily, resolvePmCommandVisibilityTier, } from "../sdk/agent-capability-contracts.js";
@@ -49,7 +50,8 @@ function resolveCommandFromPathTokens(root, pathTokens) {
49
50
  const requestedPath = pathTokens.join(" ");
50
51
  if (!PM_CORE_COMMAND_NAMES.some((commandName) => commandName === requestedPath) &&
51
52
  !hasSubcommandFlagContractsForCommand(requestedPath) &&
52
- !resolvePmPositionalActionContract(requestedPath)) {
53
+ !resolvePmPositionalActionContract(requestedPath) &&
54
+ !isKnownHelpCommandPath(root, pathTokens)) {
53
55
  return null;
54
56
  }
55
57
  for (let length = pathTokens.length - 1; length > 0; length -= 1) {
@@ -352,7 +354,7 @@ function buildJsonHelpPayload(rootProgram, targetCommand, argv, requestedPath, e
352
354
  ? requestedCommandPath
353
355
  : commanderPath;
354
356
  const positionalAction = resolvePmPositionalActionContract(resolvedPath);
355
- const projectedPath = positionalAction?.command ?? resolvedPath;
357
+ const projectedPath = positionalAction?.command ?? commanderPath;
356
358
  const commandPath = projectedPath.length > 0 ? projectedPath : undefined;
357
359
  const rootCommandPath = commandPath?.split(" ")[0];
358
360
  const fallbackNarrative = resolveHelpNarrative(commandPath, detailMode);
@@ -413,7 +415,10 @@ export async function maybeRenderBootstrapJsonHelp(rootProgram, argv, extensionD
413
415
  normalizedInvocationArgs: [...argv],
414
416
  providedOptionFlags: extractProvidedOptionFlags(argv),
415
417
  });
416
- printError(JSON.stringify(envelope, null, 2));
418
+ const output = bootstrapGlobal.tokenAccounting
419
+ ? attachOutputTokenAccounting(envelope, (value) => `${JSON.stringify(value, null, 2)}\n`)
420
+ : envelope;
421
+ writeStderr(`${JSON.stringify(output, null, 2)}\n`);
417
422
  }
418
423
  process.exitCode = EXIT_CODE.USAGE;
419
424
  return true;
@@ -563,4 +568,4 @@ export const _testOnly = {
563
568
  resolveExtensionCommandSurface,
564
569
  };
565
570
  //# sourceMappingURL=help-json-payload.js.map
566
- //# debugId=43167bb0-7cc0-599f-8587-8583d398f1ad
571
+ //# debugId=e4324332-da8f-5ae1-b0e3-b6d0e9674f98
package/dist/cli/main.js CHANGED
@@ -3,9 +3,9 @@
3
3
  * @module cli/main
4
4
  */
5
5
 
6
- !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="f947c7f0-adf8-59da-8bc7-9cd746b05839")}catch(e){}}();
6
+ !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="2b73baa7-f63e-5a3b-a8cb-659ac26d7c67")}catch(e){}}();
7
7
  import { Command, CommanderError } from "commander";
8
- import { activateExtensions, clearActiveExtensionHooks, createCoreCommandHookContext, resetActiveExtensionRuntimeState, createEmptyExtensionRegistrationRegistry, discoverExtensions, getActiveCommandResult, getActiveExtensionRegistrations, loadExtensions, consumeAfterCommandAffectedItems, runActiveCommandHandler, runActiveParserOverride, runActivePreflightOverride, runAfterCommandHooks, runBeforeCommandHooks, setActiveCommandResult, setActiveCommandContext, setActiveExtensionCommands, setActiveExtensionHooks, setActiveExtensionParsers, setActiveExtensionPreflight, setActiveExtensionRegistrations, setActiveExtensionRenderers, setActiveExtensionServices, pathExists, resolvePmCliVersion, resolvePmPackageRootFromModule, resolveItemTypeRegistry, resolveRuntimeFieldRegistry, EXIT_CODE, resolveTelemetryErrorCategory, PmCliError, asRecordOrNull, printError, printResult, maybeRunFirstUseTelemetryPrompt, emitTelemetryErrorEvent, startTelemetryCommand, deriveTelemetryCommandResolution, sentryCaptureCliError, sentryFinishCommandSpan, sentryFlush, sentryLogCliUsageError, sentrySetCommandContext, sentryStartCommandSpan, ensureSentryInit, getSettingsPath, resolvePmRoot, readSettings, readSettingsWithMetadata, runWithWorkspaceHarnessSignalDescriptors, createLazyModule, } from "../sdk/runtime-primitives.js";
8
+ import { activateExtensions, clearActiveExtensionHooks, createCoreCommandHookContext, resetActiveExtensionRuntimeState, createEmptyExtensionRegistrationRegistry, discoverExtensions, getActiveCommandResult, getActiveExtensionRegistrations, loadExtensions, consumeAfterCommandAffectedItems, runActiveCommandHandler, runActiveParserOverride, runActivePreflightOverride, runAfterCommandHooks, runBeforeCommandHooks, setActiveCommandResult, setActiveCommandContext, setActiveExtensionCommands, setActiveExtensionHooks, setActiveExtensionParsers, setActiveExtensionPreflight, setActiveExtensionRegistrations, setActiveExtensionRenderers, setActiveExtensionServices, pathExists, resolvePmCliVersion, resolvePmPackageRootFromModule, resolveItemTypeRegistry, resolveRuntimeFieldRegistry, EXIT_CODE, resolveTelemetryErrorCategory, PmCliError, asRecordOrNull, printError, printResult, writeStderr, maybeRunFirstUseTelemetryPrompt, emitTelemetryErrorEvent, startTelemetryCommand, deriveTelemetryCommandResolution, sentryCaptureCliError, sentryFinishCommandSpan, sentryFlush, sentryLogCliUsageError, sentrySetCommandContext, sentryStartCommandSpan, ensureSentryInit, getSettingsPath, resolvePmRoot, readSettings, readSettingsWithMetadata, runWithHarnessDetectionSignals, runWithWorkspaceHarnessSignalDescriptors, createLazyModule, } from "../sdk/runtime-primitives.js";
9
9
  import { runWithReproducibleProcessEnvironment } from "../sdk/reproducibility/process.js";
10
10
  import { resolveSubcommandFlagContractsForCommand } from "../sdk/cli-contracts.js";
11
11
  import { createExtensionCommandSdk } from "../sdk/extension-command-context.js";
@@ -2168,7 +2168,10 @@ async function handleRunPmCliKnownError(context, numericExitCode) {
2168
2168
  const renderedError = context.jsonErrors
2169
2169
  ? JSON.stringify(context.bootstrapGlobal.tokenAccounting ? attachOutputTokenAccounting(jsonErrorPayload, (value) => `${JSON.stringify(value, null, 2)}\n`) : jsonErrorPayload, null, 2)
2170
2170
  : formatPmCliErrorForDisplay(errorMessage, enrichedContext);
2171
- printError(renderedError);
2171
+ if (context.jsonErrors)
2172
+ writeStderr(`${renderedError}\n`);
2173
+ else
2174
+ printError(renderedError);
2172
2175
  const { errorCategory, commandResolution } = await context.emitTelemetryCommandError({
2173
2176
  command: context.attemptedCommand,
2174
2177
  errorCode: classification.code,
@@ -2254,7 +2257,10 @@ async function handleUnknownHelpCommandError(context, code) {
2254
2257
  commandResolution,
2255
2258
  resolutionStage: "parse",
2256
2259
  });
2257
- printError(renderedUsage);
2260
+ if (context.jsonErrors)
2261
+ writeStderr(`${renderedUsage}\n`);
2262
+ else
2263
+ printError(renderedUsage);
2258
2264
  if (loggedHandledErrorToSentry) {
2259
2265
  await sentryFlush(HANDLED_ERROR_SENTRY_FLUSH_TIMEOUT_MS);
2260
2266
  }
@@ -2318,7 +2324,10 @@ async function handleRunPmCliCommanderUsageError(context, code) {
2318
2324
  commandResolution,
2319
2325
  resolutionStage: "parse",
2320
2326
  });
2321
- printError(renderedUsage);
2327
+ if (context.jsonErrors)
2328
+ writeStderr(`${renderedUsage}\n`);
2329
+ else
2330
+ printError(renderedUsage);
2322
2331
  if (loggedHandledErrorToSentry) {
2323
2332
  await sentryFlush(HANDLED_ERROR_SENTRY_FLUSH_TIMEOUT_MS);
2324
2333
  }
@@ -2382,6 +2391,7 @@ async function handleRunPmCliError(params) {
2382
2391
  emitTelemetryCommandError: context.emitTelemetryCommandError,
2383
2392
  });
2384
2393
  }
2394
+ /** Dispatch one fresh CLI invocation with deterministic process state and tracker-scoped attribution. */
2385
2395
  async function runPmCliInReproducibleContext(rawArgv) {
2386
2396
  program = createPmCliProgram(CLI_VERSION);
2387
2397
  attachProgramLifecycleHooks(program);
@@ -2443,14 +2453,15 @@ async function runPmCliInReproducibleContext(rawArgv) {
2443
2453
  program.outputHelp();
2444
2454
  return;
2445
2455
  }
2446
- const invocationSettings = await readSettings(resolvePmRoot(process.cwd(), bootstrapGlobal.path));
2447
- const intentSnapshot = await loadContextIntentSnapshotForInvocation(invocationArgv, resolvePmRoot(process.cwd(), bootstrapGlobal.path), bootstrapGlobal.noExtensions, loadRuntimeExtensionSnapshot);
2456
+ const invocationPmRoot = resolvePmRoot(process.cwd(), bootstrapGlobal.path);
2457
+ const invocationSettings = await readSettings(invocationPmRoot);
2458
+ const intentSnapshot = await loadContextIntentSnapshotForInvocation(invocationArgv, invocationPmRoot, bootstrapGlobal.noExtensions, loadRuntimeExtensionSnapshot);
2448
2459
  await runWithDiscoveredContextIntentContracts({
2449
- pmRoot: resolvePmRoot(process.cwd(), bootstrapGlobal.path),
2460
+ pmRoot: invocationPmRoot,
2450
2461
  packages: intentSnapshot?.contextIntentPackages,
2451
- }, () => runWithWorkspaceHarnessSignalDescriptors(invocationSettings.agent_identity.harness_signals, () => program.parseAsync(invocationProcessArgv), {
2462
+ }, () => runWithHarnessDetectionSignals({ env: { ...process.env, PM_PATH: invocationPmRoot }, argv: invocationProcessArgv, cwd: process.cwd() }, () => runWithWorkspaceHarnessSignalDescriptors(invocationSettings.agent_identity.harness_signals, () => program.parseAsync(invocationProcessArgv), {
2452
2463
  probesEnabled: invocationSettings.agent_identity?.probes_enabled,
2453
- }));
2464
+ })));
2454
2465
  }
2455
2466
  catch (error) {
2456
2467
  await handleRunPmCliError({ error, invocationArgv });
@@ -2561,4 +2572,4 @@ export const _testOnly = {
2561
2572
  wrapThrownErrorForSentry,
2562
2573
  };
2563
2574
  //# sourceMappingURL=main.js.map
2564
- //# debugId=f947c7f0-adf8-59da-8bc7-9cd746b05839
2575
+ //# debugId=2b73baa7-f63e-5a3b-a8cb-659ac26d7c67
@@ -1,5 +1,5 @@
1
1
 
2
- !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="1c6a0524-a8eb-5a20-b395-b488249c4e83")}catch(e){}}();
2
+ !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="7b6e80ad-a85b-5539-8f47-02bfad799cdb")}catch(e){}}();
3
3
  import { EXIT_CODE, PmCliError, readSettings, renderRowsAsCsv, renderRowsAsTable, resolvePmRoot, } from "../sdk/runtime-primitives.js";
4
4
  import { renderPmCommandAliasMigrationHint, resolvePmCommandAlias, } from "../sdk/cli-contracts.js";
5
5
  import { EVAL_QUERY_SET_SCHEMA_ID } from "../sdk/eval.js";
@@ -762,6 +762,8 @@ export function registerListQueryCommands(program, options) {
762
762
  .option("--blocked-limit <n>", "Limit blocked rows (default: same as --limit)")
763
763
  .option("--ready-only", "Omit the blocked companion list")
764
764
  .option("--include-decisions", "Include human-gated Decision items in the claimable ready queue")
765
+ .option("--include-gates", "Include outcome gates in the ready queue")
766
+ .option("--include-containers", "Include containers with unfinished descendants in the ready queue")
765
767
  .option("--format <value>", "Next output format override: markdown|toon|json")
766
768
  .option("--explain-ranking", "Include the scorer model, per-signal contributions, and ranked ready ids")
767
769
  .option("--token-budget <n>", "Maximum estimated tokens spent on the ranked ready queue");
@@ -939,4 +941,4 @@ export const _testOnlyRegisterListQuery = {
939
941
  parseListFormat,
940
942
  };
941
943
  //# sourceMappingURL=register-list-query.js.map
942
- //# debugId=1c6a0524-a8eb-5a20-b395-b488249c4e83
944
+ //# debugId=7b6e80ad-a85b-5539-8f47-02bfad799cdb
@@ -1,5 +1,5 @@
1
1
 
2
- !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="4e3b2528-5128-5bfd-8234-1e60fe90d9e2")}catch(e){}}();
2
+ !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="c9d736d1-58bf-5088-aaae-0b89ad61d41f")}catch(e){}}();
3
3
  import { resolveBodyFileContent, resolveCliBulkIdsInput, EXIT_CODE, splitCommaList, PmCliError, createUnknownSubcommandError, } from "../sdk/runtime-primitives.js";
4
4
  import { CREATE_COMMANDER_OPTION_REGISTRATION_CONTRACTS, MERGE_SUBCOMMAND_VALUES, PLAN_CREATE_METADATA_PARAMETER_KEYS, UPDATE_COMMANDER_OPTION_REGISTRATION_CONTRACTS, } from "../sdk/cli-contracts.js";
5
5
  import { BUILTIN_ITEM_TYPE_VALUES, PLAN_STEP_LINK_KIND_VALUES, } from "../types/index.js";
@@ -1717,6 +1717,7 @@ export function registerMutationCommands(program, registrationOptions = {}) {
1717
1717
  program
1718
1718
  .command("history-repair")
1719
1719
  .argument("[id]", "Item id (omit with --all)")
1720
+ .option("--salvage-tail", "Recover invalid tail; requires verified prefix")
1720
1721
  .option("--all", "Scan every stream for drift and repair each drifted stream in one audited pass")
1721
1722
  .option("--dry-run", "Preview the re-anchor impact without writing the history file")
1722
1723
  .option("--normalize-provenance", "Remove invalid provenance; return aggregate-only evidence")
@@ -1735,6 +1736,7 @@ export function registerMutationCommands(program, registrationOptions = {}) {
1735
1736
  message: typeof options.message === "string" ? options.message : undefined,
1736
1737
  force: Boolean(options.force),
1737
1738
  normalizeProvenance: options.normalizeProvenance === true,
1739
+ salvageTail: options.salvageTail === true,
1738
1740
  };
1739
1741
  // history-repair only re-anchors the audit stream; item content is untouched,
1740
1742
  // so search caches do not need invalidation.
@@ -1889,4 +1891,4 @@ export function registerMutationCommands(program, registrationOptions = {}) {
1889
1891
  .action(runDepsAction);
1890
1892
  }
1891
1893
  //# sourceMappingURL=register-mutation.js.map
1892
- //# debugId=4e3b2528-5128-5bfd-8234-1e60fe90d9e2
1894
+ //# debugId=c9d736d1-58bf-5088-aaae-0b89ad61d41f