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.

Metadata

Release files for memoryhub-local 0.2.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for memoryhub-local 0.2.1
File Size Uploaded Provenance Actions
memoryhub_local-0.2.1.tar.gz 53.5 kB With provenance Details for memoryhub_local-0.2.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for memoryhub-local 0.2.1
File Interpreter ABI Platform Actions
memoryhub_local-0.2.1-py3-none-any.whl Python 3 none any Details for memoryhub_local-0.2.1-py3-none-any.whl

Total release size: 114.9 kB

Release files / memoryhub_local-0.2.1.tar.gz

Download URL memoryhub_local-0.2.1.tar.gz
Size 53.5 kB
Tags Source
SHA-256 checksum
How to use checksums
bbbbf033f6c6f350f4ab12c4c3bfad8dcd79d544d24069a9bc0cb5b1ac7ff20e
BLAKE2b-256 checksum
How to use checksums
b90da89e76c726d3d2a9becc1fcad51c05d055e0b50a3019773e5ae4323c0baf
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jul 29, 2026.

Transparency log

Release files / memoryhub_local-0.2.1-py3-none-any.whl

Download URL memoryhub_local-0.2.1-py3-none-any.whl
Size 61.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
272324590237c1528f6041d84e56ec689db4f8d549297afd10a89e4776a0ba69
BLAKE2b-256 checksum
How to use checksums
8e82727323a03f43f2f1fb4b35b0ed0fd7b31af0325fd11417f9aaf498ae38cc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jul 29, 2026.

Transparency log

Security for memoryhub-local 0.2.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for memoryhub_local-0.2.1.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jul 29, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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