beans-memory 0.0.0-stage → 0.1.4
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/LICENSE +21 -0
- package/README.id.md +354 -0
- package/README.md +353 -2
- package/docs/wordmark.svg +36 -0
- package/examples/claude-code.mcp.json +8 -0
- package/examples/codex.config.toml +8 -0
- package/examples/gemini.settings.json +10 -0
- package/examples/memory-instructions.md +19 -0
- package/package.json +45 -4
- package/skills/beans-memory/SKILL.md +56 -0
- package/src/cli.ts +183 -0
- package/src/db.ts +136 -0
- package/src/import-claude-mem-db.ts +125 -0
- package/src/import-claude-mem-extras.ts +162 -0
- package/src/import-claude-mem.ts +137 -0
- package/src/mcp.ts +230 -0
- package/src/migrate-legacy-db.ts +72 -0
- package/src/plugin.ts +335 -0
- package/src/redact-prompts.ts +27 -0
- package/src/redact.ts +26 -0
- package/src/rehash.ts +45 -0
- package/src/repo.ts +245 -0
- package/src/time.ts +18 -0
package/README.md
CHANGED
|
@@ -1,3 +1,354 @@
|
|
|
1
|
-
|
|
1
|
+
<p align="center">
|
|
2
|
+
<img src="docs/wordmark.svg" alt="beans-memory" width="520">
|
|
3
|
+
</p>
|
|
2
4
|
|
|
3
|
-
|
|
5
|
+
<p align="center">
|
|
6
|
+
Local, persistent memory for coding agents. One SQLite file. No daemon, no cloud, no account.
|
|
7
|
+
</p>
|
|
8
|
+
|
|
9
|
+
<p align="center">
|
|
10
|
+
<a href="https://github.com/firasmpratama/beans-memory/tags"><img src="https://img.shields.io/github/v/tag/firasmpratama/beans-memory" alt="Latest tag"></a>
|
|
11
|
+
<a href="LICENSE"><img src="https://img.shields.io/github/license/firasmpratama/beans-memory" alt="License: MIT"></a>
|
|
12
|
+
<a href="https://github.com/firasmpratama/beans-memory/stargazers"><img src="https://img.shields.io/github/stars/firasmpratama/beans-memory" alt="GitHub stars"></a>
|
|
13
|
+
<img src="https://img.shields.io/github/last-commit/firasmpratama/beans-memory" alt="Last commit">
|
|
14
|
+
<img src="https://img.shields.io/badge/Bun-%3E%3D1.2-000000?logo=bun&logoColor=white" alt="Bun 1.2+">
|
|
15
|
+
<img src="https://img.shields.io/badge/platform-macOS%20%7C%20Linux-lightgrey" alt="Platforms">
|
|
16
|
+
</p>
|
|
17
|
+
|
|
18
|
+
<p align="center">
|
|
19
|
+
English | <a href="README.id.md">Bahasa Indonesia</a>
|
|
20
|
+
</p>
|
|
21
|
+
|
|
22
|
+
The agent can save notes while it works, search them later, and gets a small index injected at the start of each session.
|
|
23
|
+
|
|
24
|
+
## How it works
|
|
25
|
+
|
|
26
|
+
```
|
|
27
|
+
OpenCode (Bun runtime)
|
|
28
|
+
├── plugin src/plugin.ts hooks + memory_* tools, runs in-process
|
|
29
|
+
├── MCP src/mcp.ts same tools over stdio, for other clients
|
|
30
|
+
└── SQLite ~/.local/share/beans-memory/memory.db
|
|
31
|
+
observations + FTS5 + prompts + sessions
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
- **Plugin** captures user prompts, records files touched by edit/write tools, and injects the 8 most recent note titles once per session.
|
|
35
|
+
- **Tools** let the agent write and search durable notes. Summaries are written by the agent itself, so no extra model call and no background worker.
|
|
36
|
+
- **MCP** exposes the same store to any MCP client (Claude Desktop, Cursor, scripts).
|
|
37
|
+
- **Search** uses SQLite FTS5: AND first, OR as fallback, ranked with BM25.
|
|
38
|
+
- Everything fails open. If the database or plugin breaks, OpenCode keeps working without memory.
|
|
39
|
+
|
|
40
|
+
## Requirements
|
|
41
|
+
|
|
42
|
+
- OpenCode 2
|
|
43
|
+
- Bun 1.2+ for the CLI, MCP server, importers, and tests. Not needed for the plugin alone: it runs inside OpenCode's bundled Bun.
|
|
44
|
+
- `curl -fsSL https://bun.sh/install | bash`
|
|
45
|
+
- macOS or Linux. Windows works in theory but is untested.
|
|
46
|
+
|
|
47
|
+
## Quick start
|
|
48
|
+
|
|
49
|
+
```bash
|
|
50
|
+
git clone https://github.com/firasmpratama/beans-memory ~/tools/beans-memory
|
|
51
|
+
cd ~/tools/beans-memory
|
|
52
|
+
./install.sh
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
Then restart OpenCode and ask the agent to call `memory_stats`. On a fresh install it returns zero notes.
|
|
56
|
+
|
|
57
|
+
The installer writes the plugin loader, creates the `beans-memory` CLI launcher when Bun is available, and installs the skill. It does not edit `opencode.json` and does not start a service.
|
|
58
|
+
|
|
59
|
+
No git? Download the source archive from the Releases page, unpack it anywhere permanent, and run `./install.sh` there.
|
|
60
|
+
|
|
61
|
+
### Manual install
|
|
62
|
+
|
|
63
|
+
<details>
|
|
64
|
+
<summary>Prefer to wire it yourself, or the script failed?</summary>
|
|
65
|
+
|
|
66
|
+
1. Get the code somewhere permanent:
|
|
67
|
+
|
|
68
|
+
```bash
|
|
69
|
+
git clone https://github.com/firasmpratama/beans-memory ~/tools/beans-memory
|
|
70
|
+
cd ~/tools/beans-memory
|
|
71
|
+
bun test # optional, requires Bun; uses a temporary database
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
2. Create the OpenCode loader:
|
|
75
|
+
|
|
76
|
+
```bash
|
|
77
|
+
mkdir -p ~/.config/opencode/plugins/memory
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
`~/.config/opencode/plugins/memory/index.ts`:
|
|
81
|
+
|
|
82
|
+
```ts
|
|
83
|
+
import { pathToFileURL } from "node:url";
|
|
84
|
+
|
|
85
|
+
const ENTRY = "/absolute/path/to/beans-memory/src/plugin.ts";
|
|
86
|
+
|
|
87
|
+
const noop = {
|
|
88
|
+
id: "memory",
|
|
89
|
+
async setup() {
|
|
90
|
+
return () => {};
|
|
91
|
+
},
|
|
92
|
+
};
|
|
93
|
+
|
|
94
|
+
let plugin: unknown = noop;
|
|
95
|
+
|
|
96
|
+
try {
|
|
97
|
+
const loaded = await import(pathToFileURL(ENTRY).href);
|
|
98
|
+
if (loaded?.default?.setup) plugin = loaded.default;
|
|
99
|
+
} catch (error) {
|
|
100
|
+
console.error("[memory] plugin not loaded:", error);
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
export default plugin;
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
Replace `ENTRY` with the real path. Keep the fallback: if the code is on an external drive that is not mounted, OpenCode still starts with memory disabled instead of failing.
|
|
107
|
+
|
|
108
|
+
The directory name and file name are free-form. OpenCode loads any `.ts` file under `~/.config/opencode/plugins/`.
|
|
109
|
+
|
|
110
|
+
3. Restart OpenCode.
|
|
111
|
+
|
|
112
|
+
4. Verify. Ask the agent to call `memory_stats`. On a fresh install it returns zero notes. If the tool is missing, see Troubleshooting.
|
|
113
|
+
|
|
114
|
+
Check the loader itself without OpenCode, if Bun is installed:
|
|
115
|
+
|
|
116
|
+
```bash
|
|
117
|
+
bun -e 'import("/absolute/path/to/beans-memory/src/plugin.ts").then((m) => console.log(typeof m.default.setup))'
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
It should print `function`. A path or import error here will also break the plugin in OpenCode.
|
|
121
|
+
|
|
122
|
+
</details>
|
|
123
|
+
|
|
124
|
+
## Use
|
|
125
|
+
|
|
126
|
+
Tools registered by the plugin:
|
|
127
|
+
|
|
128
|
+
| Tool | Purpose |
|
|
129
|
+
|---|---|
|
|
130
|
+
| `memory_note` | Save a note: title, body, type, files, concepts |
|
|
131
|
+
| `memory_search` | Full-text search, returns compact rows with ids |
|
|
132
|
+
| `memory_get` | Full bodies by id |
|
|
133
|
+
| `memory_stats` | Counts and last note date |
|
|
134
|
+
|
|
135
|
+
Suggested workflow for the agent: call `memory_note` after a task that produced a decision, bugfix, or non-obvious wiring discovery. Search first with `memory_search`, then fetch only the rows you need with `memory_get`.
|
|
136
|
+
|
|
137
|
+
Guided by `AGENTS.md`, the agent should keep notes short: what changed, why, and which files matter.
|
|
138
|
+
|
|
139
|
+
## MCP server (optional)
|
|
140
|
+
|
|
141
|
+
For clients that cannot load the plugin:
|
|
142
|
+
|
|
143
|
+
```jsonc
|
|
144
|
+
{
|
|
145
|
+
"mcp": {
|
|
146
|
+
"servers": {
|
|
147
|
+
"beans_memory": {
|
|
148
|
+
"type": "local",
|
|
149
|
+
"command": ["/absolute/path/to/bun", "/absolute/path/to/beans-memory/src/mcp.ts"]
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
- The server speaks JSON-RPC over stdio, one message per line.
|
|
157
|
+
- Tools: `memory_search`, `memory_get`, `memory_note`, `memory_stats`.
|
|
158
|
+
- Database selection: `MEMORY_DB`, otherwise `~/.local/share/beans-memory/memory.db`.
|
|
159
|
+
- Project name: `MEMORY_PROJECT`, otherwise the basename of the process working directory.
|
|
160
|
+
|
|
161
|
+
Claude Desktop example:
|
|
162
|
+
|
|
163
|
+
```json
|
|
164
|
+
{
|
|
165
|
+
"mcpServers": {
|
|
166
|
+
"beans-memory": {
|
|
167
|
+
"command": "/absolute/path/to/bun",
|
|
168
|
+
"args": ["/absolute/path/to/beans-memory/src/mcp.ts"],
|
|
169
|
+
"env": { "MEMORY_DB": "/Users/you/.local/share/beans-memory/memory.db" }
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
## CLI and skill (optional)
|
|
176
|
+
|
|
177
|
+
The same store is available without any tool registration:
|
|
178
|
+
|
|
179
|
+
```bash
|
|
180
|
+
bun src/cli.ts search "query" --limit 5
|
|
181
|
+
bun src/cli.ts get 12 13
|
|
182
|
+
bun src/cli.ts note --title "Title" --type decision --body "What changed and why"
|
|
183
|
+
bun src/cli.ts note --title "Title" --stdin <<'EOF'
|
|
184
|
+
Multi-line body.
|
|
185
|
+
EOF
|
|
186
|
+
bun src/cli.ts recent --limit 5
|
|
187
|
+
bun src/cli.ts stats
|
|
188
|
+
bun src/cli.ts projects
|
|
189
|
+
```
|
|
190
|
+
|
|
191
|
+
Flags: `--limit`, `--type`, `--files a,b`, `--concepts x,y`, `--json`, `--db <path>`, `--project <name>`.
|
|
192
|
+
|
|
193
|
+
Install a launcher on PATH:
|
|
194
|
+
|
|
195
|
+
```bash
|
|
196
|
+
printf '#!/bin/sh\nexec /ABSOLUTE/PATH/TO/bun /ABSOLUTE/PATH/TO/beans-memory/src/cli.ts "$@"\n' \
|
|
197
|
+
> ~/.local/bin/beans-memory
|
|
198
|
+
chmod +x ~/.local/bin/beans-memory
|
|
199
|
+
```
|
|
200
|
+
|
|
201
|
+
The skill in `skills/beans-memory/SKILL.md` teaches the agent when to run those commands. Copy it to `~/.claude/skills/beans-memory/SKILL.md`; OpenCode and Claude Code both read that directory.
|
|
202
|
+
|
|
203
|
+
When the skill is the only path you want, set `MEMORY_TOOLS=off` before starting OpenCode. Plugin hooks still capture prompts and inject context; the four plugin tools are not registered.
|
|
204
|
+
|
|
205
|
+
## Other agents
|
|
206
|
+
|
|
207
|
+
The MCP server works with any client that speaks stdio MCP. Every agent on the same machine shares one database, so a note saved from Claude Code is visible in Codex, Gemini CLI, and OpenCode.
|
|
208
|
+
|
|
209
|
+
Ready-to-copy files live in `examples/`. Replace `/ABSOLUTE/PATH/TO/` with real paths first.
|
|
210
|
+
|
|
211
|
+
### Claude Code
|
|
212
|
+
|
|
213
|
+
```bash
|
|
214
|
+
claude mcp add --scope user --transport stdio beans_memory -- \
|
|
215
|
+
/ABSOLUTE/PATH/TO/bun /ABSOLUTE/PATH/TO/beans-memory/src/mcp.ts
|
|
216
|
+
```
|
|
217
|
+
|
|
218
|
+
Or copy `examples/claude-code.mcp.json` to `.mcp.json` at the project root for a project-scoped server that the whole team can share.
|
|
219
|
+
|
|
220
|
+
Tool names are prefixed: `mcp__beans_memory__memory_search`.
|
|
221
|
+
|
|
222
|
+
### Codex
|
|
223
|
+
|
|
224
|
+
Merge `examples/codex.config.toml` into `~/.codex/config.toml`. For a project-scoped server, use `.codex/config.toml` inside a trusted project instead.
|
|
225
|
+
|
|
226
|
+
### Gemini CLI
|
|
227
|
+
|
|
228
|
+
```bash
|
|
229
|
+
gemini mcp add -s user beans-memory \
|
|
230
|
+
/ABSOLUTE/PATH/TO/bun /ABSOLUTE/PATH/TO/beans-memory/src/mcp.ts
|
|
231
|
+
```
|
|
232
|
+
|
|
233
|
+
Or merge `examples/gemini.settings.json` into `~/.gemini/settings.json`.
|
|
234
|
+
|
|
235
|
+
Keep the hyphen in the server name (`beans-memory`). Gemini builds tool names as `mcp_<server>_<tool>` and its policy parser splits on the first underscore, so an underscore in the server name breaks wildcard rules.
|
|
236
|
+
|
|
237
|
+
### Tell the agent to use it
|
|
238
|
+
|
|
239
|
+
Config alone only exposes tools. Append `examples/memory-instructions.md` to the agent instruction file: `CLAUDE.md`, `AGENTS.md`, or `GEMINI.md`.
|
|
240
|
+
|
|
241
|
+
## Data
|
|
242
|
+
|
|
243
|
+
Default location:
|
|
244
|
+
|
|
245
|
+
```
|
|
246
|
+
~/.local/share/beans-memory/memory.db
|
|
247
|
+
```
|
|
248
|
+
|
|
249
|
+
Override with `MEMORY_DB=/path/to/memory.db`. All projects share one file; the `project` column separates them. The project name comes from the basename of the working directory, so `~/work/api` is project `api`.
|
|
250
|
+
|
|
251
|
+
Backup, with OpenCode closed:
|
|
252
|
+
|
|
253
|
+
```bash
|
|
254
|
+
cp ~/.local/share/beans-memory/memory.db ~/backup-memory.db
|
|
255
|
+
```
|
|
256
|
+
|
|
257
|
+
Or online:
|
|
258
|
+
|
|
259
|
+
```bash
|
|
260
|
+
sqlite3 ~/.local/share/beans-memory/memory.db ".backup '/path/to/copy.db'"
|
|
261
|
+
```
|
|
262
|
+
|
|
263
|
+
Reset: stop OpenCode, delete the file, start again. The schema is recreated empty.
|
|
264
|
+
|
|
265
|
+
Timestamps are stored in UTC and displayed in local time.
|
|
266
|
+
|
|
267
|
+
## Import from claude-mem (optional)
|
|
268
|
+
|
|
269
|
+
If you have an old `~/.claude-mem/claude-mem.db`:
|
|
270
|
+
|
|
271
|
+
```bash
|
|
272
|
+
cd /path/to/beans-memory
|
|
273
|
+
|
|
274
|
+
# observations; discovery-type rows are skipped by default
|
|
275
|
+
bun src/import-claude-mem-db.ts --dry-run
|
|
276
|
+
bun src/import-claude-mem-db.ts
|
|
277
|
+
|
|
278
|
+
# session summaries and historical prompts
|
|
279
|
+
bun src/import-claude-mem-extras.ts --dry-run
|
|
280
|
+
bun src/import-claude-mem-extras.ts
|
|
281
|
+
```
|
|
282
|
+
|
|
283
|
+
Flags: `--source`, `--db`, `--project`, `--include-discovery`, `--dry-run`.
|
|
284
|
+
|
|
285
|
+
To migrate a database created by an older version of this project:
|
|
286
|
+
|
|
287
|
+
```bash
|
|
288
|
+
bun src/migrate-legacy-db.ts --from /old/memory.db
|
|
289
|
+
```
|
|
290
|
+
|
|
291
|
+
## Security
|
|
292
|
+
|
|
293
|
+
- Data stays on this machine. No network calls, no telemetry.
|
|
294
|
+
- Notes are stored as written. There is no secret redaction for notes. Do not save tokens, passwords, or `.env` contents into a note.
|
|
295
|
+
- Prompts captured automatically are redacted for common secret patterns: OpenAI/GitHub/AWS/Google API keys, Slack/Discord webhooks, and `password=` / `token:` style assignments. Redaction is best effort, not a guarantee, so still avoid pasting secrets into chat.
|
|
296
|
+
- The database is readable by any process running as your user. Treat it like a notes file, not a vault.
|
|
297
|
+
- Report vulnerabilities through [GitHub private vulnerability reporting](https://github.com/firasmpratama/beans-memory/security/advisories/new), not a public issue. See [SECURITY.md](.github/SECURITY.md) for what to include.
|
|
298
|
+
|
|
299
|
+
## Troubleshooting
|
|
300
|
+
|
|
301
|
+
- `memory_stats` is missing after restart: check the `ENTRY` path in the loader and run the `bun -e` check above. OpenCode logs loader errors to `~/.local/share/opencode/log/opencode.log`.
|
|
302
|
+
- Plugin silently does nothing: the loader caught an import error, usually because the code lives on an unmounted drive. Mount it and restart.
|
|
303
|
+
- `Cannot use import statement outside a module`: create `~/.config/opencode/plugins/package.json` with `{"type":"module"}`.
|
|
304
|
+
- `database is locked`: another process is writing. Close extra agents or wait; the database uses WAL with a 5 second busy timeout.
|
|
305
|
+
- Permission denied on the database: files are `0600` and the directory `0700` by design. Run as the user that created it.
|
|
306
|
+
|
|
307
|
+
## Limitations
|
|
308
|
+
|
|
309
|
+
- Keyword search only, no embeddings.
|
|
310
|
+
- No automatic summarization. Notes exist only when the agent writes them.
|
|
311
|
+
- Context injection is a short index (8 titles), not full bodies.
|
|
312
|
+
- Project identity is the working-directory basename. Two unrelated repositories with the same folder name share notes unless you set `MEMORY_PROJECT`.
|
|
313
|
+
- Single user, single machine. No sync.
|
|
314
|
+
- SQLite is accessed by the plugin process and the MCP process. WAL mode plus a 5 second busy timeout handles that; heavy concurrent writes are not a design goal.
|
|
315
|
+
|
|
316
|
+
## Development
|
|
317
|
+
|
|
318
|
+
Install the dev dependencies once, then use the scripts:
|
|
319
|
+
|
|
320
|
+
```bash
|
|
321
|
+
bun install
|
|
322
|
+
bun test
|
|
323
|
+
bun run typecheck
|
|
324
|
+
bun run test:coverage
|
|
325
|
+
```
|
|
326
|
+
|
|
327
|
+
## Layout
|
|
328
|
+
|
|
329
|
+
```
|
|
330
|
+
src/db.ts schema, FTS5, migrations
|
|
331
|
+
src/repo.ts queries: sessions, prompts, observations, search
|
|
332
|
+
src/plugin.ts OpenCode plugin: hooks and tools
|
|
333
|
+
src/mcp.ts MCP stdio server
|
|
334
|
+
src/cli.ts CLI for skill-based use
|
|
335
|
+
src/time.ts UTC to local formatting
|
|
336
|
+
src/redact.ts secret redaction for captured prompts
|
|
337
|
+
src/rehash.ts one-time hash migration
|
|
338
|
+
src/redact-prompts.ts redact existing prompt rows
|
|
339
|
+
src/import-claude-mem-db.ts import observations from claude-mem
|
|
340
|
+
src/import-claude-mem-extras.ts import summaries and prompts
|
|
341
|
+
src/migrate-legacy-db.ts copy an older beans-memory database
|
|
342
|
+
skills/beans-memory/ agent skill for the CLI
|
|
343
|
+
test/ bun test: repo, edges, time, MCP, CLI, redaction
|
|
344
|
+
```
|
|
345
|
+
|
|
346
|
+
## Uninstall
|
|
347
|
+
|
|
348
|
+
1. Remove `~/.config/opencode/plugins/memory/`.
|
|
349
|
+
2. Remove the `beans_memory` entry from `opencode.json` if you added it.
|
|
350
|
+
3. Delete `~/.local/share/beans-memory/` if you do not want to keep the notes.
|
|
351
|
+
|
|
352
|
+
## License
|
|
353
|
+
|
|
354
|
+
MIT. See [LICENSE](LICENSE).
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="792" height="430" viewBox="0 0 792 430" role="img" aria-labelledby="t d">
|
|
2
|
+
<title id="t">beans-memory</title>
|
|
3
|
+
<desc id="d">Wordmark: a golden bean with a sprout above the name beans-memory.</desc>
|
|
4
|
+
<defs>
|
|
5
|
+
<linearGradient id="bean" x1="0" y1="0" x2="0.4" y2="1">
|
|
6
|
+
<stop offset="0" stop-color="#FBE0A8"/>
|
|
7
|
+
<stop offset="0.62" stop-color="#EDBE72"/>
|
|
8
|
+
<stop offset="1" stop-color="#C98F41"/>
|
|
9
|
+
</linearGradient>
|
|
10
|
+
<linearGradient id="leaf" x1="0" y1="0" x2="1" y2="1">
|
|
11
|
+
<stop offset="0" stop-color="#A9C286"/>
|
|
12
|
+
<stop offset="1" stop-color="#7E9B5C"/>
|
|
13
|
+
</linearGradient>
|
|
14
|
+
</defs>
|
|
15
|
+
|
|
16
|
+
<rect x="1" y="1" width="790" height="428" rx="34" fill="#FDF7EA" stroke="#E8D7B8" stroke-width="2"/>
|
|
17
|
+
|
|
18
|
+
<g transform="translate(236.00 22.00) scale(0.4)">
|
|
19
|
+
<ellipse cx="400" cy="500" rx="140" ry="17" fill="#8B5A2B" opacity="0.12"/>
|
|
20
|
+
<path d="M430 138
|
|
21
|
+
C548 158 608 256 582 368
|
|
22
|
+
C560 462 478 510 396 500
|
|
23
|
+
C326 492 262 446 242 378
|
|
24
|
+
C232 346 243 322 268 317
|
|
25
|
+
C300 311 329 291 339 259
|
|
26
|
+
C352 214 380 163 430 138Z"
|
|
27
|
+
fill="url(#bean)" stroke="#5F3A1A" stroke-width="8" stroke-linejoin="round"/>
|
|
28
|
+
<path d="M260 336 C292 334 320 310 334 272" fill="none" stroke="#FFE8BC" stroke-width="11" stroke-linecap="round" opacity="0.85"/>
|
|
29
|
+
<path d="M262 340 C294 338 322 314 336 276" fill="none" stroke="#8A5A28" stroke-width="3" stroke-linecap="round" opacity="0.5"/>
|
|
30
|
+
<path d="M470 212 C452 250 446 300 452 350" fill="none" stroke="#FFF0CC" stroke-width="12" stroke-linecap="round" opacity="0.35"/>
|
|
31
|
+
</g>
|
|
32
|
+
|
|
33
|
+
<g transform="translate(55.75 360.00)" fill="#6E4420">
|
|
34
|
+
<path transform="translate(0.00 0) scale(0.044922 -0.044922)" d="M393 1335V918Q470 998 550.0 1040.5Q630 1083 748 1083Q884 1083 986.5 1018.5Q1089 954 1145.5 831.5Q1202 709 1202 541Q1202 417 1170.5 313.5Q1139 210 1079.0 134.0Q1019 58 933.5 16.5Q848 -25 745 -25Q682 -25 626.5 -10.0Q571 5 532.0 29.5Q493 54 465.5 80.0Q438 106 393 158V131Q393 54 356.0 14.5Q319 -25 262 -25Q204 -25 169.5 14.5Q135 54 135 131V1323Q135 1406 168.5 1448.5Q202 1491 262 1491Q325 1491 359.0 1450.5Q393 1410 393 1335ZM406 524Q406 361 480.5 273.5Q555 186 676 186Q779 186 853.5 275.5Q928 365 928 532Q928 640 897.0 718.0Q866 796 809.0 838.5Q752 881 676 881Q598 881 537.0 838.5Q476 796 441.0 715.5Q406 635 406 524Z"/><path transform="translate(58.70 0) scale(0.044922 -0.044922)" d="M903 463H369Q370 370 406.5 299.0Q443 228 503.5 192.0Q564 156 637 156Q686 156 726.5 167.5Q767 179 805.0 203.5Q843 228 875.0 256.0Q907 284 958 332Q979 350 1018 350Q1060 350 1086.0 327.0Q1112 304 1112 262Q1112 225 1083.0 175.5Q1054 126 995.5 80.5Q937 35 848.5 5.0Q760 -25 645 -25Q382 -25 236.0 125.0Q90 275 90 532Q90 653 126.0 756.5Q162 860 231.0 934.0Q300 1008 401.0 1047.5Q502 1087 625 1087Q785 1087 899.5 1019.5Q1014 952 1071.0 845.0Q1128 738 1128 627Q1128 524 1069.0 493.5Q1010 463 903 463ZM369 618H864Q854 758 788.5 827.5Q723 897 616 897Q514 897 448.5 826.5Q383 756 369 618Z"/><path transform="translate(114.57 0) scale(0.044922 -0.044922)" d="M831 129Q732 52 639.5 13.5Q547 -25 432 -25Q327 -25 247.5 16.5Q168 58 125.0 129.0Q82 200 82 283Q82 395 153.0 474.0Q224 553 348 580Q374 586 477.0 607.0Q580 628 653.5 645.5Q727 663 813 688Q808 796 769.5 846.5Q731 897 610 897Q506 897 453.5 868.0Q401 839 363.5 781.0Q326 723 310.5 704.5Q295 686 244 686Q198 686 164.5 715.5Q131 745 131 791Q131 863 182.0 931.0Q233 999 341.0 1043.0Q449 1087 610 1087Q790 1087 893.0 1044.5Q996 1002 1038.5 910.0Q1081 818 1081 666Q1081 570 1080.5 503.0Q1080 436 1079 354Q1079 277 1104.5 193.5Q1130 110 1130 86Q1130 44 1090.5 9.5Q1051 -25 1001 -25Q959 -25 918.0 14.5Q877 54 831 129ZM813 524Q753 502 638.5 477.5Q524 453 480.0 441.5Q436 430 396.0 396.5Q356 363 356 303Q356 241 403.0 197.5Q450 154 526 154Q607 154 675.5 189.5Q744 225 776 281Q813 343 813 485Z"/><path transform="translate(170.44 0) scale(0.044922 -0.044922)" d="M389 934V901Q461 996 546.5 1040.5Q632 1085 743 1085Q851 1085 936.0 1038.0Q1021 991 1063 905Q1090 855 1098.0 797.0Q1106 739 1106 649V141Q1106 59 1068.5 17.0Q1031 -25 971 -25Q910 -25 872.0 18.0Q834 61 834 141V596Q834 731 796.5 802.5Q759 874 647 874Q574 874 514.0 830.5Q454 787 426 711Q406 650 406 483V141Q406 58 367.5 16.5Q329 -25 268 -25Q209 -25 171.0 18.0Q133 61 133 141V930Q133 1008 167.0 1046.5Q201 1085 260 1085Q296 1085 325.0 1068.0Q354 1051 371.5 1017.0Q389 983 389 934Z"/><path transform="translate(227.21 0) scale(0.044922 -0.044922)" d="M1020 332Q1020 219 965.0 138.5Q910 58 802.5 16.5Q695 -25 541 -25Q394 -25 289.0 20.0Q184 65 134.0 132.5Q84 200 84 268Q84 313 116.0 345.0Q148 377 197 377Q240 377 263.0 356.0Q286 335 307 297Q349 224 407.5 188.0Q466 152 567 152Q649 152 701.5 188.5Q754 225 754 272Q754 344 699.5 377.0Q645 410 520 440Q379 475 290.5 513.5Q202 552 149.0 615.0Q96 678 96 770Q96 852 145.0 925.0Q194 998 289.5 1041.5Q385 1085 520 1085Q626 1085 710.5 1063.0Q795 1041 851.5 1004.0Q908 967 937.5 922.0Q967 877 967 834Q967 787 935.5 757.0Q904 727 846 727Q804 727 774.5 751.0Q745 775 707 823Q676 863 634.0 887.0Q592 911 520 911Q446 911 397.0 879.5Q348 848 348 801Q348 758 384.0 730.5Q420 703 481.0 685.0Q542 667 649 641Q776 610 856.5 567.0Q937 524 978.5 465.5Q1020 407 1020 332Z"/><path transform="translate(278.27 0) scale(0.044922 -0.044922)" d="M500 412H184Q112 412 74.5 445.5Q37 479 37 532Q37 586 73.5 619.5Q110 653 184 653H500Q574 653 610.5 619.5Q647 586 647 532Q647 479 611.0 445.5Q575 412 500 412Z"/><path transform="translate(310.11 0) scale(0.044922 -0.044922)" d="M1049 510V147Q1049 61 1010.0 18.0Q971 -25 907 -25Q845 -25 806.5 18.0Q768 61 768 147V582Q768 685 761.0 742.0Q754 799 723.0 835.5Q692 872 625 872Q491 872 448.5 780.0Q406 688 406 516V147Q406 62 367.5 18.5Q329 -25 266 -25Q204 -25 164.5 18.5Q125 62 125 147V928Q125 1005 160.5 1045.0Q196 1085 254 1085Q310 1085 347.5 1047.5Q385 1010 385 944V918Q456 1003 537.0 1043.0Q618 1083 717 1083Q820 1083 894.0 1042.0Q968 1001 1016 918Q1085 1002 1164.0 1042.5Q1243 1083 1339 1083Q1451 1083 1532.0 1039.0Q1613 995 1653 913Q1688 839 1688 680V147Q1688 61 1649.0 18.0Q1610 -25 1546 -25Q1484 -25 1444.5 18.5Q1405 62 1405 147V606Q1405 694 1397.5 747.0Q1390 800 1357.0 836.0Q1324 872 1257 872Q1203 872 1154.5 840.0Q1106 808 1079 754Q1049 685 1049 510Z"/><path transform="translate(392.71 0) scale(0.044922 -0.044922)" d="M903 463H369Q370 370 406.5 299.0Q443 228 503.5 192.0Q564 156 637 156Q686 156 726.5 167.5Q767 179 805.0 203.5Q843 228 875.0 256.0Q907 284 958 332Q979 350 1018 350Q1060 350 1086.0 327.0Q1112 304 1112 262Q1112 225 1083.0 175.5Q1054 126 995.5 80.5Q937 35 848.5 5.0Q760 -25 645 -25Q382 -25 236.0 125.0Q90 275 90 532Q90 653 126.0 756.5Q162 860 231.0 934.0Q300 1008 401.0 1047.5Q502 1087 625 1087Q785 1087 899.5 1019.5Q1014 952 1071.0 845.0Q1128 738 1128 627Q1128 524 1069.0 493.5Q1010 463 903 463ZM369 618H864Q854 758 788.5 827.5Q723 897 616 897Q514 897 448.5 826.5Q383 756 369 618Z"/><path transform="translate(448.58 0) scale(0.044922 -0.044922)" d="M1049 510V147Q1049 61 1010.0 18.0Q971 -25 907 -25Q845 -25 806.5 18.0Q768 61 768 147V582Q768 685 761.0 742.0Q754 799 723.0 835.5Q692 872 625 872Q491 872 448.5 780.0Q406 688 406 516V147Q406 62 367.5 18.5Q329 -25 266 -25Q204 -25 164.5 18.5Q125 62 125 147V928Q125 1005 160.5 1045.0Q196 1085 254 1085Q310 1085 347.5 1047.5Q385 1010 385 944V918Q456 1003 537.0 1043.0Q618 1083 717 1083Q820 1083 894.0 1042.0Q968 1001 1016 918Q1085 1002 1164.0 1042.5Q1243 1083 1339 1083Q1451 1083 1532.0 1039.0Q1613 995 1653 913Q1688 839 1688 680V147Q1688 61 1649.0 18.0Q1610 -25 1546 -25Q1484 -25 1444.5 18.5Q1405 62 1405 147V606Q1405 694 1397.5 747.0Q1390 800 1357.0 836.0Q1324 872 1257 872Q1203 872 1154.5 840.0Q1106 808 1079 754Q1049 685 1049 510Z"/><path transform="translate(531.17 0) scale(0.044922 -0.044922)" d="M1163 530Q1163 408 1125.0 305.0Q1087 202 1015.0 128.0Q943 54 843.0 14.5Q743 -25 618 -25Q494 -25 395.0 15.0Q296 55 223.5 129.5Q151 204 113.5 305.5Q76 407 76 530Q76 654 114.0 757.0Q152 860 223.0 933.0Q294 1006 395.0 1045.5Q496 1085 618 1085Q742 1085 843.0 1045.0Q944 1005 1016.0 931.0Q1088 857 1125.5 755.0Q1163 653 1163 530ZM889 530Q889 697 815.5 790.0Q742 883 618 883Q538 883 477.0 841.5Q416 800 383.0 719.0Q350 638 350 530Q350 423 382.5 343.0Q415 263 475.5 220.5Q536 178 618 178Q742 178 815.5 271.5Q889 365 889 530Z"/><path transform="translate(587.94 0) scale(0.044922 -0.044922)" d="M412 369V141Q412 58 373.0 16.5Q334 -25 274 -25Q215 -25 177.0 17.0Q139 59 139 141V901Q139 1085 272 1085Q340 1085 370.0 1042.0Q400 999 403 915Q452 999 503.5 1042.0Q555 1085 641 1085Q727 1085 808.0 1042.0Q889 999 889 928Q889 878 854.5 845.5Q820 813 780 813Q765 813 707.5 831.5Q650 850 606 850Q546 850 508.0 818.5Q470 787 449.0 725.0Q428 663 420.0 577.5Q412 492 412 369Z"/><path transform="translate(629.44 0) scale(0.044922 -0.044922)" d="M393 -59 418 2 82 848Q51 921 51 954Q51 989 69.0 1019.0Q87 1049 118.5 1067.0Q150 1085 184 1085Q243 1085 273.0 1047.5Q303 1010 326 940L557 268L776 893Q802 969 823.0 1012.0Q844 1055 867.5 1070.0Q891 1085 934 1085Q965 1085 993.5 1068.5Q1022 1052 1037.5 1024.0Q1053 996 1053 965Q1049 946 1040.0 911.0Q1031 876 1018 840L662 -92Q616 -215 572.0 -285.0Q528 -355 455.5 -392.5Q383 -430 260 -430Q140 -430 80.0 -404.0Q20 -378 20 -309Q20 -262 48.5 -236.5Q77 -211 133 -211Q155 -211 176 -217Q202 -223 221 -223Q268 -223 295.0 -209.0Q322 -195 343.5 -160.5Q365 -126 393 -59Z"/>
|
|
35
|
+
</g>
|
|
36
|
+
</svg>
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
[mcp_servers.beans_memory]
|
|
2
|
+
command = "/ABSOLUTE/PATH/TO/bun"
|
|
3
|
+
args = ["/ABSOLUTE/PATH/TO/beans-memory/src/mcp.ts"]
|
|
4
|
+
startup_timeout_sec = 20
|
|
5
|
+
tool_timeout_sec = 60
|
|
6
|
+
|
|
7
|
+
[mcp_servers.beans_memory.env]
|
|
8
|
+
# MEMORY_DB = "/Users/you/.local/share/beans-memory/memory.db"
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# Memory instructions
|
|
2
|
+
|
|
3
|
+
Paste this block into the agent instruction file:
|
|
4
|
+
|
|
5
|
+
- Claude Code: `CLAUDE.md`
|
|
6
|
+
- Codex: `AGENTS.md`
|
|
7
|
+
- Gemini CLI: `GEMINI.md`
|
|
8
|
+
- OpenCode: `AGENTS.md`
|
|
9
|
+
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
## Project memory
|
|
13
|
+
|
|
14
|
+
Memories live in a local SQLite database, shared by every agent on this machine.
|
|
15
|
+
|
|
16
|
+
- Before starting work that may have been done before, call `memory_search` with a few keywords. Then call `memory_get` only for the ids that matter.
|
|
17
|
+
- After a task that produced a decision, a non-obvious bugfix, or wiring that is hard to rediscover, call `memory_note` with a short title and a body covering: what changed, why, and the files involved.
|
|
18
|
+
- Do not save secrets, tokens, passwords, or `.env` contents into a note.
|
|
19
|
+
- Keep notes short. One fact per note is easier to find than one long summary.
|
package/package.json
CHANGED
|
@@ -1,6 +1,47 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "beans-memory",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "0.1.4",
|
|
4
|
+
"description": "Local persistent memory for OpenCode and other coding agents: SQLite + FTS5 plugin, MCP server, and CLI",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "git+https://github.com/firasmpratama/beans-memory.git"
|
|
10
|
+
},
|
|
11
|
+
"homepage": "https://github.com/firasmpratama/beans-memory",
|
|
12
|
+
"bugs": {
|
|
13
|
+
"url": "https://github.com/firasmpratama/beans-memory/issues"
|
|
14
|
+
},
|
|
15
|
+
"bin": {
|
|
16
|
+
"beans-memory": "./src/cli.ts"
|
|
17
|
+
},
|
|
18
|
+
"files": [
|
|
19
|
+
"src",
|
|
20
|
+
"skills",
|
|
21
|
+
"examples",
|
|
22
|
+
"docs",
|
|
23
|
+
"README.md",
|
|
24
|
+
"README.id.md",
|
|
25
|
+
"SECURITY.md"
|
|
26
|
+
],
|
|
27
|
+
"keywords": [
|
|
28
|
+
"opencode",
|
|
29
|
+
"memory",
|
|
30
|
+
"sqlite",
|
|
31
|
+
"fts5",
|
|
32
|
+
"mcp",
|
|
33
|
+
"coding-agent"
|
|
34
|
+
],
|
|
35
|
+
"engines": {
|
|
36
|
+
"bun": ">=1.2.0"
|
|
37
|
+
},
|
|
38
|
+
"scripts": {
|
|
39
|
+
"test": "bun test",
|
|
40
|
+
"test:coverage": "bun test --coverage",
|
|
41
|
+
"typecheck": "tsc --noEmit"
|
|
42
|
+
},
|
|
43
|
+
"devDependencies": {
|
|
44
|
+
"@types/bun": "^1.4.5",
|
|
45
|
+
"typescript": "^7.0.2"
|
|
46
|
+
}
|
|
47
|
+
}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: Beans Memory
|
|
3
|
+
description: Cari catatan proyek yang tersimpan dan simpan keputusan atau bugfix baru ke memory lokal. Gunakan sebelum mulai pekerjaan yang mungkin pernah dikerjakan, dan setelah tugas yang menghasilkan keputusan, bugfix, atau wiring yang sulit ditemukan lagi.
|
|
4
|
+
metadata:
|
|
5
|
+
opencode/autoinvoke: true
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# Beans Memory
|
|
9
|
+
|
|
10
|
+
Memory lokal berbasis SQLite. Tidak ada cloud, tidak ada akun.
|
|
11
|
+
|
|
12
|
+
CLI: `beans-memory` (launcher di `~/.local/bin/beans-memory`). Kalau launcher tidak tersedia, jalankan langsung:
|
|
13
|
+
|
|
14
|
+
```bash
|
|
15
|
+
bun "/Volumes/Beans Ext/projects/ai/beans-memory/src/cli.ts" <command>
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
## Sebelum mulai
|
|
19
|
+
|
|
20
|
+
Cari dulu apakah topik ini pernah dikerjakan:
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
beans-memory search "kata kunci topik" --limit 5
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
Kalau ada hasil relevan, buka isinya:
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
beans-memory get <id> [<id>...]
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
Gunakan `--json` kalau perlu memproses hasil secara terstruktur.
|
|
33
|
+
|
|
34
|
+
## Setelah tugas
|
|
35
|
+
|
|
36
|
+
Simpan satu catatan ringkas untuk keputusan, bugfix, aturan bisnis, atau wiring yang tidak jelas dari kode:
|
|
37
|
+
|
|
38
|
+
```bash
|
|
39
|
+
beans-memory note \
|
|
40
|
+
--title "Judul satu baris" \
|
|
41
|
+
--type decision \
|
|
42
|
+
--files "app/Contoh.php,app/Lain.php" \
|
|
43
|
+
--stdin <<'EOF'
|
|
44
|
+
Apa yang berubah, kenapa, dan bagian mana yang perlu diingat.
|
|
45
|
+
EOF
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
Tipe yang tersedia: `decision`, `bugfix`, `feature`, `refactor`, `security_note`, `note`.
|
|
49
|
+
|
|
50
|
+
## Aturan
|
|
51
|
+
|
|
52
|
+
- Satu catatan satu fakta. Jangan menulis ringkasan panjang.
|
|
53
|
+
- Sertakan alasan keputusan, bukan hanya perubahan.
|
|
54
|
+
- Jangan simpan token, password, isi `.env`, atau data pribadi.
|
|
55
|
+
- Project ditentukan dari nama folder kerja. Gunakan `--project <nama>` kalau perlu memisahkan.
|
|
56
|
+
- Cek `beans-memory stats` untuk melihat jumlah catatan project ini.
|