You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: plugins/openclaw/README.md
+29-5Lines changed: 29 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -34,21 +34,25 @@ remindb --version
34
34
35
35
remindb needs a SQLite file built from a source tree before the agent can read from it.
36
36
37
-
A natural source for OpenClaw is its own state folder at `~/.openclaw/` — `openclaw.json`, hook scripts under `hooks/<id>/`, agent workspaces under `workspace/` (and `workspace-*`), and skill definitions under `skills/`. Indexing it lets OpenClaw query its own persistent context through remindb instead of grepping the dot folder.
37
+
A natural source for OpenClaw is its own state folder at `~/.openclaw/` — `openclaw.json`, hook scripts under `hooks/<id>/`, agent workspaces under `workspace/` (and `workspace-*`), per-agent state under `agents/<id>/`, installed plugins under `extensions/`, and shared skill definitions under `skills/`. Indexing it lets OpenClaw query its own persistent context through remindb instead of grepping the dot folder.
38
38
39
-
`~/.openclaw/` also accumulates per-agent session transcripts under`agents/<id>/sessions/`, plus `credentials/`, `sandboxes/`, and `sandbox/`— runtime state that bloats the indexand includes secrets. Drop a `.remindb.ignore` at `~/.openclaw/` to filter them out (gitignore-style minimal subset: `*`, `**`, trailing `/`, `#` comments; no `!` negation, no `[abc]` ranges):
39
+
`~/.openclaw/` also accumulates session transcripts at`agents/<id>/sessions/*.jsonl`, OAuth + API-key stores at `agents/<id>/agent/auth-profiles.json` (with provider apiKey residues sometimes spilling into adjacent `models.json`), the `extensions/`plugin install dir (you don't want remindb indexing its own bundled `index.ts` / `.mcp.json`), and `sandboxes/` / `sandbox/` runtime state. Drop a `.remindb.ignore` at `~/.openclaw/` to filter them out (gitignore-style minimal subset: `*`, `**`, trailing `/`, `#` comments; no `!` negation, no `[abc]` ranges):
40
40
41
41
```bash
42
42
mkdir -p ~/.cache/remindb
43
43
printf'%s\n' \
44
-
'# Compile only curated context; skip session transcripts and runtime state.' \
44
+
'# Compile only curated context; skip session transcripts, secrets, and runtime state.' \
Step 2 compiled `~/.openclaw/` — OpenClaw's own state folder. The current project's `AGENTS.md` (or `SOUL.md`, `USER.md`, `MEMORY.md`) and in-repo docs (`README.md`, design notes, roadmaps) live in the repo, not under that path. Ask the agent in your first session to fold them in. Use absolute paths — `MemoryCompile` doesn't expand `~`:
Drop a `.remindb.ignore` at the workspace root if you need to exclude noise (build outputs, vendored deps, generated files). The same file is honored by `serve`'s background rescan and the `MemoryCompile` tool.
44
44
45
-
#### Bring OpenCode's hierarchical memory along
45
+
###3. Configure opencode.json
46
46
47
-
OpenCode doesn't keep a `memory/` folder — its persistent context is a stack of `AGENTS.md` files. It loads them from three places: the global `~/.config/opencode/AGENTS.md`, project-root and ancestor `AGENTS.md` files traversed upward from your cwd, and a Claude Code fallback at `~/.claude/CLAUDE.md` (unless disabled). Only `AGENTS.md` files at or below the workspace root land in `REMINDB_SOURCE` automatically — ancestors above it and the global file live outside.
47
+
`remindb serve` reads `REMINDB_DB` and `REMINDB_SOURCE` for its `--db`and `--source` flags. The cleanest place to set them for OpenCode is the `environment` object on the `mcp.remindb` entry — OpenCode passes it straight to the spawned subprocess without touching your shell env. The full config looks like this:
48
48
49
-
Ask OpenCode to compile them once the plugin is running. Use absolute paths — `MemoryCompile` doesn't expand `~`:
50
-
51
-
```
52
-
remindb__MemoryCompile(path="/home/you/.config/opencode/AGENTS.md", message="seed: global memory")
Or merge this block into an existing config by hand:
83
+
The bundled file ships only the bare MCP entry — open it after curling and add the `environment`block from the snippet above. Or skip the curl and write the full snippet by hand into either path.
79
84
80
-
```json
81
-
{
82
-
"$schema": "https://opencode.ai/config.json",
83
-
"mcp": {
84
-
"remindb": {
85
-
"type": "local",
86
-
"command": ["remindb", "serve"],
87
-
"enabled": true
88
-
}
89
-
}
90
-
}
91
-
```
85
+
Heads up: OpenCode only expands `{env:VARIABLE_NAME}` in config values — shell-style `$HOME` or `${HOME}` is treated as a literal string and won't work. Swap the paths for a different workspace (e.g., `{env:HOME}/notes` + `{env:HOME}/.cache/remindb/notes.db`) whenever you want OpenCode to read a different tree. Per-project is recommended so each workspace carries its own DB and source paths — OpenCode reads `opencode.json` on session start, so launching a fresh session from the new directory is enough to swap configs.
92
86
93
87
**Optional — npm-distributed plugin stub.** If you want the bundle to show up in OpenCode's plugin list, reference the npm package from the same `opencode.json`:
94
88
@@ -100,6 +94,17 @@ Or merge this block into an existing config by hand:
100
94
101
95
OpenCode runs `bun install` at startup to resolve the dependency.
102
96
97
+
**Prefer a shell-inherited env?** Point the two values at your own env vars via the same substitution:
98
+
99
+
```json
100
+
"environment": {
101
+
"REMINDB_DB": "{env:REMINDB_DB}",
102
+
"REMINDB_SOURCE": "{env:REMINDB_SOURCE}"
103
+
}
104
+
```
105
+
106
+
Then export the pair in `~/.bashrc` / `~/.zshrc` / your fish equivalent and restart OpenCode from that shell.
107
+
103
108
Confirm the server is connected:
104
109
105
110
```bash
@@ -108,39 +113,19 @@ opencode mcp list
108
113
109
114
You should see `remindb` listed with the full `Memory*` tool suite.
110
115
111
-
### 4. Point remindb at your workspace via `opencode.json`
112
-
113
-
`remindb serve` reads `REMINDB_DB` and `REMINDB_SOURCE` as fallbacks for its `--db` and `--source` flags. The cleanest place to set them for OpenCode is the `environment` object on the same `mcp.remindb` entry — OpenCode passes it straight to the spawned subprocess without touching your shell env:
Heads up: OpenCode only expands `{env:VARIABLE_NAME}` in config values — shell-style `$HOME` or `${HOME}`is treated as a literal string and won't work. Swap the paths for a different workspace (e.g., `{env:HOME}/notes` + `{env:HOME}/.cache/remindb/notes.db`) whenever you want OpenCode to read a different tree. Keep the file per-project at the workspace root as `opencode.json` so each workspace carries its own DB and source paths — OpenCode reads it on session start, so launching a fresh session from the new directory is enough to swap configs.
118
+
OpenCode doesn't keep a `memory/` folder — its persistent context is a stack of `AGENTS.md` files loaded from three places: the global `~/.config/opencode/AGENTS.md`, project-root and ancestor `AGENTS.md` files traversed upward from your cwd, and a Claude Code fallback at `~/.claude/CLAUDE.md` (unless disabled). Only `AGENTS.md` files at or below the workspace root land in `REMINDB_SOURCE` automatically — ancestors above it and the global file live outside.
133
119
134
-
Prefer a shell-inherited env? Point the two values at your own env vars via the same substitution:
120
+
Ask OpenCode in your first session to fold them in. Use absolute paths — `MemoryCompile` doesn't expand `~`:
135
121
136
-
```json
137
-
"environment": {
138
-
"REMINDB_DB": "{env:REMINDB_DB}",
139
-
"REMINDB_SOURCE": "{env:REMINDB_SOURCE}"
140
-
}
122
+
```
123
+
remindb__MemoryCompile(path="/home/you/.config/opencode/AGENTS.md", message="seed: global memory")
0 commit comments