
Mem0 CLI
FreeManage memories directly from your command line.
Free · Opens the source repo
What Mem0 CLI does
Mem0 CLI is a command-line interface designed for interacting with the Mem0 memory platform. It allows users to perform a range of memory operations such as adding, searching, listing, updating, and deleting memories directly from the terminal. This tool is particularly useful for developers, AI agents, and CI/CD pipelines that require efficient memory management without the need for a graphical interface. By leveraging the CLI, users can automate tasks and integrate memory operations into their workflows seamlessly.
Installation is straightforward, with support for both Node.js and Python environments. Users can install the CLI via npm or pip, which provides a consistent experience across different programming environments. The commands and output formats are identical regardless of the runtime, ensuring that users can switch between Node.js and Python without any confusion. The CLI also supports JSON output for structured data handling, making it suitable for AI agents that need to process memory data programmatically.
The setup process is designed to be user-friendly, with options for both autonomous agent setup and interactive wizards for human users. This flexibility allows for quick integration into various workflows. The CLI commands are designed to be intuitive, with clear syntax for memory operations, and the ability to handle errors gracefully. Additionally, the tool includes features for managing API keys securely, ensuring that sensitive information is not compromised during use.
Overall, Mem0 CLI is an essential tool for anyone looking to manage memory operations efficiently from the command line, whether for personal projects, development tasks, or automated systems.
When to use it
Use Mem0 CLI when you need to manage memories quickly and efficiently from the command line, especially in automated workflows or CI/CD pipelines.
When not to use it
This tool is not suitable for users looking for a graphical interface or those who require programmatic SDK integration in Python or TypeScript.
What you can build with it
Automating Memory Management
Integrate Mem0 CLI into your CI/CD pipeline to automate memory operations, ensuring that memory updates happen seamlessly during your deployment process.
Terminal-Based Memory Search
Quickly search for user memories directly from the terminal using `mem0 search`, allowing for efficient retrieval of information without a GUI.
Agent Mode Setup
Set up Mem0 in agent mode for AI applications, enabling memory operations without user intervention, ideal for autonomous systems.
How to install Mem0 CLI
View source1. Install with the skills CLI
npx skills add mem0ai/mem0/mem0-cli --agent claude-code2. Or install it manually
Download the skill folder and drop it into ~/.claude/skills/ for all projects, or .claude/skills/ to scope it to one repo. Restart Claude Code so it picks up the new skill.
Anthropic's agentic coding CLI, and the reference implementation of Agent Skills. Drop a skill folder into ~/.claude/skills and Claude Code loads it automatically whenever a task matches the skill's description. Claude Code docs
Inside SKILL.md
Written by mem0aiMem0 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. Usemem0 event listto check processing status. --allvs--entitydelete modes:mem0 delete --all -u alicedeletes all memories for user alice.mem0 delete --entity -u alicedeletes 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, andupdate.
References
Load these on demand for deeper detail:
| Topic | File |
|---|---|
| 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
| Skill | When to use | Link |
|---|---|---|
| mem0 | Python/TypeScript SDK, REST API, framework integrations | local / GitHub |
| mem0-vercel-ai-sdk | Vercel AI SDK provider with automatic memory | local / GitHub |
Frequently asked questions about Mem0 CLI
Similar skills
Turborepo
Optimized build system for JavaScript/TypeScript monorepos.
Azure Pipelines Validation
Streamline your Azure DevOps pipeline changes locally.
Azure Developer CLI
Streamline your Azure project workflows with best practices.
Azure Container Registry CLI
Manage Azure Container Registry resources with ease.
Aspire
Build and orchestrate polyglot distributed applications seamlessly.
Vercel CLI
Manage and deploy Vercel projects from the command line.
