open-memex 0.3.0 → 0.4.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 +20 -1
- package/README.md +117 -9
- package/README.zh-CN.md +103 -9
- package/dist/cli.js +583 -14
- package/dist/config.js +12 -0
- package/dist/distill-agents.js +55 -0
- package/dist/doctor.js +1 -1
- package/dist/export.js +157 -0
- package/dist/github.js +215 -0
- package/dist/index.js +6 -0
- package/dist/init.js +43 -18
- package/dist/mcp.js +119 -12
- package/dist/paths.js +31 -0
- package/dist/providers/git.js +142 -0
- package/dist/retrieve/inject.js +2 -2
- package/dist/retrieve/search.js +31 -6
- package/dist/review.js +437 -0
- package/dist/store/db.js +3 -2
- package/dist/store/lifecycle.js +28 -13
- package/dist/store/markdown.js +57 -14
- package/dist/store/sync.js +74 -6
- package/dist/submit.js +347 -0
- package/dist/tools/ops.js +171 -8
- package/docs/CURATOR.md +59 -0
- package/docs/USER-GUIDE.md +197 -0
- package/docs/USER-GUIDE.zh-CN.md +161 -0
- package/docs/V2-DESIGN.md +287 -13
- package/package.json +1 -1
- package/scripts/smoke-mcp.ts +2 -2
- package/src/cli.ts +608 -15
- package/src/config.ts +26 -0
- package/src/distill-agents.ts +70 -0
- package/src/doctor.ts +1 -1
- package/src/export.ts +206 -0
- package/src/github.ts +257 -0
- package/src/index.ts +6 -0
- package/src/init.ts +43 -17
- package/src/mcp.ts +166 -11
- package/src/paths.ts +32 -0
- package/src/providers/git.ts +191 -0
- package/src/retrieve/inject.ts +2 -2
- package/src/retrieve/search.ts +33 -6
- package/src/review.ts +504 -0
- package/src/store/db.ts +3 -2
- package/src/store/lifecycle.ts +30 -12
- package/src/store/markdown.ts +91 -14
- package/src/store/sync.ts +85 -4
- package/src/submit.ts +424 -0
- package/src/tools/ops.ts +203 -9
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
|
|
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.**
|
|
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
|
|
|
@@ -29,6 +29,18 @@ Consequences:
|
|
|
29
29
|
npm install # once
|
|
30
30
|
npm run typecheck # tsc --noEmit — the only lint/type gate
|
|
31
31
|
npm run cli -- where | list | search "q" | add ... | forget <id> | reindex
|
|
32
|
+
npm run cli -- <command> --help # per-command help (AI assistants discover flags this way)
|
|
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)
|
|
39
|
+
npm run cli -- submit <id...> [--branch <name>] [--base <branch>] # drafts → .ai/open-memex/ (current branch + local commit; never auto-branches)
|
|
40
|
+
npm run cli -- propose <id...> --to project [--local-approve] # copy personal → project outbox (batch OK)
|
|
41
|
+
npm run cli -- promote <id> [--reject] [--resubmit] [--note "..."] # proposed → approved → published (audit trail appended)
|
|
42
|
+
npm run cli -- pr-status [--apply] # map branch PR's GitHub state onto review_state (report; apply = local only)
|
|
43
|
+
npm run cli -- resolve [id-or-path] # list / 3-way-merge conflicted memories
|
|
32
44
|
npm run mcp # start the stdio MCP server
|
|
33
45
|
node --experimental-strip-types scripts\smoke-pure.ts # runs pure-logic checks (no sqlite)
|
|
34
46
|
node --experimental-strip-types scripts\smoke-mcp.ts # MCP handshake + tool round-trip (temp dirs, no real data)
|
|
@@ -129,3 +141,10 @@ hold `V2` and `V2/…` simultaneously. Full rules: `CONTRIBUTING.md`.
|
|
|
129
141
|
and the frozen `docs/V2-DESIGN.md` (append a `D<n>` decision entry, never rewrite history);
|
|
130
142
|
new commands → README CLI sections + this file's Commands. A change without its docs
|
|
131
143
|
is not done.
|
|
144
|
+
- **Version bumps ship with features.** `package.json` + `package-lock.json` carry the
|
|
145
|
+
in-development version. New features on a dev branch bump the minor on the alpha
|
|
146
|
+
line (`0.3.0` → `0.4.0-alpha.1`); fixes bump the patch (`-alpha.1` → `-alpha.2`).
|
|
147
|
+
The bump goes in the same commit as the feature, never as an afterthought.
|
|
148
|
+
The version number serves the publish: no publish, no mandatory bump. But once a
|
|
149
|
+
version has been pushed to the remote (shared), later changes must bump — two
|
|
150
|
+
different code states must never share one version number.
|
package/README.md
CHANGED
|
@@ -153,7 +153,7 @@ open-memex doctor
|
|
|
153
153
|
|
|
154
154
|
Checks: Node version, config source, scope resolution for the current directory,
|
|
155
155
|
storage writability, then boots a real MCP server and runs `initialize` +
|
|
156
|
-
`tools/list` against it — all
|
|
156
|
+
`tools/list` against it — all eleven tools must show up.
|
|
157
157
|
|
|
158
158
|
## Tools the agent gets
|
|
159
159
|
|
|
@@ -164,6 +164,12 @@ storage writability, then boots a real MCP server and runs `initialize` +
|
|
|
164
164
|
| `memory_list` | List memories in a scope, newest first |
|
|
165
165
|
| `memory_supersede` | Replace a memory with a newer version (keeps a supersede chain) |
|
|
166
166
|
| `memory_forget` | Delete a memory by id |
|
|
167
|
+
| `memory_status` | Show the sync queue: outbox drafts, repo review states, uncommitted files |
|
|
168
|
+
| `memory_submit` | Move named drafts into the repo memory dir (local branch + commit) |
|
|
169
|
+
| `memory_propose` | Copy personal memories into the project scope as review candidates |
|
|
170
|
+
| `memory_promote` | Advance `proposed → approved → published` (or reject / resubmit) |
|
|
171
|
+
| `memory_resolve` | List conflicted memory files / 3-way-merge one of them |
|
|
172
|
+
| `memory_pr_status` | Map the branch PR's GitHub state onto each memory's review state |
|
|
167
173
|
|
|
168
174
|
## Capture
|
|
169
175
|
|
|
@@ -222,10 +228,17 @@ Defaults:
|
|
|
222
228
|
"maxProfileItems": 5, // top-N personal items injected on first turn
|
|
223
229
|
"injectOnFirstTurn": true, // [OPEN-MEMEX] system-prompt block
|
|
224
230
|
"keywordCaptureEnabled": true,
|
|
225
|
-
"logLevel": "info" // info | debug
|
|
231
|
+
"logLevel": "info", // info | debug
|
|
232
|
+
"memoryDir": ".ai/open-memex" // in-repo project-memory dir, relative to repo root
|
|
226
233
|
}
|
|
227
234
|
```
|
|
228
235
|
|
|
236
|
+
Project-scope memories are stored as one Markdown file each under
|
|
237
|
+
`<repo>/<memoryDir>/` (default `.ai/open-memex/`) so they can be shared via git;
|
|
238
|
+
personal memories stay in local appdata and never leave the machine. Existing
|
|
239
|
+
project files from appdata are moved into the repo dir automatically on first
|
|
240
|
+
write/sync.
|
|
241
|
+
|
|
229
242
|
`open-memex config` prints the effective config (defaults + file).
|
|
230
243
|
Change a setting after install:
|
|
231
244
|
|
|
@@ -235,7 +248,7 @@ open-memex config set maxProjectMemories 12
|
|
|
235
248
|
```
|
|
236
249
|
|
|
237
250
|
Settable keys: `maxProjectMemories`, `maxProfileItems`, `injectOnFirstTurn`,
|
|
238
|
-
`keywordCaptureEnabled`, `logLevel`. Full design: [docs/V2-DESIGN.md](./docs/V2-DESIGN.md).
|
|
251
|
+
`keywordCaptureEnabled`, `logLevel`, `memoryDir`. Full design: [docs/V2-DESIGN.md](./docs/V2-DESIGN.md).
|
|
239
252
|
|
|
240
253
|
## CLI reference
|
|
241
254
|
|
|
@@ -249,6 +262,7 @@ open-memex doctor # environment health check
|
|
|
249
262
|
open-memex capture --dry-run "记住我喜欢简洁的回答" # preview keyword capture
|
|
250
263
|
open-memex mcp --print-config vscode|cursor|claude|opencode|visualstudio
|
|
251
264
|
open-memex --help # this reference
|
|
265
|
+
open-memex <command> --help # help for one command
|
|
252
266
|
open-memex --version # installed version
|
|
253
267
|
```
|
|
254
268
|
|
|
@@ -263,6 +277,92 @@ open-memex status <id> deprecated
|
|
|
263
277
|
open-memex forget <id>
|
|
264
278
|
```
|
|
265
279
|
|
|
280
|
+
Team review workflow (Phase 2B — two homes, one per stage):
|
|
281
|
+
|
|
282
|
+
Project drafts live in the **appdata outbox** (git-invisible, branch-independent);
|
|
283
|
+
only user-approved drafts move into `<repo>/.ai/open-memex/`, where they follow
|
|
284
|
+
branches and PRs. Nothing moves without you naming it.
|
|
285
|
+
|
|
286
|
+
In an AI chat with the MCP server connected, just say **"sync memory"**
|
|
287
|
+
(or "同步记忆") — the agent runs the status check, summarizes the outbox drafts,
|
|
288
|
+
and asks which ones to sync. The agent also proposes this on its own at session
|
|
289
|
+
start and at work checkpoints.
|
|
290
|
+
|
|
291
|
+
```sh
|
|
292
|
+
open-memex sync-status
|
|
293
|
+
# show when the index was last synced (and what triggered it), the outbox
|
|
294
|
+
# (pending sync), the repo review states
|
|
295
|
+
# (draft / proposed / approved / published / rejected),
|
|
296
|
+
# and any uncommitted repo memory files.
|
|
297
|
+
|
|
298
|
+
open-memex submit <id...> [--branch <name>] [--base <branch>]
|
|
299
|
+
# move your named drafts into .ai/open-memex/ as "proposed":
|
|
300
|
+
# copies, flips review_state, local git commit ON THE CURRENT BRANCH.
|
|
301
|
+
# Never creates a branch on its own — branch creation is your call
|
|
302
|
+
# (or the agent's, only with your explicit approval for the full chain).
|
|
303
|
+
# All-or-nothing; conflicts (same id, different content) abort cleanly.
|
|
304
|
+
# Prints the push + gh pr commands; an agent holding your Yes carries
|
|
305
|
+
# through push/PR itself. --branch <name> creates the branch first
|
|
306
|
+
# (agent full-chain path). Default PR base is the current branch; --base
|
|
307
|
+
# redirects to main or your integration branch.
|
|
308
|
+
|
|
309
|
+
open-memex pr-status [--apply]
|
|
310
|
+
# read the branch's GitHub PR and map its state onto each in-repo memory:
|
|
311
|
+
# merged PR → published, PR approval → approved (approved_by = reviewer),
|
|
312
|
+
# changes-requested → suggestion only. Report by default; --apply performs
|
|
313
|
+
# the mapped transitions locally (no push).
|
|
314
|
+
|
|
315
|
+
open-memex pull
|
|
316
|
+
# pull shared memories from the git remote: fetch + fast-forward ONLY.
|
|
317
|
+
# A diverged branch fails with a clear message — open-memex never
|
|
318
|
+
# force-merges; resolve it by hand, then pull again. On success the
|
|
319
|
+
# local index re-syncs. Pulls are explicit by default; set
|
|
320
|
+
# `open-memex config set sync.autoPull true` for a best-effort pull
|
|
321
|
+
# at MCP session start (a failed pull never blocks the session).
|
|
322
|
+
|
|
323
|
+
open-memex push
|
|
324
|
+
# push the current branch (with its submitted memories) to the git remote.
|
|
325
|
+
# Explicit only — open-memex never pushes on its own.
|
|
326
|
+
|
|
327
|
+
open-memex export [--scope project|personal|both] [--type T] [--tag t] [--all] [-o <file>]
|
|
328
|
+
# bundle memories into a portable .tar.gz (markdown + manifest.json) for
|
|
329
|
+
# moving to another machine or another app. Excludes visibility:private
|
|
330
|
+
# memories by default; --all / -a includes everything (full migration).
|
|
331
|
+
|
|
332
|
+
open-memex import <bundle.tar.gz> [--dry-run]
|
|
333
|
+
# restore a bundle: personal memories go to the personal dir; project
|
|
334
|
+
# memories are re-keyed to the current project and land in the outbox as
|
|
335
|
+
# drafts. Identical ids are skipped; conflicting ids are reported,
|
|
336
|
+
# never overwritten.
|
|
337
|
+
|
|
338
|
+
open-memex distill-agents [--scope project|personal] [--type t1,t2] [--limit N] [-o <file>]
|
|
339
|
+
# propose an AGENTS.md snippet distilled from project memories
|
|
340
|
+
# (decisions, constraints, lessons, gotchas, howtos). Prints markdown;
|
|
341
|
+
# -o writes it to a file. You review and merge by hand — open-memex
|
|
342
|
+
# never rewrites your AGENTS.md on its own.
|
|
343
|
+
|
|
344
|
+
open-memex propose <id...> --to project [--local-approve]
|
|
345
|
+
# propose one or several personal memories at once (one branch, one PR);
|
|
346
|
+
# each is copied with its own new id. All-or-nothing: a bad id aborts the
|
|
347
|
+
# whole batch, never a half-proposed one.
|
|
348
|
+
# copy a personal memory into the project scope as a review candidate
|
|
349
|
+
# (never moves — the personal original stays). Result lands in the outbox;
|
|
350
|
+
# run sync-status / submit when you're ready to put it in the repo.
|
|
351
|
+
open-memex promote <id> [--reject] [--resubmit] [--note "..."] [--by NAME]
|
|
352
|
+
# advance one step: proposed → approved → published (or reject with a note).
|
|
353
|
+
# Every transition is appended to the memory's review_history (who/when/why).
|
|
354
|
+
# A rejection never deletes the file — your call: accept it (close the PR,
|
|
355
|
+
# delete the branch), revise + --resubmit for another round, or keep it as
|
|
356
|
+
# a [rejected] record.
|
|
357
|
+
open-memex resolve [id-or-path]
|
|
358
|
+
# list conflicted memory files, or field-level 3-way merge one of them.
|
|
359
|
+
# Semantic conflicts are reported, never auto-resolved.
|
|
360
|
+
```
|
|
361
|
+
|
|
362
|
+
Whoever tends the shared memory follows the curator convention —
|
|
363
|
+
`docs/CURATOR.md`: what to approve, what to send back, and the hygiene
|
|
364
|
+
rules that keep shared memory from rotting.
|
|
365
|
+
|
|
266
366
|
Maintenance:
|
|
267
367
|
|
|
268
368
|
```sh
|
|
@@ -280,7 +380,7 @@ simple cases — npm swallows unknown `--flag` args, so prefer direct `node`).
|
|
|
280
380
|
|
|
281
381
|
## MCP server
|
|
282
382
|
|
|
283
|
-
The same
|
|
383
|
+
The same eleven memory tools over the Model Context Protocol via a stdio server —
|
|
284
384
|
no host-specific plugin needed. Any MCP client can use open-memex.
|
|
285
385
|
|
|
286
386
|
```sh
|
|
@@ -293,8 +393,11 @@ server with cwd set to your project root (`init` handles this for you).
|
|
|
293
393
|
|
|
294
394
|
> **Note:** MCP is request/response — it gives the agent tools, not the opencode
|
|
295
395
|
> plugin's automatic keyword capture or first-turn context injection. Proactive
|
|
296
|
-
> memory use depends on the agent's instructions
|
|
297
|
-
>
|
|
396
|
+
> memory use depends on the agent's instructions: the server sends session-start
|
|
397
|
+
> guidance (call `memory_status` at session start and at checkpoints) in the MCP
|
|
398
|
+
> handshake `instructions`, and `init` writes the fuller version into the
|
|
399
|
+
> editor's instruction files. Both are advisory — no MCP consumer offers a hard
|
|
400
|
+
> session-start hook.
|
|
298
401
|
|
|
299
402
|
## Roadmap
|
|
300
403
|
|
|
@@ -302,11 +405,16 @@ server with cwd set to your project root (`init` handles this for you).
|
|
|
302
405
|
`init` setup, Chinese keyword capture with personal/project routing, `config` /
|
|
303
406
|
`capture --dry-run` / `doctor` helpers, Visual Studio support.
|
|
304
407
|
|
|
305
|
-
**
|
|
306
|
-
`
|
|
408
|
+
**In progress — `0.4.0`:** team sync — shared memory via git: appdata draft
|
|
409
|
+
outbox → `sync-status` → `submit` (local branch+commit, push/PR on your Yes)
|
|
410
|
+
→ `promote` / `resolve` review workflow, in-repo `.ai/open-memex/` dir, 1–2
|
|
411
|
+
colleague pilot; capture — §3.5 checkpoint distillation in MCP handshake +
|
|
412
|
+
init instructions (agent proposes 1–3 captures, human decides).
|
|
307
413
|
|
|
308
414
|
**Coming — `0.3.0` (stable):** org layer — org memory repo, curator convention,
|
|
309
|
-
distill-to-AGENTS.md assist
|
|
415
|
+
distill-to-AGENTS.md assist, `export`/`import` archive for user portability
|
|
416
|
+
(Markdown + manifest, no walled garden; private excluded by default,
|
|
417
|
+
`-a`/`--all` for full migration).
|
|
310
418
|
|
|
311
419
|
**Future (signal-gated, no version committed):** native agent plugins (Claude Code /
|
|
312
420
|
Codex hooks as enhancement paths over the same MCP tools); local embeddings as a
|
package/README.zh-CN.md
CHANGED
|
@@ -149,7 +149,7 @@ open-memex doctor
|
|
|
149
149
|
|
|
150
150
|
检查:Node 版本、配置来源、当前目录的 scope 解析、存储可写性,
|
|
151
151
|
然后启动一个真实的 MCP server 做 `initialize` + `tools/list`——
|
|
152
|
-
|
|
152
|
+
十一个 tools 都必须出现。
|
|
153
153
|
|
|
154
154
|
## Agent 可用的 tools
|
|
155
155
|
|
|
@@ -160,6 +160,12 @@ open-memex doctor
|
|
|
160
160
|
| `memory_list` | 按 scope 列出记忆,最新的在前 |
|
|
161
161
|
| `memory_supersede` | 用新版本替换一条记忆(保留替换链) |
|
|
162
162
|
| `memory_forget` | 按 id 删除一条记忆 |
|
|
163
|
+
| `memory_status` | 显示同步队列:outbox 草稿、repo 评审状态、未提交文件 |
|
|
164
|
+
| `memory_submit` | 把点名的草稿移入 repo memory 目录(建本地分支 + commit) |
|
|
165
|
+
| `memory_propose` | 把 personal 记忆复制到 project scope 作为评审候选 |
|
|
166
|
+
| `memory_promote` | 推进 `proposed → approved → published`(或 reject / resubmit) |
|
|
167
|
+
| `memory_resolve` | 列出冲突的记忆文件 / 对单个做三路合并 |
|
|
168
|
+
| `memory_pr_status` | 把分支 PR 的 GitHub 状态映射到每条记忆的评审状态 |
|
|
163
169
|
|
|
164
170
|
## 捕获(Capture)
|
|
165
171
|
|
|
@@ -220,10 +226,16 @@ Markdown 是 source of truth,SQLite 索引是派生的、可重建的
|
|
|
220
226
|
"maxProfileItems": 5, // 首轮注入的个人偏好条数
|
|
221
227
|
"injectOnFirstTurn": true, // [OPEN-MEMEX] system-prompt 块
|
|
222
228
|
"keywordCaptureEnabled": true,
|
|
223
|
-
"logLevel": "info" // info | debug
|
|
229
|
+
"logLevel": "info", // info | debug
|
|
230
|
+
"memoryDir": ".ai/open-memex" // 仓库内项目记忆目录,相对于仓库根目录
|
|
224
231
|
}
|
|
225
232
|
```
|
|
226
233
|
|
|
234
|
+
project scope 的记忆以"一个记忆一个 Markdown 文件"的形式存放在
|
|
235
|
+
`<仓库>/<memoryDir>/`(默认 `.ai/open-memex/`)下,可经 git 共享;
|
|
236
|
+
personal 记忆只存本地 appdata,永不离开本机。已有的 appdata 项目文件会在
|
|
237
|
+
首次写入/同步时自动搬进仓库目录。
|
|
238
|
+
|
|
227
239
|
`open-memex config` 打印生效配置(默认值 + 文件)。
|
|
228
240
|
安装后改设置:
|
|
229
241
|
|
|
@@ -233,7 +245,7 @@ open-memex config set maxProjectMemories 12
|
|
|
233
245
|
```
|
|
234
246
|
|
|
235
247
|
可设置的 key:`maxProjectMemories`、`maxProfileItems`、`injectOnFirstTurn`、
|
|
236
|
-
`keywordCaptureEnabled`、`logLevel`。完整设计见
|
|
248
|
+
`keywordCaptureEnabled`、`logLevel`、`memoryDir`。完整设计见
|
|
237
249
|
[docs/V2-DESIGN.md](./docs/V2-DESIGN.md)。
|
|
238
250
|
|
|
239
251
|
## CLI 参考
|
|
@@ -248,6 +260,7 @@ open-memex doctor # 环境健康检查
|
|
|
248
260
|
open-memex capture --dry-run "记住我喜欢简洁的回答" # 预览关键词捕获
|
|
249
261
|
open-memex mcp --print-config vscode|cursor|claude|opencode|visualstudio
|
|
250
262
|
open-memex --help # 本帮助
|
|
263
|
+
open-memex <command> --help # 单个命令的帮助
|
|
251
264
|
open-memex --version # 已安装版本
|
|
252
265
|
```
|
|
253
266
|
|
|
@@ -262,6 +275,80 @@ open-memex status <id> deprecated
|
|
|
262
275
|
open-memex forget <id>
|
|
263
276
|
```
|
|
264
277
|
|
|
278
|
+
团队评审工作流(Phase 2B —— 两个家,各管一段):
|
|
279
|
+
|
|
280
|
+
project 草稿先住在 **appdata outbox**(git 看不见、跟分支无关);只有你
|
|
281
|
+
点名批准的草稿,才会被移入 `<repo>/.ai/open-memex/`,之后随分支和 PR 走。
|
|
282
|
+
没经过你点名,什么都不会动。
|
|
283
|
+
|
|
284
|
+
在接了 MCP 服务器的 AI 对话里,直接说 **"同步记忆"**(或 "sync memory")——
|
|
285
|
+
agent 会查状态、把 outbox 草稿逐条摘要、问你同步哪几条。agent 也会在新对话
|
|
286
|
+
开始和任务检查点主动提这件事。
|
|
287
|
+
|
|
288
|
+
```sh
|
|
289
|
+
open-memex sync-status
|
|
290
|
+
# 看索引上次同步的时间和触发方、outbox(待同步)、repo 里的评审状态
|
|
291
|
+
# (draft / proposed / approved / published / rejected),
|
|
292
|
+
# 以及 repo 里还没 commit 的记忆文件。
|
|
293
|
+
|
|
294
|
+
open-memex submit <id...> [--branch <name>] [--base <branch>]
|
|
295
|
+
# 把你点名的草稿移入 .ai/open-memex/,状态变为 proposed:
|
|
296
|
+
# 复制、改 review_state、在当前分支本地 git commit。
|
|
297
|
+
# 永不自动建分支——建分支是你说了算(或 Agent 拿到你明确批准走全链时)。
|
|
298
|
+
# 全有或全无;冲突(同 id 不同内容)干净回滚。
|
|
299
|
+
# 打印 push + gh pr 命令;Agent 拿到你的 Yes 后会自己走完 push/PR。
|
|
300
|
+
# --branch <name> 先建分支再提交(Agent 全链路径)。
|
|
301
|
+
# PR 默认 base 是当前分支;--base 可改到 main 或集成支。
|
|
302
|
+
|
|
303
|
+
open-memex pr-status [--apply]
|
|
304
|
+
# 读分支的 GitHub PR,把它的状态映射到每条 in-repo 记忆:
|
|
305
|
+
# PR merged → published,PR approved → approved(approved_by = reviewer),
|
|
306
|
+
# changes requested 只给建议。默认只报告;--apply 在本地执行映射的流转(不 push)。
|
|
307
|
+
|
|
308
|
+
open-memex pull
|
|
309
|
+
# 从 git 远端拉共享记忆:fetch + 只允许 fast-forward。
|
|
310
|
+
# 分支 diverged 时直接报错退出——open-memex 永不强行 merge;
|
|
311
|
+
# 手工解决(rebase 或 merge)后再 pull。成功后本地索引重新同步。
|
|
312
|
+
# pull 默认只显式触发;`open-memex config set sync.autoPull true`
|
|
313
|
+
# 可在 MCP session start 时尝试自动 pull(失败永不阻塞 session)。
|
|
314
|
+
|
|
315
|
+
open-memex push
|
|
316
|
+
# 把当前分支(含已 submit 的记忆)push 到 git 远端。
|
|
317
|
+
# 只显式触发——open-memex 永不自动 push。
|
|
318
|
+
|
|
319
|
+
open-memex export [--scope project|personal|both] [--type T] [--tag t] [--all] [-o <file>]
|
|
320
|
+
# 把记忆打包成可携带的 .tar.gz(markdown 原件 + manifest.json),
|
|
321
|
+
# 用于搬到另一台机器或导入别的工具。默认排除 visibility:private 的记忆;
|
|
322
|
+
# --all / -a 全量包含(完整迁移)。
|
|
323
|
+
|
|
324
|
+
open-memex import <bundle.tar.gz> [--dry-run]
|
|
325
|
+
# 恢复 export 的包:personal 记忆进 personal 目录;project 记忆按当前
|
|
326
|
+
# 项目重新编号 scope_key,进 outbox 当草稿。内容相同的 id 跳过;
|
|
327
|
+
# 内容冲突的 id 只报告,永不覆盖。
|
|
328
|
+
|
|
329
|
+
open-memex distill-agents [--scope project|personal] [--type t1,t2] [--limit N] [-o <file>]
|
|
330
|
+
# 把项目记忆(decision/constraint/lesson/gotcha/howto)提炼成
|
|
331
|
+
# AGENTS.md 片段。默认打印到 stdout;-o 写文件。人工审阅后手工合并——
|
|
332
|
+
# open-memex 永不自动改写你的 AGENTS.md。
|
|
333
|
+
|
|
334
|
+
open-memex propose <id...> --to project [--local-approve]
|
|
335
|
+
# 一次 propose 一条或多条(一个分支、一个 PR),每条独立新 id。
|
|
336
|
+
# 全有或全无:id 有错整批回滚,不会留半截。
|
|
337
|
+
# 把一条 personal 记忆复制到 project scope 进入评审(复制而非移动,
|
|
338
|
+
# personal 原件保留)。结果落在 outbox;准备好进 repo 时再 sync-status / submit。
|
|
339
|
+
open-memex promote <id> [--reject] [--resubmit] [--note "..."] [--by NAME]
|
|
340
|
+
# 晋升一步:proposed → approved → published(或用 --reject 驳回并附注原因)。
|
|
341
|
+
# 每次流转都追加到记忆的 review_history(谁、何时、为什么)。
|
|
342
|
+
# 驳回不删文件,由你决定:接受(关 PR 删分支)、改完 --resubmit 再审、
|
|
343
|
+
# 或留着当 [rejected] 记录。
|
|
344
|
+
open-memex resolve [id-or-path]
|
|
345
|
+
# 列出冲突中的记忆文件,或对其中一个做字段级 3-way 合并。
|
|
346
|
+
# 语义冲突只报告、不自动解决。
|
|
347
|
+
```
|
|
348
|
+
|
|
349
|
+
打理共享记忆的人遵循 curator 公约——`docs/CURATOR.md`:
|
|
350
|
+
批什么、退回什么,以及防止共享记忆腐烂的卫生规则。
|
|
351
|
+
|
|
265
352
|
维护:
|
|
266
353
|
|
|
267
354
|
```sh
|
|
@@ -280,7 +367,7 @@ CLI 跑在 Node 22 下。从源码 checkout 使用时走内置的实验性 TypeS
|
|
|
280
367
|
|
|
281
368
|
## MCP server
|
|
282
369
|
|
|
283
|
-
|
|
370
|
+
同一个十一个 memory tools,走 Model Context Protocol 的 stdio server——
|
|
284
371
|
不需要宿主专属插件,任何 MCP 客户端都能用 open-memex。
|
|
285
372
|
|
|
286
373
|
```sh
|
|
@@ -293,7 +380,10 @@ project scope 从进程工作目录解析,所以配置 server 时 cwd 要指
|
|
|
293
380
|
|
|
294
381
|
> **注意:** MCP 是请求/响应式的——它给 agent 提供 tools,但没有 opencode
|
|
295
382
|
> 插件的关键词自动捕获和首轮上下文注入。想让 agent 主动用记忆,
|
|
296
|
-
> 靠的是 agent 的 instructions
|
|
383
|
+
> 靠的是 agent 的 instructions:服务器在 MCP 握手的 `instructions` 里自带
|
|
384
|
+
> session-start 指引(开场调 `memory_status`、检查点再调),`init` 则把更完整
|
|
385
|
+
> 的版本写进编辑器的 instruction 文件。两者都是建议性的——MCP 客户端没有
|
|
386
|
+
> 强制的 session-start hook。
|
|
297
387
|
|
|
298
388
|
## 路线图(Roadmap)
|
|
299
389
|
|
|
@@ -301,12 +391,16 @@ project scope 从进程工作目录解析,所以配置 server 时 cwd 要指
|
|
|
301
391
|
一键 `init` 配置、中文关键词捕获(含 personal/project 路由)、
|
|
302
392
|
`config` / `capture --dry-run` / `doctor` 助手命令、Visual Studio 支持。
|
|
303
393
|
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
394
|
+
**进行中 —— `0.4.0`:** 团队同步——用 git 做共享记忆:appdata 草稿箱 →
|
|
395
|
+
`sync-status` → `submit`(本地分支+commit,push/PR 拿你的 Yes 才做)
|
|
396
|
+
→ `promote` / `resolve` 评审工作流、仓库内 `.ai/open-memex/` 目录,
|
|
397
|
+
找 1–2 个同事做 pilot;捕获——§3.5 检查点蒸馏写进 MCP 握手指令和
|
|
398
|
+
init 指令文件(agent 提议 1–3 条,人来定)。
|
|
307
399
|
|
|
308
400
|
**Coming —— `0.3.0`(稳定版):** 组织层——组织记忆仓库、
|
|
309
|
-
curator 约定、distill-to-AGENTS.md
|
|
401
|
+
curator 约定、distill-to-AGENTS.md 辅助、`export`/`import` 归档
|
|
402
|
+
(Markdown + manifest,不造围墙花园,用户可带走;
|
|
403
|
+
private 默认不导出,`-a`/`--all` 全量迁移)。
|
|
310
404
|
|
|
311
405
|
**未来(看信号再定,不承诺版本):** 原生 agent 插件
|
|
312
406
|
(Claude Code / Codex hooks,作为同一套 MCP tools 的增强路径);
|