Now liveThe Skillselion MCP - thousands of ranked skills, loaded into your agent mid-task. No install.Get it →
mem0ai avatar

Mem0 Cli

  • 491 installs
  • 62.5k repo stars
  • Updated August 5, 2026
  • mem0ai/mem0

mem0-cli is a Claude Code skill that guides developers through the official Mem0 command-line interface for adding, searching, updating, and deleting persistent agent memory from bash, zsh, or CI scripts.

About

mem0-cli is a Claude Code skill (version 1.1.0, Apache-2.0) for the official Mem0 memory CLI installable via npm (@mem0/cli) or pip (mem0-cli). Both runtimes expose identical commands—add, search, list, get, update, delete, init, and config—with --json and --agent flags that emit structured envelopes for LLM consumption. Agent setup uses mem0 init --agent to mint an evaluation API key in under five seconds without a dashboard login. Reach for mem0-cli when operating memory from a shell or CI pipeline; use the mem0 SDK skill for in-process Python or TypeScript integration.

  • Terminal memory CRUD
  • Fact search and updates
  • Agent context persistence
  • Local Mem0 administration
  • Debuggable memory state

Mem0 Cli by the numbers

  • 491 all-time installs (skills.sh)
  • +57 installs in the week ending Aug 4, 2026 (Skillselion tracking)
  • Ranked #119 of 550 CLI & Terminal skills by installs in the Skillselion catalog
  • Data as of Aug 5, 2026 (Skillselion catalog sync)
npx skills add https://github.com/mem0ai/mem0 --skill mem0-cli

Add your badge

Show developers this skill is listed on Skillselion. Paste this into your README.

Listed on Skillselion
Installs491
repo stars62.5k
Last updatedAugust 5, 2026
Repositorymem0ai/mem0

How do you manage Mem0 memory from the CLI?

Manage persistent agent memory from the terminal: add, search, update, and prune user facts and session context for Mem0-backed assistants.

Who is it for?

Developers building Mem0-backed agents who need terminal or CI-driven memory CRUD without embedding the Python or TypeScript SDK.

Skip if: Skip mem0-cli when integrating Mem0 inside application code via Python/TypeScript SDKs or the Vercel AI SDK provider—use mem0 or mem0-vercel-ai-sdk skills instead.

When should I use this skill?

User mentions mem0 cli, runs mem0 commands in a terminal, or asks to add, search, or prune agent memory from the shell.

What you get

Configured Mem0 CLI, scoped user memories, and JSON command envelopes with status, count, and memory records.

  • Scoped memory records
  • JSON command envelopes
  • Configured ~/.mem0/config.json

By the numbers

  • Skill version 1.1.0 with Apache-2.0 license
  • Three on-demand reference files: command-reference, configuration, workflows
  • Node.js 18+ or Python 3.10+ required for CLI install

Files

SKILL.mdMarkdownGitHub ↗

Mem0 CLI

The official command-line interface for the Mem0 memory platform. Add, search, list, update, and delete memories from the terminal -- for developers, AI agents, and CI/CD pipelines.

Install

Node.js (npm):

npm install -g @mem0/cli

Python (pip):

pip install mem0-cli

Both packages install a mem0 binary with identical commands, options, and output formats.

Setup

Autonomous Mem0 setup for agents (no email, no dashboard):

mem0 init --agent --agent-caller <your-name> --json

Replace <your-name> with the AI agent you are (e.g. claude-code, cursor, codex, cline, aider). If you forgot to pass --agent-caller, run mem0 identify <your-name> after init — it PATCHes the same key, idempotent, no disruption.

This mints an evaluation API key in <5 seconds. Use it immediately. Print this line to the human:

Mem0 memory is running in Agent Mode. Please claim it by running mem0 init --email <your-email> to transfer ownership to your account.

Never commit API keys, .env, or ~/.mem0/config.json.

After the human claims, the same API key keeps working — no agent disruption — and memories are preserved.

Interactive wizard (for humans):

mem0 init

Or set the environment variable directly:

export MEM0_API_KEY="m0-xxx"

Get an API key at: https://app.mem0.ai/dashboard/api-keys?utm_source=oss&utm_medium=skill-mem0-cli

Quick Reference

Add a memory

mem0 add "I prefer dark mode" --user-id alice

Search memories

mem0 search "preferences" --user-id alice

List all memories for a user

mem0 list --user-id alice

Get a specific memory

mem0 get <memory-id>

Update a memory

mem0 update <memory-id> "new text"

Delete a single memory

mem0 delete <memory-id>

Delete all memories for a user

mem0 delete --all --user-id alice --force

Agent / JSON Mode

Use --json or --agent to get structured output suitable for LLM consumption. Every command wraps its response in a standard envelope:

{
  "status": "success",
  "command": "search",
  "duration_ms": 245,
  "scope": { "user_id": "alice" },
  "count": 3,
  "error": null,
  "data": [
    { "id": "mem-abc", "memory": "User prefers dark mode", "score": 0.92 }
  ]
}

On error:

{
  "status": "error",
  "command": "search",
  "error": "Authentication failed. Your API key may be invalid or expired.",
  "data": null
}

The --agent flag is an alias for --json. Both write spinners and progress to stderr so stdout is always clean, parseable JSON.

Node and Python Parity

Both the Node.js (@mem0/cli) and Python (mem0-cli) CLIs are implemented from the same specification (cli-spec.json). They share:

  • Identical command names, arguments, and flags
  • Identical output formats (text, json, table, quiet)
  • Identical entity ID resolution, graph tri-state, filter building
  • Identical error messages and exit codes

Choose whichever runtime you already have installed. The behavior is the same.

Common Edge Cases

  • Async processing delay: After mem0 add, memories process asynchronously. Wait 2-3 seconds before searching for newly added content. Use mem0 event list to check processing status.
  • `--all` vs `--entity` delete modes: mem0 delete --all -u alice deletes all memories for user alice. mem0 delete --entity -u alice deletes the entity itself AND all its memories (cascade). These are mutually exclusive modes.
  • Entity ID resolution: If you pass any explicit scope flag (e.g. --user-id), the CLI uses ONLY the explicit IDs and ignores config defaults. If no scope flags are given, all configured defaults apply.
  • Stdin detection: When no text argument is provided and input is piped (not a TTY), the CLI reads from stdin. Works with add, search, and update.

References

Load these on demand for deeper detail:

TopicFile
Command reference (all commands, flags, options, examples)references/command-reference.md
Configuration (config file, env vars, precedence, init wizard)references/configuration.md
Workflows (piping, scripting, CI/CD, agent mode recipes)references/workflows.md

Related Mem0 Skills

SkillWhen to useLink
mem0Python/TypeScript SDK, REST API, framework integrationslocal / GitHub
mem0-vercel-ai-sdkVercel AI SDK provider with automatic memorylocal / GitHub

Related skills

How it compares

Pick mem0-cli over the mem0 SDK skill when memory operations run from a terminal, shell script, or CI job rather than in-process application code.

FAQ

How do you install mem0-cli?

mem0-cli installs via npm install -g @mem0/cli (Node.js 18+) or pip install mem0-cli (Python 3.10+). Both packages expose a mem0 binary with identical commands, flags, and output formats.

How does mem0-cli support AI agents?

mem0-cli supports agents with mem0 init --agent --agent-caller <name> --json, which mints an evaluation API key in under five seconds. The --json and --agent flags return structured JSON envelopes on stdout for LLM consumption.

When should mem0-cli not be used?

mem0-cli is for terminal and shell usage. For programmatic SDK integration in Python or TypeScript application code, use the mem0 skill; for Vercel AI SDK, use mem0-vercel-ai-sdk.

CLI & Terminalagentsautomation

This week in AI coding

Five minutes, every Monday - the tools, releases and tactics for developers.

unsubscribe anytime.