Skip to main content

CLI client for MemoryHub — centralized, governed memory for AI agents

Project description

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 use
  • json -- 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:

Links

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_cli-0.12.0.tar.gz (49.1 kB view details)

Uploaded Source

Built Distribution

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

memoryhub_cli-0.12.0-py3-none-any.whl (37.3 kB view details)

Uploaded Python 3

File details

Details for the file memoryhub_cli-0.12.0.tar.gz.

File metadata

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

File hashes

Hashes for memoryhub_cli-0.12.0.tar.gz
Algorithm Hash digest
SHA256 115e51d63410921aee88132e99bec1dd78a6439ec626787456ddb6ff2c7a1271
MD5 0dbfbebe3736f6f1e5cb150272625d17
BLAKE2b-256 f7a108e563a0a1ea3d93d49737010f780bd8037322de85d74b1982b59fa167ab

See more details on using hashes here.

Provenance

The following attestation bundles were made for memoryhub_cli-0.12.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_cli-0.12.0-py3-none-any.whl.

File metadata

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

File hashes

Hashes for memoryhub_cli-0.12.0-py3-none-any.whl
Algorithm Hash digest
SHA256 afe1badaf8ba6260b7447d3680b72aab27a7d49abefaa0007760868b08644868
MD5 178408616b4fede87f45659ee670adb0
BLAKE2b-256 9cf80f84ae6afe6fa676ae39021b1a0dd9d2dfcdea5372d4418a5ded146220a6

See more details on using hashes here.

Provenance

The following attestation bundles were made for memoryhub_cli-0.12.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.

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