Skip to main content

SQLite backend and local runtime for MemoryHub — agent memory without infrastructure

Project description

memoryhub-local

Persistent, versioned, searchable memory for AI agents -- no infrastructure required.

memoryhub-local is the personal edition of MemoryHub. It gives AI agents the same memory tool surface as the cluster edition, backed by a local SQLite database instead of PostgreSQL. No API keys, no database servers, no background services.

Quickstart

pip install "memoryhub[local]"
claude mcp add memoryhub -- memoryhub mcp

That's it. Start a new Claude Code session and your agent has persistent memory.

On first run, the embedding model downloads automatically (~200MB one-time download). Subsequent starts are fast.

Install from source

If the packages aren't on PyPI yet (e.g. you're working from a feature branch):

git clone https://github.com/redhat-ai-americas/memory-hub.git
cd memory-hub
pip install -e memoryhub-local -e memoryhub-cli -e sdk
claude mcp add memoryhub -- memoryhub mcp

Verify it works

memoryhub doctor
MemoryHub Doctor

  Edition:    personal
  Database:   ~/.local/share/memoryhub/memoryhub.db (12.0 KB)
  WAL mode:   yes
  Migration:  e05b0e59db47
  Memories:   0
  Model:      granite-embedding-small-english-r2-onnx
  Embed dim:  384

MCP tool surface

The MCP server exposes four tools to agents. These are the same tools as the cluster edition -- agents cannot tell the difference.

Tool Purpose
register_session Session setup (no-op locally). Runs on-connect dreaming to extract facts from unprocessed threads.
memory(action=...) All memory operations: search, read, list, write, update, delete, similar, relationships, relate, report, reconstruct, status
thread(action=...) Conversation threads: create, append, get, list, archive, delete, extract
admin_memory(action=...) Content moderation: search, quarantine, restore, hard_delete

Cluster-only actions (projects, curation rules, promote/graduate, focus) return a graceful "not available in personal edition" message rather than failing.

CLI commands

Command Description
memoryhub mcp Start the local MCP server (stdio). This is what Claude Code calls.
memoryhub doctor Health check: database status, model, migrations, memory count
memoryhub dream -m <model> Extract facts from threads using a local LLM

Offline extraction with dream

The dream command extracts facts from conversation threads using an OpenAI-compatible LLM endpoint. Designed for Ollama but works with any compatible API.

pip install "memoryhub[local,dream]"    # adds httpx dependency

memoryhub dream --model llama3.2                          # Ollama (default)
memoryhub dream --model gemini-2.0-flash \
    --url https://generativelanguage.googleapis.com/v1beta/openai \
    --api-key $GEMINI_API_KEY                             # Gemini
memoryhub dream --dry-run --model llama3.2                # preview pending threads

How it works

  • Storage: SQLite with WAL mode at ~/.local/share/memoryhub/memoryhub.db
  • Embeddings: IBM Granite Embedding Small English R2 (ONNX, 384 dimensions), runs locally on CPU
  • Vector search: sqlite-vec with brute-force KNN
  • Full-text search: FTS5
  • Versioning: every update creates a new version; old versions preserved in history
  • Extraction: via MCP sampling (agent's own LLM) or memoryhub dream with a local LLM

All data lives under ~/.local/share/memoryhub/ (or $XDG_DATA_HOME/memoryhub/).

Notes

  • A [transformers] PyTorch was not found warning may appear on startup. This is harmless -- only the tokenizer is used, not PyTorch models.
  • The embedding model (~200MB) downloads once on first start. Subsequent starts use the cached model.

Requirements

  • Python 3.10+
  • Claude Code (for MCP integration)
  • Ollama (optional, for memoryhub dream)

License

Apache-2.0. Part of the MemoryHub project.

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

memoryhub_local-0.1.0.tar.gz (51.3 kB view details)

Uploaded Source

Built Distribution

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

memoryhub_local-0.1.0-py3-none-any.whl (59.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: memoryhub_local-0.1.0.tar.gz
  • Upload date:
  • Size: 51.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.12

File hashes

Hashes for memoryhub_local-0.1.0.tar.gz
Algorithm Hash digest
SHA256 897c298f95d380329dda2cc56e8b9ef6fee5f5404b61cdac5652d2be5616f0cd
MD5 1d7bd931a0c3ee679762ee449882fcf9
BLAKE2b-256 3b5e0cc6a468d9974bc4f6f81f0fabdc3ad2a3c4d735b145c6be5066aa09acc3

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for memoryhub_local-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 cd3a5b8b21e6030419d2178335827f3c02d1a910a79d1e05b280607f6a95aad0
MD5 52b6350bdb14a34ccdd2847a7e14cca5
BLAKE2b-256 c9d0ffff6f3dbd5f91a2d81ac7c63c64002219848bd01ee9709c84679ad19bdd

See more details on using hashes here.

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