memoryhub-cli
Command-line client for MemoryHub — centralized, governed memory for AI agents.
Install
pip install memoryhub-cli
Authentication
The CLI supports two authentication modes:
API key (recommended for non-interactive use):
# Via environment variable
export MEMORYHUB_API_KEY=mh-dev-abc123
# Or store in the credentials file (INI-style, mode 0600)
mkdir -p ~/.config/memoryhub
cat > ~/.config/memoryhub/credentials << 'EOF'
[default]
api_key = mh-dev-abc123
EOF
chmod 600 ~/.config/memoryhub/credentials
API key resolution order: MEMORYHUB_API_KEY env var > ~/.config/memoryhub/credentials (section from MEMORYHUB_CONTEXT or [default]) > ~/.config/memoryhub/api-key (legacy flat file) > api_key in config.json.
Server URL:
The CLI needs to know where the MemoryHub server is. The SessionStart hook for Claude Code also reads from this config.
# Via environment variable
export MEMORYHUB_URL=https://memoryhub.example.com/mcp/
# Or save to ~/.config/memoryhub/config.json (also set by memoryhub config init)
echo '{"url": "https://memoryhub.example.com/mcp/"}' > ~/.config/memoryhub/config.json
chmod 600 ~/.config/memoryhub/config.json
URL resolution: MEMORYHUB_URL env var > url in ~/.config/memoryhub/config.json.
OAuth (interactive setup):
memoryhub login
When both are available, API key takes precedence.
Usage
# Search for memories
memoryhub search "deployment patterns"
# List memories by creation time (no semantic search)
memoryhub list --project-id my-project --max 20
# Read a specific memory
memoryhub read <memory-id>
# Write a new memory
memoryhub write "Use Podman, not Docker" --scope user --weight 0.9
# Campaign-scoped operations (requires project enrollment)
memoryhub search "shared patterns" --project-id my-project --domain React
memoryhub write "Use vLLM for embeddings" --project-id my-project --domain ML
# Compact output for LLM context injection (content only, no metadata)
memoryhub search "project conventions" --output compact
# Set up project-level memory loading
memoryhub config init
memoryhub config regenerate
# Admin: provision and manage agents
memoryhub admin create-agent my-agent --scopes user,project
memoryhub admin list-agents
memoryhub admin rotate-secret my-agent
memoryhub admin disable-agent my-agent
The --project-id flag enables campaign-scoped memory access. When your project is enrolled in campaigns via .memoryhub.yaml, the CLI auto-loads the project identifier from config, so you can omit the flag in most cases. Use --domain to tag writes or boost domain-matching results in search.
Output formats
The --output / -o flag controls output format on most commands:
table(default) -- Rich-formatted tables for interactive usejson-- Machine-readable JSON envelope ({"status": "ok", "data": {...}})quiet-- No output (exit code only)compact-- Content-only text for LLM context injection, no IDs or metadata
Project configuration
memoryhub config generates a project-local .memoryhub.yaml and a companion .claude/rules/memoryhub-loading.md rule file. Both files are meant to be committed so every contributor's agent inherits the same loading policy.
memoryhub config init is an interactive wizard that asks about session shape, loading pattern, focus source, and retrieval defaults, then writes both files at the project root. If a legacy .claude/rules/memoryhub-integration.md already exists, it is backed up to .bak before the new rule file is written.
memoryhub config regenerate re-renders the rule file from .memoryhub.yaml after you hand-edit the YAML. It reads the YAML and rewrites the Markdown rule file only; it does not modify .memoryhub.yaml.
Per-developer connection params (url, auth_url, client_id, client_secret) live separately at ~/.config/memoryhub/config.json and are managed by memoryhub login. They are not stored in .memoryhub.yaml and are not committed.
Further documentation
The CLI is one surface of the memory-hub monorepo. For deeper context:
- Architecture overview — System design, deployment topology
- MCP server tool reference — The 15 tools the CLI wraps
- Agent memory ergonomics design — Full
.memoryhub.yamlschema, rule file templates, and session-loading patterns - Python SDK — if you'd rather call the tools from Python
Links
Metadata
Release files for memoryhub-cli 0.12.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| memoryhub_cli-0.12.1.tar.gz | 49.2 kB | With provenance | Details for memoryhub_cli-0.12.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| memoryhub_cli-0.12.1-py3-none-any.whl | Python 3 | none | any | Details for memoryhub_cli-0.12.1-py3-none-any.whl |
Total release size: 86.6 kB
Release files / memoryhub_cli-0.12.1.tar.gz
| Download URL | memoryhub_cli-0.12.1.tar.gz |
|---|---|
| Size | 49.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
4fd8495eba1e095d58dbcda2adc450af0b6cab90432a289656fb1ea083db121d
|
|
BLAKE2b-256 checksum How to use checksums |
25fc762114ffe71d704f07ce7d5709023c43dbdccfec38338e14c063e0d6fb43
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.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 logRelease files / memoryhub_cli-0.12.1-py3-none-any.whl
| Download URL | memoryhub_cli-0.12.1-py3-none-any.whl |
|---|---|
| Size | 37.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
fc8044fa40505e4055493e2d277f066e3c6769ee7745621ce265ed4d145b8519
|
|
BLAKE2b-256 checksum How to use checksums |
a3a747c953e5ae5f96009afb3a291f1f208c001de39641a392f6ebafc9a3702f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.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 logSecurity for memoryhub-cli 0.12.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.
Attestation for memoryhub_cli-0.12.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 logA 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.