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

Install
npx skills add 'https://github.com/mem0ai/mem0/tree/main/skills/mem0-integrate'
Download bundle ↓
main · 0df3e4bScanned 2026-09-17

Contributors

GitHub-linked commit authors for this SKILL.md at the saved revision. Co-authors and history before file renames are not included.

File history ↗

references/subagent-prompts.md

references/subagent-prompts.mdBrowse 5 files
View on GitHub
← Back to SKILL.md

Subagent system prompts

Pass these verbatim. They are the only contract a fresh-context subagent gets, so paraphrasing them drops constraints the review step then has to catch.

Step 8: implementation

You are implementing a Mem0 integration for an existing repo.

Read these first:
- plan.md           (the mechanical contract)
- goal.md           (the intent, do not change it)
- the test files    (do not change them either)
- <delegated skill raw URL from plan.md>
- https://docs.mem0.ai/llms.txt
- https://docs.mem0.ai/openapi.json  (Platform only)

Constraints, all required, all enforced at review:

1. Touch only the files named in plan.md's call sites, or add
   strictly new files.
2. Do not remove or rename any existing symbol. Do not change
   any public signature.
3. Do not modify any existing test.
4. Gate every line of new Mem0 code behind the feature flag from
   plan.md. With the flag in its default state, the repo must
   behave exactly like `main`, byte-for-byte, including stdout
   and return values.
5. Use only the <Platform | OSS> SDK surface. No new dependencies
   beyond those listed under plan.md's "Dependencies to add."
6. Preserve everything listed under plan.md's "Preserved behavior"
   and "Coexistence."
7. Lazy client construction. `MemoryClient()` validates the API
   key in `__init__` (it makes a network call). Never instantiate
   it at module-import time, construct on first use inside the
   request / handler path. The same rule applies to OSS `Memory()`,
   which can eagerly initialize embedding and LLM providers. Use
   a function-local singleton (`functools.lru_cache`, a module-level
   `_client = None` plus getter, or DI scope), never a top-level
   global. Eager init breaks the pre-existing test suite at
   collection time whenever the key is missing or invalid, which
   is a non-invasiveness violation.

Implement the plan to make the new tests pass while all
pre-existing tests continue to pass unchanged.

Substitute <delegated skill raw URL from plan.md> and <Platform | OSS> before sending. Leave everything else as written.

Step 10: remediation

You are fixing a failing Mem0 integration test.

Non-negotiable constraints:
- Do not modify test files.
- Do not remove or rename any existing symbol or signature.
- Do not change pre-existing behavior. The feature flag from
  plan.md must still default to OFF, and with the flag in its
  default state the repo must behave exactly like main.
- Touch only the files named in plan.md's call sites, or add
  strictly new files.
- Return the smallest possible diff that fixes the single
  failing check listed in scorecard.md. No drive-by cleanup.

Never send this prompt for a pre-existing test failure. That is a non-invasiveness violation, and step 10 exits with code 6 instead of trying to heal it.

Referenced from SKILL.md