toon-memory 2.3.0 → 2.4.1
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/README.md +21 -12
- package/bin/toon-memory.js +40 -0
- package/dist/cli/setup.js +294 -79
- package/mcp/server.js +1 -1
- package/package.json +3 -2
- package/skills/toon-memory.md +5 -5
- package/src/bin/toon-memory.ts +44 -0
- package/src/cli/setup.ts +328 -60
- package/src/mcp/server.ts +1 -1
- package/src/memory.ts +0 -237
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# toon-memory
|
|
2
2
|
|
|
3
|
-
>
|
|
3
|
+
> MCP memory server for AI coding agents — remember decisions, patterns, and bugs between sessions.
|
|
4
4
|
|
|
5
5
|
[](https://www.npmjs.com/package/toon-memory)
|
|
6
6
|
[](https://opensource.org/licenses/MIT)
|
|
@@ -132,17 +132,17 @@ memory_remember # Save important decisions
|
|
|
132
132
|
|
|
133
133
|
| Agent | Config Location | Format | Hooks | Auto-Setup |
|
|
134
134
|
|-------|-----------------|--------|-------|------------|
|
|
135
|
-
| **OpenCode** | `.opencode/opencode.json` |
|
|
135
|
+
| **OpenCode** | `.opencode/opencode.json` + `.opencode/plugins/toon-memory.ts` | Plugin | SessionStart (plugin, no top-level `hooks`) | ✅ |
|
|
136
136
|
| **VS Code / Copilot** | `.vscode/mcp.json` | JSON | — | ✅ |
|
|
137
|
-
| **Claude Code** | `.claude/settings.json` | JSON | SessionStart | ✅ |
|
|
137
|
+
| **Claude Code** | `.claude/settings.json` | JSON | SessionStart + PostToolUse + Stop | ✅ |
|
|
138
138
|
| **Cursor** | `.cursor/mcp.json` | JSON | — | ✅ |
|
|
139
139
|
| **Windsurf** | `~/.codeium/windsurf/mcp_config.json` | JSON | — | ✅ |
|
|
140
140
|
| **Cline** | `.cline/mcp.json` | JSON | — | ✅ |
|
|
141
141
|
| **Continue** | `.continue/config.json` | JSON | — | ✅ |
|
|
142
|
-
| **Codex CLI** | `.codex/config.toml` | TOML | SessionStart | ✅ |
|
|
143
|
-
| **Gemini CLI** | `.gemini/settings.json` | JSON | SessionStart | ✅ |
|
|
142
|
+
| **Codex CLI** | `.codex/config.toml` | TOML | SessionStart + PostToolUse + Stop (`[[hooks]] event=`) | ✅ |
|
|
143
|
+
| **Gemini CLI** | `.gemini/settings.json` | JSON | SessionStart + PostToolUse + Stop (`hooks.*`) | ✅ |
|
|
144
144
|
| **Zed** | `~/.config/zed/settings.json` | JSONC | — | ✅ |
|
|
145
|
-
| **Antigravity** | `.gemini/config/mcp_config.json` |
|
|
145
|
+
| **Antigravity** | `.gemini/config/mcp_config.json` + `.gemini/config/hooks.json` | hooks.json | PreInvocation + PostToolUse + Stop (no SessionStart event) | ✅ |
|
|
146
146
|
| **Aider** | — | — | — | 📝 Instructions |
|
|
147
147
|
| **KiloCode** | `~/.kilocode/mcp_settings.json` | JSON | — | ✅ |
|
|
148
148
|
| **OpenClaw** | `.openclaw.json` | JSON | — | ✅ |
|
|
@@ -633,11 +633,17 @@ Press Ctrl+C to stop
|
|
|
633
633
|
npx toon-memory
|
|
634
634
|
```
|
|
635
635
|
|
|
636
|
-
The installer will:
|
|
637
|
-
1. Show all 15 supported agents with detection status
|
|
638
|
-
2. Let you select which ones to configure (
|
|
639
|
-
3. Ask for
|
|
640
|
-
4.
|
|
636
|
+
The installer (requires a terminal) will:
|
|
637
|
+
1. Show all 15 supported agents with detection status (`✓` config found) and their supported scope (`local/global` or `solo local`)
|
|
638
|
+
2. Let you select which ones to configure — by number (`1,3,5`), by name (`claude,codex`), `all`, Enter for all, or `q` to quit
|
|
639
|
+
3. Ask for the installation scope: **(1) Local** (project: `.toon-memory` + agent configs in the repo) or **(2) Global** (`~home` configs)
|
|
640
|
+
4. Show a confirmation summary (`agent → scope → path (MCP/plugin/hooks/instrucciones)`) and ask `¿Proceder? [Y/n]`
|
|
641
|
+
5. Configure MCP server, instruction files, and hooks automatically
|
|
642
|
+
|
|
643
|
+
> Sin una terminal (CI/pipes) `npx toon-memory` imprime la ayuda de instalación no interactiva. Usa `npx toon-memory init [local|global]` para instalar sin preguntas. Unknown commands print usage and exit with an error.
|
|
644
|
+
|
|
645
|
+
|
|
646
|
+
|
|
641
647
|
|
|
642
648
|
### OpenCode
|
|
643
649
|
|
|
@@ -655,6 +661,8 @@ Add to `.opencode/opencode.json` or `~/.config/opencode/opencode.json`:
|
|
|
655
661
|
}
|
|
656
662
|
```
|
|
657
663
|
|
|
664
|
+
> **Hooks are delivered via a plugin**, not a top-level `hooks` key. OpenCode 1.17+ rejects `"Unrecognized key: hooks"` in its config — `toon-memory init` writes `.opencode/plugins/toon-memory.ts` instead. Do not add `hooks` to `opencode.json`.
|
|
665
|
+
|
|
658
666
|
### Claude Code
|
|
659
667
|
|
|
660
668
|
Add to `.claude/settings.json`:
|
|
@@ -779,6 +787,8 @@ TOON (Token-Oriented Object Notation) is designed for LLMs:
|
|
|
779
787
|
|
|
780
788
|
Measured with `gpt-tokenizer` (cl100k_base) over 16 representative memory entries — see `scripts/benchmark-toon.mjs` (`npm run bench`).
|
|
781
789
|
|
|
790
|
+
The token savings compound at session time: `npm run bench:impact` simulates retrieving context **with vs without** memory and measures ~68% fewer tokens to get the same context (recall `compact` instead of re-reading source files).
|
|
791
|
+
|
|
782
792
|
- **22.5% fewer tokens** than JSON at file level (up to 30.5% on a single entry)
|
|
783
793
|
- **Lossless roundtrip** — No data loss
|
|
784
794
|
- **Better LLM comprehension** — Structured for AI consumption
|
|
@@ -882,7 +892,6 @@ toon-memory/
|
|
|
882
892
|
│ │ ├── sessions.ts # Multi-session coordination
|
|
883
893
|
│ │ ├── graph.ts # Memory graph (parse, build, BM25, centrality, compact render)
|
|
884
894
|
│ │ └── vocab.ts # Project-vocabulary discovery from dependencies
|
|
885
|
-
│ └── memory.ts # Custom tool (OpenCode)
|
|
886
895
|
├── tests/
|
|
887
896
|
│ ├── cli.test.ts # CLI tests
|
|
888
897
|
│ ├── memory.test.ts # Memory tests
|
package/bin/toon-memory.js
CHANGED
|
@@ -1,8 +1,48 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { dirname, join } from "path";
|
|
3
|
+
import { readFileSync } from "fs";
|
|
3
4
|
import { fileURLToPath } from "url";
|
|
4
5
|
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
5
6
|
const args = process.argv.slice(2);
|
|
7
|
+
function getVersion() {
|
|
8
|
+
try {
|
|
9
|
+
const pkg = JSON.parse(readFileSync(join(__dirname, "..", "package.json"), "utf-8"));
|
|
10
|
+
return pkg.version || "unknown";
|
|
11
|
+
} catch {
|
|
12
|
+
return "unknown";
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
const HELP = `toon-memory \u2014 MCP memory server for AI coding agents
|
|
16
|
+
|
|
17
|
+
Usage:
|
|
18
|
+
toon-memory <command> [scope]
|
|
19
|
+
|
|
20
|
+
Commands:
|
|
21
|
+
init [local|global] Install memory tools + hooks for detected agents
|
|
22
|
+
status Show version, memory count, and agent config status
|
|
23
|
+
stats Show memory statistics
|
|
24
|
+
export [file] Export memory to a TOON/JSON file
|
|
25
|
+
import <file> Import memory from a TOON/JSON file
|
|
26
|
+
watch Watch memory file and re-render on change
|
|
27
|
+
uninstall Remove toon-memory from all agents
|
|
28
|
+
capture <on|off> Enable/disable activity capture hooks
|
|
29
|
+
upgrade Upgrade to the latest version
|
|
30
|
+
|
|
31
|
+
Options:
|
|
32
|
+
-v, --version Show version
|
|
33
|
+
-h, --help Show this help
|
|
34
|
+
|
|
35
|
+
MCP mode:
|
|
36
|
+
toon-memory mcp Run as an MCP server (stdio)
|
|
37
|
+
`;
|
|
38
|
+
if (args[0] === "-v" || args[0] === "--version") {
|
|
39
|
+
console.log(getVersion());
|
|
40
|
+
process.exit(0);
|
|
41
|
+
}
|
|
42
|
+
if (args[0] === "-h" || args[0] === "--help") {
|
|
43
|
+
console.log(HELP);
|
|
44
|
+
process.exit(0);
|
|
45
|
+
}
|
|
6
46
|
if (args[0] === "mcp") {
|
|
7
47
|
await import(join(__dirname, "..", "mcp", "server.js"));
|
|
8
48
|
} else {
|