memorix 1.8.8 → 1.9.0

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.
Files changed (66) hide show
  1. package/CHANGELOG.md +36 -0
  2. package/README.md +15 -1
  3. package/README.zh-CN.md +15 -1
  4. package/dist/cli/index.js +3722 -1599
  5. package/dist/cli/memcode.js +0 -0
  6. package/dist/index.js +634 -363
  7. package/dist/maintenance-runner.js +285 -103
  8. package/dist/media-audio-runner.js +285 -103
  9. package/dist/media-video-runner.js +285 -103
  10. package/dist/memcode-runtime/CHANGELOG.md +36 -0
  11. package/dist/sdk.js +627 -356
  12. package/dist/vector-backfill-runner.d.ts +4 -1
  13. package/dist/vector-backfill-runner.js +288 -104
  14. package/docs/AGENT_OPERATOR_PLAYBOOK.md +4 -2
  15. package/docs/API_REFERENCE.md +14 -0
  16. package/docs/CONFIGURATION.md +46 -0
  17. package/docs/DEVELOPMENT.md +2 -2
  18. package/docs/INTEGRATIONS.md +1 -0
  19. package/docs/MULTI-DEVICE-SYNC-RESEARCH.md +344 -0
  20. package/docs/PERFORMANCE.md +32 -0
  21. package/docs/README.md +4 -2
  22. package/docs/hooks-architecture.md +18 -13
  23. package/llms-full.txt +4 -1
  24. package/llms.txt +3 -1
  25. package/package.json +2 -1
  26. package/plugins/antigravity/memorix/plugin.json +1 -1
  27. package/plugins/claude/memorix/.claude-plugin/plugin.json +1 -1
  28. package/plugins/codebuddy/memorix/.codebuddy-plugin/plugin.json +1 -1
  29. package/plugins/codex/memorix/.codex-plugin/plugin.json +1 -1
  30. package/plugins/copilot/memorix/plugin.json +1 -1
  31. package/plugins/gemini/memorix/gemini-extension.json +1 -1
  32. package/plugins/hermes/memorix/plugin.yaml +1 -1
  33. package/plugins/omp/memorix/package.json +1 -1
  34. package/plugins/openclaw/memorix/.codex-plugin/plugin.json +1 -1
  35. package/plugins/pi/memorix/package.json +1 -1
  36. package/server.json +2 -2
  37. package/src/cli/command-guide.ts +9 -1
  38. package/src/cli/commands/agent-integrations.ts +2 -1
  39. package/src/cli/commands/hooks-install.ts +2 -0
  40. package/src/cli/commands/integrate.ts +2 -0
  41. package/src/cli/commands/serve-http.ts +11 -0
  42. package/src/cli/commands/setup.ts +11 -4
  43. package/src/cli/commands/sync-store.ts +191 -0
  44. package/src/cli/commands/sync.ts +8 -0
  45. package/src/hooks/handler.ts +6 -0
  46. package/src/hooks/installers/index.ts +181 -6
  47. package/src/hooks/normalizer.ts +60 -1
  48. package/src/hooks/types.ts +3 -1
  49. package/src/integrations/registry.ts +9 -0
  50. package/src/memory/observations.ts +15 -2
  51. package/src/runtime/maintenance-targets.ts +6 -0
  52. package/src/runtime/vector-backfill-runner.ts +185 -7
  53. package/src/store/orama-store.ts +85 -102
  54. package/src/sync/adapters/fs.ts +179 -0
  55. package/src/sync/adapters/github.ts +258 -0
  56. package/src/sync/adapters/object-store.ts +267 -0
  57. package/src/sync/adapters/postgres.ts +269 -0
  58. package/src/sync/engine.ts +353 -0
  59. package/src/sync/journal.ts +162 -0
  60. package/src/sync/merge.ts +116 -0
  61. package/src/sync/namespace.ts +15 -0
  62. package/src/sync/paging.ts +45 -0
  63. package/src/sync/policy.ts +37 -0
  64. package/src/sync/remote-factory.ts +49 -0
  65. package/src/sync/store-port.ts +288 -0
  66. package/src/sync/types.ts +183 -0
package/CHANGELOG.md CHANGED
@@ -4,6 +4,42 @@ All notable changes to this project will be documented in this file.
4
4
 
5
5
  ## [Unreleased]
6
6
 
7
+ ## [1.9.0] - 2026-09-07
8
+
9
+ ### Added
10
+ - **Opt-in multi-device sync** -- adds a project-scoped observation
11
+ event contract with privacy filtering, local outbox retry, conflict evidence,
12
+ device-clone protection, bounded relay pulls, and filesystem/GitHub/S3/
13
+ Postgres transport boundaries. It is disabled by default and keeps local
14
+ SQLite as the canonical store.
15
+ - **Sync hardening** -- retracts records that become private or agent-targeted,
16
+ keeps imported observations and sync state atomic, rejects immutable-key
17
+ collisions, verifies every pulled content hash, and uses stable continuation
18
+ cursors so large pulls do not skip events.
19
+ - **Resource hardening** -- coalesces deferred vector workers across hook
20
+ processes, respects retry cooldowns, drains due vector jobs through one
21
+ recoverable worker, removes the redundant full-document detail cache, and
22
+ batches startup vector hydration to reduce CPU/RAM peaks without imposing a
23
+ small corpus limit.
24
+
25
+ ## [1.8.9] - 2026-09-06
26
+
27
+ ### Added
28
+ - **Grok Build integration** -- adds native lifecycle hook capture for session,
29
+ prompt, tool, compaction, and stop events, plus Grok-specific `AGENTS.md`
30
+ guidance. Thanks to @RaviTharuma for the original integration.
31
+
32
+ ### Changed
33
+ - **Host-owned Grok MCP** -- `memorix setup --agent grok --global` uses Grok's
34
+ hook and rules surfaces without writing Grok's `config.toml` or MCP entries.
35
+ - **Agent documentation** -- the English and Chinese README matrices and setup
36
+ guides now list Grok Build and its trust model.
37
+
38
+ ### Fixed
39
+ - **Safe Grok hook updates** -- preserves unrelated user hooks, removes only
40
+ Memorix-owned entries, supports `GROK_HOME`, and reports project hook trust
41
+ accurately without claiming that Memorix can approve it.
42
+
7
43
  ## [1.8.8] - 2026-09-03
8
44
 
9
45
  ### Changed
package/README.md CHANGED
@@ -6,7 +6,7 @@
6
6
 
7
7
  <p align="center">
8
8
  <strong>Local-first shared memory layer for AI coding agents.</strong><br>
9
- One project memory system for Claude Code, Codex, CodeBuddy Code, Cursor, Windsurf, Copilot, Gemini CLI, OpenCode, OpenClaw, Hermes Agent, Oh-my-Pi, Pi, Kiro, Antigravity, Trae, DeepSeek Harness, WorkBuddy, and any MCP-capable agent.
9
+ One project memory system for Claude Code, Codex, CodeBuddy Code, Cursor, Windsurf, Copilot, Gemini CLI, OpenCode, Grok Build, OpenClaw, Hermes Agent, Oh-my-Pi, Pi, Kiro, Antigravity, Trae, DeepSeek Harness, WorkBuddy, and any MCP-capable agent.
10
10
  </p>
11
11
 
12
12
  <p align="center">
@@ -85,6 +85,7 @@ Memorix is more than a memory store. It also installs agent integrations, keeps
85
85
  | Orchestration and team work | Task planning, worker handoffs, file locks, messages, verification gates, and review loops | `memorix orchestrate`, `memorix team`, `memorix lock` |
86
86
  | memcode | A bundled terminal coding agent that already reads and writes the same project memory | `memorix`, `memcode` |
87
87
  | CLI and SDK | Scriptable access for automation, imports/exports, diagnostics, and custom integrations | `memorix ...`, `createMemoryClient()` |
88
+ | Optional multi-device sync | Project-scoped, privacy-filtered observation events with local SQLite kept canonical; GitHub JSONL, filesystem, S3, or Postgres relay | `memorix sync store status\|push\|pull` |
88
89
 
89
90
  <h2 id="works-with-your-agent"><picture><source media="(prefers-color-scheme: dark)" srcset="assets/tags/light/section-agents.svg"><img src="assets/tags/section-agents.svg" alt="Works with every agent" height="32" /></picture></h2>
90
91
 
@@ -181,6 +182,11 @@ Memorix connects through the interfaces each agent already supports: plugin pack
181
182
  <strong>Any MCP Client</strong><br>
182
183
  <sub>stdio or HTTP MCP</sub>
183
184
  </td>
185
+ <td align="center" width="12.5%">
186
+ <a href="https://github.com/xai-org/grok-build"><img src="https://github.com/xai-org.png?size=120" alt="Grok Build" width="48" height="48"></a><br>
187
+ <strong>Grok Build</strong><br>
188
+ <sub>native hooks + AGENTS.md</sub>
189
+ </td>
184
190
  </tr>
185
191
  </table>
186
192
 
@@ -213,6 +219,12 @@ CLI, MCP, and HTTP are different entry points:
213
219
  - `memorix serve` is the stdio MCP bridge used by IDEs and coding agents. Its default tool profile is `micro`, so agents see only the compact core tool set.
214
220
  - `memorix background start` / `memorix serve-http` run the HTTP service for a shared endpoint, dashboard, VPS Docker deployment, or multiple clients.
215
221
 
222
+ Multi-device store sync is opt-in and separate from HTTP sharing. It never
223
+ uploads the live SQLite database or WAL files. By default it only relays
224
+ qualified project-visible observations; personal, agent-targeted, candidate,
225
+ ephemeral, and other-project records stay local. Set `MEMORIX_SYNC_PROVIDER` and
226
+ inspect `memorix sync store status --json` before the first push.
227
+
216
228
  <h2 id="install"><picture><source media="(prefers-color-scheme: dark)" srcset="assets/tags/light/section-install.svg"><img src="assets/tags/section-install.svg" alt="Install" height="32" /></picture></h2>
217
229
 
218
230
  Requirements:
@@ -262,6 +274,7 @@ memorix setup --agent codebuddy --global
262
274
  memorix setup --agent omp --global
263
275
  memorix setup --agent dsh --global
264
276
  memorix setup --agent workbuddy --global
277
+ memorix setup --agent grok --global
265
278
  ```
266
279
 
267
280
  What it installs depends on the target agent, but the goal is the same: make Memorix available wherever you open that agent without asking you to wire every repo by hand.
@@ -281,6 +294,7 @@ What it installs depends on the target agent, but the goal is the same: make Mem
281
294
  - Oh-my-Pi: installs an `omp.extensions` package with extension hook events, a `memorix` command, official skills, and writes MCP config.
282
295
  - DeepSeek Harness: writes a Memorix `@deepseek-ai/dsh-mcp-client` row into `$DSH_HOME/cordis.patch.yml` (default `~/.dsh/cordis.patch.yml`), appends guidance to the harness `AGENTS.md`, and installs official skills under `$DSH_HOME/skills`. The row follows DSH's own shipped Memorix reference, so tools appear as `mcp__memorix__*`.
283
296
  - WorkBuddy: writes a Memorix MCP server row into `~/.workbuddy/mcp.json` (or `<project>/.workbuddy/mcp.json` for project installs) and appends guidance to `AGENTS.md`. Tools appear as `mcp__memorix__*`; there is no hooks surface.
297
+ - Grok Build: installs native lifecycle hooks under `~/.grok/hooks/memorix.json` and guidance in `~/.grok/AGENTS.md`. It leaves Grok's MCP configuration host-owned; project-local hooks require Grok `/hooks-trust`, while global hooks are trusted. Set `GROK_HOME` to use a custom Grok home.
284
298
 
285
299
  Need a quieter install? Add `--noHooks` for targets where setup can control hook capture separately from the host's official package entry. It keeps MCP and guidance, but skips Memorix hook capture.
286
300
 
package/README.zh-CN.md CHANGED
@@ -6,7 +6,7 @@
6
6
 
7
7
  <p align="center">
8
8
  <strong>面向 AI Coding Agent 的本地优先共享记忆层。</strong><br>
9
- 让 Claude Code、Codex、CodeBuddy Code、Cursor、Windsurf、Copilot、Gemini CLI、OpenCode、OpenClaw、Hermes Agent、Oh-my-Pi、Pi、Kiro、Antigravity、Trae、DeepSeek Harness 和任何 MCP Agent 共用同一套项目记忆。
9
+ 让 Claude Code、Codex、CodeBuddy Code、Cursor、Windsurf、Copilot、Gemini CLI、OpenCode、Grok Build、OpenClaw、Hermes Agent、Oh-my-Pi、Pi、Kiro、Antigravity、Trae、DeepSeek Harness、WorkBuddy 和任何 MCP Agent 共用同一套项目记忆。
10
10
  </p>
11
11
 
12
12
  <p align="center">
@@ -84,6 +84,7 @@ Memorix 不只是一个记忆库。它还负责安装 Agent 接入、保留有
84
84
  | Orchestration 和团队协作 | 任务规划、worker 交接、文件锁、消息、验证门和 review loop | `memorix orchestrate`、`memorix team`、`memorix lock` |
85
85
  | memcode | 内置终端 Coding Agent,默认读写同一套项目记忆 | `memorix`、`memcode` |
86
86
  | CLI 和 SDK | 给自动化、导入导出、诊断和自定义集成使用的本地接口 | `memorix ...`、`createMemoryClient()` |
87
+ | 可选多设备同步 | 按项目隔离、经过隐私过滤的记忆事件同步;本地 SQLite 仍是主库 | `memorix sync store status\|push\|pull` |
87
88
 
88
89
  <h2 id="支持你的-agent"><picture><source media="(prefers-color-scheme: dark)" srcset="assets/tags/light/section-agents.svg"><img src="assets/tags/section-agents.svg" alt="Works with every agent" height="32" /></picture></h2>
89
90
 
@@ -180,6 +181,11 @@ Memorix 通过目标 Agent 已有的接口接入:插件包、MCP、项目规
180
181
  <strong>Any MCP Client</strong><br>
181
182
  <sub>stdio or HTTP MCP</sub>
182
183
  </td>
184
+ <td align="center" width="12.5%">
185
+ <a href="https://github.com/xai-org/grok-build"><img src="https://github.com/xai-org.png?size=120" alt="Grok Build" width="48" height="48"></a><br>
186
+ <strong>Grok Build</strong><br>
187
+ <sub>原生 hooks + AGENTS.md</sub>
188
+ </td>
183
189
  </tr>
184
190
  </table>
185
191
 
@@ -212,6 +218,11 @@ CLI、MCP 和 HTTP 是不同入口:
212
218
  - `memorix serve` 是给 IDE / Coding Agent 使用的 stdio MCP 桥。
213
219
  - `memorix background start` / `memorix serve-http` 是 HTTP 服务,用于共享端点、Dashboard、VPS Docker 部署或多客户端。
214
220
 
221
+ 多设备记忆同步是可选功能,和 HTTP 共享服务不是一回事。它不会上传
222
+ `memorix.db`、WAL 或 SHM 文件。默认只同步当前项目中已确认且项目可见的
223
+ 观察记录;个人、指定 Agent、候选、短期和其它项目的记录会留在本地。设置
224
+ `MEMORIX_SYNC_PROVIDER` 后,先运行 `memorix sync store status --json` 再 push。
225
+
215
226
  <h2 id="安装"><picture><source media="(prefers-color-scheme: dark)" srcset="assets/tags/light/section-install.svg"><img src="assets/tags/section-install.svg" alt="安装" height="32" /></picture></h2>
216
227
 
217
228
  要求:
@@ -260,6 +271,8 @@ memorix setup --agent hermes --global
260
271
  memorix setup --agent codebuddy --global
261
272
  memorix setup --agent omp --global
262
273
  memorix setup --agent dsh --global
274
+ memorix setup --agent workbuddy --global
275
+ memorix setup --agent grok --global
263
276
  ```
264
277
 
265
278
  它会做的事情取决于目标 Agent,但目标是一致的:你以后在哪里打开这个 Agent,Memorix 就可以在哪里被使用,而不是让你一个仓库一个仓库重复配置。
@@ -278,6 +291,7 @@ memorix setup --agent dsh --global
278
291
  - CodeBuddy Code:安装用户级本地市场插件到 `~/.codebuddy/memorix-local`,包含 MCP、skills 和 hooks。它不会修改既有的 CodeBuddy 模型、权限或 settings 文件;第三方 hook 仍由 CodeBuddy 自己的 `/hooks` 流程确认。
279
292
  - Oh-my-Pi:安装 `omp.extensions` package,包含 extension hook 事件、`memorix` command、官方 skills,并写入 MCP 配置。
280
293
  - DeepSeek Harness:向 `$DSH_HOME/cordis.patch.yml`(默认 `~/.dsh/cordis.patch.yml`)写入一行 Memorix `@deepseek-ai/dsh-mcp-client`,向 harness 的 `AGENTS.md` 追加使用规范,并把官方 skills 安装到 `$DSH_HOME/skills`。这一行遵循 DSH 自带的 Memorix 参考配置,因此工具以 `mcp__memorix__*` 形式出现。
294
+ - Grok Build:把原生生命周期 hooks 安装到 `~/.grok/hooks/memorix.json`,把使用规范写入 `~/.grok/AGENTS.md`。Grok 的 MCP 配置仍由 Grok 自己管理;项目级 hooks 需要在 Grok 中执行 `/hooks-trust`,全局 hooks 默认可信;也可以用 `GROK_HOME` 指定自定义 Grok 目录。
281
295
 
282
296
  如果你想要更安静一点的安装,可以对那些 setup 能独立控制 hook capture 的 target 加 `--noHooks`。它会保留 MCP 和使用规范,只跳过 Memorix 的 hook 自动捕获。
283
297