@unbrained/pm-cli 2026.10.24 → 2026.10.26

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 (222) hide show
  1. package/.claude-plugin/marketplace.json +1 -1
  2. package/CHANGELOG.md +48 -0
  3. package/dist/cli/error-guidance.d.ts +5 -0
  4. package/dist/cli/error-guidance.js +2 -2
  5. package/dist/cli/extension-command-help.js +2 -2
  6. package/dist/cli/register-history-activity.js +1 -1
  7. package/dist/cli/register-mutation.js +2 -2
  8. package/dist/cli-bundle/bundle-manifest.json +1 -1
  9. package/dist/cli-bundle/chunks/{chunk-3S5FLCG7.js → chunk-25MTQAHX.js} +2 -2
  10. package/dist/cli-bundle/chunks/chunk-57YPOOED.js +2 -0
  11. package/dist/cli-bundle/chunks/{chunk-YEI4N4A6.js → chunk-7UDQAINZ.js} +22 -22
  12. package/dist/cli-bundle/chunks/{chunk-ZDVTXLA6.js → chunk-ER7RLJW5.js} +2 -2
  13. package/dist/cli-bundle/chunks/{chunk-CSE47ZAN.js → chunk-MWCG25PO.js} +2 -2
  14. package/dist/cli-bundle/chunks/chunk-N6FTEILW.js +20 -0
  15. package/dist/cli-bundle/chunks/{chunk-CDR5ES7Q.js → chunk-NGKTROAO.js} +90 -86
  16. package/dist/cli-bundle/chunks/chunk-OCDRHIVQ.js +6 -0
  17. package/dist/cli-bundle/chunks/{chunk-R7KWBFM2.js → chunk-ONC4BBQP.js} +2 -2
  18. package/dist/cli-bundle/chunks/{chunk-URZB3USE.js → chunk-OUDR2HWR.js} +42 -42
  19. package/dist/cli-bundle/chunks/{chunk-FASDGYQC.js → chunk-T7T4WLUY.js} +3 -3
  20. package/dist/cli-bundle/chunks/{chunk-Z62RXNHW.js → chunk-TGOG5BFM.js} +2 -2
  21. package/dist/cli-bundle/chunks/chunk-UF6EXZSP.js +2 -0
  22. package/dist/cli-bundle/chunks/chunk-VS2IIV3F.js +128 -0
  23. package/dist/cli-bundle/chunks/chunk-XAIR53QZ.js +2 -0
  24. package/dist/cli-bundle/chunks/{chunk-VSSHB6XI.js → chunk-Y42DYMZX.js} +2 -2
  25. package/dist/cli-bundle/chunks/{chunk-MA7SNKYK.js → chunk-YJBIPNDL.js} +2 -2
  26. package/dist/cli-bundle/chunks/{chunk-4PNAUT2E.js → chunk-Z35XAHUN.js} +2 -2
  27. package/dist/cli-bundle/chunks/chunk-ZLVFUZI4.js +30 -0
  28. package/dist/cli-bundle/chunks/{chunk-3VI4XDP2.js → chunk-ZT64RDMF.js} +2 -2
  29. package/dist/cli-bundle/chunks/{indexed-receipt-blobs-XANVELIV.js → indexed-receipt-blobs-NWQIDTH7.js} +2 -2
  30. package/dist/cli-bundle/chunks/{mutation-admission-NVTBZ7DH.js → mutation-admission-VTNV6JV2.js} +2 -2
  31. package/dist/cli-bundle/chunks/{register-list-query-2FE6K7FQ.js → register-list-query-LZDWUZS4.js} +3 -3
  32. package/dist/cli-bundle/chunks/register-mutation-M2A7PH42.js +20 -0
  33. package/dist/cli-bundle/chunks/register-operations-E7P2JTXM.js +2 -0
  34. package/dist/cli-bundle/chunks/{register-setup-P3VLCTDY.js → register-setup-DOV7KGSH.js} +2 -2
  35. package/dist/cli-bundle/chunks/{settlement-hook-YUVCO65H.js → settlement-hook-SVD6CO7U.js} +2 -2
  36. package/dist/cli-bundle/chunks/stage-LYLEOAQB.js +2 -0
  37. package/dist/cli-bundle/focused-chunks/chunk-226XKW3W.js +8 -0
  38. package/dist/cli-bundle/focused-chunks/chunk-ABMNYWV6.js +2 -0
  39. package/dist/cli-bundle/focused-chunks/{chunk-RSEGFZTY.js → chunk-ADSBGYLW.js} +54 -54
  40. package/dist/cli-bundle/focused-chunks/{chunk-JYXA4JIP.js → chunk-B266DDBJ.js} +2 -2
  41. package/dist/cli-bundle/focused-chunks/{chunk-R536272H.js → chunk-BH7RE2ZY.js} +2 -2
  42. package/dist/cli-bundle/focused-chunks/chunk-BL77VCRB.js +22 -0
  43. package/dist/cli-bundle/focused-chunks/chunk-CSCZYSNZ.js +2 -0
  44. package/dist/cli-bundle/focused-chunks/{chunk-6HJCSHBG.js → chunk-D5YQ4KAE.js} +2 -2
  45. package/dist/cli-bundle/focused-chunks/{chunk-TAHSXKAT.js → chunk-E5C24MCV.js} +2 -2
  46. package/dist/cli-bundle/focused-chunks/{chunk-SHUPX6G2.js → chunk-I7H3XF25.js} +2 -2
  47. package/dist/cli-bundle/focused-chunks/chunk-IF6C43IP.js +2 -0
  48. package/dist/cli-bundle/focused-chunks/chunk-KERJNFXY.js +2 -0
  49. package/dist/cli-bundle/focused-chunks/{chunk-BUZ2Z4P3.js → chunk-KTXU5WU6.js} +2 -2
  50. package/dist/cli-bundle/focused-chunks/chunk-NE27VCU7.js +91 -0
  51. package/dist/cli-bundle/focused-chunks/chunk-NFN2P4TW.js +2 -0
  52. package/dist/cli-bundle/focused-chunks/{chunk-7RQOFHMH.js → chunk-NLZUI234.js} +4 -4
  53. package/dist/cli-bundle/focused-chunks/chunk-PK5FJIVA.js +12 -0
  54. package/dist/cli-bundle/focused-chunks/{chunk-IUAYTD2S.js → chunk-UHWTPOM4.js} +24 -24
  55. package/dist/cli-bundle/focused-chunks/{chunk-ES2NGVHZ.js → chunk-UP765R2V.js} +2 -2
  56. package/dist/cli-bundle/focused-chunks/{chunk-POLMFGPQ.js → chunk-WDWHUJQW.js} +2 -2
  57. package/dist/cli-bundle/focused-chunks/{chunk-NX7TVNUM.js → chunk-YQKLKRMW.js} +2 -2
  58. package/dist/cli-bundle/focused-chunks/chunk-YTEC2EPM.js +3 -0
  59. package/dist/cli-bundle/focused-chunks/{chunk-RVUGTIIU.js → chunk-YW5GHQN2.js} +2 -2
  60. package/dist/cli-bundle/focused-chunks/{indexed-receipt-blobs-FVOA3XMI.js → indexed-receipt-blobs-YFDNGHCM.js} +2 -2
  61. package/dist/cli-bundle/focused-chunks/{mutation-admission-PB6YFY7S.js → mutation-admission-L42E3U5U.js} +2 -2
  62. package/dist/cli-bundle/focused-chunks/{settlement-hook-2VXEB6PP.js → settlement-hook-3CADO4XZ.js} +2 -2
  63. package/dist/cli-bundle/focused-chunks/stage-TUQHWU7N.js +2 -0
  64. package/dist/cli-bundle/main.js +19 -19
  65. package/dist/cli-bundle/sdk-authoring.js +1 -1
  66. package/dist/cli-bundle/sdk-contracts.js +2 -2
  67. package/dist/cli-bundle/sdk-core.js +23 -23
  68. package/dist/cli-bundle/sdk-governance.js +1 -1
  69. package/dist/cli-bundle/sdk-graph.js +1 -1
  70. package/dist/cli-bundle/sdk-merge.js +57 -58
  71. package/dist/cli-bundle/sdk-query.js +1 -1
  72. package/dist/cli-bundle/sdk-runtime.js +1 -1
  73. package/dist/cli-bundle/sdk-testing.js +1 -1
  74. package/dist/cli-bundle/sdk.js +9 -9
  75. package/dist/core/diagnostics/remediation.js +1 -1
  76. package/dist/core/extensions/extension-types.d.ts +3 -0
  77. package/dist/core/extensions/extension-types.js +1 -1
  78. package/dist/core/output/mutation-projection.js +1 -1
  79. package/dist/core/policy/workflow-policy-store.js +1 -1
  80. package/dist/core/shared/errors.d.ts +22 -0
  81. package/dist/core/shared/errors.js +1 -1
  82. package/dist/core/shared/secret-rules.d.ts +17 -0
  83. package/dist/core/shared/secret-rules.js +2 -1
  84. package/dist/core/store/item-mutation-precondition.d.ts +8 -0
  85. package/dist/core/store/item-mutation-precondition.js +1 -1
  86. package/dist/core/store/item-store.js +1 -1
  87. package/dist/core/store/settings.js +2 -2
  88. package/dist/sdk/agent/command-recovery.js +1 -1
  89. package/dist/sdk/cli-contracts/commander-mutation-options.js +1 -1
  90. package/dist/sdk/cli-contracts/commander-types.js +1 -1
  91. package/dist/sdk/cli-contracts/completeness.js +1 -1
  92. package/dist/sdk/cli-contracts/flag-contracts.d.ts +2 -0
  93. package/dist/sdk/cli-contracts/flag-contracts.js +1 -1
  94. package/dist/sdk/cli-contracts/flag-lexicon-contracts.js +1 -1
  95. package/dist/sdk/cli-contracts/grammar-contracts.js +1 -1
  96. package/dist/sdk/cli-contracts/registration-helpers.d.ts +3 -1
  97. package/dist/sdk/cli-contracts/registration-helpers.js +2 -2
  98. package/dist/sdk/cli-contracts/runtime-contracts.js +1 -1
  99. package/dist/sdk/cli-contracts/tool-option-contracts.d.ts +4 -0
  100. package/dist/sdk/cli-contracts/tool-option-contracts.js +1 -1
  101. package/dist/sdk/cli-contracts/tool-parameter-tables.js +1 -1
  102. package/dist/sdk/cli-contracts/tool-schema.d.ts +2 -2
  103. package/dist/sdk/cli-contracts/tool-schema.js +1 -1
  104. package/dist/sdk/completion/fish.js +3 -1
  105. package/dist/sdk/completion/zsh.js +3 -1
  106. package/dist/sdk/context-signal-store.js +2 -2
  107. package/dist/sdk/core.d.ts +1 -1
  108. package/dist/sdk/core.js +1 -1
  109. package/dist/sdk/extension-command-context.js +2 -2
  110. package/dist/sdk/generated/generated-error-code-catalog-part-1.js +1 -1
  111. package/dist/sdk/generated/generated-error-code-catalog-part-2.js +1 -1
  112. package/dist/sdk/governance/health-merge-evidence.d.ts +5 -0
  113. package/dist/sdk/governance/health-merge-evidence.js +1 -1
  114. package/dist/sdk/governance/health.js +1 -1
  115. package/dist/sdk/index.d.ts +3 -2
  116. package/dist/sdk/index.js +1 -1
  117. package/dist/sdk/item-transaction.js +1 -1
  118. package/dist/sdk/lifecycle/close-many.d.ts +3 -0
  119. package/dist/sdk/lifecycle/close-many.js +1 -1
  120. package/dist/sdk/lifecycle/close.d.ts +3 -1
  121. package/dist/sdk/lifecycle/close.js +1 -1
  122. package/dist/sdk/lifecycle/create.d.ts +2 -0
  123. package/dist/sdk/lifecycle/create.js +1 -1
  124. package/dist/sdk/lifecycle/plan.d.ts +2 -0
  125. package/dist/sdk/lifecycle/plan.js +1 -1
  126. package/dist/sdk/lifecycle/restore.js +1 -1
  127. package/dist/sdk/lifecycle-policy.d.ts +11 -0
  128. package/dist/sdk/lifecycle-policy.js +1 -1
  129. package/dist/sdk/merge/history-scalar-rebase.d.ts +9 -0
  130. package/dist/sdk/merge/history-scalar-rebase.js +2 -0
  131. package/dist/sdk/merge/ignored-artifacts.d.ts +13 -0
  132. package/dist/sdk/merge/ignored-artifacts.js +2 -0
  133. package/dist/sdk/merge/stage.js +1 -1
  134. package/dist/sdk/merge/three-way.js +1 -1
  135. package/dist/sdk/mutation-guard.d.ts +6 -1
  136. package/dist/sdk/mutation-guard.js +1 -1
  137. package/dist/sdk/output/fit-envelope.d.ts +98 -0
  138. package/dist/sdk/output/fit-envelope.js +2 -0
  139. package/dist/sdk/public-surface.json +1 -1
  140. package/dist/sdk/query/activity.d.ts +14 -2
  141. package/dist/sdk/query/activity.js +1 -1
  142. package/dist/sdk/query/calendar.d.ts +16 -0
  143. package/dist/sdk/query/calendar.js +3 -3
  144. package/dist/sdk/query/context.js +2 -2
  145. package/dist/sdk/query/get.js +1 -1
  146. package/dist/sdk/query/list.js +1 -1
  147. package/dist/sdk/query/search-contracts.js +1 -1
  148. package/dist/sdk/query/window-pagination.d.ts +20 -0
  149. package/dist/sdk/query/window-pagination.js +2 -0
  150. package/dist/sdk/query.d.ts +1 -0
  151. package/dist/sdk/query.js +1 -1
  152. package/dist/sdk/read-output-contracts.js +1 -1
  153. package/dist/sdk/read-output-session.d.ts +1 -1
  154. package/dist/sdk/read-output-session.js +1 -1
  155. package/dist/sdk/runtime-input.js +1 -1
  156. package/dist/sdk/runtime-primitives.d.ts +1 -1
  157. package/dist/sdk/runtime-primitives.js +1 -1
  158. package/dist/sdk/runtime.d.ts +3 -3
  159. package/dist/sdk/runtime.js +1 -1
  160. package/dist/sdk/scheduling-shortcuts.d.ts +2 -0
  161. package/dist/sdk/scheduling-shortcuts.js +1 -1
  162. package/dist/sdk/schema-migration.js +2 -2
  163. package/dist/sdk/templates.d.ts +7 -1
  164. package/dist/sdk/templates.js +2 -2
  165. package/dist/sdk/workspace-transaction.d.ts +3 -1
  166. package/dist/sdk/workspace-transaction.js +2 -2
  167. package/docs/COMMANDS.md +21 -2
  168. package/docs/EXTENSIONS.md +1 -1
  169. package/docs/MERGE_SAFETY.md +28 -0
  170. package/docs/MUTATION_INTEGRITY.md +33 -0
  171. package/docs/QUALITY_EVIDENCE.md +9 -0
  172. package/docs/READ_OUTPUT_CONTRACTS.md +55 -1
  173. package/docs/SDK.md +173 -12
  174. package/docs/WORKFLOW_POLICIES.md +14 -1
  175. package/docs/agent-task-token-baseline.json +1 -1
  176. package/docs/agent-task-transcripts.json +1 -1
  177. package/docs/generated/FLAG_LEXICON_BUDGETS.md +4 -4
  178. package/docs/generated/REFUSAL_CLOSURE_CENSUS.md +6 -3
  179. package/marketplace.json +1 -1
  180. package/package.json +1 -1
  181. package/packages/pm-beads/package.json +1 -1
  182. package/packages/pm-calendar/extensions/calendar/index.ts +6 -0
  183. package/packages/pm-calendar/extensions/calendar/shortcuts.ts +2 -2
  184. package/packages/pm-calendar/package.json +1 -1
  185. package/packages/pm-command-kit/package.json +1 -1
  186. package/packages/pm-digital-twin/package.json +1 -1
  187. package/packages/pm-governance-audit/package.json +1 -1
  188. package/packages/pm-guide-shell/package.json +1 -1
  189. package/packages/pm-kanban/package.json +1 -1
  190. package/packages/pm-lifecycle-hooks/package.json +1 -1
  191. package/packages/pm-linked-test-adapters/package.json +1 -1
  192. package/packages/pm-search-advanced/package.json +1 -1
  193. package/packages/pm-templates/extensions/templates/runtime.ts +3 -1
  194. package/packages/pm-templates/package.json +1 -1
  195. package/packages/pm-todos/package.json +1 -1
  196. package/packages/pm-vcs/package.json +1 -1
  197. package/plugins/pm-claude/.claude-plugin/plugin.json +1 -1
  198. package/plugins/pm-claude/package.json +1 -1
  199. package/plugins/pm-codex/.codex-plugin/plugin.json +1 -1
  200. package/plugins/pm-codex/package.json +1 -1
  201. package/plugins/pm-codex/plugin.json +1 -1
  202. package/runtime-dependencies.json +1 -1
  203. package/dist/cli-bundle/chunks/chunk-CNEUJHA4.js +0 -2
  204. package/dist/cli-bundle/chunks/chunk-HZNFNETE.js +0 -127
  205. package/dist/cli-bundle/chunks/chunk-KGZGXC7T.js +0 -30
  206. package/dist/cli-bundle/chunks/chunk-TZYQ4JDZ.js +0 -6
  207. package/dist/cli-bundle/chunks/chunk-UY5UHI4I.js +0 -2
  208. package/dist/cli-bundle/chunks/chunk-VPMQEVU6.js +0 -20
  209. package/dist/cli-bundle/chunks/register-mutation-KZXQUZUH.js +0 -20
  210. package/dist/cli-bundle/chunks/register-operations-BOCBWNKJ.js +0 -2
  211. package/dist/cli-bundle/chunks/stage-WRDTMCCF.js +0 -2
  212. package/dist/cli-bundle/focused-chunks/chunk-3QYTS4OY.js +0 -12
  213. package/dist/cli-bundle/focused-chunks/chunk-5MKNVJCM.js +0 -2
  214. package/dist/cli-bundle/focused-chunks/chunk-AGCEWJ27.js +0 -21
  215. package/dist/cli-bundle/focused-chunks/chunk-CEEOWDB7.js +0 -8
  216. package/dist/cli-bundle/focused-chunks/chunk-GXAXDPD4.js +0 -2
  217. package/dist/cli-bundle/focused-chunks/chunk-NFFPNMTH.js +0 -2
  218. package/dist/cli-bundle/focused-chunks/chunk-SBJ2IKTH.js +0 -3
  219. package/dist/cli-bundle/focused-chunks/chunk-X5YRJMAY.js +0 -2
  220. package/dist/cli-bundle/focused-chunks/chunk-XTYEASIY.js +0 -2
  221. package/dist/cli-bundle/focused-chunks/chunk-ZMWLV2CE.js +0 -91
  222. package/dist/cli-bundle/focused-chunks/stage-MQE4PFWT.js +0 -2
@@ -132,6 +132,10 @@ pm merge install --dry-run --json
132
132
 
133
133
  ## Artifact semantics
134
134
 
135
+ History scalar rebasing and ignored settlement artifacts are tracked by
136
+ [pm-gh1553](../.agents/pm/issues/pm-gh1553.toon) and
137
+ [pm-gh1556](../.agents/pm/issues/pm-gh1556.toon).
138
+
135
139
  | Artifact | Driver | Merge behavior |
136
140
  | ---------------------------------------------------------------- | ----------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
137
141
  | Item `.toon` / `.md` | `pm-item-toon` / `pm-item-markdown` | Three-way field merge; append-like collections use set union, `updated_at` uses the latest timestamp, scalar conflicts select the value from the later document update with stable value order as an equal-timestamp tie-break, and canonical serialization recomputes TOON counts. |
@@ -139,6 +143,18 @@ pm merge install --dry-run --json
139
143
  | tracker `**/*.jsonl` except the later `history/*.jsonl` override | `pm-relationship` | Covers default and package-owned custom relationship event paths, unions divergent suffixes by `eventId` (timestamp-ordered, ours-first on ties), and renumbers `sequence` consecutively so the strict-sequence store loader accepts the merged stream. |
140
144
  | root `settings.json` and nested `**/*.json` | `pm-json` | Recursively merges objects per key. Arrays compose when both branches preserve the base and add distinct entries, so independent extension installs and evaluation additions merge without weakening edit/removal conflict detection. |
141
145
 
146
+ History union validates each event in its original branch before rebasing its
147
+ effects. A whole metadata-field replacement still assigns its exact value when
148
+ another branch removed that field; a repeated whole-field removal keeps its
149
+ event even when absence already satisfies its effect. This covers a branch
150
+ claim following another branch's release without losing closure or comments.
151
+ Nested paths and conditional patches remain strict. An unsafe scalar patch
152
+ refuses with `history_union_rebase_conflict` and SDK `history_merge` coordinates
153
+ (branch, one-based event line, operation, scalar-patch index and JSON pointer).
154
+ CLI diagnostics name those coordinates in the error message. Preserve all three
155
+ inputs and both item snapshots for deliberate recovery;
156
+ verify the resolved history and preview reconciliation before committing.
157
+
142
158
  The `tests` collection has an additional execution-safety rule. Its semantic
143
159
  identity excludes provenance so the same command/context does not duplicate
144
160
  when branches record different authorship metadata. A test definition newly
@@ -485,6 +501,18 @@ The result's `staged_paths` lists the repository-relative artifacts added.
485
501
  Tracker aliases resolve before preview, so proof verification, repair and staging
486
502
  use the same physical tracker root.
487
503
 
504
+ Both preview and apply check Git's effective ignore rules before any staging or
505
+ audit write. An ignored artifact refuses with `merge_settlement_review_required`,
506
+ `reason: ignored_merge_artifacts`, its relative path, and the owning
507
+ `file:line: pattern`. Remove or narrow that rule, then retry the preview. Older
508
+ workspaces may still ignore `merge-receipts/` from the former clone-local receipt
509
+ policy; current receipt sidecars must travel with the merge commit. `pm health`
510
+ checks a representative receipt path even before a merge exists and reports
511
+ `merge_artifacts_ignored` with the rule coordinates. A file-specific rule is
512
+ also checked against each actual settlement artifact. Git negations and tracked
513
+ files retain their native meaning; pm neither force-adds artifacts nor rewrites
514
+ user ignore rules.
515
+
488
516
  Repositories can explicitly opt into a merge-aware `pre-commit` hook:
489
517
 
490
518
  ```bash
@@ -2,6 +2,8 @@
2
2
 
3
3
  Tracker references: [pm-h90s](../.agents/pm/issues/pm-h90s.toon), [pm-pim7](../.agents/pm/features/pm-pim7.toon), [pm-w8q4](../.agents/pm/features/pm-w8q4.toon), [pm-9yfo](../.agents/pm/tasks/pm-9yfo.toon), [pm-wwooxx](../.agents/pm/issues/pm-wwooxx.toon), [pm-3kk6](../.agents/pm/issues/pm-3kk6.toon)
4
4
 
5
+ Concrete home-path normalization is tracked by [pm-gh1583](https://github.com/unbraind/pm-cli/blob/main/.agents/pm/issues/pm-gh1583.toon). Tracker records are repository-only and excluded from npm.
6
+
5
7
  `pm` treats mutation provenance and content safety as shared SDK policy. CLI,
6
8
  MCP, and package hosts can therefore enforce the same rules without duplicating
7
9
  argument parsing or exposing detected values.
@@ -70,6 +72,10 @@ whether a blocking policy was explicitly overridden. `scanMutationSecrets` is
70
72
  available separately for package-specific preflight UIs. Cyclic inputs are
71
73
  safe; scanner failures fail open with `secret_guard_scan_failed_open`.
72
74
 
75
+ Direct SDK persistence does not automatically apply this host preflight.
76
+ Integrations that require the policy must evaluate it before dispatching their
77
+ SDK mutations. CLI and MCP adapters already do this.
78
+
73
79
  The SDK guard and repository scanner consume one inventory in
74
80
  `src/core/shared/secret-rules.ts`. It covers GitHub, npm, Slack, AWS access
75
81
  keys (including temporary keys), Google, Anthropic, OpenAI, GitLab, Sentry,
@@ -91,6 +97,33 @@ remains advisory; a workspace selecting `block` must replace those literals
91
97
  with references or explicitly review a force override. CLI routing paths and
92
98
  payload content are distinct: pass only content to package-owned preflight.
93
99
 
100
+ Home-path detection recognizes concrete POSIX and macOS account roots, root
101
+ subdirectories, Windows user profiles, UNC profile shares, DOS device namespace
102
+ profiles, and explicit file URLs. Device prefixes follow the
103
+ [documented Windows path families](https://learn.microsoft.com/dotnet/standard/io/file-path-formats).
104
+ It accepts surrounding markup and punctuation. Detection-only views
105
+ decode percent-byte runs, serialized slash/character escapes, and documented
106
+ Unicode disguises. Unicode handling applies NFKC, removes zero-width/bidi
107
+ controls, and folds division/fraction slashes and Cyrillic look-alikes for the
108
+ path vocabulary's letters o and s. These are finite heuristics, not filesystem
109
+ canonicalization or a complete confidentiality guarantee.
110
+
111
+ Inspection is limited to four normalization passes per original line. Findings
112
+ can include typed `normalizations` identifiers; original and decoded values are
113
+ never returned, and payloads are never rewritten. If encoding remains after the
114
+ limit, `normalization_incomplete: true` conservatively requires review using
115
+ the same advisory/blocking policy. It applies to the entire string leaf, even
116
+ when an earlier line already contained a concrete path. A blocking workspace
117
+ may explicitly force a reviewed value. Repository diagnostics retain original source lines, including
118
+ when an encoded value contains a newline.
119
+
120
+ Portable references remain literal: current-user and named tilde references,
121
+ home environment variables, and Windows profile variables are not expanded
122
+ using the scanner's host. They do not establish a concrete absolute coordinate.
123
+ Ordinary web URLs and relative paths are also preserved. Package-specific
124
+ policies may classify additional context, but must not treat an empty finding
125
+ list as proof that arbitrary content is safe to publish.
126
+
94
127
  Nested settings reads use own properties. Writes reject empty and prototype
95
128
  path segments before changing any object, create local containers for inherited
96
129
  values, and define own data properties without invoking inherited setters. Findings expose only the stable rule
@@ -54,6 +54,15 @@ their real emitted-byte counts may differ. Output growth still fails the
54
54
  unchanged ceilings; normalization does not waive accounting, payload parity,
55
55
  required-field or executable-recovery checks.
56
56
 
57
+ The completion-provenance delivery
58
+ ([pm-gh1579](https://github.com/unbraind/pm-cli/blob/main/.agents/pm/issues/pm-gh1579.toon),
59
+ a repository-only tracker record excluded from npm) makes the existing close and
60
+ partial-bulk transcripts consume completion timestamp, source and correction
61
+ guidance. Their reviewed ceilings increase by 76 and 80 estimated tokens
62
+ respectively to account for this new required context. Other task and step
63
+ ceilings, orientation selection, output accounting and the seeded growth
64
+ negative control retain their existing enforcement.
65
+
57
66
  ## SDK mutation testing
58
67
 
59
68
  `pnpm quality:mutation` uses Stryker's Vitest runner to mutate the SDK cursor and
@@ -4,6 +4,10 @@ Tracker references: [pm-15yuly](../.agents/pm/issues/pm-15yuly.toon), [pm-g8oh0f
4
4
 
5
5
  ## Agent Quick Context
6
6
 
7
+ Complete package-envelope fitting and session-reference recovery are tracked by
8
+ [pm-gh1567](../.agents/pm/issues/pm-gh1567.toon) and
9
+ [pm-session-reference-recovery](../.agents/pm/issues/pm-session-reference-recovery.toon).
10
+
7
11
  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
12
 
9
13
  | Dimension | CLI | SDK and MCP | Meaning |
@@ -27,6 +31,56 @@ repeated metadata from results by default. Request
27
31
  `--output-row-contract` / `outputRowContract: true` when a consumer needs the
28
32
  row paths, jq selector, and active TOON encoding contract.
29
33
 
34
+ ### Package-defined complete envelopes
35
+
36
+ `fitOutputEnvelope` is available from `@unbrained/pm-cli/sdk/query`, the
37
+ aggregate SDK, and an extension command's `sdk.fitOutputEnvelope`. It fits
38
+ ordered whole rows into a caller-defined envelope without changing domain
39
+ ranking, metadata or transport policy:
40
+
41
+ ```ts
42
+ import { fitOutputEnvelope } from "@unbrained/pm-cli/sdk/query";
43
+
44
+ const fitted = fitOutputEnvelope([{ id: "one", title: "Context" }], {
45
+ tokenBudget: 800,
46
+ buildEnvelope: (items) => ({ source: "my-package", items }),
47
+ renderers: { json: (value) => JSON.stringify(value) + "\n" },
48
+ });
49
+ process.stdout.write(fitted.renderings[0]!.text);
50
+ ```
51
+
52
+ The SDK reserves `output_fit`, attaches the omission/accounting receipt, and
53
+ stabilizes its `estimated_tokens` and `output_bytes` against complete output,
54
+ including the receipt itself and caller-supplied framing. Multiple required
55
+ renderers may be supplied, such as JSON and TOON; each must fit, and the receipt
56
+ records the greatest token estimate and byte count independently. Emit a cached
57
+ rendering directly: another serializer or extra newline changes its cost.
58
+ `buildEnvelope` can read the receipt for a package-owned self-accounting field.
59
+
60
+ The default estimator is `ceil(UTF-8 bytes / 4)`. Supply `estimateTokens` for
61
+ another contract, including a stronger one-token-per-byte bound. Estimates are
62
+ not a tokenizer guarantee. Callbacks must be pure, deterministic, promptly
63
+ returning, and include mandatory metadata in every rendering. The SDK does not
64
+ interpret package fields or provider authentication.
65
+
66
+ The default `prefix` policy stops at the first row that does not fit. `skip`
67
+ tries later rows without changing their order. The receipt retains original
68
+ `included_indices`, `total_candidates` and `omitted_count`; `complete` on the
69
+ result means all candidate rows fit. Neither policy splits rows or assumes
70
+ serialized size is monotone. A smaller budget does not promise nested selected
71
+ sets under `skip`; use `prefix` when prefix continuity matters.
72
+
73
+ The empty mandatory envelope must fit before any row is attempted.
74
+ `OutputEnvelopeFitError.code` distinguishes `output_envelope_infeasible`
75
+ (with `minimum_tokens`), `output_envelope_work_limit`, and
76
+ `output_envelope_unstable`. No unverified or oversized packet is returned.
77
+ `maxRenderCalls` defaults to 10,000 across every trial and renderer;
78
+ `maxStabilizationPasses` defaults to 16 per trial. Actual renderer calls and
79
+ evaluated candidates are reported in `work`, outside the measured packet.
80
+ These ceilings bound fitting work; they cannot interrupt arbitrary callback
81
+ execution. Existing candidate-projection packing and pre-receipt token
82
+ attribution retain their distinct contracts.
83
+
30
84
  ### Include Modes
31
85
 
32
86
  `--output-include` accepts two kinds of token. A **field selector** names a row
@@ -195,7 +249,7 @@ The session ceiling and an explicit `--output-budget` both bind; the smaller
195
249
  remaining allowance wins. Rows for item facts already present in the caller's
196
250
  context become `{ "id": "pm-a1b2", "context_ref":
197
251
  "session:orientation:pm-a1b2" }` instead of repeating prose. References retain
198
- stable item identity and can be restored with `pm get <item-id> --brief` when
252
+ stable item identity and can be restored with `pm get <item-id> --depth brief` when
199
253
  the prior context is unavailable. The receipt reports estimated and charged
200
254
  tokens separately when the remaining group allowance is smaller than the
201
255
  minimum control envelope, plus the accumulated spend, remaining capacity,
package/docs/SDK.md CHANGED
@@ -312,6 +312,19 @@ explicitly installs the merge-aware pre-commit hook; the default installs no hoo
312
312
  verified lossless history and receipt artifacts. It refuses forced acceptance,
313
313
  competing values, unrelated drift, dirty reconciliation paths and unresolved Git
314
314
  paths. `staged_paths` reports exactly which relative paths were added to the index.
315
+ Git-ignored artifacts refuse before staging or auditing with
316
+ `merge_settlement_review_required`, `reason: ignored_merge_artifacts`, relative
317
+ `paths`, and owning ignore-rule coordinates. The same check applies to
318
+ `{ stage: true, dryRun: true }`; health reports legacy directory rules before a
319
+ merge exists. This recovery is tracked by
320
+ [pm-gh1556](../.agents/pm/issues/pm-gh1556.toon).
321
+
322
+ `mergeHistoryStreams` preserves validated whole-field assignment/removal intent
323
+ when another branch removed its target. Nested or conditional patches that
324
+ cannot replay refuse with `history_union_rebase_conflict` and typed
325
+ `PmCliError.context.history_merge` coordinates, retaining source inputs for
326
+ deliberate recovery. See [history semantics](MERGE_SAFETY.md#artifact-semantics)
327
+ and [pm-gh1553](../.agents/pm/issues/pm-gh1553.toon).
315
328
 
316
329
  The single-commit journey pauses Git with `git merge --no-commit --no-ff` before
317
330
  reconciliation or an opted-in pre-commit hook runs. `durable_receipt_ids` on the
@@ -586,6 +599,17 @@ sentinel rather than presenting it as a mistyped pm id.
586
599
 
587
600
  ### Agent output budgets and discovery
588
601
 
602
+ Package-defined packets can use `fitOutputEnvelope` from the query entrypoint
603
+ or `CommandHandlerContext.sdk.fitOutputEnvelope` to fit complete JSON/TOON
604
+ renderings, including self-accounting receipts and framing. See
605
+ [complete envelope fitting](READ_OUTPUT_CONTRACTS.md#package-defined-complete-envelopes)
606
+ for policies, work ceilings and refusal contracts, tracked by
607
+ [pm-gh1567](../.agents/pm/issues/pm-gh1567.toon).
608
+ Session receipts now advertise `pm get <item-id> --depth brief`; the
609
+ `restore_reference_with` literal type changes accordingly. Hosts constructing
610
+ `ExtensionCommandSdk` implementations must supply `fitOutputEnvelope` from the
611
+ public SDK; host-created command contexts already provide it.
612
+
589
613
  Tracked by [pm-5t33or](../.agents/pm/features/pm-5t33or.toon),
590
614
  [pm-gmdzaa](../.agents/pm/issues/pm-gmdzaa.toon), and
591
615
  [pm-dpqa3h](../.agents/pm/chores/pm-dpqa3h.toon).
@@ -643,12 +667,41 @@ explicit full projection. Active package commands receive deterministic
643
667
  fallback contracts, so extension authors can discover a bounded surface before
644
668
  they invoke it.
645
669
 
646
- `pm activity` applies a compact 20-row default bound; direct SDK calls default
647
- to five full rows. Results disclose `total_count`, `omitted_count`, `has_more`,
648
- and `applied_bound`. An explicit `limit` remains authoritative, while
649
- `unbounded: true` (CLI: `--unbounded`) is an intentional opt-out and cannot be
650
- combined with a limit. The activity flag and tool schemas publish the same
651
- option for extension and transport consumers.
670
+ `runActivity` defaults to a 15-item digest over the last 24 hours. `raw: true`
671
+ selects compact events (20 by default); `raw: true, compact: false` selects full
672
+ history entries (five by default). CLI equivalents are `--raw` and `--full`.
673
+ Results disclose `total_count`, `count`, `page_start`, `omitted_count`,
674
+ `has_more`, `next_cursor`, and `applied_bound`. Continue with the same options
675
+ and `after: result.next_cursor` (CLI/MCP: `--after` / `after`). Page size may
676
+ change. `omitted_count` counts rows remaining after the current page.
677
+
678
+ Activity's `window` publishes the original evaluation `anchor`, inclusive
679
+ `from`, and exclusive `to`. Bounded reads without an explicit upper bound pin
680
+ `to` to that anchor. Relative bounds resolve against the same clock on every
681
+ page. Later writes outside the window do not disturb continuation. Query,
682
+ projection, workspace, or matching-content changes refuse the old cursor with
683
+ `invalid_query_cursor`; start the query again without `after`. This is checked
684
+ continuation over an unchanged matching set, not a persisted snapshot or an
685
+ atomic cross-file read. Backdated writes within the window and current metadata
686
+ changes affecting digest rows can require a restart. `unbounded: true`
687
+ intentionally removes the row bound and cannot be combined with a limit.
688
+
689
+ Queries collect the matching rows and scan them on each page to detect changes.
690
+ Content fingerprints hash canonical rows incrementally, bounding additional
691
+ serialization storage to the largest row. Digest activity also hashes its full
692
+ source events incrementally so hidden patch changes still invalidate a cursor.
693
+
694
+ `runCalendar` uses the same `after` contract and frozen clock. `total_count`
695
+ counts matching expanded rows within the selected window and recurrence caps;
696
+ `count`, `page_start`, `omitted_count`, `has_more`, and `next_cursor` describe
697
+ the page. `summary_scope: "returned_rows"` labels `summary` and `days` as
698
+ page-local. Exact-full and empty results have `has_more: false`. A zero limit
699
+ returns counts without rows or a new cursor; repeat with `limit: "1"` or larger
700
+ to fetch rows. Existing recurrence expansion limits remain separate from
701
+ pagination, and calendar mutations affecting matching rows require a restart.
702
+ Repository tracking (PM records are excluded from the npm package):
703
+ [pm-gh1554](https://github.com/unbraind/pm-cli/blob/main/.agents/pm/issues/pm-gh1554.toon)
704
+ and [pm-gh1562](https://github.com/unbraind/pm-cli/blob/main/.agents/pm/issues/pm-gh1562.toon).
652
705
 
653
706
  The required `quality:token-budget` gate keeps discovery and answer cost
654
707
  separate. Help and contract discovery surfaces use ratcheted baselines;
@@ -1011,6 +1064,18 @@ pm contracts --action calendar --runtime-only --schema-only --json
1011
1064
  pm contracts --command templates --runtime-only --flags-only --json
1012
1065
  ```
1013
1066
 
1067
+ The SDK owns template persistence independently of the presentation package.
1068
+ `runTemplatesSave(name, options: TemplatesSaveOptions, global)` accepts priority
1069
+ as an integer `0..4`, a numeric string, or a named priority such as `critical`.
1070
+ It validates priority before writing and stores its normalized numeric string;
1071
+ `0` therefore survives save, show, and item creation. Invalid priority values
1072
+ refuse with exit code 2 and the accepted forms, preserving the template and
1073
+ workspace history. Other template keys retain the existing string/string-array
1074
+ storage contract, including extension-defined fields. Import the input type
1075
+ and function from `@unbrained/pm-cli/sdk/runtime` or the aggregate SDK.
1076
+ Tracked by [pm-gh1561](https://github.com/unbraind/pm-cli/blob/main/.agents/pm/issues/pm-gh1561.toon)
1077
+ (repository-only tracker record, excluded from npm).
1078
+
1014
1079
  Use static SDK contracts for baseline validation, then use runtime contracts in the target project before invoking package-provided commands or actions. Embedded SDK consumers can avoid subprocesses:
1015
1080
 
1016
1081
  ```ts
@@ -1069,6 +1134,28 @@ recurrence reason, accepts only the workspace open or in-progress target, and
1069
1134
  returns the terminal evidence captured atomically before the update path clears
1070
1135
  it from active metadata.
1071
1136
 
1137
+ Create focus policy is tracked by [pm-gh1577](https://github.com/unbraind/pm-cli/blob/main/.agents/pm/issues/pm-gh1577.toon)
1138
+ (this tracker record is repository-only and excluded from npm).
1139
+ Programmatic `create`, `PmClient.create`, `runCreate`, and MCP `pm_create`
1140
+ ignore saved session focus unless `inheritFocus: true` is supplied. An explicit
1141
+ parent, a parent from the selected template, or `unset: ["parent"]` takes
1142
+ precedence. Create receipts report `parent_source: "focus"`; the effective
1143
+ parent remains in the item and immutable create event. Plan results expose the
1144
+ effective parent as `plan.parent`. `pm create` and
1145
+ `pm plan create` enable this convenience by default; `--no-inherit-focus` or
1146
+ `--parent none` suppresses it (`pm create` also accepts `--unset parent`).
1147
+ SDK `planCreate` and MCP plan creation follow the same explicit opt-in policy.
1148
+ SDK scheduling shortcuts follow the same opt-in policy; package scheduling
1149
+ commands retain their focused creation convenience.
1150
+
1151
+ Other create defaults still apply: an explicitly selected template supplies
1152
+ options before explicit caller values, workspace governance selects the default
1153
+ type/create mode, the type workflow selects its initial status, priority defaults
1154
+ to 2, tags to an empty array, and author identity comes from invocation/workspace
1155
+ policy. There is no implicit saved assignee or tag default outside the selected
1156
+ template. Importers should supply explicit type, status, priority, tags, assignee,
1157
+ and parent/unset policy when those values are part of their source contract.
1158
+
1072
1159
  Lifecycle handoff and receipt guidance are tracked by
1073
1160
  [pm-gh1465](../.agents/pm/features/pm-gh1465.toon) and
1074
1161
  [pm-gh1464](../.agents/pm/issues/pm-gh1464.toon). Register a project-specific
@@ -1120,10 +1207,31 @@ If a process stops between the domain write and the journal update, rerunning
1120
1207
  the same plan discovers the already-applied step and continues. An ordinary
1121
1208
  error switches the journal to compensation mode and runs applied steps in
1122
1209
  reverse order, limited to steps whose forward attempt was durably recorded.
1210
+ Adapters can opt into `compensatePending: true` when `apply()` may fail after
1211
+ an internal write while inspection still reports `pending`. Such compensators
1212
+ must handle absent and partial effects idempotently. The default preserves
1213
+ applied-only compensation; an inspected `compensated` step is skipped.
1214
+ If compensation refuses, the journal retains its started steps
1215
+ and recovery data in `compensating` state instead of claiming a rollback.
1123
1216
  Compensations are new item-history or relationship events: the
1124
1217
  coordinator never deletes or rewrites immutable history. A crash during
1125
1218
  compensation resumes compensation before a new attempt begins.
1126
1219
 
1220
+ Guarded terminal updates are tracked by
1221
+ [pm-pllp78](../.agents/pm/issues/pm-pllp78.toon). A bulk update's `match` guard
1222
+ is checked under each item lock and advances to the operation's own committed
1223
+ key value before its next internal lifecycle write. A stale starting value
1224
+ still refuses without item or history writes. Item updates opt into pending
1225
+ compensation and attribute every internal write in immutable history. New
1226
+ receipts bind the history fingerprint, integer prefix length and exact version, so writes sharing
1227
+ one timestamp remain distinguishable. Recovery restores exclusively owned
1228
+ effects and preserves peer-only changes. Mixed ownership, rewritten receipts,
1229
+ or a peer write before the restore lock refuse with
1230
+ `transaction_partial_mutation`; the surfaced `AggregateError` retains both
1231
+ failures and the journal keeps recovery data. Repeated compensation recognizes
1232
+ its durable marker even when a peer adds context afterward. Legacy timestamp
1233
+ receipts remain supported, with ambiguous partial effects refused.
1234
+
1127
1235
  ### Schema evolution and workspace history
1128
1236
 
1129
1237
  Tracked by [pm-dijg](../.agents/pm/features/pm-dijg.toon) and
@@ -1473,8 +1581,9 @@ handlers remain disabled. Package-backed `--template` create input cannot be
1473
1581
  semantically previewed through its package handler; expand it into explicit core
1474
1582
  mutation options before preview.
1475
1583
 
1476
- Actionable previews are tracked by [pm-ekf2gu](../.agents/pm/issues/pm-ekf2gu.toon)
1477
- and [pm-fa9olc](../.agents/pm/tasks/pm-fa9olc.toon).
1584
+ Actionable previews are tracked by [pm-ekf2gu](../.agents/pm/issues/pm-ekf2gu.toon),
1585
+ [pm-fa9olc](../.agents/pm/tasks/pm-fa9olc.toon), and
1586
+ [pm-jhkzk0](../.agents/pm/features/pm-jhkzk0.toon).
1478
1587
  `previewItemMutations` returns `warnings` grouped by zero-based operation
1479
1588
  `index`, canonical `id`, and `op`. These are the original create lifecycle
1480
1589
  warnings, including advisory `likely_duplicates` and duplicate-recovery tokens.
@@ -1490,7 +1599,14 @@ use this same projection. A `replayed_committed_plan` has no newly evaluated
1490
1599
  warnings; an empty warning list in that state does not certify current policy.
1491
1600
 
1492
1601
  Staging excludes derived `search` and `locks` content and unrelated runtime state,
1493
- retaining registered item folders, explicitly configured schema files, and
1602
+ plus `extensions/<directory>/node_modules` dependency trees. These trees are
1603
+ excluded before entry inspection or traversal, including dependency links;
1604
+ configured schema files and registered item folders take precedence and retain
1605
+ the regular-file safety checks even inside a dependency tree. Extension source,
1606
+ manifests and managed-package metadata remain in the snapshot. The receipt
1607
+ declares `derived_extension_dependencies_excluded` among its unresolved commit
1608
+ constraints because executable package dependencies are not validated.
1609
+ Staging retains registered item folders, explicitly configured schema files, and
1494
1610
  `runtime/session.json` for core focus and inherited-parent semantics. Root-layout
1495
1611
  trackers copy only tracker-owned files and directories, including standard and
1496
1612
  custom item folders and configured schema files; unrelated project content is
@@ -1741,6 +1857,23 @@ the SDK search engine directly. Package authors can import these functions and
1741
1857
  their typed result contracts from `@unbrained/pm-cli/sdk` without importing CLI
1742
1858
  implementation modules.
1743
1859
 
1860
+ Read projections also accept metadata names registered by active extensions with
1861
+ `registerItemFields`, including `item.<name>` selectors. For example,
1862
+ `client.get(id, { fields: "id,probe_score" })` returns the declared numeric value
1863
+ without requiring a full item read. `list` and `search` use the same active field
1864
+ vocabulary; search retains the requested selector spelling in its row keys.
1865
+ Disabling the extension removes its selectors from validation and recovery.
1866
+ Unknown names still refuse, and recovery retains valid requested custom fields.
1867
+ Tracked by [pm-gh1571](../.agents/pm/issues/pm-gh1571.toon).
1868
+
1869
+ Settings reads load optional schema files without creating missing files. Missing
1870
+ sections use configured or built-in defaults in memory, and later file creation
1871
+ invalidates the settings cache. Explicit `pm init --defaults` scaffolds missing
1872
+ sections while preserving existing schema definitions. This applies to shared
1873
+ SDK settings reads and CLI read commands; derived query caches and normal
1874
+ observability retain their own policies. Tracked by
1875
+ [pm-gh1568](../.agents/pm/issues/pm-gh1568.toon).
1876
+
1744
1877
  The shared query cursor contract treats every published list, context, and
1745
1878
  search flag as query-semantic by default: it changes the matched or ordered
1746
1879
  result and therefore invalidates a cursor. Only page-size and rendering flags
@@ -1996,9 +2129,15 @@ signal-set metadata are supported, its item source matches, and its cursor,
1996
2129
  complete item-id set, and substantive recency-evidence fingerprint match.
1997
2130
  Missing, stale, version-incompatible, or corrupt state is rebuilt from the
1998
2131
  authoritative items and atomically replaced. The result reports `cache_status`
1999
- and non-fatal `context_signal_store_stale`,
2000
- `context_signal_store_invalid`, or `context_signal_store_write_failed`
2001
- warnings. A write failure still serves the in-memory rebuilt candidates because
2132
+ without a warning for a successful missing/stale refresh
2133
+ ([pm-gh1581](https://github.com/unbraind/pm-cli/blob/main/.agents/pm/issues/pm-gh1581.toon);
2134
+ this tracker record is repository-only and excluded from npm). Rebuilt signals are used in
2135
+ the current response; another read is unnecessary. With `explainRanking`,
2136
+ `ranking.feature_store.cache_status` exposes the refresh on context receipts.
2137
+ Corrupt/unreadable state and failed persistence retain actionable
2138
+ `context_signal_store_invalid` and `context_signal_store_write_failed` warnings.
2139
+ The exported stale-warning descriptor remains for compatibility with older
2140
+ receipts. A write failure still serves the in-memory rebuilt candidates because
2002
2141
  the snapshot is derived, never authoritative. Optional maps for activity density,
2003
2142
  graph proximity, claim/focus, knowledge density, author affinity, usage
2004
2143
  affinity, and semantic similarity let an index or application-specific host
@@ -2510,6 +2649,14 @@ same list/default semantics as core flags:
2510
2649
  `default: "a,b"` or `default: ["a,b", "c"]`) are split into elements. A default
2511
2650
  that would not cleanly coerce under the declared `value_type` (e.g.
2512
2651
  `value_type: "number", default: "abc"`) is rejected at registration.
2652
+ Declared defaults are discoverable without running the command: text help
2653
+ shows `(default: ...)`, JSON help uses `default_value`, and runtime flag
2654
+ contracts and command schemas use `default`, preserving strings, numbers,
2655
+ booleans, empty strings and arrays. These are declaration values; runtime
2656
+ coercion and list flattening still apply during execution. Explicit values
2657
+ replace omitted-flag defaults, including list defaults. Tracked by
2658
+ [pm-gh1560](https://github.com/unbraind/pm-cli/blob/main/.agents/pm/issues/pm-gh1560.toon)
2659
+ (repository-only tracker record, excluded from npm).
2513
2660
  - `value_validation` (`"coerce"` | `"strict"`, tracked by
2514
2661
  [pm-extension-scalar-validation](../.agents/pm/features/pm-extension-scalar-validation.toon))
2515
2662
  decides what happens to a `number`/`boolean` token that does not coerce.
@@ -3431,6 +3578,20 @@ search degrades gracefully and emits warning codes instead of hard-failing.
3431
3578
 
3432
3579
  ## Completion-aware reporting and migration
3433
3580
 
3581
+ Close provenance is tracked by [pm-gh1579](https://github.com/unbraind/pm-cli/blob/main/.agents/pm/issues/pm-gh1579.toon)
3582
+ (a repository-only tracker record excluded from npm).
3583
+ `closeItem`, `PmClient.close`, CLI/MCP close receipts and successful `closeMany`
3584
+ rows return `completion` with the persisted `timestamp` and `source`:
3585
+ `asserted` means this close supplied `completedAt`, `existing` preserves an
3586
+ earlier metadata value, and `close_time` means completion was inferred from the
3587
+ tracker close time. Timestamp and source are sealed in the close event's
3588
+ `context.completion`; the local correction hint remains in the response.
3589
+ Existing records without it have unknown provenance;
3590
+ `existing` does not assert how an earlier value was obtained. No prior events are
3591
+ rewritten. Inferred receipts include a tracker-bound `update --completed-at`
3592
+ correction hint. Pass `completedAt` (CLI `--completed-at`) when closing delivered
3593
+ work retroactively; core never extracts a delivery date from reason prose.
3594
+
3434
3595
  `resolveCompletionTimestamp(item)` gives reports one canonical timestamp plus a
3435
3596
  `source` and `fallback` disclosure. It prefers `completed_at` (when the work
3436
3597
  actually finished), then legacy `closed_at`, then `updated_at`.
@@ -80,7 +80,20 @@ reviewable history and skip approval requirements; use `transition` rules with
80
80
  of the current record, using the same content and independent-actor checks.
81
81
 
82
82
  Refused mutations preserve item state and item history, and append a workspace
83
- refusal event. Accepted mutations attach bounded policy decisions to their normal
83
+ refusal event. This append changes the tracked `history/_workspace.jsonl` file
84
+ under the selected tracker. Retain it with the workspace changes. The typed SDK
85
+ error's `context.side_effects` and CLI JSON `side_effects` disclose the
86
+ tracker-relative `path`, `op: "policy_refused"`, and sealed `record_hash`; MCP
87
+ error details retain the same context. Human-readable diagnostics also name the
88
+ write. Every refused attempt records a distinct event and returns its own record
89
+ identity, including repeated identical requests. This preserves attempt history
90
+ instead of silently coalescing it. Dry-run refusals have `side_effects: []` and
91
+ append nothing. An audit failure retains its separate error contract below and
92
+ does not claim a completed append. This disclosure is tracked by
93
+ [pm-gh1585](https://github.com/unbraind/pm-cli/blob/main/.agents/pm/issues/pm-gh1585.toon)
94
+ (a repository-only tracker record excluded from npm).
95
+
96
+ Accepted mutations attach bounded policy decisions to their normal
84
97
  history event. Diagnostics contain policy ids and missing field paths, without
85
98
  copying reviewed content into errors.
86
99
  If the mandatory refusal audit cannot be appended, the mutation instead raises
@@ -1 +1 @@
1
- {"version":5,"transcript_version":2,"transcript_digest":"sha256:6d4041acfaa4075dde1972d6127a74f18916f7661738b4f5d5fd47a61c179a78","estimator":"ceil(utf8_bytes / 4)","comparison_scope":"plan_recovery_tracker_root_canonicalized","measurement_scope":"output_before_token_accounting","published_with_release":true,"orientation":{"canonical_task_id":"orientation-context-intent","required_capabilities":["actionable_work","active_ownership","workspace_state"],"measured_winner_tokens":1087,"protocols":[{"task_id":"orientation-context-intent","command_count":1,"estimated_tokens":1087,"capabilities":["actionable_work","active_ownership","workspace_state"],"capability_evidence":{"actionable_work":[{"step_id":"context","field_path":"hierarchy"}],"active_ownership":[{"step_id":"context","field_path":"activity"}],"workspace_state":[{"step_id":"context","field_path":"summary.active_items"}]}},{"task_id":"orientation-operating-rules","command_count":4,"estimated_tokens":2139,"capabilities":["actionable_work","active_ownership","workspace_state"],"capability_evidence":{"actionable_work":[{"step_id":"open","field_path":"items"}],"active_ownership":[{"step_id":"in-progress","field_path":"items"}],"workspace_state":[{"step_id":"context","field_path":"summary.active_items"}]}},{"task_id":"orientation-contracts-next","command_count":2,"estimated_tokens":5203,"capabilities":["actionable_work","active_ownership","workspace_state"],"capability_evidence":{"actionable_work":[{"step_id":"next","field_path":"recommended.id"}],"active_ownership":[{"step_id":"next","field_path":"held_by_others"}],"workspace_state":[{"step_id":"next","field_path":"summary.in_progress"}]}}]},"tasks":[{"id":"orientation-context-intent","max_estimated_tokens":1087,"steps":[{"id":"context","max_estimated_tokens":1087,"accounting_mode":"self_reported"}]},{"id":"orientation-contracts-next","max_estimated_tokens":5203,"steps":[{"id":"contracts","max_estimated_tokens":4481,"accounting_mode":"self_reported"},{"id":"next","max_estimated_tokens":722,"accounting_mode":"self_reported"}]},{"id":"orientation-operating-rules","max_estimated_tokens":2139,"steps":[{"id":"context","max_estimated_tokens":1087,"accounting_mode":"self_reported"},{"id":"search","max_estimated_tokens":164,"accounting_mode":"self_reported"},{"id":"open","max_estimated_tokens":712,"accounting_mode":"self_reported"},{"id":"in-progress","max_estimated_tokens":176,"accounting_mode":"self_reported"}]},{"id":"context-bootstrap","max_estimated_tokens":2077,"steps":[{"id":"triage","max_estimated_tokens":619,"accounting_mode":"self_reported"},{"id":"orient","max_estimated_tokens":1087,"accounting_mode":"self_reported"},{"id":"inspect","max_estimated_tokens":371,"accounting_mode":"self_reported"}]},{"id":"closed-domain-recovery","max_estimated_tokens":630,"steps":[{"id":"refuse-intent","max_estimated_tokens":259,"accounting_mode":"self_reported"},{"id":"retry-intent","max_estimated_tokens":371,"accounting_mode":"self_reported"}]},{"id":"unknown-option-recovery","max_estimated_tokens":596,"steps":[{"id":"refuse-option","max_estimated_tokens":433,"accounting_mode":"self_reported"},{"id":"retry-option","max_estimated_tokens":163,"accounting_mode":"self_reported"}]},{"id":"lifecycle-mutation","max_estimated_tokens":812,"steps":[{"id":"create","max_estimated_tokens":20,"accounting_mode":"self_reported"},{"id":"inspect-open","max_estimated_tokens":363,"accounting_mode":"self_reported"},{"id":"close","max_estimated_tokens":31,"accounting_mode":"self_reported"},{"id":"inspect-closed","max_estimated_tokens":398,"accounting_mode":"self_reported"}]},{"id":"bulk-effect-outcomes","max_estimated_tokens":326,"steps":[{"id":"create-bulk-target","max_estimated_tokens":20,"accounting_mode":"self_reported"},{"id":"partial-effect","max_estimated_tokens":174,"accounting_mode":"self_reported"},{"id":"no-effect","max_estimated_tokens":132,"accounting_mode":"self_reported"}]},{"id":"plan-execution-mutations","max_estimated_tokens":806,"steps":[{"id":"create-plan","max_estimated_tokens":21,"accounting_mode":"self_reported"},{"id":"add-step","max_estimated_tokens":254,"accounting_mode":"self_reported"},{"id":"complete-step","max_estimated_tokens":253,"accounting_mode":"self_reported"},{"id":"inspect-plan","max_estimated_tokens":278,"accounting_mode":"self_reported"}]}],"composite_max_estimated_tokens":13676}
1
+ {"version":5,"transcript_version":2,"transcript_digest":"sha256:83d4523ca528ad5e8801cf5c7c02dcebbf2b87dc72422d4b8e648755dcdc36c2","estimator":"ceil(utf8_bytes / 4)","comparison_scope":"plan_recovery_tracker_root_canonicalized","measurement_scope":"output_before_token_accounting","published_with_release":true,"orientation":{"canonical_task_id":"orientation-context-intent","required_capabilities":["actionable_work","active_ownership","workspace_state"],"measured_winner_tokens":1087,"protocols":[{"task_id":"orientation-context-intent","command_count":1,"estimated_tokens":1087,"capabilities":["actionable_work","active_ownership","workspace_state"],"capability_evidence":{"actionable_work":[{"step_id":"context","field_path":"hierarchy"}],"active_ownership":[{"step_id":"context","field_path":"activity"}],"workspace_state":[{"step_id":"context","field_path":"summary.active_items"}]}},{"task_id":"orientation-operating-rules","command_count":4,"estimated_tokens":2139,"capabilities":["actionable_work","active_ownership","workspace_state"],"capability_evidence":{"actionable_work":[{"step_id":"open","field_path":"items"}],"active_ownership":[{"step_id":"in-progress","field_path":"items"}],"workspace_state":[{"step_id":"context","field_path":"summary.active_items"}]}},{"task_id":"orientation-contracts-next","command_count":2,"estimated_tokens":5203,"capabilities":["actionable_work","active_ownership","workspace_state"],"capability_evidence":{"actionable_work":[{"step_id":"next","field_path":"recommended.id"}],"active_ownership":[{"step_id":"next","field_path":"held_by_others"}],"workspace_state":[{"step_id":"next","field_path":"summary.in_progress"}]}}]},"tasks":[{"id":"orientation-context-intent","max_estimated_tokens":1087,"steps":[{"id":"context","max_estimated_tokens":1087,"accounting_mode":"self_reported"}]},{"id":"orientation-contracts-next","max_estimated_tokens":5203,"steps":[{"id":"contracts","max_estimated_tokens":4481,"accounting_mode":"self_reported"},{"id":"next","max_estimated_tokens":722,"accounting_mode":"self_reported"}]},{"id":"orientation-operating-rules","max_estimated_tokens":2139,"steps":[{"id":"context","max_estimated_tokens":1087,"accounting_mode":"self_reported"},{"id":"search","max_estimated_tokens":164,"accounting_mode":"self_reported"},{"id":"open","max_estimated_tokens":712,"accounting_mode":"self_reported"},{"id":"in-progress","max_estimated_tokens":176,"accounting_mode":"self_reported"}]},{"id":"context-bootstrap","max_estimated_tokens":2077,"steps":[{"id":"triage","max_estimated_tokens":619,"accounting_mode":"self_reported"},{"id":"orient","max_estimated_tokens":1087,"accounting_mode":"self_reported"},{"id":"inspect","max_estimated_tokens":371,"accounting_mode":"self_reported"}]},{"id":"closed-domain-recovery","max_estimated_tokens":630,"steps":[{"id":"refuse-intent","max_estimated_tokens":259,"accounting_mode":"self_reported"},{"id":"retry-intent","max_estimated_tokens":371,"accounting_mode":"self_reported"}]},{"id":"unknown-option-recovery","max_estimated_tokens":596,"steps":[{"id":"refuse-option","max_estimated_tokens":433,"accounting_mode":"self_reported"},{"id":"retry-option","max_estimated_tokens":163,"accounting_mode":"self_reported"}]},{"id":"lifecycle-mutation","max_estimated_tokens":888,"steps":[{"id":"create","max_estimated_tokens":20,"accounting_mode":"self_reported"},{"id":"inspect-open","max_estimated_tokens":363,"accounting_mode":"self_reported"},{"id":"close","max_estimated_tokens":107,"accounting_mode":"self_reported"},{"id":"inspect-closed","max_estimated_tokens":398,"accounting_mode":"self_reported"}]},{"id":"bulk-effect-outcomes","max_estimated_tokens":406,"steps":[{"id":"create-bulk-target","max_estimated_tokens":20,"accounting_mode":"self_reported"},{"id":"partial-effect","max_estimated_tokens":254,"accounting_mode":"self_reported"},{"id":"no-effect","max_estimated_tokens":132,"accounting_mode":"self_reported"}]},{"id":"plan-execution-mutations","max_estimated_tokens":806,"steps":[{"id":"create-plan","max_estimated_tokens":21,"accounting_mode":"self_reported"},{"id":"add-step","max_estimated_tokens":254,"accounting_mode":"self_reported"},{"id":"complete-step","max_estimated_tokens":253,"accounting_mode":"self_reported"},{"id":"inspect-plan","max_estimated_tokens":278,"accounting_mode":"self_reported"}]}],"composite_max_estimated_tokens":13832}
@@ -1 +1 @@
1
- {"version":2,"orientation":{"canonical_task_id":"orientation-context-intent","required_capabilities":["workspace_state","active_ownership","actionable_work"],"protocols":[{"task_id":"orientation-context-intent","capabilities":["workspace_state","active_ownership","actionable_work"],"capability_evidence":{"workspace_state":[{"step_id":"context","field_path":"summary.active_items"}],"active_ownership":[{"step_id":"context","field_path":"activity"}],"actionable_work":[{"step_id":"context","field_path":"hierarchy"}]}},{"task_id":"orientation-contracts-next","capabilities":["workspace_state","active_ownership","actionable_work"],"capability_evidence":{"workspace_state":[{"step_id":"next","field_path":"summary.in_progress"}],"active_ownership":[{"step_id":"next","field_path":"held_by_others"}],"actionable_work":[{"step_id":"next","field_path":"recommended.id"}]}},{"task_id":"orientation-operating-rules","capabilities":["workspace_state","active_ownership","actionable_work"],"capability_evidence":{"workspace_state":[{"step_id":"context","field_path":"summary.active_items"}],"active_ownership":[{"step_id":"in-progress","field_path":"items"}],"actionable_work":[{"step_id":"open","field_path":"items"}]}}]},"tasks":[{"id":"orientation-context-intent","description":"Build sufficient cold-start workspace, ownership, and actionable-work context with the bounded orientation intent.","steps":[{"id":"context","args":["context","--for","orient","--limit","10"],"expected_exit_code":0,"expected_output_kind":"diagnostic","expected_accounting_mode":"self_reported","required_fields":["summary.active_items","hierarchy","activity"]}]},{"id":"orientation-contracts-next","description":"Compare the proposed contracts-summary plus next cold-start protocol on the same fixed workspace.","steps":[{"id":"contracts","args":["contracts","--summary"],"expected_exit_code":0,"expected_output_kind":"collection","expected_accounting_mode":"self_reported","required_fields":["commands"]},{"id":"next","args":["next","--for","execute","--ready-only","--limit","3"],"expected_exit_code":0,"expected_output_kind":"diagnostic","expected_accounting_mode":"self_reported","required_fields":["summary.in_progress","held_by_others","recommended.id"]}]},{"id":"orientation-operating-rules","description":"Compare the historical context, search, open-list, and in-progress-list orientation sequence.","steps":[{"id":"context","args":["context","--for","orient","--limit","10"],"expected_exit_code":0,"expected_output_kind":"diagnostic","expected_accounting_mode":"self_reported","required_fields":["summary.active_items","hierarchy","activity"]},{"id":"search","args":["search","agent task","--status","all","--limit","10"],"expected_exit_code":0,"expected_output_kind":"collection","expected_accounting_mode":"self_reported","required_fields":["items"]},{"id":"open","args":["list","--status","open","--limit","20"],"expected_exit_code":0,"expected_output_kind":"collection","expected_accounting_mode":"self_reported","required_fields":["items"]},{"id":"in-progress","args":["list","--status","in_progress","--limit","20"],"expected_exit_code":0,"expected_output_kind":"collection","expected_accounting_mode":"self_reported","required_fields":["items"]}]},{"id":"context-bootstrap","description":"Orient in a scaled workspace and inspect the canonical focus item.","steps":[{"id":"triage","args":["list","--for","triage","--limit","2"],"expected_exit_code":0,"expected_output_kind":"collection","expected_accounting_mode":"self_reported","required_fields":["items"]},{"id":"orient","args":["context","--for","orient","--limit","5"],"expected_exit_code":0,"expected_output_kind":"diagnostic","expected_accounting_mode":"self_reported","required_fields":["summary.active_items","hierarchy","activity"]},{"id":"inspect","args":["get","$ANCHOR_ID","--for","inspect"],"expected_exit_code":0,"expected_output_kind":"entity","expected_accounting_mode":"self_reported","required_fields":["item.id"]}]},{"id":"closed-domain-recovery","description":"Reject an invalid context intent and execute the advertised shell-free retry.","steps":[{"id":"refuse-intent","args":["get","$ANCHOR_ID","--for","invalid-agent-intent"],"expected_exit_code":2,"expected_output_kind":"refusal","expected_accounting_mode":"self_reported","required_fields":["code","refusal","recovery"],"expected_error_code":"unknown_context_intent","expected_field_values":{"recovery.recovery_mode":"compact"},"expected_refusal_surface":"--for"},{"id":"retry-intent","args":["get","$ANCHOR_ID","--for","inspect"],"expected_exit_code":0,"expected_output_kind":"entity","expected_accounting_mode":"self_reported","required_fields":["item.id"],"recovery_for":"refuse-intent"}]},{"id":"unknown-option-recovery","description":"Identify an unsupported option after valid flags and continue with the corrected command.","steps":[{"id":"refuse-option","args":["search","agent task","--status","open","--limit","5","--include-body"],"expected_exit_code":2,"expected_output_kind":"refusal","expected_accounting_mode":"self_reported","required_fields":["code","refusal","recovery"],"expected_error_code":"unknown_option","expected_refusal_surface":"--include-body"},{"id":"retry-option","args":["search","agent task","--status","open","--limit","5"],"expected_exit_code":0,"expected_output_kind":"collection","expected_accounting_mode":"self_reported","required_fields":["items"],"recovery_for":"refuse-option"}]},{"id":"lifecycle-mutation","description":"Create, inspect, close, and confirm a project item through public CLI receipts.","steps":[{"id":"create","args":["create","--id","$LIFECYCLE_ID","--title","Transcript lifecycle item","--description","Golden multi-step lifecycle task","--type","Task","--status","open","--create-mode","progressive"],"expected_exit_code":0,"expected_output_kind":"mutation_receipt","expected_accounting_mode":"self_reported","required_fields":["id","changed_field_count"]},{"id":"inspect-open","args":["get","$LIFECYCLE_ID","--for","inspect"],"expected_exit_code":0,"expected_output_kind":"entity","expected_accounting_mode":"self_reported","required_fields":["item.id","item.status"],"expected_field_values":{"item.status":"open"}},{"id":"close","args":["close","$LIFECYCLE_ID","Golden task completed"],"expected_exit_code":0,"expected_output_kind":"mutation_receipt","expected_accounting_mode":"self_reported","required_fields":["id","status","close_reason"]},{"id":"inspect-closed","args":["get","$LIFECYCLE_ID","--for","inspect"],"expected_exit_code":0,"expected_output_kind":"entity","expected_accounting_mode":"self_reported","required_fields":["item.id","item.status"],"expected_field_values":{"item.status":"closed"}}]},{"id":"bulk-effect-outcomes","description":"Preserve successful partial-effect and no-effect outcomes across a bulk lifecycle task.","steps":[{"id":"create-bulk-target","args":["create","--id","$BULK_ID","--title","Transcript bulk effect target","--description","Golden bulk outcome transcript target","--type","Task","--status","open","--create-mode","progressive"],"expected_exit_code":0,"expected_output_kind":"mutation_receipt","expected_accounting_mode":"self_reported","required_fields":["id","status","changed_field_count"]},{"id":"partial-effect","args":["close-many","--ids","$BULK_ID,pm-transcript-missing","--reason","Golden partial-effect transcript","--validate-close","off","--no-checkpoint"],"expected_exit_code":7,"expected_output_kind":"collection","expected_accounting_mode":"self_reported","required_fields":["rows","outcome","exit_code"],"expected_field_values":{"outcome":"partial_effect"}},{"id":"no-effect","args":["close-many","--ids","$BULK_ID","--reason","Golden no-effect transcript","--validate-close","off","--no-checkpoint"],"expected_exit_code":6,"expected_output_kind":"collection","expected_accounting_mode":"self_reported","required_fields":["rows","outcome","exit_code"],"expected_field_values":{"outcome":"no_effect"}}]},{"id":"plan-execution-mutations","description":"Create a Plan, add and complete a step, then inspect its durable evidence without echoing the full Plan on each mutation.","steps":[{"id":"create-plan","args":["create","--id","pm-transcript-plan","--type","Plan","--title","Transcript execution Plan","--create-mode","progressive"],"expected_exit_code":0,"expected_output_kind":"mutation_receipt","expected_accounting_mode":"self_reported","required_fields":["id","status"]},{"id":"add-step","args":["plan","add-step","pm-transcript-plan","--step-title","Verify result","--step-body","Durable execution context retained for later inspection."],"expected_exit_code":0,"expected_output_kind":"diagnostic","expected_accounting_mode":"self_reported","required_fields":["id","step.id","steps_summary.total","inspection_command"],"expected_field_values":{"kind":"plan_mutation","steps_summary.total":1}},{"id":"complete-step","args":["plan","complete-step","pm-transcript-plan","plan-step-001","--step-evidence","Verified result"],"expected_exit_code":0,"expected_output_kind":"diagnostic","expected_accounting_mode":"self_reported","required_fields":["id","step.status","steps_summary.completed","omission_receipt"],"expected_field_values":{"step.status":"completed","steps_summary.completed":1}},{"id":"inspect-plan","args":["plan","show","pm-transcript-plan","--depth","deep"],"expected_exit_code":0,"expected_output_kind":"diagnostic","expected_accounting_mode":"self_reported","required_fields":["plan.steps","plan.steps_summary.completed"],"expected_field_values":{"plan.steps_summary.completed":1}}]}]}
1
+ {"version":2,"orientation":{"canonical_task_id":"orientation-context-intent","required_capabilities":["workspace_state","active_ownership","actionable_work"],"protocols":[{"task_id":"orientation-context-intent","capabilities":["workspace_state","active_ownership","actionable_work"],"capability_evidence":{"workspace_state":[{"step_id":"context","field_path":"summary.active_items"}],"active_ownership":[{"step_id":"context","field_path":"activity"}],"actionable_work":[{"step_id":"context","field_path":"hierarchy"}]}},{"task_id":"orientation-contracts-next","capabilities":["workspace_state","active_ownership","actionable_work"],"capability_evidence":{"workspace_state":[{"step_id":"next","field_path":"summary.in_progress"}],"active_ownership":[{"step_id":"next","field_path":"held_by_others"}],"actionable_work":[{"step_id":"next","field_path":"recommended.id"}]}},{"task_id":"orientation-operating-rules","capabilities":["workspace_state","active_ownership","actionable_work"],"capability_evidence":{"workspace_state":[{"step_id":"context","field_path":"summary.active_items"}],"active_ownership":[{"step_id":"in-progress","field_path":"items"}],"actionable_work":[{"step_id":"open","field_path":"items"}]}}]},"tasks":[{"id":"orientation-context-intent","description":"Build sufficient cold-start workspace, ownership, and actionable-work context with the bounded orientation intent.","steps":[{"id":"context","args":["context","--for","orient","--limit","10"],"expected_exit_code":0,"expected_output_kind":"diagnostic","expected_accounting_mode":"self_reported","required_fields":["summary.active_items","hierarchy","activity"]}]},{"id":"orientation-contracts-next","description":"Compare the proposed contracts-summary plus next cold-start protocol on the same fixed workspace.","steps":[{"id":"contracts","args":["contracts","--summary"],"expected_exit_code":0,"expected_output_kind":"collection","expected_accounting_mode":"self_reported","required_fields":["commands"]},{"id":"next","args":["next","--for","execute","--ready-only","--limit","3"],"expected_exit_code":0,"expected_output_kind":"diagnostic","expected_accounting_mode":"self_reported","required_fields":["summary.in_progress","held_by_others","recommended.id"]}]},{"id":"orientation-operating-rules","description":"Compare the historical context, search, open-list, and in-progress-list orientation sequence.","steps":[{"id":"context","args":["context","--for","orient","--limit","10"],"expected_exit_code":0,"expected_output_kind":"diagnostic","expected_accounting_mode":"self_reported","required_fields":["summary.active_items","hierarchy","activity"]},{"id":"search","args":["search","agent task","--status","all","--limit","10"],"expected_exit_code":0,"expected_output_kind":"collection","expected_accounting_mode":"self_reported","required_fields":["items"]},{"id":"open","args":["list","--status","open","--limit","20"],"expected_exit_code":0,"expected_output_kind":"collection","expected_accounting_mode":"self_reported","required_fields":["items"]},{"id":"in-progress","args":["list","--status","in_progress","--limit","20"],"expected_exit_code":0,"expected_output_kind":"collection","expected_accounting_mode":"self_reported","required_fields":["items"]}]},{"id":"context-bootstrap","description":"Orient in a scaled workspace and inspect the canonical focus item.","steps":[{"id":"triage","args":["list","--for","triage","--limit","2"],"expected_exit_code":0,"expected_output_kind":"collection","expected_accounting_mode":"self_reported","required_fields":["items"]},{"id":"orient","args":["context","--for","orient","--limit","5"],"expected_exit_code":0,"expected_output_kind":"diagnostic","expected_accounting_mode":"self_reported","required_fields":["summary.active_items","hierarchy","activity"]},{"id":"inspect","args":["get","$ANCHOR_ID","--for","inspect"],"expected_exit_code":0,"expected_output_kind":"entity","expected_accounting_mode":"self_reported","required_fields":["item.id"]}]},{"id":"closed-domain-recovery","description":"Reject an invalid context intent and execute the advertised shell-free retry.","steps":[{"id":"refuse-intent","args":["get","$ANCHOR_ID","--for","invalid-agent-intent"],"expected_exit_code":2,"expected_output_kind":"refusal","expected_accounting_mode":"self_reported","required_fields":["code","refusal","recovery"],"expected_error_code":"unknown_context_intent","expected_field_values":{"recovery.recovery_mode":"compact"},"expected_refusal_surface":"--for"},{"id":"retry-intent","args":["get","$ANCHOR_ID","--for","inspect"],"expected_exit_code":0,"expected_output_kind":"entity","expected_accounting_mode":"self_reported","required_fields":["item.id"],"recovery_for":"refuse-intent"}]},{"id":"unknown-option-recovery","description":"Identify an unsupported option after valid flags and continue with the corrected command.","steps":[{"id":"refuse-option","args":["search","agent task","--status","open","--limit","5","--include-body"],"expected_exit_code":2,"expected_output_kind":"refusal","expected_accounting_mode":"self_reported","required_fields":["code","refusal","recovery"],"expected_error_code":"unknown_option","expected_refusal_surface":"--include-body"},{"id":"retry-option","args":["search","agent task","--status","open","--limit","5"],"expected_exit_code":0,"expected_output_kind":"collection","expected_accounting_mode":"self_reported","required_fields":["items"],"recovery_for":"refuse-option"}]},{"id":"lifecycle-mutation","description":"Create, inspect, close, and confirm a project item through public CLI receipts.","steps":[{"id":"create","args":["create","--id","$LIFECYCLE_ID","--title","Transcript lifecycle item","--description","Golden multi-step lifecycle task","--type","Task","--status","open","--create-mode","progressive"],"expected_exit_code":0,"expected_output_kind":"mutation_receipt","expected_accounting_mode":"self_reported","required_fields":["id","changed_field_count"]},{"id":"inspect-open","args":["get","$LIFECYCLE_ID","--for","inspect"],"expected_exit_code":0,"expected_output_kind":"entity","expected_accounting_mode":"self_reported","required_fields":["item.id","item.status"],"expected_field_values":{"item.status":"open"}},{"id":"close","args":["close","$LIFECYCLE_ID","Golden task completed"],"expected_exit_code":0,"expected_output_kind":"mutation_receipt","expected_accounting_mode":"self_reported","required_fields":["id","status","close_reason","completion.timestamp","completion.source","completion.hint"],"expected_field_values":{"completion.source":"close_time"}},{"id":"inspect-closed","args":["get","$LIFECYCLE_ID","--for","inspect"],"expected_exit_code":0,"expected_output_kind":"entity","expected_accounting_mode":"self_reported","required_fields":["item.id","item.status"],"expected_field_values":{"item.status":"closed"}}]},{"id":"bulk-effect-outcomes","description":"Preserve successful partial-effect and no-effect outcomes across a bulk lifecycle task.","steps":[{"id":"create-bulk-target","args":["create","--id","$BULK_ID","--title","Transcript bulk effect target","--description","Golden bulk outcome transcript target","--type","Task","--status","open","--create-mode","progressive"],"expected_exit_code":0,"expected_output_kind":"mutation_receipt","expected_accounting_mode":"self_reported","required_fields":["id","status","changed_field_count"]},{"id":"partial-effect","args":["close-many","--ids","$BULK_ID,pm-transcript-missing","--reason","Golden partial-effect transcript","--validate-close","off","--no-checkpoint"],"expected_exit_code":7,"expected_output_kind":"collection","expected_accounting_mode":"self_reported","required_fields":["rows","outcome","exit_code","rows.0.completion.timestamp","rows.0.completion.source","rows.0.completion.hint"],"expected_field_values":{"outcome":"partial_effect","rows.0.completion.source":"close_time"}},{"id":"no-effect","args":["close-many","--ids","$BULK_ID","--reason","Golden no-effect transcript","--validate-close","off","--no-checkpoint"],"expected_exit_code":6,"expected_output_kind":"collection","expected_accounting_mode":"self_reported","required_fields":["rows","outcome","exit_code"],"expected_field_values":{"outcome":"no_effect"}}]},{"id":"plan-execution-mutations","description":"Create a Plan, add and complete a step, then inspect its durable evidence without echoing the full Plan on each mutation.","steps":[{"id":"create-plan","args":["create","--id","pm-transcript-plan","--type","Plan","--title","Transcript execution Plan","--create-mode","progressive"],"expected_exit_code":0,"expected_output_kind":"mutation_receipt","expected_accounting_mode":"self_reported","required_fields":["id","status"]},{"id":"add-step","args":["plan","add-step","pm-transcript-plan","--step-title","Verify result","--step-body","Durable execution context retained for later inspection."],"expected_exit_code":0,"expected_output_kind":"diagnostic","expected_accounting_mode":"self_reported","required_fields":["id","step.id","steps_summary.total","inspection_command"],"expected_field_values":{"kind":"plan_mutation","steps_summary.total":1}},{"id":"complete-step","args":["plan","complete-step","pm-transcript-plan","plan-step-001","--step-evidence","Verified result"],"expected_exit_code":0,"expected_output_kind":"diagnostic","expected_accounting_mode":"self_reported","required_fields":["id","step.status","steps_summary.completed","omission_receipt"],"expected_field_values":{"step.status":"completed","steps_summary.completed":1}},{"id":"inspect-plan","args":["plan","show","pm-transcript-plan","--depth","deep"],"expected_exit_code":0,"expected_output_kind":"diagnostic","expected_accounting_mode":"self_reported","required_fields":["plan.steps","plan.steps_summary.completed"],"expected_field_values":{"plan.steps_summary.completed":1}}]}]}