open-memex 0.7.0-alpha.4 → 0.7.0-alpha.6
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 -2
- package/CHANGELOG.md +22 -0
- package/README.md +10 -9
- package/README.zh-CN.md +12 -12
- package/dist/cli.js +2 -1
- package/dist/config.js +5 -4
- package/dist/distill-agents.js +6 -1
- package/dist/doctor.js +21 -0
- package/dist/init.js +17 -6
- package/dist/review.js +9 -3
- package/dist/store/lifecycle.js +18 -4
- package/dist/store/markdown.js +14 -6
- package/dist/store/migrate.js +2 -2
- package/dist/store/v2migrate.js +2 -2
- package/dist/submit.js +9 -4
- package/dist/tools/memory.js +23 -0
- package/dist/tools/ops.js +37 -3
- package/docs/CURATOR.md +7 -3
- package/docs/V2-DESIGN.md +75 -26
- package/package.json +1 -1
- package/scripts/smoke-pure.ts +22 -0
- package/scripts/test-full.ts +92 -0
- package/src/cli.ts +2 -1
- package/src/config.ts +5 -4
- package/src/distill-agents.ts +6 -0
- package/src/doctor.ts +24 -0
- package/src/init.ts +16 -6
- package/src/review.ts +9 -2
- package/src/store/lifecycle.ts +21 -3
- package/src/store/markdown.ts +15 -6
- package/src/store/migrate.ts +2 -1
- package/src/store/v2migrate.ts +2 -1
- package/src/submit.ts +7 -3
- package/src/tools/memory.ts +23 -0
- package/src/tools/ops.ts +45 -3
package/AGENTS.md
CHANGED
|
@@ -151,16 +151,19 @@ AGENTS.md hygiene footer, the MCP handshake, and the tool descriptions.
|
|
|
151
151
|
|
|
152
152
|
- Statuses: `active → superseded | deprecated | retracted | archived`. Retrieval excludes `retracted`/`archived`, ranks `active` above `deprecated`.
|
|
153
153
|
- Never hand-write `status: superseded` or half a chain. Use the `supersede` code path (`src/store/lifecycle.ts`): the old record keeps its file, flips to `superseded`, and both sides get `supersedes`/`superseded_by`. Only `active` memories can be superseded.
|
|
154
|
+
- Superseding a memory that had entered review (proposed/approved/published/rejected) starts the replacement at `review_state: proposed` so `promote` can advance it (D64). Never reset it to `draft` — a draft in the repo dir is stranded (submit only moves outbox files).
|
|
155
|
+
- `setStatus` refuses `retracted → active` (D64): retracted content must not silently return to recall. Save a new memory instead.
|
|
156
|
+
- **Every memory-file write goes through `atomicWriteTextSync`** (markdown.ts; tmp + rename). The create path, supersede flips, review transitions, submit landings, migrate/v2migrate rewrites — no direct `fs.writeFileSync` on a memory file. A torn read mid-rewrite parses as a deletion and drops the memory from the index.
|
|
154
157
|
- Chain integrity is self-healing: on read, a missing counterpart is auto-completed with a warning; a dangling pointer warns but is never fabricated. Don't "fix" chains by editing frontmatter directly — let the read path do it.
|
|
155
158
|
- Frontmatter is `schema_version: 2`. The SQLite index schema is versioned separately and rebuilds automatically on version change — never hand-edit `index.db`.
|
|
156
159
|
|
|
157
|
-
Keyword capture fires from `chat.message` on the user's message parts (`UserMessage`). Patterns live in `src/capture/keywords.ts` / config `keywordPatterns`; regex group 1 is the memory body. Scope routing: personal patterns (`cfg.keywordPersonalPatterns`) force the personal scope — the rule is 我 → personal (
|
|
160
|
+
Keyword capture fires from `chat.message` on the user's message parts (`UserMessage`). Patterns live in `src/capture/keywords.ts` / config `keywordPatterns`; regex group 1 is the memory body. Scope routing: personal patterns (`cfg.keywordPersonalPatterns`) force the personal scope — the rule is 我 → personal (记住我/替我记/帮我记/我觉得/我喜欢/remember for me), 我们 → current scope (我们认为/我们决定/帮我们记住); personal patterns run first and claim their line so a generic trigger can't double-fire.
|
|
158
161
|
|
|
159
162
|
Context injection happens exactly once per session in `experimental.chat.system.transform`, guarded by an in-memory `Set<sessionID>` in `src/index.ts`. It is not persisted — restarting opencode re-injects on the next first turn.
|
|
160
163
|
|
|
161
164
|
## Design constraints — read the frozen design first
|
|
162
165
|
|
|
163
|
-
`docs/V2-DESIGN.md` is the frozen protocol v0.2 (
|
|
166
|
+
`docs/V2-DESIGN.md` is the frozen protocol v0.2 (decisions D1–D64 settled; open questions tracked at the end of the doc). Per its §12:
|
|
164
167
|
AGENTS.md answers "how should AI work here"; the design doc answers "why is it
|
|
165
168
|
built this way" (principles, iron rules, D1–D49 decision log). Before changing
|
|
166
169
|
architecture, scope semantics, lifecycle, or the protocol surface (frontmatter
|
package/CHANGELOG.md
CHANGED
|
@@ -9,6 +9,28 @@ the `@alpha` tag are development snapshots and are not listed individually.
|
|
|
9
9
|
|
|
10
10
|
## [Unreleased]
|
|
11
11
|
|
|
12
|
+
## Keyword capture gaps (D65)
|
|
13
|
+
|
|
14
|
+
The most natural phrasings were the ones that fell through:
|
|
15
|
+
|
|
16
|
+
- `帮我记住…` / `帮我记一下…` now capture (personal scope, same 我-rule as 替我记; `帮我们记住…` still routes project).
|
|
17
|
+
- A leading `请` no longer defeats capture: `请记住我…`, `请记住(个人)…`, and `请记住:…` all work.
|
|
18
|
+
- English `remember to …` no longer leaves a stray "to" at the front of the captured body.
|
|
19
|
+
|
|
20
|
+
Patterns are code defaults, so these apply automatically on upgrade — unless you hand-customized `keywordPatterns` / `keywordPersonalPatterns` in your config, in which case your lists win and you can port the additions by hand.
|
|
21
|
+
|
|
22
|
+
## P1 fixes: stale answers and stranded files (D64)
|
|
23
|
+
|
|
24
|
+
Second batch from the whole-project review — the index, the files, and the guidance can no longer quietly disagree:
|
|
25
|
+
|
|
26
|
+
- The opencode plugin now re-syncs the index before every tool call (previously only at startup): memories added via the CLI or another client are visible right away instead of after a restart.
|
|
27
|
+
- Superseding a published memory re-enters review as `proposed` instead of a stranded `draft` no command could advance; `promote` can move it forward again.
|
|
28
|
+
- All memory-file rewrites are atomic (tmp + rename), not just creates.
|
|
29
|
+
- A retracted memory can't be flipped back to `active` via status changes — save a new memory if the content is valid again.
|
|
30
|
+
- Proposed copies of personal memories are `visibility: internal` (was: `private`, which export silently excluded from team bundles).
|
|
31
|
+
- `uninstall` finds the real global opencode config (`.jsonc` included), and `doctor` checks all eleven MCP tools plus stranded v1 (`user`-scope) memories.
|
|
32
|
+
- `memory_status` output is capped per section; `memory_list` accepts `scope: both`; `forget` notes when the deleted file was in the repo; `where` prints the config path.
|
|
33
|
+
|
|
12
34
|
## Correctness fixes from the whole-project review (D63)
|
|
13
35
|
|
|
14
36
|
Six silent-wrong-answer bugs found by an external three-lens review, each fixed with a regression test:
|
package/README.md
CHANGED
|
@@ -222,9 +222,10 @@ open-memex init --client vscode
|
|
|
222
222
|
```
|
|
223
223
|
|
|
224
224
|
Writes the MCP server entry; reload the window afterwards and confirm the
|
|
225
|
-
`open-memex` server is started in Copilot Chat's MCP panel. By default
|
|
226
|
-
|
|
227
|
-
`
|
|
225
|
+
`open-memex` server is started in Copilot Chat's MCP panel. By default this
|
|
226
|
+
writes a project-level `.vscode/mcp.json` (an interactive run asks which
|
|
227
|
+
level you want); add `--global` for VS Code's *user-level* config instead —
|
|
228
|
+
one setup that works in every project.
|
|
228
229
|
|
|
229
230
|
**Cursor:**
|
|
230
231
|
|
|
@@ -232,8 +233,8 @@ server entry goes to VS Code's *user-level* config (works in every project);
|
|
|
232
233
|
open-memex init --client cursor
|
|
233
234
|
```
|
|
234
235
|
|
|
235
|
-
Same shape as VS Code:
|
|
236
|
-
|
|
236
|
+
Same shape as VS Code: project-level `.cursor/mcp.json` by default,
|
|
237
|
+
user-level MCP config with `--global`, plus Copilot-style instructions.
|
|
237
238
|
|
|
238
239
|
**opencode** (native plugin — recommended):
|
|
239
240
|
|
|
@@ -367,7 +368,7 @@ Three ways memories get in:
|
|
|
367
368
|
`记住…` / `记一下` / `记录一下` / `别忘了…` — and the sentence is captured
|
|
368
369
|
without any tool call. Captures land in the current **project** by default;
|
|
369
370
|
phrases that signal "this is about me" — `remember for me …`, `记住我…`,
|
|
370
|
-
`替我记…`, `我觉得…`, `我喜欢…` — go to **personal** instead, and
|
|
371
|
+
`替我记…`, `帮我记…`, `我觉得…`, `我喜欢…` — go to **personal** instead, and
|
|
371
372
|
team-context phrases (`我们决定…`, `帮我们记住…`) stay in project.
|
|
372
373
|
- **The agent saves it**: in any editor, ask your agent to remember something
|
|
373
374
|
(or it saves on its own when you state a fact worth keeping) — it calls
|
|
@@ -378,7 +379,7 @@ Three ways memories get in:
|
|
|
378
379
|
conventions, gotchas, approaches tried and abandoned — and saves only the
|
|
379
380
|
ones you approve. Nothing is written silently: no draft is created behind
|
|
380
381
|
your back.
|
|
381
|
-
- **The CLI**: `open-memex add "…"` with optional `--scope` / `--
|
|
382
|
+
- **The CLI**: `open-memex add "…"` with optional `--scope` / `--tag` / `--type`
|
|
382
383
|
/ `--aliases`.
|
|
383
384
|
|
|
384
385
|
**Aliases.** Each saved memory can carry up to 4 alternate phrasings
|
|
@@ -409,7 +410,7 @@ they only matter once you share memories through Git.
|
|
|
409
410
|
|---|---|
|
|
410
411
|
| ● `memory_add` | Save a fact, preference, decision, note |
|
|
411
412
|
| ● `memory_search` | Keyword search (BM25) across project + personal memories |
|
|
412
|
-
| ● `memory_list` | List memories in a scope, newest first |
|
|
413
|
+
| ● `memory_list` | List memories in a scope (`project`, `personal`, or `both`), newest first |
|
|
413
414
|
| ● `memory_supersede` | Replace a memory with a newer version (keeps a supersede chain) |
|
|
414
415
|
| ● `memory_forget` | Delete a memory by id |
|
|
415
416
|
| `memory_status` | Show the sync queue: outbox drafts, repo review states, uncommitted files |
|
|
@@ -605,7 +606,7 @@ open-memex config set sync.autoPull true # best-effort pull at MCP session sta
|
|
|
605
606
|
```
|
|
606
607
|
|
|
607
608
|
Settable keys: `maxProjectMemories`, `maxProfileItems`, `injectOnFirstTurn`,
|
|
608
|
-
`keywordCaptureEnabled`, `logLevel`, `memoryDir`, and `sync.autoPull` (a dotted
|
|
609
|
+
`keywordCaptureEnabled`, `captureAliases`, `logLevel`, `memoryDir`, and `sync.autoPull` (a dotted
|
|
609
610
|
key that writes into the nested `sync` object). Full design:
|
|
610
611
|
[docs/V2-DESIGN.md](./docs/V2-DESIGN.md).
|
|
611
612
|
|
package/README.zh-CN.md
CHANGED
|
@@ -162,7 +162,7 @@ npx -y open-memex init --yes
|
|
|
162
162
|
open-memex init --client vscode
|
|
163
163
|
```
|
|
164
164
|
|
|
165
|
-
写入 MCP
|
|
165
|
+
写入 MCP 服务器配置;重载窗口,确认 Copilot Chat 的 MCP 面板里 `open-memex` 服务器已启动。默认写到项目级 `.vscode/mcp.json`(交互式运行会问你选哪一级);加 `--global` 改写 VS Code 的*用户级*配置——一次设置,每个项目都生效。
|
|
166
166
|
|
|
167
167
|
**Cursor**:
|
|
168
168
|
|
|
@@ -170,7 +170,7 @@ open-memex init --client vscode
|
|
|
170
170
|
open-memex init --client cursor
|
|
171
171
|
```
|
|
172
172
|
|
|
173
|
-
形态和 VS Code
|
|
173
|
+
形态和 VS Code 一样:默认项目级 `.cursor/mcp.json`,`--global` 改为用户级 MCP 配置,外加 Copilot 风格的指令文件。
|
|
174
174
|
|
|
175
175
|
**opencode**(原生插件——推荐):
|
|
176
176
|
|
|
@@ -252,10 +252,10 @@ open-memex uninstall --yes
|
|
|
252
252
|
|
|
253
253
|
三种存入方式:
|
|
254
254
|
|
|
255
|
-
- **关键词触发**(仅 opencode 原生插件):说 `remember …`、`note that …`、`don't forget …`、`TIL …`、`save this …`——中文 `记住…` / `记一下` / `记录一下` / `别忘了…`——这句话就被存下来,不需要任何工具调用。捕获默认进当前 **project**;`remember for me
|
|
255
|
+
- **关键词触发**(仅 opencode 原生插件):说 `remember …`、`note that …`、`don't forget …`、`TIL …`、`save this …`——中文 `记住…` / `记一下` / `记录一下` / `别忘了…`——这句话就被存下来,不需要任何工具调用。捕获默认进当前 **project**;`remember for me …`、`记住我…`、`替我记…`、`帮我记…`、`我觉得…`、`我喜欢…` 这类"这是关于我"的信号会改为进 **personal**;`我们决定…`、`帮我们记住…` 等团队语境仍留在项目里。
|
|
256
256
|
- **助手主动保存**:在任何编辑器里,你让助手记住某件事(或者你陈述了一个值得记的事实、它自己判断该保存),它会调用 `memory_add`。上面的路由是启发式规则;你可以明说"存到我的个人记忆",或用 CLI 加 `--scope` 明确指定。
|
|
257
257
|
- **检查点提议**:一个任务收尾时,助手会提议 1–3 条从这轮工作里提炼的候选记忆——决定及其理由、约定、踩过的坑、走过又放弃的路——只有你点头的那几条才存。不会有任何东西在你不知情时被写下来。
|
|
258
|
-
- **CLI**:`open-memex add "…"`,可选 `--scope` / `--
|
|
258
|
+
- **CLI**:`open-memex add "…"`,可选 `--scope` / `--tag` / `--type` / `--aliases`。
|
|
259
259
|
|
|
260
260
|
**别名。** 每条记忆可以带最多 4 个换一种说法(同义词、另一种语言的对应词),和记忆一起进索引,这样问法不同也能找到——比如搜 "vacation days" 能找到假期政策那条。`init` 时会问一次是否开启(默认开);随时可用 `open-memex config set captureAliases false` 关掉。
|
|
261
261
|
|
|
@@ -275,7 +275,7 @@ MCP 服务器暴露十一个工具;opencode 原生插件暴露其中五个核
|
|
|
275
275
|
|---|---|
|
|
276
276
|
| ● `memory_add` | 保存一条事实、偏好、决策、笔记 |
|
|
277
277
|
| ● `memory_search` | 关键词搜索(BM25),横跨项目 + 个人记忆 |
|
|
278
|
-
| ● `memory_list` |
|
|
278
|
+
| ● `memory_list` | 列出某个作用域(`project`、`personal` 或 `both`)的记忆,最新在前 |
|
|
279
279
|
| ● `memory_supersede` | 用新版本替换一条记忆(保留 supersede 链) |
|
|
280
280
|
| ● `memory_forget` | 按 id 删除一条记忆 |
|
|
281
281
|
| `memory_status` | 显示同步队列:outbox 草稿、仓库评审状态、未提交文件 |
|
|
@@ -323,7 +323,7 @@ MCP 服务器暴露十一个工具;opencode 原生插件暴露其中五个核
|
|
|
323
323
|
4. **PR 评审**——记忆是纯 Markdown;评审者走正常分支/PR 流程批准、要求修改或拒绝。
|
|
324
324
|
5. **回想**——已发布的记忆在会话开始时注入,平时也能随时搜,人和助手都一样。
|
|
325
325
|
|
|
326
|
-
看护共享记忆的人遵循 [维护者约定](./docs/CURATOR.md)
|
|
326
|
+
看护共享记忆的人遵循 [维护者约定](./docs/CURATOR.md)(英文):什么该批准、什么该打回、哪些卫生规则让共享记忆不腐烂。
|
|
327
327
|
|
|
328
328
|
## 回想:记忆是怎么回来的
|
|
329
329
|
|
|
@@ -414,7 +414,7 @@ open-memex config set maxProjectMemories 12
|
|
|
414
414
|
open-memex config set sync.autoPull true # MCP 会话开始时尽力而为地 pull
|
|
415
415
|
```
|
|
416
416
|
|
|
417
|
-
可设置的键:`maxProjectMemories`、`maxProfileItems`、`injectOnFirstTurn`、`keywordCaptureEnabled`、`logLevel`、`memoryDir`,以及 `sync.autoPull`(带点的键,写入嵌套的 `sync` 对象)。完整设计:[docs/V2-DESIGN.md](./docs/V2-DESIGN.md)
|
|
417
|
+
可设置的键:`maxProjectMemories`、`maxProfileItems`、`injectOnFirstTurn`、`keywordCaptureEnabled`、`captureAliases`、`logLevel`、`memoryDir`,以及 `sync.autoPull`(带点的键,写入嵌套的 `sync` 对象)。完整设计:[docs/V2-DESIGN.md](./docs/V2-DESIGN.md)(英文)。
|
|
418
418
|
|
|
419
419
|
## CLI 参考
|
|
420
420
|
|
|
@@ -462,7 +462,7 @@ open-memex submit <id...> [--branch <name>] [--base <branch>]
|
|
|
462
462
|
# 把你点名的草稿移进 .ai/open-memex/,标为 "proposed":
|
|
463
463
|
# 复制、翻转 review_state、在当前分支本地 git 提交。
|
|
464
464
|
# 永不自己建分支——建分支是你(或拿到完整链路明确许可的助手)的事。
|
|
465
|
-
#
|
|
465
|
+
# 全有全无;冲突(同 id 不同内容)干净地中止。
|
|
466
466
|
# 打印 push + gh pr 命令;持有你 Yes 的助手可以一并执行 push/PR。
|
|
467
467
|
# --branch <name> 先建分支(助手全链路路径)。PR base 默认是当前分支
|
|
468
468
|
# (记忆 PR 叠在你的工作分支上);--base 可改指到 main 或你的评审分支。
|
|
@@ -473,7 +473,7 @@ open-memex pr-status [--apply]
|
|
|
473
473
|
# 要求修改 → 只给建议。默认只报告;--apply 在本地执行映射的迁移(不推送)。
|
|
474
474
|
|
|
475
475
|
open-memex pull
|
|
476
|
-
# 从 git 远程拉共享记忆:fetch +
|
|
476
|
+
# 从 git 远程拉共享记忆:fetch + 纯 fast-forward。
|
|
477
477
|
# 分支分叉则明确报错失败——open-memex 永不强制合并;手工解决后再 pull。
|
|
478
478
|
# 成功后本地索引重新同步。pull 默认显式触发;设置
|
|
479
479
|
# `open-memex config set sync.autoPull true` 可在 MCP 会话开始时尽力拉一次
|
|
@@ -502,7 +502,7 @@ open-memex distill-agents [--scope project|personal] [--type t1,t2] [--limit N]
|
|
|
502
502
|
|
|
503
503
|
open-memex propose <id...> --to project [--local-approve]
|
|
504
504
|
# 一次提议一条或多条个人记忆(一个分支、一个 PR);
|
|
505
|
-
# 每条复制并生成新 id
|
|
505
|
+
# 每条复制并生成新 id。全有全无:任何一条 id 出错,整批中止,绝不半途。
|
|
506
506
|
# 把一条个人记忆复制到项目作用域作为评审候选
|
|
507
507
|
# (是复制不是移动——个人原件保留)。结果落进 outbox;
|
|
508
508
|
# 准备进仓库时再跑 sync-status / submit。
|
|
@@ -547,7 +547,7 @@ npx -y open-memex mcp # 无需安装
|
|
|
547
547
|
- **project(项目)**——限定在当前仓库,键由 git origin URL 的 hash 派生(所以同一仓库的多个 clone 共享一个作用域),没有远程时退回到当前工作目录路径。新记忆的默认作用域。
|
|
548
548
|
- **personal(个人)**——横跨你的所有项目,仅限本机,永不向外同步。放个人偏好用。(v1 里叫 `user`;`migrate --to-v2` 会改名。)
|
|
549
549
|
|
|
550
|
-
完整的 scope 模型(键派生、迁移、可见性、保留名)见 [docs/SCOPES.md](./docs/SCOPES.md)
|
|
550
|
+
完整的 scope 模型(键派生、迁移、可见性、保留名)见 [docs/SCOPES.md](./docs/SCOPES.md)(英文)。[概念指南](./docs/CONCEPTS.zh-CN.md)把心智模型完整走了一遍。
|
|
551
551
|
|
|
552
552
|
## 故障排查
|
|
553
553
|
|
|
@@ -602,7 +602,7 @@ Windows 上已加载的 DLL 是锁定的:如果 open-memex 的 MCP 服务器
|
|
|
602
602
|
|
|
603
603
|
## 项目状态
|
|
604
604
|
|
|
605
|
-
open-memex 是稳定且日常在用的;当前稳定线以 `latest` 发到 npm 上,`alpha` 构建给测试者。发版历史在 [GitHub Releases](https://github.com/stoneskin/open-memex/releases);设计决策记录在只追加的日志 [docs/V2-DESIGN.md](./docs/V2-DESIGN.md)
|
|
605
|
+
open-memex 是稳定且日常在用的;当前稳定线以 `latest` 发到 npm 上,`alpha` 构建给测试者。发版历史在 [GitHub Releases](https://github.com/stoneskin/open-memex/releases);设计决策记录在只追加的日志 [docs/V2-DESIGN.md](./docs/V2-DESIGN.md) 里(英文)。
|
|
606
606
|
|
|
607
607
|
在望的方向(不承诺版本号):更多编辑器的原生助手插件(作为在同一组 MCP 工具之上的增强路径);本地 embedding 作为可选择开启的实验(没经询问,永不下载任何模型);只有在真实多仓库共享、ACL 或合规需求出现时才做 org 层。
|
|
608
608
|
|
package/dist/cli.js
CHANGED
|
@@ -11,7 +11,7 @@ import { getSyncStatus, formatSyncStatus, submitMemories } from "./submit.js";
|
|
|
11
11
|
import { getPrStatus, formatPrStatus, applyPrStatus } from "./github.js";
|
|
12
12
|
import { search, list, hitStateLabel } from "./retrieve/search.js";
|
|
13
13
|
import { writeMemoryFile, readMemoryFile, ulid, msToRfc3339, normalizeAliases, } from "./store/markdown.js";
|
|
14
|
-
import { loadConfig } from "./config.js";
|
|
14
|
+
import { loadConfig, configSource } from "./config.js";
|
|
15
15
|
import { paths, projectRoot } from "./paths.js";
|
|
16
16
|
import { redact } from "./redact.js";
|
|
17
17
|
import { resolveMcpCommand } from "./init.js";
|
|
@@ -752,6 +752,7 @@ async function main() {
|
|
|
752
752
|
if (cmd === "where") {
|
|
753
753
|
const p = paths();
|
|
754
754
|
console.log(`root: ${p.root}`);
|
|
755
|
+
console.log(`config: ${configSource() ?? "(built-in defaults)"}`);
|
|
755
756
|
console.log(`memories: ${p.memories}`);
|
|
756
757
|
console.log(`index: ${p.indexDb}`);
|
|
757
758
|
console.log(`project: ${project.key}`);
|
package/dist/config.js
CHANGED
|
@@ -8,12 +8,12 @@ export const DEFAULT_CONFIG = {
|
|
|
8
8
|
keywordCaptureEnabled: true,
|
|
9
9
|
captureAliases: true,
|
|
10
10
|
keywordPatterns: [
|
|
11
|
-
"^\\s*remember(?!\\s+for\\s+me)(?:\\s+that)?[:,]?\\s+(.+)$",
|
|
11
|
+
"^\\s*remember(?!\\s+for\\s+me)(?:\\s+that|\\s+to)?[:,]?\\s+(.+)$",
|
|
12
12
|
"^\\s*(?:please\\s+)?(?:note|don'?t\\s+forget)(?:\\s+that)?[:,]?\\s+(.+)$",
|
|
13
13
|
"^\\s*TIL[:,]?\\s+(.+)$",
|
|
14
14
|
"^\\s*save\\s+(?:this|to\\s+memory)[:,]?\\s+(.+)$",
|
|
15
15
|
// Chinese equivalents
|
|
16
|
-
"^\\s
|
|
16
|
+
"^\\s*(?:请)?记住(?!(个人))[::,,]?\\s*(.+)$",
|
|
17
17
|
"^\\s*(?:请)?(?:记一下|记录一下)[::,,]?\\s*(.+)$",
|
|
18
18
|
"^\\s*别忘了[::,,]?\\s*(.+)$",
|
|
19
19
|
// First-person plural: team/project context, NOT personal
|
|
@@ -23,10 +23,11 @@ export const DEFAULT_CONFIG = {
|
|
|
23
23
|
],
|
|
24
24
|
keywordPersonalPatterns: [
|
|
25
25
|
"^\\s*remember\\s+for\\s+me(?:\\s+that)?[:,]?\\s+(.+)$",
|
|
26
|
-
"^\\s
|
|
26
|
+
"^\\s*(?:请)?记住(个人)[::,,]?\\s*(.+)$",
|
|
27
27
|
// First-person singular: personal scope ("我" → 个人, "我们" → 项目)
|
|
28
|
-
"^\\s
|
|
28
|
+
"^\\s*(?:请)?记住我(?!们)[::,,]?\\s*(.+)$",
|
|
29
29
|
"^\\s*替我记(?:住|一下)?[::,,]?\\s*(.+)$",
|
|
30
|
+
"^\\s*帮我记(?:住|一下)?[::,,]?\\s*(.+)$",
|
|
30
31
|
"^\\s*我觉得[::,,]?\\s*(.+)$",
|
|
31
32
|
"^\\s*我喜欢[::,,]?\\s*(.+)$",
|
|
32
33
|
],
|
package/dist/distill-agents.js
CHANGED
|
@@ -57,7 +57,12 @@ export function distillAgentsMarkdown(opts) {
|
|
|
57
57
|
// (D53: the checkpoint mechanism is gone).
|
|
58
58
|
lines.push(`### Memory hygiene (open-memex)`);
|
|
59
59
|
lines.push(``);
|
|
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.`, ` Worth keeping: decisions and their reasons, preferences, conventions,`, ` gotchas, approaches tried and abandoned. Not worth keeping: one-off task`, ` details or anything re-derivable from the code.`, `- If the knowledge already lives in project docs, save a \`reference\` memory`, ` pointing at the doc instead of copying it.`, `- When saving via \`memory_add\`, attach 2–4 aliases (alternate phrasings,`, ` synonyms, equivalents in the user's other language) when the install has`, ` capture aliases enabled — they make reworded questions find the memory
|
|
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.`, ` Worth keeping: decisions and their reasons, preferences, conventions,`, ` gotchas, approaches tried and abandoned. Not worth keeping: one-off task`, ` details or anything re-derivable from the code.`, `- If the knowledge already lives in project docs, save a \`reference\` memory`, ` pointing at the doc instead of copying it.`, `- When saving via \`memory_add\`, attach 2–4 aliases (alternate phrasings,`, ` synonyms, equivalents in the user's other language) when the install has`, ` capture aliases enabled — they make reworded questions find the memory.`,
|
|
61
|
+
// D64: the skills runbook and the MCP handshake both teach marking
|
|
62
|
+
// inferred captures source: "inference"; this footer omitted it, so
|
|
63
|
+
// opencode agents saved distilled conclusions as if the user had
|
|
64
|
+
// stated them ("tool"). Keep the rubric one voice across surfaces.
|
|
65
|
+
`- Mark captures you infer (rather than the user stating) with`, ` \`source: "inference"\` — provenance matters more than polish.`);
|
|
61
66
|
lines.push(``);
|
|
62
67
|
return lines.join("\n");
|
|
63
68
|
}
|
package/dist/doctor.js
CHANGED
|
@@ -12,12 +12,20 @@ import { paths, homeOverride } from "./paths.js";
|
|
|
12
12
|
import { resolveCwdScope } from "./scope.js";
|
|
13
13
|
import { db, backendName } from "./store/db.js";
|
|
14
14
|
import { LEGACY_PACKAGE_NAME, opencodeGlobalConfigPath, userMcpConfigPath } from "./init.js";
|
|
15
|
+
// D64: the MCP server exposes eleven tools; checking only the five the
|
|
16
|
+
// opencode plugin carries let a half-registered server pass as healthy.
|
|
15
17
|
const EXPECTED_TOOLS = [
|
|
16
18
|
"memory_add",
|
|
17
19
|
"memory_search",
|
|
18
20
|
"memory_list",
|
|
19
21
|
"memory_supersede",
|
|
20
22
|
"memory_forget",
|
|
23
|
+
"memory_status",
|
|
24
|
+
"memory_submit",
|
|
25
|
+
"memory_propose",
|
|
26
|
+
"memory_promote",
|
|
27
|
+
"memory_resolve",
|
|
28
|
+
"memory_pr_status",
|
|
21
29
|
];
|
|
22
30
|
function nodeCheck() {
|
|
23
31
|
const [major, minor] = process.versions.node.split(".").map(Number);
|
|
@@ -535,6 +543,19 @@ function legacyCheck() {
|
|
|
535
543
|
const legacyDir = path.join(path.dirname(root), LEGACY_PACKAGE_NAME);
|
|
536
544
|
if (fs.existsSync(legacyDir) && fs.statSync(legacyDir).isDirectory())
|
|
537
545
|
found.push(`legacy data dir ${legacyDir} — merge it with \`open-memex migrate --to-v2\``);
|
|
546
|
+
// D64: v1 stored personal memories under the scope dir "user"; v2 reads
|
|
547
|
+
// only "personal". Files left there are invisible to every read path —
|
|
548
|
+
// an upgrader silently sees an empty personal scope. Surface them here;
|
|
549
|
+
// the migration itself stays explicit (no silent moves).
|
|
550
|
+
try {
|
|
551
|
+
const userDir = path.join(root, "memories", "user");
|
|
552
|
+
if (fs.existsSync(userDir) &&
|
|
553
|
+
fs.readdirSync(userDir).some((f) => f.endsWith(".md")))
|
|
554
|
+
found.push("v1 personal memories under " + userDir + " are invisible to v2 reads — convert them with `open-memex migrate --to-v2` (it moves them to the personal scope; preview with --dry-run)");
|
|
555
|
+
}
|
|
556
|
+
catch {
|
|
557
|
+
/* unreadable — not this check's problem */
|
|
558
|
+
}
|
|
538
559
|
for (const f of [opencodeGlobalConfigPath(), userMcpConfigPath("vscode"), userMcpConfigPath("cursor")]) {
|
|
539
560
|
try {
|
|
540
561
|
if (fs.existsSync(f) && fs.readFileSync(f, "utf8").includes(LEGACY_PACKAGE_NAME))
|
package/dist/init.js
CHANGED
|
@@ -56,11 +56,12 @@ You have a local memory MCP server (\`open-memex\`). Its tools are
|
|
|
56
56
|
these full names.
|
|
57
57
|
|
|
58
58
|
- The server tells you when project outbox drafts are waiting for review — in
|
|
59
|
-
tool results.
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
59
|
+
tool results. When it does (or when the user asks), call \`memory_status\`
|
|
60
|
+
to see them; don't call it blindly at session start. When drafts are
|
|
61
|
+
waiting, summarize them (one line each) and ask the user which ones to
|
|
62
|
+
sync into the repo; sync NOTHING the user did not name. If you already
|
|
63
|
+
asked about these drafts this session, don't ask again. When the server
|
|
64
|
+
reports none waiting, do nothing.
|
|
64
65
|
- BE PROACTIVE about facts the user states directly: when the user shares a
|
|
65
66
|
decision, preference, project convention, or fix-and-cause worth remembering
|
|
66
67
|
across sessions, call \`memory_add\` without being asked. Keep each memory to
|
|
@@ -286,7 +287,17 @@ function opencodePluginDir() {
|
|
|
286
287
|
* loads open-memex in every project with no per-project init.
|
|
287
288
|
*/
|
|
288
289
|
export function opencodeGlobalConfigPath(home = os.homedir()) {
|
|
289
|
-
|
|
290
|
+
const dir = opencodeConfigDir(home, process.env.XDG_CONFIG_HOME);
|
|
291
|
+
// D64: init writes into whichever of .json/.jsonc already exists
|
|
292
|
+
// (writeOpencodeGlobalPlugin), so readers must resolve the same file.
|
|
293
|
+
// Hardcoding .json made uninstall report "nothing to remove" on
|
|
294
|
+
// .jsonc-only setups and left the plugin entry behind.
|
|
295
|
+
for (const name of ["opencode.jsonc", "opencode.json"]) {
|
|
296
|
+
const candidate = path.join(dir, name);
|
|
297
|
+
if (fs.existsSync(candidate))
|
|
298
|
+
return candidate;
|
|
299
|
+
}
|
|
300
|
+
return path.join(dir, "opencode.json");
|
|
290
301
|
}
|
|
291
302
|
/**
|
|
292
303
|
* Pure merge of the open-memex plugin URL into a parsed opencode config doc.
|
package/dist/review.js
CHANGED
|
@@ -23,7 +23,7 @@ import * as path from "node:path";
|
|
|
23
23
|
import { loadConfig } from "./config.js";
|
|
24
24
|
import { inRepoMemoriesDirPath, projectRoot } from "./paths.js";
|
|
25
25
|
import { resolveProjectScope } from "./scope.js";
|
|
26
|
-
import { parse as parseMemory, serialize, ulid, writeMemoryFile, } from "./store/markdown.js";
|
|
26
|
+
import { parse as parseMemory, serialize, atomicWriteTextSync, ulid, writeMemoryFile, } from "./store/markdown.js";
|
|
27
27
|
import { findMemoryFile } from "./store/lifecycle.js";
|
|
28
28
|
import { upsertFromFile } from "./store/sync.js";
|
|
29
29
|
/** Best-effort author identity: git user.name, else the OS user. */
|
|
@@ -79,6 +79,12 @@ function copyPersonalToProject(sourceId, srcFm, srcBody, opts = {}) {
|
|
|
79
79
|
id: ulid(),
|
|
80
80
|
scope: "project",
|
|
81
81
|
scope_key: project.key,
|
|
82
|
+
// D64: the copy is headed for the team. Source visibility (usually
|
|
83
|
+
// "private") must not ride along: export excludes private by default,
|
|
84
|
+
// so a private copy would silently vanish from every bundle the team
|
|
85
|
+
// builds. Proposing IS the act of sharing — the copy is internal;
|
|
86
|
+
// the personal original keeps its own visibility, untouched.
|
|
87
|
+
visibility: "internal",
|
|
82
88
|
project_name: project.projectName,
|
|
83
89
|
created_at: now,
|
|
84
90
|
updated_at: now,
|
|
@@ -194,7 +200,7 @@ export function promoteMemory(id, opts = {}) {
|
|
|
194
200
|
},
|
|
195
201
|
],
|
|
196
202
|
};
|
|
197
|
-
|
|
203
|
+
atomicWriteTextSync(mf.filePath, serialize(fm, mf.body));
|
|
198
204
|
upsertFromFile({ fm, body: mf.body, filePath: mf.filePath, mtimeMs: Date.now() });
|
|
199
205
|
return { id, from, to, history: fm.review_history };
|
|
200
206
|
}
|
|
@@ -428,7 +434,7 @@ export function resolveConflict(target) {
|
|
|
428
434
|
if (conflicts.length > 0)
|
|
429
435
|
return { ok: false, filePath, conflicts };
|
|
430
436
|
const fm = merged;
|
|
431
|
-
|
|
437
|
+
atomicWriteTextSync(filePath, serialize(fm, mergedBody));
|
|
432
438
|
upsertFromFile({ fm, body: mergedBody, filePath, mtimeMs: Date.now() });
|
|
433
439
|
return { ok: true, filePath, autoMerged: [...new Set(autoMerged)] };
|
|
434
440
|
}
|
package/dist/store/lifecycle.js
CHANGED
|
@@ -5,7 +5,7 @@ import { db } from "./db.js";
|
|
|
5
5
|
import { paths, projectRoot, inRepoMemoriesDirPath, } from "../paths.js";
|
|
6
6
|
import { loadConfig } from "../config.js";
|
|
7
7
|
import { cjkIndexText } from "../retrieve/cjk.js";
|
|
8
|
-
import { parse, serialize, ulid, msToRfc3339, } from "./markdown.js";
|
|
8
|
+
import { parse, serialize, atomicWriteTextSync, ulid, msToRfc3339, } from "./markdown.js";
|
|
9
9
|
/**
|
|
10
10
|
* Dedup + lifecycle (V2-DESIGN §3.3, §3.4).
|
|
11
11
|
*
|
|
@@ -111,7 +111,7 @@ export function findMemoryFile(id) {
|
|
|
111
111
|
return { fm: parsed.fm, body: parsed.body, filePath, mtimeMs: st.mtimeMs };
|
|
112
112
|
}
|
|
113
113
|
export function rewriteMemoryFile(mf) {
|
|
114
|
-
|
|
114
|
+
atomicWriteTextSync(mf.filePath, serialize(mf.fm, mf.body));
|
|
115
115
|
}
|
|
116
116
|
/**
|
|
117
117
|
* Chain integrity (§3.3): supersedes/superseded_by must be pairwise
|
|
@@ -179,7 +179,13 @@ export function supersede(oldId, input) {
|
|
|
179
179
|
updated_at: now,
|
|
180
180
|
supersedes: oldId,
|
|
181
181
|
superseded_by: null,
|
|
182
|
-
|
|
182
|
+
// D64: the replacement inherits the old memory's place in the review
|
|
183
|
+
// flow. A draft stays a draft; anything that had entered review
|
|
184
|
+
// (proposed/approved/published/rejected) re-enters at "proposed" so
|
|
185
|
+
// promote can advance it — resetting to "draft" would strand the new
|
|
186
|
+
// file in the repo, where submit cannot reach it (not the outbox)
|
|
187
|
+
// and promote refuses drafts.
|
|
188
|
+
review_state: (oldMf.fm.review_state ?? "draft") === "draft" ? "draft" : "proposed",
|
|
183
189
|
proposed_by: null,
|
|
184
190
|
approved_by: null,
|
|
185
191
|
derived_from: null,
|
|
@@ -187,7 +193,7 @@ export function supersede(oldId, input) {
|
|
|
187
193
|
};
|
|
188
194
|
const dir = path.dirname(oldMf.filePath);
|
|
189
195
|
const newPath = path.join(dir, `${newFm.id}.md`);
|
|
190
|
-
|
|
196
|
+
atomicWriteTextSync(newPath, serialize(newFm, input.body));
|
|
191
197
|
const st = fs.statSync(newPath);
|
|
192
198
|
const newMf = {
|
|
193
199
|
fm: newFm,
|
|
@@ -224,6 +230,14 @@ export function setStatus(id, status) {
|
|
|
224
230
|
if (mf.fm.status === "superseded") {
|
|
225
231
|
throw new Error(`memory ${id} is superseded (chain-managed); supersede it again instead of changing status directly`);
|
|
226
232
|
}
|
|
233
|
+
// D64: retraction is a one-way door through this path. A retracted
|
|
234
|
+
// memory was withdrawn on purpose (wrong, sensitive, superseded by
|
|
235
|
+
// policy); silently flipping it back to active would return it to
|
|
236
|
+
// recall (retrieval excludes retracted) with no review. Save a new
|
|
237
|
+
// memory if the content is valid again.
|
|
238
|
+
if (mf.fm.status === "retracted" && status === "active") {
|
|
239
|
+
throw new Error(`memory ${id} is retracted and cannot return to active; save the content as a new memory if it is valid again`);
|
|
240
|
+
}
|
|
227
241
|
mf.fm.status = status;
|
|
228
242
|
mf.fm.updated_at = msToRfc3339(Date.now());
|
|
229
243
|
rewriteMemoryFile(mf);
|
package/dist/store/markdown.js
CHANGED
|
@@ -237,18 +237,26 @@ export function parse(raw) {
|
|
|
237
237
|
return null;
|
|
238
238
|
return { fm: normalizeFrontmatter(parsed.rawFm), body: parsed.body };
|
|
239
239
|
}
|
|
240
|
+
/**
|
|
241
|
+
* Atomic text publish: write a sibling tmp file and rename over the
|
|
242
|
+
* target, so a concurrent reader (another process mid-sync) never sees a
|
|
243
|
+
* torn half-written file. Same-directory rename is atomic on one fs.
|
|
244
|
+
* Every memory-file write/rewrite must go through here (D57 for creates,
|
|
245
|
+
* D64 extended to all rewrites: supersede flips, review transitions,
|
|
246
|
+
* submit landings, status changes).
|
|
247
|
+
*/
|
|
248
|
+
export function atomicWriteTextSync(filePath, text) {
|
|
249
|
+
const tmpPath = `${filePath}.tmp-${process.pid}`;
|
|
250
|
+
fs.writeFileSync(tmpPath, text, "utf8");
|
|
251
|
+
fs.renameSync(tmpPath, filePath);
|
|
252
|
+
}
|
|
240
253
|
export function writeMemoryFile(fm, body) {
|
|
241
254
|
// 2B/D26: project drafts live in appdata (the outbox) — the in-repo dir
|
|
242
255
|
// only ever holds submitted memories (proposed/approved/published).
|
|
243
256
|
// Personal stays in appdata and never leaves the machine.
|
|
244
257
|
const dir = memoriesDirFor(fm.scope_key);
|
|
245
258
|
const filePath = path.join(dir, `${fm.id}.md`);
|
|
246
|
-
|
|
247
|
-
// target, so a concurrent reader (another process mid-sync) never sees a
|
|
248
|
-
// torn half-written memory. Same-directory rename is atomic on one fs.
|
|
249
|
-
const tmpPath = `${filePath}.tmp-${process.pid}`;
|
|
250
|
-
fs.writeFileSync(tmpPath, serialize(fm, body), "utf8");
|
|
251
|
-
fs.renameSync(tmpPath, filePath);
|
|
259
|
+
atomicWriteTextSync(filePath, serialize(fm, body));
|
|
252
260
|
const st = fs.statSync(filePath);
|
|
253
261
|
return { filePath, mtimeMs: st.mtimeMs };
|
|
254
262
|
}
|
package/dist/store/migrate.js
CHANGED
|
@@ -2,7 +2,7 @@ import fs from "node:fs";
|
|
|
2
2
|
import path from "node:path";
|
|
3
3
|
import { memoriesDirFor, memoriesDirPath } from "../paths.js";
|
|
4
4
|
import { db } from "./db.js";
|
|
5
|
-
import { iterMemoryFiles, readMemoryFile, serialize, timeToMs, } from "./markdown.js";
|
|
5
|
+
import { iterMemoryFiles, readMemoryFile, serialize, timeToMs, atomicWriteTextSync, } from "./markdown.js";
|
|
6
6
|
import { syncScope } from "./sync.js";
|
|
7
7
|
import { PERSONAL_SCOPE } from "../scope.js";
|
|
8
8
|
/** True if this scope has at least one `.md` file on disk. Does not create
|
|
@@ -90,7 +90,7 @@ export function migrateScope(fromKey, toKey, opts = {}) {
|
|
|
90
90
|
};
|
|
91
91
|
const raw = serialize(newFm, mf.body);
|
|
92
92
|
if (!dryRun) {
|
|
93
|
-
|
|
93
|
+
atomicWriteTextSync(dstPath, raw);
|
|
94
94
|
// Only unlink source if it's a different path (paths differ because
|
|
95
95
|
// scope dir differs; belt-and-suspenders check).
|
|
96
96
|
if (path.resolve(srcPath) !== path.resolve(dstPath)) {
|
package/dist/store/v2migrate.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import fs from "node:fs";
|
|
2
2
|
import path from "node:path";
|
|
3
3
|
import { paths } from "../paths.js";
|
|
4
|
-
import { parseRawFrontmatter, normalizeFrontmatter, isTaxonomyType, serialize, } from "./markdown.js";
|
|
4
|
+
import { parseRawFrontmatter, normalizeFrontmatter, isTaxonomyType, serialize, atomicWriteTextSync, } from "./markdown.js";
|
|
5
5
|
/**
|
|
6
6
|
* v1 → v2 file migration (V2-DESIGN §19). Explicit only — run via
|
|
7
7
|
* `open-memex migrate --to-v2`. Converts frontmatter in place:
|
|
@@ -174,7 +174,7 @@ function planDir(dir, memoriesRoot, result) {
|
|
|
174
174
|
function applyPlans(result) {
|
|
175
175
|
for (const plan of result.plans) {
|
|
176
176
|
fs.mkdirSync(path.dirname(plan.toPath), { recursive: true });
|
|
177
|
-
|
|
177
|
+
atomicWriteTextSync(plan.toPath, serialize(plan.fm, plan.body));
|
|
178
178
|
if (plan.toPath !== plan.fromPath)
|
|
179
179
|
fs.unlinkSync(plan.fromPath);
|
|
180
180
|
}
|
package/dist/submit.js
CHANGED
|
@@ -25,7 +25,7 @@ import { loadConfig } from "./config.js";
|
|
|
25
25
|
import { inRepoMemoriesDir, memoriesDirPath, projectRoot } from "./paths.js";
|
|
26
26
|
import { resolveProjectScope } from "./scope.js";
|
|
27
27
|
import { contentHash } from "./store/lifecycle.js";
|
|
28
|
-
import { msToRfc3339, parse as parseMemory, readMemoryFile, serialize, } from "./store/markdown.js";
|
|
28
|
+
import { msToRfc3339, parse as parseMemory, readMemoryFile, serialize, atomicWriteTextSync, } from "./store/markdown.js";
|
|
29
29
|
import { upsertFromFile, recordSync, readSyncState } from "./store/sync.js";
|
|
30
30
|
import { db } from "./store/db.js";
|
|
31
31
|
import { currentAuthor } from "./review.js";
|
|
@@ -138,19 +138,24 @@ export function formatSyncStatus(st) {
|
|
|
138
138
|
else {
|
|
139
139
|
lines.push(`last sync: never`);
|
|
140
140
|
}
|
|
141
|
+
const CAP = 20;
|
|
141
142
|
lines.push(`outbox (appdata, pending sync): ${st.outbox.length}`);
|
|
142
|
-
for (const e of st.outbox) {
|
|
143
|
+
for (const e of st.outbox.slice(0, CAP)) {
|
|
143
144
|
lines.push(` ${e.id} [${e.reviewState}] ${e.title}`);
|
|
144
145
|
}
|
|
146
|
+
if (st.outbox.length > CAP)
|
|
147
|
+
lines.push(` … and ${st.outbox.length - CAP} more`);
|
|
145
148
|
const byState = new Map();
|
|
146
149
|
for (const e of st.inRepo)
|
|
147
150
|
byState.set(e.reviewState, (byState.get(e.reviewState) ?? 0) + 1);
|
|
148
151
|
const breakdown = [...byState.entries()].map(([s, n]) => `${n} ${s}`).join(", ") || "none";
|
|
149
152
|
lines.push(`repo .ai/open-memex: ${st.inRepo.length} (${breakdown})`);
|
|
150
|
-
for (const e of st.inRepo) {
|
|
153
|
+
for (const e of st.inRepo.slice(0, CAP)) {
|
|
151
154
|
const u = e.gitState === "uncommitted" ? " (uncommitted)" : "";
|
|
152
155
|
lines.push(` ${e.id} [${e.reviewState}]${u} ${e.title}`);
|
|
153
156
|
}
|
|
157
|
+
if (st.inRepo.length > CAP)
|
|
158
|
+
lines.push(` … and ${st.inRepo.length - CAP} more`);
|
|
154
159
|
if (st.uncommitted.length > 0) {
|
|
155
160
|
lines.push(`note: ${st.uncommitted.length} repo file(s) not yet committed — they ride with the working tree until you commit.`);
|
|
156
161
|
}
|
|
@@ -279,7 +284,7 @@ export function submitMemories(ids, opts = {}) {
|
|
|
279
284
|
],
|
|
280
285
|
};
|
|
281
286
|
const text = serialize(fm, parsed.body);
|
|
282
|
-
|
|
287
|
+
atomicWriteTextSync(destPath, text);
|
|
283
288
|
written.push({ id: v.id, srcPath: v.srcPath, destPath, hash: contentHash(parsed.body) });
|
|
284
289
|
submitted.push({ id: v.id, filePath: destPath, reviewState: destState });
|
|
285
290
|
}
|