pi-smart-compact 9.7.1 → 10.0.1

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 (206) hide show
  1. package/ARCHITECTURE.md +973 -372
  2. package/CHANGELOG.md +721 -0
  3. package/LICENSE +8 -0
  4. package/README.md +128 -640
  5. package/SECURITY.md +34 -12
  6. package/SUPPORT.md +26 -9
  7. package/assets/DejaVu-LICENSE.txt +187 -0
  8. package/assets/DejaVuSansMono.ttf +0 -0
  9. package/assets/README.md +26 -0
  10. package/assets/skills/context-management/SKILL.md +34 -0
  11. package/dist/app/anchor-cache.d.ts +36 -0
  12. package/dist/app/anchor-cache.d.ts.map +1 -0
  13. package/dist/app/artifact-storage.d.ts +47 -0
  14. package/dist/app/artifact-storage.d.ts.map +1 -0
  15. package/dist/app/background-preparation.d.ts +39 -0
  16. package/dist/app/background-preparation.d.ts.map +1 -0
  17. package/dist/app/compaction-commit-store.d.ts +5 -1
  18. package/dist/app/compaction-commit-store.d.ts.map +1 -1
  19. package/dist/app/context-evidence.d.ts +57 -0
  20. package/dist/app/context-evidence.d.ts.map +1 -0
  21. package/dist/app/context-guide.d.ts +3 -0
  22. package/dist/app/context-guide.d.ts.map +1 -0
  23. package/dist/app/context-operations.d.ts +106 -0
  24. package/dist/app/context-operations.d.ts.map +1 -0
  25. package/dist/app/effective-state.d.ts +23 -0
  26. package/dist/app/effective-state.d.ts.map +1 -0
  27. package/dist/app/global-settings-runtime.d.ts +3 -3
  28. package/dist/app/global-settings-runtime.d.ts.map +1 -1
  29. package/dist/app/hindsight-memory.d.ts +100 -0
  30. package/dist/app/hindsight-memory.d.ts.map +1 -0
  31. package/dist/app/host-cache-ledger.d.ts +68 -0
  32. package/dist/app/host-cache-ledger.d.ts.map +1 -0
  33. package/dist/app/lazy-tools.d.ts +36 -0
  34. package/dist/app/lazy-tools.d.ts.map +1 -0
  35. package/dist/app/memory-backend.d.ts +58 -0
  36. package/dist/app/memory-backend.d.ts.map +1 -0
  37. package/dist/app/mnemopi-memory.d.ts +13 -0
  38. package/dist/app/mnemopi-memory.d.ts.map +1 -0
  39. package/dist/app/mnemopi-protocol.d.ts +78 -0
  40. package/dist/app/mnemopi-protocol.d.ts.map +1 -0
  41. package/dist/app/mnemopi-worker.d.ts +2 -0
  42. package/dist/app/mnemopi-worker.d.ts.map +1 -0
  43. package/dist/app/model-feasibility.d.ts +20 -0
  44. package/dist/app/model-feasibility.d.ts.map +1 -0
  45. package/dist/app/native-compaction.d.ts +88 -0
  46. package/dist/app/native-compaction.d.ts.map +1 -0
  47. package/dist/app/native-continuity-bridge.d.ts.map +1 -1
  48. package/dist/app/navigation-data.d.ts +28 -0
  49. package/dist/app/navigation-data.d.ts.map +1 -0
  50. package/dist/app/navigation-types.d.ts +60 -0
  51. package/dist/app/navigation-types.d.ts.map +1 -0
  52. package/dist/app/pending-slot.d.ts +11 -1
  53. package/dist/app/pending-slot.d.ts.map +1 -1
  54. package/dist/app/preflight.d.ts.map +1 -1
  55. package/dist/app/register-context-tools.d.ts +16 -3
  56. package/dist/app/register-context-tools.d.ts.map +1 -1
  57. package/dist/app/register-navigation.d.ts +20 -0
  58. package/dist/app/register-navigation.d.ts.map +1 -0
  59. package/dist/app/register-smart-compact-command.d.ts +17 -2
  60. package/dist/app/register-smart-compact-command.d.ts.map +1 -1
  61. package/dist/app/register-smart-compact-tool.d.ts.map +1 -1
  62. package/dist/app/register-smart-context-tool.d.ts +55 -0
  63. package/dist/app/register-smart-context-tool.d.ts.map +1 -0
  64. package/dist/app/run-context.d.ts +1 -0
  65. package/dist/app/run-context.d.ts.map +1 -1
  66. package/dist/app/run-smart-compact.d.ts +3 -3
  67. package/dist/app/run-smart-compact.d.ts.map +1 -1
  68. package/dist/app/session-handoff.d.ts +64 -0
  69. package/dist/app/session-handoff.d.ts.map +1 -0
  70. package/dist/app/session-lineage.d.ts +17 -0
  71. package/dist/app/session-lineage.d.ts.map +1 -0
  72. package/dist/app/session-run-lock.d.ts +0 -2
  73. package/dist/app/session-run-lock.d.ts.map +1 -1
  74. package/dist/app/settled-auto-trigger.d.ts +2 -0
  75. package/dist/app/settled-auto-trigger.d.ts.map +1 -1
  76. package/dist/app/smart-compact-input.d.ts +1 -1
  77. package/dist/app/smart-compact-input.d.ts.map +1 -1
  78. package/dist/app/smart-compact-policy.d.ts +1 -1
  79. package/dist/app/smart-compact-policy.d.ts.map +1 -1
  80. package/dist/app/steps/extract.d.ts +45 -1
  81. package/dist/app/steps/extract.d.ts.map +1 -1
  82. package/dist/app/steps/metrics.d.ts +1 -0
  83. package/dist/app/steps/metrics.d.ts.map +1 -1
  84. package/dist/app/steps/persist.d.ts.map +1 -1
  85. package/dist/app/steps/prepare.d.ts.map +1 -1
  86. package/dist/app/steps/recover.d.ts +9 -0
  87. package/dist/app/steps/recover.d.ts.map +1 -1
  88. package/dist/app/steps/synthesize.d.ts.map +1 -1
  89. package/dist/app/steps/tier.d.ts.map +1 -1
  90. package/dist/app/steps/verify.d.ts.map +1 -1
  91. package/dist/app/steps/visual.d.ts +4 -0
  92. package/dist/app/steps/visual.d.ts.map +1 -0
  93. package/dist/app/steps/window.d.ts.map +1 -1
  94. package/dist/app/tool-artifacts.d.ts +27 -0
  95. package/dist/app/tool-artifacts.d.ts.map +1 -0
  96. package/dist/app/visual-archive.d.ts +29 -0
  97. package/dist/app/visual-archive.d.ts.map +1 -0
  98. package/dist/constants.d.ts +96 -1
  99. package/dist/constants.d.ts.map +1 -1
  100. package/dist/domain/compaction-usage.d.ts +16 -0
  101. package/dist/domain/compaction-usage.d.ts.map +1 -0
  102. package/dist/domain/model-capacity.d.ts +12 -0
  103. package/dist/domain/model-capacity.d.ts.map +1 -0
  104. package/dist/domain/provider-evaluation.d.ts +7 -0
  105. package/dist/domain/provider-evaluation.d.ts.map +1 -1
  106. package/dist/domain/telemetry.d.ts +43 -2
  107. package/dist/domain/telemetry.d.ts.map +1 -1
  108. package/dist/domain/tool-semantics.d.ts +23 -0
  109. package/dist/domain/tool-semantics.d.ts.map +1 -1
  110. package/dist/index.d.ts.map +1 -1
  111. package/dist/index.js +15757 -6942
  112. package/dist/infra/ai-messages.d.ts +1 -1
  113. package/dist/infra/ai-messages.d.ts.map +1 -1
  114. package/dist/infra/context-graph.d.ts +38 -7
  115. package/dist/infra/context-graph.d.ts.map +1 -1
  116. package/dist/infra/fs.d.ts.map +1 -1
  117. package/dist/infra/hindsight-client.d.ts +73 -0
  118. package/dist/infra/hindsight-client.d.ts.map +1 -0
  119. package/dist/infra/hindsight-receipts.d.ts +68 -0
  120. package/dist/infra/hindsight-receipts.d.ts.map +1 -0
  121. package/dist/infra/llm-client.d.ts +26 -23
  122. package/dist/infra/llm-client.d.ts.map +1 -1
  123. package/dist/infra/memory-ref.d.ts +27 -0
  124. package/dist/infra/memory-ref.d.ts.map +1 -0
  125. package/dist/infra/native-protocol.d.ts +54 -0
  126. package/dist/infra/native-protocol.d.ts.map +1 -0
  127. package/dist/infra/optional-components.d.ts +15 -0
  128. package/dist/infra/optional-components.d.ts.map +1 -0
  129. package/dist/infra/paths.d.ts +2 -0
  130. package/dist/infra/paths.d.ts.map +1 -1
  131. package/dist/infra/services.d.ts +15 -5
  132. package/dist/infra/services.d.ts.map +1 -1
  133. package/dist/infra/visual-renderer.d.ts +16 -0
  134. package/dist/infra/visual-renderer.d.ts.map +1 -0
  135. package/dist/mnemopi-worker.js +213 -0
  136. package/dist/phases/explore.d.ts +12 -9
  137. package/dist/phases/explore.d.ts.map +1 -1
  138. package/dist/phases/synthesize.d.ts +18 -3
  139. package/dist/phases/synthesize.d.ts.map +1 -1
  140. package/dist/phases/verify.d.ts +5 -1
  141. package/dist/phases/verify.d.ts.map +1 -1
  142. package/dist/rtk.d.ts +7 -0
  143. package/dist/rtk.d.ts.map +1 -0
  144. package/dist/rtk.js +767 -0
  145. package/dist/types.d.ts +128 -4
  146. package/dist/types.d.ts.map +1 -1
  147. package/dist/ui/dashboard-format.d.ts +2 -1
  148. package/dist/ui/dashboard-format.d.ts.map +1 -1
  149. package/dist/ui/dashboard-insights.d.ts +9 -1
  150. package/dist/ui/dashboard-insights.d.ts.map +1 -1
  151. package/dist/ui/error-format.d.ts +7 -2
  152. package/dist/ui/error-format.d.ts.map +1 -1
  153. package/dist/ui/handoff-overlay.d.ts +26 -0
  154. package/dist/ui/handoff-overlay.d.ts.map +1 -0
  155. package/dist/ui/home-overlay.d.ts +54 -0
  156. package/dist/ui/home-overlay.d.ts.map +1 -0
  157. package/dist/ui/metrics-dashboard-overlay.d.ts.map +1 -1
  158. package/dist/ui/metrics-report.d.ts.map +1 -1
  159. package/dist/ui/navigation-overlay.d.ts +92 -0
  160. package/dist/ui/navigation-overlay.d.ts.map +1 -0
  161. package/dist/ui/overlays.d.ts +12 -2
  162. package/dist/ui/overlays.d.ts.map +1 -1
  163. package/dist/ui/profiles.d.ts +51 -0
  164. package/dist/ui/profiles.d.ts.map +1 -0
  165. package/dist/ui/settings-complex.d.ts +49 -3
  166. package/dist/ui/settings-complex.d.ts.map +1 -1
  167. package/dist/ui/settings-list.d.ts +28 -0
  168. package/dist/ui/settings-list.d.ts.map +1 -0
  169. package/dist/ui/settings-overlay.d.ts +13 -6
  170. package/dist/ui/settings-overlay.d.ts.map +1 -1
  171. package/dist/ui/storage-report.d.ts +4 -0
  172. package/dist/ui/storage-report.d.ts.map +1 -0
  173. package/dist/utils/backups.d.ts.map +1 -1
  174. package/dist/utils/cache.d.ts +6 -2
  175. package/dist/utils/cache.d.ts.map +1 -1
  176. package/dist/utils/config.d.ts +12 -0
  177. package/dist/utils/config.d.ts.map +1 -1
  178. package/dist/utils/helpers.d.ts.map +1 -1
  179. package/dist/utils/id-fingerprint.d.ts +3 -1
  180. package/dist/utils/id-fingerprint.d.ts.map +1 -1
  181. package/dist/utils/issues.d.ts +61 -0
  182. package/dist/utils/issues.d.ts.map +1 -0
  183. package/dist/utils/pruning.d.ts.map +1 -1
  184. package/dist/utils/session-log.d.ts +0 -2
  185. package/dist/utils/session-log.d.ts.map +1 -1
  186. package/dist/utils/state.d.ts +3 -1
  187. package/dist/utils/state.d.ts.map +1 -1
  188. package/dist/utils/tokens.d.ts +10 -2
  189. package/dist/utils/tokens.d.ts.map +1 -1
  190. package/docs/MIGRATING_TO_V8.md +7 -1
  191. package/docs/README.md +69 -0
  192. package/docs/RELEASE.md +173 -56
  193. package/docs/assets/banner.png +0 -0
  194. package/docs/assets/banner.svg +1158 -70
  195. package/docs/assets/pi-smart-compact.png +0 -0
  196. package/docs/assets/pi-smart-compact.svg +24 -0
  197. package/docs/configuration.md +637 -0
  198. package/docs/evaluation.md +408 -0
  199. package/docs/guide.md +860 -0
  200. package/docs/hindsight-memory.md +314 -0
  201. package/docs/identity.md +124 -0
  202. package/package.json +44 -11
  203. package/dist/provider-eval.js +0 -2122
  204. package/dist/provider-scenario-eval.js +0 -2900
  205. package/dist/telemetry-report.js +0 -1973
  206. package/docs/provider-evaluation-2026-08-06.md +0 -63
package/docs/README.md ADDED
@@ -0,0 +1,69 @@
1
+ # Pi Continuity documentation
2
+
3
+ [Project overview](../README.md) · [User guide](./guide.md) · [Configuration](./configuration.md)
4
+
5
+ Pi Continuity is the product name; `pi-smart-compact` remains the package,
6
+ command family and repository. [Identity and naming](./identity.md).
7
+
8
+ These guides follow the **current source checkout**, including unreleased work.
9
+ Compare your installed version with the [changelog](../CHANGELOG.md). Dated
10
+ reports describe their own revisions, not necessarily today's behavior.
11
+
12
+ ## Start with your task
13
+
14
+ | I want to… | Read |
15
+ | --- | --- |
16
+ | Install and choose how the extension runs | [Get started](../README.md#get-started) |
17
+ | Clean up output, compact or recover evidence | [User guide](./guide.md) |
18
+ | Use anchors or move work to a fresh session | [Session navigation and handoff](./guide.md#session-navigation) |
19
+ | Understand a setting, trigger, model route or budget | [Configuration reference](./configuration.md) |
20
+ | Choose where project memory lives | [Memory stores](./guide.md#memory-store-memorybackend) |
21
+ | Connect an existing Hindsight server | [Hindsight setup and privacy](./hindsight-memory.md) |
22
+ | Diagnose unexpected behavior | [Troubleshooting](./guide.md#troubleshooting) · [Support](../SUPPORT.md) |
23
+ | Report sensitive information privately | [Security policy](../SECURITY.md) |
24
+
25
+ ## Understand or contribute
26
+
27
+ | Document | Scope |
28
+ | --- | --- |
29
+ | [Architecture](../ARCHITECTURE.md) | Ownership, preservation rules, apply boundaries and module responsibilities. |
30
+ | [Evaluation](./evaluation.md) | Available checks and experiments; what quality, cost and timing evidence can establish. |
31
+ | [Contributing](https://github.com/alpertarhan/pi-smart-compact/blob/main/CONTRIBUTING.md) | Development setup, repository map and pull-request expectations. |
32
+ | [Release checklist](./RELEASE.md) | Package validation, compatibility and publication gates. |
33
+ | [Identity and assets](./identity.md) | Product naming, logo sources, palette and reproducible image exports. |
34
+ | [Changelog](../CHANGELOG.md) | Versioned changes and unpublished work. |
35
+
36
+ ## Keep these concepts separate
37
+
38
+ | Concept | Purpose | Not a substitute for… |
39
+ | --- | --- | --- |
40
+ | **Context hygiene** | Reduce active tool-output noise while keeping eligible evidence retrievable. Local cleanup needs no summary-model call. | A new conversation summary. |
41
+ | **Session continuity** | Carry constraints, decisions, failures and next steps through research, compaction and reload. | Filesystem rollback or a complete copy of the original history. |
42
+ | **Project memory** | Recall scoped facts through one selected backend; explicit saves require confirmation. The local graph can also index derived compaction state. | Backups, output archives or automatic transcript upload. |
43
+
44
+ The [storage guide](./guide.md#storage-and-privacy) explains where each kind of
45
+ state lives and how long it is retained.
46
+
47
+ ## Historical evidence
48
+
49
+ Reports are preserved as dated evidence. Their measurements, revision limits and
50
+ warnings remain part of the record; they are not current setup instructions.
51
+
52
+ - [Pilot and research reports on GitHub](https://github.com/alpertarhan/pi-smart-compact/tree/main/docs/reports):
53
+ context hygiene, AgentSession lifecycle, visual evidence, Hindsight/native
54
+ compaction research and the earlier provider baseline. The
55
+ [evaluation guide](./evaluation.md#pilots-and-dated-reports) explains each scope.
56
+ - [Review findings on GitHub](https://github.com/alpertarhan/pi-smart-compact/blob/main/docs/findings/README.md):
57
+ the index of external-model and agent-harness audits, organized by reviewer
58
+ and date. Findings are advisory, not a release gate or product guarantee.
59
+ - [v7 → v8 migration](./MIGRATING_TO_V8.md): instructions for that historical
60
+ transition, **not** the current installation baseline.
61
+
62
+ `docs/reports/` and `docs/findings/` are repository-only and excluded from npm.
63
+ Links to those archives deliberately open GitHub, so this index also works from
64
+ an installed package. User guides and brand assets ship with the package;
65
+ developer source, tests and evaluation scripts do not.
66
+
67
+ A green scripted pilot does not establish live-model fidelity, billed savings
68
+ or production readiness. Use the [evaluation limits](./evaluation.md) and
69
+ [release checklist](./RELEASE.md) before making those claims.
package/docs/RELEASE.md CHANGED
@@ -1,21 +1,47 @@
1
1
  # Release checklist
2
2
 
3
- Use this checklist before publishing `pi-smart-compact`.
4
-
5
- > **Stop condition:** validation, packing, and isolated installation are safe.
6
- > `npm publish`, Git tags, GitHub releases, and deployment require separate
7
- > explicit approval. The automated checks never perform them.
3
+ Use this checklist before publishing Pi Continuity as the npm package
4
+ `pi-smart-compact`. The package name, command, tool names and configuration
5
+ key do not change with the documentation brand.
6
+
7
+ > **Approval boundary:** validation, packing and isolated installation do not
8
+ > publish anything. Creating a published GitHub release is the explicit
9
+ > approval that starts npm publication through Trusted Publishing. Use a draft
10
+ > release for preparation; ordinary commits, tags and pull-request CI do not
11
+ > publish packages.
12
+
13
+ Evidence classes and their limits are defined in
14
+ [evaluation](./evaluation.md#offline-and-live-evidence). Keep the unpublished
15
+ checkout version and the version currently on npm distinct in every note.
16
+ Toolchain prerequisites (Bun pin, Node with npm, ripgrep) are listed at the top
17
+ of [evaluation](./evaluation.md); `release:audit` also needs network access for
18
+ package installation.
8
19
 
9
20
  ## 1. Prepare the candidate
10
21
 
11
- - [ ] Choose a SemVer version. Use a prerelease such as `8.0.0-rc.4` until the
12
- stable/canary gates pass.
13
- - [ ] Update `package.json`; run `bun run sync-version` for `src/constants.ts`.
22
+ - [ ] Use a distinct prerelease until the stable/canary gates pass, unless the
23
+ release owner explicitly approves a version-specific stable exception.
24
+ Record any exception and missing evidence in the release notes; it is
25
+ not a `PROMOTE` result. Stamp `package.json` and run
26
+ `bun run sync-version` before packing.
14
27
  - [ ] Move shipped notes from `[Unreleased]` into the dated version in
15
- `CHANGELOG.md`.
16
- - [ ] Update README, architecture, and migration notes for behavior/config
17
- changes.
18
- - [ ] Confirm Pi and TypeBox remain wildcard peer dependencies (`"*"`).
28
+ `CHANGELOG.md`; never word a candidate entry as if the final release
29
+ check or canary promotion already passed.
30
+ - [ ] Update the guide, configuration, evaluation, architecture and migration
31
+ notes for behavior/config changes. Dated reports (`docs/reports/`) stay
32
+ historical and are not packed; add a new report or addendum instead of
33
+ rewriting them.
34
+ - [ ] On a major version change, update the supported-versions row in
35
+ `SECURITY.md`; `release:audit` requires it to read ``Latest `<major>.x` ``.
36
+ - [ ] For Claude subscription routes, pair the fresh candidate with the exact
37
+ `pi-claude-oauth-adapter` build used in the proofs (published `0.2.2`
38
+ plus the final-payload patch, [upstream PR #10](https://github.com/minzique/pi-claude-oauth-adapter/pull/10),
39
+ until it is released) and record
40
+ the paired archive paths and hashes at final packaging — do not
41
+ reconstruct them from memory.
42
+ - [ ] Confirm Pi remains a host peer (`">=0.87.1"`) and TypeBox a wildcard peer (`"*"`); neither is bundled.
43
+ - [ ] Confirm the visual renderer remains optional/external and the font plus its license ship in `assets/`, together with the on-demand context guide `assets/skills/context-management/SKILL.md`. Verify default Node loading without the optional addon and a real PNG render where supported.
44
+ - [ ] Confirm Mnemopi stays an optional external engine with TypeBox external in its worker, and that `bun`, `@oh-my-pi/pi-mnemopi` and `@resvg/resvg-js` remain optional peers pinned to `OPTIONAL_COMPONENTS` (never `optionalDependencies`). Verify a plain install pulls none of them in, the failure names the install command for the install root, the installed Node-host worker runs on the user-installed `bun` component under a Pi-style npm root with no Bun on `PATH`, and the fail-closed missing-engine and missing-Bun failures submit no memory request and create no store.
19
45
  - [ ] Confirm no secrets, local JSONL, SQLite data, backups, or generated
20
46
  credentials are tracked or packed.
21
47
 
@@ -26,22 +52,40 @@ bun install --frozen-lockfile
26
52
  bun run release:check
27
53
  ```
28
54
 
29
- `release:check` runs the expanded CI chain: source and scripts typechecking,
30
- all tests, the adversarial gate, build, and release audit. The audit verifies the
31
- packed manifest/version/peers, supported SECURITY major, package contents,
32
- isolated and frozen installs, extension/tool registration, Node SQLite, and
33
- packaged CLIs.
55
+ `release:check` runs the full local chain: source, scripts, test and bench
56
+ typechecking; all tests; the adversarial `gate`; the hot-path `bench`; build;
57
+ `release:audit`; and `compat:pi latest`. The audit verifies the packed
58
+ manifest/version/peers, supported SECURITY major, package contents
59
+ (runtime-only `dist`: exactly `index.js`, `rtk.js`, and `mnemopi-worker.js` plus
60
+ declarations), isolated and frozen installs, extension/tool registration, Node
61
+ SQLite, and the optional Mnemopi worker through real Node-host tools. It also
62
+ runs the installed worker under a Bun-free `PATH` on the user-installed
63
+ pinned `bun` component (installed with the command Readiness shows into a
64
+ Pi-style npm root, then kept across a Pi update) and checks the
65
+ install-command, missing-engine and missing-Bun negatives (no store, no
66
+ model/network request). Evaluation and report CLIs are source-checkout tools,
67
+ not packed: the audit runs `scripts/provider-eval.ts`,
68
+ `scripts/telemetry-report.ts`, and all four offline continuation/memory arms of
69
+ `scripts/task-eval.ts` under its isolated HOME; scripted transport is not
70
+ live quality evidence. The test suite covers storage durability with real
71
+ `SessionManager` artifacts aged past 20 days by timestamps — deterministic
72
+ aging, not a wall-clock soak — through actual reload and fork.
73
+
74
+ Run the full chain on the exact candidate. A green result from before any
75
+ later change, including UI or documentation edits, does not count. Pull-request
76
+ CI includes the adversarial gate, but latest-Pi compatibility runs only on a
77
+ schedule or manual dispatch, so a green CI badge does not replace this step.
34
78
 
35
79
  Then validate the host boundary in an isolated workspace:
36
80
 
37
81
  ```bash
38
- bun run compat:pi 0.84.0
82
+ bun run compat:pi 0.87.1
39
83
  bun run compat:pi latest
40
84
  bun audit
41
85
  ```
42
86
 
43
- The compatibility runner temporarily pins only its copied workspace; the source
44
- manifest must remain wildcard-only.
87
+ The compatibility runner temporarily pins only its copied workspace; source
88
+ peer ranges and minimum-version development pins must remain unchanged.
45
89
 
46
90
  ## 3. Inspect artifacts
47
91
 
@@ -49,18 +93,32 @@ manifest must remain wildcard-only.
49
93
  npm pack --dry-run
50
94
  bun run provider-eval --min-samples=5
51
95
  bun run telemetry-report --min-canary-runs=20
96
+ bun run task-eval --out=/tmp/psc-task-eval-new
52
97
  ```
53
98
 
54
99
  Check that:
55
100
 
56
- - [ ] packed files are limited to `dist`, `docs`, README, LICENSE, CHANGELOG,
57
- SECURITY, SUPPORT, ARCHITECTURE, and package metadata;
58
- - [ ] `dist/index.js`, declarations, and all three bundled CLIs are present;
59
- - [ ] the extension registers `smart_compact`, `smart_recall`, and
60
- `smart_save_memory` from the packed install;
101
+ - [ ] packed files are limited to `dist`, `docs` (without `docs/reports/` and
102
+ `docs/findings/`), `assets`, README, LICENSE, CHANGELOG, SECURITY,
103
+ SUPPORT, ARCHITECTURE, and package metadata; `release:audit` requires
104
+ `ARCHITECTURE.md`, `docs/RELEASE.md` and `docs/MIGRATING_TO_V8.md` and
105
+ rejects reports and findings;
106
+ - [ ] `dist` holds only `index.js`, `rtk.js`, `mnemopi-worker.js`, and
107
+ declarations — no evaluation/report CLI bundles;
108
+ - [ ] the extension registers `smart_compact`, `smart_context`,
109
+ `smart_recall`, and `smart_save_memory` from the packed install;
61
110
  - [ ] no provider route was selected automatically;
62
111
  - [ ] Data Confidence is honest (legacy evidence may keep it below 85).
63
112
 
113
+ The task evaluator defaults to real stock Pi sessions with offline scripted
114
+ transport and temporary memory stores. Live mode needs a fresh explicit
115
+ request/input/output budget and selected-provider credentials; it is not part
116
+ of `release:check`. Input estimates and output reservations are not invoices.
117
+ The SDK fetch guard is not a subprocess network/filesystem sandbox. Codex is
118
+ rejected unless explicitly selected as unbounded output; that exception never
119
+ satisfies a hard output-token budget. No provider-quality or savings claim
120
+ follows from a passing offline report.
121
+
64
122
  ## 4. Canary the RC
65
123
 
66
124
  After explicit approval to publish an RC, use the npm `next` tag rather than
@@ -75,51 +133,110 @@ After explicit approval to publish an RC, use the npm `next` tag rather than
75
133
  ```
76
134
 
77
135
  Keep all stage model routes null unless a separate routing decision is approved.
78
- Collect at least 20 non-dry, host-confirmed **applied** schema-v2 canary runs,
79
- ≥70% verifier-quality coverage, and ≥70% run-correlated damage-observation
80
- coverage in both stable and canary cohorts. Inspect the report's total/applied
81
- counts: dry runs and staged-but-unapplied runs are not promotion evidence.
82
- Missing observations are missing evidence, never clean runs. A deterministic
83
- green release check never implies `PROMOTE`. Promotion requires:
136
+ Collect at least 20 non-dry, host-confirmed **applied** schema-v2 canary runs
137
+ of the candidate version, a stable baseline of at least 20 applied runs,
138
+ ≥70% verifier-quality coverage and ≥70% run-correlated damage-observation
139
+ coverage **in both stable and canary cohorts**, and canary data confidence ≥85.
140
+ Inspect the report's total/attempted/applied counts: dry runs, staged-but-
141
+ unapplied runs, voluntary user cancellations, and discarded speculative
142
+ preparations are not promotion evidence (cancellations are neutral — real
143
+ timeouts and provider failures still count). Every metrics entry must carry an
144
+ explicit `releaseChannel`; entries without one are excluded from both cohorts
145
+ and surfaced in the report, never silently pooled as stable. Missing
146
+ observations are missing evidence, never clean runs. A deterministic green
147
+ release check never implies `PROMOTE`. Promotion requires:
84
148
 
85
149
  - [ ] `telemetry-report` says `PROMOTE`;
150
+ - [ ] canary data confidence is ≥85 (report `HOLD` at 82 is a hold, not a pass);
86
151
  - [ ] dashboard Data Confidence is ≥85;
87
152
  - [ ] canary success is ≥95% and absolute verifier quality is ≥85;
88
- - [ ] failure rate did not rise by ≥5pp to at least 10%;
89
- - [ ] verifier quality did not fall by 5 points;
90
- - [ ] p95 duration and average tokens did not rise by 50%;
91
- - [ ] fallback and damage rates did not rise by 10pp;
153
+ - [ ] both cohorts have ≥70% quality and damage-observation coverage;
154
+ - [ ] canary failure rate is at most 5% and not 5pp or more above stable;
155
+ - [ ] verifier quality did not fall by 5 points or more;
156
+ - [ ] p95 duration and average tokens did not rise by 50% or more;
157
+ - [ ] fallback and damage rates did not rise by 10pp or more;
92
158
  - [ ] no unresolved security, data-loss, cross-session, or cancellation issue.
93
159
 
94
- A `ROLLBACK` result blocks promotion. `HOLD` means collect evidence or fix data
95
- coverage; it is not a pass.
96
-
97
- ## 5. Publish — explicit approval required
160
+ The report evaluates rollback triggers once the canary has at least three
161
+ attempted runs; exact rules are in
162
+ [evaluation](./evaluation.md#decision-rules).
98
163
 
99
- Only after the user/release owner explicitly approves:
164
+ The preparation-policy block (prepared/used/discarded, discard reasons,
165
+ time-to-ready, reuse rate, discarded spend) is measurement only: thresholds,
166
+ TTLs, and cooldowns stay manual policy decisions. Route reports keep the
167
+ input/cache-read/cache-write/output split, mark estimated usage, and label
168
+ subscription (OAuth) routes — never price subscription usage at API rates or
169
+ strip cached tokens from quota.
100
170
 
101
- ```bash
102
- # RC
103
- npm publish --tag next
171
+ A `ROLLBACK` result blocks promotion. `HOLD` means collect evidence or fix data
172
+ coverage; it is not a pass. Promotion authority remains manual. A release-owner
173
+ exception must name its version and evidence limits; it does not turn missing
174
+ evidence into a passing gate.
104
175
 
105
- # Stable, after canary approval and a stable SemVer bump
106
- npm publish
107
- ```
176
+ ## 5. Publish — explicit approval required
108
177
 
109
- `prepublishOnly` reruns `release:check`; it does not bypass any gate.
178
+ ### One-time npm Trusted Publisher setup
179
+
180
+ In the npm package settings for `pi-smart-compact`, add a **GitHub Actions**
181
+ trusted publisher with these exact values:
182
+
183
+ | Field | Value |
184
+ | --- | --- |
185
+ | Organization or user | `alpertarhan` |
186
+ | Repository | `pi-smart-compact` |
187
+ | Workflow filename | `publish.yml` (not `.github/workflows/publish.yml`) |
188
+ | Environment | Leave empty; the workflow does not use an environment |
189
+ | Publish permission | Allow direct `npm publish`, not only `npm stage publish` |
190
+
191
+ The current npm default can permit staging only. Direct publication must be
192
+ enabled to avoid a manual approval for every package. npm does not verify these
193
+ fields when saving; the first successful workflow publication proves the link.
194
+ See [npm Trusted Publishing](https://docs.npmjs.com/trusted-publishers/).
195
+
196
+ No `NPM_TOKEN` or `NODE_AUTH_TOKEN` secret is needed.
197
+ [`publish.yml`](https://github.com/alpertarhan/pi-smart-compact/blob/main/.github/workflows/publish.yml)
198
+ uses a GitHub-hosted runner, `id-token: write`, Node 26.10.0, npm 11.19.1 and
199
+ the Bun version pinned in `package.json`. npm obtains short-lived OIDC
200
+ credentials and automatically attaches provenance for this public repository.
201
+ Keep these versions and the workflow filename aligned when changing tooling.
202
+
203
+ ### Release an approved version
204
+
205
+ 1. Merge the version, generated `VERSION`, changelog and release documentation
206
+ through a PR into `main`, with required CI passing. Complete the checks above.
207
+ 2. Create a GitHub release at that exact `main` commit with tag `v<version>`,
208
+ matching `package.json`. Include upgrade notes and the actual validation
209
+ evidence; document any explicitly approved canary exception.
210
+ 3. For a SemVer prerelease, mark the GitHub release **pre-release**. For a stable
211
+ version, leave that flag off. Publish the release, not just its tag.
212
+ 4. Follow **Actions → Publish to npm**. The workflow rejects tags that do not
213
+ match the package version, mismatched prerelease flags and commits outside
214
+ `main`. Prereleases publish to npm `next`; stable versions publish to `latest`.
215
+
216
+ The workflow checks minimum-Pi compatibility and dependency advisories, then
217
+ calls `npm publish`. Its existing `prepublishOnly` hook runs the full
218
+ `release:check`, including the packed install audit and latest-Pi compatibility,
219
+ before uploading. It never uses `--ignore-scripts` to bypass these gates.
220
+
221
+ If the first run fails authentication, check the exact owner/repository/workflow
222
+ fields, the empty environment and direct-publish permission on npm. After fixing
223
+ the configuration, rerun the failed Actions job; do not publish manually to
224
+ mask a broken OIDC setup. Once a version is published, it is immutable: a new
225
+ package change needs a new version, not a republish or a moved release tag.
110
226
 
111
227
  ## 6. After publishing
112
228
 
113
- 1. Verify npm package contents and integrity.
114
- 2. Create the matching Git tag and GitHub release with migration/compatibility
115
- notes.
116
- 3. Install through Pi in a clean profile:
229
+ 1. Confirm **Publish to npm** completed successfully. A published GitHub release
230
+ alone does not prove the package reached npm.
231
+ 2. Check the registry version, dist-tag, integrity and provenance:
117
232
 
118
233
  ```bash
119
- pi install npm:pi-smart-compact@next # RC
120
- # or npm:pi-smart-compact for stable
234
+ VERSION=$(node -p 'require("./package.json").version')
235
+ npm view "pi-smart-compact@$VERSION" version dist.integrity dist.attestations --json
236
+ npm view pi-smart-compact dist-tags --json
121
237
  ```
122
238
 
123
- 4. Re-run tool registration, one manual compaction, Smart Recall, and the local
124
- dashboard.
125
- 5. Keep canary monitoring active through the agreed observation window.
239
+ 3. Install the exact version through Pi in a clean profile, then re-run tool
240
+ registration, one manual compaction, Smart Recall and the local dashboard.
241
+ 4. Keep canary monitoring active through the agreed observation window;
242
+ successful publication is not production-quality evidence.
Binary file