pi-memory-evolution 0.2.0 → 0.2.2

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/CHANGELOG.md CHANGED
@@ -2,6 +2,26 @@
2
2
 
3
3
  All notable changes to pi-memory-evolution are documented here.
4
4
 
5
+ ## [0.2.2](https://github.com/btnalit/pi-memory-evolution/compare/v0.2.1...v0.2.2) (2026-09-08)
6
+
7
+
8
+ ### Bug Fixes
9
+
10
+ * support npm 12 pack output and gate CLI compatibility ([#7](https://github.com/btnalit/pi-memory-evolution/issues/7)) ([4fde298](https://github.com/btnalit/pi-memory-evolution/commit/4fde29844b6d2c9e9497a656f75d8655e812d4c6))
11
+
12
+
13
+ ### Maintenance
14
+
15
+ * **deps-dev:** bump the development-minor-patch group across 1 directory with 3 updates ([#9](https://github.com/btnalit/pi-memory-evolution/issues/9)) ([03ef2be](https://github.com/btnalit/pi-memory-evolution/commit/03ef2beed637cfaa5c9dae22b26060c6f330d754))
16
+ * **deps-dev:** bump typescript from 5.9.3 to 7.0.2 ([#5](https://github.com/btnalit/pi-memory-evolution/issues/5)) ([dc97e2c](https://github.com/btnalit/pi-memory-evolution/commit/dc97e2c3306a0c1b07c34675d1eebaa7c73aaa8d))
17
+
18
+ ## [0.2.1](https://github.com/btnalit/pi-memory-evolution/compare/v0.2.0...v0.2.1) (2026-09-08)
19
+
20
+
21
+ ### Automation
22
+
23
+ * gate changes and automate verified npm releases ([#2](https://github.com/btnalit/pi-memory-evolution/issues/2)) ([87f9245](https://github.com/btnalit/pi-memory-evolution/commit/87f9245ef799870723ef1f6478eb623d2a37a958))
24
+
5
25
  ## [0.2.0] - 2026-09-08
6
26
 
7
27
  ### Changed
package/README.cn.md ADDED
@@ -0,0 +1,114 @@
1
+ # pi-memory-evolution
2
+
3
+ [English](README.md) · 简体中文
4
+
5
+ [![CI](https://github.com/btnalit/pi-memory-evolution/actions/workflows/ci.yml/badge.svg)](https://github.com/btnalit/pi-memory-evolution/actions/workflows/ci.yml)
6
+ [![npm](https://img.shields.io/npm/v/pi-memory-evolution)](https://www.npmjs.com/package/pi-memory-evolution)
7
+
8
+ 为 [Pi](https://pi.dev) 提供持久记忆,让项目背景、个人偏好和工作进展能够跨会话延续。
9
+
10
+ 扩展自动学习值得保留的信息,在后续对话中按主题注入相关内容,也支持跨目录召回。不需要反复说“记住”,不需要维护审批队列。
11
+
12
+ ## 功能
13
+
14
+ - **自动学习与更新**:从对话摘要、需求和纠正中提取记忆,根据实际工具结果更新已有项目状态;保留来源和变更历史,支持衰退、排序与撤销。
15
+ - **相关内容注入**:结合当前问题和近期用户上下文选择记忆,过滤弱匹配和失效状态;没有匹配就不填充无关内容。
16
+ - **跨会话召回**:在共享记忆库的不同会话、目录中查找背景;提供只读 `memory_recall` 工具,供助手在任务中途补查。
17
+
18
+ 学习使用 Pi 当前模型和已有认证,无需另配 API Key、向量数据库或嵌入服务。
19
+
20
+ ## 安装
21
+
22
+ 需要 **Pi 0.85+**,并已配置可用模型。使用 npm 版 Pi 时需要 **Node.js 22.19+**。
23
+
24
+ ### npm
25
+
26
+ ```bash
27
+ pi install npm:pi-memory-evolution
28
+ ```
29
+
30
+ ### Git
31
+
32
+ 也可以直接安装 Git 默认分支,需要本机有 Git 和 npm:
33
+
34
+ ```bash
35
+ pi install https://github.com/btnalit/pi-memory-evolution
36
+ ```
37
+
38
+ **两种方式选一种**,不要重复安装。然后在 Pi 中执行:
39
+
40
+ ```text
41
+ /reload
42
+ /memory status
43
+ ```
44
+
45
+ 出现 `SQLite ok (schema 5)` 表示存储初始化成功。后续正常使用 Pi 即可,学习和召回会自动运行。
46
+
47
+ ## 使用
48
+
49
+ 在对话中说明需求,例如:
50
+
51
+ ```text
52
+ atlas-service 的核心需求是自动备份和故障恢复。
53
+ ```
54
+
55
+ 之后可以在新会话中继续询问:
56
+
57
+ ```text
58
+ 你还记得 atlas-service 的核心需求吗?
59
+ ```
60
+
61
+ 学习在后台完成,并非每句话都会保存。可用以下命令查看和维护记忆:
62
+
63
+ | 命令 | 用途 |
64
+ | --- | --- |
65
+ | `/memory list` | 浏览记忆 |
66
+ | `/memory search <主题>` | 搜索相关内容 |
67
+ | `/memory show <id>` | 查看内容和来源 |
68
+ | `/memory learning` | 查看采集、更新及实际变更结果 |
69
+ | `/memory explain` | 查看上一次自动注入的选择原因 |
70
+ | `/memory correct <id> <内容>` | 纠正记忆 |
71
+ | `/memory forget <id>` | 停止召回该记忆 |
72
+
73
+ 完整命令、安装迁移和排错方法见[使用指南](docs/usage.md)。
74
+
75
+ ## 更新与卸载
76
+
77
+ npm 安装:
78
+
79
+ ```bash
80
+ pi update npm:pi-memory-evolution
81
+ pi remove npm:pi-memory-evolution
82
+ ```
83
+
84
+ Git 安装请把上面的包来源替换为安装时使用的仓库 URL。操作后执行 `/reload` 或重启 Pi。卸载扩展不会删除记忆库;升级数据库结构前请先退出共用该库的 Pi 进程并备份。
85
+
86
+ ## 数据与边界
87
+
88
+ 数据默认保存在 `~/.pi/agent/agent-suite/memory-evolution/`,使用本地 SQLite。`PI_CODING_AGENT_DIR` 可改变存储前缀;不同工作目录默认共享记忆库。
89
+
90
+ 学习会将经过过滤的来源内容发送给当前模型,并消耗相应额度。记忆不是经过独立验证的事实,匹配和敏感信息过滤也并非万无一失;重要内容仍需核实。详见[存储与隐私](docs/usage.md#local-storage-and-provenance)。
91
+
92
+ ## 开发
93
+
94
+ 在源码仓库中运行:
95
+
96
+ ```bash
97
+ npm ci --ignore-scripts
98
+ npm run check
99
+ npm run test:install
100
+ npm run test:pi
101
+ npm run build
102
+ ```
103
+
104
+ CI 自动检查类型、回归、包内容、安装和模拟模型集成;构建产出可安装的 npm 压缩包及校验值。版本和更新记录由发布 PR 自动维护,合并且验证通过后自动发包;依赖更新也走 PR 门禁。
105
+
106
+ 安装测试使用隔离环境,集成测试使用真实 Pi 和模拟模型,不产生付费模型调用。详见[测试说明](docs/testing.md)和[发布流程](docs/releasing.md)。
107
+
108
+ ## 文档
109
+
110
+ [使用指南](docs/usage.md) · [架构设计](docs/design.md) · [记忆质量](docs/core-quality.md) · [更新记录](CHANGELOG.md)
111
+
112
+ ## 许可证
113
+
114
+ [MIT](LICENSE)
package/README.md CHANGED
@@ -1,106 +1,126 @@
1
1
  # pi-memory-evolution
2
2
 
3
- [Pi](https://pi.dev) 提供持久记忆,让项目背景、个人偏好和工作进展能够跨会话延续。
3
+ [![CI](https://github.com/btnalit/pi-memory-evolution/actions/workflows/ci.yml/badge.svg)](https://github.com/btnalit/pi-memory-evolution/actions/workflows/ci.yml)
4
+ [![npm](https://img.shields.io/npm/v/pi-memory-evolution)](https://www.npmjs.com/package/pi-memory-evolution)
5
+ [![MIT](https://img.shields.io/badge/license-MIT-blue)](LICENSE)
4
6
 
5
- 扩展自动学习值得保留的信息,在后续对话中按主题注入相关内容,也支持跨目录召回。不需要反复说“记住”,不需要维护审批队列。
7
+ English · [简体中文](README.cn.md)
6
8
 
7
- ## 功能
9
+ Persistent, evidence-aware memory for [Pi](https://pi.dev). Keep useful preferences,
10
+ project context and work progress across sessions—without repeatedly asking the
11
+ assistant to remember them.
8
12
 
9
- - **自动学习与更新**:从对话摘要、需求和纠正中提取记忆,根据实际工具结果更新已有项目状态;保留来源和变更历史,支持衰退、排序与撤销。
10
- - **相关内容注入**:结合当前问题和近期用户上下文选择记忆,过滤弱匹配和失效状态;没有匹配就不填充无关内容。
11
- - **跨会话召回**:在共享记忆库的不同会话、目录中查找背景;提供只读 `memory_recall` 工具,供助手在任务中途补查。
13
+ ![Memory learning, context injection and cross-session recall](assets/overview.png)
12
14
 
13
- 学习使用 Pi 当前模型和已有认证,无需另配 API Key、向量数据库或嵌入服务。
15
+ ## Features
14
16
 
15
- ## 安装
17
+ - **Learn and update automatically.** Capture requirements, corrections and compaction
18
+ summaries. Update tracked project states from tool observations, with provenance,
19
+ history, gradual decay and evidence-aware ranking.
20
+ - **Inject relevant context.** Select memories by the current topic and recent user
21
+ context. Filter weak or stale matches; no relevant match means no unrelated filler.
22
+ - **Recall across sessions.** Find background from another session or directory.
23
+ A read-only `memory_recall` tool lets the assistant look up missing context mid-task.
16
24
 
17
- 需要 **Pi 0.85+**,并已配置可用模型。使用 npm Pi 时需要 **Node.js 22.19+**。
25
+ Learning uses Pi's active model and existing authentication. No separate API key,
26
+ embedding service or vector database is required.
18
27
 
19
- ### npm
28
+ ## Install
29
+
30
+ Requires **Pi 0.85+** with a working model. npm-based Pi requires **Node.js 22.19+**.
20
31
 
21
32
  ```bash
22
33
  pi install npm:pi-memory-evolution
23
34
  ```
24
35
 
25
- ### Git
26
-
27
- 也可以直接安装 Git 默认分支,需要本机有 Git 和 npm:
36
+ Or install the Git default branch, with Git and npm available locally:
28
37
 
29
38
  ```bash
30
39
  pi install https://github.com/btnalit/pi-memory-evolution
31
40
  ```
32
41
 
33
- **两种方式选一种**,不要重复安装。然后在 Pi 中执行:
42
+ Choose **one** source, then run these commands inside Pi:
34
43
 
35
44
  ```text
36
45
  /reload
37
46
  /memory status
38
47
  ```
39
48
 
40
- 出现 `SQLite ok (schema 5)` 表示存储初始化成功。后续正常使用 Pi 即可,学习和召回会自动运行。
49
+ `SQLite ok (schema 5)` confirms storage initialization. Continue using Pi normally;
50
+ learning and recall run automatically.
41
51
 
42
- ## 使用
52
+ ## Use
43
53
 
44
- 在对话中说明需求,例如:
54
+ Describe your requirements in a conversation:
45
55
 
46
56
  ```text
47
- atlas-service 的核心需求是自动备份和故障恢复。
57
+ Our priorities for atlas-service are automatic backups and reliable recovery.
48
58
  ```
49
59
 
50
- 之后可以在新会话中继续询问:
60
+ Later, in a fresh session sharing the same memory store:
51
61
 
52
62
  ```text
53
- 你还记得 atlas-service 的核心需求吗?
63
+ What do you remember about atlas-service's priorities?
54
64
  ```
55
65
 
56
- 学习在后台完成,并非每句话都会保存。可用以下命令查看和维护记忆:
66
+ Learning is asynchronous and selective—not every message becomes a memory.
57
67
 
58
- | 命令 | 用途 |
68
+ | Command | Purpose |
59
69
  | --- | --- |
60
- | `/memory list` | 浏览记忆 |
61
- | `/memory search <主题>` | 搜索相关内容 |
62
- | `/memory show <id>` | 查看内容和来源 |
63
- | `/memory learning` | 查看采集、更新及实际变更结果 |
64
- | `/memory explain` | 查看上一次自动注入的选择原因 |
65
- | `/memory correct <id> <内容>` | 纠正记忆 |
66
- | `/memory forget <id>` | 停止召回该记忆 |
70
+ | `/memory list` | Browse memories |
71
+ | `/memory search <topic>` | Search relevant claims |
72
+ | `/memory show <id>` | Inspect content and evidence |
73
+ | `/memory learning` | Inspect capture and actual update results |
74
+ | `/memory explain` | Explain the last automatic injection |
75
+ | `/memory correct <id> <text>` | Correct a record |
76
+ | `/memory forget <id>` | Suppress a record from recall |
67
77
 
68
- 完整命令、安装迁移和排错方法见[使用指南](docs/usage.md)
78
+ See the [usage guide](docs/usage.md) for all commands, migration and troubleshooting.
69
79
 
70
- ## 更新与卸载
80
+ ## Update or uninstall
71
81
 
72
- npm 安装:
82
+ For the npm installation:
73
83
 
74
84
  ```bash
75
85
  pi update npm:pi-memory-evolution
76
86
  pi remove npm:pi-memory-evolution
77
87
  ```
78
88
 
79
- Git 安装请把上面的包来源替换为安装时使用的仓库 URL。操作后执行 `/reload` 或重启 Pi。卸载扩展不会删除记忆库;升级数据库结构前请先退出共用该库的 Pi 进程并备份。
89
+ For Git, substitute the repository URL used during installation. Reload or restart
90
+ Pi afterward. Uninstalling does not delete memory data. Before a schema-changing
91
+ upgrade, stop Pi processes sharing the database and back up the state directory.
80
92
 
81
- ## 数据与边界
93
+ ## Data and limits
82
94
 
83
- 数据默认保存在 `~/.pi/agent/agent-suite/memory-evolution/`,使用本地 SQLite。`PI_CODING_AGENT_DIR` 可改变存储前缀;不同工作目录默认共享记忆库。
95
+ Local SQLite state lives in `~/.pi/agent/agent-suite/memory-evolution/`.
96
+ `PI_CODING_AGENT_DIR` changes that prefix; different working directories share the
97
+ same store by default.
84
98
 
85
- 学习会将经过过滤的来源内容发送给当前模型,并消耗相应额度。记忆不是经过独立验证的事实,匹配和敏感信息过滤也并非万无一失;重要内容仍需核实。详见[存储与隐私](docs/usage.md#local-storage-and-provenance)。
99
+ Learning sends filtered source content to the active model and consumes its quota.
100
+ Memories are historical evidence, not independently verified facts. Matching and
101
+ secret filtering are imperfect; verify important claims. See [privacy and storage](docs/usage.md#local-storage-and-provenance).
86
102
 
87
- ## 开发
88
-
89
- 在源码仓库中运行:
103
+ ## Development
90
104
 
91
105
  ```bash
92
106
  npm ci --ignore-scripts
93
107
  npm run check
94
108
  npm run test:install
95
109
  npm run test:pi
110
+ npm run build
96
111
  ```
97
112
 
98
- 安装测试使用隔离环境,集成测试使用真实 Pi 和模拟模型,不产生付费模型调用。环境要求和测试范围见[测试说明](docs/testing.md)。
113
+ CI checks types, regressions, package contents, installation and fake-model host
114
+ integration. Builds produce an installable npm archive and checksums, not a separate
115
+ compiled runtime. Release PRs automate versions and changelogs; merging a verified
116
+ release PR triggers npm publication. Dependency updates arrive as gated PRs.
117
+
118
+ See [testing](docs/testing.md) and [release automation](docs/releasing.md).
99
119
 
100
- ## 文档
120
+ ## Documentation
101
121
 
102
- [使用指南](docs/usage.md) · [架构设计](docs/design.md) · [记忆质量](docs/core-quality.md) · [更新记录](CHANGELOG.md)
122
+ [Usage](docs/usage.md) · [Architecture](docs/design.md) · [Memory quality](docs/core-quality.md) · [Changelog](CHANGELOG.md)
103
123
 
104
- ## 许可证
124
+ ## License
105
125
 
106
126
  [MIT](LICENSE)
Binary file
package/docs/design.md CHANGED
@@ -322,7 +322,8 @@ grows until deliberately managed; no automatic purge or physical secret erasure
322
322
  Background model usage is not added to Pi's normal session token accounting.
323
323
 
324
324
  Node/npm development requires 22.19+ to match Pi 0.85's engine; the standalone Bun host is
325
- also tested. There is no installed GitHub Actions workflow: `npm run check` and
326
- `npm run test:pi` run locally. Fake-provider validation is not live-provider accuracy or a
325
+ also tested. GitHub CI runs the regression/package checks and isolated install/host
326
+ scripts; [release automation](releasing.md) reuses those gates before publishing.
327
+ Fake-provider validation is not live-provider accuracy or a
327
328
  multi-day TUI trial. See [README.md](../README.md) for commands/recovery, and the historical
328
329
  [follow-up review](review-0.2.md) for previously reproduced defects and validation limits.
@@ -0,0 +1,128 @@
1
+ # CI and releases
2
+
3
+ ## Pull request gate
4
+
5
+ Use Conventional Commit PR titles, such as `fix: retain work evidence` or
6
+ `feat: improve recall`. Squash merges preserve that title for release automation.
7
+
8
+ `CI` runs on PRs, pushes to `main`, explicit dispatch and a weekly schedule:
9
+
10
+ - Node 22.19.0 and Node 24: typecheck, regression/release-policy tests, package and
11
+ automation assertions, and an npm audit that fails on high/critical findings.
12
+ - Node 24 with explicit npm 10 and 12: checks, native installation and package builds;
13
+ both npm compatibility lanes are mandatory parts of the gate.
14
+ - Node 24: native Pi installation tests and real-host/fake-model integration.
15
+ - Workflow syntax checks with a checksum-pinned actionlint binary.
16
+ - Build an npm tarball, `SHA256SUMS` and a source-commit/integrity manifest. Pi loads
17
+ TypeScript directly, so building means packaging, not compiling a second runtime.
18
+
19
+ The final **Quality gate** fails if any prerequisite fails, is cancelled or is skipped.
20
+ `main` requires a PR, an up-to-date successful gate and resolved conversations, with
21
+ force pushes/deletion blocked. In this single-maintainer repository, the gate does
22
+ not require a second person's approval. It does not automatically merge arbitrary
23
+ PRs or claim a human code review occurred.
24
+
25
+ CI uses read-only GitHub tokens, no production credentials and no paid model calls.
26
+ Actions are pinned by full commit SHA; checkouts do not persist credentials.
27
+ Workflow policy changes still need maintainer review—tests are not a substitute
28
+ for reviewing a malicious workflow or dependency change.
29
+
30
+ ## Version and publication flow
31
+
32
+ 1. Merge a checked change into `main`.
33
+ 2. Release Please maintains a release PR containing `package.json`, lockfile,
34
+ `.release-please-manifest.json` and `CHANGELOG.md` changes.
35
+ 3. Review and merge that PR. Release Please creates the version tag and GitHub
36
+ Release; the same workflow verifies the exact tagged commit through the full CI.
37
+ 4. Only after verification succeeds does the `npm` environment publish the built
38
+ archive with npm provenance and verify its public registry integrity.
39
+ 5. The tarball, checksums and manifest are attached to the GitHub Release.
40
+
41
+ A GitHub tag/release can exist before npm publication succeeds. Check the **Release**
42
+ workflow and npm registry, not just the presence of the tag. Builds are retained as
43
+ Actions artifacts for seven days; successful release assets remain attached to the
44
+ release. The script never rebuilds between verification and publication.
45
+
46
+ Release Please uses the built-in `GITHUB_TOKEN`, not a personal GitHub credential.
47
+ Because events generated by that token do not start normal push/PR workflows,
48
+ it explicitly dispatches CI for its same-repository release PRs. Publication is a
49
+ job in the same workflow, not a separate listener waiting for a suppressed event.
50
+ GitHub can additionally create a bot-PR run with `action_required`. If that run blocks
51
+ PR checks, a maintainer must review the changes and approve that run in Actions;
52
+ a successful dispatch alone does not override GitHub's platform approval policy.
53
+ The initial rollout required this approval. The workflow does not self-approve or
54
+ delete blocked checks to bypass it.
55
+
56
+ Version behavior follows Conventional Commits. `fix` normally bumps patch, `feat`
57
+ bumps minor, and breaking changes before 1.0 bump minor. Visible maintenance/docs/CI
58
+ changes can also produce release notes. The bootstrap starts after the already
59
+ published 0.2.0 commit; it does not republish 0.1 history.
60
+
61
+ ## Publication credentials
62
+
63
+ The GitHub environment **npm** accepts deployments from `main` only. No environment
64
+ secret is given to the reusable CI jobs or ordinary PR checks. Only the publishing
65
+ step receives `NPM_TOKEN` when the repository variable `NPM_AUTH_MODE=token` is set.
66
+ No personal GitHub token is stored in Actions.
67
+
68
+ Prefer npm trusted publishing (OIDC): configure `btnalit/pi-memory-evolution`,
69
+ workflow **release.yml**, environment **npm** on the package's npm settings page.
70
+ Then set `NPM_AUTH_MODE=oidc`, verify a release, and remove the environment's
71
+ `NPM_TOKEN`. `id-token: write` is already granted only to the publication job.
72
+
73
+ The supplied npm token can publish but cannot configure trust relationships:
74
+ npm rejects that account-management operation for granular tokens that bypass 2FA.
75
+ Until an account owner completes trusted-publisher setup with supported interactive
76
+ authentication, the environment-scoped token is the explicit fallback, not a claim
77
+ that OIDC authentication is active. Use a package-scoped, short-lived token and
78
+ rotate it before expiry. Do not commit tokens or copy local `key.conf` into CI.
79
+
80
+ Repository settings must allow Actions to create pull requests. The setting also
81
+ mentions approving PRs; this workflow creates them but does not approve them.
82
+
83
+ ## Retrying a release
84
+
85
+ From Actions, dispatch **Release** on `main` with `tag=vX.Y.Z`, or run:
86
+
87
+ ```bash
88
+ gh workflow run release.yml --ref main -f tag=v0.2.1
89
+ ```
90
+
91
+ The workflow requires an existing stable GitHub Release whose commit belongs to
92
+ `main`, reruns verification and checks the version against the archive manifest.
93
+ An already published version is accepted only when npm's integrity matches exactly.
94
+ It never overwrites a version or moves `latest` backwards. Existing release assets
95
+ must have matching digests; mismatches stop rather than silently using `--clobber`.
96
+ Retry the original failed workflow when possible so the original artifact remains
97
+ available. Rebuilding with different tooling may legitimately produce different
98
+ bytes and require investigation, not bypassing the integrity check.
99
+
100
+ A cancelled or failed npm call is not proof nothing was published: the registry
101
+ check on retry handles that case. Do not delete/recreate tags or edit registry
102
+ metadata to disguise a failed release.
103
+
104
+ ## Dependency updates and Pi Gallery
105
+
106
+ Dependabot checks npm dev dependencies and GitHub Actions weekly. Minor/patch updates
107
+ are grouped; majors stay separate. Updates arrive as PRs and must pass the same
108
+ gate; no blanket auto-merge is enabled. GitHub vulnerability alerts/security update
109
+ PRs complement the scheduled audit. Transitive runtime dependencies are not bundled
110
+ just to satisfy host-provided Pi peer APIs.
111
+
112
+ The package already uses the Pi `pi` manifest and `pi-package` keyword. Distribution
113
+ checks retain both, the English npm description/default README, `README.cn.md`,
114
+ and a PNG overview referenced by `pi.image`. This provides Gallery discovery and
115
+ preview metadata, not an official endorsement or a guarantee of immediate indexing.
116
+ The overview is an architecture illustration, not a screenshot of a real user session.
117
+
118
+ ## Local checks
119
+
120
+ ```bash
121
+ npm run check
122
+ npm run test:install
123
+ npm run test:pi
124
+ bash scripts/check-workflows.sh # Linux x86-64; downloads checksum-pinned actionlint
125
+ npm run build
126
+ ```
127
+
128
+ See [testing](testing.md) for fixture isolation and model-validation boundaries.
package/docs/testing.md CHANGED
@@ -9,14 +9,49 @@ Tests use synthetic data and temporary directories, not production memories.
9
9
  npm run check
10
10
  ```
11
11
 
12
- This runs strict TypeScript checking, the `src/**/*.test.ts` regression suite and
13
- `check:package`. Package checking asserts that the Pi manifest points to the current
12
+ This runs strict TypeScript checking, the `src/**/*.test.ts` regression suite,
13
+ `scripts/*.test.mjs` release-policy tests, `check:package` and `check:automation`. Package checking asserts that the Pi manifest points to the current
14
14
  entry, host APIs remain peer dependencies, all production TypeScript sources are
15
15
  packed, and local documentation links resolve to packaged files. Test sources,
16
16
  helper scripts and memory state must not ship in the package.
17
17
 
18
18
  `check:package` inspects `npm pack --dry-run --json`; it does not publish to npm.
19
19
 
20
+ ## npm CLI compatibility
21
+
22
+ All consumers of `npm pack --json` share `scripts/lib/npm-pack.mjs`. npm 10/11
23
+ return an array; npm 12 returns a package-name map. The helper accepts both and
24
+ rejects invalid, empty, multi-package or mismatched results rather than picking an
25
+ arbitrary package. It is development tooling, not part of the runtime tarball.
26
+
27
+ CI explicitly installs and verifies npm majors **10 and 12** on Node 24, and runs
28
+ checks, installation and packaging in both lanes. The ordinary Node 22/24 jobs
29
+ also exercise their bundled npm. Node version alone does not define coverage of an
30
+ npm major. The pinned setup-node action has no `npm-version` input, so selecting
31
+ npm uses an explicit `npm install --global --ignore-scripts` step instead.
32
+
33
+ For local reproduction without changing the global npm installation:
34
+
35
+ ```bash
36
+ npx --yes npm@12 run check
37
+ npx --yes npm@12 run test:install
38
+ npx --yes npm@10 run check
39
+ npx --yes npm@10 run test:install
40
+ ```
41
+
42
+ For an older checkout whose pack parser still fails under npm 12, the npm 10
43
+ commands are a temporary workaround until you update. `npm run` retains the npx
44
+ npm shim on PATH, so nested `execFileSync('npm', ...)` calls use the selected CLI;
45
+ the installation test prints the actual Node/Pi/npm versions. Declaring npm in
46
+ `engines` can document a requirement, but does not replace compatible parsing or
47
+ explicit version testing.
48
+
49
+ npm 12 also gates dependency lifecycle scripts through its script-allow policy.
50
+ This repository installs with `--ignore-scripts`; do not turn on all scripts merely
51
+ to make an installation pass. If a future dependency requires postinstall compilation,
52
+ review that dependency and update the isolated tests/policy explicitly. Pi's bundled
53
+ runtime and currently tested dependencies work with scripts disabled.
54
+
20
55
  ## Installation smoke test
21
56
 
22
57
  ```bash
@@ -44,6 +79,10 @@ host explicitly. The script prints the tested host version. The test:
44
79
  6. Serves the actual tarball through a loopback npm registry, with a fresh cache,
45
80
  then checks native `pi install npm:pi-memory-evolution`, repeat installation,
46
81
  normal loading and removal. No host peer packages are served or installed.
82
+ 7. Intentionally installs local and npm copies together, reproduces the host's
83
+ duplicate `memory_recall` failure, removes the unwanted source through the CLI,
84
+ and verifies startup and unchanged memory/history. This is configuration recovery,
85
+ not silently choosing which installed version should win.
47
86
 
48
87
  The test whitelists child environment variables, gives Pi a fresh agent directory
49
88
  and HOME, disables startup network operations, and uses private npm caches/config with
@@ -98,5 +137,8 @@ product acceptance. Historical design/review documents describe their own tested
98
137
  revisions; see [progress pipeline](progress-pipeline.md), [core quality](core-quality.md)
99
138
  and [quality validation](quality-validation.md) for context.
100
139
 
101
- No GitHub Actions workflow is configured. Run the local checks before submitting
102
- changes; the Pi-dependent scripts are explicit commands, not part of `npm run check`.
140
+ GitHub Actions runs these checks and the Pi-dependent scripts before the required
141
+ Quality gate passes. The install/host scripts remain separate local commands, not
142
+ part of `npm run check`. Release verification uses the same CI workflow on the exact
143
+ tagged commit. See [CI and releases](releasing.md) for branch protection, dependency
144
+ updates, publication credentials and retry behavior.
package/docs/usage.md CHANGED
@@ -57,6 +57,31 @@ the old source before switching between npm/Git/local forms, which Pi treats as
57
57
  different package identities. `pi remove <source>` does not erase memory state.
58
58
  Restart or `/reload` all sessions using the extension after changing versions.
59
59
 
60
+ ### Recovering from duplicate installation sources
61
+
62
+ Pi treats npm, Git and local paths as different package identities. Installing the
63
+ same source twice is idempotent, but keeping both a dev checkout and an npm copy can
64
+ register `memory_recall` twice and prevent Pi from starting. Updating either copy
65
+ does not remove the other. This is not a failure of a single-source upgrade.
66
+
67
+ Use terminal commands, not commands inside the broken Pi session:
68
+
69
+ ```bash
70
+ pi list
71
+ # Keep npm; remove the local source shown by pi list:
72
+ pi remove /absolute/path/to/pi-memory-evolution
73
+ # Or keep the checkout; remove npm instead:
74
+ # pi remove npm:pi-memory-evolution
75
+ ```
76
+
77
+ Choose only the removal matching your intended source. If installed project-locally,
78
+ run `pi list --approve` and `pi remove <source> -l --approve` from that trusted project.
79
+ A manually configured `extensions` entry is not a package entry: remove that explicit
80
+ entry from the appropriate settings file as well. Then restart Pi and run
81
+ `/memory status`. Package CLI operations work without loading the conflicting
82
+ extensions, and removal leaves memory data intact. Do not delete the database or
83
+ rename the tool to hide the conflict; an old installation would still run its hooks.
84
+
60
85
  ## What happens automatically
61
86
 
62
87
  - A successful `session_compact` saves a sanitized source and extracts up to 16
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pi-memory-evolution",
3
- "version": "0.2.0",
3
+ "version": "0.2.2",
4
4
  "description": "Automatic cross-session memory using Pi's active model, transactional local storage, and topic-based recall across directories.",
5
5
  "license": "MIT",
6
6
  "publishConfig": {
@@ -31,6 +31,8 @@
31
31
  "!src/**/*.test.ts",
32
32
  "docs",
33
33
  "README.md",
34
+ "README.cn.md",
35
+ "assets/overview.png",
34
36
  "CHANGELOG.md",
35
37
  "LICENSE",
36
38
  "package.json"
@@ -38,24 +40,28 @@
38
40
  "pi": {
39
41
  "extensions": [
40
42
  "./src/index.ts"
41
- ]
43
+ ],
44
+ "image": "https://raw.githubusercontent.com/btnalit/pi-memory-evolution/main/assets/overview.png"
42
45
  },
43
46
  "peerDependencies": {
44
47
  "@earendil-works/pi-coding-agent": "*",
45
48
  "typebox": "*"
46
49
  },
47
50
  "scripts": {
48
- "test": "node --test \"src/**/*.test.ts\"",
51
+ "test": "node --test \"src/**/*.test.ts\" \"scripts/*.test.mjs\"",
49
52
  "typecheck": "tsc --noEmit",
50
53
  "test:pi": "node scripts/test-pi.mjs",
51
54
  "test:install": "node scripts/test-install.mjs",
52
- "check": "npm run typecheck && npm test && npm run check:package",
55
+ "check": "npm run typecheck && npm test && npm run check:package && npm run check:automation",
56
+ "check:automation": "node scripts/check-automation.mjs",
57
+ "build": "node scripts/build-package.mjs",
53
58
  "check:package": "node scripts/check-package.mjs"
54
59
  },
55
60
  "devDependencies": {
56
- "@earendil-works/pi-coding-agent": "0.85.0",
57
- "@types/node": "22.18.0",
58
- "typescript": "5.9.3",
59
- "typebox": "1.3.7"
61
+ "@earendil-works/pi-coding-agent": "0.85.1",
62
+ "@types/node": "22.20.1",
63
+ "typebox": "1.3.27",
64
+ "typescript": "7.0.2",
65
+ "yaml": "2.9.0"
60
66
  }
61
67
  }