@unbrained/pm-cli 2026.11.21 → 2026.11.22

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 (203) hide show
  1. package/.agents/skills/pm-developer/SKILL.md +1 -1
  2. package/.claude-plugin/marketplace.json +1 -1
  3. package/dist/cli/register-history-maintenance.js +2 -2
  4. package/dist/cli-bundle/bundle-manifest.json +1 -1
  5. package/dist/cli-bundle/chunks/chunk-3W47ZZ5T.js +9 -0
  6. package/dist/cli-bundle/chunks/{chunk-PJXKA4QU.js → chunk-4TB5D6HL.js} +37 -37
  7. package/dist/cli-bundle/chunks/{chunk-WELSVDPU.js → chunk-5ZMVLWE3.js} +2 -2
  8. package/dist/cli-bundle/chunks/chunk-6BBDEIKC.js +33 -0
  9. package/dist/cli-bundle/chunks/{chunk-JVGRFU5H.js → chunk-AR4NP5HI.js} +2 -2
  10. package/dist/cli-bundle/chunks/{chunk-XHJ3H5PL.js → chunk-B4PPFOPY.js} +3 -3
  11. package/dist/cli-bundle/chunks/{chunk-5647LU3A.js → chunk-B76TFRO2.js} +47 -45
  12. package/dist/cli-bundle/chunks/{chunk-YJEBK7HU.js → chunk-CAR2L5NW.js} +2 -2
  13. package/dist/cli-bundle/chunks/{chunk-D6ILFXZY.js → chunk-EIGUKEV6.js} +2 -2
  14. package/dist/cli-bundle/chunks/{chunk-XWHJIRNV.js → chunk-GTPCAJMZ.js} +2 -2
  15. package/dist/cli-bundle/chunks/chunk-GYP24M7W.js +2 -0
  16. package/dist/cli-bundle/chunks/{chunk-CASX6SFI.js → chunk-HC2OPETM.js} +2 -2
  17. package/dist/cli-bundle/chunks/{chunk-NCFCBKIP.js → chunk-HKUV74K3.js} +2 -2
  18. package/dist/cli-bundle/chunks/chunk-HXHYDO2R.js +115 -0
  19. package/dist/cli-bundle/chunks/{chunk-S6HB3WL2.js → chunk-J2LABXBL.js} +2 -2
  20. package/dist/cli-bundle/chunks/{chunk-BKSVHOWI.js → chunk-J52BEBSS.js} +2 -2
  21. package/dist/cli-bundle/chunks/{chunk-NT5AKFE5.js → chunk-OJTMGDON.js} +31 -31
  22. package/dist/cli-bundle/chunks/{chunk-SRVTCYAU.js → chunk-TC6XLIYO.js} +2 -2
  23. package/dist/cli-bundle/chunks/{chunk-AHQB7W2H.js → chunk-U7EL3AYA.js} +2 -2
  24. package/dist/cli-bundle/chunks/chunk-VQFWW4EF.js +6 -0
  25. package/dist/cli-bundle/chunks/{chunk-CIKGG34F.js → chunk-X6MIWTTT.js} +2 -2
  26. package/dist/cli-bundle/chunks/chunk-XC5Q2ZV7.js +2 -0
  27. package/dist/cli-bundle/chunks/{chunk-RMIRNYRG.js → chunk-XFHPKXAE.js} +2 -2
  28. package/dist/cli-bundle/chunks/{chunk-6QLEXRUG.js → chunk-YHVLVSEZ.js} +2 -2
  29. package/dist/cli-bundle/chunks/{item-revision-R5SZPJZ5.js → item-revision-4QBMZXKX.js} +2 -2
  30. package/dist/cli-bundle/chunks/item-transaction-QY3PUHEI.js +2 -0
  31. package/dist/cli-bundle/chunks/{mutation-actor-3TG636XG.js → mutation-actor-FWLYWJ37.js} +2 -2
  32. package/dist/cli-bundle/chunks/{mutation-admission-LICSDNNO.js → mutation-admission-7ZDCK3G2.js} +2 -2
  33. package/dist/cli-bundle/chunks/{register-list-query-SPGPS3OS.js → register-list-query-RR5KACJ3.js} +2 -2
  34. package/dist/cli-bundle/chunks/{register-mutation-WWVECKFQ.js → register-mutation-57AJQWFV.js} +2 -2
  35. package/dist/cli-bundle/chunks/{register-operations-L6HFJNWD.js → register-operations-RKWST7CU.js} +2 -2
  36. package/dist/cli-bundle/chunks/{register-setup-K7UFG5TD.js → register-setup-CMI23PC5.js} +2 -2
  37. package/dist/cli-bundle/chunks/{stage-57KH3KAC.js → stage-4KDVXC5Z.js} +2 -2
  38. package/dist/cli-bundle/focused-chunks/{chunk-YOAYY3HE.js → chunk-2ZD7275J.js} +2 -2
  39. package/dist/cli-bundle/focused-chunks/{chunk-532WZV65.js → chunk-324AHXJO.js} +2 -2
  40. package/dist/cli-bundle/focused-chunks/chunk-3XSWH6QC.js +91 -0
  41. package/dist/cli-bundle/focused-chunks/{chunk-QGKLRXP7.js → chunk-4JZITIJB.js} +2 -2
  42. package/dist/cli-bundle/focused-chunks/{chunk-CU2BRAOX.js → chunk-4KTFKSS3.js} +2 -2
  43. package/dist/cli-bundle/focused-chunks/chunk-5C5TK3ET.js +78 -0
  44. package/dist/cli-bundle/focused-chunks/chunk-AKJYOZZP.js +2 -0
  45. package/dist/cli-bundle/focused-chunks/{chunk-MKM5NKD7.js → chunk-BRZV7BFV.js} +2 -2
  46. package/dist/cli-bundle/focused-chunks/{chunk-RPE6IX26.js → chunk-HDEKFSOK.js} +2 -2
  47. package/dist/cli-bundle/focused-chunks/{chunk-LNHUE4VV.js → chunk-IWOXAUDU.js} +2 -2
  48. package/dist/cli-bundle/focused-chunks/{chunk-J63D6QST.js → chunk-ML3JHCC6.js} +2 -2
  49. package/dist/cli-bundle/focused-chunks/{chunk-JMQJBZQ5.js → chunk-OPGOOP25.js} +2 -2
  50. package/dist/cli-bundle/focused-chunks/{chunk-XCJSHNXK.js → chunk-RE7ZWT7D.js} +3 -3
  51. package/dist/cli-bundle/focused-chunks/chunk-RKQNVYGF.js +3 -0
  52. package/dist/cli-bundle/focused-chunks/{chunk-WXMI4AV5.js → chunk-RQ252B6V.js} +2 -2
  53. package/dist/cli-bundle/focused-chunks/{chunk-7A4QWNZX.js → chunk-URGHTTT3.js} +2 -2
  54. package/dist/cli-bundle/focused-chunks/{chunk-IQK5NPMG.js → chunk-USPYKWQG.js} +2 -2
  55. package/dist/cli-bundle/focused-chunks/chunk-UWS3FC4D.js +102 -0
  56. package/dist/cli-bundle/focused-chunks/chunk-UXQGFGAT.js +44 -0
  57. package/dist/cli-bundle/focused-chunks/{chunk-UOC6257J.js → chunk-WZWXGDYY.js} +2 -2
  58. package/dist/cli-bundle/focused-chunks/{chunk-NP72ZDXE.js → chunk-YKSLZPLT.js} +2 -2
  59. package/dist/cli-bundle/focused-chunks/chunk-ZWJTY4ID.js +2 -0
  60. package/dist/cli-bundle/focused-chunks/{item-revision-3V3UIP5X.js → item-revision-2O6MLPEX.js} +2 -2
  61. package/dist/cli-bundle/focused-chunks/item-transaction-GLACUTPL.js +2 -0
  62. package/dist/cli-bundle/focused-chunks/{mutation-actor-62HKR5IO.js → mutation-actor-TCYDPUGG.js} +2 -2
  63. package/dist/cli-bundle/focused-chunks/{mutation-admission-X4PF2SG3.js → mutation-admission-LY73EJWM.js} +2 -2
  64. package/dist/cli-bundle/focused-chunks/{stage-O7T7CXBB.js → stage-DQ7RQQ52.js} +2 -2
  65. package/dist/cli-bundle/main.js +2 -2
  66. package/dist/cli-bundle/sdk-authoring.js +1 -1
  67. package/dist/cli-bundle/sdk-contracts.js +2 -2
  68. package/dist/cli-bundle/sdk-core.js +1 -1
  69. package/dist/cli-bundle/sdk-governance.js +1 -1
  70. package/dist/cli-bundle/sdk-graph.js +1 -1
  71. package/dist/cli-bundle/sdk-merge.js +70 -58
  72. package/dist/cli-bundle/sdk-query.js +1 -1
  73. package/dist/cli-bundle/sdk-runtime.js +1 -1
  74. package/dist/cli-bundle/sdk-testing.js +1 -1
  75. package/dist/cli-bundle/sdk.js +11 -11
  76. package/dist/core/diagnostics/remediation.js +1 -1
  77. package/dist/core/fs/atomic-create.js +1 -1
  78. package/dist/core/fs/file-glob.js +1 -1
  79. package/dist/core/history/bridge.js +2 -0
  80. package/dist/core/history/drift-scan.js +1 -1
  81. package/dist/core/history/history-rewrite.js +1 -1
  82. package/dist/core/history/history.d.ts +12 -0
  83. package/dist/core/history/history.js +2 -2
  84. package/dist/core/history/projection.js +1 -1
  85. package/dist/core/history/read.d.ts +9 -0
  86. package/dist/core/history/read.js +1 -1
  87. package/dist/core/history/replay.d.ts +46 -5
  88. package/dist/core/history/replay.js +2 -2
  89. package/dist/sdk/cli-contracts/flag-contracts.js +1 -1
  90. package/dist/sdk/cli-contracts/flag-lexicon-contracts.js +1 -1
  91. package/dist/sdk/cli-contracts/tool-parameter-tables.js +1 -1
  92. package/dist/sdk/cli-contracts/tool-schema.js +1 -1
  93. package/dist/sdk/cli-contracts/typed-action-inputs.d.ts +2 -2
  94. package/dist/sdk/completion/fish.js +3 -2
  95. package/dist/sdk/completion/zsh.js +3 -2
  96. package/dist/sdk/generated/generated-error-code-catalog-part-1.js +1 -1
  97. package/dist/sdk/generated/generated-error-code-catalog-part-2.js +1 -1
  98. package/dist/sdk/governance/health/history-drift-remedies.js +2 -0
  99. package/dist/sdk/governance/health.js +2 -2
  100. package/dist/sdk/history/append-only-repair.d.ts +30 -0
  101. package/dist/sdk/history/append-only-repair.js +6 -0
  102. package/dist/sdk/history/maintenance.d.ts +8 -2
  103. package/dist/sdk/history/maintenance.js +1 -1
  104. package/dist/sdk/history/reanchor-refusal.js +2 -0
  105. package/dist/sdk/history/reseed.d.ts +15 -0
  106. package/dist/sdk/history/reseed.js +2 -0
  107. package/dist/sdk/history/salvage.d.ts +19 -8
  108. package/dist/sdk/history/salvage.js +5 -3
  109. package/dist/sdk/history-compact.js +1 -1
  110. package/dist/sdk/history-redact.js +1 -1
  111. package/dist/sdk/history-repair.d.ts +8 -2
  112. package/dist/sdk/history-repair.js +1 -1
  113. package/dist/sdk/index.d.ts +1 -1
  114. package/dist/sdk/item-transaction.d.ts +33 -1
  115. package/dist/sdk/item-transaction.js +1 -1
  116. package/dist/sdk/lifecycle/restore.js +1 -1
  117. package/dist/sdk/merge/three-way.d.ts +22 -3
  118. package/dist/sdk/merge/three-way.js +8 -2
  119. package/dist/sdk/public-surface.json +1 -1
  120. package/dist/sdk/runtime/actions.js +1 -1
  121. package/dist/sdk/runtime-input.d.ts +6 -2
  122. package/dist/sdk/runtime-input.js +1 -1
  123. package/dist/sdk/runtime-primitives.d.ts +1 -1
  124. package/dist/sdk/runtime-primitives.js +1 -1
  125. package/dist/sdk/runtime.d.ts +7 -0
  126. package/dist/sdk/runtime.js +1 -1
  127. package/dist/sdk/structured-mutations.d.ts +5 -5
  128. package/dist/sdk/structured-mutations.js +1 -1
  129. package/dist/sdk/transactions/item-finalization.js +2 -0
  130. package/dist/types.d.ts +20 -0
  131. package/dist/types.js +1 -1
  132. package/docs/AGENT_GUIDE.md +1 -1
  133. package/docs/AGENT_RUNTIME_PRIMITIVES.md +1 -1
  134. package/docs/COMMANDS.md +6 -2
  135. package/docs/HISTORY_RECOVERY.md +229 -5
  136. package/docs/README.md +2 -2
  137. package/docs/SDK.md +103 -4
  138. package/docs/SDK_CONTEXT_COORDINATION.md +3 -2
  139. package/marketplace.json +1 -1
  140. package/node_modules/tar/package.json +2 -3
  141. package/package.json +30 -2
  142. package/packages/pm-beads/package.json +1 -1
  143. package/packages/pm-calendar/package.json +1 -1
  144. package/packages/pm-command-kit/package.json +1 -1
  145. package/packages/pm-digital-twin/package.json +1 -1
  146. package/packages/pm-governance-audit/package.json +1 -1
  147. package/packages/pm-guide-shell/package.json +1 -1
  148. package/packages/pm-kanban/package.json +1 -1
  149. package/packages/pm-lifecycle-hooks/package.json +1 -1
  150. package/packages/pm-linked-test-adapters/package.json +1 -1
  151. package/packages/pm-search-advanced/package.json +1 -1
  152. package/packages/pm-templates/package.json +1 -1
  153. package/packages/pm-todos/package.json +1 -1
  154. package/packages/pm-vcs/package.json +1 -1
  155. package/plugins/pm-claude/.claude-plugin/plugin.json +1 -1
  156. package/plugins/pm-claude/package.json +1 -1
  157. package/plugins/pm-codex/.codex-plugin/plugin.json +1 -1
  158. package/plugins/pm-codex/package.json +1 -1
  159. package/plugins/pm-codex/plugin.json +1 -1
  160. package/runtime-dependencies.json +1 -1
  161. package/dist/cli-bundle/chunks/chunk-2DXRTIC6.js +0 -21
  162. package/dist/cli-bundle/chunks/chunk-IUIOTAF6.js +0 -9
  163. package/dist/cli-bundle/chunks/chunk-KVBIMFUG.js +0 -6
  164. package/dist/cli-bundle/chunks/chunk-RULHZRFN.js +0 -2
  165. package/dist/cli-bundle/chunks/chunk-SA4BNP3Q.js +0 -2
  166. package/dist/cli-bundle/chunks/chunk-YKJKQ7DM.js +0 -115
  167. package/dist/cli-bundle/chunks/item-transaction-7DFCG73I.js +0 -2
  168. package/dist/cli-bundle/focused-chunks/chunk-CWWKRI5P.js +0 -2
  169. package/dist/cli-bundle/focused-chunks/chunk-HGFNL5XI.js +0 -2
  170. package/dist/cli-bundle/focused-chunks/chunk-OSLQD5VH.js +0 -102
  171. package/dist/cli-bundle/focused-chunks/chunk-QSJW6NSQ.js +0 -66
  172. package/dist/cli-bundle/focused-chunks/chunk-SRDQSA6M.js +0 -91
  173. package/dist/cli-bundle/focused-chunks/chunk-URJ2E6AS.js +0 -3
  174. package/dist/cli-bundle/focused-chunks/chunk-XQQSSKJI.js +0 -44
  175. package/dist/cli-bundle/focused-chunks/item-transaction-HLBW7B3J.js +0 -2
  176. package/dist/sdk/agent/refusal-closure.js +0 -2
  177. package/dist/sdk/agent/refusal-reachability.js +0 -4
  178. package/dist/sdk/agent/task-transcript-contracts.js +0 -2
  179. package/dist/sdk/agent/tracker-preflight-contracts.js +0 -2
  180. package/dist/sdk/authoring.js +0 -2
  181. package/dist/sdk/compose.js +0 -2
  182. package/dist/sdk/contracts.js +0 -2
  183. package/dist/sdk/core-governance.js +0 -2
  184. package/dist/sdk/core.js +0 -2
  185. package/dist/sdk/corpus-shape.js +0 -2
  186. package/dist/sdk/define.js +0 -2
  187. package/dist/sdk/environment/agent-environment.js +0 -2
  188. package/dist/sdk/governance/artifact-ledgers.js +0 -2
  189. package/dist/sdk/governance/coverage-assurance.js +0 -2
  190. package/dist/sdk/governance/reliability.js +0 -2
  191. package/dist/sdk/governance.js +0 -2
  192. package/dist/sdk/graph/adapter.js +0 -2
  193. package/dist/sdk/graph/conformance.js +0 -2
  194. package/dist/sdk/graph/index.js +0 -2
  195. package/dist/sdk/graph.js +0 -2
  196. package/dist/sdk/index.js +0 -2
  197. package/dist/sdk/query.js +0 -2
  198. package/dist/sdk/relationship-migration.js +0 -2
  199. package/dist/sdk/testing.js +0 -8
  200. package/dist/sdk/workspace-recipe.js +0 -2
  201. package/docs/AGENT_PROVENANCE_ADR.md +0 -206
  202. package/docs/DEFECT_RECURRENCE.md +0 -257
  203. package/docs/PERFORMANCE.md +0 -204
@@ -1,204 +0,0 @@
1
- # Performance and scale
2
-
3
- Tracker: [pm-mi2x](../.agents/pm/chores/pm-mi2x.toon) under the [pm-9rxu scale-out initiative](../.agents/pm/epics/pm-9rxu.toon). CLI transport overhead is tracked by [pm-yse5dt](../.agents/pm/tasks/pm-yse5dt.toon).
4
-
5
- `pm` treats wall time, memory, and agent token cost as one performance contract: project management is context management, so a fast command that emits an unbounded payload is still slow for its caller.
6
-
7
- ## Current targets
8
-
9
- Every measured CLI and SDK operation targets:
10
-
11
- - p95 wall time at or below 1,000 ms;
12
- - default output at or below 5,000 estimated tokens;
13
- - no feature, flag, output, history, or validation loss.
14
-
15
- The committed regression budgets in [`scripts/bench/scale-budgets.json`](../scripts/bench/scale-budgets.json) protect the current baseline while the product targets stay fixed. Baseline refreshes use the Node major pinned by release and primary CI workflows (currently Node 24); newer supported runtimes remain compatibility targets, but their startup and memory characteristics must not silently rewrite the release baseline. Short local checks use the best observed latency as a regression floor; statistically meaningful runs of 20 or more use p95. Both receive 25% baseline headroom plus a 25 ms scheduler/filesystem noise margin. Reports always retain min/p50/p95, and product-target status always uses p95. This lets a busy workstation detect deterministic code slowdowns without pretending that three samples produce a meaningful p95 or hiding the real tail-latency target.
16
-
17
- ## Reproducible fixtures
18
-
19
- Generate a deterministic isolated workspace without touching the current tracker:
20
-
21
- ```bash
22
- pnpm build
23
- pnpm benchmark:scale:generate --output /tmp/pm-scale --items 10000 --mode direct
24
- PM_PATH=/tmp/pm-scale/.agents/pm PM_GLOBAL_PATH=/tmp/pm-scale-global pm validate --json
25
- ```
26
-
27
- Named tiers are `smoke` (100), `ci` (10,000), `large` (100,000), and `million` (1,000,000). The `ci` name describes the fixture size for compatibility with existing benchmark data; these performance workloads run locally and are intentionally absent from GitHub Actions. `direct` writes bounded batches for large fixtures; `sdk` uses the public SDK atomic-write and history primitives. Both modes serialize the same deterministic item and history bytes.
28
-
29
- The fixture models built-in item types, open/in-progress/blocked/closed/canceled states, parents, dependencies, tags, bodies, comments, notes, learnings, and one valid history stream per item. It refuses to generate inside this repository. `--force` replaces a non-empty target only when that target already contains the scale-fixture manifest, so a mistyped arbitrary directory is never recursively removed.
30
-
31
- ## Benchmark runner
32
-
33
- Run CLI cold-process and SDK warm-process measurements together:
34
-
35
- ```bash
36
- pnpm benchmark:scale --items ci --iterations 3 --transport both --check
37
- ```
38
-
39
- The JSON report records fixture generation time plus one excluded warmup observation and measured p50/p95/min/max latency, peak RSS on Linux, output bytes, and estimated tokens for `list`, `get`, `next`, `context`, `search`, `create`, and `claim`. The warmup exposes initial index-build cost while regression percentiles measure the continuously warm derived-index contract across real cold CLI processes and in-process SDK calls. Run the committed local regression check with `pnpm benchmark:scale:check`. GitHub-hosted runners do not execute the scale suite, which keeps expensive performance work off Actions and avoids consuming hosted-runner capacity.
40
-
41
- The scale report also records the CLI-minus-SDK transport delta for each common
42
- operation and gates it independently from the absolute CLI/SDK budgets. This
43
- separates process/bootstrap cost from storage or domain cost instead of allowing
44
- one transport to hide a regression in the other. The synthetic workspace has no
45
- installed extensions, while the SDK client explicitly opts out, so both paths
46
- measure the same core operation without project package work. CLI mutations do
47
- not inject `PM_AUTHOR`; they exercise the normal harness/default attribution
48
- resolver. The 10,000-item delta budgets are measured ratchets. The 100,000-item
49
- delta bounds are conservative ceilings derived from the existing absolute CLI
50
- budgets until a stable large-fixture measurement can replace them; they do not
51
- weaken either transport's existing absolute gate.
52
-
53
- For a fast, deterministic one-item cold-start floor covering `get`, `list`,
54
- `context`, `next`, `create`, and `claim`, run:
55
-
56
- ```bash
57
- pnpm benchmark:transport:check
58
- ```
59
-
60
- The committed [CLI transport report](https://github.com/unbraind/pm-cli/blob/main/docs/performance/cli-transport-overhead.md)
61
- contains best/p50/p95 measurements and a stage breakdown. SDK entrypoint import
62
- costs are independently gated with `pnpm benchmark:sdk-entrypoints:check` and
63
- documented in the
64
- [SDK entrypoint report](https://github.com/unbraind/pm-cli/blob/main/docs/performance/sdk-entrypoint-import-costs.md). The committed reports under `docs/performance/` are repository-only and excluded from npm.
65
-
66
- Recent-activity reads are gated on history volume rather than item count
67
- (GH-1664). `node scripts/bench/history-read-costs.mjs --check`, part of
68
- `pnpm quality:static`, measures `pm context --for orient --limit 3` on a
69
- fixture with 2,000 history streams and over 100 MiB of history, once with
70
- trusted derived stream bounds and once with the summary path blocked before
71
- every sample, which forces a complete traversal that persists nothing. The bounded p50 must stay below 0.6 of the same runner's full-scan p50;
72
- on a qualified runner whose full scan exceeds the declared ceiling it must also
73
- stay below that ceiling, and elsewhere the absolute check is reported as
74
- unverified. See the
75
- [history read report](https://github.com/unbraind/pm-cli/blob/main/docs/performance/history-read-costs.md). The bounds live in
76
- `runtime/history-stream-summary.json`, a checksummed derived file trusted per
77
- stream only while the stream's stat signature (device, inode, size, mtime,
78
- ctime and the reader's credentials) is unchanged; it is safe to delete, and trackers
79
- under 500 history streams never write it.
80
-
81
- The metadata read cache is rebuildable derived state. Workspaces with at least
82
- 500 indexed items use its directory-validated fast path to avoid per-item
83
- stats; validation and recovery can force a canonical source scan. Every
84
- metadata, body, and collection tier carries one `source_cursor`. A small
85
- manifest exposes the base cursor and item count without parsing the full index.
86
- A supported create, update, move, or delete acquires the cross-process
87
- derived-index writer lock before the authoritative item commit and atomically
88
- publishes one collapsed delta containing every compatible tier projection,
89
- directory signatures, and the next cursor before releasing the lock. Mutation
90
- cost for this metadata projection therefore follows changed items rather than total workspace size. A torn,
91
- corrupt, or base-mismatched delta is rejected and rebuilt from source.
92
-
93
- Large indexes also carry `runtime/metadata-query-index.sqlite`, a rebuildable
94
- row/index projection with the same context fingerprint and effective
95
- `source_cursor`. Source scans replace it atomically; supported mutations update
96
- it inside the existing derived-index writer critical section. Bounded
97
- default-order light `list` pages query only their result window plus a count,
98
- instead of parsing the full JSON cache. Unsupported filters, heavy
99
- body/collection projections, trees, runtime fields, active read hooks, missing
100
- files, stale cursors, and corrupt databases fail closed to the established
101
- authoritative/JSON path. The SQLite file is optimization state and is safe to
102
- delete or rebuild with `pm reindex`.
103
-
104
- The same database carries bounded FTS candidate retrieval for the opt-in
105
- create/copy duplicate-governance probe. Minimal/default governance keeps the
106
- probe off and performs no query on the create path; advisory/strict modes reuse
107
- one dependency-light SDK scorer with the package-owned dedupe audit. Mutation
108
- history events use a separate rebuildable ordered SQLite projection so
109
- `pm events --since <cursor>` retrieves only matching rows from the index.
110
- As required by [pm-gh1593](../.agents/pm/issues/pm-gh1593.toon), cache validation
111
- hashes the complete authoritative bytes of selected streams on every read;
112
- its cost therefore grows with selected history size. An `--item` filter bounds
113
- that source population. Opt-in `--verify` additionally replays each selected
114
- chain, before filtering or pagination. These checks detect same-length rewrites
115
- without trusting timestamps or a last-record hash. The version-7 schema retains
116
- substantive-versus-maintenance indexing, so context recency still retrieves only
117
- the latest substantive row per requested stream after content validation.
118
-
119
- An indexed history append reads and SHA-256-hashes the complete affected stream
120
- before the append to certify its existing index base, then reads and hashes it
121
- again after the authoritative append to publish the new content receipt. Both
122
- checks run under the history-index writer lock. This history validation cost is
123
- O(stream bytes), in addition to the changed-item metadata projection work.
124
- Unfiltered follow queries repeat selected-stream validation on every iteration;
125
- use an item filter and an explicit interval appropriate to the history size.
126
- Further append and follow measurements are tracked by
127
- [pm-history-receipt-cost](../.agents/pm/tasks/pm-history-receipt-cost.toon).
128
- See [SDK Context Coordination](SDK_CONTEXT_COORDINATION.md).
129
-
130
- SDK hosts that commit authoritative item documents outside the stock mutation
131
- commands use `acquireItemMetadataDerivedIndexLock` and
132
- `refreshItemMetadataDerivedIndex` from `@unbrained/pm-cli/sdk` around the same
133
- commit boundary. Repeated writes collapse by item path in the delta instead of
134
- growing an event log; a later source scan compacts the projection into fresh
135
- base tiers. Projection failure removes the rebuildable tiers, delta, and
136
- manifest and returns a warning; it never rolls back or outranks the
137
- authoritative item/history write. Small workspaces without an active index
138
- receive a no-op release function and retain direct external-edit detection.
139
-
140
- Context-signal snapshots follow the same rule: they are versioned and
141
- cursor-stamped, never authoritative, and rebuild from the metadata index or
142
- source-scan fallback when missing, stale, or corrupt. The stock `context` and
143
- `next` projections use separate snapshot namespaces, persist only
144
- caller-independent signals, and recompute author, time, semantic, and usage
145
- overlays on every read. SDK hosts can use `readWorkspaceContextSignals` for the
146
- same automatic cursor binding or compose `ContextSignalStore` directly, while
147
- retaining explicit `fresh`/`rebuilt` and `derived_index`/`scan_fallback`
148
- diagnostics. See [Context relevance and packing](CONTEXT_RELEVANCE.md).
149
-
150
- At 10,000 items, `context` and `search` also build
151
- `runtime/workspace-memory.json`: compact calendar-epoch and epic-lineage
152
- summaries over completed history. The snapshot is cursor-bound, token-bounded
153
- when attached to context, searchable without expanding closed rows, and skipped
154
- entirely below the threshold. Missing, stale, corrupt, or unwritable memory
155
- state rebuilds or degrades without outranking item documents or history.
156
-
157
- To refresh a baseline after an intentional, measured improvement:
158
-
159
- ```bash
160
- pnpm benchmark:scale --items ci --iterations 5 --transport both --update --headroom 1.25
161
- ```
162
-
163
- Review the report and budget diff together. Before a refresh, compare the delivery head with its exact base commit using the same runtime, fixture shape, and transport set; retain that evidence on the owning PM item. Never update a budget merely to silence a regression.
164
-
165
- ## Startup and observability
166
-
167
- Sentry is loaded only when an error-reporting path actually initializes it. Disabled and normal successful commands do not resolve or compile the `@sentry/node` → OpenTelemetry → Undici graph. The loader uses the package's supported CommonJS export after the opt-out gate, preserving the repo-wide ban on dynamic/inline imports while keeping enabled capture, sanitization, and flush behavior intact.
168
-
169
- ## Invocation timing
170
-
171
- Tracked by [pm-ag9nka](../.agents/pm/issues/pm-ag9nka.toon).
172
-
173
- Use `pm --profile list --limit 5` to print diagnostics on stderr while retaining
174
- normal stdout (including JSON). Every executable invocation with `--profile`
175
- emits one final receipt on normal process drain, including help, version, and
176
- handled refusals:
177
-
178
- ```text
179
- profile:command=list took_ms=20
180
- profile:invocation total_ms=324.125 scope=process_start_to_output_drain command_took_ms_scope=handler
181
- ```
182
-
183
- `total_ms` uses monotonic runtime uptime, starting before module initialization
184
- and ending after pending command output and event-loop work drain. It includes
185
- bootstrap, settings/schema and extension loading, dispatch, rendering, and
186
- foreground cleanup. Existing `profile:command` records retain their compatible
187
- `took_ms` field; `command_took_ms_scope=handler` explicitly labels those narrower
188
- spans. Extension discovery timing is another component, never an invocation
189
- total. Components may overlap and must not be added to the total.
190
-
191
- The total excludes parent-side scheduling/spawn, final OS teardown, and remote
192
- telemetry delivery after a detached flush. A forcibly terminated process may
193
- never reach the drain callback. In-process SDK calls do not emit a process-total
194
- receipt: their host owns the lifetime. `--profile` after the `--` positional
195
- terminator does not enable the receipt.
196
-
197
- The real-process regression compares the reported total against external wall
198
- time across query, mutation, configuration, schema, health, discovery, and
199
- refusal paths. It permits parent/teardown overhead of the greater of 250 ms or
200
- 25% of external wall time, and no more than 5 ms of clock rounding above it.
201
- This is an instrument agreement tolerance, not a performance budget. Existing
202
- transport/scale gates retain external end-to-end process wall time and their
203
- unchanged stricter regression budgets; never gate invocation latency on handler
204
- `took_ms`.