@unbrained/pm-cli 2026.11.20 → 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.
- package/.agents/skills/pm-developer/SKILL.md +1 -1
- package/.agents/skills/pm-sdk/SKILL.md +1 -1
- package/.agents/skills/pm-test-audit/SKILL.md +1 -1
- package/.claude-plugin/marketplace.json +1 -1
- package/CONTRIBUTING.md +2 -1
- package/dist/cli/error-guidance.js +2 -2
- package/dist/cli/register-history-maintenance.js +2 -2
- package/dist/cli/register-list-query.js +2 -2
- package/dist/cli/runtime/refusal-credential-redaction.js +1 -1
- package/dist/cli-bundle/bundle-manifest.json +1 -1
- package/dist/cli-bundle/chunks/chunk-3W47ZZ5T.js +9 -0
- package/dist/cli-bundle/chunks/chunk-4TB5D6HL.js +125 -0
- package/dist/cli-bundle/chunks/{chunk-4TZW4NLM.js → chunk-5ZMVLWE3.js} +2 -2
- package/dist/cli-bundle/chunks/chunk-6BBDEIKC.js +33 -0
- package/dist/cli-bundle/chunks/{chunk-GXGW6KHB.js → chunk-AR4NP5HI.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-6X2AGUOT.js → chunk-B4PPFOPY.js} +3 -3
- package/dist/cli-bundle/chunks/{chunk-XK25TAJZ.js → chunk-B76TFRO2.js} +47 -45
- package/dist/cli-bundle/chunks/chunk-CAR2L5NW.js +8 -0
- package/dist/cli-bundle/chunks/{chunk-KDDIHGAO.js → chunk-EIGUKEV6.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-ZAO7VGX3.js → chunk-GTPCAJMZ.js} +2 -2
- package/dist/cli-bundle/chunks/chunk-GYP24M7W.js +2 -0
- package/dist/cli-bundle/chunks/{chunk-KQSPKWFH.js → chunk-HC2OPETM.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-5LF5QZT3.js → chunk-HKUV74K3.js} +2 -2
- package/dist/cli-bundle/chunks/chunk-HXHYDO2R.js +115 -0
- package/dist/cli-bundle/chunks/{chunk-FF4TXJDH.js → chunk-J2LABXBL.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-3BOR22MC.js → chunk-J52BEBSS.js} +2 -2
- package/dist/cli-bundle/chunks/chunk-KQIZ34SF.js +3 -0
- package/dist/cli-bundle/chunks/chunk-LQBWLNZJ.js +3 -0
- package/dist/cli-bundle/chunks/chunk-OJTMGDON.js +31 -0
- package/dist/cli-bundle/chunks/{chunk-DG2EOOFX.js → chunk-TC6XLIYO.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-MGYAJONE.js → chunk-U7EL3AYA.js} +2 -2
- package/dist/cli-bundle/chunks/chunk-VQFWW4EF.js +6 -0
- package/dist/cli-bundle/chunks/{chunk-ZVEHACE6.js → chunk-X6MIWTTT.js} +2 -2
- package/dist/cli-bundle/chunks/chunk-XC5Q2ZV7.js +2 -0
- package/dist/cli-bundle/chunks/{chunk-KEBLUTC3.js → chunk-XFHPKXAE.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-OXG5XPC7.js → chunk-YHVLVSEZ.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-Y4LXVPA5.js → chunk-YMUSRWV4.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-HQYIKAC6.js → chunk-YR2KEBHP.js} +2 -2
- package/dist/cli-bundle/chunks/{indexed-receipt-blobs-ELEMA7IW.js → indexed-receipt-blobs-ITTXIN4K.js} +2 -2
- package/dist/cli-bundle/chunks/{item-revision-GE2CQECR.js → item-revision-4QBMZXKX.js} +2 -2
- package/dist/cli-bundle/chunks/item-transaction-QY3PUHEI.js +2 -0
- package/dist/cli-bundle/chunks/{mutation-actor-5GYX7LP3.js → mutation-actor-FWLYWJ37.js} +2 -2
- package/dist/cli-bundle/chunks/{mutation-admission-72TYKPGU.js → mutation-admission-7ZDCK3G2.js} +2 -2
- package/dist/cli-bundle/chunks/{register-list-query-OQZZEWEB.js → register-list-query-RR5KACJ3.js} +10 -10
- package/dist/cli-bundle/chunks/{register-mutation-YZEUZ6XT.js → register-mutation-57AJQWFV.js} +2 -2
- package/dist/cli-bundle/chunks/{register-operations-JNVCF7EW.js → register-operations-RKWST7CU.js} +2 -2
- package/dist/cli-bundle/chunks/{register-setup-LDKULZSD.js → register-setup-CMI23PC5.js} +2 -2
- package/dist/cli-bundle/chunks/{settlement-hook-E5LHZ4RD.js → settlement-hook-BXN5LEQD.js} +2 -2
- package/dist/cli-bundle/chunks/{stage-Q2QZ2IBG.js → stage-4KDVXC5Z.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-JUYJ7NXL.js → chunk-2ZD7275J.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-7SB6VKEI.js → chunk-324AHXJO.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-IXYBN6D2.js → chunk-3IRCYJI5.js} +3 -3
- package/dist/cli-bundle/focused-chunks/{chunk-DH4DHL6V.js → chunk-3V53UBHN.js} +2 -2
- package/dist/cli-bundle/focused-chunks/chunk-3XSWH6QC.js +91 -0
- package/dist/cli-bundle/focused-chunks/{chunk-V55XZFOP.js → chunk-4JZITIJB.js} +2 -2
- package/dist/cli-bundle/focused-chunks/chunk-4KTFKSS3.js +2 -0
- package/dist/cli-bundle/focused-chunks/chunk-5C5TK3ET.js +78 -0
- package/dist/cli-bundle/focused-chunks/chunk-AKJYOZZP.js +2 -0
- package/dist/cli-bundle/focused-chunks/{chunk-BZCLW5V7.js → chunk-BRZV7BFV.js} +2 -2
- package/dist/cli-bundle/focused-chunks/chunk-CR7CGEB2.js +3 -0
- package/dist/cli-bundle/focused-chunks/{chunk-PKMDWIP3.js → chunk-HDEKFSOK.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-O25KFLLA.js → chunk-IWOXAUDU.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-UATP3RK3.js → chunk-ML3JHCC6.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-ZKGGGU2K.js → chunk-OPGOOP25.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-PRFEOCNZ.js → chunk-RE7ZWT7D.js} +3 -3
- package/dist/cli-bundle/focused-chunks/chunk-RKQNVYGF.js +3 -0
- package/dist/cli-bundle/focused-chunks/chunk-RQ252B6V.js +8 -0
- package/dist/cli-bundle/focused-chunks/{chunk-KQJNJZKP.js → chunk-URGHTTT3.js} +2 -2
- package/dist/cli-bundle/focused-chunks/chunk-USPYKWQG.js +13 -0
- package/dist/cli-bundle/focused-chunks/chunk-UWS3FC4D.js +102 -0
- package/dist/cli-bundle/focused-chunks/chunk-UXQGFGAT.js +44 -0
- package/dist/cli-bundle/focused-chunks/{chunk-PQXTZLK3.js → chunk-WZWXGDYY.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-5VSXKA35.js → chunk-YKSLZPLT.js} +2 -2
- package/dist/cli-bundle/focused-chunks/chunk-ZWJTY4ID.js +2 -0
- package/dist/cli-bundle/focused-chunks/{indexed-receipt-blobs-ZTRFCPH7.js → indexed-receipt-blobs-AF4U3F3D.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{item-revision-OXDZHMJ7.js → item-revision-2O6MLPEX.js} +2 -2
- package/dist/cli-bundle/focused-chunks/item-transaction-GLACUTPL.js +2 -0
- package/dist/cli-bundle/focused-chunks/{mutation-actor-6DYIF6NH.js → mutation-actor-TCYDPUGG.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{mutation-admission-2BYXANVJ.js → mutation-admission-LY73EJWM.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{settlement-hook-OUBUN45C.js → settlement-hook-ARYCZQY4.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{stage-FGHSB3QX.js → stage-DQ7RQQ52.js} +2 -2
- package/dist/cli-bundle/main.js +25 -25
- package/dist/cli-bundle/sdk-authoring.js +1 -1
- package/dist/cli-bundle/sdk-contracts.js +2 -2
- package/dist/cli-bundle/sdk-core.js +1 -1
- package/dist/cli-bundle/sdk-governance.js +1 -1
- package/dist/cli-bundle/sdk-graph.js +1 -1
- package/dist/cli-bundle/sdk-merge.js +70 -57
- package/dist/cli-bundle/sdk-query.js +1 -1
- package/dist/cli-bundle/sdk-runtime.js +1 -1
- package/dist/cli-bundle/sdk-testing.js +1 -1
- package/dist/cli-bundle/sdk.js +11 -11
- package/dist/core/diagnostics/remediation.js +1 -1
- package/dist/core/extensions/index.d.ts +2 -0
- package/dist/core/extensions/index.js +1 -1
- package/dist/core/fs/atomic-create.js +1 -1
- package/dist/core/fs/file-glob.js +1 -1
- package/dist/core/fs/fs-utils.d.ts +3 -1
- package/dist/core/fs/fs-utils.js +1 -1
- package/dist/core/history/bridge.js +2 -0
- package/dist/core/history/drift-scan.js +1 -1
- package/dist/core/history/history-rewrite.js +1 -1
- package/dist/core/history/history-stream-policy.js +1 -1
- package/dist/core/history/history.d.ts +12 -0
- package/dist/core/history/history.js +2 -2
- package/dist/core/history/projection.js +1 -1
- package/dist/core/history/read.d.ts +20 -1
- package/dist/core/history/read.js +1 -1
- package/dist/core/history/replay.d.ts +46 -5
- package/dist/core/history/replay.js +2 -2
- package/dist/core/history/stream-summary.d.ts +129 -0
- package/dist/core/history/stream-summary.js +3 -0
- package/dist/core/shared/errors.d.ts +8 -0
- package/dist/core/shared/errors.js +1 -1
- package/dist/core/shared/url-credentials.js +1 -1
- package/dist/sdk/cli-contracts/flag-contracts.js +1 -1
- package/dist/sdk/cli-contracts/flag-lexicon-contracts.js +1 -1
- package/dist/sdk/cli-contracts/registration-helpers.js +2 -2
- package/dist/sdk/cli-contracts/tool-parameter-tables.js +1 -1
- package/dist/sdk/cli-contracts/tool-schema.js +1 -1
- package/dist/sdk/cli-contracts/typed-action-inputs.d.ts +2 -2
- package/dist/sdk/completion/fish.js +3 -2
- package/dist/sdk/completion/zsh.js +3 -2
- package/dist/sdk/generated/generated-error-code-catalog-part-1.js +1 -1
- package/dist/sdk/generated/generated-error-code-catalog-part-2.js +1 -1
- package/dist/sdk/governance/gc.js +1 -1
- package/dist/sdk/governance/health/history-drift-remedies.js +2 -0
- package/dist/sdk/governance/health-merge-evidence.js +1 -1
- package/dist/sdk/governance/health.js +2 -2
- package/dist/sdk/governance/validate.js +1 -1
- package/dist/sdk/governance/workspace-position.js +1 -1
- package/dist/sdk/history/append-only-repair.d.ts +30 -0
- package/dist/sdk/history/append-only-repair.js +6 -0
- package/dist/sdk/history/maintenance.d.ts +8 -2
- package/dist/sdk/history/maintenance.js +1 -1
- package/dist/sdk/history/reanchor-refusal.js +2 -0
- package/dist/sdk/history/reseed.d.ts +15 -0
- package/dist/sdk/history/reseed.js +2 -0
- package/dist/sdk/history/salvage.d.ts +19 -8
- package/dist/sdk/history/salvage.js +5 -3
- package/dist/sdk/history-compact.js +1 -1
- package/dist/sdk/history-provenance.js +1 -1
- package/dist/sdk/history-redact.js +1 -1
- package/dist/sdk/history-repair.d.ts +8 -2
- package/dist/sdk/history-repair.js +1 -1
- package/dist/sdk/index.d.ts +1 -1
- package/dist/sdk/item-transaction.d.ts +33 -1
- package/dist/sdk/item-transaction.js +1 -1
- package/dist/sdk/lifecycle/restore.js +1 -1
- package/dist/sdk/merge/index.d.ts +1 -1
- package/dist/sdk/merge/index.js +1 -1
- package/dist/sdk/merge/install.d.ts +20 -6
- package/dist/sdk/merge/install.js +3 -3
- package/dist/sdk/merge/three-way.d.ts +22 -3
- package/dist/sdk/merge/three-way.js +8 -2
- package/dist/sdk/merge/worktree-config.js +2 -1
- package/dist/sdk/public-surface.json +1 -1
- package/dist/sdk/query/activity.d.ts +67 -5
- package/dist/sdk/query/activity.js +1 -1
- package/dist/sdk/query/context.d.ts +13 -3
- package/dist/sdk/query/context.js +2 -2
- package/dist/sdk/query.d.ts +1 -1
- package/dist/sdk/runtime/actions.js +1 -1
- package/dist/sdk/runtime-input.d.ts +6 -2
- package/dist/sdk/runtime-input.js +1 -1
- package/dist/sdk/runtime-primitives.d.ts +1 -1
- package/dist/sdk/runtime-primitives.js +1 -1
- package/dist/sdk/runtime.d.ts +7 -0
- package/dist/sdk/runtime.js +1 -1
- package/dist/sdk/structured-mutations.d.ts +5 -5
- package/dist/sdk/structured-mutations.js +1 -1
- package/dist/sdk/transactions/item-finalization.js +2 -0
- package/dist/types.d.ts +20 -0
- package/dist/types.js +1 -1
- package/docs/AGENT_GUIDE.md +1 -1
- package/docs/AGENT_RUNTIME_PRIMITIVES.md +1 -1
- package/docs/COMMANDS.md +62 -4
- package/docs/HISTORY_RECOVERY.md +229 -5
- package/docs/MERGE_SAFETY.md +8 -0
- package/docs/MUTATION_INTEGRITY.md +3 -1
- package/docs/README.md +8 -6
- package/docs/SDK.md +128 -5
- package/docs/SDK_CONTEXT_COORDINATION.md +3 -2
- package/docs/TESTING.md +8 -697
- package/docs/WORKSPACE_POSITION_AND_LIFECYCLE.md +1 -1
- package/marketplace.json +1 -1
- package/node_modules/tar/package.json +2 -3
- package/package.json +35 -3
- package/packages/pm-beads/package.json +1 -1
- package/packages/pm-calendar/package.json +1 -1
- package/packages/pm-command-kit/package.json +1 -1
- package/packages/pm-digital-twin/package.json +1 -1
- package/packages/pm-governance-audit/package.json +1 -1
- package/packages/pm-guide-shell/package.json +1 -1
- package/packages/pm-kanban/package.json +1 -1
- package/packages/pm-lifecycle-hooks/package.json +1 -1
- package/packages/pm-linked-test-adapters/package.json +1 -1
- package/packages/pm-search-advanced/package.json +1 -1
- package/packages/pm-templates/package.json +1 -1
- package/packages/pm-todos/package.json +1 -1
- package/packages/pm-vcs/package.json +1 -1
- package/plugins/pm-claude/.claude-plugin/plugin.json +1 -1
- package/plugins/pm-claude/package.json +1 -1
- package/plugins/pm-codex/.codex-plugin/plugin.json +1 -1
- package/plugins/pm-codex/package.json +1 -1
- package/plugins/pm-codex/plugin.json +1 -1
- package/runtime-dependencies.json +1 -1
- package/dist/cli-bundle/chunks/chunk-2IZGNOGT.js +0 -6
- package/dist/cli-bundle/chunks/chunk-4QQPM3IY.js +0 -2
- package/dist/cli-bundle/chunks/chunk-5OFMWP3Q.js +0 -3
- package/dist/cli-bundle/chunks/chunk-6HRPGEBF.js +0 -2
- package/dist/cli-bundle/chunks/chunk-7ESF676D.js +0 -125
- package/dist/cli-bundle/chunks/chunk-7EZZ4W7O.js +0 -20
- package/dist/cli-bundle/chunks/chunk-FOYRE23V.js +0 -115
- package/dist/cli-bundle/chunks/chunk-HJQ3XPS3.js +0 -31
- package/dist/cli-bundle/chunks/chunk-M5D3CEMY.js +0 -9
- package/dist/cli-bundle/chunks/chunk-VS565KBX.js +0 -2
- package/dist/cli-bundle/chunks/chunk-W4TLA5H3.js +0 -8
- package/dist/cli-bundle/chunks/item-transaction-YSAWJRA2.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-3LRSQXCN.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-FOA7XKWP.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-FPKVHC3Q.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-I7XBR2RM.js +0 -91
- package/dist/cli-bundle/focused-chunks/chunk-MJP3TFVW.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-PZSTRYTA.js +0 -102
- package/dist/cli-bundle/focused-chunks/chunk-QNJQPJWO.js +0 -44
- package/dist/cli-bundle/focused-chunks/chunk-SIPDQBJI.js +0 -8
- package/dist/cli-bundle/focused-chunks/chunk-SJE3PYPI.js +0 -3
- package/dist/cli-bundle/focused-chunks/chunk-TNKI6WKG.js +0 -66
- package/dist/cli-bundle/focused-chunks/chunk-TRCXANRR.js +0 -12
- package/dist/cli-bundle/focused-chunks/item-transaction-54VSTT6L.js +0 -2
- package/dist/sdk/agent/refusal-closure.js +0 -2
- package/dist/sdk/agent/refusal-reachability.js +0 -4
- package/dist/sdk/agent/task-transcript-contracts.js +0 -2
- package/dist/sdk/agent/tracker-preflight-contracts.js +0 -2
- package/dist/sdk/authoring.js +0 -2
- package/dist/sdk/compose.js +0 -2
- package/dist/sdk/contracts.js +0 -2
- package/dist/sdk/core-governance.js +0 -2
- package/dist/sdk/core.js +0 -2
- package/dist/sdk/corpus-shape.js +0 -2
- package/dist/sdk/define.js +0 -2
- package/dist/sdk/environment/agent-environment.js +0 -2
- package/dist/sdk/governance/artifact-ledgers.js +0 -2
- package/dist/sdk/governance/coverage-assurance.js +0 -2
- package/dist/sdk/governance/reliability.js +0 -2
- package/dist/sdk/governance.js +0 -2
- package/dist/sdk/graph/adapter.js +0 -2
- package/dist/sdk/graph/conformance.js +0 -2
- package/dist/sdk/graph/index.js +0 -2
- package/dist/sdk/graph.js +0 -2
- package/dist/sdk/index.js +0 -2
- package/dist/sdk/query.js +0 -2
- package/dist/sdk/relationship-migration.js +0 -2
- package/dist/sdk/testing.js +0 -8
- package/dist/sdk/workspace-recipe.js +0 -2
- package/docs/AGENT_PROVENANCE_ADR.md +0 -206
- package/docs/DEFECT_RECURRENCE.md +0 -257
- package/docs/MCP_2026_07_28_CONFORMANCE.md +0 -41
- package/docs/PERFORMANCE.md +0 -189
- package/docs/QUALITY_EVIDENCE.md +0 -130
- package/docs/generated/FLAG_LEXICON_BUDGETS.md +0 -117
- package/docs/performance/cli-transport-overhead.md +0 -51
- package/docs/performance/runner-qualification.md +0 -36
- package/docs/performance/sdk-entrypoint-import-costs.md +0 -32
package/docs/COMMANDS.md
CHANGED
|
@@ -188,7 +188,9 @@ pm list --status in_progress --assignee-filter unassigned --updated-before -72h
|
|
|
188
188
|
`pm health` prints these sweeps (with the configured status id and threshold)
|
|
189
189
|
as the remedies of its `in_progress_unowned`, `in_progress_idle` and
|
|
190
190
|
`stale_in_progress_items` advisories, and `pm context` counts
|
|
191
|
-
`in_progress_unowned` and `in_progress_idle` next to `in_progress`.
|
|
191
|
+
`in_progress_unowned` and `in_progress_idle` next to `in_progress`. All three
|
|
192
|
+
count items in the configured progress status, whatever role that status
|
|
193
|
+
carries, so neither advisory can exceed `in_progress` (GH-1756). The sweeps
|
|
192
194
|
select by `updated_at`, so they are candidate lists: an item restored within
|
|
193
195
|
the window keeps an older `updated_at` but recent history, and only
|
|
194
196
|
`--takeover-stale` applies the full activity clock.
|
|
@@ -1355,7 +1357,7 @@ Use dry-run modes before broad lifecycle or cleanup changes.
|
|
|
1355
1357
|
|
|
1356
1358
|
`pm gc --scope` accepts `index`, `embeddings`, `runtime`, `locks`, and `checkpoints`, comma-separated or repeated. Omitting the flag selects all scopes:
|
|
1357
1359
|
|
|
1358
|
-
- `runtime` clears `runtime/test-runs
|
|
1360
|
+
- `runtime` clears `runtime/test-runs/`, `runtime/history-drift-cache.json` and `runtime/history-stream-summary.json`. It never follows a link: a cache target that is one is retained with a `not_a_file` or `not_a_directory` warning, and when `runtime/` itself is a link, junction or file nothing under it is removed (`redirected_runtime_directory:runtime`). The next health check rescans history drift, and the next activity or context read parses every history stream once to rebuild the stream summary.
|
|
1359
1361
|
- `embeddings` removes keyword/semantic artifacts (`search/embeddings.jsonl`, `search/vectorization-status.json`, `search/lancedb/`) plus `search/pending-refresh.json` and its gate, preventing a background worker from rebuilding a partial index against an empty ledger. Rebuild with keyword reindex and semantic reindex when enabled.
|
|
1360
1362
|
- `locks` removes locks with an expired embedded `created_at + ttl_seconds` lease or positive same-host original-owner death evidence. It rechecks the observed receipt under the writer cleanup gate before deletion; replaced or initializing locks remain. Active, unreadable, or unparseable locks remain. The result reports `scanned`, `removed`, and `retained` counts.
|
|
1361
1363
|
|
|
@@ -1428,7 +1430,9 @@ pm telemetry local-analytics status
|
|
|
1428
1430
|
"remediation_map": { "locks_stale_count": "pm gc --scope locks" }
|
|
1429
1431
|
```
|
|
1430
1432
|
|
|
1431
|
-
|
|
1433
|
+
Each advised history remedy repairs the streams it names ([pm-3os5p6](https://github.com/unbraind/pm-cli/blob/main/.agents/pm/issues/pm-3os5p6.toon); tracker record excluded from npm). `pm health` previews the append-only repair for every chain mismatch. A break a bridge can repair keeps `history_drift_chain_mismatch` (`pm history-repair <id> --append-only`). A break only the rewriting repair can fix, such as a recorded patch that applies only on top of the unrecorded change, becomes `history_drift_chain_unbridgeable` (`pm history-repair <id>`). When the rewriting preview refuses too, for example because a sealed record no longer matches its seal, it becomes `history_drift_unrepairable_stream`, as does a missing stream whose history path is a symbolic link (`pm history <id> --verify --full`; restore the item's own stream from version control). `details.repair_refusals` lists each stream with the refusal `reason` and, for an unrepairable one, the `rewrite_refusal`. A missing stream is rebuilt by `pm history-repair <id>`, and an unreadable one is salvaged with `pm history-repair <id> --salvage-tail --dry-run` followed by the same command without `--dry-run`.
|
|
1434
|
+
|
|
1435
|
+
When more than one history stream is drifted, the repair remedies are rewritten to one bulk command. `pm history-repair --all --append-only` applies when every drifted stream is a bridgeable chain mismatch or a missing stream, so the bulk remedy never rewrites recorded entries. Otherwise the remaining repair remedies become `pm history-repair --all` and a bridgeable chain mismatch keeps its per-item `--append-only` remedy. Both bulk forms run on every drifted stream, so while a stream is unreadable, unrepairable, written by a newer pm, or attributed to a pending merge receipt, every remedy stays per item: the bulk run would fail that row or reconcile it without the merge audit. An unrepairable or version-skewed stream keeps only that verdict, without the hash- or chain-mismatch advice whose repair would refuse.
|
|
1432
1436
|
|
|
1433
1437
|
`remediation_map` appears in default and `--full` output and is omitted in `--brief`/`--summary` to stay token-efficient. Extension checks keep their existing richer `details.triage.remediation` instead.
|
|
1434
1438
|
|
|
@@ -1504,6 +1508,7 @@ pm history-compact --ids pm-a1b2,pm-c3d4 --dry-run
|
|
|
1504
1508
|
pm history-redact <id> --literal "[redacted_path_prefix]/private" --replacement "[redacted_path]"
|
|
1505
1509
|
pm history-redact <id> --regex "/192\\.168\\.[0-9.]+/g" --dry-run
|
|
1506
1510
|
pm history-repair <id> --dry-run
|
|
1511
|
+
pm history-repair <id> --append-only --dry-run
|
|
1507
1512
|
pm history-repair <id> --message "re-anchor legacy drift"
|
|
1508
1513
|
pm history-repair --all --dry-run
|
|
1509
1514
|
pm history-repair --all --message "bulk re-anchor drifted streams"
|
|
@@ -1538,6 +1543,58 @@ metadata changes may also require a restart. Continuation does not retain a
|
|
|
1538
1543
|
persisted or atomic cross-file snapshot. Use `--from` for a starting timestamp;
|
|
1539
1544
|
`--since` refusals suggest that correction. Use an envelope (for example `--json`
|
|
1540
1545
|
without `--stream`) when paging: stream mode emits rows without cursor metadata.
|
|
1546
|
+
|
|
1547
|
+
On a tracker with 500 or more history streams, activity reads and the
|
|
1548
|
+
`pm context` activity section are bounded by their window instead of the
|
|
1549
|
+
history archive (GH-1664). A derived, gitignored
|
|
1550
|
+
`runtime/history-stream-summary.json` records each stream's entry count and
|
|
1551
|
+
oldest/newest timestamps under the stat signature (device, inode, size, mtime,
|
|
1552
|
+
ctime and the reader's credentials: effective user, group and supplementary
|
|
1553
|
+
groups on POSIX, the account name on Windows) of the open file that supplied
|
|
1554
|
+
the bytes, with a checksum over the file. A read skips a stream only while that
|
|
1555
|
+
signature is unchanged and the stream had not changed within two seconds of the
|
|
1556
|
+
read that recorded it, so appends, redaction, compaction, repair and restore
|
|
1557
|
+
all invalidate it without cooperation, and other POSIX credentials never reuse
|
|
1558
|
+
bounds for a stream they may not be allowed to read. Like the metadata cache,
|
|
1559
|
+
the summary trusts the filesystem's stat results: on Windows, processes of one
|
|
1560
|
+
account share it whatever their token, and a network mount that caches
|
|
1561
|
+
attributes can delay invalidation until its cache expires. Rows, totals, cursors and errors equal those of a complete read.
|
|
1562
|
+
A stream the window reaches is still parsed in full, so a read costs the size
|
|
1563
|
+
of the streams with entries in its window, not the size of the archive. Before
|
|
1564
|
+
it finishes, a bounded read re-stats the streams it skipped on their bounds and
|
|
1565
|
+
reads any that changed, a best-effort per-stream recheck. Like a complete read,
|
|
1566
|
+
it is not an atomic snapshot: a write that lands in a stream after that stream
|
|
1567
|
+
was read or rechecked is not reflected. The
|
|
1568
|
+
context activity section takes the newest rows directly and returns no
|
|
1569
|
+
cursor. When a read could not be bounded it adds `history_read` (context:
|
|
1570
|
+
`activity_history_read`) with `reason` (`summary_missing`, `summary_invalid`,
|
|
1571
|
+
`summary_stale` or `irregular_timestamps`, named by the larger cause, when
|
|
1572
|
+
streams lack usable regular bounds because they changed or hold timestamps that
|
|
1573
|
+
are not canonical millisecond UTC: more than half of all streams as the read
|
|
1574
|
+
opens, or, when the read parsed most streams, more than half of those it
|
|
1575
|
+
parsed; `read_hooks_active` when read hooks were active as the read opened or
|
|
1576
|
+
became active while it ran, which ends pruning (a hook active at open keeps the
|
|
1577
|
+
complete read in file order; one registered mid-read observes every stream the
|
|
1578
|
+
read has not yet read, exactly once, but a side effect it has on a stream the
|
|
1579
|
+
reordered read already parsed is not reflected); `unwindowed_query` when a
|
|
1580
|
+
read with no `--from` bound parsed most streams, or `window_reaches_most_streams`
|
|
1581
|
+
when current bounds still left most streams inside the window), `streams_read`
|
|
1582
|
+
(streams parsed; one removed after the listing is not counted) and
|
|
1583
|
+
`streams_total`; `--stream` carries it on the `meta` record, markdown context
|
|
1584
|
+
adds a `history read:` line, and NDJSON context, whose stdout carries focus rows
|
|
1585
|
+
only, writes `[pm] warning: activity_history_read reason=<reason>
|
|
1586
|
+
streams_read=<read>/<total>` to stderr. Bounded reads add nothing. On POSIX the summary file is written owner-only (mode 0600) and is
|
|
1587
|
+
trusted only when the reading user owns it and no one else can write it; on
|
|
1588
|
+
Windows it inherits the runtime directory's ACL. A summary in a redirected
|
|
1589
|
+
`runtime/` (symbolic link or junction), or any entry at the summary path that
|
|
1590
|
+
is not a regular file (a link, directory, FIFO or socket), is never read,
|
|
1591
|
+
written or replaced, and the read then computes no bounds at all; an oversized
|
|
1592
|
+
summary is never read. Like the context-usage ledger, the
|
|
1593
|
+
checks reject existing redirections and require trusted, stable workspace
|
|
1594
|
+
directories: portable Node APIs cannot pin `runtime/` against an actor that
|
|
1595
|
+
replaces it concurrently.
|
|
1596
|
+
Extensions with read hooks keep the complete read, so every stream read is
|
|
1597
|
+
still observed.
|
|
1541
1598
|
Workspace-scoped mutations to settings, schema, profiles, init state, and
|
|
1542
1599
|
extension/package activation are recorded in
|
|
1543
1600
|
`.agents/pm/history/_workspace.jsonl` using the same patch/hash format.
|
|
@@ -1582,7 +1639,8 @@ still match only at the current position. Omit `y` to search later positions. Tr
|
|
|
1582
1639
|
(repository-only tracker record, excluded from npm).
|
|
1583
1640
|
`history-compact` rewrites long streams into a synthetic checkpoint baseline plus a retained tail (`--before` accepts a 1-based version or ISO timestamp), re-anchors hashes, verifies integrity, and appends an auditable `history_compact` marker when applied.
|
|
1584
1641
|
`history-compact` bulk mode (mutually exclusive with a positional `<id>`) compacts many streams in one audited pass. Select with `--ids <a,b,c>` (an explicit list — used on its own, not combined with the scan selectors below), or a scan: `--all-over <N>` (every stream with more than N entries) and/or a lifecycle filter `--closed` (terminal items only) or `--all-streams` (every stream). `--closed` and `--all-streams` are mutually exclusive. `--min-entries <N>` (default 3) skips already-compact streams; when `history.compact_policy` is enabled and `--all-over` is omitted, the policy's `max_entries` becomes the default threshold. `--before` is single-id only and is rejected in bulk mode. Each selected stream runs the same single-item compaction; one failing stream never aborts the rest — the result reports `totals` (`streams_considered`/`selected`/`items_compacted`/`items_skipped`/`items_errored`) plus one row per stream (`compacted`/`skipped` with a `skip_reason`/`errored`), and the command exits non-zero only if any stream errored.
|
|
1585
|
-
`history-repair` re-anchors a drifted history chain when `pm health`/`pm validate --check-history-drift` report stale hashes: it replays the stream, recomputes every before/after hash using the stream's detected hash epoch, repairs legacy patch ops that no longer strictly apply, reconciles the latest hash with the on-disk item, and appends an auditable `history_repair` marker. It never modifies item content and is a safe no-op on a clean stream. The result reports the before/after hash versions and whether the epoch was preserved or selected for an ambiguous broken stream, preventing old/new runtimes from alternately rewriting an otherwise consistent legacy chain.
|
|
1642
|
+
`history-repair` re-anchors a drifted history chain when `pm health`/`pm validate --check-history-drift` report stale hashes: it replays the stream, recomputes every before/after hash using the stream's detected hash epoch, repairs legacy patch ops that no longer strictly apply, reconciles the latest hash with the on-disk item, and appends an auditable `history_repair` marker. It never modifies item content and is a safe no-op on a clean stream. A live item whose stream is absent or holds no record, which `pm health` reports as `history_drift_missing_stream`, gets one sealed `history_repair` baseline from the empty document to the on-disk item, in both repair modes, after any whitespace the stream held. Its `context.history_reseed` and the result's `reseed` receipt record `reason` (`missing_stream` or `empty_stream`) and `prior_versions: "unrecorded"`: version 1 is the item as of the repair. A deleted item's empty stream and the audited merge-reconciliation modes keep refusing. A record whose seal no longer matches its content refuses with `history_record_integrity_invalid`, exit 4, because no repair can tell which part to keep. The result reports the before/after hash versions and whether the epoch was preserved or selected for an ambiguous broken stream, preventing old/new runtimes from alternately rewriting an otherwise consistent legacy chain.
|
|
1643
|
+
`history-repair --append-only` never rewrites a recorded entry, so the stream before the repair stays a byte prefix of the repaired stream. When the chain breaks, it appends one sealed `history_repair` record whose `bridge` names every break (by `gap_from`, `gap_to` and the break entry's `record_hash`) and whose patch reconciles replay with the on-disk item. When the chain verifies and only the item drifted, it appends a reconciliation record without a bridge. Verification accepts a break only when the next bridge names it, and `pm health` names this form as the remedy for `history_drift_chain_mismatch`. It refuses with `history_append_only_repair_unavailable` (and a `reason`) when a break cannot be bridged, for example when a recorded patch only applies on top of the unrecorded change, and it cannot be combined with `--salvage-tail` or `--normalize-provenance`. See [History durability and recovery](HISTORY_RECOVERY.md#bridge-a-broken-chain-without-rewriting-it).
|
|
1586
1644
|
`history-repair --all` (mutually exclusive with `<id>`) runs the same drift scan `pm health` uses and applies the audited single-stream repair (ownership check, lock, post-repair no-drift verification, `--message` audit marker, per-stream `--force`) to every drifted stream in one pass. One failing stream never aborts the rest: the result lists one compact row per targeted stream (`repaired` / `skipped_clean` / `failed`) plus `totals`, and the command exits non-zero only if any stream failed. Add `--normalize-provenance` to include streams containing invalid boolean or single-digit provenance observations. The normalizer removes only those invalid observations and writes aggregate harness/dimension/kind counts in the audit receipt; it never echoes or retains the removed value.
|
|
1587
1645
|
|
|
1588
1646
|
Every `pm health` projection exposes `findings` and `failed_because`. A finding binds one warning token to its owning check, stable code, `advisory|gate_failing` severity, and either an executable remediation or `no_safe_automatic_remediation`. Extension health also publishes `host_version_census`, which enumerates the host and every pm-cli copy resolved by loaded extensions across npm/pnpm layouts. A version mismatch makes the extension check non-clean; matching workspace-linked or deduplicated copies remain healthy.
|
package/docs/HISTORY_RECOVERY.md
CHANGED
|
@@ -4,8 +4,12 @@ Tracked by [pm-96fsma](../.agents/pm/issues/pm-96fsma.toon),
|
|
|
4
4
|
[pm-m0yjtg](../.agents/pm/issues/pm-m0yjtg.toon),
|
|
5
5
|
[pm-qw1uw6](../.agents/pm/issues/pm-qw1uw6.toon),
|
|
6
6
|
[pm-e3gn0z](../.agents/pm/issues/pm-e3gn0z.toon),
|
|
7
|
-
[pm-wlqxg3](../.agents/pm/tasks/pm-wlqxg3.toon),
|
|
8
|
-
[pm-nb4zwz](../.agents/pm/issues/pm-nb4zwz.toon)
|
|
7
|
+
[pm-wlqxg3](../.agents/pm/tasks/pm-wlqxg3.toon),
|
|
8
|
+
[pm-nb4zwz](../.agents/pm/issues/pm-nb4zwz.toon),
|
|
9
|
+
[pm-jbplbq](../.agents/pm/issues/pm-jbplbq.toon),
|
|
10
|
+
[pm-gh1715](../.agents/pm/issues/pm-gh1715.toon),
|
|
11
|
+
[pm-3os5p6](../.agents/pm/issues/pm-3os5p6.toon), and
|
|
12
|
+
[pm-rpucvb](../.agents/pm/issues/pm-rpucvb.toon).
|
|
9
13
|
|
|
10
14
|
Project management depends on trustworthy context. History is not just an
|
|
11
15
|
activity feed: it is the reconstructable source for prior item states, including
|
|
@@ -76,9 +80,31 @@ pm history-repair <id> --salvage-tail --json
|
|
|
76
80
|
pm history <id> --verify --strict-exit
|
|
77
81
|
```
|
|
78
82
|
|
|
79
|
-
Salvage
|
|
80
|
-
|
|
81
|
-
|
|
83
|
+
Salvage retains every record byte unchanged. Discarding an invalid suffix
|
|
84
|
+
requires a nonempty, hash-verified prefix, because truncation must not cut a
|
|
85
|
+
chain whose damage it cannot see. It also removes lines whose JSON value is a
|
|
86
|
+
null, a boolean or a number wherever they sit, because such a value cannot hold
|
|
87
|
+
a record. Removing only such lines conceals nothing, so it does not require the
|
|
88
|
+
chain to verify: a stream with both a scalar line and a chain break is salvaged
|
|
89
|
+
first, the result reports `verify_ok: false` with the `verify_errors`, and its
|
|
90
|
+
`history_chain_unverified` warning names the append-only repair preview, with
|
|
91
|
+
the rewriting preview for a break a bridge cannot repair. `pm history-repair
|
|
92
|
+
<id> --append-only` then bridges the break. A stream of only scalar lines is
|
|
93
|
+
salvaged to an empty stream without a salvage record, because no record is
|
|
94
|
+
left to anchor one on. For a live item, the result's `history_stream_empty`
|
|
95
|
+
warning names `pm history-repair <id>`, which rebuilds the stream (see below).
|
|
96
|
+
With nothing to discard, salvage refuses and names the repair the chain needs.
|
|
97
|
+
Salvage checks the item identity at every replayed state, so a stream that
|
|
98
|
+
names another item anywhere refuses, even when a later delete cleared the id.
|
|
99
|
+
The salvage record is planned before the lock, so a preview refuses wherever
|
|
100
|
+
the write would, for example on a digest algorithm this pm cannot compute. A
|
|
101
|
+
broken stream that declares no hash epoch keeps its salvage record implicit. A string,
|
|
102
|
+
an array or a complete malformed object might encode one, so salvage refuses
|
|
103
|
+
those. A truncated object at the tail, such as `{"ts":`, is part of the invalid
|
|
104
|
+
suffix after the verified prefix and is discarded with it.
|
|
105
|
+
The receipt records the first discarded physical line, discarded UTF-8 byte
|
|
106
|
+
count, SHA-256 of the discarded bytes in file order, retained record count, and
|
|
107
|
+
`non_record_lines` when scalar lines were removed. An appended `history_salvage`
|
|
82
108
|
event records that receipt without copying potentially private damaged contents.
|
|
83
109
|
Salvage does not rehash prior entries, reconcile item state, or normalize
|
|
84
110
|
provenance. It refuses bulk selection, conflicting repair modes, merge conflict
|
|
@@ -87,6 +113,14 @@ with attached corruption. Recover those cases from version control or a backup.
|
|
|
87
113
|
Non-UTF-8 streams are also refused, so receipt hashes and rollback snapshots
|
|
88
114
|
always describe the original bytes rather than a lossy decoded approximation.
|
|
89
115
|
|
|
116
|
+
Every reader that goes through the shared history decoder refuses a history
|
|
117
|
+
line that is valid JSON but not an object with `history_record_invalid`. The
|
|
118
|
+
merge driver parses its inputs itself and reports such a line as invalid JSON
|
|
119
|
+
at that line. The error names the item (`item_id`), the value kind
|
|
120
|
+
(`reason`, for example `a JSON null`) and the physical line (`details.line`), and
|
|
121
|
+
its next step is the salvage preview above. Readers never report such a line as
|
|
122
|
+
`unknown_error`. `pm health` keeps reporting the stream under `unreadable_streams`.
|
|
123
|
+
|
|
90
124
|
The public SDK uses the same operation:
|
|
91
125
|
|
|
92
126
|
```ts
|
|
@@ -103,6 +137,196 @@ console.log(preview.salvage);
|
|
|
103
137
|
The CLI and MCP expose this SDK-owned contract; package authors do not need a
|
|
104
138
|
separate recovery implementation.
|
|
105
139
|
|
|
140
|
+
## Rebuild a missing history stream
|
|
141
|
+
|
|
142
|
+
A live item whose history stream is absent, or holds no record (the default
|
|
143
|
+
`history.missing_stream: auto_create` policy recreates a deleted stream as an
|
|
144
|
+
empty file on read), is reported by `pm health` as
|
|
145
|
+
`history_drift_missing_stream`. When the stream was deleted by mistake, restore
|
|
146
|
+
it from version control first. Otherwise rebuild it:
|
|
147
|
+
|
|
148
|
+
```bash
|
|
149
|
+
pm history-repair <id> --dry-run --json
|
|
150
|
+
pm history-repair <id> --json
|
|
151
|
+
pm health --strict-exit
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
The repair writes one sealed `history_repair` record from the empty document
|
|
155
|
+
to the on-disk item, after any whitespace the stream held, so it keeps every
|
|
156
|
+
existing byte in either repair mode. An existing empty stream gets the record
|
|
157
|
+
through `O_APPEND`, on the exact bytes the repair verified. An absent stream is
|
|
158
|
+
published complete: the record is staged and flushed beside it, then
|
|
159
|
+
hard-linked into the absent path, so no partial or empty stream is ever
|
|
160
|
+
visible. A stream that another writer created or extended meanwhile refuses
|
|
161
|
+
with `stream_changed`. A filesystem whose link call fails with `EPERM`,
|
|
162
|
+
`ENOTSUP`, `EOPNOTSUPP` or `ENOSYS` refuses with `stream_publish_unsupported`;
|
|
163
|
+
any other link failure (for example `EISDIR`, which Windows exFAT reports;
|
|
164
|
+
[pm-ue6pqv](https://github.com/unbraind/pm-cli/blob/main/.agents/pm/issues/pm-ue6pqv.toon),
|
|
165
|
+
tracker record excluded from npm) surfaces as that error. On a local
|
|
166
|
+
filesystem nothing is published either way. A network filesystem can publish
|
|
167
|
+
the link and lose the reply, so before restoring or retrying, check whether the
|
|
168
|
+
item's stream file exists as a regular file, without running a pm command on
|
|
169
|
+
the item first: under the default `auto_create` policy a pm read recreates an
|
|
170
|
+
absent stream as an empty file. If it exists, verify it with `pm history <id>
|
|
171
|
+
--verify --full`. Restore the stream from version control, or repair from a
|
|
172
|
+
clone on a filesystem with hard links, only when nothing valid was published. A
|
|
173
|
+
history path that is a symbolic link refuses with `stream_not_regular_file`,
|
|
174
|
+
both in the preview and in the write, and `pm health` reports it as
|
|
175
|
+
`history_drift_unrepairable_stream` instead of advising the rebuild. `context.history_reseed` and the result's
|
|
176
|
+
`reseed` receipt record why (`missing_stream` or `empty_stream`) and
|
|
177
|
+
`prior_versions: "unrecorded"`: version 1 is the item as of the repair, and
|
|
178
|
+
earlier versions cannot be read or restored. The record is maintenance, so it
|
|
179
|
+
does not count as work on the item. `pm history-repair --all`, with or without
|
|
180
|
+
`--append-only`, rebuilds every missing stream in one pass. A deleted item's
|
|
181
|
+
empty stream has nothing to anchor on and keeps refusing, as do the audited
|
|
182
|
+
merge-reconciliation modes, which prove their evidence against recorded
|
|
183
|
+
history.
|
|
184
|
+
|
|
185
|
+
## Bridge a broken chain without rewriting it
|
|
186
|
+
|
|
187
|
+
A change made outside pm, such as a hand edit or a merge resolution that
|
|
188
|
+
bypassed the driver, breaks the item's history chain. `pm health` previews
|
|
189
|
+
the append-only repair for every broken chain and reports
|
|
190
|
+
`history_drift_chain_mismatch` when a bridge can repair it. A break only the
|
|
191
|
+
rewriting repair can fix (`pm history-repair <id>`), such as a recorded patch
|
|
192
|
+
that applies only on top of the unrecorded change, is reported as
|
|
193
|
+
`history_drift_chain_unbridgeable`. A stream neither repair can keep, such as
|
|
194
|
+
one whose sealed record no longer matches its seal, is reported as
|
|
195
|
+
`history_drift_unrepairable_stream`. Restore that one from version control:
|
|
196
|
+
the rewriting repair refuses it with `history_record_integrity_invalid`. Such a
|
|
197
|
+
stream, and one a newer pm wrote (`history_drift_version_skew`, including a
|
|
198
|
+
record seal format this pm cannot read, which refuses with
|
|
199
|
+
`history_record_version_unsupported`), keeps only that verdict: its chain- and
|
|
200
|
+
hash-mismatch warnings would advise a repair that refuses, so health drops
|
|
201
|
+
them from the advice while `details` keeps the evidence.
|
|
202
|
+
Repair a bridgeable break append-only:
|
|
203
|
+
|
|
204
|
+
```bash
|
|
205
|
+
pm history-repair <id> --append-only --dry-run --json
|
|
206
|
+
pm history-repair <id> --append-only --json
|
|
207
|
+
pm health --strict-exit
|
|
208
|
+
```
|
|
209
|
+
|
|
210
|
+
The repair appends one sealed `history_repair` record carrying a `bridge`. The
|
|
211
|
+
bridge names each break by the `after_hash` before it (`gap_from`), the
|
|
212
|
+
`before_hash` after it (`gap_to`) and that entry's `record_hash`. Its
|
|
213
|
+
`segment_digest` commits to every record from the first break up to the bridge,
|
|
214
|
+
so no record it covers can change under it, sealed or not. Its patch
|
|
215
|
+
reconciles replay with the on-disk item. Its anchors keep the hash epoch the
|
|
216
|
+
stream already uses:
|
|
217
|
+
|
|
218
|
+
- If any record declares an epoch, the newest declared epoch.
|
|
219
|
+
- For an implicit stream, the epoch the verified records prove, unless the
|
|
220
|
+
last record's own anchor proves another epoch. Then the newest epoch it
|
|
221
|
+
proves wins.
|
|
222
|
+
- The epoch-2 variant that replay or the on-disk item proves.
|
|
223
|
+
|
|
224
|
+
The repair refuses with `hash_surface_ambiguous` when nothing proves the epoch
|
|
225
|
+
or the variant. The record is appended with `O_APPEND` to the exact bytes the
|
|
226
|
+
repair verified. If another writer that ignores pm's lock appends in the same
|
|
227
|
+
moment, its bytes are kept and the repair reports `stream_changed`. Every earlier line stays
|
|
228
|
+
byte-identical, so the stream before the repair remains a prefix of the
|
|
229
|
+
repaired stream. Other clones, worktrees and append-only consumers keep the
|
|
230
|
+
bytes they already hold. `--all --append-only` attempts every drifted stream:
|
|
231
|
+
it bridges each bridgeable break, rebuilds each missing stream, and refuses a
|
|
232
|
+
stream a bridge cannot repair with a typed reason. When several streams drift
|
|
233
|
+
and every one is a bridgeable chain mismatch or a missing stream, `pm health`
|
|
234
|
+
names it as the bulk remedy. With other drift present a bridgeable mismatch
|
|
235
|
+
keeps its per-item `--append-only` remedy, and while any stream is unreadable,
|
|
236
|
+
unrepairable, written by a newer pm or attributed to a pending merge receipt,
|
|
237
|
+
every remedy stays per item.
|
|
238
|
+
|
|
239
|
+
Verification accepts a break exactly when the next bridge names it. Inside the
|
|
240
|
+
bridged segment it checks the recorded links, and each further break must be
|
|
241
|
+
the next one the bridge names. Wherever replay proves an entry's recorded
|
|
242
|
+
before-state, for example after a later change overwrote the edited field, that
|
|
243
|
+
entry's recorded effect must match too. Every record from the break to the
|
|
244
|
+
bridge must be complete, with item anchors that are well-formed digests of its
|
|
245
|
+
algorithm (`record_incomplete`). A declared epoch inside the segment governs the
|
|
246
|
+
records after it, and the bridge must keep the epoch the stream declared
|
|
247
|
+
(`bridge_epoch_mismatch`). The bridge must name no break that did
|
|
248
|
+
not occur, must match its `segment_digest`, and must re-anchor replay on its
|
|
249
|
+
own `after_hash`. A forged, unsealed or partial bridge is drift
|
|
250
|
+
(`bridge_invalid`, `bridge_unnamed_break`, `bridge_names_absent_break`,
|
|
251
|
+
`bridge_link_mismatch`, `bridge_segment_mismatch` or
|
|
252
|
+
`bridge_after_hash_mismatch`).
|
|
253
|
+
|
|
254
|
+
A later rewriting repair keeps a verified bridged segment's records unchanged.
|
|
255
|
+
Like every rewriting repair, it re-serializes the file, so it normalizes line
|
|
256
|
+
endings and spacing; only `--append-only` keeps the existing bytes.
|
|
257
|
+
Three rewrites must dissolve the bridge into an ordinary re-anchored record:
|
|
258
|
+
|
|
259
|
+
- a rewrite that changes an entry before the segment
|
|
260
|
+
- a merge union, which rebases every patch
|
|
261
|
+
- `history-redact`, which recomputes every state anchor
|
|
262
|
+
|
|
263
|
+
Each keeps the original bridge as rewrite evidence. It also marks every entry
|
|
264
|
+
the segment covered with a sealed `replay_inexact`, because those states were
|
|
265
|
+
re-anchored without the unrecorded change. Each rewrite locates a bridge's segment from the bridge's own commitments. The
|
|
266
|
+
segment digest proves the segment from a start that the first break's record
|
|
267
|
+
hash or recorded anchors name, so a rewrite that repairs a record before the
|
|
268
|
+
segment still marks it. When no intact commitment proves the segment, the
|
|
269
|
+
rewrite marks every record since the previous bridge, and the bridge record
|
|
270
|
+
itself. That over-restricts but never serves a version as exact. `history-redact` refuses a stream whose
|
|
271
|
+
bridge does not locate its segment (`history_redact_bridge_unlocated`) instead
|
|
272
|
+
of dropping that bridge's evidence. The markers are written before anything can
|
|
273
|
+
void the bridge:
|
|
274
|
+
|
|
275
|
+
- Provenance normalization writes them before it reseals a covered record.
|
|
276
|
+
- A merge union writes them on the records a bridge covers on either original
|
|
277
|
+
branch, before it interleaves the branches. It also marks every event the
|
|
278
|
+
merged order places between such a segment's first record and its bridge.
|
|
279
|
+
Every merge, including identical and fast-forward results, keeps a marker
|
|
280
|
+
either branch already carries, except on records a retained live bridge
|
|
281
|
+
covers.
|
|
282
|
+
- A compaction checkpoint taken at an inexact version keeps the marker. When two clones bridged the same
|
|
283
|
+
break independently, the merge driver keeps ours byte-for-byte unless a marker
|
|
284
|
+
theirs carries must be propagated onto one of ours' records, in which case the
|
|
285
|
+
changed stream is written. It appends the other bridge as a neutral record with
|
|
286
|
+
an empty patch (`equivalent_bridges`), so both repairs' provenance survives. It
|
|
287
|
+
does this only when both sides and the result verify.
|
|
288
|
+
|
|
289
|
+
Versions between a break and its bridge cannot be reconstructed exactly,
|
|
290
|
+
because the unrecorded change is missing from replay. `pm restore` and
|
|
291
|
+
`pm get --at` refuse them with `history_version_unreconstructable`, both before
|
|
292
|
+
and after a dissolution. Versions before the break and from the bridge onward
|
|
293
|
+
remain addressable. While the bridge is live, `pm history-compact` cannot
|
|
294
|
+
checkpoint such a version either. It refuses with
|
|
295
|
+
`history_compact_boundary_bridged` and names the
|
|
296
|
+
nearest durable `--before` versions before the break and from the bridge
|
|
297
|
+
onward, or timestamps when a legacy checkpoint has no trustworthy offset. After
|
|
298
|
+
a rewrite has dissolved the bridge, a checkpoint at a marked version is allowed
|
|
299
|
+
and inherits the marker, so reads and restores keep refusing it.
|
|
300
|
+
|
|
301
|
+
Clones that repaired the same break independently and then kept working
|
|
302
|
+
diverge in a run of the same repair, live or neutral and in either order,
|
|
303
|
+
followed by ordinary records. The merge driver first turns both runs into one
|
|
304
|
+
shared run: ours, plus neutral copies of theirs' repairs ours lacks. It then
|
|
305
|
+
orders only the later records, so reciprocal merges merge again without
|
|
306
|
+
contradictory orders. It does this only when no repair of the runs recurs
|
|
307
|
+
later and both rewritten sides still verify; otherwise the streams merge as
|
|
308
|
+
recorded. Its receipt keeps the original coordinates: the shared prefix of
|
|
309
|
+
the two inputs, and theirs' neutral copies count as theirs.
|
|
310
|
+
|
|
311
|
+
The repair refuses with `history_append_only_repair_unavailable` and names the
|
|
312
|
+
rewriting repair as the fallback when a bridge cannot carry the drift:
|
|
313
|
+
|
|
314
|
+
| `reason` | Meaning |
|
|
315
|
+
|---|---|
|
|
316
|
+
| `chain_failure_not_a_break` | The stream fails for another reason, such as a broken record envelope. |
|
|
317
|
+
| `patch_does_not_replay` | A recorded patch only applies on top of the unrecorded change. |
|
|
318
|
+
| `item_missing` | No on-disk item exists to anchor the bridge. |
|
|
319
|
+
| `stream_not_utf8` | The stream bytes cannot be kept exactly. |
|
|
320
|
+
| `stream_changed` | The stream changed or was replaced after the repair verified it. The record may already be in the stream, so run `pm health` and inspect the stream before retrying. |
|
|
321
|
+
| `hash_surface_ambiguous` | Neither replay nor the on-disk item proves the tail's epoch-2 variant. |
|
|
322
|
+
| `bridge_does_not_verify` | The extended stream would not verify. |
|
|
323
|
+
|
|
324
|
+
A preview reports the recorded effects the reconciliation overwrites
|
|
325
|
+
(`reconciliation`, with the `history_repair_reconcile_discards_events` warning),
|
|
326
|
+
as the rewriting repair does. `pm history-repair <id>` without `--append-only`
|
|
327
|
+
still re-anchors every recorded entry after the break, for single-writer
|
|
328
|
+
trackers that want a continuous chain.
|
|
329
|
+
|
|
106
330
|
## Permanent item identities
|
|
107
331
|
|
|
108
332
|
Reading a deleted ID returns `item_deleted`, distinct from an unknown ID.
|
package/docs/MERGE_SAFETY.md
CHANGED
|
@@ -109,6 +109,14 @@ Removing a sibling worktree does not remove a separately installed main driver.
|
|
|
109
109
|
Use `pm merge install` in the affected worktree to repair stale, missing, or
|
|
110
110
|
incompatible commands. A dry run changes neither configuration nor attributes.
|
|
111
111
|
|
|
112
|
+
Attribute evidence stops at the active worktree's top level
|
|
113
|
+
([pm-gh1759](../.agents/pm/issues/pm-gh1759.toon)). Git never reads a
|
|
114
|
+
`.gitattributes` above it, so a matching fence in an enclosing, different
|
|
115
|
+
repository never satisfies `pm health`, `pm validate` or the workspace
|
|
116
|
+
position read: a linked worktree without its own fence reports
|
|
117
|
+
`merge_fence_missing`. A fence at the worktree root, or in a directory between
|
|
118
|
+
that root and the tracker, still counts.
|
|
119
|
+
|
|
112
120
|
### Fence coverage contract
|
|
113
121
|
|
|
114
122
|
Extension assets are tracked by [pm-gh1460](../.agents/pm/issues/pm-gh1460.toon).
|
|
@@ -104,7 +104,9 @@ time: it can include an item whose history is newer than its `updated_at`
|
|
|
104
104
|
(for example after a restore), which the advisory does not count;
|
|
105
105
|
`pm claim <id> --takeover-stale` re-judges each one under the item lock. `pm context` reports `in_progress_unowned`
|
|
106
106
|
and `in_progress_idle` next to `in_progress` in its summary when they are
|
|
107
|
-
non-zero, so unattended work is not read as active work.
|
|
107
|
+
non-zero, so unattended work is not read as active work. `in_progress` counts
|
|
108
|
+
the same population as both advisories: every item in the configured progress
|
|
109
|
+
status, whatever role that status carries (GH-1756).
|
|
108
110
|
|
|
109
111
|
A blocking secret policy may be bypassed only by an explicit `--force` on a
|
|
110
112
|
force-capable mutation. The warning records that an override occurred while
|
package/docs/README.md
CHANGED
|
@@ -22,7 +22,7 @@ pm guide release --json
|
|
|
22
22
|
| New user | [Quickstart](QUICKSTART.md) | [Command Reference](COMMANDS.md) |
|
|
23
23
|
| New maintainer | [Onboarding](ONBOARDING.md) | [Agent Guide](AGENT_GUIDE.md), [Testing](TESTING.md), [Releasing](https://github.com/unbraind/pm-cli/blob/main/docs/RELEASING.md) (repository-only, excluded from npm) |
|
|
24
24
|
| Coding agent | [Agent Guide](AGENT_GUIDE.md) | [Configuration](CONFIGURATION.md), then command help |
|
|
25
|
-
| Maintainer | [Contributing](../CONTRIBUTING.md) | [Testing](TESTING.md), [Releasing](https://github.com/unbraind/pm-cli/blob/main/docs/RELEASING.md) (repository-only, excluded from npm), [Architecture](ARCHITECTURE.md) |
|
|
25
|
+
| Maintainer | [Contributing](../CONTRIBUTING.md) | [Testing](TESTING.md), [Repository Testing](https://github.com/unbraind/pm-cli/blob/main/docs/REPOSITORY_TESTING.md) (repository-only, excluded from npm), [Releasing](https://github.com/unbraind/pm-cli/blob/main/docs/RELEASING.md) (repository-only, excluded from npm), [Architecture](ARCHITECTURE.md) |
|
|
26
26
|
| Package author | [Packages and Extensions](EXTENSIONS.md) | [SDK](SDK.md), [starter extension](examples/starter-extension/README.md) |
|
|
27
27
|
| Codex or ChatGPT plugin implementer | [Codex Plugin](CODEX_PLUGIN.md) | [Native ChatGPT and Codex Plugin Implementation Plan](https://github.com/unbraind/pm-cli/blob/main/docs/CHATGPT_CODEX_PLUGIN_IMPLEMENTATION.md) (repository-only, excluded from npm) |
|
|
28
28
|
| Codex user | [Codex Plugin](CODEX_PLUGIN.md) | [Agent Guide](AGENT_GUIDE.md), then [Command Reference](COMMANDS.md) |
|
|
@@ -43,7 +43,8 @@ pm guide release --json
|
|
|
43
43
|
- [CLI Scripting Contract](SCRIPTING.md) - exit codes, flat mutation receipts versus read envelopes, stdout/stderr boundaries, stable JSON fields, uniform OR filters, and shell composition recipes.
|
|
44
44
|
- [Configuration](CONFIGURATION.md) - settings, storage formats, output, search, validation, and environment variables.
|
|
45
45
|
- [Semantic Batching and Retrieval Quality](SEARCH_QUALITY.md) - independent request bounds, execution receipts, and per-query quality floors.
|
|
46
|
-
- [Testing](TESTING.md) - sandbox-safe
|
|
46
|
+
- [Testing](TESTING.md) - sandbox-safe linked-test orchestration.
|
|
47
|
+
- [Repository Testing](https://github.com/unbraind/pm-cli/blob/main/docs/REPOSITORY_TESTING.md) - this repository's own local checks, CI layout, coverage governance and release gates (repository-only, excluded from npm).
|
|
47
48
|
- [Faithful Package Acceptance](PACKAGE_GATE_ACCEPTANCE.md) - self-isolating package gates, independent Git snapshots, native diagnostics and isolated timing admission.
|
|
48
49
|
- [Completion Portability and Bounded Replication Checks](VALIDATION_PORTABILITY.md) - literal Bash choices across versions and locales, and semantic Git diff collection.
|
|
49
50
|
- [Build and Release Acceptance](BUILD_AND_RELEASE_ACCEPTANCE.md) - complete-build leases and cross-platform registry installation controls.
|
|
@@ -56,7 +57,7 @@ pm guide release --json
|
|
|
56
57
|
- [SDK Action and Boundary Conformance](SDK_ACTION_CONFORMANCE.md) - derived CLI/SDK/MCP action vocabulary, public-import ratchets, intent budget diagnostics, and package-runner proof.
|
|
57
58
|
- [MCP 2026-07-28 Protocol Decision](MCP_2026_07_28.md) - stateless request metadata, discovery, result envelopes, explicit legacy boundary, and migration policy.
|
|
58
59
|
- [Progressive Tool Discovery](PROGRESSIVE_TOOL_DISCOVERY.md) - opt-in bounded MCP catalogs, public SDK ranking and pagination, canonical results, and compatibility isolation.
|
|
59
|
-
- [MCP 2026-07-28 Conformance Matrix](MCP_2026_07_28_CONFORMANCE.md) - official revision changes mapped to canonical owners and executable evidence.
|
|
60
|
+
- [MCP 2026-07-28 Conformance Matrix](https://github.com/unbraind/pm-cli/blob/main/docs/MCP_2026_07_28_CONFORMANCE.md) - official revision changes mapped to canonical owners and executable evidence (repository-only, excluded from npm).
|
|
60
61
|
- [MCP Interaction and Task SDK](SDK_MCP_INTERACTIONS.md) - public MRTR continuation, cache/schema validation, and durable task-store contracts.
|
|
61
62
|
- [MCP Skills and Apps](MCP_SKILLS_AND_APPS.md) - negotiated draft workflow discovery, stable interactive views, digests, provenance, accessibility, and trust boundaries.
|
|
62
63
|
- [MCP Remote Transport, Authorization, and Migration](MCP_REMOTE_TRANSPORT_SECURITY.md) - Streamable HTTP operation, subscriptions, OAuth and trace boundaries, threat model, and deprecated-feature ratchet.
|
|
@@ -76,16 +77,17 @@ pm guide release --json
|
|
|
76
77
|
- [History Algorithms and Detached Attestations](HISTORY_ATTESTATION.md) - named record digests, portable exact-byte proofs, and read-only verification.
|
|
77
78
|
- [History-derived Governance Repair](HISTORY_GOVERNANCE_REPAIR.md) - verified closure timestamps and typed issue-code lineage.
|
|
78
79
|
- [History Maintenance and Recovery](HISTORY_MAINTENANCE.md) - native history commands, permanent aliases, shared SDK transforms, and transactional recovery.
|
|
80
|
+
- [History Durability and Recovery](HISTORY_RECOVERY.md) - history-only lifecycle reconstruction and recovery contracts.
|
|
79
81
|
- [Agent Recovery and Guidance](AGENT_RECOVERY_AND_GUIDANCE.md) - policy refusal evidence, canonical help, and managed instruction freshness.
|
|
80
82
|
- [Declarative Workflow Policies](WORKFLOW_POLICIES.md) - portable lifecycle requirements, independent approvals, and completeness reports.
|
|
81
83
|
- [Mutation Integrity](MUTATION_INTEGRITY.md) - shared CLI/SDK/MCP author, secret, append-only disposition, and stale-work guardrails.
|
|
82
|
-
- [Agent Provenance ADR Amendment](AGENT_PROVENANCE_ADR.md) - extensible model, effort, role, and host provenance with privacy and compatibility boundaries.
|
|
84
|
+
- [Agent Provenance ADR Amendment](https://github.com/unbraind/pm-cli/blob/main/docs/AGENT_PROVENANCE_ADR.md) (repository-only, excluded from npm) - extensible model, effort, role, and host provenance with privacy and compatibility boundaries.
|
|
83
85
|
- [SDK Agent Session and Episode Context](SDK_AGENT_SESSION_CONTEXT.md) - inherited role/topic context, cross-process episode identity, and deterministic history grouping.
|
|
84
86
|
- [SDK Agent Environments](AGENT_ENVIRONMENTS.md) - calibrated observations, total verdicts, isolated episodes, and an executable public-SDK environment.
|
|
85
87
|
- [Improvement Ledger and History Analytics](IMPROVEMENT_ANALYTICS.md) - audited quantitative observations, live provenance coverage, and bounded observational fleet outcomes.
|
|
86
88
|
- [Project Assurance Primitives](ASSURANCE.md) - SDK-owned measurements, assertions, lifecycle gates, cost receipts, and durable verdict history shared by CLI and MCP.
|
|
87
89
|
- [Planning Measurements](PLANNING_MEASUREMENTS.md) - lifecycle coverage, set-membership aggregation, and derived deadline constraints.
|
|
88
|
-
- [Defect Recurrence and Boundary Evidence](DEFECT_RECURRENCE.md) - captured external samples, structured defect-escape evidence, incremental change-risk indexing, and executable recovery-producer census.
|
|
90
|
+
- [Defect Recurrence and Boundary Evidence](https://github.com/unbraind/pm-cli/blob/main/docs/DEFECT_RECURRENCE.md) (repository-only, excluded from npm) - captured external samples, structured defect-escape evidence, incremental change-risk indexing, and executable recovery-producer census.
|
|
89
91
|
- [Recurrence and Executable Recovery Contracts](RECURRENCE_RECOVERY_CONTRACTS.md) - terminal-item recurrence, duplicate-intake routing, capability-aware reindex recovery, and target-aware generated test guidance.
|
|
90
92
|
- [Trustworthy Context and Evidence Contracts](TRUSTWORTHY_CONTEXT_EVIDENCE.md) - full-record assurance, graph composition, boolean health rows, lossless linked-test removal, and role-labelled recovery.
|
|
91
93
|
- [Context Integrity Contracts](CONTEXT_INTEGRITY_CONTRACTS.md) - sparse-read identity, closed extension manifests, lossless remote docs, direction-locked graph impact, and cross-version history epochs.
|
|
@@ -123,7 +125,7 @@ Additional SDK, operations, and generated contracts:
|
|
|
123
125
|
- [SDK Runtime Boundaries](SDK_RUNTIME_BOUNDARIES.md) - runtime ownership and import boundaries.
|
|
124
126
|
- [Sentry Contract Epochs](SENTRY_CONTRACT_EPOCHS.md) - diagnostic compatibility and release epochs.
|
|
125
127
|
- [Generated Agent Command Surface](generated/AGENT_COMMAND_SURFACE.md) - command routing inventory.
|
|
126
|
-
- [Generated Flag Lexicon Budgets](generated/FLAG_LEXICON_BUDGETS.md) - flag vocabulary and budget inventory.
|
|
128
|
+
- [Generated Flag Lexicon Budgets](https://github.com/unbraind/pm-cli/blob/main/docs/generated/FLAG_LEXICON_BUDGETS.md) (repository-only, excluded from npm; `listPmFlagLexicon()` returns the same inventory) - flag vocabulary and budget inventory.
|
|
127
129
|
|
|
128
130
|
## Guide Topic Map
|
|
129
131
|
|