kimiflare 0.22.0 → 0.24.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
@@ -68,6 +68,7 @@ Requires Node.js ≥ 20.
68
68
  | **Project context (`/init`)** | Scans your repo and writes a concise `KIMI.md` — build commands, layout, conventions. Auto-loaded on every launch. |
69
69
  | **MCP server integration** | Plug in external tools via the Model Context Protocol — local stdio servers or remote SSE endpoints. GitHub, Sentry, docs search, databases, etc. |
70
70
  | **Co-author auto-append** | Detects `git commit` commands and auto-injects `Co-authored-by: kimiflare <kimiflare@proton.me>`. |
71
+ | **Local structured memory** | SQLite + embeddings cross-session memory. Extracts facts, instructions, and preferences at compaction time; recalls them via hybrid search (FTS5 + vector + exact) in future sessions. Team-shareable via `.kimiflare/memory.db`. |
71
72
  | **Resilient transport** | Retries Cloudflare capacity errors (code 3040) and 5xx with exponential backoff up to 5 attempts. |
72
73
 
73
74
  ## Configure
@@ -84,6 +85,11 @@ export CLOUDFLARE_ACCOUNT_ID=...
84
85
  export CLOUDFLARE_API_TOKEN=...
85
86
  # Optional: route through a Cloudflare AI Gateway you own
86
87
  export KIMIFLARE_AI_GATEWAY_ID=...
88
+ # Optional: enable local structured memory
89
+ export KIMIFLARE_MEMORY_ENABLED=1
90
+ export KIMIFLARE_MEMORY_DB_PATH=.kimiflare/memory.db
91
+ export KIMIFLARE_MEMORY_MAX_AGE_DAYS=90
92
+ export KIMIFLARE_MEMORY_MAX_ENTRIES=1000
87
93
  ```
88
94
 
89
95
  or save them once (`chmod 600` automatically):
@@ -164,6 +170,43 @@ MCP tools appear prefixed as `mcp_<server>_<tool>` alongside built-in tools.
164
170
  - `/mcp list` — show connected servers and tool counts
165
171
  - `/mcp reload` — disconnect and reconnect all configured servers
166
172
 
173
+ ## Local structured memory
174
+
175
+ kimiflare can remember facts, instructions, and preferences across sessions using a local SQLite database with vector search.
176
+
177
+ **How it works:**
178
+ - At compaction time, the agent extracts structured memories from the conversation
179
+ - Memories are stored with embeddings (`@cf/baai/bge-base-en-v1.5`) in a local SQLite database
180
+ - On future sessions, relevant memories are recalled via hybrid search (FTS5 full-text + vector similarity + exact file-path matching)
181
+ - Supports team-shared memory: `.kimiflare/memory.db` in your repo root (add to `.gitignore`)
182
+
183
+ **Enable:**
184
+ ```sh
185
+ export KIMIFLARE_MEMORY_ENABLED=1
186
+ ```
187
+
188
+ Or in `~/.config/kimiflare/config.json`:
189
+ ```json
190
+ {
191
+ "memoryEnabled": true,
192
+ "memoryDbPath": ".kimiflare/memory.db",
193
+ "memoryMaxAgeDays": 90,
194
+ "memoryMaxEntries": 1000,
195
+ "memoryEmbeddingModel": "@cf/baai/bge-base-en-v1.5"
196
+ }
197
+ ```
198
+
199
+ **Commands:**
200
+ - `/memory` — show memory stats (total count, DB size, by category)
201
+ - `/memory search <query>` — manual hybrid search over stored memories
202
+ - `/memory clear` — wipe all memories for the current repo
203
+
204
+ **Storage & cleanup:**
205
+ - Default retention: 90 days, 1000 memories per repo
206
+ - Automatic deduplication of near-identical memories
207
+ - Cleanup runs on startup and after every compaction
208
+ - Typical size: ~4–5 KB per memory; ~15 MB/month under heavy use
209
+
167
210
  ## Usage
168
211
 
169
212
  ### Interactive TUI
@@ -215,8 +258,11 @@ Supported formats: PNG, JPG, JPEG, WebP, GIF, BMP (up to 5 MB each, 10 per messa
215
258
  | `/theme` | Interactive theme picker with live preview (`Ctrl+T`). Saved to config. |
216
259
  | `/theme NAME` | Set theme by name directly. |
217
260
  | `/resume` | Pick a past conversation to restore. |
218
- | `/compact` | Summarize older turns to free context. Suggested automatically at ~80% full. |
261
+ | `/compact` | Summarize older turns to free context. Suggested automatically at ~80% full. Extracts memories if memory is enabled. |
219
262
  | `/init` | Scan the repo and write a `KIMI.md` so future agents have project context. |
263
+ | `/memory` | Show memory stats (total count, DB size, by category). |
264
+ | `/memory search <query>` | Search stored memories manually. |
265
+ | `/memory clear` | Wipe all memories for the current repo. |
220
266
  | `/mcp list` | List connected MCP servers and their tools. |
221
267
  | `/mcp reload` | Disconnect and reconnect all configured MCP servers. |
222
268
  | `/reasoning` | Toggle chain-of-thought display. |
@@ -416,6 +462,10 @@ For a real-world test, try the [official GitHub MCP server](https://github.com/m
416
462
 
417
463
  Then ask: `search for issues labeled bug in sinameraji/kimiflare`
418
464
 
465
+ ## Credits
466
+
467
+ - **Cloudflare Agent Memory** — This feature was inspired by [Cloudflare's Agent Memory](https://blog.cloudflare.com/introducing-agent-memory/) announcement. While Cloudflare's managed service requires a platform binding, kimiflare implements a local self-hosted equivalent using SQLite + Workers AI embeddings so you can use it today with your own account.
468
+
419
469
  ## License
420
470
 
421
471
  [MIT](LICENSE) © Sina Meraji