open-memex 0.4.0-alpha.1 → 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 +10 -1
- package/README.md +58 -11
- package/README.zh-CN.md +49 -7
- package/dist/cli.js +371 -5
- package/dist/config.js +2 -0
- package/dist/distill-agents.js +55 -0
- package/dist/doctor.js +1 -1
- package/dist/export.js +157 -0
- package/dist/init.js +22 -9
- package/dist/mcp.js +75 -4
- package/dist/providers/git.js +142 -0
- package/dist/store/markdown.js +8 -6
- package/dist/submit.js +23 -15
- package/dist/tools/ops.js +17 -11
- package/docs/CURATOR.md +59 -0
- package/docs/USER-GUIDE.md +10 -8
- package/docs/USER-GUIDE.zh-CN.md +7 -6
- package/docs/V2-DESIGN.md +179 -7
- package/package.json +1 -1
- package/src/cli.ts +406 -5
- package/src/config.ts +10 -0
- package/src/distill-agents.ts +70 -0
- package/src/doctor.ts +1 -1
- package/src/export.ts +206 -0
- package/src/init.ts +22 -9
- package/src/mcp.ts +80 -4
- package/src/providers/git.ts +191 -0
- package/src/store/markdown.ts +8 -6
- package/src/store/sync.ts +1 -1
- package/src/submit.ts +30 -17
- package/src/tools/ops.ts +20 -11
package/AGENTS.md
CHANGED
|
@@ -29,8 +29,14 @@ 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)
|
|
32
33
|
npm run cli -- sync-status # last sync time/kind + outbox drafts + repo review states + uncommitted files
|
|
33
|
-
npm run cli --
|
|
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)
|
|
34
40
|
npm run cli -- propose <id...> --to project [--local-approve] # copy personal → project outbox (batch OK)
|
|
35
41
|
npm run cli -- promote <id> [--reject] [--resubmit] [--note "..."] # proposed → approved → published (audit trail appended)
|
|
36
42
|
npm run cli -- pr-status [--apply] # map branch PR's GitHub state onto review_state (report; apply = local only)
|
|
@@ -139,3 +145,6 @@ hold `V2` and `V2/…` simultaneously. Full rules: `CONTRIBUTING.md`.
|
|
|
139
145
|
in-development version. New features on a dev branch bump the minor on the alpha
|
|
140
146
|
line (`0.3.0` → `0.4.0-alpha.1`); fixes bump the patch (`-alpha.1` → `-alpha.2`).
|
|
141
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
|
@@ -262,6 +262,7 @@ open-memex doctor # environment health check
|
|
|
262
262
|
open-memex capture --dry-run "记住我喜欢简洁的回答" # preview keyword capture
|
|
263
263
|
open-memex mcp --print-config vscode|cursor|claude|opencode|visualstudio
|
|
264
264
|
open-memex --help # this reference
|
|
265
|
+
open-memex <command> --help # help for one command
|
|
265
266
|
open-memex --version # installed version
|
|
266
267
|
```
|
|
267
268
|
|
|
@@ -282,6 +283,11 @@ Project drafts live in the **appdata outbox** (git-invisible, branch-independent
|
|
|
282
283
|
only user-approved drafts move into `<repo>/.ai/open-memex/`, where they follow
|
|
283
284
|
branches and PRs. Nothing moves without you naming it.
|
|
284
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
|
+
|
|
285
291
|
```sh
|
|
286
292
|
open-memex sync-status
|
|
287
293
|
# show when the index was last synced (and what triggered it), the outbox
|
|
@@ -289,14 +295,16 @@ open-memex sync-status
|
|
|
289
295
|
# (draft / proposed / approved / published / rejected),
|
|
290
296
|
# and any uncommitted repo memory files.
|
|
291
297
|
|
|
292
|
-
open-memex submit <id...> [--
|
|
298
|
+
open-memex submit <id...> [--branch <name>] [--base <branch>]
|
|
293
299
|
# move your named drafts into .ai/open-memex/ as "proposed":
|
|
294
|
-
#
|
|
295
|
-
#
|
|
296
|
-
# (
|
|
297
|
-
#
|
|
298
|
-
#
|
|
299
|
-
#
|
|
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.
|
|
300
308
|
|
|
301
309
|
open-memex pr-status [--apply]
|
|
302
310
|
# read the branch's GitHub PR and map its state onto each in-repo memory:
|
|
@@ -304,6 +312,35 @@ open-memex pr-status [--apply]
|
|
|
304
312
|
# changes-requested → suggestion only. Report by default; --apply performs
|
|
305
313
|
# the mapped transitions locally (no push).
|
|
306
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
|
+
|
|
307
344
|
open-memex propose <id...> --to project [--local-approve]
|
|
308
345
|
# propose one or several personal memories at once (one branch, one PR);
|
|
309
346
|
# each is copied with its own new id. All-or-nothing: a bad id aborts the
|
|
@@ -322,6 +359,10 @@ open-memex resolve [id-or-path]
|
|
|
322
359
|
# Semantic conflicts are reported, never auto-resolved.
|
|
323
360
|
```
|
|
324
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
|
+
|
|
325
366
|
Maintenance:
|
|
326
367
|
|
|
327
368
|
```sh
|
|
@@ -352,8 +393,11 @@ server with cwd set to your project root (`init` handles this for you).
|
|
|
352
393
|
|
|
353
394
|
> **Note:** MCP is request/response — it gives the agent tools, not the opencode
|
|
354
395
|
> plugin's automatic keyword capture or first-turn context injection. Proactive
|
|
355
|
-
> memory use depends on the agent's instructions
|
|
356
|
-
>
|
|
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.
|
|
357
401
|
|
|
358
402
|
## Roadmap
|
|
359
403
|
|
|
@@ -364,10 +408,13 @@ server with cwd set to your project root (`init` handles this for you).
|
|
|
364
408
|
**In progress — `0.4.0`:** team sync — shared memory via git: appdata draft
|
|
365
409
|
outbox → `sync-status` → `submit` (local branch+commit, push/PR on your Yes)
|
|
366
410
|
→ `promote` / `resolve` review workflow, in-repo `.ai/open-memex/` dir, 1–2
|
|
367
|
-
colleague pilot.
|
|
411
|
+
colleague pilot; capture — §3.5 checkpoint distillation in MCP handshake +
|
|
412
|
+
init instructions (agent proposes 1–3 captures, human decides).
|
|
368
413
|
|
|
369
414
|
**Coming — `0.3.0` (stable):** org layer — org memory repo, curator convention,
|
|
370
|
-
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).
|
|
371
418
|
|
|
372
419
|
**Future (signal-gated, no version committed):** native agent plugins (Claude Code /
|
|
373
420
|
Codex hooks as enhancement paths over the same MCP tools); local embeddings as a
|
package/README.zh-CN.md
CHANGED
|
@@ -260,6 +260,7 @@ open-memex doctor # 环境健康检查
|
|
|
260
260
|
open-memex capture --dry-run "记住我喜欢简洁的回答" # 预览关键词捕获
|
|
261
261
|
open-memex mcp --print-config vscode|cursor|claude|opencode|visualstudio
|
|
262
262
|
open-memex --help # 本帮助
|
|
263
|
+
open-memex <command> --help # 单个命令的帮助
|
|
263
264
|
open-memex --version # 已安装版本
|
|
264
265
|
```
|
|
265
266
|
|
|
@@ -280,17 +281,23 @@ project 草稿先住在 **appdata outbox**(git 看不见、跟分支无关)
|
|
|
280
281
|
点名批准的草稿,才会被移入 `<repo>/.ai/open-memex/`,之后随分支和 PR 走。
|
|
281
282
|
没经过你点名,什么都不会动。
|
|
282
283
|
|
|
284
|
+
在接了 MCP 服务器的 AI 对话里,直接说 **"同步记忆"**(或 "sync memory")——
|
|
285
|
+
agent 会查状态、把 outbox 草稿逐条摘要、问你同步哪几条。agent 也会在新对话
|
|
286
|
+
开始和任务检查点主动提这件事。
|
|
287
|
+
|
|
283
288
|
```sh
|
|
284
289
|
open-memex sync-status
|
|
285
290
|
# 看索引上次同步的时间和触发方、outbox(待同步)、repo 里的评审状态
|
|
286
291
|
# (draft / proposed / approved / published / rejected),
|
|
287
292
|
# 以及 repo 里还没 commit 的记忆文件。
|
|
288
293
|
|
|
289
|
-
open-memex submit <id...> [--
|
|
294
|
+
open-memex submit <id...> [--branch <name>] [--base <branch>]
|
|
290
295
|
# 把你点名的草稿移入 .ai/open-memex/,状态变为 proposed:
|
|
291
|
-
#
|
|
292
|
-
#
|
|
293
|
-
#
|
|
296
|
+
# 复制、改 review_state、在当前分支本地 git commit。
|
|
297
|
+
# 永不自动建分支——建分支是你说了算(或 Agent 拿到你明确批准走全链时)。
|
|
298
|
+
# 全有或全无;冲突(同 id 不同内容)干净回滚。
|
|
299
|
+
# 打印 push + gh pr 命令;Agent 拿到你的 Yes 后会自己走完 push/PR。
|
|
300
|
+
# --branch <name> 先建分支再提交(Agent 全链路径)。
|
|
294
301
|
# PR 默认 base 是当前分支;--base 可改到 main 或集成支。
|
|
295
302
|
|
|
296
303
|
open-memex pr-status [--apply]
|
|
@@ -298,6 +305,32 @@ open-memex pr-status [--apply]
|
|
|
298
305
|
# PR merged → published,PR approved → approved(approved_by = reviewer),
|
|
299
306
|
# changes requested 只给建议。默认只报告;--apply 在本地执行映射的流转(不 push)。
|
|
300
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
|
+
|
|
301
334
|
open-memex propose <id...> --to project [--local-approve]
|
|
302
335
|
# 一次 propose 一条或多条(一个分支、一个 PR),每条独立新 id。
|
|
303
336
|
# 全有或全无:id 有错整批回滚,不会留半截。
|
|
@@ -313,6 +346,9 @@ open-memex resolve [id-or-path]
|
|
|
313
346
|
# 语义冲突只报告、不自动解决。
|
|
314
347
|
```
|
|
315
348
|
|
|
349
|
+
打理共享记忆的人遵循 curator 公约——`docs/CURATOR.md`:
|
|
350
|
+
批什么、退回什么,以及防止共享记忆腐烂的卫生规则。
|
|
351
|
+
|
|
316
352
|
维护:
|
|
317
353
|
|
|
318
354
|
```sh
|
|
@@ -344,7 +380,10 @@ project scope 从进程工作目录解析,所以配置 server 时 cwd 要指
|
|
|
344
380
|
|
|
345
381
|
> **注意:** MCP 是请求/响应式的——它给 agent 提供 tools,但没有 opencode
|
|
346
382
|
> 插件的关键词自动捕获和首轮上下文注入。想让 agent 主动用记忆,
|
|
347
|
-
> 靠的是 agent 的 instructions
|
|
383
|
+
> 靠的是 agent 的 instructions:服务器在 MCP 握手的 `instructions` 里自带
|
|
384
|
+
> session-start 指引(开场调 `memory_status`、检查点再调),`init` 则把更完整
|
|
385
|
+
> 的版本写进编辑器的 instruction 文件。两者都是建议性的——MCP 客户端没有
|
|
386
|
+
> 强制的 session-start hook。
|
|
348
387
|
|
|
349
388
|
## 路线图(Roadmap)
|
|
350
389
|
|
|
@@ -355,10 +394,13 @@ project scope 从进程工作目录解析,所以配置 server 时 cwd 要指
|
|
|
355
394
|
**进行中 —— `0.4.0`:** 团队同步——用 git 做共享记忆:appdata 草稿箱 →
|
|
356
395
|
`sync-status` → `submit`(本地分支+commit,push/PR 拿你的 Yes 才做)
|
|
357
396
|
→ `promote` / `resolve` 评审工作流、仓库内 `.ai/open-memex/` 目录,
|
|
358
|
-
找 1–2 个同事做 pilot
|
|
397
|
+
找 1–2 个同事做 pilot;捕获——§3.5 检查点蒸馏写进 MCP 握手指令和
|
|
398
|
+
init 指令文件(agent 提议 1–3 条,人来定)。
|
|
359
399
|
|
|
360
400
|
**Coming —— `0.3.0`(稳定版):** 组织层——组织记忆仓库、
|
|
361
|
-
curator 约定、distill-to-AGENTS.md
|
|
401
|
+
curator 约定、distill-to-AGENTS.md 辅助、`export`/`import` 归档
|
|
402
|
+
(Markdown + manifest,不造围墙花园,用户可带走;
|
|
403
|
+
private 默认不导出,`-a`/`--all` 全量迁移)。
|
|
362
404
|
|
|
363
405
|
**未来(看信号再定,不承诺版本):** 原生 agent 插件
|
|
364
406
|
(Claude Code / Codex hooks,作为同一套 MCP tools 的增强路径);
|