Skip to main content

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

Scope: one project vs all projects

The Quickstart command registers the MCP server for the current project only (--scope local, the default). Other projects are unaffected.

To enable MemoryHub in all your projects, register it at user scope instead:

claude mcp add --scope user memoryhub -- memoryhub mcp

To remove it from a single project (or globally, if registered at user scope):

claude mcp remove memoryhub

The three scopes, in priority order:

Scope Where it's stored Shared with team?
local (default) .claude/settings.local.json No (gitignored)
project .mcp.json Yes (committed)
user ~/.claude/settings.json No (global)

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/).

Troubleshooting

NumPy / scipy crash on Anaconda

If memoryhub doctor or memoryhub mcp crashes with A module that was compiled using NumPy 1.x cannot be run in NumPy 2.x, the Anaconda base environment has a NumPy version conflict with scipy/sklearn. The fix is to install memoryhub-local in its own venv:

python3 -m venv ~/.memoryhub-venv
~/.memoryhub-venv/bin/pip install "memoryhub[local]"
claude mcp add memoryhub -- ~/.memoryhub-venv/bin/memoryhub mcp
~/.memoryhub-venv/bin/memoryhub doctor   # verify

The venv doesn't need to be activated -- claude mcp add takes the full path to the binary.

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.

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.2.0.tar.gz (53.4 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.2.0-py3-none-any.whl (61.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: memoryhub_local-0.2.0.tar.gz
  • Upload date:
  • Size: 53.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.14

File hashes

Hashes for memoryhub_local-0.2.0.tar.gz
Algorithm Hash digest
SHA256 0b2dfb329f5581bae3ff31082ae57f7a38c908fdf01abe1bb9d50ffb5a570bcb
MD5 34ada13d0d5a1ccb7bdfad069aa5eca8
BLAKE2b-256 41bfda2f179983f9d29648ea6d3bf1de9dc095201584e28cc958bb18f1f6a6ae

See more details on using hashes here.

Provenance

The following attestation bundles were made for memoryhub_local-0.2.0.tar.gz:

Publisher: release.yml on redhat-ai-americas/memory-hub

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

File details

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

File metadata

  • Download URL: memoryhub_local-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 61.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.14

File hashes

Hashes for memoryhub_local-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 5cb860925664fe8e47a49c36d776b1853cc294f724ad4243b6f5ee655738d3b1
MD5 aa57de922e5c5a2ed82a1a23628be760
BLAKE2b-256 6a3b7598a3ccc46c1743a671085dae28ec5b2bc71359f598722ea8e09ce9ed20

See more details on using hashes here.

Provenance

The following attestation bundles were made for memoryhub_local-0.2.0-py3-none-any.whl:

Publisher: release.yml on redhat-ai-americas/memory-hub

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

Release history Release notifications | RSS feed

0.2.1

2 files

This release

0.2.0 This release

2 files

0.1.0

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page