MCPInstall

mem0-integrate

Integrate Mem0 into an existing repository using a goal-driven, TDD pipeline. Detects the repo's language automatically and asks the user to pick between Mem0 Platform (managed) and Mem0 Open Source (self-hosted). Writes failing tests before any implementation. Produces a local feature branch plus .mem0-integration/ artifacts consumed by the paired verification skill. TRIGGER when: user says "integrate mem0", "add mem0 to this repo", "wire mem0 into ", or asks how to add memory to an existing project. DO NOT TRIGGER when: the user wants general SDK usage (use skill:mem0), CLI usage (use skill:mem0-cli), or Vercel AI SDK (use skill:mem0-vercel-ai-sdk). After success, invoke skill:mem0-test-integration to verify in the same workspace (loose coupling).

Installs
402
Last 24h
—
Trending rank
—
Security
Not audited

Install

Works with every agent the skills CLI supports.

npx skills add https://github.com/mem0ai/mem0 --skill mem0-integrate
  1. 01

    Install

    Run the command in your project. The CLI asks which agents to install for.

  2. 02

    Describe the task

    Ask your agent for something this skill covers. It loads mem0-integrate automatically when relevant.

  3. 03

    Review the result

    The agent follows the SKILL.md steps, scripts and references bundled with the skill.

SKILL.md

The instructions your agent reads when the skill is triggered.

mem0-integrate

Wire Mem0 into an existing repo with a goal-driven, test-first pipeline. Pairs with mem0-test-integration for verification.

Canonical sources (fetch before deciding anything)

The skill MUST WebFetch these URLs before step 3 and cite them in plan.md. They are the ground truth — do not rely on ambient knowledge of the Mem0 API.

Agent-ready docs

Published Mem0 skills — delegate; do not reimplement

Prefer these over writing your own call-site patterns. Each is a standalone SKILL.md with triggers, examples, and version-pinned code.

SDK source (read when docs are ambiguous)

Public repo. Cross-check against the mem0_tested_versions range in this skill's frontmatter if the main branch has moved past a major.

Quickstarts (for bootstrapping unfamiliar stacks)

Integration principles (non-negotiable)

The true goal of this skill is to produce a PR the maintainers can accept without argument. That rules out anything invasive.

  1. Additive, not replacing. If the target repo already has a memory system, a session store, a user-context layer, or anything named Memory / memory_*, Mem0 sits alongside it, not in place of it. The existing system keeps working unchanged.
  2. Opt-in by default. Gate all new Mem0 code behind a feature flag (env var like MEM0_ENABLED=1, a config key, or a strategy selector). With the flag unset, behavior is the repo's original behavior, byte-for-byte.
  3. No breakage. No removed exports, no renamed public functions, no changed method signatures, no modified existing tests, no changed behavior of existing tests. All pre-existing tests must pass unchanged both with the flag set and unset.
  4. Minimal dependency surface. Add mem0ai (plus any deps the delegated skill requires) and nothing else. No new vector stores, no graph databases, no provider SDKs the repo does not already use.
  5. Separable commits. Code, tests, and config/docs land in separate commits so reviewers can cherry-pick.
  6. The null hypothesis wins. If no additive, gated fit exists after step 6 (plan), exit with code 1 and a rationale. A bad PR is worse than no PR.
  7. Backend only. Mem0 integration lives in server-side code. API keys, memory scope, and user-identity resolution are not safe client-side. If the repo has both backend and frontend, the call sites live in backend files. Frontend-only repos are rejected at preconditions.

Enforced at four gates: preconditions (reject frontend-only repos and repos where additive fit is impossible), step 2 comprehension (confirm a backend exists and name candidate surfaces), step 6 plan review (reject plans that mutate existing exports or name client-side call sites), and step 10 self-healing loop (refuse to "fix" principle violations — surface them instead).

Skill delegation rules

Before writing any code, check whether a published skill already covers the target stack. If yes, delegate — copy its call-site pattern into plan.md and into the tests; do not paraphrase.

Detected in target repoDelegate toWhy
@ai-sdk/* + ai in package.jsonskills/mem0-vercel-ai-sdkIntegration is via createMem0 provider wrapper, not raw MemoryClient.
CLI-only repo (Typer, Commander, Click, Cobra) with no LLM call sitesskills/mem0-cliCall sites are command handlers, not model wrappers. Consider whether mem0 actually fits first.
Target is an MCP client / editor config (Claude Code, Cursor, Codex settings)integrations/mem0-agent-pluginLocal stdio MCP server (one search tool) plus skills, no hooks or automatic capture; for a hosted endpoint use https://mcp.mem0.ai/mcp. No SDK code usually needed.
Any other Python or TS repo with an LLM call siteskills/mem0Default SDK integration path.

Record the delegated skill's raw URL in plan.md under a "Delegated skill:" field. The test writer in step 7 and the implementation subagent in step 8 both read this field.

Preconditions

Refuse to start unless ALL of the following are true:

  • Current working directory is inside a git repository with a clean index (no uncommitted changes). Protects the user's work — every edit lands on a feature branch, not on top of in-progress changes.
  • Repo has a detectable language (package.json / pyproject.toml / requirements.txt). No language → exit cleanly with a written rationale.
  • Repo has a backend. Detected by: a backend/ or server/ or api/ directory; a Python package with FastAPI/Flask/Django/Starlette; a Node package with Express/Fastify/Koa/NestJS/Next-API-routes; an agent-loop framework (LangGraph, LangChain, LlamaIndex, Agno). Frontend-only repos (pure React/Vue/Svelte SPAs, static sites, mobile-only) → exit with code 1 and a rationale. Mem0 is not installed client-side.
  • The user has already decided Mem0 fits this repo. This skill does NOT survey the codebase to justify fit — bring a concrete goal. (Step 2 does read the repo to understand what it does and locate backend integration surfaces; that is mechanics, not fit-justification.)

Exit with a written rationale if any precondition fails. Do not try to "make it work anyway."

Pipeline

Ten steps. Full mechanics, document templates, and gate rules are in references/pipeline.md. Read that file when you start executing a step; the summary below is only for routing.

#StepGate
1Language detection. package.json / pyproject.toml / requirements.txt. Monorepo, ask which subdirectory.
2Repo comprehension. Budgeted read of README, contributor docs, entry points, top two directory levels. Produces repo-summary.md with ranked backend surfaces.User confirms the summary and picks a surface. No backend surface, exit 1.
3Product selection. Platform vs OSS, recommended from dependency signals, never asked blank.Locked into goal.md, never re-decided.
4API key check. MEM0_API_KEY (Platform) or OPENAI_API_KEY (OSS). Missing on Platform, default to Agent Mode via mem0 init --agent.CI mode with a missing key, exit 2.
5Goal doc. goal.md: what gets stored, when it is retrieved, why, product, delegated skill, out of scope.Hard gate. Explicit approval required. 3 rejections, exit 3.
6Integration plan. Scoped grep for call sites and identity source. plan.md: write/read patterns, scoping, call sites, dependencies, preserved behavior, coexistence, feature flag, sources, E2E recipe.Hard gate. No plausible additive call site or 3 rejections, exit 5.
7Tests first. Failing write and read tests in the repo's native framework, assertion shapes lifted from the canonical signatures. Must be importable with MEM0_API_KEY unset.Tests must fail. If they pass, they are wrong.
8Implementation. Fresh-context subagent, prompt in references/subagent-prompts.md, returns a diff reviewed against plan.md and goal.md.3 review loops, then exit 4.
9Commit and handoff. Branch mem0-integrate/<slug>, four separable commits: dependency, module, wiring, tests.--no-heal stops here.
10Self-healing loop. Runs /mem0-test-integration --ci, categorizes the failure, spawns a bounded remediation subagent, reverts on regression.Pre-existing test failure, stop, exit 6. Never "fix" it.

Artifacts (all under .mem0-integration/)

FilePurposeRetention
repo-summary.mdRepo comprehension + candidate backend surfaces (step 2).Keep across runs.
goal.mdApproved intent. Never rewritten after step 6.Keep across runs.
plan.mdApproved mechanics (where, how, call sites, preserved behavior).Keep across runs.
trace.jsonlEvery tool call, decision, and subagent exchange this run.Overwritten per run.
diff.patchThe committed integration as a reviewable patch.Overwritten per run.
heal-trace.mdPer-attempt record of the self-healing loop (step 10).Overwritten per run.
product.json{"product": "platform"|"oss", "language": "...", "mem0_version": "...", "write_site": "file:line", "read_site": "file:line", "feature_flag": "MEM0_ENABLED", "preferred_site": "<surface index from step 2>"}, consumed by the verification skill.Overwritten per run.

.mem0-integration/ is added to .gitignore on first run. Nothing is written outside this directory and the repo's source tree.

Modes

ModeTriggerBehavior
Interactive (default)TTY present, MEM0_INTEGRATE_CI unsetAsks for keys, confirms goal doc, shows recommendations.
CIMEM0_INTEGRATE_CI=1Requires keys in env, requires --product, auto-approves goal doc from goal.md if present, fails fast otherwise.

Invocation

/mem0-integrate                            # interactive, heal ON
/mem0-integrate --no-heal                  # stop after commit; manual verify
/mem0-integrate --heal-max 5               # cap heal attempts per category (default 3)
/mem0-integrate --product platform         # skip the product ask
/mem0-integrate --product oss
/mem0-integrate --ci                       # non-interactive (for test harness)

Exit codes

CodeMeaning
0Success. Feature branch committed; verification skill ready to run.
1Precondition failed (dirty repo, no detectable language, etc.).
2Missing env key in CI mode.
3Goal doc rejected 3+ times — integration is not well-specified.
4Subagent review loop did not converge in 3 rounds.
5Integration plan rejected 3+ times, or no plausible additive call site found.
6Self-healing loop did not converge, detected a non-invasiveness violation, or a pre-existing test failed.

Explicitly out of scope

  • Surveying the repo for fit points. Humans decide where Mem0 helps before invoking this skill.
  • Replacing any existing memory / session / state system. Always additive and feature-flagged; see "Integration principles."
  • Modifying pre-existing tests, even to "fix" them under self-heal. Tests that fail after integration with the flag unset are a non-invasiveness violation, not a bug to patch.
  • Deciding Platform vs OSS silently. Always ask with a recommendation.
  • Switching branches, pushing, or opening PRs. Commits locally and stops (or enters the heal loop, still local).
  • Data migration between stores. Point user at migration/oss-to-platform docs if they ask.
  • Provider selection beyond the default LLM for OSS. If they need a custom LLM / embedder / vector store, route to components/* docs and re-run step 4 with the new key.

FAQ

What does the mem0-integrate skill do?

Integrate Mem0 into an existing repository using a goal-driven, TDD pipeline. Detects the repo's language automatically and asks the user to pick between Mem0 Platform (managed) and Mem0 Open Source (self-hosted). Writes failing tests before any implementation. Produces a local feature branch plus .mem0-integration/ artifacts consumed by the paired verification skill. TRIGGER when: user says "integrate mem0", "add mem0 to this repo", "wire mem0 into ", or asks how to add memory to an existing project. DO NOT TRIGGER when: the user wants general SDK usage (use skill:mem0), CLI usage (use skill:mem0-cli), or Vercel AI SDK (use skill:mem0-vercel-ai-sdk). After success, invoke skill:mem0-test-integration to verify in the same workspace (loose coupling).

How do I install mem0-integrate?

Run npx skills add https://github.com/mem0ai/mem0 --skill mem0-integrate in your project. The skills CLI detects the agents you use and copies the skill into the right folder. For Claude Code you can also place the skill folder at ~/.claude/skills/mem0-integrate/ (personal) or .claude/skills/mem0-integrate/ (project).

Which AI agents can use mem0-integrate?

Any agent that supports the open Agent Skills format (a folder with a SKILL.md file), including Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, Windsurf, Cline, OpenCode and more.

Is mem0-integrate safe to install?

No partner security audit is available yet. Skills can run commands and scripts, so read the SKILL.md and any bundled files before installing.

Who maintains mem0-integrate?

It is published by mem0ai in mem0ai/mem0. It has 402 recorded installs.

More from mem0ai/mem0

View all →

mem0

mem0ai/mem0

Mem0 Platform SDK for adding persistent memory to AI applications. TRIGGER when: user mentions "mem0", "MemoryClient", "memory layer", "remember user preferences", "persistent context", "personalization", or needs to add long-term memory to chatbots, agents, or AI apps. Covers Python SDK (mem0ai), TypeScript SDK (mem0ai), and framework integrations (LangChain, CrewAI, OpenAI Agents SDK, Pipecat, LlamaIndex, AutoGen, LangGraph). Also covers the open-source self-hosted Memory class. This is the DEFAULT mem0 skill for ambiguous queries. DO NOT TRIGGER when: user asks about CLI commands, terminal usage, or shell scripts (use mem0-cli), or Vercel AI SDK / @mem0/vercel-ai-provider / createMem0 (use mem0-vercel-ai-sdk).

AI & Agents2.3K installs

mem0-cli

mem0ai/mem0

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

DevOps & Cloud778 installs

Mem0 provider for Vercel AI SDK (@mem0/vercel-ai-provider). TRIGGER when: user mentions "vercel ai sdk", "@mem0/vercel-ai-provider", "createMem0", "retrieveMemories", "addMemories", "getMemories", "searchMemories", "mem0 vercel", "AI SDK provider", "AI SDK memory", or is using generateText/streamText with mem0. Also triggers for Next.js apps needing memory-augmented AI. DO NOT TRIGGER when: user asks about direct Python/TS SDK calls without Vercel (use mem0 skill), or CLI terminal commands (use mem0-cli skill).

AI & Agents514 installs

Open the skill to read its SKILL.md instructions.

Testing & QA327 installs

Open the skill to read its SKILL.md instructions.

186 installs

remember

mem0ai/mem0

Acknowledge a "remember this" request and make sure it is captured well. Use when the user explicitly asks to remember, note, or save something for future sessions.

145 installs

Popular testing & qa skills

View category →

tdd

mattpocock/skills

Test-driven development. Use when the user wants to build features or fix bugs test-first, mentions "red-green-refactor", or wants integration tests.

Testing & QA1.2M installs

grilling

mattpocock/skills

Grill the user relentlessly about a plan, decision, or idea. Use when the user wants to stress-test their thinking, or uses any 'grill' trigger phrases.

Testing & QA996.2K installs

migrate-to-shoehorn

mattpocock/skills

Migrate test files from as type assertions to @total-typescript/shoehorn. Use when user mentions shoehorn, wants to replace as in tests, or needs partial test data.

Testing & QA484.1K installs

run-train

lllllllama/rigorpilot-skills

Rigor Train skill for deep learning research repositories. Use when a documented or selected training command should be run conservatively for startup verification, short-run verification, full kickoff, or resume, with command, config, seed, log, checkpoint, status, and metric evidence written to standardized trainoutputs/. Do not use for environment setup, exploratory sweeps, speculative idea implementation, or end-to-end orchestration.

Testing & QA337.8K installs

test-driven-development

obra/superpowers

Use when implementing any feature or bugfix, before writing implementation code

Testing & QA261.8K installs

Use when implementation is complete, all tests pass, and you need to decide how to integrate the work

Testing & QA216.8K installs