agent-memory-cpp
A C++17 library and research project for local agent memory, retrieval and traceable document history.
What it does
agent-memory-cpp is a C++17 library for applications that maintain local agent memory or a knowledge base. When a document changes, the application needs to know which version supplied a retrieved quotation and which source supports a note derived from it. The library is built around canonical documents, revision history, and source references. Its core runs in the host process without requiring an external memory service or a separate Python process.
Available today
A canonical document gives source content a stable logical form. Block IDs survive edits, and revisions let the application read earlier text. In the runnable example, the application writes an edit to the in-memory reference store and retrieves Markdown from both the original and the current revision.
- An optional MDBX adapter persists raw canonical content and revision history. It is enabled separately at build time.
- The source includes bounded lexical and vector search primitives and an experimental path from raw Markdown ingestion to retrieving text from the exact revision.
Planned memory and retrieval use cases
Episodic memory recalls events, semantic memory retrieves facts and concepts, and procedural memory stores ways to carry out tasks. In the target architecture, text, embedding, relationship, and time-based retrieval help assemble model context with references to exact revisions. Notes, summaries, and instructions derived from sources should retain those references so they can be checked after an update.
Hybrid, graph, and time-based retrieval, end-to-end context assembly, and derived knowledge are at different stages of development. The first-release profile describes the intended scope of a user-facing version.
Research
The experiments look at memory and time costs for different retrieval methods at a given result quality. They cover compact embeddings, THQ and PQ/OPQ, binary-code search with multi-index hashing (MIH), and staged retrieval. HNSW is considered as one approximate search option. Associative retrieval and memory consolidation form a separate research line. The reports document results for specific experimental settings.
Collaboration
Get in touch to discuss developing this project or working on related research.
Discuss a project