Agent skill

Mem0 Integration Pipeline

by mem0ai in mem0ai/mem0

Adds Mem0 memory to an existing repository with a test-first pipeline that detects the language, lets you choose Platform or open source, and leaves a local feature branch.

Apache-2.0Auto-check passedAgent Workflows

Install Mem0 Integration Pipeline

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

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

GitHub CLI
$ gh skill install mem0ai/mem0 mem0-integrate --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-integrate .claude/skills/mem0-integrate && 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-integrate
GitHub stars
67k
Token cost
~3.3k tokens
SKILL.md length
1,505 words
Files
5 (incl. references)
Skills in repo
26
Repo updated
First seen
Licence
Apache-2.0

At a glance

Adds Mem0 memory to an existing repository with a test-first pipeline that detects the language, lets you choose Platform or open source, and leaves a local feature branch.

  • Works in 7 steps: Additive, not replacing. If the target… → Opt-in by default. Gate all new Mem0… → No breakage. No removed exports, no… → …
  • Adding long-term memory to an existing project with Mem0
  • SKILL.md covers Canonical sources (fetch…, Integration principles…, Skill delegation rules and Preconditions, plus 6 more sections
  • Reaches mcp.mem0.ai; needs MEM0_API_KEY and OPENAI_API_KEY

What it does

The skill wires Mem0 into a codebase in a goal-driven way. It detects the repository's language, asks you to choose between Mem0 Platform (managed) and Mem0 Open Source (self-hosted), writes failing tests before any implementation, and produces a local feature branch plus a .mem0-integration folder of artifacts that the paired mem0-test-integration skill uses to verify the work. Before deciding anything it must fetch the Mem0 docs index, full docs, OpenAPI spec and quickstarts and cite them in plan.md.

Its principles aim at a pull request maintainers can accept: additive rather than replacing, so an existing memory or session system keeps working with Mem0 alongside it, and opt-in by default behind a feature flag. It prefers delegating to published Mem0 skills for the SDK, CLI and Vercel AI SDK over reimplementing call patterns, and sends those general-usage requests elsewhere. The excerpt is cut off after the second principle.

When your agent uses it

  • Adding long-term memory to an existing project with Mem0
  • Choosing between managed Mem0 Platform and self-hosted Mem0 Open Source
  • Integrating Mem0 without disturbing a repo's current session or memory layer
  • Producing a reviewable feature branch with tests for a Mem0 integration

Example prompts

  • “Integrate Mem0 into this repo and ask me whether to use Platform or Open Source.”
  • “Add Mem0 memory to our support bot behind a feature flag, tests first.”
  • “Wire Mem0 into this TypeScript project without replacing our existing session store.”
  • “Plan a Mem0 integration for this codebase and cite the docs you used in plan.md.”

Requirements

  • Network access to the Mem0 documentation
  • A repository where a feature branch can be created

Workflow steps

7 steps, taken from the first numbered list in SKILL.md.

  1. Additive, not replacing. If the target repo already has a memory
  2. Opt-in by default. Gate all new Mem0 code behind a feature flag
  3. No breakage. No removed exports, no renamed public functions,
  4. Minimal dependency surface. Add mem0ai (plus any deps the
  5. Separable commits. Code, tests, and config/docs land in separate
  6. The null hypothesis wins. If no additive, gated fit exists after
  7. Backend only. Mem0 integration lives in server-side code. API keys,

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

    No scripts in the folder and no shell commands in SKILL.md.

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

  • Network

    Hosts in commands or code, which the agent is likely to contact:

    • mcp.mem0.ai

    Also links to:

    • docs.mem0.ai

    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
    • OPENAI_API_KEY

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

Context cost

Mem0 Integration Pipeline loads about 3.3k tokens when it runs, and up to ~8.2k if it reads all its reference files. Until then it costs about 196 tokens; SKILL.md has 1,505 words of instructions outside code blocks.

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

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 passed

The automated check found no risky patterns in SKILL.md.

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). 1,505 words, ~3,276 tokens.

Download SKILL.mdSave it as .claude/skills/mem0-integrate/SKILL.md (or your agent's skills folder). This skill also uses 4 other files; get the full folder from GitHub.
name
mem0-integrate
description
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 <repo>", 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).
license
Apache-2.0
metadata.author
mem0ai
metadata.version
0.1.1
metadata.category
ai-memory
metadata.tags
memory, integration, tdd, platform, oss
metadata.mem0_tested_versions
mem0ai (PyPI) >=2.0.0,<3.0.0; mem0ai (npm) >=3.0.0,<4.0.0

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

Show full SKILL.md (648 more words)Show less

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.

© 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 4 other files (references) in skills/mem0-integrate of mem0ai/mem0.

  • SKILL.md
  • LICENSE
  • README.md
  • references/pipeline.md
  • references/subagent-prompts.md

Open the folder on GitHubat commit b7ad69a

Compare with similar skills

Mem0 Integration Pipeline 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 Integration Pipeline compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Mem0 Integration Pipeline this skillmem0ai/mem067k—~3.3kAutomated safety check: PassApache-2.0
Hyperspacedb MemoryYARlabs/hyperspace-db162—~880Automated safety check: PassMIT
Add an MCP Tool to remindbradimsem/remindb129—~2.1kAutomated safety check: PassMIT
MemPalace Memory SearchMemPalace/mempalace59k—~1.4kAutomated safety check: PassMIT
MemPalace Setup and OperationMemPalace/mempalace59k—~2.2kAutomated safety check: PassMIT
agentmemory Setup and Diagnosticsrohitg00/agentmemory29k—~1kAutomated safety check: NotesApache-2.0

Similar skills

  • Hyperspacedb Memory

    YARlabs/hyperspace-db

    Zero-overhead cognitive long-term and episodic memory for AI agents (Mem0 drop-in and mcp-hyperspace-memory).

    162 GitHub stars~880 tokensUpdated today
    Agent WorkflowsAuto-check passed
  • Checklist for adding a new Memory-prefixed tool to remindb's Go MCP server: tool file, registration, test, skill docs, plus the locking and logging rules.

    129 GitHub stars~2.1k tokensUpdated 2 mo ago
    Agent WorkflowsAuto-check passed
  • MemPalace Memory Search

    MemPalace/mempalace

    Mines project files and conversation exports into a local, searchable memory palace and recalls past work by semantic search through the mempalace CLI.

    59k GitHub stars~1.4k tokensUpdated yesterday
    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 yesterday
    Agent WorkflowsAuto-check passed
  • Sets up and troubleshoots a local agentmemory install, covering the MCP connection, environment variables, ports, authentication and optional feature flags.

    29k GitHub stars~1k tokensUpdated today
    Agent WorkflowsAuto-check: notes
  • Claude-Mem Install for Grok Bot

    thedotmack/claude-mem

    Use this when setting up claude-mem on Grok Bot: local worker plus CMEM Pro observer (default), optional host-login observer, or remote cmem.ai. No Cursor…

    99k GitHub stars~440 tokensUpdated today
    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 1 repo~2.2k tokens
    Auto-check passed
  • 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.

    67k GitHub stars~2k tokensUpdated today
    Auto-check: notes
  • 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

Questions about Mem0 Integration Pipeline

What does Mem0 Integration Pipeline do?

Adds Mem0 memory to an existing repository with a test-first pipeline that detects the language, lets you choose Platform or open source, and leaves a local feature branch. The skill wires Mem0 into a codebase in a goal-driven way.mem0-integration folder of artifacts that the paired mem0-test-integration skill uses to verify the work.

When should I use Mem0 Integration Pipeline?

Mem0 Integration Pipeline fits situations like: adding long-term memory to an existing project with Mem0; choosing between managed Mem0 Platform and self-hosted Mem0 Open Source; integrating Mem0 without disturbing a repo's current session or memory layer; producing a reviewable feature branch with tests for a Mem0 integration.

How do I install Mem0 Integration Pipeline in Claude Code?

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

How do I install Mem0 Integration Pipeline in Codex?

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

Can I use Mem0 Integration Pipeline 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-integrate -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-integrate, .gemini/skills/mem0-integrate, .github/skills/mem0-integrate and .opencode/skills/mem0-integrate in your project.

What does Mem0 Integration Pipeline need to run?

Going by SKILL.md and its folder, Mem0 Integration Pipeline needs credentials named MEM0_API_KEY and OPENAI_API_KEY. Our summary lists: Network access to the Mem0 documentation; A repository where a feature branch can be created.

Does Mem0 Integration Pipeline access the network?

SKILL.md names 2 domains. In commands or code: mcp.mem0.ai; the agent is likely to contact it when it follows the instructions. As links in the text: docs.mem0.ai. This is read from the text; nothing was executed.

Is Mem0 Integration Pipeline safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Mem0 Integration Pipeline use?

Mem0 Integration Pipeline 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 Integration Pipeline use?

About 3.3k tokens (SKILL.md is roughly 13k 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 5k tokens, read only when the agent opens those files.

What are the alternatives to Mem0 Integration Pipeline?

Skills that share tags, products or a category with Mem0 Integration Pipeline: Hyperspacedb Memory (YARlabs/hyperspace-db, 162 stars), Add an MCP Tool to remindb (radimsem/remindb, 129 stars), MemPalace Memory Search (MemPalace/mempalace, 59k stars) and MemPalace Setup and Operation (MemPalace/mempalace, 59k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Mem0 Integration Pipeline?

mem0ai (a GitHub organization) maintains it in mem0ai/mem0, which has 66,867 GitHub stars. The repository holds 26 skills in this directory. The repository was last updated on October 9, 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.