open-memex 0.5.0 → 0.6.0-alpha.10

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.md CHANGED
@@ -12,7 +12,7 @@ via `prepublishOnly` — Node refuses `--experimental-strip-types` for files und
12
12
 
13
13
  - **opencode host** loads `src/index.ts` under embedded **Bun**. SQLite here is `bun:sqlite` (built-in).
14
14
  - **CLI** (`src/cli.ts`) and smoke tests run under **Node 22+** with `--experimental-strip-types`. SQLite here is `better-sqlite3` (native module).
15
- - **MCP server** (`src/mcp.ts`, stdio) runs under **Node 22+** with `--experimental-strip-types`. It exposes the same ten memory tools to any MCP client (VS Code Copilot, Cursor, Claude Code). **stdout is the protocol channel — never log to stdout in `mcp.ts`; diagnostics go to stderr.**
15
+ - **MCP server** (`src/mcp.ts`, stdio) runs under **Node 22+** with `--experimental-strip-types`. It exposes the same eleven memory tools to any MCP client (VS Code Copilot, Cursor, Claude Code). **stdout is the protocol channel — never log to stdout in `mcp.ts`; diagnostics go to stderr.**
16
16
 
17
17
  `src/store/db.ts` picks the backend at runtime by sniffing `globalThis.Bun`. Both backends share the same surface (`new Database(path)`, `.exec`, `.prepare().run/all/get`, `.close`). Any DB code you write must stay on that common subset — do not import `better-sqlite3` or `bun:sqlite` directly outside `db.ts`.
18
18
 
@@ -61,16 +61,37 @@ resolves the server command
61
61
  at init time — npx fallback when no durable bin is on PATH, D17),
62
62
  `open-memex config` prints the effective config, `open-memex capture --dry-run "text"`
63
63
  previews keyword capture without writing, `open-memex doctor` runs health checks
64
- (node version, config, scope resolution, storage writability, MCP handshake).
64
+ (node version, config, scope resolution, storage writability, VS Code MCP enablement, MCP handshake).
65
65
  `open-memex init` with no --client auto-detects and wires every installed editor
66
66
  (`--yes` skips, scripts never prompt); `open-memex config set <key> <value>` edits settings after install.
67
+ `npm install -g` prints a pointer to `open-memex init` via a postinstall script
68
+ (print-only — postinstall must never prompt, it runs in CI/Docker; D50).
69
+ Note: npm swallows lifecycle-script stdout (background run unless
70
+ `--foreground-scripts`), so the postinstall pointer is best-effort only —
71
+ every CLI entry point also prints a one-line stderr nudge until init has run
72
+ or been declined (F28; stderr keeps the MCP stdio protocol intact).
73
+ Bare `open-memex` on a machine where init never completed offers to run it on a
74
+ TTY (usage as before when non-interactive); init/uninstall maintain a
75
+ `.init.json` first-run marker at the data root so the offer is asked once (D50);
76
+ init ends with a one-line next-step hint (`open-memex add` + ask the agent to
77
+ recall it) so a first-time user sees what "it works" looks like (D51).
78
+ init also installs the bundled `open-memex` Agent Skill (skills/open-memex/SKILL.md,
79
+ teaches skill-aware agents the CLI: save/search/scope rules/outbox flow) into each
80
+ wired editor's user-level skills dir — ~/.copilot/skills/ (VS Code),
81
+ ~/.cursor/skills/ (Cursor), ~/.config/opencode/skills/ (opencode, per-project MCP
82
+ mode only — with the native plugin the skill is skipped and any previously installed
83
+ one is removed, D55); Visual Studio
84
+ has no skills concept and is skipped. Copy, not symlink (Windows needs no
85
+ Developer Mode); existing skill kept unless --force (D54).
67
86
  `open-memex uninstall [--client vscode|cursor|opencode|visualstudio] [--global] [--yes]`
68
87
  reverses init — removes the MCP server entry / opencode plugin line / Copilot
69
- instructions section; memory data never touched (D48); no --client → auto-detect
88
+ instructions section / Agent Skill directory; memory data never touched (D48); no --client → auto-detect
70
89
  with an interactive confirm, explicit --client never prompts; `--yes` only skips
71
90
  that confirm; `--global` limits cleanup to user-level. Empty/whitespace-only
72
91
  config files parse as `{}` and are safely populated (D49); non-JSON (JSONC)
73
- files are left untouched with a printed manual snippet (D47).
92
+ files are left untouched with a printed manual snippet (D47). init/uninstall also sweep
93
+ pre-rename `my-o-memory` plugin entries and MCP server keys wherever they touch a
94
+ config, and `open-memex doctor` reports any remaining pre-rename leftovers (F30).
74
95
  The published `open-memex` bin points at `dist/cli.js` (compiled at publish time).
75
96
  From a source checkout, `npm run cli` / `npm run mcp` still run `src/` directly
76
97
  with type-stripping — no build step needed for development.
@@ -125,7 +146,7 @@ Context injection happens exactly once per session in `experimental.chat.system.
125
146
 
126
147
  `docs/V2-DESIGN.md` is the frozen protocol v0.2 (zero open questions). Per its §12:
127
148
  AGENTS.md answers "how should AI work here"; the design doc answers "why is it
128
- built this way" (principles, iron rules, D1–D13 decision log). Before changing
149
+ built this way" (principles, iron rules, D1–D49 decision log). Before changing
129
150
  architecture, scope semantics, lifecycle, or the protocol surface (frontmatter
130
151
  schema, MCP tools, CLI contract), read the relevant design section — the decision
131
152
  log records what was already considered and rejected.
@@ -138,7 +159,7 @@ build roadmap; the design doc tracks the *why*.
138
159
 
139
160
  ## Branch workflow
140
161
 
141
- `dev/<topic>` → PR → `main` (the v2 line; alpha versions published with
162
+ `dev/<topic>` → PR → `main` (alpha versions published with
142
163
  `npm publish --tag alpha`, npm `latest` moves only on stable releases).
143
164
  The `V2` integration branch was retired 2026-09-29 — its job (isolating the
144
165
  breaking v1→v2 transition) shipped with 0.3.0. Full rules: `CONTRIBUTING.md`.
package/CONTRIBUTING.md CHANGED
@@ -2,10 +2,13 @@
2
2
 
3
3
  ## Branch workflow
4
4
 
5
- - `main` — the v2 line. Never commit directly; land work via pull request
6
- from a dev branch. Alpha versions (e.g. `0.5.0-alpha.x`) live on `main`;
7
- publish them with `npm publish --tag alpha` so the npm `latest` tag only
8
- moves on stable releases.
5
+ - `main` — the only line (the `V2` integration branch was retired 2026-09-29).
6
+ Land work via pull request from a `dev/<topic>` branch. Exception: tiny
7
+ text-only doc tweaks may go directly to `main`, but only after the owner
8
+ has previewed and approved the exact change. Alpha versions
9
+ (e.g. `0.5.0-alpha.x`) live on `main`; publish them with
10
+ `npm publish --tag alpha` so the npm `latest` tag only moves on stable
11
+ releases.
9
12
  - `dev/<topic>` — feature/fix branches (e.g. `dev/init-ux`). Open as **draft**
10
13
  PRs against `main`; mark ready and merge after local testing passes.
11
14
 
@@ -25,7 +28,7 @@ branches are cheap.)
25
28
  ## Design authority
26
29
 
27
30
  Protocol decisions live in `docs/V2-DESIGN.md` (frozen v0.2, decision log
28
- D1–D13). Changing architecture, scope semantics, lifecycle, or the protocol
31
+ D1–D49). Changing architecture, scope semantics, lifecycle, or the protocol
29
32
  surface (frontmatter schema, MCP tools, CLI contract) requires updating the
30
33
  design doc first. `AGENTS.md` has the working notes for AI agents; this file
31
34
  has the contributor workflow.
package/README.md CHANGED
@@ -23,6 +23,20 @@ automatically.
23
23
 
24
24
  > No capture, nothing to inherit.
25
25
 
26
+ ### One memory, every agent
27
+
28
+ Most developers don't use one AI tool — they use several on the same machine:
29
+ Copilot in VS Code, Cursor, opencode, Claude Code. Each tool keeps
30
+ its own silo: a decision made in one is invisible to the others.
31
+
32
+ open-memex is tool-agnostic by design. Memory lives as Markdown + SQLite next
33
+ to your project, and every editor talks to it through the same MCP interface.
34
+ Wire up two, three, five clients with `open-memex init` — they all read and
35
+ write the same memory on that machine. A constraint captured in VS Code is respected in
36
+ opencode; a lesson learned in Cursor shows up in Claude Code.
37
+
38
+ > Your memory belongs to you — not to your tools.
39
+
26
40
  It also complements agentic development workflows (spec-driven development,
27
41
  plan/implement/verify loops): plans produce decisions, verification produces
28
42
  rules — open-memex is the memory layer that keeps them across sessions instead
@@ -36,6 +50,7 @@ of re-deriving them on every run.
36
50
  | Review before sharing | Yes — outbox + PR | Varies | Yes | No |
37
51
  | Agent recall | Session-start injection + search | API calls | Manual lookup | No |
38
52
  | Human-readable | Plain Markdown files | Dashboard / API | Yes | No |
53
+ | Works across AI tools | Yes — any MCP client (same machine) | Per-integration | No | No |
39
54
 
40
55
  - **Markdown files** as the source of truth (human-editable, git-friendly)
41
56
  - **SQLite FTS5** as a rebuildable index (BM25 keyword search, via `better-sqlite3`)
@@ -90,7 +105,7 @@ personal scope: this machine only — never synced, never enters a repo.
90
105
  npm install -g open-memex
91
106
  ```
92
107
 
93
- This installs the `0.4.1` stable release.
108
+ This installs the `0.5.1` stable release.
94
109
 
95
110
  **Alpha** (bleeding edge, for testers) — the `alpha` tag:
96
111
 
@@ -98,6 +113,12 @@ This installs the `0.4.1` stable release.
98
113
  npm install -g open-memex@alpha
99
114
  ```
100
115
 
116
+ ```sh
117
+ open-memex init
118
+ ```
119
+
120
+ The install isn't complete until you run `open-memex init` — it wires up your editors (VS Code, Cursor, opencode, and Visual Studio for solution projects).
121
+
101
122
  See what's published:
102
123
 
103
124
  ```sh
@@ -165,7 +186,10 @@ npx -y open-memex init --yes
165
186
  With no `--client`, `init` **detects your installed editors and wires them all**
166
187
  — user-level where the editor supports it (VS Code / Cursor MCP config, opencode
167
188
  native plugin), so one init covers every project. Visual Studio joins in when the
168
- project has a solution file. Prefer to pick a single editor? Pass `--client`:
189
+ project has a solution file. It also installs an **Agent Skill** (`open-memex`)
190
+ into each editor's skills folder (not opencode when the native plugin is wired —
191
+ the plugin already provides memory tools), so skill-aware agents can use your memory via
192
+ the CLI with no MCP configuration. Prefer to pick a single editor? Pass `--client`:
169
193
 
170
194
  > **Two different "globals" — don't mix them up.**
171
195
  > - `npm install -g open-memex` installs the *package* globally: it puts the
@@ -174,6 +198,14 @@ project has a solution file. Prefer to pick a single editor? Pass `--client`:
174
198
  > project: init once, the wiring works in every project. It works the same
175
199
  > whether the package was installed globally or run via npx.
176
200
 
201
+ Installing the package also prints a reminder to run `open-memex init` — the
202
+ wiring is a separate step. And if you run bare `open-memex` on a machine where
203
+ init never completed, it offers to run it for you (only on an interactive
204
+ terminal; scripts and CI just see the usual usage text). When init finishes,
205
+ it prints one concrete next step — save a memory with `open-memex add`, then
206
+ ask your agent to recall it — so a first-time user sees what "it works" looks
207
+ like.
208
+
177
209
  **VS Code** (Copilot):
178
210
 
179
211
  ```sh
@@ -219,7 +251,8 @@ open-memex init --client opencode --global --yes
219
251
  ```
220
252
 
221
253
  Merges `"plugin": ["file:///absolute/path/to/open-memex/src/index.ts"]` into your
222
- user-level `~/.config/opencode/opencode.json` — one-time, every project picks it
254
+ user-level `~/.config/opencode/opencode.json` (or `opencode.jsonc` if that is
255
+ the file you already have) — one-time, every project picks it
223
256
  up, no per-project init. You get keyword auto-capture and first-turn context
224
257
  injection on top of the tools. (A config file with comments is left untouched —
225
258
  add the `plugin` line by hand in that case.)
@@ -492,8 +525,9 @@ branches and PRs. Nothing moves without you naming it.
492
525
 
493
526
  In an AI chat with the MCP server connected, just say **"sync memory"**
494
527
  (or "同步记忆") — the agent runs the status check, summarizes the outbox drafts,
495
- and asks which ones to sync. The agent also proposes this on its own at session
496
- start and at work checkpoints.
528
+ and asks which ones to sync. The server also tells the agent on its own: at
529
+ session start the handshake reports how many drafts are waiting, and every
530
+ memory-changing tool result carries the current count when it is non-zero.
497
531
 
498
532
  ```sh
499
533
  open-memex sync-status
@@ -547,8 +581,8 @@ open-memex distill-agents [--scope project|personal] [--type t1,t2] [--limit N]
547
581
  # (decisions, constraints, lessons, gotchas, howtos). Prints markdown;
548
582
  # -o writes it to a file. You review and merge by hand — open-memex
549
583
  # never rewrites your AGENTS.md on its own. The snippet ends with a
550
- # "memory hygiene" section (§3.5 checkpoint guidance) so agents reading
551
- # AGENTS.md learn to propose distilled captures at checkpoints.
584
+ # "memory hygiene" section (§3.5 distillation guidance) so agents reading
585
+ # AGENTS.md learn to propose distilled captures when a task ends.
552
586
 
553
587
  open-memex propose <id...> --to project [--local-approve]
554
588
  # propose one or several personal memories at once (one branch, one PR);
@@ -603,8 +637,9 @@ server with cwd set to your project root (`init` handles this for you).
603
637
  > **Note:** MCP is request/response — it gives the agent tools, not the opencode
604
638
  > plugin's automatic keyword capture or first-turn context injection. Proactive
605
639
  > memory use depends on the agent's instructions: the server sends session-start
606
- > guidance (call `memory_status` at session start and at checkpoints) in the MCP
607
- > handshake `instructions`, and `init` writes the fuller version into the
640
+ > guidance in the MCP handshake `instructions` (including the live outbox draft
641
+ > count at session start, plus the pending count appended to memory-changing
642
+ > tool results when non-zero), and `init` writes the fuller version into the
608
643
  > editor's instruction files. Both are advisory — no MCP consumer offers a hard
609
644
  > session-start hook.
610
645
 
@@ -620,8 +655,20 @@ outbox → `sync-status` → `submit` (local branch+commit, push/PR on your Yes)
620
655
  `export` / `import` archive for user portability (Markdown + manifest, no walled
621
656
  garden; private excluded by default, `-a` / `--all` for full migration);
622
657
  distill-to-AGENTS.md assist (`distill-agents`, propose-only — you merge by hand);
623
- §3.5 checkpoint distillation in the MCP handshake + init instructions (the agent
624
- proposes 1–3 captures at checkpoints, the human decides); 1–2 colleague pilot.
658
+ §3.5 distillation in the MCP handshake + init instructions (the agent proposes
659
+ 1–3 captures when a task ends, the human decides); 1–2 colleague pilot.
660
+
661
+ **`0.5.0` (stable):** init UX pass — `init --global` writes the editor wiring
662
+ once at user level (D45); bare `init` auto-detects installed editors and wires
663
+ them all (D46); non-JSON configs are left untouched with a paste-ready snippet
664
+ instead of an error (D47); `uninstall` reverses `init` without touching memory
665
+ data (D48); empty config files are treated as blank, not corrupt (D49).
666
+ "One memory, every agent": every editor on the same machine reads and writes
667
+ the same memory through one MCP interface.
668
+
669
+ **`0.5.1` (stable):** `--help` accuracy fixes — the `mcp` help text now states the
670
+ server exposes 11 tools (a superset of the opencode plugin's five memory tools),
671
+ and install hints point at the stable line instead of `@alpha` (F27).
625
672
 
626
673
  **Future (signal-gated, no version committed):** org layer — org memory repo,
627
674
  curator convention; native agent plugins (Claude Code / Codex hooks as
@@ -669,7 +716,7 @@ project. A per-project `.vscode/mcp.json` still wins when present, and the
669
716
  entry keeps `cwd=${workspaceFolder}` so project-scope resolution keeps
670
717
  working per window. If your user-level `mcp.json` has comments (VS Code
671
718
  accepts JSONC), `init` leaves it alone and prints the exact snippet to add
672
- by hand.
719
+ by hand. An empty file is treated as blank and written to directly.
673
720
 
674
721
  **How do I remove the editor wiring?**
675
722
  `open-memex uninstall` reverses `init`: it removes the MCP server entry,
package/README.zh-CN.md CHANGED
@@ -21,6 +21,18 @@ open-memex 把值得记住的部分——决策、约束、教训——存成可
21
21
 
22
22
  > No capture, nothing to inherit.(不记录,就无从传承。)
23
23
 
24
+ ### 一份记忆,所有 Agent 通用
25
+
26
+ 大多数开发者并不是只用一个 AI 工具——同一台电脑上可能装着 VS Code Copilot、
27
+ Cursor、opencode、Claude Code。但每个工具的记忆都是孤岛:在 A 里定好的决策,B 一无所知。
28
+
29
+ open-memex 天生与工具无关。记忆以 Markdown + SQLite 的形式存在项目旁边,
30
+ 所有编辑器都通过同一个 MCP 接口读写。用 `open-memex init` 接上两三个客户端,
31
+ 它们读写的是这台机器上的同一份记忆:在 VS Code 里记下的约束,opencode 会遵守;
32
+ 在 Cursor 里学到的教训,Claude Code 也看得到。
33
+
34
+ > 记忆属于你,不属于工具。
35
+
24
36
  它也补齐了 agentic 开发工作流(spec 驱动开发、plan/implement/verify 循环)缺的那一块:
25
37
  plan 产出决策,verify 产出规则——open-memex 是让它们跨会话留存的记忆层,
26
38
  而不是每次从头重新推导。
@@ -33,6 +45,7 @@ plan 产出决策,verify 产出规则——open-memex 是让它们跨会话留
33
45
  | 分享前 review | 有——outbox + PR | 不一定 | 有 | 没有 |
34
46
  | Agent 回忆 | 会话开始注入 + 搜索 | 调 API | 人工去查 | 没有 |
35
47
  | 人类可读 | 纯 Markdown 文件 | 后台 / API | 有 | 没有 |
48
+ | 跨 AI 工具通用 | 可以——同一台机器上的任何 MCP 客户端 | 按集成逐个对接 | 不可以 | 不可以 |
36
49
 
37
50
  - **Markdown 文件**是 source of truth(人类可读、git 友好)
38
51
  - **SQLite FTS5** 做可重建索引(BM25 关键词检索,`better-sqlite3`)
@@ -87,7 +100,7 @@ personal scope:只属于这台机器——永不同步,永远进不了仓库
87
100
  npm install -g open-memex
88
101
  ```
89
102
 
90
- 安装的是 `0.4.1` 正式版。
103
+ 安装的是 `0.5.1` 正式版。
91
104
 
92
105
  **Alpha 版**(最新开发版,给测试者)——`alpha` 标签:
93
106
 
@@ -95,6 +108,12 @@ npm install -g open-memex
95
108
  npm install -g open-memex@alpha
96
109
  ```
97
110
 
111
+ ```sh
112
+ open-memex init
113
+ ```
114
+
115
+ 不跑 `open-memex init` 把编辑器接上,安装就不算完成(支持 VS Code、Cursor、opencode,有 .sln 的项目还支持 Visual Studio)。
116
+
98
117
  查看已发布版本:
99
118
 
100
119
  ```sh
@@ -160,6 +179,9 @@ npx -y open-memex init --yes
160
179
  不带 `--client` 时,`init` 会**自动检测本机装了哪些编辑器,一次全接上**——
161
180
  支持用户级的编辑器走用户级(VS Code / Cursor 的 MCP 配置、opencode 原生插件),
162
181
  一次 init,所有项目通用;项目里有 solution 文件时 Visual Studio 也会一起配。
182
+ 同时会给每个编辑器装一个 **Agent Skill**(`open-memex`,opencode 用原生插件时除外——
183
+ 插件已经提供了记忆工具),懂 skill 的 agent
184
+ 不用配 MCP 也能通过 CLI 用你的记忆。
163
185
  想只配某一个编辑器?加 `--client`:
164
186
 
165
187
  > **两个"全局"不是一回事,别搞混。**
@@ -168,6 +190,12 @@ npx -y open-memex init --yes
168
190
  > - `init --global` 是把*编辑器配置*写到用户级而不是项目里:init 一次,
169
191
  > 每个项目都生效。不管包是全局安装的还是用 npx 临时跑的,效果一样。
170
192
 
193
+ 装完包还会打印一句提醒,让你跑 `open-memex init`——接线是独立的一步。
194
+ 如果你在从没跑过 init 的机器上直接敲 `open-memex`,它会问你要不要现在
195
+ init(只在交互终端里问;脚本和 CI 里看到的还是原来的 usage)。
196
+ init 跑完会打印一个具体的下一步——用 `open-memex add` 存一条记忆,再让
197
+ agent 回忆它——让第一次用的用户一眼看到"跑起来了"是什么样子。
198
+
171
199
  **VS Code**(Copilot):
172
200
 
173
201
  ```sh
@@ -213,7 +241,8 @@ open-memex init --client opencode --global --yes
213
241
  ```
214
242
 
215
243
  把 `"plugin": ["file:///absolute/path/to/open-memex/src/index.ts"]` 合并进用户级
216
- `~/.config/opencode/opencode.json`——一次配置,每个项目自动生效,不用逐个项目
244
+ `~/.config/opencode/opencode.json`(如果你用的是 `opencode.jsonc`,就合并进那个)
245
+ ——一次配置,每个项目自动生效,不用逐个项目
217
246
  init。在 tools 之外还能获得关键词自动捕获和首轮上下文注入。(带注释的配置文件
218
247
  不会被改动——那种情况请手动加 `plugin` 这一行。)
219
248
 
@@ -468,8 +497,8 @@ project 草稿先住在 **appdata outbox**(git 看不见、跟分支无关)
468
497
  没经过你点名,什么都不会动。
469
498
 
470
499
  在接了 MCP 服务器的 AI 对话里,直接说 **"同步记忆"**(或 "sync memory")——
471
- agent 会查状态、把 outbox 草稿逐条摘要、问你同步哪几条。agent 也会在新对话
472
- 开始和任务检查点主动提这件事。
500
+ agent 会查状态、把 outbox 草稿逐条摘要、问你同步哪几条。服务器也会主动告诉
501
+ agent:新对话开始时握手里带待审草稿数,每次改记忆的 tool 返回里也带当前数(为零时不带)。
473
502
 
474
503
  ```sh
475
504
  open-memex sync-status
@@ -516,7 +545,7 @@ open-memex distill-agents [--scope project|personal] [--type t1,t2] [--limit N]
516
545
  # 把项目记忆(decision/constraint/lesson/gotcha/howto)提炼成
517
546
  # AGENTS.md 片段。默认打印到 stdout;-o 写文件。人工审阅后手工合并——
518
547
  # open-memex 永不自动改写你的 AGENTS.md。片段末尾带一段"记忆卫生"
519
- # (§3.5 检查点指引),让读 AGENTS.md 的 agent 学会在检查点提议蒸馏捕获。
548
+ # (§3.5 蒸馏指引),让读 AGENTS.md 的 agent 学会在任务结束时提议蒸馏捕获。
520
549
 
521
550
  open-memex propose <id...> --to project [--local-approve]
522
551
  # 一次 propose 一条或多条(一个分支、一个 PR),每条独立新 id。
@@ -568,9 +597,9 @@ project scope 从进程工作目录解析,所以配置 server 时 cwd 要指
568
597
  > **注意:** MCP 是请求/响应式的——它给 agent 提供 tools,但没有 opencode
569
598
  > 插件的关键词自动捕获和首轮上下文注入。想让 agent 主动用记忆,
570
599
  > 靠的是 agent 的 instructions:服务器在 MCP 握手的 `instructions` 里自带
571
- > session-start 指引(开场调 `memory_status`、检查点再调),`init` 则把更完整
572
- > 的版本写进编辑器的 instruction 文件。两者都是建议性的——MCP 客户端没有
573
- > 强制的 session-start hook。
600
+ > session-start 指引(含开场时的 outbox 待审草稿数;改记忆的 tool 返回里也会
601
+ > 带当前数,为零时不带),`init` 则把更完整的版本写进编辑器的 instruction
602
+ > 文件。两者都是建议性的——MCP 客户端没有强制的 session-start hook。
574
603
 
575
604
  ## 路线图(Roadmap)
576
605
 
@@ -584,8 +613,12 @@ project scope 从进程工作目录解析,所以配置 server 时 cwd 要指
584
613
  `export` / `import` 归档做用户可携带(Markdown + manifest,不造围墙花园;
585
614
  private 默认不导出,`-a` / `--all` 全量迁移);
586
615
  distill-to-AGENTS.md 辅助(`distill-agents`,只提议不改写——人工合并);
587
- §3.5 检查点蒸馏写进 MCP 握手指令和 init 指令文件
588
- (agent 在检查点提议 1–3 条捕获,人来定);找 1–2 个同事做 pilot。
616
+ §3.5 蒸馏写进 MCP 握手指令和 init 指令文件
617
+ (agent 在任务结束时提议 1–3 条捕获,人来定);找 1–2 个同事做 pilot。
618
+
619
+ **`0.5.0`(稳定版):** init 体验整修——`init --global` 一次写好用户级编辑器接线(D45);裸 `init` 自动检测已装编辑器并一次全接上(D46);非标准 JSON 配置不再报错,而是原样保留并打印手贴片段(D47);`uninstall` 逆转 `init` 且永不碰记忆数据(D48);空配置文件按空白处理、不再误判为损坏(D49)。"一份记忆,所有 Agent 通用":同一台机器上的每个编辑器,经由同一个 MCP 接口读写同一份记忆。
620
+
621
+ **`0.5.1`(稳定版):** `--help` 文案准确性修正——`mcp` 帮助写明 server 暴露 11 个工具(含 opencode 插件的 5 个 memory 工具),安装提示改指稳定版而非 `@alpha`(F27)。
589
622
 
590
623
  **未来(看信号再定,不承诺版本):** 组织层——组织记忆仓库、curator 约定;
591
624
  原生 agent 插件(Claude Code / Codex hooks,作为同一套 MCP tools 的增强路径);
@@ -625,7 +658,7 @@ Linux:`~/.config/Code/User/mcp.json`),每个项目打开 server 都在。
625
658
  项目里如果有 `.vscode/mcp.json` 仍然优先;entry 里保留了
626
659
  `cwd=${workspaceFolder}`,project scope 按窗口照常工作。
627
660
  如果你的用户级 `mcp.json` 带注释(VS Code 接受 JSONC),`init` 不会碰它,
628
- 只打印可直接手贴的配置片段。
661
+ 只打印可直接手贴的配置片段。空文件会被当作空白直接写入。
629
662
 
630
663
  **怎么拆掉编辑器接线?**
631
664
  `open-memex uninstall` 就是 `init` 的逆操作:删掉 MCP server 条目、opencode
package/dist/cli.js CHANGED
@@ -296,8 +296,9 @@ Usage: open-memex capture --dry-run "text"
296
296
  Example:
297
297
  open-memex capture --dry-run "remember: we deploy on Fridays"`,
298
298
  doctor: `Environment health check: Node version, config source, scope resolution,
299
- storage writability, then boots a real MCP server and runs initialize +
300
- tools/list against it — all eleven tools must show up.
299
+ storage writability, VS Code MCP enablement (settings.json + system policy),
300
+ then boots a real MCP server and runs initialize + tools/list against it —
301
+ all eleven tools must show up.
301
302
 
302
303
  Usage: open-memex doctor
303
304
 
@@ -343,7 +344,7 @@ Usage:
343
344
  Every command has its own help with description and examples:
344
345
  open-memex <command> --help (or -h)
345
346
 
346
- One-command project setup: \`open-memex init\` (or \`npx open-memex@alpha init\`) detects
347
+ One-command project setup: \`open-memex init\` (or \`npx -y open-memex init\`) detects
347
348
  your installed editors and wires them all — user-level where the editor supports it
348
349
  (VS Code / Cursor MCP config, opencode native plugin), so one init covers every project;
349
350
  Visual Studio is included when the project has a solution file (its \`.mcp.json\`
@@ -358,9 +359,9 @@ confirms the detected editors and asks a couple of settings (keyword capture,
358
359
  first-turn injection); \`--yes\` accepts all defaults, and non-terminal runs never prompt.
359
360
  \`open-memex config set <key> <value>\` changes those settings after install.
360
361
 
361
- Once installed globally (\`npm i -g open-memex@alpha\`) the \`open-memex\` command is
362
- available directly: \`open-memex mcp\` starts the stdio MCP server (same five
363
- memory_* tools as the opencode plugin); \`open-memex mcp --print-config <client>\`
362
+ Once installed globally (\`npm i -g open-memex\`) the \`open-memex\` command is
363
+ available directly: \`open-memex mcp\` starts the stdio MCP server (11 tools, a superset of
364
+ the opencode plugin's five memory_* tools); \`open-memex mcp --print-config <client>\`
364
365
  prints a copy-paste MCP client config snippet.
365
366
 
366
367
  Scope defaults to \`project\` (derived from cwd's git remote or path).
@@ -433,7 +434,7 @@ function resolveCliScope(flags, project) {
433
434
  : project;
434
435
  }
435
436
  /** Print a copy-paste MCP client config snippet. Requires a global install
436
- * (`npm i -g open-memex@alpha`) so the `open-memex` command is on PATH. */
437
+ * (`npm i -g open-memex`) so the `open-memex` command is on PATH. */
437
438
  function printMcpConfig(client) {
438
439
  const c = client.toLowerCase();
439
440
  // D17: resolve the server command the same way `init` does.
@@ -489,13 +490,48 @@ function printMcpConfig(client) {
489
490
  process.exit(1);
490
491
  }
491
492
  if (!mc.durable) {
492
- console.error(`\n# note: no durable \`open-memex\` on PATH — snippet uses npx. \`npm i -g open-memex@alpha\` for faster startup.`);
493
+ console.error(`\n# note: no durable \`open-memex\` on PATH — snippet uses npx. \`npm i -g open-memex\` for faster startup.`);
493
494
  }
494
495
  process.exit(0);
495
496
  }
496
497
  async function main() {
497
498
  const [cmd, ...rest] = process.argv.slice(2);
498
- if (!cmd || cmd === "--help" || cmd === "-h" || cmd === "help")
499
+ if (!cmd) {
500
+ // D50: fresh machine + interactive terminal → offer init instead of bare usage.
501
+ // Non-interactive (CI/scripts/pipes) prints usage exactly as before.
502
+ const { offerFirstRunInit } = await import("./first-run.js");
503
+ const outcome = await offerFirstRunInit(async () => {
504
+ // Re-exec `open-memex init` as a child with inherited stdio instead of
505
+ // calling initProject() in-process: the offer's readline already
506
+ // consumed stdin's buffer, and a second readline on the same stream
507
+ // would see EOF on burst input instead of the user's next answers.
508
+ const { spawnSync } = await import("node:child_process");
509
+ const r = spawnSync(process.execPath, [...process.execArgv, fileURLToPath(import.meta.url), "init"], { stdio: "inherit" });
510
+ if (r.error)
511
+ throw r.error;
512
+ if ((r.status ?? 1) !== 0)
513
+ process.exit(r.status ?? 1);
514
+ });
515
+ if (outcome !== "initialized")
516
+ usage(0);
517
+ return;
518
+ }
519
+ // F28: npm runs lifecycle scripts in the background and swallows their
520
+ // stdout (unless --foreground-scripts), so the D50 postinstall pointer
521
+ // never reaches the user. Every CLI entry point therefore carries a
522
+ // one-line nudge on stderr until init has run or been declined — stderr
523
+ // keeps the MCP stdio protocol (stdout) intact, and the .init.json marker
524
+ // makes it once-ever. `init`/`uninstall` are excluded (already there /
525
+ // nothing to wire). Placed before the --help/--version early returns:
526
+ // `-v` is the first thing people run after installing.
527
+ if (cmd !== "init" && cmd !== "uninstall") {
528
+ const { isFirstRun } = await import("./first-run.js");
529
+ if (isFirstRun()) {
530
+ console.error("open-memex: first run? `open-memex init` wires it into your editors " +
531
+ "(auto-detects VS Code, Cursor, opencode — and Visual Studio for solution projects).");
532
+ }
533
+ }
534
+ if (cmd === "--help" || cmd === "-h" || cmd === "help")
499
535
  usage(0);
500
536
  if (cmd === "--version" || cmd === "-v") {
501
537
  // package.json sits two levels above this file in both layouts
@@ -648,7 +684,7 @@ async function main() {
648
684
  }
649
685
  return;
650
686
  }
651
- // `mcp` starts the stdio MCP server (same tools as the opencode plugin).
687
+ // `mcp` starts the stdio MCP server (11 tools; the opencode plugin exposes 5).
652
688
  // Branched before db() — runMcpServer() does its own init, and stdout must
653
689
  // stay clean for the MCP protocol.
654
690
  if (cmd === "mcp") {
@@ -53,10 +53,11 @@ export function distillAgentsMarkdown(opts) {
53
53
  }
54
54
  // D43 — §3.5 memory-hygiene footer (double insurance for opencode users,
55
55
  // who never see the MCP handshake / init instructions): teach the agent
56
- // reading this AGENTS.md to propose distilled captures at checkpoints.
56
+ // reading this AGENTS.md to propose distilled captures when a task ends
57
+ // (D53: the checkpoint mechanism is gone).
57
58
  lines.push(`### Memory hygiene (open-memex)`);
58
59
  lines.push(``);
59
- lines.push(`- At checkpoints (session start, end of a work chunk, after the user commits),`, ` distill the session: propose 1–3 short memories capturing the useful`, ` conclusion — what was learned or decided, how an issue was resolved, what`, ` to avoid, where the authoritative doc lives — not the raw transcript.`, ` Save nothing without user approval.`, `- If the knowledge already lives in project docs, save a \`reference\` memory`, ` pointing at the doc instead of copying it.`);
60
+ lines.push(`- When you finish a task the user would describe in one sentence, distill`, ` the session: propose 1–3 short memories capturing the useful`, ` conclusion — what was learned or decided, how an issue was resolved, what`, ` to avoid, where the authoritative doc lives — not the raw transcript.`, ` Save nothing without user approval.`, `- If the knowledge already lives in project docs, save a \`reference\` memory`, ` pointing at the doc instead of copying it.`);
60
61
  lines.push(``);
61
62
  return lines.join("\n");
62
63
  }