The full upstream README, mirrored here for reference. Install config, tool schemas, adoption signals, and an original overview live on the Agentkits Memory listing page.
by AityTech
Persistent Memory System for AI Coding Assistants
Your AI assistant forgets everything between sessions. AgentKits Memory fixes that.
Decisions, patterns, errors, and context — all persisted locally via MCP.
Website • Docs • Quick Start • How It Works • Platforms • CLI • Web Viewer
English · 简体中文 · 日本語 · 한국어 · Español · Deutsch · Français · Português · Tiếng Việt · Русский · العربية
| Feature | Benefit |
|---|---|
| 100% Local | All data stays on your machine. No cloud, no API keys, no accounts |
| Blazing Fast | Native SQLite (better-sqlite3) = instant queries, zero latency |
| Zero Config | Works out of the box. No database setup required |
| Multi-Platform | Claude Code, Cursor, Windsurf, Cline, OpenCode — one setup command |
| MCP Server | 9 tools: save, search, timeline, details, recall, list, update, delete, status |
| Auto-Capture | Hooks capture session context, tool usage, summaries automatically |
| AI Enrichment | Background workers enrich observations with AI-generated summaries |
| Vector Search | sqlite-vec semantic similarity with multilingual embeddings (100+ languages) |
| Web Viewer | Browser UI to view, search, add, edit, delete memories |
| 3-Layer Search | Progressive disclosure saves ~87% tokens vs fetching everything |
| Lifecycle Mgmt | Auto-compress, archive, and clean up old sessions |
| Export/Import | Backup and restore memories as JSON |
npx @aitytech/agentkits-memory configures your platformmemory_search → memory_details) to find past contextAll data stays in .claude/memory/memory.db on your machine. No cloud. No API keys required.
Most memory tools scatter data across markdown files, require Python runtimes, or send your code to external APIs. AgentKits Memory makes fundamentally different choices:
| Design Choice | Why It Matters |
|---|---|
| Single SQLite database | One file (memory.db) holds everything — memories, sessions, observations, embeddings. No scattered files to sync, no merge conflicts, no orphaned data. Backup = copy one file |
| Native Node.js, zero Python | Runs wherever Node runs. No conda, no pip, no virtualenv. Same language as your MCP server — one npx command, done |
| Token-efficient 3-layer search | Search index first (~50 tokens/result), then timeline context, then full details. Only fetch what you need. Other tools dump entire memory files into context, burning tokens on irrelevant content |
| Auto-capture via hooks | Decisions, patterns, and errors are recorded as they happen — not after you remember to save them. Session context injection happens automatically on next session start |
| Local embeddings, no API calls | Vector search uses a local ONNX model (multilingual-e5-small). Semantic search works offline, costs nothing, and supports 100+ languages |
| Background workers | AI enrichment, embedding generation, and compression run asynchronously. Your coding flow is never blocked |
| Multi-platform from day one | One --platform=all flag configures Claude Code, Cursor, Windsurf, Cline, and OpenCode simultaneously. Same memory database, different editors |
| Structured observation data | Tool usage is captured with type classification (read/write/execute/search), file tracking, intent detection, and AI-generated narratives — not raw text dumps |
| No process leaks | Background workers self-terminate after 5 minutes, use PID-based lock files with stale-lock cleanup, and handle SIGTERM/SIGINT gracefully. No zombie processes, no orphaned workers |
| No memory leaks | Hooks run as short-lived processes (not long-running daemons). Database connections close on shutdown. Embedding subprocess has bounded respawn (max 2), pending request timeouts, and graceful cleanup of all timers and queues |
View and manage your memories through a modern web interface.
Then open http://localhost:1905 in your browser.
Browse all sessions with timeline view and activity details.

Browse all stored memories with search and namespace filtering.

Create new memories with key, namespace, type, content, and tags.

View full memory details with edit and delete options.

Generate and manage vector embeddings for semantic search.

Install as a plugin with one command — no manual configuration needed:
This installs hooks, MCP server, and memory workflow skill automatically. Restart Claude Code after installation.
This auto-detects your platform and configures everything: MCP server, hooks (Claude Code/OpenCode), rules files (Cursor/Windsurf/Cline), and downloads the embedding model.
Target a specific platform:
If you prefer manual setup, add to your MCP config:
Config file locations:
.claude/settings.json (embedded in mcpServers key).cursor/mcp.json.windsurf/mcp.json.mcp.json (project root)Once configured, your AI assistant can use these tools:
| Tool | Description |
|---|---|
memory_status | Check memory system status (call first!) |
memory_save | Save decisions, patterns, errors, or context |
memory_search | [Step 1] Search index — lightweight IDs + titles (~50 tokens/result) |
memory_timeline | [Step 2] Get temporal context around a memory |
memory_details | [Step 3] Get full content for specific IDs |
memory_recall | Quick topic overview — grouped summary |
memory_list | List recent memories |
memory_update | Update existing memory content or tags |
memory_delete | Remove outdated memories |
AgentKits Memory uses a 3-layer search pattern that saves ~70% tokens compared to fetching full content upfront.
| Approach | Tokens Used |
|---|---|
| Old: Fetch all content | ~500 tokens × 10 results = 5000 tokens |
| New: Progressive disclosure | 50 × 10 + 500 × 2 = 1500 tokens |
| Savings | 70% reduction |
Hooks automatically capture your AI coding sessions (Claude Code and OpenCode only):
| Hook | Trigger | Action |
|---|---|---|
context | Session Start | Injects previous session context + memory status |
session-init | User Prompt | Initializes/resumes session, records prompts |
observation | After Tool Use | Captures tool usage with intent detection |
summarize | Session End | Generates structured session summary |
user-message | Session Start | Displays memory status to user (stderr) |
Setup hooks:
What gets captured automatically:
| Platform | MCP | Hooks | Rules File | Setup |
|---|---|---|---|---|
| Claude Code | .claude/settings.json | ✅ Full | CLAUDE.md (skill) | --platform=claude-code |
| Cursor | .cursor/mcp.json | — | .cursorrules | --platform=cursor |
| Windsurf | .windsurf/mcp.json | — | .windsurfrules | --platform=windsurf |
| Cline | .mcp.json | — | .clinerules | --platform=cline |
| OpenCode | .mcp.json | ✅ Full | — | --platform=opencode |
.claude/memory/ (single source of truth)After each session, background workers process queued tasks:
| Worker | Task | Description |
|---|---|---|
embed-session | Embeddings | Generate vector embeddings for semantic search |
enrich-session | AI Enrichment | Enrich observations with AI-generated summaries, facts, concepts |
compress-session | Compression | Compress old observations (10:1–25:1) and generate session digests (20:1–100:1) |
Workers run automatically after session end. Each worker:
AI enrichment uses pluggable providers. Default is claude-cli (no API key needed).
| Provider | Type | Default Model | Notes |
|---|---|---|---|
| Claude CLI | claude-cli | haiku | Uses claude --print, no API key needed |
| OpenAI | openai | gpt-4o-mini | Any OpenAI model |
| Google Gemini | gemini | gemini-2.0-flash | Google AI Studio key |
| OpenRouter | openai | any | Set baseUrl to https://openrouter.ai/api/v1 |
| GLM (Zhipu) | openai | any | Set baseUrl to https://open.bigmodel.cn/api/paas/v4 |
| Ollama | openai | any | Set baseUrl to http://localhost:11434/v1 |
Priority: Environment variables override settings.json. Settings.json overrides defaults.
Manage memory growth over time:
| Stage | What Happens |
|---|---|
| Compress | AI-compresses observations, generates session digests |
| Archive | Marks old sessions as archived (excluded from context) |
| Delete | Removes archived sessions (opt-in, requires --delete) |
Backup and restore your project memories:
Export format includes sessions, observations, prompts, and summaries.
| Category | Use Case |
|---|---|
decision | Architecture decisions, tech stack picks, trade-offs |
pattern | Coding conventions, project patterns, recurring approaches |
error | Bug fixes, error solutions, debugging insights |
context | Project background, team conventions, environment setup |
observation | Auto-captured session observations |
Memories are stored in .claude/memory/ within your project directory.
AgentKits Memory has automatic CJK support for Chinese, Japanese, and Korean text search.
When better-sqlite3 is installed (default), CJK search works automatically:
better-sqlite3 for maximum performanceFor advanced Japanese with proper word segmentation, optionally use lindera:
Requires lindera-sqlite build.
| Method | Description |
|---|---|
initialize() | Initialize the memory service |
shutdown() | Shutdown and persist changes |
storeEntry(input) | Store a memory entry |
get(id) | Get entry by ID |
getByKey(namespace, key) | Get entry by namespace and key |
update(id, update) | Update an entry |
delete(id) | Delete an entry |
query(query) | Query entries with filters |
semanticSearch(content, k) | Semantic similarity search |
count(namespace?) | Count entries |
listNamespaces() | List all namespaces |
getStats() | Get statistics |
AgentKits Memory is thoroughly tested with 970 unit tests across 21 test suites.
| Metric | Coverage |
|---|---|
| Statements | 90.29% |
| Branches | 80.85% |
| Functions | 90.54% |
| Lines | 91.74% |
| Category | Tests | What's Covered |
|---|---|---|
| Core Memory Service | 56 | CRUD, search, pagination, categories, tags, import/export |
| SQLite Backend | 65 | Schema, migrations, FTS5, transactions, error handling |
| sqlite-vec Vector Index | 47 | Insert, search, delete, persistence, edge cases |
| Hybrid Search | 44 | FTS + vector fusion, scoring, ranking, filters |
| Token Economics | 27 | 3-layer search budgets, truncation, optimization |
| Embedding System | 63 | Cache, subprocess, local models, CJK support |
| Hook System | 502 | Context, session-init, observation, summarize, AI enrichment, service lifecycle, queue workers, adapters, types |
| MCP Server | 48 | All 9 MCP tools, validation, error responses |
| CLI | 34 | Platform detection, rules generation |
| Integration | 84 | End-to-end flows, embedding integration, multi-session |
This package uses better-sqlite3 which requires native binaries. Prebuilt binaries are available for LTS versions only.
| Node Version | Status | Notes |
|---|---|---|
| 18.x LTS | ✅ Works | Prebuilt binaries |
| 20.x LTS | ✅ Works | Prebuilt binaries |
| 22.x LTS | ✅ Works | Prebuilt binaries |
| 19.x, 21.x, 23.x | ⚠️ Requires build tools | No prebuilt binaries |
If you must use a non-LTS version (19, 21, 23), install build tools first:
Option 1: Visual Studio Build Tools
Option 2: windows-build-tools (npm)
Option 3: Chocolatey
See node-gyp Windows guide for more details.
AgentKits Memory is part of the AgentKits ecosystem by AityTech - tools that make AI coding assistants smarter.
| Product | Description | Link |
|---|---|---|
| AgentKits Engineer | 28 specialized agents, 100+ skills, enterprise patterns | GitHub |
| AgentKits Marketing | AI-powered marketing content generation | GitHub |
| AgentKits Memory | Persistent memory for AI assistants (this package) | npm |
MIT
Give your AI assistant memory that persists.
AgentKits Memory by AityTech
Star this repo if it helps your AI remember.