Sitelet https://github.com/subashp/AgentMemory
Skip to content

Latest commit

 

History

28 Commits

Folders and files

Repository files navigation

AgentMemory

AgentMemory is a local-first, provider-neutral memory subsystem for agentic applications. It provides durable SQLite storage, privacy-aware exposure policy, prompt assembly, and a stable integration boundary for Python, C++, and C consumers.

Capabilities

  • Persistent memory records with correction, soft deletion, hard deletion, and search.
  • Append-only interaction events, persona blocks, and auditable memory proposals.
  • Privacy classes: generic, team, and private.
  • Provider classes: external_public, external_team, and local_private.
  • Configurable prompt budgets and policy decisions before memory is exposed.
  • Python runtime tools, deterministic distillation, sync interfaces, CLI, and JSON process API.
  • Native C++ SQLite implementation with a standalone C ABI and CPython binding.
  • No network, database service, embedding service, or provider SDK required.

Higher-level orchestration remains in Python; both Python and native consumers share the same storage and policy model.

Choose an API

Consumer Entry point Reference
Python application agentmemory package; NativeSQLiteMemoryStore for the native backend Python API reference
C++ application CMake target AgentMemory::core C++ API reference
C or runtime-loaded integration Shared library agentmemory_capi and agentmemory_capi.h C++/C API reference
Process-isolated integration JSON command and prompt boundary API contract

The public compatibility rules are documented in the API contract. Public API changes must be additive, preserve existing behavior, update the references and tests, and retain backward compatibility.

Python

The portable Python backend works after installing the package:

python -m pip install -e .
python -m unittest discover -s tests
from agentmemory import MemoryRecord, MemoryToolRuntime, SQLiteMemoryStore

store = SQLiteMemoryStore(".agentmemory/memory.sqlite3")
tools = MemoryToolRuntime(store)
result = tools.call("memory_remember", {
    "content": "Use local inference for confidential code",
    "privacy_class": "private",
})

The native backend is selected explicitly after the native extension is built:

from agentmemory import NativeSQLiteMemoryStore, open_store

store = NativeSQLiteMemoryStore(".agentmemory/native.sqlite3")
# Or: store = open_store(".agentmemory/native.sqlite3", backend="native")

open_store(..., backend="python") remains the backward-compatible default. backend="auto" uses native storage only for a new path when the extension is available; existing databases remain on the Python backend until explicitly migrated with migrate_to_native.

Native C++ and C

Build the native library for Windows x64:

cmake -S . -B build\x64 -G "Visual Studio 17 2022" -A x64
cmake --build build\x64 --config Release

On Linux or macOS, use the host CMake generator. For macOS/ARM64 or Ubuntu ARM64, provide the platform toolchain and normally set -DAGENTMEMORY_BUILD_PYTHON=OFF; see the native build guide.

Subproject consumers can use:

add_subdirectory(third_party/AgentMemory)
target_link_libraries(my_app PRIVATE AgentMemory::core) # C++
# Or AgentMemory::capi for the C ABI shared library.

The native build exports AgentMemory::core, AgentMemory::capi, and AgentMemory::python when enabled. The C ABI allocates JSON output strings; release them with agentmemory_free_string. See the C++ and C API reference.

CLI and process boundary

agentmemory remember --class private "Use local inference for confidential code"
agentmemory search "confidential" --json
agentmemory show <memory-id>
agentmemory forget <memory-id>

Non-Python clients can use the documented JSON commands and schemas in schemas/; this avoids embedding Python in a system integration.

Build and support notes

  • Default native Python bindings target 64-bit x86 (amd64/x86_64).
  • Native C++ and C builds require C++17 and SQLite3 development headers/libraries.
  • The repository validates Windows x64 plus an external CMake consumer fixture.
  • Linux, macOS, and ARM builds use normal CMake/toolchain workflows and require validation with the target toolchain.
  • The native extension is not built by pip install automatically; build it with CMake as documented above.

See native build guide, Python API reference, C++ API reference, and API contract.

License

MIT. See LICENSE.

About

Common memory sub-system which is agent agnostic

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages