@chendpoc/pi-memory 0.2.1 → 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/README.md CHANGED
@@ -1,3 +1,7 @@
1
+ <p align="center">
2
+ <img src="./assets/pi-memory-logo.png" alt="pi-memory logo" width="720" />
3
+ </p>
4
+
1
5
  # @chendpoc/pi-memory
2
6
 
3
7
  <p align="center">
@@ -9,7 +13,7 @@ Cross-session episodic memory for the [Pi coding agent](https://pi.dev).
9
13
 
10
14
  `pi-memory` gives Pi a local, auditable memory layer across sessions. It keeps durable facts in **`MEMORY.md` as the source of truth**, derives a vector index in `memory.vec.sqlite`, and injects relevant private context through Preflight before the main model answers.
11
15
 
12
- ## What It Does
16
+ ## 🧠 What It Does
13
17
 
14
18
  Pi already has compaction for long sessions. That solves "this conversation is too long"; it does not solve "a new session forgot my preferences, project conventions, prior decisions, and unresolved todos."
15
19
 
@@ -21,14 +25,15 @@ durable facts -> MEMORY.md -> derived vector index -> per-turn Preflight recall
21
25
 
22
26
  It provides:
23
27
 
24
- - **Explicit memory** through `/remember`.
25
- - **Automatic durable fact export** from Pi compaction.
26
- - **Shutdown queue recovery** for short or missed sessions.
27
- - **Per-turn private recall** before the main model runs.
28
- - **Human-editable storage** in Markdown, with vector search as a rebuildable index.
29
- - **Offline maintenance** for consolidation, dedupe, overflow handling, and queue draining.
28
+ - ✍️ **Explicit memory** through `/remember`.
29
+ - 🔁 **Automatic durable fact export** from Pi compaction.
30
+ - 📥 **Shutdown queue recovery** for short or missed sessions.
31
+ - 🔦 **Per-turn private recall** before the main model runs.
32
+ - 📄 **Human-editable storage** in Markdown, with vector search as a rebuildable index.
33
+ - 🔌 **Local UDS sidecar** for vector retrieval and reindexing, without opening an HTTP port.
34
+ - ⏳ **Daemon-friendly maintenance**: shutdown enqueues metadata, while consolidation and queue draining can run offline.
30
35
 
31
- ## Installation
36
+ ## 📦 Installation
32
37
 
33
38
  Requirements:
34
39
 
@@ -36,10 +41,10 @@ Requirements:
36
41
  - pnpm
37
42
  - Pi extension runtime packages supplied by Pi
38
43
 
39
- Install as a package in the Pi extension environment:
44
+ Install from Pi:
40
45
 
41
46
  ```bash
42
- pnpm add @chendpoc/pi-memory
47
+ pi install npm:@chendpoc/pi-memory
43
48
  ```
44
49
 
45
50
  For local development from this repository:
@@ -61,17 +66,29 @@ Enable the extension through Pi's extension loading mechanism. This package decl
61
66
  }
62
67
  ```
63
68
 
64
- Initialize memory explicitly when needed:
69
+ ### 🌱 Memory workspace (automatic)
70
+
71
+ You usually **do not need to run `pi-memory init` manually**. The same bootstrap (`initializeMemoryWorkspace`) runs automatically and **never overwrites a non-empty `MEMORY.md`**:
72
+
73
+ | When | What happens |
74
+ | --- | --- |
75
+ | **`pnpm install`** | `postinstall` runs `pi-memory init` (or a pre-build fallback) |
76
+ | **First Pi session** | `session_start` → `MemoryStore.ensureInitialized()` |
77
+ | **Manual (optional)** | `pi-memory init` |
78
+
79
+ Run `pi-memory init` explicitly only when:
80
+
81
+ - You set **`PI_MEMORY_AGENT_DIR`** after install (postinstall may have seeded the default path).
82
+ - Install scripts were skipped (`--ignore-scripts` or corporate policy).
83
+ - You want to bootstrap before opening Pi, or verify setup with `pi-memory status`.
65
84
 
66
85
  ```bash
67
- pi-memory init
86
+ pi-memory init # optional; see above
68
87
  ```
69
88
 
70
- Initialization never overwrites a non-empty `MEMORY.md`.
71
-
72
- ## Why Choose `pi-memory`
89
+ ## Why Choose `pi-memory`
73
90
 
74
- ### Agent Before / After
91
+ ### 🔄 Agent Before / After
75
92
 
76
93
  | Situation | Without `pi-memory` | With `pi-memory` |
77
94
  | --- | --- | --- |
@@ -82,18 +99,30 @@ Initialization never overwrites a non-empty `MEMORY.md`.
82
99
  | Vector sidecar is down | A hard dependency would break the turn. | Preflight silently falls back to Markdown or injects nothing; the model still runs. |
83
100
  | Memory grows | A file can become noisy and unbounded. | 150-line `MEMORY.md` cap, `auto-*.md` overflow, consolidate merge/dedupe. |
84
101
 
85
- ### Key Advantages
102
+ ### 🌟 Key Advantages
86
103
 
87
- - **Markdown Ground Truth**: `MEMORY.md` and `auto-*.md` can be opened, reviewed, edited, grepped, copied, or versioned.
88
- - **Derived index, not hidden state**: `memory.vec.sqlite` can be deleted and rebuilt from Markdown.
89
- - **Preflight recall**: Memory is injected before the main model answers instead of hoping the model calls a search tool.
90
- - **Hot-path budget**: Default Preflight budget is **800ms**, with QueryIntent, sidecar query, and fallback all bounded.
91
- - **Protected user notes**: `/remember` writes `[user]` entries that consolidate must not remove or rewrite.
92
- - **Sidecar isolation**: embedding, vector scan, MMR, stats, and reindex run outside the extension process, while writes stay owned by `MemoryStore`.
93
- - **Subagent policy**: root sessions get Memory Cap + Episodic Preflight; subagents get Memory Cap only by default.
94
- - **Graceful fallback**: if sidecar recall is empty, timed out, or unavailable, the turn still runs.
104
+ - 📓 **Markdown Ground Truth**: `MEMORY.md` and `auto-*.md` can be opened, reviewed, edited, grepped, copied, or versioned.
105
+ - 🏗️ **Derived index, not hidden state**: `memory.vec.sqlite` can be deleted and rebuilt from Markdown.
106
+ - 🔎 **Preflight recall**: Memory is injected before the main model answers instead of hoping the model calls a search tool.
107
+ - ⏱️ **Hot-path budget**: Default Preflight budget is **800ms**, with QueryIntent, sidecar query, and fallback all bounded.
108
+ - 🔒 **Protected user notes**: `/remember` writes `[user]` entries that consolidate must not remove or rewrite.
109
+ - 🔗 **UDS, not HTTP**: the agent talks to the sidecar over `node:net` Unix domain sockets with JSONL frames, so there is no local HTTP server or port to secure.
110
+ - 🏭 **Sidecar process isolation**: embedding, vector scan, MMR, stats, and reindex run in a spawned Node process, while writes stay owned by `MemoryStore`.
111
+ - 💤 **Daemon-safe writes**: `session_shutdown` only appends metadata; heavier consolidation and shutdown-queue draining are intended for `pi-memory maintenance` or background scheduling.
112
+ - 👥 **Subagent policy**: root sessions get Memory Cap + Episodic Preflight; subagents get Memory Cap only by default.
113
+ - ☂️ **Graceful fallback**: if sidecar recall is empty, timed out, or unavailable, the turn still runs.
114
+
115
+ ### ⚙️ Runtime Choices
116
+
117
+ | Choice | Why it matters |
118
+ | --- | --- |
119
+ | `MEMORY.md` as Ground Truth | Durable memory remains inspectable and editable instead of becoming opaque database state. |
120
+ | UDS JSONL over `node:net` | Local IPC stays private to the machine, avoids HTTP ports, and keeps request/response framing simple. |
121
+ | Spawned sidecar process | Vector query/reindex work is isolated from the Pi extension process; failures degrade to Markdown fallback. |
122
+ | Offline `maintenance` job | Consolidation and shutdown-queue draining can run outside the interactive agent turn. |
123
+ | Bounded Preflight | QueryIntent, sidecar query, cache, and fallback all share a tight latency budget. |
95
124
 
96
- ### Comparison
125
+ ### ⚖️ Comparison
97
126
 
98
127
  `pi-memory` is not trying to be every memory system. The value is a specific Pi-native loop: Markdown ground truth, Preflight injection, sidecar retrieval, compaction export, and offline maintenance.
99
128
 
@@ -115,9 +144,9 @@ Where other systems are stronger:
115
144
  - Mem0: hosted multi-tenant memory API.
116
145
  - Letta: autonomous context repositories and sleep-time memory work.
117
146
 
118
- ## How It Works
147
+ ## ⚙️ How It Works
119
148
 
120
- ### Architecture
149
+ ### 🏗️ Architecture
121
150
 
122
151
  ```text
123
152
  Pi extension process
@@ -142,14 +171,14 @@ Pi extension process
142
171
  `- consolidate scheduler
143
172
  `- merge/dedupe -> rewrite Ground Truth -> reindex
144
173
 
145
- Sidecar process over UDS JSONL
174
+ Sidecar process over UDS JSONL (`node:net`, no HTTP port)
146
175
  |- ping
147
176
  |- stats
148
177
  |- query: embed -> cosine scan -> MMR
149
178
  `- reindex: upsert chunks into memory.vec.sqlite
150
179
  ```
151
180
 
152
- ### Read Path
181
+ ### 🔎 Read Path
153
182
 
154
183
  Root session:
155
184
 
@@ -174,7 +203,7 @@ Sidecar results
174
203
  -> if empty: no injection
175
204
  ```
176
205
 
177
- ### Write Paths
206
+ ### ✍️ Write Paths
178
207
 
179
208
  | Path | Trigger | LLM? | Blocking? | Purpose |
180
209
  | --- | --- | --- | --- | --- |
@@ -183,7 +212,7 @@ Sidecar results
183
212
  | Shutdown Queue | `session_shutdown` + `pi-memory maintenance` | Only offline, when no compaction summary exists | No during shutdown | Recover facts from short or missed sessions |
184
213
  | Consolidate | overflow >= 12, 7 days, or daily cron | Optional | Offline/background | Dedupe, merge, prune obsolete todos |
185
214
 
186
- ## Data And Memory Format
215
+ ## 💾 Data And Memory Format
187
216
 
188
217
  All artifacts live under one memory agent directory.
189
218
 
@@ -233,7 +262,7 @@ Rules:
233
262
  - Overflow entries spill to `auto-*.md`, with a pointer in `MEMORY.md`.
234
263
  - Vector chunks are derived from entries; by default long entries split beyond `PI_MEMORY_CHUNK_MAX_CHARS=512`.
235
264
 
236
- ## Configuration
265
+ ## 🎛️ Configuration
237
266
 
238
267
  Optional env file locations are loaded in this order:
239
268
 
@@ -262,7 +291,7 @@ Common variables:
262
291
 
263
292
  See [`.env.example`](./.env.example) for the full list.
264
293
 
265
- ### Embedders
294
+ ### 🛰️ Embedders
266
295
 
267
296
  | Embedder | Use When | Notes |
268
297
  | --- | --- | --- |
@@ -272,7 +301,7 @@ See [`.env.example`](./.env.example) for the full list.
272
301
 
273
302
  The Vector Index stores embedding provider, model, and dimension metadata. When they change, old chunks are cleared and rebuilt.
274
303
 
275
- ## Commands
304
+ ## ⌨️ Commands
276
305
 
277
306
  Inside Pi:
278
307
 
@@ -284,11 +313,11 @@ Inside Pi:
284
313
  CLI:
285
314
 
286
315
  ```bash
287
- pi-memory init
288
316
  pi-memory status
289
317
  pi-memory maintenance --cron --verbose
290
318
  pi-memory consolidate --force --verbose
291
319
  pi-memory drain-shutdown-queue --verbose
320
+ pi-memory init # optional — usually automatic after install + first session
292
321
  ```
293
322
 
294
323
  `maintenance` is the recommended scheduler entrypoint:
@@ -304,7 +333,7 @@ Scheduler templates:
304
333
  - [`templates/consolidate.cmd.example`](./templates/consolidate.cmd.example)
305
334
  - [`templates/schtasks.example.txt`](./templates/schtasks.example.txt)
306
335
 
307
- ## Diagnostics
336
+ ## 🩺 Diagnostics
308
337
 
309
338
  Use `/memory-status` or `pi-memory status` to inspect:
310
339
 
@@ -335,7 +364,7 @@ Use `PI_MEMORY_DEBUG=1` to log Preflight timings:
335
364
  }
336
365
  ```
337
366
 
338
- ## Non-Goals
367
+ ## 🚫 Non-Goals
339
368
 
340
369
  - Replacing Pi compaction.
341
370
  - Replacing session search; use a dedicated session-search extension for old conversations.
@@ -344,7 +373,7 @@ Use `PI_MEMORY_DEBUG=1` to log Preflight timings:
344
373
  - Storing full chat transcripts as memory.
345
374
  - Adding multi-second reflection to every user turn.
346
375
 
347
- ## Development
376
+ ## 🛠️ Development
348
377
 
349
378
  ```bash
350
379
  pnpm typecheck
@@ -354,12 +383,12 @@ pnpm build
354
383
 
355
384
  The sidecar IPC test opens a Unix domain socket. If it fails with `listen EPERM` inside a restricted sandbox, run the test in a normal local shell.
356
385
 
357
- ## Docs
386
+ ## 📚 Docs
358
387
 
359
388
  - [Chinese README](./doc/README-zh.md)
360
389
  - [Roadmap](./doc/ROADMAP.md)
361
390
  - [UBIQUITOUS_LANGUAGE.md](./UBIQUITOUS_LANGUAGE.md) - domain glossary
362
391
 
363
- ## License
392
+ ## 📜 License
364
393
 
365
394
  MIT
Binary file
package/doc/README-zh.md CHANGED
@@ -1,3 +1,7 @@
1
+ <p align="center">
2
+ <img src="../assets/pi-memory-logo.png" alt="pi-memory logo" width="720" />
3
+ </p>
4
+
1
5
  # @chendpoc/pi-memory
2
6
 
3
7
  <p align="center">
@@ -9,7 +13,7 @@ Pi coding agent 的跨 session 情景记忆扩展。
9
13
 
10
14
  `pi-memory` 给 Pi 增加一层本地、可审计的跨 session 记忆。它把长期事实保存在 **`MEMORY.md` 这个 Ground Truth** 里,把 `memory.vec.sqlite` 作为派生向量索引,并在主模型回答前通过 Preflight 注入相关的私有上下文。
11
15
 
12
- ## 这个 Package 做什么
16
+ ## 🧠 这个 Package 做什么
13
17
 
14
18
  Pi 已经有长 session compaction,它解决的是“当前对话太长了怎么办”;但它不解决“新开 session 后忘记用户偏好、项目约定、历史决策和未完成 TODO”的问题。
15
19
 
@@ -21,14 +25,15 @@ Pi 已经有长 session compaction,它解决的是“当前对话太长了怎
21
25
 
22
26
  它提供:
23
27
 
24
- - 通过 `/remember` 写入显式记忆。
25
- - 从 Pi compaction 自动导出长期事实。
26
- - 用 Shutdown Queue 补捞短 session 或漏处理 session。
27
- - 在主模型运行前做每轮私有记忆召回。
28
- - 用 Markdown 保存人类可编辑的事实,向量搜索只是可重建索引。
29
- - 离线 maintenance 负责 consolidate、去重、overflow 处理和 queue drain。
28
+ - ✍️ 通过 `/remember` 写入显式记忆。
29
+ - 🔁 从 Pi compaction 自动导出长期事实。
30
+ - 📥 用 Shutdown Queue 补捞短 session 或漏处理 session。
31
+ - 🔦 在主模型运行前做每轮私有记忆召回。
32
+ - 📄 用 Markdown 保存人类可编辑的事实,向量搜索只是可重建索引。
33
+ - 🔌 通过本地 UDS sidecar 做向量召回和 reindex,不打开 HTTP 端口。
34
+ - ⏳ daemon 友好的维护路径:shutdown 只追加元数据,consolidate 和 queue drain 可以离线执行。
30
35
 
31
- ## 安装与启用
36
+ ## 📦 安装与启用
32
37
 
33
38
  要求:
34
39
 
@@ -36,10 +41,10 @@ Pi 已经有长 session compaction,它解决的是“当前对话太长了怎
36
41
  - pnpm
37
42
  - Pi 提供的 extension runtime packages
38
43
 
39
- Pi extension 环境中安装包:
44
+ 通过 Pi 安装:
40
45
 
41
46
  ```bash
42
- pnpm add @chendpoc/pi-memory
47
+ pi install npm:@chendpoc/pi-memory
43
48
  ```
44
49
 
45
50
  从本仓库本地开发:
@@ -61,17 +66,29 @@ pnpm test
61
66
  }
62
67
  ```
63
68
 
64
- 需要时可显式初始化记忆:
69
+ ### 🌱 记忆工作区(自动初始化)
70
+
71
+ **大多数用户不需要手动运行 `pi-memory init`。** 同一套 bootstrap(`initializeMemoryWorkspace`)会自动执行,且**不会覆盖非空的 `MEMORY.md`**:
72
+
73
+ | 时机 | 行为 |
74
+ | --- | --- |
75
+ | **`pnpm install`** | `postinstall` 执行 `pi-memory init`(或 pre-build 回退脚本) |
76
+ | **首次 Pi session** | `session_start` → `MemoryStore.ensureInitialized()` |
77
+ | **手动(可选)** | `pi-memory init` |
78
+
79
+ 仅在以下情况需要显式运行 `pi-memory init`:
80
+
81
+ - 安装**之后**才设置 **`PI_MEMORY_AGENT_DIR`**(postinstall 可能已按默认路径初始化)。
82
+ - 安装脚本被跳过(`--ignore-scripts` 或企业策略)。
83
+ - 想在打开 Pi 之前先 bootstrap,或配合 `pi-memory status` 做排查。
65
84
 
66
85
  ```bash
67
- pi-memory init
86
+ pi-memory init # 可选;见上文
68
87
  ```
69
88
 
70
- 初始化不会覆盖非空 `MEMORY.md`。
71
-
72
- ## 为什么选择 `pi-memory`
89
+ ## ✨ 为什么选择 `pi-memory`
73
90
 
74
- ### Agent 使用前后差异
91
+ ### 🔄 Agent 使用前后差异
75
92
 
76
93
  | 场景 | 未使用 `pi-memory` | 使用 `pi-memory` 后 |
77
94
  | --- | --- | --- |
@@ -82,18 +99,30 @@ pi-memory init
82
99
  | 向量 sidecar 不可用 | 如果是硬依赖,会直接影响对话。 | Preflight 静默回退到 Markdown 或空注入,主模型照常运行。 |
83
100
  | 记忆持续增长 | 文件容易变成无边界流水账。 | `MEMORY.md` 150 行上限,`auto-*.md` 溢出,consolidate 合并去重。 |
84
101
 
85
- ### 核心优势
102
+ ### 🌟 核心优势
86
103
 
87
- - **Markdown Ground Truth**:`MEMORY.md` 和 `auto-*.md` 可以直接打开、审查、编辑、grep、复制或纳入版本控制。
88
- - **索引不是隐藏事实源**:`memory.vec.sqlite` 可以删除,并从 Markdown 重新构建。
89
- - **Preflight 召回**:记忆在主模型回答前注入,而不是依赖模型主动调用搜索工具。
90
- - **热路径有预算**:默认 Preflight 预算是 **800ms**,QueryIntent、sidecar query 和 fallback 都有边界。
91
- - **用户显式记忆受保护**:`/remember` 写入 `[user]` 条目,consolidate 不能删除或改写。
92
- - **Sidecar 隔离**:embedding、向量扫描、MMR、statsreindex 在扩展进程外运行;写入仍由 `MemoryStore` 负责。
93
- - **Subagent 策略**:root session Memory Cap + Episodic Preflight;subagent 默认只拿 Memory Cap。
94
- - **优雅降级**:sidecar 召回为空、超时或不可用时,当前 turn 仍然继续。
104
+ - 📓 **Markdown Ground Truth**:`MEMORY.md` 和 `auto-*.md` 可以直接打开、审查、编辑、grep、复制或纳入版本控制。
105
+ - 🏗️ **索引不是隐藏事实源**:`memory.vec.sqlite` 可以删除,并从 Markdown 重新构建。
106
+ - 🔎 **Preflight 召回**:记忆在主模型回答前注入,而不是依赖模型主动调用搜索工具。
107
+ - ⏱️ **热路径有预算**:默认 Preflight 预算是 **800ms**,QueryIntent、sidecar query 和 fallback 都有边界。
108
+ - 🔒 **用户显式记忆受保护**:`/remember` 写入 `[user]` 条目,consolidate 不能删除或改写。
109
+ - 🔗 **UDS,不走 HTTP**:agent 通过 `node:net` Unix domain socket + JSONL frame sidecar 通信,不需要本地 HTTP server,也没有额外端口暴露。
110
+ - 🏭 **Sidecar 进程隔离**:embedding、向量扫描、MMR、stats reindex 在独立 spawn Node 进程中运行;写入仍由 `MemoryStore` 负责。
111
+ - 💤 **daemon-safe 写入路径**:`session_shutdown` 只追加元数据;更重的 consolidate 和 shutdown-queue drain 交给 `pi-memory maintenance` 或后台调度。
112
+ - 👥 **Subagent 策略**:root session 跑 Memory Cap + Episodic Preflight;subagent 默认只拿 Memory Cap。
113
+ - ☂️ **优雅降级**:sidecar 召回为空、超时或不可用时,当前 turn 仍然继续。
114
+
115
+ ### ⚙️ Runtime 选择
116
+
117
+ | 选择 | 为什么重要 |
118
+ | --- | --- |
119
+ | `MEMORY.md` 作为 Ground Truth | 长期记忆保持可审查、可编辑,而不是变成不透明数据库状态。 |
120
+ | 基于 `node:net` 的 UDS JSONL | IPC 只在本机发生,避免 HTTP 端口,同时保持简单的 request/response frame。 |
121
+ | spawn 独立 sidecar 进程 | 向量 query/reindex 与 Pi extension 进程隔离;失败时可降级到 Markdown fallback。 |
122
+ | 离线 `maintenance` job | consolidate 和 shutdown-queue drain 可以在交互 turn 之外执行。 |
123
+ | 有预算的 Preflight | QueryIntent、sidecar query、cache 和 fallback 都在明确延迟边界内运行。 |
95
124
 
96
- ### 对比
125
+ ### ⚖️ 对比
97
126
 
98
127
  `pi-memory` 不试图成为所有 memory 系统的集合。它的价值是一个 Pi-native 闭环:Markdown ground truth、Preflight 注入、sidecar 检索、compaction export 和离线 maintenance。
99
128
 
@@ -115,9 +144,9 @@ pi-memory init
115
144
  - Mem0:托管多租户 memory API。
116
145
  - Letta:自主 context repository 和 sleep-time memory work。
117
146
 
118
- ## 工作方式
147
+ ## ⚙️ 工作方式
119
148
 
120
- ### 架构
149
+ ### 🏗️ 架构
121
150
 
122
151
  ```text
123
152
  Pi 扩展进程
@@ -142,14 +171,14 @@ Pi 扩展进程
142
171
  `- consolidate scheduler
143
172
  `- 合并/去重 -> 重写 Ground Truth -> reindex
144
173
 
145
- 通过 UDS JSONL 通信的 Sidecar 进程
174
+ 通过 UDS JSONL 通信的 Sidecar 进程(`node:net`,不走 HTTP 端口)
146
175
  |- ping
147
176
  |- stats
148
177
  |- query: embed -> cosine scan -> MMR
149
178
  `- reindex: upsert chunks into memory.vec.sqlite
150
179
  ```
151
180
 
152
- ### 读取路径
181
+ ### 🔎 读取路径
153
182
 
154
183
  Root session:
155
184
 
@@ -174,7 +203,7 @@ Sidecar 结果
174
203
  -> 仍为空:不注入
175
204
  ```
176
205
 
177
- ### 写入路径
206
+ ### ✍️ 写入路径
178
207
 
179
208
  | 路径 | 触发 | LLM? | 是否阻塞 | 目的 |
180
209
  | --- | --- | --- | --- | --- |
@@ -183,7 +212,7 @@ Sidecar 结果
183
212
  | Shutdown Queue | `session_shutdown` + `pi-memory maintenance` | 仅离线且无 compaction summary 时 | shutdown 时不阻塞 | 补捞短 session 或漏处理事实 |
184
213
  | Consolidate | overflow >= 12、7 天或每日 cron | 可选 | 离线或后台 | 去重、合并、清理过期 TODO |
185
214
 
186
- ## 数据和 MEMORY.md 格式
215
+ ## 💾 数据和 MEMORY.md 格式
187
216
 
188
217
  所有产物都放在同一个 memory agent directory 下。
189
218
 
@@ -233,7 +262,7 @@ Sidecar 结果
233
262
  - 溢出条目写入 `auto-*.md`,并在 `MEMORY.md` 留指针。
234
263
  - 向量 chunk 从条目派生;默认超过 `PI_MEMORY_CHUNK_MAX_CHARS=512` 的长条目会拆分。
235
264
 
236
- ## 配置
265
+ ## 🎛️ 配置
237
266
 
238
267
  可选 env 文件按以下顺序加载:
239
268
 
@@ -262,7 +291,7 @@ Sidecar 结果
262
291
 
263
292
  完整列表见 [`.env.example`](../.env.example)。
264
293
 
265
- ### Embedding Provider
294
+ ### 🛰️ Embedding Provider
266
295
 
267
296
  | Embedder | 适用场景 | 说明 |
268
297
  | --- | --- | --- |
@@ -272,7 +301,7 @@ Sidecar 结果
272
301
 
273
302
  Vector Index 会保存 embedding provider、model 和 dimension 元数据。配置变化时会清空旧 chunks 并重建。
274
303
 
275
- ## 命令
304
+ ## ⌨️ 命令
276
305
 
277
306
  Pi 内部:
278
307
 
@@ -284,11 +313,11 @@ Pi 内部:
284
313
  CLI:
285
314
 
286
315
  ```bash
287
- pi-memory init
288
316
  pi-memory status
289
317
  pi-memory maintenance --cron --verbose
290
318
  pi-memory consolidate --force --verbose
291
319
  pi-memory drain-shutdown-queue --verbose
320
+ pi-memory init # 可选 — 安装后 + 首次 session 通常已自动完成
292
321
  ```
293
322
 
294
323
  `maintenance` 是推荐的调度入口:
@@ -304,7 +333,7 @@ consolidate -> drain-shutdown-queue
304
333
  - [`templates/consolidate.cmd.example`](../templates/consolidate.cmd.example)
305
334
  - [`templates/schtasks.example.txt`](../templates/schtasks.example.txt)
306
335
 
307
- ## 诊断
336
+ ## 🩺 诊断
308
337
 
309
338
  使用 `/memory-status` 或 `pi-memory status` 检查:
310
339
 
@@ -335,7 +364,7 @@ consolidate -> drain-shutdown-queue
335
364
  }
336
365
  ```
337
366
 
338
- ## 非目标
367
+ ## 🚫 非目标
339
368
 
340
369
  - 不替代 Pi compaction。
341
370
  - 不替代 session search;历史对话搜索应使用专门的 session-search 扩展。
@@ -344,7 +373,7 @@ consolidate -> drain-shutdown-queue
344
373
  - 不把完整聊天记录当作 memory 存储。
345
374
  - 不给每轮用户消息增加多秒级 reflection。
346
375
 
347
- ## 开发
376
+ ## 🛠️ 开发
348
377
 
349
378
  ```bash
350
379
  pnpm typecheck
@@ -354,12 +383,12 @@ pnpm build
354
383
 
355
384
  sidecar IPC 测试会打开 Unix domain socket。如果在受限沙盒中因为 `listen EPERM` 失败,请在正常本地 shell 中运行。
356
385
 
357
- ## 文档
386
+ ## 📚 文档
358
387
 
359
388
  - [English README](../README.md)
360
389
  - [路线图](./ROADMAP-zh.md)
361
390
  - [UBIQUITOUS_LANGUAGE.md](../UBIQUITOUS_LANGUAGE.md) - 领域术语表
362
391
 
363
- ## 许可证
392
+ ## 📜 许可证
364
393
 
365
394
  MIT
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@chendpoc/pi-memory",
3
- "version": "0.2.1",
3
+ "version": "0.2.2",
4
4
  "description": "Cross-session episodic memory for Pi agent — MEMORY.md ground truth, JSONL sidecar retrieval, and Preflight injection",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -44,6 +44,7 @@
44
44
  "scripts/init-memory-workspace.mjs",
45
45
  "scripts/platform-fs.mjs",
46
46
  "scripts/postinstall.mjs",
47
+ "assets/pi-memory-logo.png",
47
48
  "README.md",
48
49
  "doc/README-zh.md",
49
50
  "doc/ROADMAP.md",