Skip to main content

Framework-agnostic memory layer for AI agents with importance-aware, graph-structured context assembly

Project description

Mnemonic

Give your AI agents a memory that works like a brain.

Today's AI agents are stateless. Every conversation starts from zero. Mnemonic changes that. It's a memory layer that models how humans actually remember — important things stick, old things fade, related ideas connect, and contradictions get flagged.

Tell your agent you prefer Kubernetes on Monday, and it still knows on Friday. Correct a mistake, and the old fact fades while the new one takes priority. No more repeating yourself.

How It Works

Mnemonic organizes memories into five tiers, just like the human brain:

Tier What it holds How long it lasts
Identity Name, role, core preferences Years
Procedural Workflows, step-by-step processes ~1 year
Structural Architecture decisions, tools, constraints ~6 months
Episodic Specific conversations and events ~30 days
Transient Small talk, temporary context ~7 days

Memories don't just sit in a list. They form a graph — related ideas link together, contradictions are detected, and outdated facts get superseded (not deleted). When your agent needs context, Mnemonic picks the most relevant memories that fit within the token budget.

Get Started in 3 Lines

pip install mnemonic-ai
from mnemonic import Mnemonic

mem = Mnemonic()
mem.add("User prefers dark mode and Kubernetes over ECS")
context = mem.recall("deployment preferences", max_tokens=3000)
# Returns the most relevant memories, ranked by importance

No API keys. No database setup. Works immediately with SQLite.

Why Mnemonic

  • Memories decay naturally — like human memory, unused information fades. Actively accessed memories stay strong.
  • Smart prioritization — urgency, errors, corrections, and decisions automatically get importance boosts.
  • Contradictions are handled — "moved to SF" supersedes "lived in NYC" instead of creating confusion.
  • Stays within your token budget — fills the context window with the highest-signal memories, not everything.
  • Gets smarter over time — episodic memories consolidate into durable knowledge, just like sleep does for the brain.

Scale When You're Ready

What you need How to get it
Production database pip install mnemonic-ai[postgres] — PostgreSQL with vector search
Semantic search pip install mnemonic-ai[openai-embeddings] or mnemonic-ai[local-embeddings]
AI tool integration pip install mnemonic-ai[mcp] then mnemonic-mcp — works with Claude, VS Code Copilot
TypeScript npm install @mnemonic-ai/core — full parity with Python
Multiple agents Built-in agent isolation with explicit sharing

Use With Any Framework

# LangChain
from mnemonic.adapters.langchain import LangChainMemory

# CrewAI
from mnemonic.adapters.crewai import CrewAIMemory

# AutoGen
from mnemonic.adapters.autogen import AutoGenMemory

# Or just inject into any prompt
from mnemonic.adapters.raw import recall_as_prompt
system = f"You are helpful.\n\n{recall_as_prompt(mem, user_query)}"

Multi-Agent Memory

Multiple agents can share a memory store while keeping their own memories private:

agent_a = Mnemonic(store=store, agent_id="researcher")
agent_b = Mnemonic(store=store, agent_id="coder")

agent_a.add("The API uses OAuth 2.0", shared=True)  # both agents see this
agent_b.add("Refactored auth module yesterday")       # only coder sees this

Extend It

Mnemonic is designed to be extended. Register custom store backends, add consolidation hooks, or replace any heuristic with your own logic:

from mnemonic import register_store, MnemonicConfig

register_store("mydb", my_factory)        # custom store backend

cfg = MnemonicConfig()
cfg.scorer.weight_recency = 0.50          # tune scoring weights
cfg.classifier.custom_classifier = my_fn  # replace tier classification

Mnemonic Platform

Need Neo4j graph storage, LLM-powered consolidation, a REST API with authentication, or an admin dashboard? See Mnemonic Platform.

License

Apache 2.0

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

mnemonic_ai-0.1.0.tar.gz (79.8 kB view details)

Uploaded Source

Built Distribution

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

mnemonic_ai-0.1.0-py3-none-any.whl (64.9 kB view details)

Uploaded Python 3

File details

Details for the file mnemonic_ai-0.1.0.tar.gz.

File metadata

  • Download URL: mnemonic_ai-0.1.0.tar.gz
  • Upload date:
  • Size: 79.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for mnemonic_ai-0.1.0.tar.gz
Algorithm Hash digest
SHA256 13d9553829c0efa330377402ea645aa9e75b17d42e70e21913fa020677cfab8f
MD5 b07349e82a57925d7f20979cbdbaac5d
BLAKE2b-256 c487f6ef3d218873815fae2297163a56be1725de49e54b8c3dc5340704c29ecd

See more details on using hashes here.

Provenance

The following attestation bundles were made for mnemonic_ai-0.1.0.tar.gz:

Publisher: py-publish.yml on obscura-oss/mnemonic-oss

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

File details

Details for the file mnemonic_ai-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: mnemonic_ai-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 64.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for mnemonic_ai-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 2c3a07bea8dbf4c3910f81ab338a7715dfcd7535ea10555e0709f9048cd93254
MD5 ed911f5d524e1edfa342e8a741f705b5
BLAKE2b-256 7bce948f7efce8d9ebd2d48f1a2b49c52ba45179b66560abea0283a405725d74

See more details on using hashes here.

Provenance

The following attestation bundles were made for mnemonic_ai-0.1.0-py3-none-any.whl:

Publisher: py-publish.yml on obscura-oss/mnemonic-oss

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