open-memex 0.4.0-alpha.7 → 0.4.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.
- package/AGENTS.md +5 -0
- package/README.md +193 -21
- package/README.zh-CN.md +166 -17
- package/dist/cli.js +309 -23
- package/dist/config.js +2 -0
- package/dist/distill-agents.js +62 -0
- package/dist/export.js +157 -0
- package/dist/mcp.js +14 -0
- package/dist/providers/git.js +142 -0
- package/dist/store/v2migrate.js +83 -34
- package/docs/CURATOR.md +59 -0
- package/docs/TEST-PLAN.md +72 -0
- package/docs/V2-DESIGN.md +26 -2
- package/package.json +1 -1
- package/scripts/smoke-pure.ts +49 -1
- package/scripts/test-full.ts +345 -0
- package/src/cli.ts +321 -23
- package/src/config.ts +10 -0
- package/src/distill-agents.ts +85 -0
- package/src/export.ts +206 -0
- package/src/mcp.ts +16 -0
- package/src/providers/git.ts +191 -0
- package/src/store/sync.ts +1 -1
- package/src/store/v2migrate.ts +88 -34
package/AGENTS.md
CHANGED
|
@@ -31,6 +31,11 @@ npm run typecheck # tsc --noEmit — the only
|
|
|
31
31
|
npm run cli -- where | list | search "q" | add ... | forget <id> | reindex
|
|
32
32
|
npm run cli -- <command> --help # per-command help (AI assistants discover flags this way)
|
|
33
33
|
npm run cli -- sync-status # last sync time/kind + outbox drafts + repo review states + uncommitted files
|
|
34
|
+
npm run cli -- pull # fetch + fast-forward only (explicit; diverged = clean failure, never force-merge)
|
|
35
|
+
npm run cli -- push # push current branch to remote (explicit only; open-memex never auto-pushes)
|
|
36
|
+
npm run cli -- export [--scope project|personal|both] [--all] [-o <file>] # portable .tar.gz bundle (markdown + manifest); private excluded unless --all
|
|
37
|
+
npm run cli -- import <bundle.tar.gz> [--dry-run] # restore: personal → personal dir, project → outbox re-keyed; conflicts reported, never overwritten
|
|
38
|
+
npm run cli -- distill-agents [--type t1,t2] [-o <file>] # propose an AGENTS.md snippet from project memories (assist only; you merge by hand)
|
|
34
39
|
npm run cli -- submit <id...> [--branch <name>] [--base <branch>] # drafts → .ai/open-memex/ (current branch + local commit; never auto-branches)
|
|
35
40
|
npm run cli -- propose <id...> --to project [--local-approve] # copy personal → project outbox (batch OK)
|
|
36
41
|
npm run cli -- promote <id> [--reject] [--resubmit] [--note "..."] # proposed → approved → published (audit trail appended)
|
package/README.md
CHANGED
|
@@ -1,15 +1,79 @@
|
|
|
1
1
|
# open-memex
|
|
2
2
|
|
|
3
|
+
> A shared organizational memory layer that helps people and AI capture, retain, and reuse institutional knowledge.
|
|
4
|
+
|
|
5
|
+
[](https://www.npmjs.com/package/open-memex)
|
|
6
|
+
[](./LICENSE)
|
|
7
|
+
|
|
3
8
|
[中文文档](./README.zh-CN.md)
|
|
4
9
|
|
|
5
10
|
Local-first persistent memory for AI coding agents: an [opencode](https://opencode.ai) plugin
|
|
6
11
|
plus a generic MCP server (VS Code Copilot, Cursor, Claude Code, Visual Studio, …).
|
|
7
12
|
|
|
13
|
+
## Why open-memex?
|
|
14
|
+
|
|
15
|
+
Engineering knowledge lives in two places: the code, and people's heads.
|
|
16
|
+
Every new AI coding session starts from zero — the same project context gets
|
|
17
|
+
explained again, the same gotchas get rediscovered, the same incident lessons
|
|
18
|
+
fade when the chat ends.
|
|
19
|
+
|
|
20
|
+
open-memex captures the part worth remembering — the decision, the constraint,
|
|
21
|
+
the lesson — as reviewable Markdown, and injects it back into the next session
|
|
22
|
+
automatically.
|
|
23
|
+
|
|
24
|
+
> No capture, nothing to inherit.
|
|
25
|
+
|
|
26
|
+
It also complements agentic development workflows (spec-driven development,
|
|
27
|
+
plan/implement/verify loops): plans produce decisions, verification produces
|
|
28
|
+
rules — open-memex is the memory layer that keeps them across sessions instead
|
|
29
|
+
of re-deriving them on every run.
|
|
30
|
+
|
|
31
|
+
## How it compares
|
|
32
|
+
|
|
33
|
+
| | open-memex | Cloud memory services | Wiki / docs portal | Chat history |
|
|
34
|
+
|---|---|---|---|---|
|
|
35
|
+
| Data location | Your machine + your repos | Vendor servers | Central server | Gone when the chat ends |
|
|
36
|
+
| Review before sharing | Yes — outbox + PR | Varies | Yes | No |
|
|
37
|
+
| Agent recall | Session-start injection + search | API calls | Manual lookup | No |
|
|
38
|
+
| Human-readable | Plain Markdown files | Dashboard / API | Yes | No |
|
|
39
|
+
|
|
8
40
|
- **Markdown files** as the source of truth (human-editable, git-friendly)
|
|
9
41
|
- **SQLite FTS5** as a rebuildable index (BM25 keyword search, via `better-sqlite3`)
|
|
10
42
|
- **Zero cloud**, zero account, zero third-party API
|
|
11
43
|
- Loads directly under opencode's embedded Bun runtime; CLI and MCP server run under Node — no build step in development (the published npm package ships pre-compiled JS), no Bun install
|
|
12
44
|
|
|
45
|
+
## Architecture
|
|
46
|
+
|
|
47
|
+
```text
|
|
48
|
+
┌──────────────────┐
|
|
49
|
+
│ AI agent │
|
|
50
|
+
│ Copilot / Cursor │
|
|
51
|
+
│ Claude / opencode│
|
|
52
|
+
└────────┬─────────┘
|
|
53
|
+
│ MCP (stdio) — 11 tools
|
|
54
|
+
│ session-start injection
|
|
55
|
+
┌────────▼─────────┐
|
|
56
|
+
│ open-memex │
|
|
57
|
+
│ MCP server │
|
|
58
|
+
└──┬────────────┬──┘
|
|
59
|
+
│ │
|
|
60
|
+
┌────────────▼───┐ ┌─────▼──────────┐
|
|
61
|
+
│ Markdown files │ │ SQLite FTS5 │
|
|
62
|
+
│ source of truth│ │ rebuildable │
|
|
63
|
+
│ local-first │ │ index (BM25) │
|
|
64
|
+
└─────────────┬──┘ └────────────────┘
|
|
65
|
+
│ submit (explicit,
|
|
66
|
+
│ local commit)
|
|
67
|
+
┌───────▼────────┐
|
|
68
|
+
│ Git repo │
|
|
69
|
+
│ .ai/open-memex/│
|
|
70
|
+
│ PR-reviewed │
|
|
71
|
+
│ team memory │
|
|
72
|
+
└────────────────┘
|
|
73
|
+
|
|
74
|
+
personal scope: this machine only — never synced, never enters a repo.
|
|
75
|
+
```
|
|
76
|
+
|
|
13
77
|
## Installation
|
|
14
78
|
|
|
15
79
|
### Requirements
|
|
@@ -18,18 +82,36 @@ plus a generic MCP server (VS Code Copilot, Cursor, Claude Code, Visual Studio,
|
|
|
18
82
|
|
|
19
83
|
### Step 1 — Install the CLI
|
|
20
84
|
|
|
21
|
-
|
|
85
|
+
#### Stable vs alpha
|
|
86
|
+
|
|
87
|
+
**Stable** (recommended for most users) — the `latest` tag:
|
|
22
88
|
|
|
23
89
|
```sh
|
|
24
90
|
npm install -g open-memex
|
|
25
91
|
```
|
|
26
92
|
|
|
27
|
-
This installs the `0.
|
|
93
|
+
This installs the `0.4.0` stable release.
|
|
94
|
+
|
|
95
|
+
**Alpha** (bleeding edge, for testers) — the `alpha` tag:
|
|
96
|
+
|
|
97
|
+
```sh
|
|
98
|
+
npm install -g open-memex@alpha
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
See what's published:
|
|
102
|
+
|
|
103
|
+
```sh
|
|
104
|
+
npm view open-memex version # latest stable
|
|
105
|
+
npm view open-memex@alpha version # latest alpha
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
Alpha builds may have rough edges — bug reports are welcome.
|
|
28
109
|
|
|
29
110
|
**No install — run via npx:**
|
|
30
111
|
|
|
31
112
|
```sh
|
|
32
|
-
npx -y open-memex <command>
|
|
113
|
+
npx -y open-memex <command> # e.g. npx -y open-memex init --client vscode
|
|
114
|
+
npx -y open-memex@alpha <command> # alpha line, no install
|
|
33
115
|
```
|
|
34
116
|
|
|
35
117
|
**From source** (bleeding edge, `V2-dev-p2` branch):
|
|
@@ -185,6 +267,62 @@ storage writability, then boots a real MCP server and runs `initialize` +
|
|
|
185
267
|
4 characters kept, the rest replaced with `x` — and the memory is saved.
|
|
186
268
|
Preview what a message would capture with `open-memex capture --dry-run "…"`.
|
|
187
269
|
|
|
270
|
+
## Memory types
|
|
271
|
+
|
|
272
|
+
Eleven types — `type` says what the memory is, `tags` say what it's about:
|
|
273
|
+
|
|
274
|
+
| Type | Captures |
|
|
275
|
+
|---|---|
|
|
276
|
+
| `fact` | A stable true statement about the project or world |
|
|
277
|
+
| `preference` | How someone likes things done |
|
|
278
|
+
| `decision` | A choice that was made — the why and the trade-off |
|
|
279
|
+
| `constraint` | A rule that must not be violated |
|
|
280
|
+
| `todo` | A commitment to do something later |
|
|
281
|
+
| `knowledge` | Durable domain or architecture knowledge |
|
|
282
|
+
| `howto` | A procedure that worked |
|
|
283
|
+
| `gotcha` | A trap to avoid |
|
|
284
|
+
| `lesson` | What an incident or mistake taught us |
|
|
285
|
+
| `observation` | Something noticed, not yet a conclusion |
|
|
286
|
+
| `reference` | A pointer to the authoritative doc (no copying) |
|
|
287
|
+
|
|
288
|
+
## Team memory workflow
|
|
289
|
+
|
|
290
|
+
Personal notes stay private. Project knowledge follows an explicit, reviewable
|
|
291
|
+
pipeline — nothing is shared automatically:
|
|
292
|
+
|
|
293
|
+
```
|
|
294
|
+
capture → outbox (draft, local) → submit → repo (.ai/open-memex/) → PR review → published → recall
|
|
295
|
+
```
|
|
296
|
+
|
|
297
|
+
1. **Capture** — save decisions, gotchas, lessons as drafts during normal work.
|
|
298
|
+
2. **Review** — drafts wait in a local outbox; `sync-status` (or saying
|
|
299
|
+
"sync memory" in chat) shows what's pending.
|
|
300
|
+
3. **Submit** — you name the memories; they move into `<repo>/.ai/open-memex/`
|
|
301
|
+
with a local commit. open-memex never auto-pushes.
|
|
302
|
+
4. **PR review** — memories are plain Markdown; reviewers approve, request
|
|
303
|
+
changes, or reject through the normal branch/PR process (`promote`,
|
|
304
|
+
`pr-status`, `resolve`).
|
|
305
|
+
5. **Recall** — published memories are injected at session start and searchable
|
|
306
|
+
on demand, for humans and agents alike.
|
|
307
|
+
|
|
308
|
+
Reviewer convention: [docs/CURATOR.md](./docs/CURATOR.md).
|
|
309
|
+
|
|
310
|
+
## Security & data
|
|
311
|
+
|
|
312
|
+
- **Local-first:** everything lives on your machine (`%APPDATA%\open-memex` /
|
|
313
|
+
`~/.local/share/open-memex`) plus the repos you choose. Zero cloud calls,
|
|
314
|
+
zero accounts, zero third-party APIs, zero telemetry.
|
|
315
|
+
- **Secrets stay out:** `<private>…</private>` spans are stripped; detected API
|
|
316
|
+
keys/tokens are masked in place before saving. Preview with
|
|
317
|
+
`open-memex capture --dry-run "…"`.
|
|
318
|
+
- **Personal never syncs:** the `personal` scope is this machine only — excluded
|
|
319
|
+
from export by default and can never enter a repo.
|
|
320
|
+
- **Auditable sharing:** team memories move only by explicit `submit`, travel
|
|
321
|
+
through branch/PR review, and every `promote` transition is appended to the
|
|
322
|
+
memory's `review_history` (who / when / why).
|
|
323
|
+
- **You own the files:** Markdown is the source of truth — inspect, edit, or
|
|
324
|
+
delete anything by hand; the SQLite index rebuilds from the files.
|
|
325
|
+
|
|
188
326
|
## Scopes
|
|
189
327
|
|
|
190
328
|
- **project** — scoped to the current repo (keyed off the git origin URL hash, or the cwd if no remote). Default for new memories.
|
|
@@ -312,6 +450,37 @@ open-memex pr-status [--apply]
|
|
|
312
450
|
# changes-requested → suggestion only. Report by default; --apply performs
|
|
313
451
|
# the mapped transitions locally (no push).
|
|
314
452
|
|
|
453
|
+
open-memex pull
|
|
454
|
+
# pull shared memories from the git remote: fetch + fast-forward ONLY.
|
|
455
|
+
# A diverged branch fails with a clear message — open-memex never
|
|
456
|
+
# force-merges; resolve it by hand, then pull again. On success the
|
|
457
|
+
# local index re-syncs. Pulls are explicit by default; set
|
|
458
|
+
# `open-memex config set sync.autoPull true` for a best-effort pull
|
|
459
|
+
# at MCP session start (a failed pull never blocks the session).
|
|
460
|
+
|
|
461
|
+
open-memex push
|
|
462
|
+
# push the current branch (with its submitted memories) to the git remote.
|
|
463
|
+
# Explicit only — open-memex never pushes on its own.
|
|
464
|
+
|
|
465
|
+
open-memex export [--scope project|personal|both] [--type T] [--tag t] [--all] [-o <file>]
|
|
466
|
+
# bundle memories into a portable .tar.gz (markdown + manifest.json) for
|
|
467
|
+
# moving to another machine or another app. Excludes visibility:private
|
|
468
|
+
# memories by default; --all / -a includes everything (full migration).
|
|
469
|
+
|
|
470
|
+
open-memex import <bundle.tar.gz> [--dry-run]
|
|
471
|
+
# restore a bundle: personal memories go to the personal dir; project
|
|
472
|
+
# memories are re-keyed to the current project and land in the outbox as
|
|
473
|
+
# drafts. Identical ids are skipped; conflicting ids are reported,
|
|
474
|
+
# never overwritten.
|
|
475
|
+
|
|
476
|
+
open-memex distill-agents [--scope project|personal] [--type t1,t2] [--limit N] [-o <file>]
|
|
477
|
+
# propose an AGENTS.md snippet distilled from project memories
|
|
478
|
+
# (decisions, constraints, lessons, gotchas, howtos). Prints markdown;
|
|
479
|
+
# -o writes it to a file. You review and merge by hand — open-memex
|
|
480
|
+
# never rewrites your AGENTS.md on its own. The snippet ends with a
|
|
481
|
+
# "memory hygiene" section (§3.5 checkpoint guidance) so agents reading
|
|
482
|
+
# AGENTS.md learn to propose distilled captures at checkpoints.
|
|
483
|
+
|
|
315
484
|
open-memex propose <id...> --to project [--local-approve]
|
|
316
485
|
# propose one or several personal memories at once (one branch, one PR);
|
|
317
486
|
# each is copied with its own new id. All-or-nothing: a bad id aborts the
|
|
@@ -330,6 +499,10 @@ open-memex resolve [id-or-path]
|
|
|
330
499
|
# Semantic conflicts are reported, never auto-resolved.
|
|
331
500
|
```
|
|
332
501
|
|
|
502
|
+
Whoever tends the shared memory follows the curator convention —
|
|
503
|
+
`docs/CURATOR.md`: what to approve, what to send back, and the hygiene
|
|
504
|
+
rules that keep shared memory from rotting.
|
|
505
|
+
|
|
333
506
|
Maintenance:
|
|
334
507
|
|
|
335
508
|
```sh
|
|
@@ -368,28 +541,27 @@ server with cwd set to your project root (`init` handles this for you).
|
|
|
368
541
|
|
|
369
542
|
## Roadmap
|
|
370
543
|
|
|
371
|
-
**`0.3.0` (
|
|
544
|
+
**`0.3.0` (stable):** generic MCP server, `open-memex` bin/CLI, one-command
|
|
372
545
|
`init` setup, Chinese keyword capture with personal/project routing, `config` /
|
|
373
546
|
`capture --dry-run` / `doctor` helpers, Visual Studio support.
|
|
374
547
|
|
|
375
|
-
|
|
548
|
+
**`0.4.0` (stable):** team sync — shared memory via git: appdata draft
|
|
376
549
|
outbox → `sync-status` → `submit` (local branch+commit, push/PR on your Yes)
|
|
377
|
-
→ `promote` / `resolve` review workflow, in-repo `.ai/open-memex/` dir
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
Design details: [docs/V2-DESIGN.md](./docs/V2-DESIGN.md) (append-only decision log D1–D20).
|
|
550
|
+
→ `promote` / `resolve` review workflow, in-repo `.ai/open-memex/` dir;
|
|
551
|
+
`export` / `import` archive for user portability (Markdown + manifest, no walled
|
|
552
|
+
garden; private excluded by default, `-a` / `--all` for full migration);
|
|
553
|
+
distill-to-AGENTS.md assist (`distill-agents`, propose-only — you merge by hand);
|
|
554
|
+
§3.5 checkpoint distillation in the MCP handshake + init instructions (the agent
|
|
555
|
+
proposes 1–3 captures at checkpoints, the human decides); 1–2 colleague pilot.
|
|
556
|
+
|
|
557
|
+
**Future (signal-gated, no version committed):** org layer — org memory repo,
|
|
558
|
+
curator convention; native agent plugins (Claude Code / Codex hooks as
|
|
559
|
+
enhancement paths over the same MCP tools); local embeddings as a
|
|
560
|
+
benchmark-gated experiment (no embedding model is ever downloaded without
|
|
561
|
+
explicit opt-in); cloud `RemoteProvider` customization only if multi-repo
|
|
562
|
+
sharing, ACL, or compliance needs demand it.
|
|
563
|
+
|
|
564
|
+
Design details: [docs/V2-DESIGN.md](./docs/V2-DESIGN.md) (append-only decision log).
|
|
393
565
|
|
|
394
566
|
## License
|
|
395
567
|
|
package/README.zh-CN.md
CHANGED
|
@@ -1,15 +1,76 @@
|
|
|
1
1
|
# open-memex
|
|
2
2
|
|
|
3
|
+
> 共享组织记忆层,帮助人与 AI 捕获、沉淀并复用组织知识。
|
|
4
|
+
|
|
5
|
+
[](https://www.npmjs.com/package/open-memex)
|
|
6
|
+
[](./LICENSE)
|
|
7
|
+
|
|
3
8
|
[English](./README.md)
|
|
4
9
|
|
|
5
10
|
给 AI 编程助手的本地优先持久记忆:一个 [opencode](https://opencode.ai) 插件,
|
|
6
11
|
加上一个通用 MCP server(VS Code Copilot、Cursor、Claude Code、Visual Studio 等)。
|
|
7
12
|
|
|
13
|
+
## 为什么需要 open-memex?
|
|
14
|
+
|
|
15
|
+
工程知识只存在于两个地方:代码里,和人的脑子里。
|
|
16
|
+
每个新的 AI 编程会话都从零开始——同样的项目背景要反复讲,同样的坑要反复踩,
|
|
17
|
+
同样的事故教训在聊天结束时就消失了。
|
|
18
|
+
|
|
19
|
+
open-memex 把值得记住的部分——决策、约束、教训——存成可 review 的 Markdown,
|
|
20
|
+
并在下一次会话开始时自动注入回去。
|
|
21
|
+
|
|
22
|
+
> No capture, nothing to inherit.(不记录,就无从传承。)
|
|
23
|
+
|
|
24
|
+
它也补齐了 agentic 开发工作流(spec 驱动开发、plan/implement/verify 循环)缺的那一块:
|
|
25
|
+
plan 产出决策,verify 产出规则——open-memex 是让它们跨会话留存的记忆层,
|
|
26
|
+
而不是每次从头重新推导。
|
|
27
|
+
|
|
28
|
+
## 和其它方案的对比
|
|
29
|
+
|
|
30
|
+
| | open-memex | 云端记忆服务 | Wiki / 文档平台 | 聊天记录 |
|
|
31
|
+
|---|---|---|---|---|
|
|
32
|
+
| 数据在哪 | 你的机器 + 你的仓库 | 服务商服务器 | 中心服务器 | 聊天结束就没了 |
|
|
33
|
+
| 分享前 review | 有——outbox + PR | 不一定 | 有 | 没有 |
|
|
34
|
+
| Agent 回忆 | 会话开始注入 + 搜索 | 调 API | 人工去查 | 没有 |
|
|
35
|
+
| 人类可读 | 纯 Markdown 文件 | 后台 / API | 有 | 没有 |
|
|
36
|
+
|
|
8
37
|
- **Markdown 文件**是 source of truth(人类可读、git 友好)
|
|
9
38
|
- **SQLite FTS5** 做可重建索引(BM25 关键词检索,`better-sqlite3`)
|
|
10
39
|
- **零云端**、零账号、零第三方 API
|
|
11
40
|
- 直接跑在 opencode 内嵌的 Bun 运行时里;CLI 和 MCP server 跑在 Node 下——开发时无需构建(发布的 npm 包带预编译好的 JS)、无需安装 Bun
|
|
12
41
|
|
|
42
|
+
## 架构
|
|
43
|
+
|
|
44
|
+
```text
|
|
45
|
+
┌──────────────────┐
|
|
46
|
+
│ AI agent │
|
|
47
|
+
│ Copilot / Cursor │
|
|
48
|
+
│ Claude / opencode│
|
|
49
|
+
└────────┬─────────┘
|
|
50
|
+
│ MCP (stdio) — 11 tools
|
|
51
|
+
│ session-start injection
|
|
52
|
+
┌────────▼─────────┐
|
|
53
|
+
│ open-memex │
|
|
54
|
+
│ MCP server │
|
|
55
|
+
└──┬────────────┬──┘
|
|
56
|
+
│ │
|
|
57
|
+
┌────────────▼───┐ ┌─────▼──────────┐
|
|
58
|
+
│ Markdown files │ │ SQLite FTS5 │
|
|
59
|
+
│ source of truth│ │ rebuildable │
|
|
60
|
+
│ local-first │ │ index (BM25) │
|
|
61
|
+
└─────────────┬──┘ └────────────────┘
|
|
62
|
+
│ submit (explicit,
|
|
63
|
+
│ local commit)
|
|
64
|
+
┌───────▼────────┐
|
|
65
|
+
│ Git repo │
|
|
66
|
+
│ .ai/open-memex/│
|
|
67
|
+
│ PR-reviewed │
|
|
68
|
+
│ team memory │
|
|
69
|
+
└────────────────┘
|
|
70
|
+
|
|
71
|
+
personal scope:只属于这台机器——永不同步,永远进不了仓库。
|
|
72
|
+
```
|
|
73
|
+
|
|
13
74
|
## 安装
|
|
14
75
|
|
|
15
76
|
### 前置要求
|
|
@@ -18,18 +79,36 @@
|
|
|
18
79
|
|
|
19
80
|
### 第一步——安装 CLI
|
|
20
81
|
|
|
21
|
-
|
|
82
|
+
#### 稳定版 vs Alpha 版
|
|
83
|
+
|
|
84
|
+
**稳定版**(推荐大多数用户)——`latest` 标签:
|
|
22
85
|
|
|
23
86
|
```sh
|
|
24
87
|
npm install -g open-memex
|
|
25
88
|
```
|
|
26
89
|
|
|
27
|
-
安装的是 `0.
|
|
90
|
+
安装的是 `0.4.0` 正式版。
|
|
91
|
+
|
|
92
|
+
**Alpha 版**(最新开发版,给测试者)——`alpha` 标签:
|
|
93
|
+
|
|
94
|
+
```sh
|
|
95
|
+
npm install -g open-memex@alpha
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
查看已发布版本:
|
|
99
|
+
|
|
100
|
+
```sh
|
|
101
|
+
npm view open-memex version # 最新稳定版
|
|
102
|
+
npm view open-memex@alpha version # 最新 alpha 版
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
Alpha 版可能有毛边——欢迎报 bug。
|
|
28
106
|
|
|
29
107
|
**免安装——用 npx 直接跑:**
|
|
30
108
|
|
|
31
109
|
```sh
|
|
32
|
-
npx -y open-memex <命令>
|
|
110
|
+
npx -y open-memex <命令> # 例如 npx -y open-memex init --client vscode
|
|
111
|
+
npx -y open-memex@alpha <命令> # alpha 线,免安装
|
|
33
112
|
```
|
|
34
113
|
|
|
35
114
|
**从源码安装**(最新开发版,`V2-dev-p2` 分支):
|
|
@@ -180,6 +259,48 @@ open-memex doctor
|
|
|
180
259
|
(API key、token、高熵凭据)就地打码——保留前 4 个字符,其余替换为 `x`——
|
|
181
260
|
然后照常保存。用 `open-memex capture --dry-run "…"` 预览一条消息会被如何捕获。
|
|
182
261
|
|
|
262
|
+
## 记忆类型(Memory types)
|
|
263
|
+
|
|
264
|
+
11 种类型——`type` 说明这条记忆是什么,`tags` 说明它和什么有关:
|
|
265
|
+
|
|
266
|
+
| 类型 | 记录什么 |
|
|
267
|
+
|---|---|
|
|
268
|
+
| `fact` | 关于项目或世界的稳定事实 |
|
|
269
|
+
| `preference` | 某人做事的偏好 |
|
|
270
|
+
| `decision` | 做过的选择——为什么、权衡了什么 |
|
|
271
|
+
| `constraint` | 不能违反的规则 |
|
|
272
|
+
| `todo` | 以后要做的承诺 |
|
|
273
|
+
| `knowledge` | 持久的领域或架构知识 |
|
|
274
|
+
| `howto` | 验证过的做法 |
|
|
275
|
+
| `gotcha` | 要避开的坑 |
|
|
276
|
+
| `lesson` | 事故或错误教会我们的东西 |
|
|
277
|
+
| `observation` | 注意到的现象,还不是结论 |
|
|
278
|
+
| `reference` | 指向权威文档的指针(不复制内容) |
|
|
279
|
+
|
|
280
|
+
## 团队记忆工作流
|
|
281
|
+
|
|
282
|
+
个人笔记永远私有。项目知识走一条显式、可 review 的流水线——没有任何东西会自动分享:
|
|
283
|
+
|
|
284
|
+
```
|
|
285
|
+
capture → outbox(本地草稿)→ submit → 仓库(.ai/open-memex/)→ PR review → published → recall
|
|
286
|
+
```
|
|
287
|
+
|
|
288
|
+
1. **Capture**——正常工作中把决策、坑、教训存成草稿。
|
|
289
|
+
2. **Review**——草稿在本地 outbox 里等着;`sync-status`(或在聊天里说"同步记忆")查看待处理项。
|
|
290
|
+
3. **Submit**——你点名要分享的记忆才会进 `<repo>/.ai/open-memex/`,并做本地 commit。open-memex 永远不会自动 push。
|
|
291
|
+
4. **PR review**——记忆就是纯 Markdown;reviewer 走正常的分支/PR 流程批准、要求修改或拒绝(`promote`、`pr-status`、`resolve`)。
|
|
292
|
+
5. **Recall**——已发布的记忆在会话开始时自动注入,也可随时搜索,人和 agent 都能用。
|
|
293
|
+
|
|
294
|
+
Reviewer 守则:[docs/CURATOR.md](./docs/CURATOR.md)。
|
|
295
|
+
|
|
296
|
+
## 安全与数据
|
|
297
|
+
|
|
298
|
+
- **本地优先:** 所有东西都在你的机器上(`%APPDATA%\open-memex` / `~/.local/share/open-memex`),加上你选择的仓库。零云端调用、零账号、零第三方 API、零遥测。
|
|
299
|
+
- **密钥进不来:** `<private>…</private>` 包裹的内容会被剥离;检测到的 API key / token 在保存前就地打码。先用 `open-memex capture --dry-run "…"` 预览。
|
|
300
|
+
- **个人 scope 永不同步:** `personal` 只属于这台机器——export 默认排除,也永远进不了仓库。
|
|
301
|
+
- **分享可审计:** 团队记忆只能靠显式的 `submit` 移动,走分支/PR review,每次 `promote` 状态流转都会追加到记忆的 `review_history`(谁/何时/为什么)。
|
|
302
|
+
- **文件是你的:** Markdown 是 source of truth——随手看、随手改、随手删;SQLite 索引可以从文件重建。
|
|
303
|
+
|
|
183
304
|
## Scope
|
|
184
305
|
|
|
185
306
|
- **project** — 绑定当前仓库(用 git origin URL 哈希做 key,无 remote 则用 cwd)。新记忆默认进这里。
|
|
@@ -305,6 +426,33 @@ open-memex pr-status [--apply]
|
|
|
305
426
|
# PR merged → published,PR approved → approved(approved_by = reviewer),
|
|
306
427
|
# changes requested 只给建议。默认只报告;--apply 在本地执行映射的流转(不 push)。
|
|
307
428
|
|
|
429
|
+
open-memex pull
|
|
430
|
+
# 从 git 远端拉共享记忆:fetch + 只允许 fast-forward。
|
|
431
|
+
# 分支 diverged 时直接报错退出——open-memex 永不强行 merge;
|
|
432
|
+
# 手工解决(rebase 或 merge)后再 pull。成功后本地索引重新同步。
|
|
433
|
+
# pull 默认只显式触发;`open-memex config set sync.autoPull true`
|
|
434
|
+
# 可在 MCP session start 时尝试自动 pull(失败永不阻塞 session)。
|
|
435
|
+
|
|
436
|
+
open-memex push
|
|
437
|
+
# 把当前分支(含已 submit 的记忆)push 到 git 远端。
|
|
438
|
+
# 只显式触发——open-memex 永不自动 push。
|
|
439
|
+
|
|
440
|
+
open-memex export [--scope project|personal|both] [--type T] [--tag t] [--all] [-o <file>]
|
|
441
|
+
# 把记忆打包成可携带的 .tar.gz(markdown 原件 + manifest.json),
|
|
442
|
+
# 用于搬到另一台机器或导入别的工具。默认排除 visibility:private 的记忆;
|
|
443
|
+
# --all / -a 全量包含(完整迁移)。
|
|
444
|
+
|
|
445
|
+
open-memex import <bundle.tar.gz> [--dry-run]
|
|
446
|
+
# 恢复 export 的包:personal 记忆进 personal 目录;project 记忆按当前
|
|
447
|
+
# 项目重新编号 scope_key,进 outbox 当草稿。内容相同的 id 跳过;
|
|
448
|
+
# 内容冲突的 id 只报告,永不覆盖。
|
|
449
|
+
|
|
450
|
+
open-memex distill-agents [--scope project|personal] [--type t1,t2] [--limit N] [-o <file>]
|
|
451
|
+
# 把项目记忆(decision/constraint/lesson/gotcha/howto)提炼成
|
|
452
|
+
# AGENTS.md 片段。默认打印到 stdout;-o 写文件。人工审阅后手工合并——
|
|
453
|
+
# open-memex 永不自动改写你的 AGENTS.md。片段末尾带一段"记忆卫生"
|
|
454
|
+
# (§3.5 检查点指引),让读 AGENTS.md 的 agent 学会在检查点提议蒸馏捕获。
|
|
455
|
+
|
|
308
456
|
open-memex propose <id...> --to project [--local-approve]
|
|
309
457
|
# 一次 propose 一条或多条(一个分支、一个 PR),每条独立新 id。
|
|
310
458
|
# 全有或全无:id 有错整批回滚,不会留半截。
|
|
@@ -320,6 +468,9 @@ open-memex resolve [id-or-path]
|
|
|
320
468
|
# 语义冲突只报告、不自动解决。
|
|
321
469
|
```
|
|
322
470
|
|
|
471
|
+
打理共享记忆的人遵循 curator 公约——`docs/CURATOR.md`:
|
|
472
|
+
批什么、退回什么,以及防止共享记忆腐烂的卫生规则。
|
|
473
|
+
|
|
323
474
|
维护:
|
|
324
475
|
|
|
325
476
|
```sh
|
|
@@ -358,28 +509,26 @@ project scope 从进程工作目录解析,所以配置 server 时 cwd 要指
|
|
|
358
509
|
|
|
359
510
|
## 路线图(Roadmap)
|
|
360
511
|
|
|
361
|
-
**`0.3.0
|
|
512
|
+
**`0.3.0`(稳定版):** 通用 MCP server、`open-memex` bin/CLI、
|
|
362
513
|
一键 `init` 配置、中文关键词捕获(含 personal/project 路由)、
|
|
363
514
|
`config` / `capture --dry-run` / `doctor` 助手命令、Visual Studio 支持。
|
|
364
515
|
|
|
365
|
-
|
|
516
|
+
**`0.4.0`(稳定版):** 团队同步——用 git 做共享记忆:appdata 草稿箱 →
|
|
366
517
|
`sync-status` → `submit`(本地分支+commit,push/PR 拿你的 Yes 才做)
|
|
367
|
-
→ `promote` / `resolve` 评审工作流、仓库内 `.ai/open-memex/`
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
**未来(看信号再定,不承诺版本):** 原生 agent 插件
|
|
377
|
-
(Claude Code / Codex hooks,作为同一套 MCP tools 的增强路径);
|
|
518
|
+
→ `promote` / `resolve` 评审工作流、仓库内 `.ai/open-memex/` 目录;
|
|
519
|
+
`export` / `import` 归档做用户可携带(Markdown + manifest,不造围墙花园;
|
|
520
|
+
private 默认不导出,`-a` / `--all` 全量迁移);
|
|
521
|
+
distill-to-AGENTS.md 辅助(`distill-agents`,只提议不改写——人工合并);
|
|
522
|
+
§3.5 检查点蒸馏写进 MCP 握手指令和 init 指令文件
|
|
523
|
+
(agent 在检查点提议 1–3 条捕获,人来定);找 1–2 个同事做 pilot。
|
|
524
|
+
|
|
525
|
+
**未来(看信号再定,不承诺版本):** 组织层——组织记忆仓库、curator 约定;
|
|
526
|
+
原生 agent 插件(Claude Code / Codex hooks,作为同一套 MCP tools 的增强路径);
|
|
378
527
|
本地 embedding 做基准测试门控的实验(**未经明确 opt-in 绝不下载
|
|
379
528
|
embedding 模型**);云端 `RemoteProvider` 定制只在多仓库共享、
|
|
380
529
|
ACL 或合规需求出现时才做。
|
|
381
530
|
|
|
382
|
-
设计细节:[docs/V2-DESIGN.md](./docs/V2-DESIGN.md)(append-only
|
|
531
|
+
设计细节:[docs/V2-DESIGN.md](./docs/V2-DESIGN.md)(append-only 决策日志)。
|
|
383
532
|
|
|
384
533
|
## 许可证
|
|
385
534
|
|