toon-memory 1.2.0 → 1.3.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
@@ -27,6 +27,8 @@ AI agents forget everything between sessions. toon-memory fixes this by providin
27
27
  - **TOON format** — 40% fewer tokens than JSON, better LLM comprehension
28
28
  - **Per-project memory** — each project gets its own memory file
29
29
  - **Zero config** — just install and use
30
+ - **Auto gitignore** — automatically adds `.opencode/memory/` to `.gitignore`
31
+ - **Date filtering** — search memory by date range
30
32
 
31
33
  ---
32
34
 
@@ -88,6 +90,19 @@ memory_remember # Save important decisions
88
90
  | `memory_stats` | View memory state |
89
91
  | `memory_summary` | Save/retrieve file summaries |
90
92
 
93
+ ### Date Filtering
94
+
95
+ Search memory by date range:
96
+
97
+ ```typescript
98
+ // Search with date filter
99
+ memory_recall({
100
+ query: "redis",
101
+ from_date: "2026-07-01",
102
+ to_date: "2026-07-31"
103
+ })
104
+ ```
105
+
91
106
  ---
92
107
 
93
108
  ## How It Works
@@ -114,12 +129,55 @@ summaries:
114
129
  ## CLI Commands
115
130
 
116
131
  ```bash
117
- npx toon-memory # Interactive installer
118
- npx toon-memory init # Quick setup (no prompts)
119
- npx toon-memory mcp # Run MCP server directly
120
- npx toon-memory status # Check installation status
121
- npx toon-memory upgrade # Update to latest version
122
- npx toon-memory uninstall # Remove from all agents
132
+ npx toon-memory # Interactive installer
133
+ npx toon-memory init # Quick setup (no prompts)
134
+ npx toon-memory mcp # Run MCP server directly
135
+ npx toon-memory status # Check installation status
136
+ npx toon-memory stats # View memory statistics
137
+ npx toon-memory export # Export memory to JSON
138
+ npx toon-memory import <file> # Import memory from JSON
139
+ npx toon-memory upgrade # Update to latest version
140
+ npx toon-memory uninstall # Remove from all agents
141
+ ```
142
+
143
+ ### Stats
144
+
145
+ ```bash
146
+ $ npx toon-memory stats
147
+
148
+ 🧠 toon-memory stats
149
+
150
+ 📊 Memory Stats
151
+ ━━━━━━━━━━━━━━━━━━
152
+ Total entries: 45
153
+ ├── decision: 12
154
+ ├── pattern: 18
155
+ ├── bug: 8
156
+ └── knowledge: 7
157
+ Last updated: 2026-07-10
158
+ File size: 12.4 KB
159
+ ```
160
+
161
+ ### Export
162
+
163
+ ```bash
164
+ $ npx toon-memory export
165
+
166
+ 🧠 toon-memory export
167
+
168
+ Exported 45 entries to:
169
+ /path/to/project/toon-memory-export.json
170
+ ```
171
+
172
+ ### Import
173
+
174
+ ```bash
175
+ $ npx toon-memory import backup.json
176
+
177
+ 🧠 toon-memory import
178
+
179
+ Imported 3 new entries
180
+ Skipped 2 duplicates
123
181
  ```
124
182
 
125
183
  ---
package/dist/cli/setup.js CHANGED
@@ -77,6 +77,23 @@ function installOpenCodeTools() {
77
77
  console.log(" Created .opencode/memory/data.toon");
78
78
  }
79
79
  }
80
+ function ensureGitignore() {
81
+ const gitignorePath = join(projectRoot, ".gitignore");
82
+ const entry = ".opencode/memory/";
83
+ if (!existsSync(gitignorePath)) {
84
+ writeFileSync(gitignorePath, `${entry}
85
+ `);
86
+ console.log(" Created .gitignore with memory exclusion");
87
+ return;
88
+ }
89
+ const content = readFileSync(gitignorePath, "utf-8");
90
+ if (!content.includes(entry)) {
91
+ writeFileSync(gitignorePath, `${content.trim()}
92
+ ${entry}
93
+ `);
94
+ console.log(" Added .opencode/memory/ to .gitignore");
95
+ }
96
+ }
80
97
  function installMCPConfig(agent, scope) {
81
98
  const configPath = scope === "global" ? agent.global : agent.local;
82
99
  if (!configPath) {
@@ -139,6 +156,7 @@ function init(scope = "local") {
139
156
  installMCPConfig(agent, scope);
140
157
  console.log("");
141
158
  }
159
+ ensureGitignore();
142
160
  console.log("Done! Restart your agent to use memory tools.\n");
143
161
  }
144
162
  function status() {
@@ -365,6 +383,7 @@ Installing ${scope}ly...
365
383
  installMCPConfig(agent, scope);
366
384
  console.log("");
367
385
  }
386
+ ensureGitignore();
368
387
  console.log("Done! Restart your agent to use memory tools.");
369
388
  console.log("Run 'npx toon-memory uninstall' to remove.\n");
370
389
  rl.close();
package/mcp/server.js CHANGED
@@ -27709,10 +27709,12 @@ server.registerTool(
27709
27709
  description: "Busca en la memoria persistente del proyecto. Devuelve entradas relevantes. Usar ANTES de leer archivos.",
27710
27710
  inputSchema: {
27711
27711
  query: external_exports.string().describe("Texto a buscar"),
27712
- category: external_exports.string().optional().default("").describe("Filtrar por categor\xEDa (vac\xEDo = todos)")
27712
+ category: external_exports.string().optional().default("").describe("Filtrar por categor\xEDa (vac\xEDo = todos)"),
27713
+ from_date: external_exports.string().optional().default("").describe("Fecha inicio filtro (YYYY-MM-DD)"),
27714
+ to_date: external_exports.string().optional().default("").describe("Fecha fin filtro (YYYY-MM-DD)")
27713
27715
  }
27714
27716
  },
27715
- async ({ query, category }) => {
27717
+ async ({ query, category, from_date, to_date }) => {
27716
27718
  const data = readMemory();
27717
27719
  const lines = data.split("\n").filter((l) => l.startsWith(" ") && l.includes("|"));
27718
27720
  const queryLower = query.toLowerCase();
@@ -27722,6 +27724,8 @@ server.registerTool(
27722
27724
  if (parts.length < 7) return null;
27723
27725
  const [id, cat, key, content, file2, tags, date5] = parts;
27724
27726
  if (category && cat !== category) return null;
27727
+ if (from_date && date5 < from_date) return null;
27728
+ if (to_date && date5 > to_date) return null;
27725
27729
  const searchStr = `${id} ${cat} ${key} ${content} ${file2} ${tags}`.toLowerCase();
27726
27730
  if (!searchStr.includes(queryLower)) return null;
27727
27731
  return { id, cat, key, content, file: file2, tags, date: date5 };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "toon-memory",
3
- "version": "1.2.0",
3
+ "version": "1.3.0",
4
4
  "description": "Persistent memory system for AI coding agents using TOON format (40% fewer tokens than JSON)",
5
5
  "type": "module",
6
6
  "bin": {
package/src/cli/setup.ts CHANGED
@@ -112,6 +112,24 @@ function installOpenCodeTools(): void {
112
112
  }
113
113
  }
114
114
 
115
+ // Add .opencode/memory/ to .gitignore if not present
116
+ function ensureGitignore(): void {
117
+ const gitignorePath = join(projectRoot, ".gitignore")
118
+ const entry = ".opencode/memory/"
119
+
120
+ if (!existsSync(gitignorePath)) {
121
+ writeFileSync(gitignorePath, `${entry}\n`)
122
+ console.log(" Created .gitignore with memory exclusion")
123
+ return
124
+ }
125
+
126
+ const content = readFileSync(gitignorePath, "utf-8")
127
+ if (!content.includes(entry)) {
128
+ writeFileSync(gitignorePath, `${content.trim()}\n${entry}\n`)
129
+ console.log(" Added .opencode/memory/ to .gitignore")
130
+ }
131
+ }
132
+
115
133
  // Install MCP server config for different agents
116
134
  function installMCPConfig(agent: Agent, scope: string): void {
117
135
  const configPath = scope === "global" ? agent.global : agent.local
@@ -197,6 +215,8 @@ function init(scope: string = "local"): void {
197
215
  console.log("")
198
216
  }
199
217
 
218
+ ensureGitignore()
219
+
200
220
  console.log("Done! Restart your agent to use memory tools.\n")
201
221
  }
202
222
 
@@ -487,6 +507,8 @@ rl.question("Install (1) Local or (2) Global? [1/2]: ", (answer: string) => {
487
507
  console.log("")
488
508
  }
489
509
 
510
+ ensureGitignore()
511
+
490
512
  console.log("Done! Restart your agent to use memory tools.")
491
513
  console.log("Run 'npx toon-memory uninstall' to remove.\n")
492
514
  rl.close()
package/src/mcp/server.ts CHANGED
@@ -83,9 +83,11 @@ server.registerTool(
83
83
  inputSchema: {
84
84
  query: z.string().describe("Texto a buscar"),
85
85
  category: z.string().optional().default("").describe("Filtrar por categoría (vacío = todos)"),
86
+ from_date: z.string().optional().default("").describe("Fecha inicio filtro (YYYY-MM-DD)"),
87
+ to_date: z.string().optional().default("").describe("Fecha fin filtro (YYYY-MM-DD)"),
86
88
  },
87
89
  },
88
- async ({ query, category }) => {
90
+ async ({ query, category, from_date, to_date }) => {
89
91
  const data = readMemory()
90
92
  const lines = data.split("\n").filter((l) => l.startsWith(" ") && l.includes("|"))
91
93
  const queryLower = query.toLowerCase()
@@ -97,6 +99,8 @@ server.registerTool(
97
99
  if (parts.length < 7) return null
98
100
  const [id, cat, key, content, file, tags, date] = parts
99
101
  if (category && cat !== category) return null
102
+ if (from_date && date < from_date) return null
103
+ if (to_date && date > to_date) return null
100
104
  const searchStr = `${id} ${cat} ${key} ${content} ${file} ${tags}`.toLowerCase()
101
105
  if (!searchStr.includes(queryLower)) return null
102
106
  return { id, cat, key, content, file, tags, date }