Skip to main content

Multi-tier long-term memory for LLM agents. Install: pip install smolAmem. Import: import mneme.

Project description

Mneme

Multi-tier long-term memory for LLM agents. Working / episodic / semantic tiers, pluggable storage backends, framework-agnostic adapters, and explicit forgetting + consolidation.

docs python license

Status: 1.0 released. APIs are stable; semver from here. Bug reports welcome.

Why

Every agent framework ships with toy memory: last-N messages, or an LLM-summarised buffer. Real agents need to remember user preferences across weeks, recall specific past interactions, and store semantic facts extracted from many interactions — and they need to forget things that stop being relevant.

Mneme is the library you wish existed.

Install

pip install smolAmem                    # core only
pip install "smolAmem[sqlite,openai]"   # SQLite + OpenAI embeddings
pip install "smolAmem[qdrant,openai]"   # production vector backend

Heads-up on naming: PyPI install name is smolAmem (the mneme slot was already taken). Python import name stays mneme — same dual-name pattern as Pillow / PIL or pyyaml / yaml. So you pip install smolAmem but write import mneme everywhere in your code.

Quickstart

from mneme import MemoryManager, SQLiteBackend, OpenAIEmbeddings

m = MemoryManager(
    agent_id="alice",
    backend=SQLiteBackend(path="mneme.db", dimensions=1536),
    embedder=OpenAIEmbeddings(),
)

m.episodic.add("user mostly works in TypeScript", metadata={"role": "user"})

for r in m.retrieve("what language does the user prefer?", k=3):
    print(r.score, r.record.content)

Full walkthrough: docs/quickstart.

Documentation

The full site lives at ashwinugale.github.io/ashwinugale-mneme.

  • Concepts — the three-tier model, retrieval, consolidation, forgetting.
  • Backends — InMemory, SQLite, Qdrant, pgvector.
  • Adapters — LangChain, LlamaIndex, raw OpenAI.
  • Eval harness — reproducible recall@k + token-cost benchmark.
  • API reference — autogen from docstrings.

Benchmark snapshot

From the v0.6 eval harness on the 5-conversation starter corpus, k=5:

Strategy recall@5 tokens / test point
no_memory 0.000 0.0
mneme (hash, deterministic) 0.833 68.0
mneme (OpenAI embeddings) 1.000 67.7
full_history 1.000 141.0
summary_buffer 1.000 165.3

Mneme matches the full-history oracle for accuracy at less than half the token cost. The HashEmbedder row is the cheap deterministic baseline that runs without an API key — useful in CI and for reviewers reproducing numbers.

Reproduce:

uv run python -m evals --runner mneme --embedder openai --output out/mneme.json

License

MIT. See LICENSE.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

smolamem-1.0.0.tar.gz (345.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

smolamem-1.0.0-py3-none-any.whl (56.3 kB view details)

Uploaded Python 3

File details

Details for the file smolamem-1.0.0.tar.gz.

File metadata

  • Download URL: smolamem-1.0.0.tar.gz
  • Upload date:
  • Size: 345.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for smolamem-1.0.0.tar.gz
Algorithm Hash digest
SHA256 21222597d08bd3779f24df7b3d142ec89f4b476423f25e420f7e6f13eaf04885
MD5 ab44b8099c2306351da1c28726a2cac6
BLAKE2b-256 cbc4a9104d33bd0a43ff9bccb11e8accf4ddd90fb9d45f6a90a1fbd899cdb540

See more details on using hashes here.

Provenance

The following attestation bundles were made for smolamem-1.0.0.tar.gz:

Publisher: release.yml on AshwinUgale/ashwinugale-mneme

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file smolamem-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: smolamem-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 56.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for smolamem-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 9a6ada7c39610bb64bf88c1e141aa59c1f851eb15079c993668e02b6a47e4cfb
MD5 e1ccffc0521ef24234b802a66bc6ef9d
BLAKE2b-256 3485692b9b107d2733f155c5f4740b0cc322b0fad4613f2fbfcdbbc583056a9e

See more details on using hashes here.

Provenance

The following attestation bundles were made for smolamem-1.0.0-py3-none-any.whl:

Publisher: release.yml on AshwinUgale/ashwinugale-mneme

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page