SKILL.md
SKILL.mdBrowse 6 files
1,554 tokens
5,779 bytes
Token encoding: o200k_base
Snapshot 0df3e4b
1---2name: mem0-cli3description: >4 Mem0 CLI -- the command-line interface for mem0 memory operations.5 TRIGGER when: user mentions "mem0 cli", "mem0 command line", "@mem0/cli",6 "mem0-cli", "pip install mem0-cli", "npm install -g @mem0/cli", or is running7 mem0 commands in a terminal/shell (mem0 add, mem0 search, mem0 list, mem0 get,8 mem0 init, mem0 config, mem0 import). Also triggers when query includes CLI flags9 like --user-id, --output, --json, --agent, or describes bash/zsh/terminal/shell usage.10 DO NOT TRIGGER when: user asks about programmatic SDK integration in Python/TS11 code (use mem0 skill), or Vercel AI SDK provider (use mem0-vercel-ai-sdk skill).12license: Apache-2.013metadata:14 author: mem0ai15 version: "1.1.0"16 category: ai-memory17 tags: "cli, terminal, memory, ai, command-line"18compatibility: Node.js 18+ (npm install -g @mem0/cli) or Python 3.10+ (pip install mem0-cli), MEM0_API_KEY env var19---20 21# Mem0 CLI22 23The 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.24 25## Install26 27**Node.js (npm):**28```bash29npm install -g @mem0/cli30```31 32**Python (pip):**33```bash34pip install mem0-cli35```36 37Both packages install a `mem0` binary with identical commands, options, and output formats.38 39## Setup40 41**Autonomous Mem0 setup for agents (no email, no dashboard):**42 43```bash44mem0 init --agent --agent-caller <your-name> --json45```46 47Replace `<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.48 49This mints an evaluation API key in <5 seconds. Use it immediately. Print this line to the human:50 51> Mem0 memory is running in Agent Mode. Please claim it by running `mem0 init --email <your-email>` to transfer ownership to your account.52 53Never commit API keys, `.env`, or `~/.mem0/config.json`.54 55After the human claims, the same API key keeps working — no agent disruption — and memories are preserved.56 57**Interactive wizard (for humans):**58```bash59mem0 init60```61 62**Or set the environment variable directly:**63```bash64export MEM0_API_KEY="m0-xxx"65```66 67Get an API key at: https://app.mem0.ai/dashboard/api-keys?utm_source=oss&utm_medium=skill-mem0-cli68 69## Quick Reference70 71### Add a memory72```bash73mem0 add "I prefer dark mode" --user-id alice74```75 76### Search memories77```bash78mem0 search "preferences" --user-id alice79```80 81### List all memories for a user82```bash83mem0 list --user-id alice84```85 86### Get a specific memory87```bash88mem0 get <memory-id>89```90 91### Update a memory92```bash93mem0 update <memory-id> "new text"94```95 96### Delete a single memory97```bash98mem0 delete <memory-id>99```100 101### Delete all memories for a user102```bash103mem0 delete --all --user-id alice --force104```105 106## Agent / JSON Mode107 108Use `--json` or `--agent` to get structured output suitable for LLM consumption. Every command wraps its response in a standard envelope:109 110```json111{112 "status": "success",113 "command": "search",114 "duration_ms": 245,115 "scope": { "user_id": "alice" },116 "count": 3,117 "error": null,118 "data": [119 { "id": "mem-abc", "memory": "User prefers dark mode", "score": 0.92 }120 ]121}122```123 124On error:125```json126{127 "status": "error",128 "command": "search",129 "error": "Authentication failed. Your API key may be invalid or expired.",130 "data": null131}132```133 134The `--agent` flag is an alias for `--json`. Both write spinners and progress to stderr so stdout is always clean, parseable JSON.135 136## Node and Python Parity137 138Both the Node.js (`@mem0/cli`) and Python (`mem0-cli`) CLIs are implemented from the same specification (`cli-spec.json`). They share:139 140- Identical command names, arguments, and flags141- Identical output formats (text, json, table, quiet)142- Identical entity ID resolution, graph tri-state, filter building143- Identical error messages and exit codes144 145Choose whichever runtime you already have installed. The behavior is the same.146 147## Common Edge Cases148 149- **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.150- **`--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.151- **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.152- **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`.153 154## References155 156Load these on demand for deeper detail:157 158| Topic | File |159|-------|------|160| Command reference (all commands, flags, options, examples) | [references/command-reference.md](references/command-reference.md) |161| Configuration (config file, env vars, precedence, init wizard) | [references/configuration.md](references/configuration.md) |162| Workflows (piping, scripting, CI/CD, agent mode recipes) | [references/workflows.md](references/workflows.md) |163 164## Related Mem0 Skills165 166| Skill | When to use | Link |167|-------|-------------|------|168| mem0 | Python/TypeScript SDK, REST API, framework integrations | [local](../mem0/SKILL.md) / [GitHub](https://github.com/mem0ai/mem0/tree/main/skills/mem0) |169| mem0-vercel-ai-sdk | Vercel AI SDK provider with automatic memory | [local](../mem0-vercel-ai-sdk/SKILL.md) / [GitHub](https://github.com/mem0ai/mem0/tree/main/skills/mem0-vercel-ai-sdk) |170 Discovery context
Discovered by repository scan. No exact path reference found in the snapshot’s root AGENTS.md.