Skip to content

Commit 0de5e13

Browse files
radimsemclaude
andcommitted
docs(plugins): rework opencode and openclaw install guides
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 4c88743 commit 0de5e13

2 files changed

Lines changed: 68 additions & 59 deletions

File tree

plugins/openclaw/README.md

Lines changed: 29 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,21 +34,25 @@ remindb --version
3434

3535
remindb needs a SQLite file built from a source tree before the agent can read from it.
3636

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.
3838

39-
`~/.openclaw/` also accumulates per-agent session transcripts under `agents/<id>/sessions/`, plus `credentials/`, `sandboxes/`, and `sandbox/` — runtime state that bloats the index and 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):
4040

4141
```bash
4242
mkdir -p ~/.cache/remindb
4343
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.' \
4545
'' \
4646
'# Session transcripts.' \
4747
'*.jsonl' \
4848
'# Per-agent session subtrees (agents/<id>/sessions/).' \
4949
'**/sessions/' \
50-
'# oauth.json — never index secrets.' \
51-
'credentials/' \
50+
'# OAuth and API-key store (agents/<id>/agent/auth-profiles.json).' \
51+
'**/auth-profiles.json' \
52+
'# Provider apiKey residues sometimes leak into agents/<id>/agent/models.json.' \
53+
'**/models.json' \
54+
'# Installed plugins — avoid indexing remindb plugin source.' \
55+
'extensions/' \
5256
'# Sandbox runtime state.' \
5357
'sandboxes/' \
5458
'# Sandbox config (containers.json).' \
@@ -78,6 +82,15 @@ Stick them in `~/.bashrc` / `~/.zshrc` / your fish equivalent to make it permane
7882

7983
### 4. Install the plugin
8084

85+
Both install paths point at a local checkout, so clone the repo first:
86+
87+
```bash
88+
git clone https://github.com/radimsem/remindb.git ~/code/remindb
89+
cd ~/code/remindb
90+
```
91+
92+
Pin to a release tag if you want a stable version: `git -C ~/code/remindb checkout v0.1.0`.
93+
8194
Via OpenClaw CLI:
8295

8396
```bash
@@ -97,6 +110,17 @@ cp plugins/openclaw/index.ts plugins/openclaw/openclaw.plugin.json plugins/openc
97110
openclaw gateway restart
98111
```
99112

113+
#### Seed remaining context
114+
115+
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 `~`:
116+
117+
```
118+
remindb__MemoryCompile(path="/home/you/code/my-project/AGENTS.md", message="seed: project rules")
119+
remindb__MemoryCompile(path="/home/you/code/my-project/README.md", message="seed: project overview")
120+
```
121+
122+
Re-run whenever a file changes.
123+
100124
## Configuration
101125

102126
You can also enable the plugin and pin its config in `openclaw.json`:

plugins/opencode/README.md

Lines changed: 39 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -42,23 +42,28 @@ remindb compile ~/code/my-project --db ~/.cache/remindb/my-project.db
4242

4343
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.
4444

45-
#### Bring OpenCode's hierarchical memory along
45+
### 3. Configure opencode.json
4646

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:
4848

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")
53-
remindb__MemoryCompile(path="/home/you/code/parent/AGENTS.md", message="seed: ancestor memory")
54-
remindb__MemoryCompile(path="/home/you/.claude/CLAUDE.md", message="seed: claude-code fallback")
49+
```json
50+
{
51+
"$schema": "https://opencode.ai/config.json",
52+
"mcp": {
53+
"remindb": {
54+
"type": "local",
55+
"command": ["remindb", "serve"],
56+
"environment": {
57+
"REMINDB_DB": "{env:HOME}/.cache/remindb/my-project.db",
58+
"REMINDB_SOURCE": "{env:HOME}/code/my-project"
59+
},
60+
"enabled": true
61+
}
62+
}
63+
}
5564
```
5665

57-
Re-run whenever the file changes.
58-
59-
### 3. Add the MCP entry to your `opencode.json`
60-
61-
Pick one:
66+
Pick one install path:
6267

6368
**Project-level** (recommended — one workspace per repo):
6469

@@ -75,20 +80,9 @@ curl -fsSL https://raw.githubusercontent.com/radimsem/remindb/main/plugins/openc
7580
-o ~/.config/opencode/opencode.json
7681
```
7782

78-
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.
7984

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.
9286

9387
**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`:
9488

@@ -100,6 +94,17 @@ Or merge this block into an existing config by hand:
10094

10195
OpenCode runs `bun install` at startup to resolve the dependency.
10296

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+
103108
Confirm the server is connected:
104109

105110
```bash
@@ -108,39 +113,19 @@ opencode mcp list
108113

109114
You should see `remindb` listed with the full `Memory*` tool suite.
110115

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:
114-
115-
```json
116-
{
117-
"$schema": "https://opencode.ai/config.json",
118-
"mcp": {
119-
"remindb": {
120-
"type": "local",
121-
"command": ["remindb", "serve"],
122-
"environment": {
123-
"REMINDB_DB": "{env:HOME}/.cache/remindb/my-project.db",
124-
"REMINDB_SOURCE": "{env:HOME}/code/my-project"
125-
},
126-
"enabled": true
127-
}
128-
}
129-
}
130-
```
116+
#### Seed remaining context
131117

132-
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.
133119

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 `~`:
135121

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")
124+
remindb__MemoryCompile(path="/home/you/code/parent/AGENTS.md", message="seed: ancestor memory")
125+
remindb__MemoryCompile(path="/home/you/.claude/CLAUDE.md", message="seed: claude-code fallback")
141126
```
142127

143-
Then export the pair in `~/.bashrc` / `~/.zshrc` / your fish equivalent and restart OpenCode from that shell.
128+
Re-run whenever a file changes.
144129

145130
## Tools exposed
146131

0 commit comments

Comments
 (0)