@unbrained/pm-cli 2026.8.12 → 2026.8.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (218) hide show
  1. package/.claude-plugin/marketplace.json +2 -2
  2. package/CHANGELOG.md +162 -111
  3. package/dist/cli/error-guidance.js +4 -8
  4. package/dist/cli/main.js +40 -3
  5. package/dist/cli/register-assurance.js +28 -17
  6. package/dist/cli-bundle/bundle-manifest.json +141 -173
  7. package/dist/cli-bundle/chunks/chunk-BBOFSVAK.js +197 -0
  8. package/dist/cli-bundle/chunks/chunk-BFALV3YP.js +5 -0
  9. package/dist/cli-bundle/chunks/{chunk-WLAHPSOX.js → chunk-FIW4P64F.js} +2 -2
  10. package/dist/cli-bundle/chunks/{chunk-BM5YJ2UW.js → chunk-G5JUB66K.js} +52 -52
  11. package/dist/cli-bundle/chunks/chunk-SBRKH6OR.js +2 -0
  12. package/dist/cli-bundle/chunks/chunk-TMJ7URWS.js +13 -0
  13. package/dist/cli-bundle/chunks/chunk-TXMEUUUY.js +8 -0
  14. package/dist/cli-bundle/chunks/{chunk-KOQMGCTA.js → chunk-XAVMOK6B.js} +50 -50
  15. package/dist/cli-bundle/chunks/chunk-YAMTJL6Y.js +34 -0
  16. package/dist/cli-bundle/chunks/chunk-YSVSMJ2B.js +2 -0
  17. package/dist/cli-bundle/chunks/{register-list-query-XPCJRUUD.js → register-list-query-T3EHHNNV.js} +2 -2
  18. package/dist/cli-bundle/chunks/{register-mutation-4RJCBKRS.js → register-mutation-E27WCLSZ.js} +2 -2
  19. package/dist/cli-bundle/chunks/register-operations-4R6I7CPY.js +2 -0
  20. package/dist/cli-bundle/chunks/{register-setup-LLHAKP2V.js → register-setup-3YXZ444E.js} +2 -2
  21. package/dist/cli-bundle/focused-chunks/{chunk-JAFRIWVF.js → chunk-4DQ2YERC.js} +4 -4
  22. package/dist/cli-bundle/focused-chunks/chunk-F43TT2QQ.js +8 -0
  23. package/dist/cli-bundle/focused-chunks/chunk-K7RWWOAG.js +4 -0
  24. package/dist/cli-bundle/focused-chunks/chunk-KFSZ3BP6.js +16 -0
  25. package/dist/cli-bundle/focused-chunks/{chunk-KHM2CS2C.js → chunk-KSEDUWVZ.js} +2 -2
  26. package/dist/cli-bundle/focused-chunks/chunk-KYUQGTSB.js +2 -0
  27. package/dist/cli-bundle/focused-chunks/{chunk-ZMGWAYH7.js → chunk-LZ4MV3RH.js} +2 -2
  28. package/dist/cli-bundle/focused-chunks/chunk-PGXJQLCT.js +155 -0
  29. package/dist/cli-bundle/focused-chunks/{chunk-RWPAWUOT.js → chunk-PPFGQDSI.js} +2 -2
  30. package/dist/cli-bundle/focused-chunks/chunk-Q4YY3XNF.js +2 -0
  31. package/dist/cli-bundle/focused-chunks/chunk-QK753U3U.js +46 -0
  32. package/dist/cli-bundle/focused-chunks/chunk-QUMB2J27.js +2 -0
  33. package/dist/cli-bundle/focused-chunks/chunk-SM7MTG27.js +2 -0
  34. package/dist/cli-bundle/focused-chunks/{chunk-GQW4BPUT.js → chunk-WCVE2NIG.js} +2 -2
  35. package/dist/cli-bundle/focused-chunks/chunk-XDNAW5OI.js +18 -0
  36. package/dist/cli-bundle/focused-chunks/{chunk-YIAXMC3T.js → chunk-YOOI3UZX.js} +2 -2
  37. package/dist/cli-bundle/focused-chunks/chunk-ZM6TZVHC.js +2 -0
  38. package/dist/cli-bundle/main.js +13 -13
  39. package/dist/cli-bundle/sdk-authoring.js +1 -1
  40. package/dist/cli-bundle/sdk-contracts.js +1 -1
  41. package/dist/cli-bundle/sdk-core.js +45 -41
  42. package/dist/cli-bundle/sdk-governance.js +1 -1
  43. package/dist/cli-bundle/sdk-graph.js +1 -1
  44. package/dist/cli-bundle/sdk-merge.js +109 -1
  45. package/dist/cli-bundle/sdk-query.js +1 -1
  46. package/dist/cli-bundle/sdk-runtime.js +1 -1
  47. package/dist/cli-bundle/sdk-testing.js +1 -1
  48. package/dist/cli-bundle/sdk.js +2 -2
  49. package/dist/core/checkpoint/checkpoint-gc.js +7 -12
  50. package/dist/core/extensions/activation-summary-markdown.js +5 -4
  51. package/dist/core/extensions/activation-summary.d.ts +2 -0
  52. package/dist/core/extensions/activation-summary.js +6 -2
  53. package/dist/core/extensions/capability-usage.d.ts +1 -1
  54. package/dist/core/extensions/capability-usage.js +4 -3
  55. package/dist/core/extensions/contribution-inventory.d.ts +1 -0
  56. package/dist/core/extensions/contribution-inventory.js +6 -2
  57. package/dist/core/extensions/extension-registries.js +3 -2
  58. package/dist/core/extensions/extension-types.d.ts +83 -1
  59. package/dist/core/extensions/extension-types.js +3 -2
  60. package/dist/core/extensions/loader.d.ts +2 -8
  61. package/dist/core/extensions/loader.js +53 -144
  62. package/dist/core/extensions/registration-values.d.ts +43 -0
  63. package/dist/core/extensions/registration-values.js +210 -0
  64. package/dist/core/extensions/runtime-registrations.d.ts +3 -1
  65. package/dist/core/extensions/runtime-registrations.js +12 -2
  66. package/dist/core/fs/fs-utils.d.ts +2 -0
  67. package/dist/core/fs/fs-utils.js +7 -3
  68. package/dist/core/history/drift-cache.js +4 -3
  69. package/dist/core/history/drift-scan.d.ts +6 -0
  70. package/dist/core/history/drift-scan.js +76 -58
  71. package/dist/core/history/workspace-history.d.ts +59 -0
  72. package/dist/core/history/workspace-history.js +197 -10
  73. package/dist/core/lock/lock-gc.js +8 -13
  74. package/dist/core/lock/lock.js +5 -4
  75. package/dist/core/output/output.js +12 -4
  76. package/dist/core/search/vector-stores.js +6 -11
  77. package/dist/core/store/item-metadata-cache.js +4 -4
  78. package/dist/core/telemetry/runtime.d.ts +6 -0
  79. package/dist/core/telemetry/runtime.js +101 -30
  80. package/dist/sdk/agent/command-recovery.d.ts +2 -0
  81. package/dist/sdk/agent/command-recovery.js +10 -2
  82. package/dist/sdk/annotations.js +4 -4
  83. package/dist/sdk/cli-contracts/completeness.js +9 -3
  84. package/dist/sdk/cli-contracts/enum-contracts.d.ts +1 -1
  85. package/dist/sdk/cli-contracts/flag-contracts.js +6 -3
  86. package/dist/sdk/cli-contracts/runtime-contracts.d.ts +6 -1
  87. package/dist/sdk/cli-contracts/runtime-contracts.js +155 -60
  88. package/dist/sdk/cli-contracts/schemas/assurance-definition.d.ts +32 -0
  89. package/dist/sdk/cli-contracts/schemas/assurance-definition.js +25 -2
  90. package/dist/sdk/cli-contracts/tool-parameter-tables.js +35 -5
  91. package/dist/sdk/cli-contracts/tool-schema.js +17 -2
  92. package/dist/sdk/cli-program.js +3 -3
  93. package/dist/sdk/comments.js +4 -3
  94. package/dist/sdk/compile-cache.js +4 -3
  95. package/dist/sdk/compose.d.ts +3 -1
  96. package/dist/sdk/compose.js +16 -2
  97. package/dist/sdk/context-relevance.js +12 -4
  98. package/dist/sdk/context-signal-store.js +4 -3
  99. package/dist/sdk/extension/install-runtime.js +4 -4
  100. package/dist/sdk/extension/managed-state.js +4 -3
  101. package/dist/sdk/extension-contracts.d.ts +1 -1
  102. package/dist/sdk/flag-invocation-contracts.js +5 -6
  103. package/dist/sdk/generated/generated-error-code-catalog-part-1.js +14 -2
  104. package/dist/sdk/governance/assurance-action.d.ts +27 -3
  105. package/dist/sdk/governance/assurance-action.js +112 -28
  106. package/dist/sdk/governance/assurance-mutation-error.d.ts +7 -0
  107. package/dist/sdk/governance/assurance-mutation-error.js +25 -2
  108. package/dist/sdk/governance/assurance-presets.d.ts +54 -0
  109. package/dist/sdk/governance/assurance-presets.js +136 -0
  110. package/dist/sdk/governance/assurance-runtime.d.ts +4 -0
  111. package/dist/sdk/governance/assurance-runtime.js +109 -8
  112. package/dist/sdk/governance/assurance.d.ts +39 -0
  113. package/dist/sdk/governance/assurance.js +145 -6
  114. package/dist/sdk/governance/gc.js +5 -11
  115. package/dist/sdk/governance/health.js +18 -6
  116. package/dist/sdk/governance/validate-history-drift.d.ts +7 -0
  117. package/dist/sdk/governance/validate-history-drift.js +68 -0
  118. package/dist/sdk/governance/validate.js +6 -48
  119. package/dist/sdk/graph/assembly.d.ts +23 -0
  120. package/dist/sdk/graph/assembly.js +54 -2
  121. package/dist/sdk/graph/durable-cache.js +91 -3
  122. package/dist/sdk/graph/governance-contracts.d.ts +12 -0
  123. package/dist/sdk/graph/governance-contracts.js +29 -0
  124. package/dist/sdk/graph/governance.d.ts +51 -3
  125. package/dist/sdk/graph/governance.js +216 -35
  126. package/dist/sdk/graph/index.d.ts +2 -2
  127. package/dist/sdk/graph/index.js +4 -4
  128. package/dist/sdk/graph/mutation-advisory.js +15 -7
  129. package/dist/sdk/graph/remediation.js +12 -2
  130. package/dist/sdk/guide.js +4 -4
  131. package/dist/sdk/history-read.d.ts +8 -0
  132. package/dist/sdk/history-read.js +2 -2
  133. package/dist/sdk/index.d.ts +3 -2
  134. package/dist/sdk/index.js +5 -4
  135. package/dist/sdk/linked-artifacts.d.ts +2 -0
  136. package/dist/sdk/linked-artifacts.js +29 -4
  137. package/dist/sdk/merge/install.js +5 -4
  138. package/dist/sdk/query/activity.js +4 -3
  139. package/dist/sdk/query/history.js +20 -3
  140. package/dist/sdk/read-output-budget.d.ts +2 -0
  141. package/dist/sdk/read-output-budget.js +12 -5
  142. package/dist/sdk/read-output-contracts.d.ts +61 -5
  143. package/dist/sdk/read-output-contracts.js +210 -28
  144. package/dist/sdk/read-output-rows.d.ts +11 -0
  145. package/dist/sdk/read-output-rows.js +47 -2
  146. package/dist/sdk/relationship-history.js +5 -5
  147. package/dist/sdk/runtime-primitives.d.ts +1 -1
  148. package/dist/sdk/runtime-primitives.js +3 -3
  149. package/dist/sdk/runtime.js +5 -3
  150. package/dist/sdk/schema-migration.js +4 -4
  151. package/dist/sdk/test/execution.js +4 -4
  152. package/dist/sdk/workspace-memory.js +4 -4
  153. package/dist/sdk/workspace-snapshot.js +8 -14
  154. package/dist/sdk/workspace-transaction-gc.js +4 -9
  155. package/dist/sdk/workspace-transaction.js +4 -4
  156. package/dist/sdk/workspace.js +4 -3
  157. package/docs/ASSURANCE.md +163 -3
  158. package/docs/COMMANDS.md +31 -2
  159. package/docs/CONFIGURATION.md +2 -0
  160. package/docs/EXTENSIONS.md +11 -12
  161. package/docs/READ_OUTPUT_CONTRACTS.md +44 -8
  162. package/docs/RELATIONSHIP_GRAPH.md +34 -4
  163. package/docs/SDK.md +29 -8
  164. package/docs/SDK_CONTEXT_INTEGRITY.md +32 -1
  165. package/docs/TESTING.md +47 -16
  166. package/docs/performance/sdk-entrypoint-import-costs.md +20 -13
  167. package/marketplace.json +2 -2
  168. package/package.json +6 -6
  169. package/packages/pm-beads/extensions/beads/index.ts +1 -0
  170. package/packages/pm-beads/package.json +1 -1
  171. package/packages/pm-calendar/extensions/calendar/index.ts +1 -0
  172. package/packages/pm-calendar/package.json +1 -1
  173. package/packages/pm-command-kit/package.json +1 -1
  174. package/packages/pm-digital-twin/extensions/digital-twin/index.ts +7 -0
  175. package/packages/pm-digital-twin/package.json +1 -1
  176. package/packages/pm-governance-audit/extensions/governance-audit/index.ts +4 -0
  177. package/packages/pm-governance-audit/package.json +1 -1
  178. package/packages/pm-guide-shell/extensions/guide-shell/index.ts +5 -0
  179. package/packages/pm-guide-shell/package.json +1 -1
  180. package/packages/pm-kanban/package.json +1 -1
  181. package/packages/pm-lifecycle-hooks/package.json +1 -1
  182. package/packages/pm-linked-test-adapters/extensions/linked-test-adapters/index.ts +6 -0
  183. package/packages/pm-linked-test-adapters/package.json +1 -1
  184. package/packages/pm-search-advanced/extensions/search-advanced/index.ts +2 -0
  185. package/packages/pm-search-advanced/package.json +1 -1
  186. package/packages/pm-templates/extensions/templates/index.ts +4 -0
  187. package/packages/pm-templates/package.json +1 -1
  188. package/packages/pm-todos/extensions/todos/index.ts +2 -0
  189. package/packages/pm-todos/package.json +1 -1
  190. package/packages/pm-vcs/extensions/vcs/index.ts +7 -0
  191. package/packages/pm-vcs/package.json +1 -1
  192. package/plugins/pm-claude/.claude-plugin/plugin.json +1 -1
  193. package/plugins/pm-codex/.codex-plugin/plugin.json +1 -1
  194. package/scripts/bundle-cli.mjs +17 -4
  195. package/sdk/public-surface.json +390 -60
  196. package/dist/cli-bundle/chunks/chunk-3PS7X6GS.js +0 -8
  197. package/dist/cli-bundle/chunks/chunk-7KL6KMWF.js +0 -13
  198. package/dist/cli-bundle/chunks/chunk-D55A5AEN.js +0 -33
  199. package/dist/cli-bundle/chunks/chunk-KIKDWECH.js +0 -196
  200. package/dist/cli-bundle/chunks/chunk-R76342NV.js +0 -2
  201. package/dist/cli-bundle/chunks/chunk-RBTK5EZV.js +0 -5
  202. package/dist/cli-bundle/chunks/chunk-VLUQOIDT.js +0 -2
  203. package/dist/cli-bundle/chunks/register-operations-2OGISOVR.js +0 -2
  204. package/dist/cli-bundle/focused-chunks/chunk-2DALMVF7.js +0 -5
  205. package/dist/cli-bundle/focused-chunks/chunk-5OQIMELN.js +0 -155
  206. package/dist/cli-bundle/focused-chunks/chunk-5TAGTDRE.js +0 -2
  207. package/dist/cli-bundle/focused-chunks/chunk-ECADZMVC.js +0 -18
  208. package/dist/cli-bundle/focused-chunks/chunk-EJGXRA6B.js +0 -2
  209. package/dist/cli-bundle/focused-chunks/chunk-FFGSZCPK.js +0 -16
  210. package/dist/cli-bundle/focused-chunks/chunk-ISKOBJCM.js +0 -2
  211. package/dist/cli-bundle/focused-chunks/chunk-KPSXVBDV.js +0 -2
  212. package/dist/cli-bundle/focused-chunks/chunk-KTLOKKCQ.js +0 -2
  213. package/dist/cli-bundle/focused-chunks/chunk-LGYK3NUF.js +0 -8
  214. package/dist/cli-bundle/focused-chunks/chunk-NBLUKITQ.js +0 -4
  215. package/dist/cli-bundle/focused-chunks/chunk-NYLOUPOB.js +0 -2
  216. package/dist/cli-bundle/focused-chunks/chunk-Q4T463SD.js +0 -31
  217. package/dist/cli-bundle/focused-chunks/chunk-QVZVY53N.js +0 -2
  218. package/dist/cli-bundle/focused-chunks/chunk-UTEWXDEQ.js +0 -17
@@ -1,17 +1,17 @@
1
1
  # Universal Read Output Contracts
2
2
 
3
- Tracker references: [pm-hb7ug8](../.agents/pm/features/pm-hb7ug8.toon), [pm-cxr0jb](../.agents/pm/features/pm-cxr0jb.toon), [pm-hid9g1](../.agents/pm/features/pm-hid9g1.toon), [pm-sb0tns](../.agents/pm/issues/pm-sb0tns.toon), and [pm-gjjurs](../.agents/pm/issues/pm-gjjurs.toon).
3
+ Tracker references: [pm-hb7ug8](../.agents/pm/features/pm-hb7ug8.toon), [pm-cxr0jb](../.agents/pm/features/pm-cxr0jb.toon), [pm-hid9g1](../.agents/pm/features/pm-hid9g1.toon), [pm-h8tpeh](../.agents/pm/features/pm-h8tpeh.toon), [pm-sb0tns](../.agents/pm/issues/pm-sb0tns.toon), [pm-gjjurs](../.agents/pm/issues/pm-gjjurs.toon), [pm-eugaqy](../.agents/pm/issues/pm-eugaqy.toon), [pm-jt8aa2](../.agents/pm/issues/pm-jt8aa2.toon), and [pm-kyjdne](../.agents/pm/issues/pm-kyjdne.toon).
4
4
 
5
5
  ## Agent Quick Context
6
6
 
7
7
  Every built-in read surface uses four output dimensions: what to include, how much to return, how much the result may cost, and how to encode it. The same canonical controls work through the CLI, SDK, MCP, generated schemas, runtime contracts, and shell completions.
8
8
 
9
- | Dimension | CLI | SDK and MCP | Meaning |
10
- | --------- | ------------------------------- | --------------- | ---------------------------------------------------------- |
11
- | Include | `--output-include <csv>` | `outputInclude` | Retain named fields or top-level sections. |
12
- | Amount | `--output-limit <n\|unbounded>` | `outputLimit` | Bound shared row collections. |
13
- | Cost | `--output-budget <tokens>` | `outputBudget` | Fail closed when even the compact result cannot fit. |
14
- | Encoding | `--output-format <toon\|json>` | `outputFormat` | Select the CLI renderer and record the requested encoding. |
9
+ | Dimension | CLI | SDK and MCP | Meaning |
10
+ | --------- | ------------------------------- | --------------- | ---------------------------------------------------------------------- |
11
+ | Include | `--output-include <csv>` | `outputInclude` | Retain named fields or sections, or select a declared projection mode. |
12
+ | Amount | `--output-limit <n\|unbounded>` | `outputLimit` | Bound shared row collections. |
13
+ | Cost | `--output-budget <tokens>` | `outputBudget` | Fail closed when even the compact result cannot fit. |
14
+ | Encoding | `--output-format <toon\|json>` | `outputFormat` | Select the CLI renderer and record the requested encoding. |
15
15
 
16
16
  The contract covers `list`, `context`, `search`, `get`, `next`, `health`, `deps`, `graph`, `history`, `activity`, `validate`, `events`, `contracts`, `comments`, `notes`, `files`, `docs`, `stats`, and `aggregate`, including list aliases and `ctx`.
17
17
 
@@ -24,6 +24,39 @@ repeated metadata from results by default. Request
24
24
  `--output-row-contract` / `outputRowContract: true` when a consumer needs the
25
25
  row paths, jq selector, and active TOON encoding contract.
26
26
 
27
+ ### Include Modes
28
+
29
+ `--output-include` accepts two kinds of token. A **field selector** names a row
30
+ field or section and narrows the computed result. A **projection mode** names a
31
+ whole declared projection and is the canonical spelling of a command-local mode
32
+ flag: `brief`, `compact`, `full`, `summary`, and `counts`, depending on the
33
+ surface. Controls that change execution rather than projection remain separate:
34
+ for example, `deps --collapse <none|repeated>` retains dependency-grouping
35
+ semantics, and `health --check-only` retains refresh-suppression semantics.
36
+
37
+ Mode tokens are resolved before the command computes its rows, because a mode
38
+ selects which fields exist rather than which of the computed fields survive.
39
+ `pm list --output-include brief` is therefore exactly `pm list --brief`, and the
40
+ two are byte-identical apart from the `read_output` receipt that records which
41
+ spelling was used. Modes and field selectors compose: the mode selects the
42
+ projection, the remaining selectors narrow it.
43
+
44
+ ```bash
45
+ pm list --status open --output-include brief # same result as --brief
46
+ pm contracts --output-include full # same result as --full
47
+ pm list --status open --output-include brief,id # brief projection, id only
48
+ ```
49
+
50
+ Read `readOutputIncludeModeOptions(command)` from the SDK for the exact
51
+ replacement modes a surface declares. Every compatibility alias also declares
52
+ `semantics: "replacement" | "behavior_preserving"`; generators therefore do
53
+ not have to infer obligation strength from prose. The executable migration test
54
+ derives all 22 projection-mode replacements from this table, invokes both
55
+ spellings in a temporary tracker, and compares their useful result after
56
+ removing spelling receipts and volatile run metadata. A selector that matches
57
+ neither a declared mode nor any field on any returned row is refused with the
58
+ legal domain, rather than returning rows with every field removed.
59
+
27
60
  ## Cross-Call Context Sessions
28
61
 
29
62
  `--output-session <json>` / `outputSession` composes the four per-call
@@ -92,7 +125,9 @@ pm stats --output-row-contract
92
125
  pm contracts --full --json
93
126
  ```
94
127
 
95
- Every projected result carries a `read_output` receipt with the requested dimensions, precedence, observed compatibility aliases, deterministic estimated token count, string/row compaction signals, and budget outcome. If no useful content can fit, `PmReadOutputBudgetExceeded` provides a discriminated omission result; use `isReadOutputBudgetExceeded` before accessing result-specific fields. Universal controls are rejected on mutation commands and on the mutation mode of hybrid commands such as `comments`, `notes`, `files`, and `docs`.
128
+ Every projected result carries a `read_output` receipt with the requested dimensions, precedence, observed compatibility aliases, deterministic estimated token count, string/row compaction signals, and budget outcome. Budget degradation discovers nested arrays as well as declared result rows, so validation diagnostics and other governance payloads compact their inner findings before the useful result is omitted. `compacted_row_paths` names every reduced collection without redefining those nested arrays as ordinary pagination rows.
129
+
130
+ When rows are dropped to satisfy a ceiling, the result also carries `output_budget_truncation`, naming the binding budget and its source, any explicitly requested dimension the budget overrode, every compacted collection path, and an executable recovery instruction — a default ceiling can override an explicit `--output-limit unbounded`, and that override is reported rather than silent. If no useful content can fit, `PmReadOutputBudgetExceeded` provides a discriminated omission result and reports `omitted_result_estimated_tokens`, the last useful-result estimate before omission; use `isReadOutputBudgetExceeded` before accessing result-specific fields. Universal controls are rejected on mutation commands and on the mutation mode of hybrid commands such as `comments`, `notes`, `files`, and `docs`.
96
131
 
97
132
  ## SDK and Package Usage
98
133
 
@@ -127,5 +162,6 @@ The full runtime contract reports every surface and all four dimensions. Strict
127
162
  ```bash
128
163
  pnpm contracts:check
129
164
  node scripts/run-tests.mjs test -- tests/unit/sdk/read-output-contracts.spec.ts
165
+ node scripts/run-tests.mjs test -- tests/unit/sdk/read-output-migration-hints.spec.ts
130
166
  node scripts/run-tests.mjs test -- tests/unit/commands/completion-command.spec.ts
131
167
  ```
@@ -1,6 +1,6 @@
1
1
  # Relationship graph semantics
2
2
 
3
- Tracked by [pm-4jqm](../.agents/pm/decisions/pm-4jqm.toon), [pm-ju83](../.agents/pm/features/pm-ju83.toon), [pm-8xr8](../.agents/pm/stories/pm-8xr8.toon), [pm-m2il](../.agents/pm/chores/pm-m2il.toon), and [pm-jiusod](../.agents/pm/issues/pm-jiusod.toon).
3
+ Tracked by [pm-4jqm](../.agents/pm/decisions/pm-4jqm.toon), [pm-dwj33e](../.agents/pm/decisions/pm-dwj33e.toon), [pm-ju83](../.agents/pm/features/pm-ju83.toon), [pm-8xr8](../.agents/pm/stories/pm-8xr8.toon), [pm-m2il](../.agents/pm/chores/pm-m2il.toon), [pm-jiusod](../.agents/pm/issues/pm-jiusod.toon), [pm-mfvsng](../.agents/pm/issues/pm-mfvsng.toon), [pm-9gzr4r](../.agents/pm/issues/pm-9gzr4r.toon), and [pm-xvt7ps](../.agents/pm/issues/pm-xvt7ps.toon).
4
4
 
5
5
  ## Decision
6
6
 
@@ -251,12 +251,34 @@ terminal dangling-reference partitions. Domain adapters pass their
251
251
  company, or package-defined edges survive assembly with their registered
252
252
  semantics. `auditWorkspaceRelationshipGraph`
253
253
  consumes that assembly and emits counts-first findings for active/terminal
254
- missing references, retired sentinels, ordering cycles, stale lifecycle blocks,
255
- and sparse or isolated active nodes. Findings include stable codes, severity,
254
+ missing references, retired sentinels, ordering cycles, exact
255
+ scalar-versus-structured ordering contradictions, stale lifecycle blocks, and
256
+ sparse or isolated active nodes. Findings include stable codes, severity,
256
257
  bounded deterministic samples, truncation, policy text, and safe remediation;
257
258
  the audit never invents an edge. Explicit isolate exemptions suppress policy
258
259
  findings without changing structural coverage metrics.
259
260
 
261
+ The audit profile also exposes graph-wide resilience and delivery-lineage
262
+ metrics. `nodes` and `edges` remain diagnostic totals. Structural ratchets use
263
+ `recorded_nodes`, which excludes synthesized missing/external placeholders,
264
+ and `informative_edges`, which subtracts the union of witnessed redundant edge
265
+ identities and structured rows proven to contradict scalar blocker precedence.
266
+ `redundant_edges` and `ordering_contradiction_edges` remain separate debt
267
+ censuses so repair can tighten their ceilings without weakening the
268
+ information-bearing floor. `articulation_points` and `bridge_edges` reuse the exact cut-structure
269
+ algorithm; outcome metrics count explicit `Milestone` titles beginning with
270
+ `Outcome milestone:` and follow only hierarchy or `implements` edges toward
271
+ them. Active and terminal populations are reported separately, with integer
272
+ basis-point rates and all-status reachable/unreachable totals; the explicit
273
+ outcome milestones are roots, not work subjects, and are excluded from those
274
+ populations. Rate or
275
+ all-status floors are lifecycle-stable; an absolute active-population floor is
276
+ invalid because completing reachable work legitimately moves it into the
277
+ terminal population. `finding_subjects_by_code` includes every known finding
278
+ code even when its population is zero, so assurance selectors never confuse a
279
+ clean class with a missing contract field. Generic `related` edges cannot
280
+ satisfy outcome reachability.
281
+
260
282
  ```ts
261
283
  import {
262
284
  assembleWorkspaceRelationshipGraph,
@@ -325,7 +347,15 @@ on terminal ones) reports raw dependency rows whose exact identity is stored
325
347
  more than once on one holder — invisible to every assembled-graph projection
326
348
  because graph construction deduplicates edges by identity, so
327
349
  `collectDuplicateDependencyRows` scans the pre-assembly item rows carried on
328
- the assembly. Coverage policy is type-aware: the audit profile's
350
+ the assembly. `collectOrderingStorageContradictions` similarly scans raw rows
351
+ before normalization: `blocked_by: target` plus a same-target source-first
352
+ ordering dependency asserts both directions and manufactures a two-node cycle.
353
+ The audit reports the exact holder, target, and removable dependency kind under
354
+ `ordering_storage_contradiction` or
355
+ `legacy_ordering_storage_contradiction`; cycle findings attach that evidence
356
+ instead of leaving agents to re-derive the storage cause. Mutation advisories
357
+ also identify a newly introduced contradiction before reporting its derived
358
+ cycle. Coverage policy is type-aware: the audit profile's
329
359
  `coverage_by_type` breaks active/isolated/degree≤1 counts down per item type
330
360
  (untyped items under `(untyped)`), and `isolateExemptTypes`
331
361
  (`--exempt-isolate-type`) suppresses isolate/sparse findings for types whose
package/docs/SDK.md CHANGED
@@ -284,7 +284,7 @@ Command/action contract exports:
284
284
  - Large-workspace memory primitives: `buildWorkspaceMemorySnapshot`, `readWorkspaceMemory`, `selectWorkspaceMemoryRollups`, and `searchWorkspaceMemory` build cursor-bound, rebuildable calendar-epoch and epic-lineage summaries. The stock `context` and `search` results attach matching bounded rollups automatically at 10,000 items; smaller projects skip the artifact entirely.
285
285
  - Persistent metadata-query primitives: `queryItemMetadataIndex` with `ItemMetadataIndexQuery` / `ItemMetadataIndexQueryResult` executes bounded status/type/id/parent/assignee/sprint/release/priority windows without materializing the JSON metadata corpus. It returns `null` on absent, stale, or corrupt derived state so custom hosts can fall back to authoritative reads.
286
286
  - Schema-evolution primitives: `planSchemaEvolutionMigration` and `runSchemaEvolutionMigration`, plus `PmClient.schemaRenameType`, `schemaRenameField`, and `schemaRemapStatus`, provide deterministic dry-run plans, collision refusal, index-backed candidate selection, per-item immutable history, and crash-resumable workspace transactions.
287
- - Workspace audit primitives: `appendWorkspaceHistoryChange`, `writeWorkspaceJsonWithHistory`, `getWorkspaceHistoryPath`, and `WORKSPACE_HISTORY_ID` let package-owned singleton JSON mutations share the CLI's verified `HistoryEntry` stream instead of inventing an unaudited side log.
287
+ - Workspace audit primitives: `appendWorkspaceHistoryChange`, `writeWorkspaceJsonWithHistory`, `inspectWorkspaceHistoryState`, `reconcileWorkspaceJsonHistory`, `restoreWorkspaceJsonFromHistory`, `getWorkspaceHistoryPath`, and `WORKSPACE_HISTORY_ID` let package-owned singleton JSON mutations share the CLI's verified `HistoryEntry` stream, prove replay-to-disk agreement, and recover forward without inventing an unaudited side log or rewriting history.
288
288
  - Typed annotation and relationship primitives on `PmClient`: `comments`, `notes`, `learnings`, `files`, `filesDiscover`, `docs`, `deps`, `graph`, and `append`
289
289
  - Workspace graph-query runner: `runGraph` (with `GraphCommandOptions`, `GraphResult`, and per-subcommand envelopes) resolves the workspace relationship graph through the shared fingerprint-keyed cache and dispatches bounded `ancestors`/`descendants`/`predecessors`/`successors`/`paths`/`impact`/`analyze`/`audit`/`communities`/`redundancy`/`dominators`/`slack`/`centrality`/`articulation`/`plan` queries with counts-first cost, truncation, and cache metadata; the `pm graph` CLI command and `pm_graph` MCP tool are thin adapters over it.
290
290
  - Structural graph analytics: `detectRelationshipCommunities` (deterministic label-propagation clustering with `maxIterations`/`minSize` bounds and convergence reporting), `findRedundantRelationshipEdges` (transitive-reduction scan that joins each directed ordering or hierarchy kind with its inverse spelling and returns witness paths), and `computeRelationshipDominators` (Cooper–Harvey–Kennedy immediate dominators with per-node gating weights for bottleneck ranking) — all deterministic, cancellable, and cost-metered like every other graph query.
@@ -292,12 +292,12 @@ Command/action contract exports:
292
292
  - Incremental graph cache: `WorkspaceGraphCache`, `workspaceGraphCache`, `resetWorkspaceGraphCache`, and `computeWorkspaceGraphFingerprint` reuse the assembled workspace graph and memoize deterministic query results under a fingerprint that digests every relationship-relevant item field (id, title, status and terminal classification, item type, parent, legacy blocker, structured dependencies), so long-lived hosts stop paying full-workspace assembly per bounded query; `GraphCacheMetadata` reports assembly/result hit-or-miss on every `runGraph` envelope.
293
293
  - Durable graph index: `openDurableGraphCache`, `persistDurableGraphResult`, `clearDurableGraphCache`, `durableGraphCacheStatus`, `shouldPersistDurableGraphCache`, and the `durableGraphCachePath`/`graphAuditBaselinePath` locators persist fingerprint-keyed deterministic query results across processes under `runtime/graph-cache.json` — atomic writes, corrupt-tolerant decode, bounded retention, never authoritative (rebuildable from item storage), optional below the `GRAPH_DURABLE_CACHE_MIN_ITEMS` threshold; `pm graph index` is the maintenance surface and `cache.durable` the per-envelope observability.
294
294
  - Temporal audit census: `RelationshipAuditSnapshot`, `diffRelationshipAuditSnapshots`, `saveGraphAuditBaseline`, and `loadGraphAuditBaseline` persist and compare point-in-time governance censuses (signed per-code and per-profile deltas, `same_snapshot` fingerprint equality) behind `pm graph audit --save-baseline` and the automatic `baseline` drift block on later audits.
295
- - Storage-integrity and coverage governance: `collectDuplicateDependencyRows` reports raw same-identity dependency rows duplicated on one holder (the `duplicate_dependency_row`/`legacy_duplicate_dependency_row` audit families; invisible to assembled-graph projections), `RelationshipCoverageProfile.coverage_by_type` breaks active connectivity down per item type, and `RelationshipAuditOptions.isolateExemptTypes` suppresses coverage findings for policy-valid disconnected types.
296
- - Incremental mutation advisory: `collectNewOrderingCycleWarnings` detects newly created ordering cycles component-scoped around the changed item over a lightweight per-snapshot ordering digraph (shared `collectOrderingCycles` Tarjan semantics with the audit; no full workspace assembly per mutation), and `resolveWorkspaceRelationshipKindRegistry` exposes the built-in-plus-extension relationship-kind registry resolution every surface shares.
295
+ - Storage-integrity and coverage governance: `collectDuplicateDependencyRows` reports raw same-identity dependency rows duplicated on one holder; `collectOrderingStorageContradictions` reports exact scalar blocker plus opposite-precedence structured rows before graph normalization; `RelationshipCoverageProfile` separates diagnostic `nodes`/`edges` from invariant-bearing `recorded_nodes`/`informative_edges` and independent redundancy/contradiction debt counts; `coverage_by_type` breaks active connectivity down per item type, and `RelationshipAuditOptions.isolateExemptTypes` suppresses coverage findings for policy-valid disconnected types.
296
+ - Incremental mutation advisory: `collectNewOrderingCycleWarnings` detects newly created ordering cycles component-scoped around the changed item over a lightweight per-snapshot ordering digraph and emits exact newly stored scalar-versus-structured contradiction evidence before the derived cycle warning (shared registry and `collectOrderingCycles` Tarjan semantics with the audit; no full workspace assembly per mutation).
297
297
  - Remediation planning: `planRelationshipRemediation` (with `RelationshipRemediationPlan`, `RelationshipRemediationStep`, and operation/confidence/code contracts) derives exact dry-run `remove`/`retype`/`supersede`/`waive`/`investigate` proposals from governance-audit findings and witnessed redundancy rows — evidence-backed, confidence-rated, and never auto-applied.
298
298
  - Annotation and relationship option/result contracts: `CommentsCommandOptions` / `CommentsResult`, `NotesCommandOptions` / `NotesResult`, `LearningsCommandOptions` / `LearningsResult`, `FilesCommandOptions` / `FilesResult`, `FilesDiscoverOptions` / `FilesDiscoverResult`, `DocsCommandOptions` / `DocsResult`, `DepsCommandOptions` / `DepsResult`, `AppendCommandOptions` / `AppendResult`
299
299
  - Annotation kernel primitives: `resolveAnnotationInput`, `runAnnotationCommand`, `resolveAnnotationIndex`, `parseAnnotationTextInput`, `limitAnnotationEntries`, `readAnnotationEntries`, `wrapOwnershipConflict`, `isErrnoError`, and their typed input/config/result contracts
300
- - Linked-resource kernel primitives: `runFiles`, `runFilesDiscover`, `runDocs`, `runDeps`, `runLinkedArtifacts`, parsing/normalization/path-validation helpers, and their typed contracts. The CLI files/docs/deps modules are presentation-only re-exports of these SDK implementations.
300
+ - Linked-resource kernel primitives: `runFiles`, `runFilesDiscover`, `runDocs`, `runDeps`, `runLinkedArtifacts`, `assertLinkedArtifactMutationIsUnambiguous`, parsing/normalization/path-validation helpers, and their typed contracts. The CLI files/docs/deps modules are presentation-only re-exports of these SDK implementations. A transaction that resolves one path into both its add and remove sets fails before item or history mutation; split an intentional replacement into two commands so its context remains explicit.
301
301
  - Actionability primitives: `collectBlockedByIds`, `resolveItemBlockers`, `collectDependencyBlockedIds`, and `computeActionabilityReport` expose the same edge-aware blocked/ready definition used by `pm next`, `pm context`, and `pm list-blocked`. Embedded schedulers can therefore classify custom lifecycle schemas without importing CLI or core modules.
302
302
  - Dependency-governance primitives: `collectDanglingDependencyReferences`, `collectMissingDependencyTargetIds`, and `assembleWorkspaceRelationshipGraph` normalize hierarchy, scalar blockers, and structured dependencies into one graph while partitioning missing targets into actionable active holders, informational terminal-history holders, and the legacy `no-active-blocker` sentinel without mutating stored history.
303
303
  - Relationship graph primitives: `RelationshipKindRegistry`, `createRelationshipKindRegistry`, `assertRelationshipEdgeAllowed`, `RelationshipGraph`, `RelationshipEventLog`, `RelationshipEventStore`, `planRelationshipEventBackfill`, `buildRelationshipContext`, `buildDepsRelationshipContext`, `hierarchyAncestors`, `hierarchyDescendants`, `orderingPredecessors`, `orderingSuccessors`, `enumerateRelationshipPaths`, `auditWorkspaceRelationshipGraph`, `isOrderingRelationshipKind`, and `dependencyToRelationship` provide application-defined edge semantics, durable replay, deterministic legacy migration, bounded semantic traversal, policy-aware governance, and explainable context queries. Mutation adapters should call `assertRelationshipEdgeAllowed` with the active registry before persistence; it resolves aliases and honors custom `allowSelf` definitions while built-in self edges fail before item or history writes. `RelationshipEventLog.stream/project` and their durable-store equivalents page immutable prefixes and fold them into deterministic application state with exact version, processed-count, and as-of metadata. `RelationshipEventStore.appendBatch` validates a complete import under one cross-process lock and atomically publishes it; `skip_identical` resume mode rejects same-id semantic collisions. `RelationshipGraphAdapter`, `createRelationshipGraphSnapshot`, `syncRelationshipGraphAdapter`, `loadRelationshipGraphAdapter`, and `federateRelationshipGraphSnapshots` form the backend-neutral content-addressed projection boundary for database or remote graph packages. `MemoryRelationshipGraphAdapter`, `assertRelationshipGraphAdapterConformance`, and `createRelationshipGraphScaleFixture` give package authors a reference implementation, reusable compatibility contract, and lazy deterministic fixtures through one million nodes. See [Relationship graph semantics](RELATIONSHIP_GRAPH.md).
@@ -317,7 +317,7 @@ Command/action contract exports:
317
317
  - Execution and diagnostics engines: `runTest`, `runLinkedTests`, `runTestAll`, `runStartBackgroundRun`, `runTestRunsList`, `runTestRunsStatus`, `runTestRunsLogs`, `runTestRunsStop`, `runTestRunsResume`, `runTestRunsWorker`, `runEval`, `runTelemetry`, and `runStats`. Their CLI modules are compatibility re-exports of SDK-owned implementations.
318
318
  - Execution and diagnostics contracts: `TestCommandOptions` / `TestResult` / `TestRunResult`, `TestAllCommandOptions` / `TestAllResult`, `StartBackgroundRunCommandOptions` / `StartBackgroundRunResult`, `TestRuns*CommandOptions`, `EvalOptions` / `EvalResult`, `TelemetryCommandOptions` / `TelemetrySubcommand`, and `StatsCommandOptions` / `StatsResult`.
319
319
  - Linked-test authoring primitives: `parseLinkedTestJsonEntries`, the `parseLinkedTest*` field parsers, `LINKED_TEST_PM_CONTEXT_MODE_VALUES`, `LINKED_TEST_PROTECTED_ENV_KEYS`, `classifyLinkedTestFailure`, `countFailureCategories`, and `summarizeContextPreflight` let custom hosts validate, execute, classify, and report linked tests without duplicating CLI policy.
320
- - Agent command primitives: `normalizeItemAddressInvocation` and `supportsItemIdAlias` project one item-id grammar across CLI adapters; `renderMissingOptionRetry` and `resolveMissingOptionPlaceholder` preserve attempted argv while deriving enum, boolean, and scalar recovery arity from flag contracts; `createUnknownSubcommandError` provides one typed positional refusal with complete allowed values and deterministic nearest retry; `rankCommandPaths` and `scoreCommandPathMatch` provide deterministic synonym/edit-distance/substring ranking; `resolveCreateExplicitEmptyFlag` and `supportsCreateExplicitEmpty` model a considered-but-empty strict repeatable input without inventing metadata or graph edges.
320
+ - Agent command primitives: `normalizeItemAddressInvocation` and `supportsItemIdAlias` project one item-id grammar across CLI adapters; `renderMissingOptionRetry`, `resolveMissingOptionPlaceholder`, and `resolveRecoveryCommandName` preserve attempted argv, derive enum/boolean/scalar recovery arity from flag contracts, and identify the actual command without mistaking a global option value for one; `createUnknownSubcommandError` provides one typed positional refusal with complete allowed values and deterministic nearest retry; `rankCommandPaths` and `scoreCommandPathMatch` provide deterministic synonym/edit-distance/substring ranking; `resolveCreateExplicitEmptyFlag` and `supportsCreateExplicitEmpty` model a considered-but-empty strict repeatable input without inventing metadata or graph edges.
321
321
  - Refusal reachability primitives: generated `PmErrorCodeContract.owned_states` declarations bind stable codes to concrete states, probe ids, entrypoints, and exit classes; `verifyPmRefusalReachability` compares those declarations with real CLI, SDK, MCP, or package observations and fails closed for missing, duplicate, wrong-entrypoint, mismatched, or undeclared probes.
322
322
  - Typed plan workflow primitives on `PmClient`: `plan`, `planCreate`, `planShow`, `planAddStep`, `planUpdateStep`, `planCompleteStep`, `planBlockStep`, `planReorderStep`, `planRemoveStep`, `planLink`, `planUnlink`, `planDecision`, `planDiscovery`, `planValidation`, `planResume`, `planApprove`, and `planMaterialize`
323
323
  - Plan contracts: `PlanSubcommand`, `PlanCommandOptions`, `PlanCommandResult`, `PlanResultPlan`, `PlanStepSummary`, `PlanShowDepth`, and `PlanTemplateName`
@@ -512,7 +512,8 @@ loud with attributed events and authors.
512
512
  Tracked: [pm-jcvg](../.agents/pm/tasks/pm-jcvg.toon),
513
513
  [pm-2ler](../.agents/pm/issues/pm-2ler.toon),
514
514
  [pm-chyh](../.agents/pm/issues/pm-chyh.toon), and
515
- [pm-p9sc](../.agents/pm/issues/pm-p9sc.toon).
515
+ [pm-p9sc](../.agents/pm/issues/pm-p9sc.toon). Conflicting batch refusal is
516
+ tracked by [pm-c6urop](../.agents/pm/issues/pm-c6urop.toon).
516
517
 
517
518
  Custom tools can use the same domain primitives as the CLI without dispatching a
518
519
  command action. The direct functions accept the typed command options plus a
@@ -556,6 +557,13 @@ tool invoked from a nested package never records a path that changes meaning
556
557
  when another agent runs from the repository root. Root-layout trackers use the
557
558
  tracker directory itself as their workspace.
558
559
 
560
+ Add and remove sets are compared after invocation-root anchoring, slash
561
+ normalization, glob expansion, and requested migrations. If the same path is in
562
+ both sets, `runFiles`, `runDocs`, and `runLinkedArtifacts` throw
563
+ `PmCliError` code `linked_artifact_mutation_conflict` before calling the item
564
+ store. This contract deliberately refuses to guess whether replacement or
565
+ removal should win and guarantees that no item or history write is published.
566
+
559
567
  `runDeps` also projects missing `parent` and legacy `blocked_by` references as
560
568
  typed missing edges, alongside structured dependencies. Tree and graph payloads
561
569
  apply shared depth/node/edge/token bounds and expose deterministic truncation
@@ -1159,10 +1167,17 @@ snapshot, atomic write, history append, and any compensating restore, so
1159
1167
  competing SDK writers cannot split persisted state from its audit chain. The
1160
1168
  stream participates in the history merge driver, appears in `pm activity`, and
1161
1169
  can be checked with
1162
- `pm history _workspace --verify`. Package authors that persist their own
1170
+ `pm history _workspace --verify`. Verification also replays the latest document
1171
+ map and compares every governed JSON singleton with disk; a valid chain is not
1172
+ reported healthy when the live document differs. Package authors that persist their own
1163
1173
  singleton JSON should call `writeWorkspaceJsonWithHistory`; use
1164
1174
  `appendWorkspaceHistoryChange` only when another primitive already owns the
1165
- document write.
1175
+ document write. Recovery code uses `inspectWorkspaceHistoryState` for the
1176
+ read-only classification, `reconcileWorkspaceJsonHistory` only when a terminal
1177
+ Decision explicitly authorizes adoption of the reviewed disk value, and
1178
+ `restoreWorkspaceJsonFromHistory` to reject drift and replace the singleton
1179
+ from a verified version. Reconciliation and restoration append new entries and
1180
+ compensate failed writes; neither edits historical rows.
1166
1181
 
1167
1182
  ```ts
1168
1183
  import {
@@ -3292,6 +3307,12 @@ interpreted as a missing input. Strict close validation reports missing
3292
3307
  resolution fields first and suggests a targeted `pm update` before retrying the
3293
3308
  original close invocation.
3294
3309
 
3310
+ Recovery help examples resolve their command through
3311
+ `resolveRecoveryCommandName`, which uses the same bootstrap grammar as the CLI.
3312
+ Global value flags such as `--pm-path <path>` may appear before or after the
3313
+ subcommand; their values are never exposed as inferred command names or help
3314
+ targets.
3315
+
3295
3316
  Unknown-option envelopes rank command paths that accept the rejected flag by
3296
3317
  shared vocabulary and include explicit total/truncation metadata. They are
3297
3318
  contract-discovery hints, not permission to change the requested operation.
@@ -1,6 +1,6 @@
1
1
  # SDK Context Integrity
2
2
 
3
- Tracker: [pm-0k19l7](../.agents/pm/issues/pm-0k19l7.toon), [pm-9stazf](../.agents/pm/issues/pm-9stazf.toon), [pm-tu71](../.agents/pm/issues/pm-tu71.toon), [pm-0xmajx](../.agents/pm/issues/pm-0xmajx.toon), [pm-7rrqsk](../.agents/pm/issues/pm-7rrqsk.toon), [pm-ety1qc](../.agents/pm/issues/pm-ety1qc.toon), [pm-lu6sca](../.agents/pm/features/pm-lu6sca.toon), [pm-5y05kq](../.agents/pm/issues/pm-5y05kq.toon), [pm-gjjurs](../.agents/pm/issues/pm-gjjurs.toon), and [pm-h97qxd](../.agents/pm/issues/pm-h97qxd.toon).
3
+ Tracker: [pm-0k19l7](../.agents/pm/issues/pm-0k19l7.toon), [pm-9stazf](../.agents/pm/issues/pm-9stazf.toon), [pm-tu71](../.agents/pm/issues/pm-tu71.toon), [pm-0xmajx](../.agents/pm/issues/pm-0xmajx.toon), [pm-7rrqsk](../.agents/pm/issues/pm-7rrqsk.toon), [pm-ety1qc](../.agents/pm/issues/pm-ety1qc.toon), [pm-lu6sca](../.agents/pm/features/pm-lu6sca.toon), [pm-5y05kq](../.agents/pm/issues/pm-5y05kq.toon), [pm-gjjurs](../.agents/pm/issues/pm-gjjurs.toon), [pm-h97qxd](../.agents/pm/issues/pm-h97qxd.toon), [pm-h06944](../.agents/pm/issues/pm-h06944.toon), and [pm-5t33or](../.agents/pm/features/pm-5t33or.toon).
4
4
 
5
5
  ## Agent Quick Context
6
6
 
@@ -31,6 +31,31 @@ selector grammar and omission receipts as any other SDK-owned item field.
31
31
 
32
32
  The same SDK-owned read-output registry now declares `package manage` as a first-class read surface. Package authors can resolve either `package manage` or `package-manage` to its canonical contract and discover the universal include, amount, cost, and encoding dimensions without copying CLI knowledge.
33
33
 
34
+ Compatibility aliases declare whether their migration promise is an exact
35
+ `replacement` or only `behavior_preserving`. Exact projection modes are
36
+ available through `readOutputIncludeModeOptions()` and are executed against
37
+ their legacy spelling in the temporary-tracker contract suite. Execution
38
+ controls such as `deps --collapse <value>` and `health --check-only` retain
39
+ their independent semantics and are never exposed as false include-mode
40
+ replacements.
41
+
42
+ Every registered read surface also resolves a format-aware default token ceiling
43
+ from the public command-output contract. Results already inside that ceiling are
44
+ returned byte-for-byte unchanged, so the safety default adds no receipt overhead
45
+ to ordinary reads. Oversized results follow the shared compaction ladder and
46
+ identify `budget_source: default` plus the applied `budget_tokens` in their
47
+ `read_output` receipt. Complete internal artifacts and callers that intentionally
48
+ accept unbounded output must say so explicitly with `--output-budget unbounded`
49
+ or `outputBudget: "unbounded"`; that opt-out is distinct from row-count
50
+ `--unbounded` compatibility behavior.
51
+
52
+ The budget ladder separately discovers nested arrays below declared result
53
+ rows. This lets governance envelopes reduce diagnostic findings before
54
+ omitting the whole verdict without redefining a nested tag or remediation list
55
+ as a pagination row. Receipts name every `compacted_row_paths` entry; a complete
56
+ omission also records the useful result's pre-omission estimate, while the
57
+ universal recovery remains `--output-budget unbounded`.
58
+
34
59
  ## Row discovery and exact output receipts
35
60
 
36
61
  Row locations and encoding capabilities remain part of the SDK-owned read
@@ -85,6 +110,12 @@ The SDK exposes `resolveUnknownAuthorAcknowledgmentSelector` and `parseUnknownAu
85
110
 
86
111
  Storage integrity is evaluated independently of that provider boundary. Lossless merge receipts remain visible as provenance, while only receipts containing discarded scalar values produce `merge_decisions_unreviewed` guidance; neither classification enables vector refresh or remote provider I/O.
87
112
 
113
+ Default history-drift verification also replays the append-only `_workspace`
114
+ stream and compares every governed singleton with its latest recorded state.
115
+ That agreement check reads only local history and JSON files: mismatched,
116
+ missing, or unreadable singleton paths become bounded `history_drift` evidence
117
+ without enabling embeddings, vector-store access, or any other provider I/O.
118
+
88
119
  Brief and summary check-only health projections use the scalar-only metadata
89
120
  reader. Validation uses collection-bearing metadata for evidence and
90
121
  relationship checks and materializes bodies only when strict history-drift
package/docs/TESTING.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  This page describes safe local tests, linked tests, coverage, and release-readiness checks.
4
4
 
5
- Tracked implementation updates: [pm-52eh](../.agents/pm/features/pm-52eh.toon), [pm-mcxr](../.agents/pm/issues/pm-mcxr.toon), [pm-u42x](../.agents/pm/issues/pm-u42x.toon), [pm-atfm](../.agents/pm/features/pm-atfm.toon), [pm-xmp5](../.agents/pm/tasks/pm-xmp5.toon), [pm-39cqqx](../.agents/pm/tasks/pm-39cqqx.toon), [pm-5cgm2z](../.agents/pm/chores/pm-5cgm2z.toon), [pm-avv3wx](../.agents/pm/issues/pm-avv3wx.toon).
5
+ Tracked implementation updates: [pm-52eh](../.agents/pm/features/pm-52eh.toon), [pm-mcxr](../.agents/pm/issues/pm-mcxr.toon), [pm-u42x](../.agents/pm/issues/pm-u42x.toon), [pm-atfm](../.agents/pm/features/pm-atfm.toon), [pm-xmp5](../.agents/pm/tasks/pm-xmp5.toon), [pm-39cqqx](../.agents/pm/tasks/pm-39cqqx.toon), [pm-5cgm2z](../.agents/pm/chores/pm-5cgm2z.toon), [pm-avv3wx](../.agents/pm/issues/pm-avv3wx.toon), [pm-rizqb6](../.agents/pm/issues/pm-rizqb6.toon).
6
6
 
7
7
  ## Agent Quick Context
8
8
 
@@ -100,6 +100,28 @@ node scripts/run-tests.mjs test -- tests/integration/cli.integration.spec.ts
100
100
 
101
101
  Use focused runs while iterating, then run coverage before closure when risk or scope warrants it.
102
102
 
103
+ ## CI Retry and Timeout Diagnostics
104
+
105
+ CI retains the 30-second per-test timeout and retries one failed attempt. A
106
+ test that passes only on retry is reported as flaky rather than silently folded
107
+ into the pass count; a persistent assertion still fails after the bounded
108
+ retry. Local runs do not retry, so deterministic failures stay immediate while
109
+ iterating.
110
+
111
+ Vitest's GitHub reporter emits annotations and retry evidence. The repository
112
+ reliability reporter additionally writes
113
+ `.vitest-reports/reliability-<shard>.json` and appends a job-summary table with
114
+ the test identity, file, duration, effective timeout, retry count, shard, and
115
+ failure detail. Tests completing at or above 80% of their timeout are recorded
116
+ as at-risk before load turns them into timeouts. Coverage shards upload this
117
+ JSON beside their blob report, so recurrence can be measured without decoding
118
+ the coverage artifact or re-reading raw logs.
119
+
120
+ `PM_TEST_SHARD` supplies a stable shard identity and
121
+ `PM_TEST_RELIABILITY_REPORT_DIR` can redirect the JSON report for an isolated
122
+ harness. These variables affect diagnostics only; they do not change test
123
+ selection, retry count, timeout, or verdicts.
124
+
103
125
  ## Coverage Governance
104
126
 
105
127
  Coverage gating now targets literal all-source coverage across runtime code families:
@@ -270,28 +292,37 @@ parsed `workflow_jobs`; validation requires the two sets to match exactly.
270
292
 
271
293
  ## Tracker Context-Quality Ratchets
272
294
 
273
- Tracked by [pm-ips23h](../.agents/pm/issues/pm-ips23h.toon) and
274
- [pm-kpftft](../.agents/pm/tasks/pm-kpftft.toon).
275
-
276
- `scripts/release/tracker-measurements.json` turns measured tracker populations
277
- into reviewed, shrinking-only ceilings. Each declaration names its canonical
278
- pm owner and a selector over stored dependency kinds, validator warnings,
279
- graph-profile fields, or health-check severity. Open owners enforce their
280
- ceiling; terminal owners retire it. Validator warnings and health checks are
281
- exhaustive, so a newly observed class fails until it has a canonical owner and
282
- reviewed declaration.
295
+ Tracked by [pm-ips23h](../.agents/pm/issues/pm-ips23h.toon),
296
+ [pm-kpftft](../.agents/pm/tasks/pm-kpftft.toon), and
297
+ [pm-4ok4ex](../.agents/pm/tasks/pm-4ok4ex.toon), with lifecycle-stable outcome
298
+ reachability owned by [pm-g4k74y](../.agents/pm/issues/pm-g4k74y.toon) and
299
+ [pm-bzmeaa](../.agents/pm/tasks/pm-bzmeaa.toon).
300
+
301
+ The SDK-owned assurance registry stores tracker context-quality measurements,
302
+ floors, ceilings, lifetimes, enforcement, and executable negative controls in
303
+ `.agents/pm/assurance.json`. The `tracker-context-quality` gate covers stored
304
+ relationship kinds, validator debt, health checks, graph findings, structural
305
+ cut points, and typed reachability to outcome milestones. One workspace
306
+ assurance context reuses identical graph, validate, and health evaluations, so
307
+ a broad gate has one authoritative snapshot without repeatedly rescanning it.
308
+ Outcome enforcement uses an all-status reachable population, unreachable
309
+ ceiling, and basis-point floor. Active and terminal populations remain
310
+ diagnostics: absolute per-lifecycle floors would mistake normal close or reopen
311
+ transitions for relationship loss.
283
312
 
284
313
  Run the same gate used by hosted CI:
285
314
 
286
315
  ```bash
287
316
  pnpm quality:tracker-measurements
288
- node scripts/release/tracker-measurement-gate.mjs --negative-control
317
+ pm assurance run tracker-context-quality --trigger ci --dry-run --json
289
318
  ```
290
319
 
291
- `--update` can only lower a ceiling. It refuses to write while any population
292
- has regressed or remains undeclared, so updating the baseline cannot absorb a
293
- failure. Dependency-kind regressions include the post-measurement item, target,
294
- author, timestamp, and mutation-source rows in the JSON receipt.
320
+ Every native assertion contains both a passing boundary case and an impossible
321
+ case that must fail. Changes flow through `pm assurance put`, which refuses a
322
+ weaker bound, scope, lifetime, or enforcement unless a verified Decision item
323
+ authorizes it. `scripts/release/gate-registry.json` separately inventories the
324
+ retired bespoke gate and gives every graph subcommand either a named automated
325
+ consumer or an explicit interactive-only classification.
295
326
 
296
327
  ## Agent Output Token Budgets
297
328
 
@@ -1,7 +1,9 @@
1
1
  # SDK entrypoint import costs
2
2
 
3
3
  Tracked by [pm-38bskj](../../.agents/pm/tasks/pm-38bskj.toon) and
4
- [pm-cg1sjb](../../.agents/pm/issues/pm-cg1sjb.toon).
4
+ [pm-cg1sjb](../../.agents/pm/issues/pm-cg1sjb.toon). Standalone merge-bundle
5
+ topology is tracked by
6
+ [pm-m9gu9r](../../.agents/pm/chores/pm-m9gu9r.toon).
5
7
 
6
8
  This table measures fresh-process ESM import and module evaluation. The bare
7
9
  Node v26.5.0 process floor on linux/x64
@@ -13,20 +15,25 @@ against the unchanged upper-bound budget and 30 ms scheduler margin. A single
13
15
  cold or descheduled process therefore cannot fail the gate, while a majority of
14
16
  over-budget samples still does; p95 remains visible as diagnostic evidence.
15
17
 
16
- | Package export | p50 | p95 | p50 above Node | Reduction vs aggregate |
17
- |---|---:|---:|---:|---:|
18
- | `./sdk` | 248 ms | 249 ms | 207 ms | 0% |
19
- | `./sdk/authoring` | 71 ms | 76 ms | 30 ms | 85.5% |
20
- | `./sdk/contracts` | 73 ms | 87 ms | 32 ms | 84.5% |
21
- | `./sdk/core` | 221 ms | 255 ms | 180 ms | 13% |
22
- | `./sdk/governance` | 154 ms | 161 ms | 113 ms | 45.4% |
23
- | `./sdk/graph` | 87 ms | 87 ms | 46 ms | 77.8% |
24
- | `./sdk/merge` | 111 ms | 122 ms | 70 ms | 66.2% |
25
- | `./sdk/query` | 100 ms | 105 ms | 59 ms | 71.5% |
26
- | `./sdk/runtime` | 251 ms | 289 ms | 210 ms | -1.4% |
27
- | `./sdk/testing` | 241 ms | 307 ms | 200 ms | 3.4% |
18
+ | Package export | p50 | p95 | p50 above Node | Reduction vs aggregate |
19
+ | ------------------ | -----: | -----: | -------------: | ---------------------: |
20
+ | `./sdk` | 248 ms | 249 ms | 207 ms | 0% |
21
+ | `./sdk/authoring` | 71 ms | 76 ms | 30 ms | 85.5% |
22
+ | `./sdk/contracts` | 73 ms | 87 ms | 32 ms | 84.5% |
23
+ | `./sdk/core` | 221 ms | 255 ms | 180 ms | 13% |
24
+ | `./sdk/governance` | 154 ms | 161 ms | 113 ms | 45.4% |
25
+ | `./sdk/graph` | 87 ms | 87 ms | 46 ms | 77.8% |
26
+ | `./sdk/merge` | 111 ms | 122 ms | 70 ms | 66.2% |
27
+ | `./sdk/query` | 100 ms | 105 ms | 59 ms | 71.5% |
28
+ | `./sdk/runtime` | 251 ms | 289 ms | 210 ms | -1.4% |
29
+ | `./sdk/testing` | 241 ms | 307 ms | 200 ms | 3.4% |
28
30
 
29
31
  The aggregate `@unbrained/pm-cli/sdk` remains supported for compatibility.
30
32
  New packages should import the narrowest subpath that owns their capability.
33
+ The build emits `./sdk/merge` as a standalone no-splitting bundle because its
34
+ dependency closure overlaps with several broader focused entrypoints. Keeping
35
+ that surface in the shared focused chunk graph made a merge-only import traverse
36
+ unrelated chunks; the isolated output preserves the same public exports while
37
+ keeping its runtime loading cost proportional to the capability requested.
31
38
  The committed budget file is an upper-bound ratchet and must not be weakened to
32
39
  hide a regression.
package/marketplace.json CHANGED
@@ -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.8.12"
9
+ "version": "2026.8.14"
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.8.12",
16
+ "version": "2026.8.14",
17
17
  "author": {
18
18
  "name": "unbrained",
19
19
  "url": "https://github.com/unbraind/pm-cli"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@unbrained/pm-cli",
3
- "version": "2026.8.12",
3
+ "version": "2026.8.14",
4
4
  "description": "Git-native project management CLI for humans and agents.",
5
5
  "type": "module",
6
6
  "packageManager": "pnpm@11.10.0",
@@ -120,7 +120,7 @@
120
120
  "lint:complexity:baseline": "eslint . --suppress-rule complexity --suppress-rule sonarjs/cognitive-complexity",
121
121
  "lint:duplicates": "jscpd --config .jscpd.json",
122
122
  "lint:codefactor": "pnpm quality:static",
123
- "quality:static": "pnpm build && pnpm exec tsx scripts/release/static-quality-gate.mts --max-eslint-suppressions 114 --max-coverage-ignore-pragmas 477 --min-docstring-coverage 100 --min-exported-docstring-coverage 100 --min-member-docstring-coverage 100 && node scripts/release/audit-package-boundary.mjs && node scripts/release/package-sdk-contract-parity.mjs && node scripts/release/surface-replication-gate.mjs && node scripts/release/absence-tolerance-gate.mjs && node scripts/release/token-budget-gate.mjs && node scripts/release/context-intent-calibration-gate.mjs && node scripts/release/tracker-measurement-gate.mjs && node scripts/release/gate-registry.mjs && node scripts/sdk-surface-snapshot.mjs --check && node scripts/bench/sdk-entrypoint-costs.mjs --check && node scripts/bench/cli-transport-floor.mjs --check && node dist/cli.js assurance run graph-composition --trigger ci --dry-run --json && node dist/cli.js assurance run record-integrity --trigger ci --dry-run --json",
123
+ "quality:static": "pnpm build && pnpm exec tsx scripts/release/static-quality-gate.mts --max-eslint-suppressions 113 --max-coverage-ignore-pragmas 477 --min-docstring-coverage 100 --min-exported-docstring-coverage 100 --min-member-docstring-coverage 100 && node scripts/release/audit-package-boundary.mjs && node scripts/release/package-sdk-contract-parity.mjs && node scripts/release/surface-replication-gate.mjs && node scripts/release/absence-tolerance-gate.mjs && node scripts/release/token-budget-gate.mjs && node scripts/release/context-intent-calibration-gate.mjs && node dist/cli.js assurance run tracker-context-quality --trigger ci --dry-run --json --output-budget unbounded && node scripts/release/gate-registry.mjs && node scripts/sdk-surface-snapshot.mjs --check && node scripts/bench/sdk-entrypoint-costs.mjs --check && node scripts/bench/cli-transport-floor.mjs --check && node dist/cli.js assurance run graph-composition --trigger ci --dry-run --json --output-budget unbounded && node dist/cli.js assurance run record-integrity --trigger ci --dry-run --json --output-budget unbounded",
124
124
  "quality:token-budget": "node scripts/release/token-budget-gate.mjs",
125
125
  "quality:token-surface": "node scripts/measure-agent-token-surface.mjs --check",
126
126
  "quality:token-surface:update": "pnpm build && node scripts/measure-agent-token-surface.mjs --update",
@@ -130,7 +130,7 @@
130
130
  "quality:retrieval-eval": "pnpm build && node scripts/release/retrieval-eval-gate.mjs",
131
131
  "quality:retrieval-eval:update": "pnpm build && node scripts/release/retrieval-eval-gate.mjs --update",
132
132
  "quality:gate-registry": "pnpm build && node scripts/release/gate-registry.mjs",
133
- "quality:tracker-measurements": "pnpm build && node scripts/release/tracker-measurement-gate.mjs",
133
+ "quality:tracker-measurements": "pnpm build && node dist/cli.js assurance run tracker-context-quality --trigger ci --dry-run --json --output-budget unbounded",
134
134
  "quality:package-artifact": "pnpm build && node scripts/release/package-artifact-gate.mjs",
135
135
  "quality:surface-replication": "node scripts/release/surface-replication-gate.mjs",
136
136
  "quality:absence-tolerance": "node scripts/release/absence-tolerance-gate.mjs",
@@ -219,11 +219,11 @@
219
219
  "eslint-plugin-sonarjs": "^4.2.0",
220
220
  "eslint-plugin-unicorn": "^73.0.0",
221
221
  "fast-check": "^4.9.0",
222
- "greptile": "^3.3.1",
223
- "jscpd": "^5.0.14",
222
+ "greptile": "^3.4.0",
223
+ "jscpd": "^5.0.15",
224
224
  "tsx": "^4.23.12",
225
225
  "typescript": "^6.0.3",
226
- "typescript-eslint": "^8.66.0",
226
+ "typescript-eslint": "^8.67.0",
227
227
  "vitest": "^4.1.10",
228
228
  "yaml": "^2.9.0"
229
229
  }
@@ -58,6 +58,7 @@ export function activate(api: ExtensionApi): void {
58
58
  {
59
59
  action: "beads-import",
60
60
  description: "Import Beads JSONL records into pm items.",
61
+ intent: "Import Beads records through audited pm item mutations.",
61
62
  failure_hints: [
62
63
  "Use the host-global --author <id> flag when an explicit mutation identity override is required.",
63
64
  ],
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@unbrained/pm-beads",
3
- "version": "2026.8.12",
3
+ "version": "2026.8.14",
4
4
  "private": true,
5
5
  "type": "module",
6
6
  "description": "First-party pm package for importing Beads JSONL records.",
@@ -217,6 +217,7 @@ function calendarCommand(name: "calendar" | "cal"): CommandDefinition {
217
217
  name,
218
218
  action: "calendar",
219
219
  description: "Show deadline, reminder, and scheduled event calendar views.",
220
+ intent: "Inspect time-bounded project context across schedules and work.",
220
221
  arguments: [
221
222
  {
222
223
  name: "view",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@unbrained/pm-calendar",
3
- "version": "2026.8.12",
3
+ "version": "2026.8.14",
4
4
  "private": true,
5
5
  "type": "module",
6
6
  "description": "First-party pm package for calendar and agenda views.",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@unbrained/pm-command-kit",
3
- "version": "2026.8.12",
3
+ "version": "2026.8.14",
4
4
  "private": true,
5
5
  "type": "module",
6
6
  "description": "First-party pm exemplar package for the commands capability: registerCommand, registerFlags, and registerParser.",