MemKraft tackles a common pain point for AI agents: how to maintain long-term, auditable memory without relying on external databases or opaque vector stores. It uses plain Markdown files as the persistent storage format, enabling full version control and time-travel debugging of memory states. Beyond just storing facts, MemKraft implements an empirical self-improvement loop that tunes prompts based on memory recall results, optimizing AI agent interactions over time.
What MemKraft does and its architecture
MemKraft is a Python library that provides a local-first, zero-dependency memory system designed specifically for AI agents. Instead of opaque databases or vector embeddings, it stores all knowledge as plain-text Markdown files on disk. This makes the memory fully auditable and git-friendly, which is rare in this domain.
The architecture centers around bitemporal memory tracking: each memory entry is tracked with both valid time and recorded time, allowing the system to reconstruct the memory state as it was known at any point in the past. This temporal dimension is crucial for agents that need consistency when recalling past knowledge.
Search is a hybrid of multiple techniques: exact string matching, inverse document frequency (IDF), fuzzy search, and BM25 ranking. This blend balances precision and recall, enabling robust retrieval of relevant memory entries even with imperfect queries.
Additionally, MemKraft features regex-based named entity recognition (NER) supporting multiple languages, automatic entity classification, and a fact registry that associates confidence levels and applicability conditions to each fact. This metadata helps agents weigh the reliability and relevance of recalled information.
MemKraft integrates seamlessly with popular AI coding agents such as Claude Code, Cursor, and OpenClaw. Integration is done via copy-paste configuration snippets or the MCP protocol, making it straightforward to add memory awareness to existing agents without modifying their core code.
Under the hood, MemKraft avoids any calls to large language models (LLMs) within the library itself, offloading inference and generation to the agent side. This keeps the memory layer lightweight and dependency-free.
What makes MemKraft’s approach stand out
The standout feature of MemKraft is its empirical self-improvement loop, summarized as register → tune → recall → decide. The system not only stores memory but also uses feedback from recall outcomes to tune prompts and improve the agent’s performance over time. This closed loop is rare in open-source agent memory systems.
The bitemporal memory tracking is another strong point. Many memory systems track only a single timestamp or overwrite data, losing historical context. MemKraft’s dual timestamp approach preserves the full history of knowledge changes, enabling time-travel queries and audit trails.
The hybrid search strategy is a thoughtful tradeoff. Purely exact or fuzzy search can miss relevant entries or return too many false positives. Combining exact matching with IDF weighting, fuzzy matching, and BM25 ranking produces a more balanced retrieval quality. This is especially important for AI agents that rely heavily on accurate context.
The codebase is surprisingly clean and modular for a project tackling such complexity. The memory is organized into Markdown files with a clear folder structure (memory/entities/, templates, resolvers), making it easy to inspect and modify the memory directly.
MemKraft’s zero-dependency design means you get a memory system that runs out-of-the-box with just Python and no external databases or APIs. This reduces operational complexity and improves data ownership, but the tradeoff is that very large-scale or highly concurrent workloads may face performance limits compared to vector DB-backed solutions.
Benchmarks back up the practical value: MemKraft achieves 98.0% accuracy on the LongMemEval open-source agent long-term memory benchmark, outperforming alternatives like MemPalace (96.6%) and Microsoft’s MEMENTO (90.8%). It also shows a 6.14x speedup on hot-path workloads, indicating solid performance for real-world use.
Quick start with MemKraft
Getting MemKraft up and running is straightforward. The official quickstart commands initialize a memory directory and prepare your agent for memory-aware operation.
pip install memkraft
memkraft init # → creates ./memory/ with RESOLVER, TEMPLATES, entities/, ...
memkraft agents-hint claude-code >> AGENTS.md # your agent is now memory-aware
You can also scaffold full projects for different agent types using templates:
memkraft init --template claude-code # CLAUDE.md + memory/ + examples
memkraft init --template cursor # .cursorrules + memory/
memkraft init --template mcp # claude_desktop_config snippet + memory/
memkraft init --template rag # retrieval-focused structure
memkraft init --template minimal # just memory/entities/
memkraft templates list # see all presets
Templates are idempotent, so rerunning an init with a template won’t overwrite your existing edits.
In Python, you can interact with the memory like this:
from memkraft import MemKraft
mk = MemKraft("./memory")
mk.init()
mk.track("Simon Kim", entity_type="person", source="news")
mk.update("Simon Kim", info="Launched MemKraft 0.8.1", source="PyPI")
mk.search("MemKraft")
Optional extras include MCP server support and auto-reindexing on save:
pip install 'memkraft[mcp]' # + MCP server (`python -m memkraft.mcp`)
pip install 'memkraft[watch]' # + auto-reindex on save (`memkraft watch`)
pip install 'memkraft[all]' # everything
Integration snippets for various agents are generated with memkraft agents-hint:
memkraft agents-hint claude-code # → CLAUDE.md / AGENTS.md block
memkraft agents-hint openclaw # → AGENTS.md block for ОpenClaw
memkraft agents-hint cursor # → .cursorrules block
memkraft agents-hint openai # → Custom GPT / function-calling schema
memkraft agents-hint mcp # → claude_desktop_config.json snippet
memkraft agents-hint langchain # → LangChain StructuredTool wrappers
Verdict
MemKraft fills a niche for developers building AI agents who want a transparent, local, and fully auditable memory system. Its use of Markdown files as the storage format is a double-edged sword: it offers perfect version control and simplicity but may not scale easily to very large memory volumes or highly concurrent access patterns.
The empirical prompt self-improvement loop is a compelling feature that sets MemKraft apart from many memory libraries that treat memory as static storage. This makes it especially relevant for teams iterating on agent prompts and skills.
The zero-dependency, no LLM calls in the library approach keeps the system simple and portable but means you need to handle AI interactions outside MemKraft.
If you value auditability, git-friendliness, and a well-rounded hybrid search without external dependencies, MemKraft is worth exploring. It’s less suited if you need ultra-high-throughput distributed memory or complex vector embedding capabilities out-of-the-box.
Overall, MemKraft impresses with its clear architecture, solid benchmark results, and pragmatic integration options. It’s a practical tool for AI agent memory management that balances simplicity, transparency, and empirical performance tuning.
Related Articles
- A-MEM: dynamic semantic memory management for LLM agents inspired by Zettelkasten — A-MEM is a Python agentic memory system that dynamically organizes LLM agent memories using semantic embeddings and auto
- mem0: optimizing AI agent memory with a new single-pass additive algorithm — mem0 enhances AI agent memory with a new single-pass ADD-only extraction algorithm and multi-signal retrieval, boosting
- MemPalace: local-first AI memory with strong semantic retrieval and no cloud dependency — MemPalace offers a local-first AI memory system with 96.6% recall on conversation history retrieval without any cloud or
→ GitHub Repo: seojoonkim/memkraft ⭐ 182 · Python