a2516269cc
CLI now consumes the unified mem0_notice surface that the platform side
emits for unclaimed Agent Mode keys. The notice is a directive to the
LLM agent reading the output, with a verbatim sentence to relay to the
human owner. Two presentation paths:
- Human/text output: yellow stderr banner after the primary output,
once per command. Skipped in agent mode (the JSON envelope carries
it instead, so no duplication).
- JSON/agent output (--json/--agent): folded into the envelope as
"mem0_notice" so an agent parsing the output sees it without
inspecting HTTP headers.
CLI changes (Python + Node, kept in lockstep):
- state.{ts,py}: captureNotice / takeNotice helpers — last-write-wins
stash so multi-request commands fire the notice exactly once.
- backend/platform.{ts,py}: _request extracts notice from response
bodies (top-level dict or list[0]) with header fallback, strips
from downstream payload, captures for end-of-command surfacing.
- output.{ts,py}: JSON envelope formatters fold in any pending notice.
- index.ts / app.py: entrypoint surfaces notice on exit when not in
agent mode.
- commands/agent-mode.{ts,py}: init success path prints the platform's
notice verbatim (fallback to dim claim-command line if a stale
backend doesn't return it).
Init-flag handling fix: the Python argv preprocessor was stripping
--agent from sys.argv unconditionally as the global JSON-output alias.
That swallowed `mem0 init --agent` (where --agent is a subcommand flag
for unattended bootstrap). Now preserved when "init" is in argv.
Parity tests: cli/python/tests/test_agent_mode.py and
cli/node/tests/agent-mode.test.ts — 7 tests each, kept in sync.
cli-spec.json updated: init now lists --agent and --source.
Docs:
- README.md: Agent Mode promo at top of Quickstart.
- docs/llms.txt: fast-path block for AI agents reading the docs.
- skills/mem0/SKILL.md, skills/mem0-cli/SKILL.md,
skills/mem0-integrate/SKILL.md, mem0-plugin/skills/mem0/SKILL.md:
autonomous-setup section + fallback hints.
- mem0-plugin/README.md, openclaw/README.md: "Quick path for agents"
blocks above the human Quick Start.
Mem0 CLI Skill for Claude
Manage memories from the terminal using the Mem0 CLI. This skill teaches Claude how to use every mem0 command, flag, and output mode -- for both the Node.js and Python implementations.
What This Skill Does
When installed, Claude can:
- Run mem0 commands correctly in your terminal (add, search, list, get, update, delete, import, config, init, status, entity, event)
- Construct complex invocations with the right flags, scoping, filters, and output formats
- Pipe and script mem0 commands in shell workflows, CI/CD pipelines, and agent loops
- Debug issues like missing API keys, entity scoping conflicts, and async processing delays
Installation
CLI (Claude Code, OpenCode, OpenClaw, or any tool that supports skills)
npx skills add https://github.com/mem0ai/mem0 --skill mem0-cli
Claude.ai
- Download this
skills/mem0-clifolder as a ZIP - Go to Settings > Capabilities > Skills
- Click Upload skill and select the ZIP
Claude API (Skills API)
curl -X POST https://api.anthropic.com/v1/skills \
-H "x-api-key: $ANTHROPIC_API_KEY" \
-H "Content-Type: application/json" \
-d '{"name": "mem0-cli", "source": "https://github.com/mem0ai/mem0/tree/main/skills/mem0-cli"}'
Prerequisites
-
A Mem0 Platform API key (Get one here)
-
Node.js 18+ or Python 3.10+
-
Install the CLI:
# Node.js npm install -g @mem0/cli # Python pip install mem0-cli -
Set the environment variable:
export MEM0_API_KEY="m0-your-api-key"Or run
mem0 initfor the interactive setup wizard.
Quick Start
After installing, just ask Claude:
- "Add a memory for user alice that she prefers dark mode"
- "Search alice's memories for dietary preferences"
- "List all memories and output as JSON"
- "Delete all memories for user bob"
- "Set up mem0 CLI in my CI pipeline"
- "Pipe the output of my script into mem0 add"
What's Inside
skills/mem0-cli/
├── SKILL.md # Skill definition and instructions
├── README.md # This file
├── LICENSE # Apache-2.0
└── references/ # Documentation (loaded on demand)
├── command-reference.md # Every command, flag, option, and example
├── configuration.md # Config file, env vars, precedence, init wizard
└── workflows.md # Piping, scripting, CI/CD, agent mode recipes
Links
Skill Graph
This skill is part of the Mem0 skill graph -- three interconnected skills for different interfaces to the Mem0 platform:
| Skill | Purpose | Link |
|---|---|---|
| mem0 | Python/TypeScript SDK, REST API, framework integrations | local / GitHub |
| mem0-cli (this skill) | Terminal commands for memory operations | local / GitHub |
| mem0-vercel-ai-sdk | Vercel AI SDK provider with automatic memory | local / GitHub |
License
Apache-2.0