toon-memory 1.6.9 → 1.8.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/README.md CHANGED
@@ -17,10 +17,13 @@
17
17
  - [Quick Start](#quick-start)
18
18
  - [Supported Agents](#supported-agents)
19
19
  - [MCP Tools](#mcp-tools)
20
+ - [Tips & Best Practices](#tips--best-practices)
20
21
  - [CLI Commands](#cli-commands)
21
22
  - [Configuration](#configuration)
22
23
  - [How It Works](#how-it-works)
23
24
  - [Why TOON?](#why-toon)
25
+ - [Troubleshooting](#troubleshooting)
26
+ - [FAQ](#faq)
24
27
  - [Development](#development)
25
28
  - [Contributing](#contributing)
26
29
  - [License](#license)
@@ -29,15 +32,22 @@
29
32
 
30
33
  ## What is toon-memory?
31
34
 
32
- AI agents forget everything between sessions. toon-memory fixes this by providing persistent memory that survives restarts.
35
+ Ever had that feeling where your AI agent forgets everything from yesterday's session? You explain the same architecture decision for the third time, and it still suggests the approach you already rejected?
36
+
37
+ **toon-memory fixes this.** It gives your AI agent a persistent memory that survives restarts, so it actually learns from your project over time.
33
38
 
34
39
  📖 **[Read the documentation](https://luiggival08.github.io/toon-memory/)**
35
40
 
36
- **Use cases:**
37
- - Remember design decisions ("Why did we choose X over Y?")
38
- - Track patterns ("This project uses Zod for validation")
39
- - Store bug resolutions ("Redis pool exhaustion fix")
40
- - Save project knowledge ("Broker uses RESP protocol")
41
+ ### Real-world use cases
42
+
43
+ | Scenario | What toon-memory does |
44
+ |----------|----------------------|
45
+ | Design debates | "We chose Redis over Memcached because of pub/sub support" |
46
+ | Framework choices | "This project uses Zod for validation, not Joi" |
47
+ | Bug fixes | "Redis pool exhaustion — fix was max_connections=20" |
48
+ | Architecture notes | "Broker service uses RESP protocol, not HTTP" |
49
+ | Onboarding | "The deploy script lives in scripts/deploy.sh" |
50
+ | Team context | "PR #142 reverted the caching change — don't re-add it" |
41
51
 
42
52
  ---
43
53
 
@@ -50,13 +60,15 @@ Read [How toon-memory Makes Your AI Agent Smarter](https://luiggival08.github.io
50
60
  ## Features
51
61
 
52
62
  - **8 MCP tools** — Full memory management via Model Context Protocol
53
- - **7 agents supported** — OpenCode, VS Code/Copilot, Claude Code, Cursor, Windsurf, Cline, Continue
63
+ - **15 agents supported** — OpenCode, VS Code, Claude Code, Cursor, Windsurf, Cline, Continue, Codex CLI, Gemini CLI, Zed, Antigravity, Aider, KiloCode, OpenClaw, Kiro
64
+ - **Interactive installer** — Select which agents to configure from a menu
65
+ - **SessionStart hooks** — Auto-reminders for Claude Code, Codex CLI, Gemini CLI, Antigravity
54
66
  - **TOON format** — 40% fewer tokens than JSON, better LLM comprehension
55
67
  - **Per-project memory** — Each project gets its own memory file
56
68
  - **Zero config** — Just install and use
57
- - **Auto gitignore** — Automatically adds `.opencode/memory/` to `.gitignore`
69
+ - **Auto gitignore** — Automatically adds `.toon-memory/memory/` to `.gitignore`
58
70
  - **Date filtering** — Search memory by date range
59
- - **Auto-archive** — Old entries (>30 days) moved to archive automatically
71
+ - **Auto-archive** — Old entries (>30 days) or 100+ entries moved to archive automatically
60
72
  - **Encryption** — AES-256-GCM encryption for sensitive data
61
73
  - **Watch mode** — Auto-backup every N minutes
62
74
 
@@ -77,6 +89,8 @@ irm https://raw.githubusercontent.com/LuiggiVal08/toon-memory/main/install.ps1 |
77
89
  npm i -g toon-memory
78
90
  ```
79
91
 
92
+ > **Tip:** The npm install is the most reliable method. The curl/irm scripts are convenience wrappers.
93
+
80
94
  ### 2. Configure your agent(s)
81
95
 
82
96
  ```bash
@@ -84,29 +98,46 @@ npm i -g toon-memory
84
98
  npx toon-memory
85
99
  ```
86
100
 
101
+ The installer will:
102
+ 1. Detect which AI agents you have installed
103
+ 2. Ask which ones to configure
104
+ 3. Add the MCP server config automatically
105
+
87
106
  ### 3. Use it
88
107
 
108
+ That's it! In your next agent session, try:
109
+
89
110
  ```bash
90
- # In your next session, run:
91
111
  memory_stats # See what's in memory
92
112
  memory_recall # Search memory before reading files
93
113
  memory_remember # Save important decisions
94
114
  ```
95
115
 
116
+ > **Tip:** Always run `memory_recall` at the start of a session. Your agent will have context from previous sessions instantly.
117
+
96
118
  ---
97
119
 
98
120
  ## Supported Agents
99
121
 
100
- | Agent | Config Location | Auto-Setup |
101
- |-------|-----------------|------------|
102
- | **OpenCode** | `.opencode/opencode.json` | ✅ |
103
- | **VS Code / Copilot** | `.vscode/mcp.json` | ✅ |
104
- | **Claude Code** | `.claude/settings.json` | ✅ |
105
- | **Cursor** | `.cursor/mcp.json` | ✅ |
106
- | **Windsurf** | `.windsurfrules` | ✅ |
107
- | **Cline** | `.cline/mcp.json` | ✅ |
108
- | **Continue** | `.continue/config.json` | ✅ |
109
- | **Aider** | `.aider.conf.yml` | ⚠️ Manual |
122
+ | Agent | Config Location | Format | Hooks | Auto-Setup |
123
+ |-------|-----------------|--------|-------|------------|
124
+ | **OpenCode** | `.opencode/opencode.json` | JSON | — | ✅ |
125
+ | **VS Code / Copilot** | `.vscode/mcp.json` | JSON | — | ✅ |
126
+ | **Claude Code** | `.claude/settings.json` | JSON | SessionStart | ✅ |
127
+ | **Cursor** | `.cursor/mcp.json` | JSON | — | ✅ |
128
+ | **Windsurf** | `~/.codeium/windsurf/mcp_config.json` | JSON | — | ✅ |
129
+ | **Cline** | `.cline/mcp.json` | JSON | — | ✅ |
130
+ | **Continue** | `.continue/config.json` | JSON | — | ✅ |
131
+ | **Codex CLI** | `.codex/config.toml` | TOML | SessionStart | ✅ |
132
+ | **Gemini CLI** | `.gemini/settings.json` | JSON | SessionStart | ✅ |
133
+ | **Zed** | `~/.config/zed/settings.json` | JSONC | — | ✅ |
134
+ | **Antigravity** | `.gemini/config/mcp_config.json` | JSON | SessionStart | ✅ |
135
+ | **Aider** | — | — | — | 📝 Instructions |
136
+ | **KiloCode** | `~/.kilocode/mcp_settings.json` | JSON | — | ✅ |
137
+ | **OpenClaw** | `.openclaw.json` | JSON | — | ✅ |
138
+ | **Kiro** | `.kiro/settings/mcp.json` | JSON | — | ✅ |
139
+
140
+ > **Tip:** You can configure toon-memory for multiple agents at the same time. Each agent gets the same shared memory file at `.toon-memory/memory/`.
110
141
 
111
142
  ---
112
143
 
@@ -131,13 +162,15 @@ memory_remember # Save important decisions
131
162
  memory_remember({
132
163
  category: "decision",
133
164
  key: "use-zod",
134
- content: "Use Zod for validation",
165
+ content: "Use Zod for validation — simpler than Joi, better TS support",
135
166
  file: "src/types.ts",
136
167
  tags: "validation;types"
137
168
  })
138
169
  // 🧠 Guardado: decision/use-zod (a1b2c3d4)
139
170
  ```
140
171
 
172
+ > **Tip:** Use descriptive keys like `use-zod` instead of vague ones like `validation`. Your agent searches by key and content, so specificity helps.
173
+
141
174
  #### Search memory
142
175
 
143
176
  ```typescript
@@ -147,6 +180,8 @@ memory_recall({ query: "redis" })
147
180
  // File: redis.ts | Tags: redis;fix | Date: 2026-07-10
148
181
  ```
149
182
 
183
+ > **Tip:** Search before you read files. This saves tokens and gives your agent context it wouldn't get from code alone.
184
+
150
185
  #### Search with date filter
151
186
 
152
187
  ```typescript
@@ -157,6 +192,8 @@ memory_recall({
157
192
  })
158
193
  ```
159
194
 
195
+ > **Tip:** Use date filters when you remember roughly *when* something happened but not exactly *what*.
196
+
160
197
  #### Archive old entries
161
198
 
162
199
  ```typescript
@@ -165,6 +202,8 @@ memory_archive()
165
202
  // 📋 Quedan 42 entradas activas
166
203
  ```
167
204
 
205
+ > **Tip:** Run this periodically to keep memory lean. Archived entries are still searchable via `memory_recall` with date filters.
206
+
168
207
  #### Enable encryption
169
208
 
170
209
  ```typescript
@@ -174,6 +213,68 @@ memory_encrypt()
174
213
  // a1b2c3d4...
175
214
  ```
176
215
 
216
+ > **Warning:** Save the encryption key somewhere safe. If you lose it, your memory data is gone forever.
217
+
218
+ ---
219
+
220
+ ## Tips & Best Practices
221
+
222
+ Here are some patterns that work well with toon-memory:
223
+
224
+ ### The "start of session" habit
225
+
226
+ At the beginning of every new session, run:
227
+ ```
228
+ memory_recall({ query: "project context" })
229
+ ```
230
+ This gives your agent instant context about what happened before.
231
+
232
+ ### The "end of session" habit
233
+
234
+ Before closing a session, save anything important:
235
+ ```
236
+ memory_remember({
237
+ category: "decision",
238
+ key: "auth-approach",
239
+ content: "Chose JWT over sessions — stateless, works across microservices",
240
+ file: "src/auth.ts",
241
+ tags: "auth;architecture"
242
+ })
243
+ ```
244
+
245
+ ### Choosing categories
246
+
247
+ | Category | When to use |
248
+ |----------|-------------|
249
+ | `decision` | Architecture choices, trade-offs, "why X over Y" |
250
+ | `pattern` | Conventions, frameworks, code style rules |
251
+ | `bug` | Issues you fixed and how |
252
+ | `knowledge` | Project facts, domain info, team context |
253
+
254
+ > **Tip:** Don't overthink it. If it's something your future self (or agent) would want to know, save it.
255
+
256
+ ### Tags that work well
257
+
258
+ Use semicolon-separated tags for easy filtering:
259
+ ```
260
+ tags: "redis;performance;fix"
261
+ tags: "auth;jwt;security"
262
+ tags: "api;rest;versioning"
263
+ ```
264
+
265
+ > **Tip:** Keep tags short and consistent. They're not hashtags — they're search filters.
266
+
267
+ ### What NOT to save
268
+
269
+ - Don't save things that are obvious from reading the code
270
+ - Don't save temporary debugging notes
271
+ - Don't save secrets, API keys, or credentials (use env vars instead)
272
+ - Don't duplicate the same information with different keys
273
+
274
+ ### Keep memory clean
275
+
276
+ Run `memory_archive()` monthly to move old entries to the archive. Run `memory_stats()` to check the size.
277
+
177
278
  ---
178
279
 
179
280
  ## CLI Commands
@@ -211,6 +312,8 @@ Last updated: 2026-07-10
211
312
  File size: 12.4 KB
212
313
  ```
213
314
 
315
+ > **Tip:** If memory gets too large (100+ entries), consider archiving or removing outdated entries with `memory_forget`.
316
+
214
317
  #### Export
215
318
 
216
319
  ```bash
@@ -222,6 +325,8 @@ Exported 45 entries to:
222
325
  /path/to/project/toon-memory-export.json
223
326
  ```
224
327
 
328
+ > **Tip:** Export before major refactors. You can always import the backup later if something goes wrong.
329
+
225
330
  #### Import
226
331
 
227
332
  ```bash
@@ -233,6 +338,8 @@ Imported 3 new entries
233
338
  Skipped 2 duplicates
234
339
  ```
235
340
 
341
+ > **Tip:** Duplicates are detected by key. If you want to re-import an entry, delete the old one first with `memory_forget`.
342
+
236
343
  #### Watch
237
344
 
238
345
  ```bash
@@ -252,6 +359,8 @@ Press Ctrl+C to stop
252
359
  ✅ Watch stopped. 2 backups created.
253
360
  ```
254
361
 
362
+ > **Tip:** Watch mode is great for long-running sessions. Use `-c` to compress and `-m 5` to keep only 5 backups.
363
+
255
364
  **Watch Options:**
256
365
 
257
366
  | Option | Description | Default |
@@ -265,9 +374,21 @@ Press Ctrl+C to stop
265
374
 
266
375
  ## Configuration
267
376
 
268
- ### Global (all projects)
377
+ ### Interactive installer (recommended)
269
378
 
270
- Add to `~/.config/opencode/opencode.json`:
379
+ ```bash
380
+ npx toon-memory
381
+ ```
382
+
383
+ The installer will:
384
+ 1. Show all 15 supported agents with detection status
385
+ 2. Let you select which ones to configure (comma-separated, `all`, or Enter)
386
+ 3. Ask for local or global installation scope
387
+ 4. Configure MCP server, instruction files, and hooks automatically
388
+
389
+ ### OpenCode
390
+
391
+ Add to `.opencode/opencode.json` or `~/.config/opencode/opencode.json`:
271
392
 
272
393
  ```json
273
394
  {
@@ -281,23 +402,22 @@ Add to `~/.config/opencode/opencode.json`:
281
402
  }
282
403
  ```
283
404
 
284
- ### Project-level
405
+ ### Claude Code
285
406
 
286
- Add to `.opencode/opencode.json`:
407
+ Add to `.claude/settings.json`:
287
408
 
288
409
  ```json
289
410
  {
290
- "mcp": {
411
+ "mcpServers": {
291
412
  "toon-memory": {
292
- "type": "local",
293
- "command": ["npx", "-y", "toon-memory", "mcp"],
294
- "enabled": true
413
+ "command": "npx",
414
+ "args": ["-y", "toon-memory", "mcp"]
295
415
  }
296
416
  }
297
417
  }
298
418
  ```
299
419
 
300
- ### VS Code
420
+ ### VS Code / Copilot
301
421
 
302
422
  Add to `.vscode/mcp.json`:
303
423
 
@@ -312,13 +432,55 @@ Add to `.vscode/mcp.json`:
312
432
  }
313
433
  ```
314
434
 
435
+ ### Codex CLI
436
+
437
+ Add to `.codex/config.toml`:
438
+
439
+ ```toml
440
+ [mcpServers.toon-memory]
441
+ command = "npx"
442
+ args = ["-y", "toon-memory", "mcp"]
443
+ ```
444
+
445
+ ### Gemini CLI
446
+
447
+ Add to `.gemini/settings.json`:
448
+
449
+ ```json
450
+ {
451
+ "mcpServers": {
452
+ "toon-memory": {
453
+ "command": "npx",
454
+ "args": ["-y", "toon-memory", "mcp"]
455
+ }
456
+ }
457
+ }
458
+ ```
459
+
460
+ ### Zed
461
+
462
+ Add to `~/.config/zed/settings.json`:
463
+
464
+ ```json
465
+ {
466
+ "mcp_servers": {
467
+ "toon-memory": {
468
+ "command": "npx",
469
+ "args": ["-y", "toon-memory", "mcp"]
470
+ }
471
+ }
472
+ }
473
+ ```
474
+
475
+ > **Tip:** Use global config if you want memory for every project. Use project-level config if you only want it for specific projects.
476
+
315
477
  ---
316
478
 
317
479
  ## How It Works
318
480
 
319
481
  1. **MCP Server** — Runs locally, talks to your agent via stdio
320
482
  2. **TOON Format** — Stores data in Token-Oriented Object Notation (~40% fewer tokens than JSON)
321
- 3. **Per-project memory** — Each project gets `.opencode/memory/data.toon`
483
+ 3. **Per-project memory** — Each project gets `.toon-memory/memory/data.toon`
322
484
  4. **Zero config** — Just install and use
323
485
 
324
486
  ### Memory File Format
@@ -336,7 +498,7 @@ summaries:
336
498
  ### File Structure
337
499
 
338
500
  ```
339
- .opencode/
501
+ .toon-memory/
340
502
  ├── memory/
341
503
  │ ├── data.toon # Main memory file
342
504
  │ ├── archive.toon # Archived entries (>30 days)
@@ -344,7 +506,11 @@ summaries:
344
506
  │ └── backups/ # Watch mode backups
345
507
  │ ├── backup-2026-07-11T16-00-00-000Z.toon
346
508
  │ └── backup-2026-07-11T16-10-00-000Z.toon
347
- └── opencode.json # MCP server config
509
+ └── hooks/
510
+ ├── session-start-claude.sh
511
+ ├── session-start-codex.sh
512
+ ├── session-start-gemini.sh
513
+ └── session-start-antigravity.sh
348
514
  ```
349
515
 
350
516
  ---
@@ -363,6 +529,76 @@ TOON (Token-Oriented Object Notation) is designed for LLMs:
363
529
  - **Lossless roundtrip** — No data loss
364
530
  - **Better LLM comprehension** — Structured for AI consumption
365
531
 
532
+ > **Tip:** Fewer tokens = faster responses + lower API costs. Your agent reads memory files on every session start, so efficiency matters.
533
+
534
+ ---
535
+
536
+ ## Troubleshooting
537
+
538
+ ### Memory not found after install
539
+
540
+ **Symptom:** Agent says it doesn't have memory tools.
541
+
542
+ **Fix:**
543
+ 1. Run `npx toon-memory status` to verify installation
544
+ 2. Restart your agent completely (close and reopen)
545
+ 3. Check that the MCP config file exists and is valid JSON
546
+
547
+ ### Memory file is empty
548
+
549
+ **Symptom:** `memory_stats` shows 0 entries.
550
+
551
+ **Fix:** This is normal on first install. Start using `memory_remember` to save entries.
552
+
553
+ ### Duplicate entries
554
+
555
+ **Symptom:** Same key appears multiple times.
556
+
557
+ **Fix:** Use `memory_forget` to remove duplicates. Import skips duplicates by key, but `memory_remember` with the same key creates a new entry with a different ID.
558
+
559
+ ### Encryption key lost
560
+
561
+ **Symptom:** Can't decrypt memory.
562
+
563
+ **Fix:** Unfortunately, there's no recovery. The encryption key is not stored anywhere after generation. This is by design for security. You'll need to start fresh or restore from a non-encrypted backup.
564
+
565
+ ### Memory too large
566
+
567
+ **Symptom:** Agent responses are slow.
568
+
569
+ **Fix:**
570
+ 1. Run `memory_archive()` to move old entries to archive
571
+ 2. Use `memory_forget` to remove irrelevant entries
572
+ 3. Keep entries concise — save the decision, not the entire conversation
573
+
574
+ ---
575
+
576
+ ## FAQ
577
+
578
+ ### Does this work with any AI agent?
579
+
580
+ Yes, as long as it supports MCP (Model Context Protocol). We have auto-setup for 15 agents, with manual configuration available for others.
581
+
582
+ ### Is my data sent anywhere?
583
+
584
+ No. Everything stays on your machine. The MCP server runs locally over stdio — no network calls, no telemetry, no cloud.
585
+
586
+ ### Can I use this across multiple machines?
587
+
588
+ Yes, if you sync the `.toon-memory/memory/` directory (e.g., via Git or a shared folder). Each machine needs toon-memory installed, but the memory file is portable.
589
+
590
+ ### What happens if I have multiple projects?
591
+
592
+ Each project gets its own memory file. Memory doesn't leak between projects.
593
+
594
+ ### Can I encrypt specific entries only?
595
+
596
+ No, encryption applies to the entire memory file. If you need selective encryption, keep sensitive data in a separate tool.
597
+
598
+ ### How is this different from just using a markdown file?
599
+
600
+ Markdown files aren't structured, aren't searchable by your agent in the same way, don't integrate via MCP, and don't have features like archiving, date filtering, or encryption. toon-memory is purpose-built for AI agents.
601
+
366
602
  ---
367
603
 
368
604
  ## Development
@@ -403,7 +639,7 @@ toon-memory/
403
639
 
404
640
  ## Contributing
405
641
 
406
- Contributions are welcome! Please read our [Code of Conduct](CODE_OF_CONDUCT.md) first.
642
+ Contributions are welcome! Please read our [Code of Conduct](CODE_OF_CONDUCT.md) and [Contributing Guide](CONTRIBUTING.md) first.
407
643
 
408
644
  1. Fork the repository
409
645
  2. Create your feature branch (`git checkout -b feature/amazing-feature`)