@shadowforge0/aquifer-memory 1.8.0 → 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.
- package/.env.example +1 -0
- package/README.md +49 -22
- package/README_CN.md +24 -22
- package/README_TW.md +20 -22
- package/aquifer.config.example.json +2 -1
- package/consumers/cli.js +560 -4
- package/consumers/codex.js +1 -1
- package/consumers/mcp.js +3 -0
- package/consumers/openclaw-ext/index.js +64 -6
- package/consumers/openclaw-ext/openclaw.plugin.json +1 -1
- package/consumers/openclaw-ext/package.json +1 -1
- package/consumers/openclaw-install.js +326 -0
- package/consumers/openclaw-plugin.js +39 -1
- package/consumers/shared/config.js +2 -0
- package/core/aquifer.js +180 -33
- package/core/backends/local.js +109 -0
- package/core/doctor.js +924 -0
- package/core/finalization-inspector.js +164 -0
- package/core/memory-explain.js +624 -0
- package/core/memory-recall.js +49 -23
- package/core/memory-records.js +16 -5
- package/core/memory-review.js +891 -0
- package/core/memory-serving.js +61 -4
- package/core/operator-observability.js +249 -0
- package/core/postgres-migrations.js +13 -0
- package/core/session-finalization.js +76 -1
- package/core/storage.js +124 -8
- package/docs/getting-started.md +34 -1
- package/docs/setup.md +102 -22
- package/package.json +5 -4
- package/schema/019-v1-memory-review-resolutions.sql +53 -0
- package/scripts/codex-checkpoint-commands.js +28 -0
- package/scripts/codex-checkpoint-runtime.js +109 -0
- package/scripts/codex-recovery.js +16 -4
package/.env.example
CHANGED
|
@@ -11,6 +11,7 @@ AQUIFER_MEMORY_SERVING_MODE=legacy
|
|
|
11
11
|
# AQUIFER_MEMORY_SERVING_MODE=curated
|
|
12
12
|
# AQUIFER_MEMORY_ACTIVE_SCOPE_KEY=project:example
|
|
13
13
|
# AQUIFER_MEMORY_ACTIVE_SCOPE_PATH=global,project:example
|
|
14
|
+
# AQUIFER_MEMORY_ALLOWED_SCOPE_KEYS=global,project:example
|
|
14
15
|
|
|
15
16
|
# Optional Codex active-session checkpoint heartbeat policy.
|
|
16
17
|
# AQUIFER_CODEX_CHECKPOINT_CHECK_INTERVAL_MINUTES=10
|
package/README.md
CHANGED
|
@@ -67,21 +67,31 @@ Claude Code, Claude Desktop, or any MCP-capable client — drop this into `.mcp.
|
|
|
67
67
|
|
|
68
68
|
Or run it directly: `DATABASE_URL=... EMBED_PROVIDER=ollama npx aquifer mcp`. The MCP server itself stays strict about env; `quickstart` autodetect is the try-it path, not the production one.
|
|
69
69
|
|
|
70
|
-
Keep `AQUIFER_MEMORY_SERVING_MODE=legacy` for first rollout. Switch to `curated` only when you want `session_recall` and `session_bootstrap` to serve active curated memory
|
|
70
|
+
Keep `AQUIFER_MEMORY_SERVING_MODE=legacy` for first rollout. Switch to `curated` only when you want compatibility `session_recall` and `session_bootstrap` to serve active curated memory. Use `memory_recall` for explicit current-memory lookup, `historical_recall` for the historical/session plane, and `evidence_recall` for the audit/debug lane. Rollback is just flipping env or config back to `legacy`.
|
|
71
|
+
|
|
72
|
+
Curated serving is scope-bound. `AQUIFER_MEMORY_ACTIVE_SCOPE_PATH` is the ordered inheritance path, while `AQUIFER_MEMORY_ALLOWED_SCOPE_KEYS` is the caller boundary. If `activeScopePath` is omitted, Aquifer defaults it to `global` plus the configured `activeScopeKey`, or to `global` alone when no active scope is configured. If `allowedScopeKeys` is omitted, Aquifer defaults it to that active scope path. Runtime requests outside that boundary are rejected before reading current memory rows.
|
|
71
73
|
|
|
72
74
|
### Common commands
|
|
73
75
|
|
|
74
76
|
| Goal | Command |
|
|
75
77
|
|---|---|
|
|
76
78
|
| Verify setup | `npx aquifer quickstart` |
|
|
79
|
+
| Run read-only governance diagnostics | `npx aquifer doctor --json` |
|
|
77
80
|
| Inspect selected backend capabilities without DB connection | `AQUIFER_BACKEND=local npx aquifer backend-info --json` |
|
|
78
81
|
| Start the MCP server | `npx aquifer mcp` |
|
|
79
82
|
| Search memory manually | `npx aquifer recall "auth middleware"` |
|
|
83
|
+
| Explain current-memory bootstrap selection | `npx aquifer explain bootstrap --active-scope-key project:aquifer --json` |
|
|
84
|
+
| Explain current-memory recall selection | `npx aquifer explain memory --query "serving contract" --active-scope-key project:aquifer --json` |
|
|
85
|
+
| Inspect finalized-session ledger rows | `npx aquifer finalization list --status finalized --json` |
|
|
86
|
+
| Inspect operator ledgers | `npx aquifer operator status --json` |
|
|
87
|
+
| Review current-memory feedback issues | `npx aquifer review queue --scope-key project:aquifer --feedback-type incorrect --json` |
|
|
88
|
+
| Resolve a reviewed memory queue item | `npx aquifer review resolve --memory-id 42 --resolution resolved --reason "verified current" --expected-latest-issue-feedback-id 9 --json` |
|
|
80
89
|
| Plan curated memory compaction | `npx aquifer compact --cadence daily --period-start 2026-04-27T00:00:00Z --period-end 2026-04-28T00:00:00Z` |
|
|
81
90
|
| Generate a timer synthesis prompt | `npx aquifer operator compaction daily --include-synthesis-prompt --json` |
|
|
82
91
|
| Apply reviewed timer synthesis candidates | `npx aquifer operator compaction daily --synthesis-summary-file /tmp/timer-summary.json --apply --promote-candidates --json` |
|
|
83
92
|
| Generate a finalized-session checkpoint prompt | `npx aquifer operator checkpoint --scope-key project:aquifer --min-finalizations 10 --include-synthesis-prompt --json` |
|
|
84
93
|
| Heartbeat-check an active Codex session for checkpoint work | `npx aquifer codex-recovery checkpoint-heartbeat --hook-stdin --scope-key project:aquifer` |
|
|
94
|
+
| Inspect pending Codex checkpoint spool files | `npx aquifer codex-recovery checkpoint-spool-status --json --limit 10` |
|
|
85
95
|
| Preview a Codex UserPromptSubmit heartbeat hook install | `npx aquifer codex-recovery checkpoint-heartbeat-hook --scope-key project:aquifer --hooks-path "$CODEX_HOME/hooks.json" --json` |
|
|
86
96
|
| Inspect storage health | `npx aquifer stats` |
|
|
87
97
|
| Enrich pending sessions | `npx aquifer backfill` |
|
|
@@ -98,6 +108,28 @@ files: it first checks a tiny local scheduler marker, reads the transcript only
|
|
|
98
108
|
when the time window is due, then writes local spool process material only when
|
|
99
109
|
the message threshold is also due. It does not print prompt text by default and
|
|
100
110
|
does not write DB memory.
|
|
111
|
+
Use `codex-recovery checkpoint-spool-status --json` to inspect pending local
|
|
112
|
+
spool files by session, coverage, byte size, and modified time without printing
|
|
113
|
+
the checkpoint prompt text.
|
|
114
|
+
|
|
115
|
+
Read-only governance commands are diagnostic surfaces. `doctor`,
|
|
116
|
+
`finalization list|inspect`, `explain bootstrap|memory`, and
|
|
117
|
+
`operator status|inspect` do not apply migrations, promote memory, mutate
|
|
118
|
+
finalization status, reclaim operator leases, or add MCP tools. `review
|
|
119
|
+
queue|inspect` is read-only with respect to memory truth, but uses the normal
|
|
120
|
+
Aquifer migration gate because it depends on the resolution ledger schema. It
|
|
121
|
+
derives an operator queue from curated memory feedback such as `incorrect`,
|
|
122
|
+
`stale`, and `scope_mismatch` without printing raw transcripts, feedback notes,
|
|
123
|
+
feedback metadata, or memory payloads. `review resolve` is the narrow write path
|
|
124
|
+
for this surface: it appends a snapshot-bound resolution ledger row
|
|
125
|
+
(`resolved`, `ignored`, or `deferred`) without mutating `memory_records` or
|
|
126
|
+
rewriting feedback history. Newer issue feedback reopens the queue item. Use
|
|
127
|
+
these commands to answer why a session did not finalize, why a current-memory
|
|
128
|
+
row was selected or excluded, which visible memory rows need human review, and
|
|
129
|
+
whether operator ledgers contain stale claims before running write paths.
|
|
130
|
+
Explain output includes stable scope inheritance details for selected and
|
|
131
|
+
excluded rows; non-selected rows redact `title` and `summary` so diagnostics
|
|
132
|
+
cannot become a cross-scope content probe.
|
|
101
133
|
|
|
102
134
|
Need LLM summarization, the knowledge graph, OpenAI embeddings, reranking, or operations details? See [docs/setup.md](docs/setup.md) and [Environment Variables](#environment-variables).
|
|
103
135
|
|
|
@@ -172,6 +204,7 @@ Sessions, summaries, turn-level embeddings, entity graph — all live in one dat
|
|
|
172
204
|
| `AQUIFER_MEMORY_SERVING_MODE` | No | Public serving mode: `legacy` default, or opt-in `curated` | `curated` |
|
|
173
205
|
| `AQUIFER_MEMORY_ACTIVE_SCOPE_KEY` | No | Default active curated scope for recall/bootstrap | `project:aquifer` |
|
|
174
206
|
| `AQUIFER_MEMORY_ACTIVE_SCOPE_PATH` | No | Ordered curated scope path for inheritance | `global,project:aquifer` |
|
|
207
|
+
| `AQUIFER_MEMORY_ALLOWED_SCOPE_KEYS` | No | Caller boundary for curated scope requests; defaults to the configured active scope path | `global,project:aquifer` |
|
|
175
208
|
| `AQUIFER_CODEX_CHECKPOINT_CHECK_INTERVAL_MINUTES` | No | Active Codex checkpoint heartbeat time gate (default: `10`) | `10` |
|
|
176
209
|
| `AQUIFER_CODEX_CHECKPOINT_EVERY_MESSAGES` | No | Active Codex checkpoint message delta gate (default: `20`) | `20` |
|
|
177
210
|
| `AQUIFER_CODEX_CHECKPOINT_EVERY_USER_MESSAGES` | No | Optional user-message delta gate | `10` |
|
|
@@ -205,7 +238,7 @@ The script is idempotent (`WHERE canonical_key_v2 IS NULL` guard) and race-safe
|
|
|
205
238
|
|
|
206
239
|
## Host Integration
|
|
207
240
|
|
|
208
|
-
MCP is the primary integration surface. Agent hosts connect to the Aquifer MCP server, which exposes
|
|
241
|
+
MCP is the primary integration surface. Agent hosts connect to the Aquifer MCP server, which exposes ten tools: `memory_recall`, `historical_recall`, `session_recall`, `evidence_recall`, `session_feedback`, `memory_feedback`, `memory_stats`, `memory_pending`, `feedback_stats`, `session_bootstrap`.
|
|
209
242
|
|
|
210
243
|
| Integration | Route | Status | When to use |
|
|
211
244
|
|-------------|-------|--------|-------------|
|
|
@@ -236,7 +269,7 @@ Add to your project's `.claude.json` or user-level MCP config:
|
|
|
236
269
|
}
|
|
237
270
|
```
|
|
238
271
|
|
|
239
|
-
Tools appear as `
|
|
272
|
+
Tools appear as `mcp__aquifer__memory_recall`, `mcp__aquifer__historical_recall`, `mcp__aquifer__session_recall`, `mcp__aquifer__evidence_recall`, `mcp__aquifer__session_feedback`, `mcp__aquifer__memory_feedback`, `mcp__aquifer__memory_stats`, `mcp__aquifer__memory_pending`, `mcp__aquifer__feedback_stats`, `mcp__aquifer__session_bootstrap`.
|
|
240
273
|
|
|
241
274
|
For Codex long sessions, Aquifer exposes a UserPromptSubmit-friendly heartbeat
|
|
242
275
|
command instead of installing a daemon:
|
|
@@ -287,27 +320,21 @@ the heartbeat hook is present.
|
|
|
287
320
|
|
|
288
321
|
### OpenClaw
|
|
289
322
|
|
|
290
|
-
|
|
323
|
+
Install or update Aquifer inside the OpenClaw host root, then let the installer
|
|
324
|
+
wire both the MCP server and the optional extension from the same package root:
|
|
291
325
|
|
|
292
|
-
```
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
"servers": {
|
|
296
|
-
"aquifer": {
|
|
297
|
-
"command": "node",
|
|
298
|
-
"args": ["/path/to/aquifer/consumers/mcp.js"],
|
|
299
|
-
"env": {
|
|
300
|
-
"DATABASE_URL": "postgresql://...",
|
|
301
|
-
"AQUIFER_EMBED_BASE_URL": "http://localhost:11434/v1",
|
|
302
|
-
"AQUIFER_EMBED_MODEL": "bge-m3"
|
|
303
|
-
}
|
|
304
|
-
}
|
|
305
|
-
}
|
|
306
|
-
}
|
|
307
|
-
}
|
|
326
|
+
```bash
|
|
327
|
+
npm install --prefix "$OPENCLAW_HOME" @shadowforge0/aquifer-memory@latest
|
|
328
|
+
node "$OPENCLAW_HOME/node_modules/@shadowforge0/aquifer-memory/consumers/cli.js" install-openclaw --openclaw-home "$OPENCLAW_HOME"
|
|
308
329
|
```
|
|
309
330
|
|
|
310
|
-
|
|
331
|
+
The installer enables `plugins.entries["aquifer-memory"]`, adds the extension
|
|
332
|
+
to `plugins.load.paths`, preserves existing `mcp.servers.aquifer.env` values,
|
|
333
|
+
and backs up `openclaw.json` before writing. Use `--dry-run --json` to inspect
|
|
334
|
+
package version, plugin config, MCP target, and extension link without changing
|
|
335
|
+
files.
|
|
336
|
+
|
|
337
|
+
Tools materialize as `aquifer__memory_recall`, `aquifer__historical_recall`, `aquifer__session_recall`, `aquifer__evidence_recall`, `aquifer__session_feedback`, `aquifer__memory_feedback`, `aquifer__memory_stats`, `aquifer__memory_pending`, `aquifer__feedback_stats`, `aquifer__session_bootstrap` (server name prefix added by the host).
|
|
311
338
|
|
|
312
339
|
The OpenClaw plugin (`consumers/openclaw-plugin.js`) is retained for session capture via `before_reset` but is **not** the recommended tool delivery path. Use MCP.
|
|
313
340
|
|
|
@@ -722,7 +749,7 @@ Key indexes: `idx_insights_canonical_v2_active` (partial on active rows with can
|
|
|
722
749
|
|
|
723
750
|
**Recall returns no results** — Make sure you've run `enrich` after `commit`. Raw sessions are not searchable until enriched (summarized + embedded). Check `aquifer stats` to see if summaries and turn embeddings exist.
|
|
724
751
|
|
|
725
|
-
**OpenClaw tools not visible** — Use `mcp.servers.aquifer` in `openclaw.json`, not the plugin. Tools appear as `
|
|
752
|
+
**OpenClaw tools not visible** — Use `mcp.servers.aquifer` in `openclaw.json`, not the plugin. Tools appear as `aquifer__memory_recall`, `aquifer__historical_recall`, `aquifer__session_recall`, etc. The plugin (`consumers/openclaw-plugin.js`) is for session capture only.
|
|
726
753
|
|
|
727
754
|
**Embedding provider connection refused** — Verify your `AQUIFER_EMBED_BASE_URL` is reachable. For local Ollama, make sure the server is running and the model is pulled (`ollama pull bge-m3`).
|
|
728
755
|
|
package/README_CN.md
CHANGED
|
@@ -109,24 +109,32 @@ Claude Code、Claude Desktop 或任何支持 MCP 的 client——放进 `.mcp.js
|
|
|
109
109
|
|
|
110
110
|
或直接跑:`DATABASE_URL=... EMBED_PROVIDER=ollama npx aquifer mcp`。(MCP server 本身对 env 严格——`quickstart` 的 autodetect 是试用路径,不是 production 路径。)
|
|
111
111
|
|
|
112
|
-
第一轮 rollout 先保持 `AQUIFER_MEMORY_SERVING_MODE=legacy
|
|
112
|
+
第一轮 rollout 先保持 `AQUIFER_MEMORY_SERVING_MODE=legacy`。只有在你要让兼容性 `session_recall` 和 `session_bootstrap` 提供 active curated memory 时,才切到 `curated`;`memory_recall` 是显式 current-memory lookup,`historical_recall` 是 historical/session 平面,`evidence_recall` 是 audit/debug 路径。要 rollback 只要把 env 或 config 切回 `legacy`。
|
|
113
113
|
|
|
114
114
|
### Common commands
|
|
115
115
|
|
|
116
116
|
| Goal | Command |
|
|
117
117
|
|---|---|
|
|
118
118
|
| Verify setup | `npx aquifer quickstart` |
|
|
119
|
+
| Run read-only diagnostics | `npx aquifer doctor --json` |
|
|
119
120
|
| Start the MCP server | `npx aquifer mcp` |
|
|
120
121
|
| Search memory manually | `npx aquifer recall "auth middleware"` |
|
|
122
|
+
| Explain current-memory selection | `npx aquifer explain bootstrap --active-scope-key project:aquifer --json` |
|
|
123
|
+
| Review current-memory feedback issues | `npx aquifer review queue --scope-key project:aquifer --json` |
|
|
124
|
+
| Resolve a reviewed memory queue item | `npx aquifer review resolve --memory-id 42 --resolution resolved --reason "verified current" --expected-latest-issue-feedback-id 9 --json` |
|
|
121
125
|
| Plan curated memory compaction | `npx aquifer compact --cadence daily --period-start 2026-04-27T00:00:00Z --period-end 2026-04-28T00:00:00Z` |
|
|
122
126
|
| Generate a timer synthesis prompt | `npx aquifer operator compaction daily --include-synthesis-prompt --json` |
|
|
123
127
|
| Apply reviewed timer synthesis candidates | `npx aquifer operator compaction daily --synthesis-summary-file /tmp/timer-summary.json --apply --promote-candidates --json` |
|
|
128
|
+
| Inspect pending Codex checkpoint spool files | `npx aquifer codex-recovery checkpoint-spool-status --json --limit 10` |
|
|
124
129
|
| Inspect storage health | `npx aquifer stats` |
|
|
125
130
|
| Enrich pending sessions | `npx aquifer backfill` |
|
|
126
131
|
|
|
127
132
|
Timer synthesis output is candidate material until an operator applies it with
|
|
128
133
|
`--promote-candidates`; it does not become active curated memory from the
|
|
129
134
|
prompt or summary file alone.
|
|
135
|
+
`codex-recovery checkpoint-spool-status --json` reports local spool file
|
|
136
|
+
metadata such as session, coverage, byte size, and modified time without
|
|
137
|
+
printing checkpoint prompt text.
|
|
130
138
|
|
|
131
139
|
需要 LLM 摘要、知识图谱、OpenAI embedding 或 reranker?往下看 [环境变量](#环境变量) 和 [docs/setup.md](docs/setup.md)。
|
|
132
140
|
|
|
@@ -194,7 +202,7 @@ const results = await aquifer.recall('auth middleware 决定', {
|
|
|
194
202
|
|
|
195
203
|
## 宿主集成
|
|
196
204
|
|
|
197
|
-
MCP 是主要的集成接口。Agent 宿主连接到 Aquifer MCP server,该 server
|
|
205
|
+
MCP 是主要的集成接口。Agent 宿主连接到 Aquifer MCP server,该 server 暴露十个工具:`memory_recall`、`historical_recall`、`session_recall`、`evidence_recall`、`session_feedback`、`memory_feedback`、`memory_stats`、`memory_pending`、`feedback_stats`、`session_bootstrap`。
|
|
198
206
|
|
|
199
207
|
| 集成方式 | 路径 | 状态 | 使用场景 |
|
|
200
208
|
|----------|------|------|----------|
|
|
@@ -225,31 +233,25 @@ MCP 是主要的集成接口。Agent 宿主连接到 Aquifer MCP server,该 se
|
|
|
225
233
|
}
|
|
226
234
|
```
|
|
227
235
|
|
|
228
|
-
工具在 Claude Code 中显示为 `mcp__aquifer__session_recall`、`mcp__aquifer__evidence_recall`、`
|
|
236
|
+
工具在 Claude Code 中显示为 `mcp__aquifer__memory_recall`、`mcp__aquifer__historical_recall`、`mcp__aquifer__session_recall`、`mcp__aquifer__evidence_recall`、`mcp__aquifer__session_feedback`、`mcp__aquifer__memory_feedback`、`mcp__aquifer__memory_stats`、`mcp__aquifer__memory_pending`、`mcp__aquifer__feedback_stats`、`mcp__aquifer__session_bootstrap`。
|
|
229
237
|
|
|
230
238
|
### OpenClaw
|
|
231
239
|
|
|
232
|
-
|
|
240
|
+
Install or update Aquifer inside the OpenClaw host root, then let the installer
|
|
241
|
+
wire both the MCP server and the optional extension from the same package root:
|
|
233
242
|
|
|
234
|
-
```
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
"servers": {
|
|
238
|
-
"aquifer": {
|
|
239
|
-
"command": "node",
|
|
240
|
-
"args": ["/path/to/aquifer/consumers/mcp.js"],
|
|
241
|
-
"env": {
|
|
242
|
-
"DATABASE_URL": "postgresql://...",
|
|
243
|
-
"AQUIFER_EMBED_BASE_URL": "http://localhost:11434/v1",
|
|
244
|
-
"AQUIFER_EMBED_MODEL": "bge-m3"
|
|
245
|
-
}
|
|
246
|
-
}
|
|
247
|
-
}
|
|
248
|
-
}
|
|
249
|
-
}
|
|
243
|
+
```bash
|
|
244
|
+
npm install --prefix "$OPENCLAW_HOME" @shadowforge0/aquifer-memory@latest
|
|
245
|
+
node "$OPENCLAW_HOME/node_modules/@shadowforge0/aquifer-memory/consumers/cli.js" install-openclaw --openclaw-home "$OPENCLAW_HOME"
|
|
250
246
|
```
|
|
251
247
|
|
|
252
|
-
|
|
248
|
+
The installer enables `plugins.entries["aquifer-memory"]`, adds the extension
|
|
249
|
+
to `plugins.load.paths`, preserves existing `mcp.servers.aquifer.env` values,
|
|
250
|
+
and backs up `openclaw.json` before writing. Use `--dry-run --json` to inspect
|
|
251
|
+
package version, plugin config, MCP target, and extension link without changing
|
|
252
|
+
files.
|
|
253
|
+
|
|
254
|
+
工具显示为 `aquifer__memory_recall`、`aquifer__historical_recall`、`aquifer__session_recall`、`aquifer__evidence_recall`、`aquifer__session_feedback`、`aquifer__memory_feedback`、`aquifer__memory_stats`、`aquifer__memory_pending`、`aquifer__feedback_stats`、`aquifer__session_bootstrap`(宿主自动添加 server 名称前缀)。
|
|
253
255
|
|
|
254
256
|
OpenClaw 插件(`consumers/openclaw-plugin.js`)保留用于通过 `before_reset` 捕获 session,但**不是**推荐的工具分发路径。请使用 MCP。
|
|
255
257
|
|
|
@@ -649,7 +651,7 @@ opt-in pipeline(`createAquifer({stateChanges: {enabled, whitelist, confidenceT
|
|
|
649
651
|
|
|
650
652
|
**Recall 没有返回结果** — 确保在 `commit` 之后执行了 `enrich`。原始 session 在丰富化(摘要 + embedding)之前不可搜索。运行 `aquifer stats` 检查摘要和 turn embedding 是否存在。
|
|
651
653
|
|
|
652
|
-
**OpenClaw 工具不可见** — 在 `openclaw.json` 中使用 `mcp.servers.aquifer`,不要用插件。工具显示为 `aquifer__session_recall` 等。插件(`consumers/openclaw-plugin.js`)仅用于 session 捕获。
|
|
654
|
+
**OpenClaw 工具不可见** — 在 `openclaw.json` 中使用 `mcp.servers.aquifer`,不要用插件。工具显示为 `aquifer__memory_recall`、`aquifer__historical_recall`、`aquifer__session_recall` 等。插件(`consumers/openclaw-plugin.js`)仅用于 session 捕获。
|
|
653
655
|
|
|
654
656
|
**Embedding 提供商连接被拒** — 检查 `AQUIFER_EMBED_BASE_URL` 是否可达。本地 Ollama 需确保服务正在运行且模型已拉取(`ollama pull bge-m3`)。
|
|
655
657
|
|
package/README_TW.md
CHANGED
|
@@ -67,22 +67,30 @@ Claude Code、Claude Desktop 或任何支援 MCP 的 client——放進 `.mcp.js
|
|
|
67
67
|
|
|
68
68
|
或直接跑:`DATABASE_URL=... EMBED_PROVIDER=ollama npx aquifer mcp`。MCP server 本身對 env 比較嚴格,`quickstart` 的 autodetect 是試用路徑,不是 production 路徑。
|
|
69
69
|
|
|
70
|
-
第一輪 rollout 先維持 `AQUIFER_MEMORY_SERVING_MODE=legacy
|
|
70
|
+
第一輪 rollout 先維持 `AQUIFER_MEMORY_SERVING_MODE=legacy`。只有在你要讓相容性 `session_recall` 跟 `session_bootstrap` 提供 active curated memory 時,才切到 `curated`;`memory_recall` 是顯式 current-memory lookup,`historical_recall` 是 historical/session 平面,`evidence_recall` 是 audit/debug 路徑。要 rollback 只要把 env 或 config 切回 `legacy`。
|
|
71
|
+
|
|
72
|
+
Curated serving 受 scope 邊界保護。`AQUIFER_MEMORY_ACTIVE_SCOPE_PATH` 是 inheritance 的順序路徑,`AQUIFER_MEMORY_ALLOWED_SCOPE_KEYS` 是 caller boundary。若沒有設定 `activeScopePath`,Aquifer 會預設使用 `global` 加上 configured `activeScopeKey`;沒有 active scope 時則只用 `global`。若沒有設定 `allowedScopeKeys`,Aquifer 會預設使用該 active scope path;runtime request 超出這個邊界時,會在讀 current memory rows 前直接拒絕。
|
|
71
73
|
|
|
72
74
|
### 常用指令
|
|
73
75
|
|
|
74
76
|
| 目標 | 指令 |
|
|
75
77
|
|---|---|
|
|
76
78
|
| 驗證 setup | `npx aquifer quickstart` |
|
|
79
|
+
| 執行唯讀治理診斷 | `npx aquifer doctor --json` |
|
|
77
80
|
| 啟動 MCP server | `npx aquifer mcp` |
|
|
78
81
|
| 手動查記憶 | `npx aquifer recall "auth middleware"` |
|
|
82
|
+
| 解釋 current-memory 選取 | `npx aquifer explain bootstrap --active-scope-key project:aquifer --json` |
|
|
83
|
+
| 檢查 current-memory feedback issue | `npx aquifer review queue --scope-key project:aquifer --json` |
|
|
84
|
+
| 關閉已人工審查的記憶 queue item | `npx aquifer review resolve --memory-id 42 --resolution resolved --reason "verified current" --expected-latest-issue-feedback-id 9 --json` |
|
|
79
85
|
| 規劃 curated memory 壓縮 | `npx aquifer compact --cadence daily --period-start 2026-04-27T00:00:00Z --period-end 2026-04-28T00:00:00Z` |
|
|
80
86
|
| 產生 timer synthesis prompt | `npx aquifer operator compaction daily --include-synthesis-prompt --json` |
|
|
81
87
|
| 套用已審核的 timer synthesis candidates | `npx aquifer operator compaction daily --synthesis-summary-file /tmp/timer-summary.json --apply --promote-candidates --json` |
|
|
88
|
+
| 檢查 Codex checkpoint spool 待處理檔 | `npx aquifer codex-recovery checkpoint-spool-status --json --limit 10` |
|
|
82
89
|
| 看儲存狀態 | `npx aquifer stats` |
|
|
83
90
|
| 補跑 pending session | `npx aquifer backfill` |
|
|
84
91
|
|
|
85
92
|
Timer synthesis output 在 operator 用 `--promote-candidates` apply 前都只是 candidate material;光有 prompt 或 summary file 不會變成 active curated memory。
|
|
93
|
+
`codex-recovery checkpoint-spool-status --json` 只列出本機 spool 檔的 session、coverage、大小與修改時間,不會印出 checkpoint prompt 內容。
|
|
86
94
|
|
|
87
95
|
需要 LLM 摘要、知識圖譜、OpenAI embedding、reranker 或維運細節,就往下看 [環境變數](#環境變數) 跟 [docs/setup.md](docs/setup.md)。
|
|
88
96
|
|
|
@@ -194,7 +202,7 @@ const results = await aquifer.recall('auth middleware 決定', {
|
|
|
194
202
|
|
|
195
203
|
## 主機整合(Host Integration)
|
|
196
204
|
|
|
197
|
-
MCP 是主要的整合介面。Agent 主機連接 Aquifer MCP
|
|
205
|
+
MCP 是主要的整合介面。Agent 主機連接 Aquifer MCP 伺服器,伺服器提供十個工具:`memory_recall`、`historical_recall`、`session_recall`、`evidence_recall`、`session_feedback`、`memory_feedback`、`memory_stats`、`memory_pending`、`feedback_stats`、`session_bootstrap`。
|
|
198
206
|
|
|
199
207
|
| 整合方式 | 路由 | 狀態 | 使用時機 |
|
|
200
208
|
|----------|------|------|----------|
|
|
@@ -225,31 +233,20 @@ MCP 是主要的整合介面。Agent 主機連接 Aquifer MCP 伺服器,伺服
|
|
|
225
233
|
}
|
|
226
234
|
```
|
|
227
235
|
|
|
228
|
-
工具會以 `mcp__aquifer__session_recall`、`mcp__aquifer__evidence_recall`、`
|
|
236
|
+
工具會以 `mcp__aquifer__memory_recall`、`mcp__aquifer__historical_recall`、`mcp__aquifer__session_recall`、`mcp__aquifer__evidence_recall`、`mcp__aquifer__session_feedback`、`mcp__aquifer__memory_feedback`、`mcp__aquifer__memory_stats`、`mcp__aquifer__memory_pending`、`mcp__aquifer__feedback_stats`、`mcp__aquifer__session_bootstrap` 等名稱出現。
|
|
229
237
|
|
|
230
238
|
### OpenClaw
|
|
231
239
|
|
|
232
|
-
|
|
240
|
+
先把 Aquifer 安裝或更新到 OpenClaw host root,再讓 installer 從同一個 package root 接好 MCP server 與可選的 extension:
|
|
233
241
|
|
|
234
|
-
```
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
"servers": {
|
|
238
|
-
"aquifer": {
|
|
239
|
-
"command": "node",
|
|
240
|
-
"args": ["/path/to/aquifer/consumers/mcp.js"],
|
|
241
|
-
"env": {
|
|
242
|
-
"DATABASE_URL": "postgresql://...",
|
|
243
|
-
"AQUIFER_EMBED_BASE_URL": "http://localhost:11434/v1",
|
|
244
|
-
"AQUIFER_EMBED_MODEL": "bge-m3"
|
|
245
|
-
}
|
|
246
|
-
}
|
|
247
|
-
}
|
|
248
|
-
}
|
|
249
|
-
}
|
|
242
|
+
```bash
|
|
243
|
+
npm install --prefix "$OPENCLAW_HOME" @shadowforge0/aquifer-memory@latest
|
|
244
|
+
node "$OPENCLAW_HOME/node_modules/@shadowforge0/aquifer-memory/consumers/cli.js" install-openclaw --openclaw-home "$OPENCLAW_HOME"
|
|
250
245
|
```
|
|
251
246
|
|
|
252
|
-
|
|
247
|
+
installer 會啟用 `plugins.entries["aquifer-memory"]`、把 extension 加進 `plugins.load.paths`、保留既有 `mcp.servers.aquifer.env`,並在寫入前備份 `openclaw.json`。可用 `--dry-run --json` 檢查 package 版本、plugin config、MCP 目標與 extension link,不改檔案。
|
|
248
|
+
|
|
249
|
+
工具會以 `aquifer__memory_recall`、`aquifer__historical_recall`、`aquifer__session_recall`、`aquifer__evidence_recall`、`aquifer__session_feedback`、`aquifer__memory_feedback`、`aquifer__memory_stats`、`aquifer__memory_pending`、`aquifer__feedback_stats`、`aquifer__session_bootstrap` 等名稱出現(主機自動加上伺服器名稱前綴)。
|
|
253
250
|
|
|
254
251
|
OpenClaw plugin(`consumers/openclaw-plugin.js`)保留用於 `before_reset` session 擷取,但**不是**建議的工具傳遞方式。請用 MCP。
|
|
255
252
|
|
|
@@ -282,6 +279,7 @@ OpenClaw plugin(`consumers/openclaw-plugin.js`)保留用於 `before_reset` s
|
|
|
282
279
|
| `AQUIFER_MEMORY_SERVING_MODE` | 否 | 對外 serving mode:預設 `legacy`,可 opt-in `curated` | `curated` |
|
|
283
280
|
| `AQUIFER_MEMORY_ACTIVE_SCOPE_KEY` | 否 | recall/bootstrap 預設 active curated scope | `project:aquifer` |
|
|
284
281
|
| `AQUIFER_MEMORY_ACTIVE_SCOPE_PATH` | 否 | curated scope inheritance 的順序路徑 | `global,project:aquifer` |
|
|
282
|
+
| `AQUIFER_MEMORY_ALLOWED_SCOPE_KEYS` | 否 | curated scope request 的 caller boundary,預設為 configured active scope path | `global,project:aquifer` |
|
|
285
283
|
| `AQUIFER_MIGRATIONS_MODE` | 否 | 啟動 handshake 模式:`apply`(預設)、`check`、`off` | `apply` |
|
|
286
284
|
| `AQUIFER_MIGRATION_LOCK_TIMEOUT_MS` | 否 | advisory lock 等待上限,逾時拋 `AQ_MIGRATION_LOCK_TIMEOUT`(預設 30000) | `30000` |
|
|
287
285
|
| `AQUIFER_INSIGHTS_DEDUP_MODE` | 否 | insights 語意去重模式:`off`(預設)、`shadow`、`enforce`——此欄位 env 蓋過程式碼設定,讓 operator 不用重部署就能緊急關閉 | `shadow` |
|
|
@@ -657,7 +655,7 @@ opt-in pipeline(`createAquifer({stateChanges: {enabled, whitelist, confidenceT
|
|
|
657
655
|
|
|
658
656
|
**Recall 沒有回傳結果** — 確認你在 `commit` 之後有執行 `enrich`。未豐富化的 session 無法被搜尋(需要摘要 + embedding)。用 `aquifer stats` 檢查摘要和 turn embedding 是否存在。
|
|
659
657
|
|
|
660
|
-
**OpenClaw 看不到工具** — 請在 `openclaw.json` 使用 `mcp.servers.aquifer`,不要用 plugin。工具會以 `aquifer__session_recall` 等名稱出現。Plugin(`consumers/openclaw-plugin.js`)僅用於 session 擷取。
|
|
658
|
+
**OpenClaw 看不到工具** — 請在 `openclaw.json` 使用 `mcp.servers.aquifer`,不要用 plugin。工具會以 `aquifer__memory_recall`、`aquifer__historical_recall`、`aquifer__session_recall` 等名稱出現。Plugin(`consumers/openclaw-plugin.js`)僅用於 session 擷取。
|
|
661
659
|
|
|
662
660
|
**Embedding 供應商連線被拒** — 確認 `AQUIFER_EMBED_BASE_URL` 可以連通。若使用本地 Ollama,確保伺服器正在執行且模型已下載(`ollama pull bge-m3`)。
|
|
663
661
|
|