Drop-in Memory Layer Library for your AI Agent
from memorymesh import Memory
mem = Memory()
mem.store("user likes rust")
mem.query("what does the user like?")
# → ["user likes rust"]pip install memorymeshFor semantic embeddings (recommended):
pip install memorymesh[embeddings]from memorymesh import Memory
mem = Memory() # uses ~/.memorymesh/memory.db
mem.store("user prefers dark mode")
mem.store("working on async refactor")
# Query by semantic similarity
mem.query("theme preference")
# → ["user prefers dark mode"]
mem.query("async work", top_k=5)
# → ["working on async refactor", ...]| Method | Description |
|---|---|
Memory(db_path=None, embedder="auto") |
Create memory. Set embedder="fallback" to skip embeddings model. |
mem.store(content) |
Store a memory (deduped). |
mem.query(query, top_k=3) |
Query by semantic similarity. |
mem.all() |
List all memories. |
- Dead simple – 2 methods:
store()andquery() - Plug-and-play – works out of the box, no config
- Local-first – SQLite + optional sentence-transformers
- Zero deps – falls back to deterministic hashing if no model
Works with any AI agent, tool, or assistant.
Scan Claude Code, Cursor, and OpenCode data across your machine (not just the repo):
# Discover locations
memorymesh scan
# Ingest all provider messages
memorymesh pull -p myproject
# Build portable package for another machine/provider
memorymesh package build -p myproject -o ./udata.tar.gz
# Import on another machine
memorymesh package import ./udata.tar.gz -p myprojectSee docs/U_DATA_PACKAGING.md and docs/STORAGE_PATHS.md.
Export everything for a project (messages, summaries, agent state) as plain text, Markdown, or JSON:
memorymesh export -p myproject --format md -o ./export.md
memorymesh export -p myproject --format txt --clipboard
memorymesh export -p myproject --format json --provider cursorThe TUI (memorymesh tui) adds [7] Export. The HTTP API accepts POST /export with {"project":"...", "format":"md", "clipboard": true}.
Move a conversation from one tool to another without dumping the whole project:
memorymesh init
# Workspace Session Bridge — auto-picks the latest session for this cwd
memorymesh resume -p lighthouse --from claude --to cursor -w ~/lighthouse
# Or target any provider pair dynamically
memorymesh resume -p myrepo --from claude --to gemini
# Manual conversation filter still supported
memorymesh transfer -p lighthouse --from claude --to cursor -c e7fcaea3 --pushHow it works (novel bits):
- Correlates sessions by workspace slug (
~/.claude/projects/-home-user-repo/↔ workspace path) - Builds a resume brief (compressed summary + tail turns) instead of 10k+ message dumps
- Delivers via a dynamic provider registry — handoff paths and import hints resolve per target, with a generic fallback for unknown agents
See docs/INTEGRATIONS.md for transfer, transfer-deliver, and install-push.