Agent skill

Mem0 CLI Memory Commands

by mem0ai in mem0ai/mem0

Adds, searches, lists, updates and deletes memories on the Mem0 platform from the terminal with the mem0 command, including a JSON mode built for agents.

Apache-2.0Auto-check: notesAgent Workflows

Install Mem0 CLI Memory Commands

skills CLI
$ npx skills add mem0ai/mem0 --skill mem0-cli -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install mem0ai/mem0 mem0-cli --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/mem0ai/mem0.git skills-src && mkdir -p .claude/skills && cp -r skills-src/skills/mem0-cli .claude/skills/mem0-cli && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
mem0-cli
GitHub stars
67k
Token cost
~2k tokens
SKILL.md length
822 words
Files
6 (incl. references)
Skills in repo
26
Repo updated
First seen
Licence
Apache-2.0

At a glance

Adds, searches, lists, updates and deletes memories on the Mem0 platform from the terminal with the mem0 command, including a JSON mode built for agents.

  • Saving a user preference to Mem0 from a shell or CI job
  • SKILL.md covers Install, Setup, Quick Reference and Agent / JSON Mode, plus 4 more sections
  • Calls npm and pip; needs MEM0_API_KEY
  • Searching stored memories from the terminal

What it does

The mem0 command line tool, installed from npm as @mem0/cli or from pip as mem0-cli, puts the same commands, options and output formats behind one binary. Everyday use covers adding a memory for a user ID, searching by query, listing, getting, updating and deleting a memory, and deleting all of a user's memories with a force flag.

Setup has three routes: an autonomous agent mode that mints an evaluation API key without email or dashboard and can be claimed later by the human, an interactive wizard for people, or setting MEM0_API_KEY directly. API keys, .env files and the mem0 config file are never to be committed.

Passing --json, or its alias --agent, wraps every response in a standard envelope with a status and command, writes spinners and progress to stderr and keeps stdout as clean JSON. Reference notes cover commands, configuration and workflows. Programmatic SDK use and the Vercel AI SDK provider have their own skills.

When your agent uses it

  • Saving a user preference to Mem0 from a shell or CI job
  • Searching stored memories from the terminal
  • Giving an agent persistent memory through the CLI
  • Deleting all memories for one user ID

Example prompts

  • “Add a memory that alice prefers dark mode using the mem0 CLI.”
  • “Search alice's memories for preferences and return JSON.”
  • “Initialize mem0 for this agent in agent mode.”

Requirements

  • Node.js 18 or newer, or Python 3.10 or newer
  • A MEM0_API_KEY, which agent mode can create for evaluation
  • Compatibility (from SKILL.md): Node.js 18+ (npm install -g @mem0/cli) or Python 3.10+ (pip install mem0-cli), MEM0_API_KEY env var

What it can do on your machine

Read from SKILL.md and the folder at commit b7ad69a. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    Shell commands in SKILL.md call:

    • npm
    • pip

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md. Its commands use npm and pip, which can reach the network depending on how they are called.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names these keys or tokens, usually read from environment variables:

    • MEM0_API_KEY

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

  • Compatibility

    Node.js 18+ (npm install -g @mem0/cli) or Python 3.10+ (pip install mem0-cli), MEM0_API_KEY env var

    From compatibility in the SKILL.md frontmatter.

Context cost

Mem0 CLI Memory Commands loads about 2k tokens when it runs, and up to ~15k if it reads all its reference files. Until then it costs about 159 tokens; SKILL.md has 822 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~159
When it runs · the whole SKILL.md, loaded when a task matches
~2k
With references · SKILL.md plus every file in references/, read only if the agent opens them
~15k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check: notes

The automated check noted patterns worth knowing about, such as sudo or a known installer.

  • NoteMentions a .env fileSKILL.md:54
    Never commit API keys, `.env`, or `~/.mem0/config.json`.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from mem0ai/mem0 at commit b7ad69a, republished under its Apache-2.0 licence (© mem0ai). 822 words, ~2,009 tokens.

Download SKILL.mdSave it as .claude/skills/mem0-cli/SKILL.md (or your agent's skills folder). This skill also uses 5 other files; get the full folder from GitHub.
name
mem0-cli
description
Mem0 CLI -- the command-line interface for mem0 memory operations. TRIGGER when: user mentions "mem0 cli", "mem0 command line", "@mem0/cli", "mem0-cli", "pip install mem0-cli", "npm install -g @mem0/cli", or is running mem0 commands in a terminal/shell (mem0 add, mem0 search, mem0 list, mem0 get, mem0 init, mem0 config, mem0 import). Also triggers when query includes CLI flags like --user-id, --output, --json, --agent, or describes bash/zsh/terminal/shell usage. DO NOT TRIGGER when: user asks about programmatic SDK integration in Python/TS code (use mem0 skill), or Vercel AI SDK provider (use mem0-vercel-ai-sdk skill).
compatibility
Node.js 18+ (npm install -g @mem0/cli) or Python 3.10+ (pip install mem0-cli), MEM0_API_KEY env var
license
Apache-2.0
metadata.author
mem0ai
metadata.version
1.2.0
metadata.category
ai-memory
metadata.tags
cli, terminal, memory, ai, command-line
metadata.mem0_tested_versions
mem0-cli (PyPI) >=0.2.13,<0.3.0; @mem0/cli (npm) >=0.2.14,<0.3.0; mem0ai (PyPI) >=2.0.0,<3.0.0; mem0ai (npm) >=3.0.0,<4.0.0

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):

bash
npm install -g @mem0/cli

Python (pip):

bash
pip install mem0-cli

Both packages install a mem0 binary with the same commands, options, and output formats (see Node and Python Differences for the exceptions).

Setup

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

bash
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):

bash
mem0 init

Or set the environment variable directly:

bash
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
bash
mem0 add "I prefer dark mode" --user-id alice
Search memories
bash
mem0 search "preferences" --user-id alice
List all memories for a user
bash
mem0 list --user-id alice
Get a specific memory
bash
mem0 get <memory-id>
Update a memory
bash
mem0 update <memory-id> "new text"
Delete a single memory
bash
mem0 delete <memory-id>
Delete all memories for a user
bash
mem0 delete --all --user-id alice --force

Agent / JSON Mode

Use --json or --agent to get structured output suitable for LLM consumption. Place the flag before the subcommand (mem0 --json search "q"), which works in both CLIs. Data commands (add, search, list, get, update, delete, import, config, entity, event, status) wrap their response in a standard envelope:

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

On error:

json
{
  "status": "error",
  "command": "search",
  "error": "Invalid or expired API key.",
  "data": null
}

The --agent flag is an alias for --json (except on mem0 init, where --agent is the Agent Mode bootstrap flag). Both write spinners and progress to stderr so stdout is clean, parseable JSON (the one exception is Node import, see below). Optional keys: duration_ms, scope, count appear only where relevant, and mem0_notice appears when the platform flags an unclaimed Agent Mode account.

Node and Python Differences

Both the Node.js (@mem0/cli) and Python (mem0-cli) CLIs share the command set, flags, entity ID resolution, filter building, and the JSON envelope. Choose whichever runtime you already have installed. Known differences:

  • --json / --agent placement: Python accepts the flag anywhere on the command line. Node reads it only as a global option, so put it before the subcommand (mem0 --json list). mem0 init --json and mem0 help --json work after the subcommand in both. For the Agent Mode bootstrap, Node starts it only from init --agent or init --json (a root-level mem0 --json init or mem0 --agent init does not start it, and without an agent runtime env var it fails with the non-TTY error), while Python also accepts those root-level forms. mem0 init --agent --json works in both.
  • --limit: mem0 search --limit is a Python-only alias for --top-k.
  • Agent-mode delete --all data: Python returns {"deleted": true} (plus scope for --project); Node returns the raw API result.
  • import JSON output: Python prints the envelope with scope. Node omits scope and writes the Importing memories... n/n progress line to stdout before the JSON, so only Python's output pipes cleanly to jq.
  • Message text: The empty-search error (Search query cannot be empty. in Python, No query provided... in Node) and the delete dry-run footers differ slightly.
Show full SKILL.md (282 more words)Show less

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.
  • --dry-run in --json/--agent mode: mem0 --json delete --all --dry-run still requires --force, then prints nothing and deletes nothing (exit 0). Node also prints nothing for single and --entity dry runs. Use text mode to see the preview.
  • --dry-run does not protect --all --project: mem0 delete --all --project --dry-run ignores the flag and deletes every memory in the project. Never use --dry-run to preview a project-wide delete.
  • 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 stdin is a pipe or a redirected file (a plain non-TTY is not enough), the CLI reads from stdin. Works with add, search, and update. In --json/--agent mode add never reads stdin (Python also skips it for search and update), so pass the text as an argument there.

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
SkillWhen to useLink
mem0Python/TypeScript SDK, REST API, framework integrationslocal / GitHub
mem0-vercel-ai-sdkVercel AI SDK provider with automatic memorylocal / GitHub

© mem0ai, Apache-2.0. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

SKILL.md and 5 other files (references) in skills/mem0-cli of mem0ai/mem0.

  • SKILL.md
  • LICENSE
  • README.md
  • references/command-reference.md
  • references/configuration.md
  • references/workflows.md

Open the folder on GitHubat commit b7ad69a

Compare with similar skills

Mem0 CLI Memory Commands next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Mem0 CLI Memory Commands compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Mem0 CLI Memory Commands this skillmem0ai/mem067k—~2kAutomated safety check: NotesApache-2.0
Install and Run Cogneetopoteretes/cognee32k1 repos~1kAutomated safety check: NotesApache-2.0
Cognee Session Memory and Improvetopoteretes/cognee32k—~3.2kAutomated safety check: PassApache-2.0
Neo4j Agent Memory Skillneo4j-contrib/neo4j-skills114—~5.8kAutomated safety check: PassMIT
MCP Server BuildershareAI-lab/learn-claude-code78k5 repos~1.2kAutomated safety check: PassMIT
MemPalace Setup and OperationMemPalace/mempalace59k—~2.2kAutomated safety check: PassMIT

Similar skills

  • Install and Run Cognee

    topoteretes/cognee

    Installs the cognee AI memory library in a Python environment, sets the LLM key and gets a first remember and recall script running with the Python SDK.

    32k GitHub starsUsed in 1 repo~1k tokens
    Agent WorkflowsAuto-check: notes
  • Explains how cognee stores session memory by session_id and bridges it into the permanent graph with improve(), including the stages, results and settings.

    32k GitHub stars~3.2k tokensUpdated today
    Agent WorkflowsAuto-check passed
  • Neo4j Agent Memory Skill

    neo4j-contrib/neo4j-skills

    Authoritative reference for the neo4j-agent-memory Python package — a graph-native memory system for AI agents built on Neo4j — and for the hosted service (NAMS) at memory.neo4jlabs.com.

    114 GitHub stars~5.8k tokensUpdated yesterday
    Agent WorkflowsAuto-check passed
  • MCP Server Builder

    shareAI-lab/learn-claude-code

    Walks through building MCP servers in Python or TypeScript that expose tools, resources and prompts to Claude, with templates, registration and testing.

    78k GitHub starsUsed in 5 repos~1.2k tokens
    Agent WorkflowsAuto-check passed
  • Installs and configures MemPalace as a private local palace, a shared-brain hub or a client of an existing hub, including MCP registration and version-correct initialization.

    59k GitHub stars~2.2k tokensUpdated today
    Agent WorkflowsAuto-check passed
  • Official

    Runs a nightly or on-demand sleep cycle for a local Codex agent: review past sessions, replay recurring tasks and stage validated skill and memory edits for adoption.

    18k GitHub stars~2.3k tokensUpdated yesterday
    Agent WorkflowsAuto-check passed

More from mem0ai/mem0

All 26 skills in this repo
  • Adds persistent memory to AI apps with the Mem0 Python and TypeScript SDKs: store, search, update and delete user memories, with framework integrations.

    67k GitHub starsUsed in 2 repos~2.2k tokens
    Auto-check passed
  • Adds persistent memory to Vercel AI SDK apps with the Mem0 provider, using a wrapped model or standalone retrieve and store utilities.

    67k GitHub stars~2.3k tokensUpdated today
    Auto-check passed
  • Finds and deletes specific mem0 memories by search query or ID, always asking for confirmation first, and can undo the most recent memories added this session.

    67k GitHub stars~664 tokensUpdated today
    Auto-check passed
  • Saves a fact, decision or preference the user states into mem0 as written, labeled with a memory type such as decision, convention or user_preference.

    67k GitHub stars~560 tokensUpdated today
    Auto-check passed
  • Shows or changes the default Mem0 memory scope, project, session or global, which decides where memories are saved and searched.

    67k GitHub stars~1.1k tokensUpdated today
    Auto-check passed
  • Looks up stored agent memories by keyword or ID and prints compact one-line results instead of full detail.

    67k GitHub stars~502 tokensUpdated today
    Auto-check passed

Works with

Questions about Mem0 CLI Memory Commands

What does Mem0 CLI Memory Commands do?

Adds, searches, lists, updates and deletes memories on the Mem0 platform from the terminal with the mem0 command, including a JSON mode built for agents. The mem0 command line tool, installed from npm as @mem0/cli or from pip as mem0-cli, puts the same commands, options and output formats behind one binary. Everyday use covers adding a memory for a user ID, searching by query, listing, getting, updating and deleting a memory, and deleting all of a user's memories with a force flag.

When should I use Mem0 CLI Memory Commands?

Mem0 CLI Memory Commands fits situations like: saving a user preference to Mem0 from a shell or CI job; searching stored memories from the terminal; giving an agent persistent memory through the CLI; deleting all memories for one user ID.

How do I install Mem0 CLI Memory Commands in Claude Code?

Run `npx skills add mem0ai/mem0 --skill mem0-cli -a claude-code`. Or copy the skill folder (skills/mem0-cli in mem0ai/mem0) into .claude/skills/mem0-cli in your project. Claude Code loads it when a task matches its description.

How do I install Mem0 CLI Memory Commands in Codex?

Run `npx skills add mem0ai/mem0 --skill mem0-cli -a codex`. Or copy the skill folder (skills/mem0-cli in mem0ai/mem0) into .agents/skills/mem0-cli in your project. Codex loads it when a task matches its description.

Can I use Mem0 CLI Memory Commands in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add mem0ai/mem0 --skill mem0-cli -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/mem0-cli, .gemini/skills/mem0-cli, .github/skills/mem0-cli and .opencode/skills/mem0-cli in your project.

What does Mem0 CLI Memory Commands need to run?

Going by SKILL.md and its folder, Mem0 CLI Memory Commands needs the command-line tools its instructions call (npm and pip) and credentials named MEM0_API_KEY. Our summary lists: Node.js 18 or newer, or Python 3.10 or newer; A MEM0_API_KEY, which agent mode can create for evaluation. Compatibility (from SKILL.md): Node.js 18+ (npm install -g @mem0/cli) or Python 3.10+ (pip install mem0-cli), MEM0_API_KEY env var.

Does Mem0 CLI Memory Commands access the network?

SKILL.md contains no URLs. Its commands use npm and pip, which can reach the network depending on how they are called. This is read from the text; nothing was executed.

Is Mem0 CLI Memory Commands safe to install?

Our automated static check of SKILL.md found notes only (mentions a .env file), nothing it rates as a warning. It is not a guarantee. Review the folder before installing.

What licence does Mem0 CLI Memory Commands use?

Mem0 CLI Memory Commands is published under the Apache-2.0 licence (declared in SKILL.md). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Mem0 CLI Memory Commands use?

About 2k tokens (SKILL.md is roughly 8k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full. Its references folder adds about 13k tokens, read only when the agent opens those files.

What are the alternatives to Mem0 CLI Memory Commands?

Skills that share tags, products or a category with Mem0 CLI Memory Commands: Install and Run Cognee (topoteretes/cognee, 32k stars), Cognee Session Memory and Improve (topoteretes/cognee, 32k stars), Neo4j Agent Memory Skill (neo4j-contrib/neo4j-skills, 114 stars) and MCP Server Builder (shareAI-lab/learn-claude-code, 78k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Mem0 CLI Memory Commands?

mem0ai (a GitHub organization) maintains it in mem0ai/mem0, which has 66,788 GitHub stars. The repository holds 26 skills in this directory. The repository was last updated on October 7, 2026.

Source: mem0ai/mem0 on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.