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

Uploaded Python 3

File details

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

File metadata

  • Download URL: memoryhub_local-0.2.1.tar.gz
  • Upload date:
  • Size: 53.5 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.1.tar.gz
Algorithm Hash digest
SHA256 bbbbf033f6c6f350f4ab12c4c3bfad8dcd79d544d24069a9bc0cb5b1ac7ff20e
MD5 5826378fea06dcad21eebb1ce349943c
BLAKE2b-256 b90da89e76c726d3d2a9becc1fcad51c05d055e0b50a3019773e5ae4323c0baf

See more details on using hashes here.

Provenance

The following attestation bundles were made for memoryhub_local-0.2.1.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.1-py3-none-any.whl.

File metadata

  • Download URL: memoryhub_local-0.2.1-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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 272324590237c1528f6041d84e56ec689db4f8d549297afd10a89e4776a0ba69
MD5 64ebe17dd007b20b5791f43bd0c1d8d8
BLAKE2b-256 8e82727323a03f43f2f1fb4b35b0ed0fd7b31af0325fd11417f9aaf498ae38cc

See more details on using hashes here.

Provenance

The following attestation bundles were made for memoryhub_local-0.2.1-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

This release

0.2.1 This release

2 files

0.2.0

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