[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill-mem0-mem0-integrate":3,"mdc-oefacz-key":46,"related-repo-mem0-mem0-integrate":3144,"related-org-mem0-mem0-integrate":3234},{"slug":4,"name":4,"fn":5,"description":6,"org":7,"tags":12,"stars":23,"repoUrl":24,"updatedAt":25,"license":26,"forks":27,"topics":28,"repo":41,"sourceUrl":44,"mdContent":45},"mem0-integrate","integrate Mem0 into repositories","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\u002F` artifacts consumed by the paired verification skill. TRIGGER when: user says \"integrate mem0\", \"add mem0 to this repo\", \"wire mem0 into \u003Crepo>\", 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).\n",{"slug":8,"name":9,"logoUrl":10,"githubOrg":11},"mem0","Mem0","https:\u002F\u002Fpexgzepcugksgbtrxkhf.supabase.co\u002Fstorage\u002Fv1\u002Fobject\u002Fpublic\u002Forg-logos\u002Fmem0.png","mem0ai",[13,17,20],{"name":14,"slug":15,"type":16},"Memory","memory","tag",{"name":18,"slug":19,"type":16},"Agents","agents",{"name":21,"slug":22,"type":16},"API Development","api-development",60691,"https:\u002F\u002Fgithub.com\u002Fmem0ai\u002Fmem0","2026-07-13T06:12:46.60755","Apache-2.0",7066,[19,29,30,31,32,33,34,35,36,15,37,38,39,40],"ai","ai-agents","application","chatbots","chatgpt","genai","llm","long-term-memory","memory-management","python","rag","state-management",{"repoUrl":24,"stars":23,"forks":27,"topics":42,"description":43},[19,29,30,31,32,33,34,35,36,15,37,38,39,40],"Universal memory layer for AI Agents","https:\u002F\u002Fgithub.com\u002Fmem0ai\u002Fmem0\u002Ftree\u002FHEAD\u002Fskills\u002Fmem0-integrate","---\nname: mem0-integrate\ndescription: >\n  Integrate Mem0 into an existing repository using a goal-driven, TDD pipeline.\n  Detects the repo's language automatically and asks the user to pick between\n  Mem0 Platform (managed) and Mem0 Open Source (self-hosted). Writes failing\n  tests before any implementation. Produces a local feature branch plus\n  `.mem0-integration\u002F` artifacts consumed by the paired verification skill.\n  TRIGGER when: user says \"integrate mem0\", \"add mem0 to this repo\", \"wire\n  mem0 into \u003Crepo>\", or asks how to add memory to an existing project.\n  DO NOT TRIGGER when: the user wants general SDK usage (use skill:mem0),\n  CLI usage (use skill:mem0-cli), or Vercel AI SDK (use skill:mem0-vercel-ai-sdk).\n  After success, invoke skill:mem0-test-integration to verify in the same\n  workspace (loose coupling).\nlicense: Apache-2.0\nmetadata:\n  author: mem0ai\n  version: \"0.1.0\"\n  category: ai-memory\n  tags: \"memory, integration, tdd, platform, oss\"\n  mem0_tested_versions: \"mem0ai (PyPI) >=2.0.0,\u003C3.0.0; mem0ai (npm) >=3.0.0,\u003C4.0.0\"\n---\n\n# mem0-integrate\n\nWire Mem0 into an existing repo with a goal-driven, test-first pipeline.\nPairs with `mem0-test-integration` for verification.\n\n## Canonical sources (fetch before deciding anything)\n\nThe skill MUST `WebFetch` these URLs before step 3 and cite them in\n`plan.md`. They are the ground truth — do not rely on ambient knowledge\nof the Mem0 API.\n\n### Agent-ready docs\n- Scope-tagged docs index: https:\u002F\u002Fdocs.mem0.ai\u002Fllms.txt\n- Full docs (single file, deep dives): https:\u002F\u002Fdocs.mem0.ai\u002Fllms-full.txt\n- OpenAPI spec (Platform REST, machine-readable): https:\u002F\u002Fdocs.mem0.ai\u002Fopenapi.json\n- Hosted MCP server: https:\u002F\u002Fmcp.mem0.ai (requires Platform API key)\n- Integrations index: https:\u002F\u002Fdocs.mem0.ai\u002Fintegrations\n\n### Published Mem0 skills — delegate; do not reimplement\nPrefer these over writing your own call-site patterns. Each is a\nstandalone `SKILL.md` with triggers, examples, and version-pinned code.\n\n- SDK (Python + TS, Platform + OSS): https:\u002F\u002Fraw.githubusercontent.com\u002Fmem0ai\u002Fmem0\u002Fmain\u002Fskills\u002Fmem0\u002FSKILL.md\n- CLI: https:\u002F\u002Fraw.githubusercontent.com\u002Fmem0ai\u002Fmem0\u002Fmain\u002Fskills\u002Fmem0-cli\u002FSKILL.md\n- Vercel AI SDK: https:\u002F\u002Fraw.githubusercontent.com\u002Fmem0ai\u002Fmem0\u002Fmain\u002Fskills\u002Fmem0-vercel-ai-sdk\u002FSKILL.md\n- Editor\u002FMCP plugin glue (9 MCP tools): https:\u002F\u002Fgithub.com\u002Fmem0ai\u002Fmem0\u002Ftree\u002Fmain\u002Fintegrations\u002Fmem0-plugin\n\n### SDK source (read when docs are ambiguous)\nPublic repo. Cross-check against the `mem0_tested_versions` range in this\nskill's frontmatter if the `main` branch has moved past a major.\n\n- Repo root: https:\u002F\u002Fgithub.com\u002Fmem0ai\u002Fmem0\n- Python SDK: https:\u002F\u002Fgithub.com\u002Fmem0ai\u002Fmem0\u002Ftree\u002Fmain\u002Fmem0\n- TypeScript SDK: https:\u002F\u002Fgithub.com\u002Fmem0ai\u002Fmem0\u002Ftree\u002Fmain\u002Fmem0-ts\n\n### Quickstarts (for bootstrapping unfamiliar stacks)\n- Platform: https:\u002F\u002Fdocs.mem0.ai\u002Fplatform\u002Fquickstart\n- OSS Python: https:\u002F\u002Fdocs.mem0.ai\u002Fopen-source\u002Fpython-quickstart\n- OSS Node: https:\u002F\u002Fdocs.mem0.ai\u002Fopen-source\u002Fnode-quickstart\n- Platform vs OSS comparison: https:\u002F\u002Fdocs.mem0.ai\u002Fplatform\u002Fplatform-vs-oss\n\n## Integration principles (non-negotiable)\n\nThe true goal of this skill is to produce a **PR the maintainers can accept\nwithout argument**. That rules out anything invasive.\n\n1. **Additive, not replacing.** If the target repo already has a memory\n   system, a session store, a user-context layer, or anything named\n   `Memory` \u002F `memory_*`, Mem0 sits **alongside** it, not in place of it.\n   The existing system keeps working unchanged.\n2. **Opt-in by default.** Gate all new Mem0 code behind a feature flag\n   (env var like `MEM0_ENABLED=1`, a config key, or a strategy selector).\n   With the flag unset, behavior is the repo's original behavior,\n   byte-for-byte.\n3. **No breakage.** No removed exports, no renamed public functions,\n   no changed method signatures, no modified existing tests, no changed\n   behavior of existing tests. All pre-existing tests must pass unchanged\n   both with the flag set and unset.\n4. **Minimal dependency surface.** Add `mem0ai` (plus any deps the\n   delegated skill requires) and nothing else. No new vector stores, no\n   graph databases, no provider SDKs the repo does not already use.\n5. **Separable commits.** Code, tests, and config\u002Fdocs land in separate\n   commits so reviewers can cherry-pick.\n6. **The null hypothesis wins.** If no additive, gated fit exists after\n   step 6 (plan), exit with code 1 and a rationale. A bad PR is worse\n   than no PR.\n7. **Backend only.** Mem0 integration lives in server-side code. API keys,\n   memory scope, and user-identity resolution are not safe client-side.\n   If the repo has both backend and frontend, the call sites live in\n   backend files. Frontend-only repos are rejected at preconditions.\n\nEnforced at four gates: **preconditions** (reject frontend-only repos\nand repos where additive fit is impossible), **step 2 comprehension**\n(confirm a backend exists and name candidate surfaces), **step 6 plan\nreview** (reject plans that mutate existing exports or name client-side\ncall sites), and **step 10 self-healing loop** (refuse to \"fix\" principle\nviolations — surface them instead).\n\n## Skill delegation rules\n\nBefore writing any code, check whether a published skill already covers\nthe target stack. If yes, delegate — copy its call-site pattern into\n`plan.md` and into the tests; do not paraphrase.\n\n| Detected in target repo | Delegate to | Why |\n|---|---|---|\n| `@ai-sdk\u002F*` + `ai` in `package.json` | `skills\u002Fmem0-vercel-ai-sdk` | Integration is via `createMem0` provider wrapper, not raw `MemoryClient`. |\n| CLI-only repo (Typer, Commander, Click, Cobra) with no LLM call sites | `skills\u002Fmem0-cli` | Call sites are command handlers, not model wrappers. Consider whether mem0 actually fits first. |\n| Target is an MCP client \u002F editor config (Claude Code, Cursor, Codex settings) | `integrations\u002Fmem0-plugin` | Wire via MCP server URL + hooks; no SDK code usually needed. |\n| Any other Python or TS repo with an LLM call site | `skills\u002Fmem0` | Default SDK integration path. |\n\nRecord the delegated skill's raw URL in `plan.md` under a\n**\"Delegated skill:\"** field. The test writer in step 7 and the\nimplementation subagent in step 8 both read this field.\n\n## Preconditions\n\nRefuse to start unless ALL of the following are true:\n\n- Current working directory is inside a git repository with a clean index\n  (no uncommitted changes). Protects the user's work — every edit lands on\n  a feature branch, not on top of in-progress changes.\n- Repo has a detectable language (`package.json` \u002F `pyproject.toml` \u002F\n  `requirements.txt`). No language → exit cleanly with a written rationale.\n- Repo has a **backend**. Detected by: a `backend\u002F` or `server\u002F` or `api\u002F`\n  directory; a Python package with FastAPI\u002FFlask\u002FDjango\u002FStarlette; a Node\n  package with Express\u002FFastify\u002FKoa\u002FNestJS\u002FNext-API-routes; an agent-loop\n  framework (LangGraph, LangChain, LlamaIndex, Agno). Frontend-only repos\n  (pure React\u002FVue\u002FSvelte SPAs, static sites, mobile-only) → exit with\n  code 1 and a rationale. Mem0 is not installed client-side.\n- The user has already decided Mem0 fits this repo. This skill does NOT\n  survey the codebase to justify fit — bring a concrete goal. (Step 2\n  *does* read the repo to understand what it does and locate backend\n  integration surfaces; that is mechanics, not fit-justification.)\n\nExit with a written rationale if any precondition fails. Do not try to\n\"make it work anyway.\"\n\n## Pipeline\n\n### 1. Language detection\n\n| Signal | Track |\n|---|---|\n| `package.json` + TypeScript config | Node \u002F TypeScript |\n| `package.json` (no TS config) | Node \u002F JavaScript |\n| `pyproject.toml` or `requirements.txt` | Python |\n\nMonorepo with both → ask which subdirectory to operate in, then recurse.\n\n### 2. Repo comprehension — what does this repo do, and where is the backend?\n\nBefore any decision (product, goal, plan), understand the repo enough\nto locate *where in the backend* the integration belongs. This is not\nfit-surveying — the user already decided Mem0 fits. This is mechanics:\nyou cannot write a plan without knowing what files matter.\n\nRead, in order, with a token budget — do not scan the whole tree:\n\n1. `README.md` (root) + first-page of any `README_*.md` variants.\n2. `CONTRIBUTING.md` \u002F `AGENTS.md` \u002F `CLAUDE.md` at root if present —\n   these often spell out architecture and entry points.\n3. `package.json` \u002F `pyproject.toml` scripts + entry points.\n4. The layout of the top two directory levels (not recursive).\n5. Key config files: `docker-compose.yml`, `Dockerfile`, `Makefile`,\n   `langgraph.json`, `next.config.*`, `nuxt.config.*`.\n\nProduce `.mem0-integration\u002Frepo-summary.md`:\n\n    # Repo comprehension\n\n    **What this repo does:** \u003Cone paragraph in plain English. Who is\n    the end user? What does the app do for them? What LLM \u002F agent\n    behavior is central? Do not list dependencies — describe behavior.>\n\n    **Architecture at a glance:**\n      - Backend: \u003Cpath(s), framework, primary entry point>\n      - Frontend: \u003Cpath(s) if any, framework — for context only; no\n        integration here>\n      - Agent loop \u002F orchestration: \u003CLangGraph? custom? none?>\n      - Existing memory\u002Fsession\u002Fstate systems: \u003Cname them — these are\n        what step 6 Coexistence must preserve>\n\n    **Candidate backend integration surfaces** (ranked, best first):\n      1. `\u003Cbackend-file>:\u003Cline_range>` — \u003Cfunction> — \u003Cone-sentence\n         reason this is where write\u002Fread could slot in without\n         replacing anything existing>\n      2. ...\n      3. ...\n\n    **Not a fit here:** \u003Clist anything the skill considered but ruled\n    out — e.g., \"frontend chat component: client-side, excluded by\n    backend-only rule\"; \"existing memory subsystem X: would require\n    replacement, excluded by additive principle\">\n\n    **Sources read:** \u003Clist the files actually opened, with line counts,\n    so reviewers can verify coverage.>\n\nShow the user the rendered summary and ask: *\"Is this understanding\ncorrect? Which of the candidate surfaces (1, 2, 3 ...) should step 3\nforward target?\"*\n\nGate rules:\n\n- If no backend surface is found → exit code 1. The preconditions\n  should already have caught frontend-only repos; reaching this point\n  means a more subtle miss (e.g., the \"backend\" is actually just a\n  static build). Do not force a fit.\n- If every candidate surface would require replacing an existing\n  memory\u002Fsession system → exit code 1 with the \"additive principle\"\n  rationale. The user can manually point at a non-conflicting location\n  and re-run.\n- User corrections update `repo-summary.md` and re-confirm. Max 3\n  rounds; beyond that, exit code 1.\n\nThe user's chosen surface index is baked into `product.json` as\n`preferred_site` and referenced by steps 5 and 6.\n\n### 3. Product selection — Platform vs OSS (ask with a recommendation)\n\nRead the `## Identify the User's Setup` block in\n`https:\u002F\u002Fdocs.mem0.ai\u002Fllms.txt` for the Platform-first routing rules, then\napply the heuristics below. Ask, but never blank:\n\n- Other managed-service SDKs present (`@clerk\u002F*`, `stripe`, `@supabase\u002F*`,\n  `openai`, `@upstash\u002F*`, `posthog-*`) — 3+ → recommend **Platform**.\n- Local-infra signals (`docker-compose.yml` with postgres \u002F redis \u002F qdrant \u002F\n  neo4j, ollama configs, self-hosted auth) — 2+ → recommend **OSS**.\n- No strong signal → default recommendation: **Platform** (lower integration\n  cost; migration later is supported).\n\nExample:\n\n> I see `stripe`, `@clerk\u002Fnextjs`, and `@supabase\u002Fsupabase-js` — managed\n> services throughout. I recommend **Mem0 Platform** (4-line integration).\n> Override and use open source?\n\nBake the choice into the goal doc in step 5. Do not re-decide later.\n\n### 4. API key check (env-first, then ask)\n\n| Track | Key | Where to find |\n|---|---|---|\n| Platform | `MEM0_API_KEY` | https:\u002F\u002Fapp.mem0.ai |\n| OSS (default LLM) | `OPENAI_API_KEY` | https:\u002F\u002Fplatform.openai.com\u002Fapi-keys |\n\nIf present in env → continue.\nIf `MEM0_API_KEY` is missing AND the track is **Platform** → **default to Agent Mode**: run `mem0 init --agent --agent-caller \u003Cyour-name> --json` (after `pip install mem0-cli` or `npm install -g @mem0\u002Fcli`), substituting your agent identity (e.g. `claude-code`, `cursor`, `codex`). If you forgot to pass `--agent-caller`, run `mem0 identify \u003Cyour-name>` after init. Cache the key to `.env` (with user consent) and continue. Tell the user to claim later with `mem0 init --email \u003Ctheir-email>` — same key, no agent disruption.\nIf missing AND **CI mode** (`MEM0_INTEGRATE_CI=1`) → exit with code 2 and the name of the missing key.\n\nNever echo key values into `trace.jsonl`. Persist to `.env` only with\nexplicit user consent, and append `.env` to `.gitignore` if not already there.\n\nIf the user is on OSS and wants a non-OpenAI LLM, route them to the\n`components\u002Fllms\u002F*` docs and re-run this step with the chosen provider's key.\n\n### 5. Goal doc — the hard gate\n\nWrite `.mem0-integration\u002Fgoal.md` and **require user approval before step 6**.\n\nTemplate:\n\n    # Mem0 Integration Goal\n\n    **What gets stored:** \u003Cone sentence — user utterances? extracted\n    preferences? a specific domain fact like \"dietary restrictions\"?>\n\n    **When it gets retrieved:** \u003Cone sentence — on each user turn? before a\n    specific tool call? at session start?>\n\n    **Why:** \u003Cone sentence — the user-visible behavior change. \"Assistant\n    remembers previous orders across sessions,\" not \"we added memory.\">\n\n    **Product:** Platform | OSS  (locked from step 3, do not change)\n\n    **Delegated skill:** \u003Craw URL of the published skill being used\n    from \"Skill delegation rules\" above, or \"none — custom integration\n    against `skills\u002Fmem0`\">.\n\n    **Out of scope:** \u003Canything explicitly excluded: \"no graph memory,\"\n    \"no multimodal,\" \"no migration from existing store\">\n\nRules:\n\n- User must approve explicitly. If they edit the doc, reload and re-confirm.\n- `goal.md` is the contract the test suite is written against. Never\n  rewrite it after step 6 starts.\n- Max 3 rejection rounds. On the 4th, exit with code 3 and the rejection\n  notes — the integration is not well-specified enough to proceed.\n\n### 6. Integration plan — how and where (hard gate)\n\nGiven `goal.md` is \"what and why,\" this step produces \"where and how\" and\ngets explicit user sign-off before any code is written.\n\nThe skill does a **scoped** read of the repo (no wide survey):\n\n- Grep for the LLM call sites that match the goal (e.g., `openai.chat.`,\n  `anthropic.messages.`, `model.generateContent`, `ChatOpenAI`, `createLLM`).\n- Grep for the user-identity source (`req.user`, `session.user`, `auth()`,\n  `ctx.userId`, cookies).\n- Check `package.json` \u002F `pyproject.toml` \u002F `requirements.txt` for\n  conflicts (e.g., existing `mem0ai` at a different version).\n\nThen write `.mem0-integration\u002Fplan.md`:\n\n    # Mem0 Integration Plan\n\n    **Write pattern:** \u003Cone sentence — e.g., \"After each assistant reply,\n    call client.add([user_msg, assistant_msg], user_id=\u003Csource>).\">\n\n    **Read pattern:** \u003Cone sentence — e.g., \"Before building the LLM prompt,\n    call client.search(query=latest_user_msg, user_id=\u003Csource>, limit=5)\n    and inject results as a system message.\">\n\n    **User identifier source:** \u003Ccode path — e.g., `req.auth.userId`,\n    `session.user.email`, `ctx.params.user_id`. If none, ask the user.>\n\n    **Session scoping:**\n      - user_id: \u003Csource>\n      - agent_id: \u003Cstatic slug | null>\n      - run_id:   \u003Csource | null>\n\n    **Write call site:** `\u003Cfile:line_range>` — inside `\u003Cfunction>`\n    **Read call site:**  `\u003Cfile:line_range>` — inside `\u003Cfunction>`\n\n    **Dependencies to add:**\n      - `\u003Cpackage>@\u003Cversion pinned in frontmatter>`\n\n    **Preserved behavior:** \u003Clist the existing repo behaviors that must\n    keep working after this edit — e.g., \"existing OpenAI streaming still\n    works,\" \"existing Redis session store still used,\" \"existing tests\n    still pass unchanged.\">\n\n    **Coexistence:** \u003Cone bullet per existing system the integration sits\n    alongside. Name the files\u002Fclasses. Example: \"The existing\n    `agents\u002Fmemory\u002Fstorage.py` MemoryStorage class remains untouched and\n    keeps its LangGraph SummarizationEvent flow. Mem0 is added as a\n    parallel long-term-facts store, in a new file, invoked only when\n    MEM0_ENABLED=1 is set.\">\n\n    **Feature flag:** \u003Cthe exact mechanism and the default. Required.\n    Example: `env MEM0_ENABLED=1`, default unset \u002F off; `config.mem0.enabled`,\n    default false. With the flag in its default state, the repo must\n    behave exactly like `main`.>\n\n    **Sources consulted:** \u003Cminimum 2 URLs from \"Canonical sources\" above\n    that informed this plan. At least one `docs.mem0.ai` URL and one\n    delegated-skill URL. Cite the specific section or heading.>\n\n    **E2E recipe:** \u003Chow the verification skill should drive the app\n    end-to-end. Omit only if the repo is a pure library with no runnable\n    entry point — in which case the E2E step will skip with a warning.>\n\n        start:               \u003Cshell command to launch the app locally,\n                              using $PORT for any network port>\n        ready_probe:         \u003Cone of: url=\u003CURL> status=\u003Ccode>  \u002F\n                              log=\"\u003Csubstring to wait for>\"  \u002F\n                              sleep=\u003Cseconds, last resort>>\n        compose_services:    \u003Coptional: whitespace-separated service\n                              names in docker-compose.yml to start first;\n                              use label mem0-e2e: \"true\" to mark them>\n        write_call:          \u003Ccommand that triggers the Mem0 write path\n                              exactly once; ≤ 60s runtime>\n        write_async_wait_ms: \u003Cmilliseconds to wait after write_call for\n                              async memory flush; default 0>\n        read_call:           \u003Ccommand that triggers the Mem0 read path,\n                              typically a fresh session \u002F new request>\n        read_assert:         \u003Csubstring, regex, or jsonpath=\u003Cexpr>=\u003Cvalue>\n                              that MUST appear in read_call's output for\n                              the E2E to pass. Derived from goal.md's\n                              \"What gets stored.\">\n\n    **Rejected alternatives:** \u003Cbriefly, 1–2 bullets — patterns the skill\n    considered but did not pick, and why. Helps the user decide.>\n\nRules:\n\n- Show the user the proposed call sites with 10 lines of context around\n  each before asking for approval.\n- If the skill can't find a plausible call site for either write or read,\n  it exits with code 5 and asks the user to name the file(s) manually\n  (this is the \"no fit here\" signal — don't guess).\n- Max 3 rejection rounds on the plan. On the 4th, exit code 5 with the\n  last plan and the user's notes.\n- If the user edits `plan.md` by hand, reload and re-confirm.\n\n`plan.md` (not `goal.md`) is the contract the subagent implements against\nin step 8.\n\n### 7. Tests first (TDD)\n\nMain agent writes failing tests against `goal.md` in the repo's native\ntest framework:\n\n| Track | Default framework |\n|---|---|\n| Python | `pytest` |\n| TypeScript | `vitest` if detected, else `jest` |\n| JavaScript | same |\n\nTest assertion shapes must match the **canonical signatures**:\n\n- Platform method signatures: `https:\u002F\u002Fdocs.mem0.ai\u002Fopenapi.json`\n  (request body schemas for `\u002Fv1\u002Fmemories\u002F` and `\u002Fv1\u002Fmemories\u002Fsearch\u002F`).\n- OSS method signatures: the delegated skill named in `plan.md`\n  (fetched from its raw URL) or `skills\u002Fmem0\u002FSKILL.md` as the default.\n- Do not hand-roll request shapes. If the delegated skill has an\n  example block, lift it verbatim.\n\nMinimum two test files (paths taken from `plan.md` call sites):\n\n- `test_mem0_write.\u003Cext>` — asserts `add()` is called at the Write call\n  site with the right payload shape (Platform messages-array vs OSS string)\n  and the right `user_id` source.\n- `test_mem0_read.\u003Cext>` — asserts `search()` runs before the Read call\n  site and the result is wired into the LLM prompt \u002F response path.\n\nTests MUST be importable with `MEM0_API_KEY` unset. This is the design\npressure that forces step 8's lazy `MemoryClient()` \u002F `Memory()`\nconstruction — eager module-level init hits the API on import and\nbreaks pre-existing test collection when the key is missing.\n\nRun the tests. They **must fail**. If they pass before any implementation,\nthe tests are wrong — rewrite them.\n\n### 8. Implementation (subagent, fresh context)\n\nSpawn a subagent with:\n\n- **Inputs**: the repo, `goal.md`, `plan.md`, the two test files, and\n  direct URLs to: the delegated skill (from `plan.md`), the SDK source\n  (pinned per `mem0_tested_versions`), `https:\u002F\u002Fdocs.mem0.ai\u002Fllms.txt`,\n  and `https:\u002F\u002Fdocs.mem0.ai\u002Fopenapi.json`.\n- **No access** to main agent's reasoning trace or scratchpad.\n- **System prompt** (verbatim):\n\n      You are implementing a Mem0 integration for an existing repo.\n\n      Read these first:\n      - plan.md           (the mechanical contract)\n      - goal.md           (the intent — do not change it)\n      - the test files    (do not change them either)\n      - \u003Cdelegated skill raw URL from plan.md>\n      - https:\u002F\u002Fdocs.mem0.ai\u002Fllms.txt\n      - https:\u002F\u002Fdocs.mem0.ai\u002Fopenapi.json  (Platform only)\n\n      Constraints — all required, all enforced at review:\n\n      1. Touch only the files named in plan.md's call sites, or add\n         strictly new files.\n      2. Do not remove or rename any existing symbol. Do not change\n         any public signature.\n      3. Do not modify any existing test.\n      4. Gate every line of new Mem0 code behind the feature flag from\n         plan.md. With the flag in its default state, the repo must\n         behave exactly like `main` — byte-for-byte, including stdout\n         and return values.\n      5. Use only the \u003CPlatform | OSS> SDK surface. No new dependencies\n         beyond those listed under plan.md's \"Dependencies to add.\"\n      6. Preserve everything listed under plan.md's \"Preserved behavior\"\n         and \"Coexistence.\"\n      7. Lazy client construction. `MemoryClient()` validates the API\n         key in `__init__` (it makes a network call). Never instantiate\n         it at module-import time — construct on first use inside the\n         request \u002F handler path. The same rule applies to OSS `Memory()`,\n         which can eagerly initialize embedding and LLM providers. Use\n         a function-local singleton (`functools.lru_cache`, a module-level\n         `_client = None` + getter, or DI scope) — never a top-level\n         global. Eager init breaks the pre-existing test suite at\n         collection time whenever the key is missing or invalid, which\n         is a non-invasiveness violation.\n\n      Implement the plan to make the new tests pass while all\n      pre-existing tests continue to pass unchanged.\n\nSubagent returns a diff. Main agent reviews against `plan.md` (the\nmechanical contract) and `goal.md` (the intent):\n\n- Approved → apply the diff, commit.\n- Rejected → return with specific, actionable feedback (not \"try again\").\n- Max 3 review loops. Beyond that → exit code 4 with the last diff and\n  reviewer feedback.\n\n### 9. Commit + handoff\n\nCreate branch `mem0-integrate\u002F\u003Cshort-goal-slug>` and commit in\n**separate commits** so reviewers can cherry-pick:\n\n1. `mem0: add gated dependency` — just the `pyproject.toml` \u002F `package.json`\n   change.\n2. `mem0: add integration module` — the new file(s).\n3. `mem0: wire into \u003Ccall site>` — the call-site edit(s), still gated.\n4. `mem0: add tests` — the new test files.\n\nIf `--no-heal` is set → print `Run \u002Fmem0-test-integration to verify.`\nand exit. Otherwise proceed to step 10.\n\n### 10. Self-healing loop (default ON; disable with `--no-heal`)\n\nRun `\u002Fmem0-test-integration --ci` in a subprocess. If `scorecard.json`\nreports `overall: pass` → done, exit 0.\n\nOtherwise loop:\n\n1. **Categorize the failing check** from `scorecard.json`. Route per\n   category:\n   - `install` \u002F `static_checks` → dependency or import fix.\n   - `unit_tests` → wiring or assertion fix.\n   - `smoke_test` → API key or SDK call-shape fix.\n   - `e2e_test` → recipe, flag-wiring, or integration-point fix.\n   - **Pre-existing test failure (test skill exit code 7,\n     `non_invasive: false` in scorecard) → STOP.** This is a\n     non-invasiveness violation. Do NOT attempt to \"fix\" it (that\n     breaks principle 3). Exit code 6 with rationale.\n\n2. **Spawn a remediation subagent**, fresh context. Inputs:\n   `plan.md`, `goal.md`, `scorecard.md`, `scorecard.json`, the last\n   committed diff, and the relevant log file for the failing category\n   (`test-stdout.log` \u002F `smoke-stdout.log` \u002F `e2e-app.log` \u002F\n   `e2e-calls.log`).\n\n   System prompt (verbatim):\n\n       You are fixing a failing Mem0 integration test.\n\n       Non-negotiable constraints:\n       - Do not modify test files.\n       - Do not remove or rename any existing symbol or signature.\n       - Do not change pre-existing behavior. The feature flag from\n         plan.md must still default to OFF, and with the flag in its\n         default state the repo must behave exactly like main.\n       - Touch only the files named in plan.md's call sites, or add\n         strictly new files.\n       - Return the smallest possible diff that fixes the single\n         failing check listed in scorecard.md. No drive-by cleanup.\n\n3. **Apply the diff**; commit on the same branch with message\n   `mem0-heal: \u003Ccategory> attempt \u003CN>`. Do NOT amend earlier commits\n   (reviewers need the heal trail).\n\n4. **Re-run `\u002Fmem0-test-integration --ci`**. Outcomes:\n   - `overall: pass` → done, exit 0.\n   - Same check still failing → increment attempt counter; loop.\n   - A *different* check now failing → regression. Revert the heal\n     commit (`git revert HEAD --no-edit`), record the regression in\n     `.mem0-integration\u002Fheal-trace.md`, exit code 6.\n\n5. **Bounded iterations.** Default 3 attempts per failing category.\n   Override with `--heal-max N` (hard cap 10). On exhaustion, exit 6\n   with the full attempt trace: each diff, each scorecard, final log\n   tail.\n\n6. **Post-loop summary** written to `.mem0-integration\u002Fheal-trace.md`:\n   which category failed, how many attempts, each diff's intent, final\n   status, and — on success — the delta from initial scorecard to final.\n\n## Artifacts (all under `.mem0-integration\u002F`)\n\n| File | Purpose | Retention |\n|---|---|---|\n| `repo-summary.md` | Repo comprehension + candidate backend surfaces (step 2). | Keep across runs. |\n| `goal.md` | Approved intent. Never rewritten after step 6. | Keep across runs. |\n| `plan.md` | Approved mechanics (where, how, call sites, preserved behavior). | Keep across runs. |\n| `trace.jsonl` | Every tool call, decision, and subagent exchange this run. | Overwritten per run. |\n| `diff.patch` | The committed integration as a reviewable patch. | Overwritten per run. |\n| `heal-trace.md` | Per-attempt record of the self-healing loop (step 10). | Overwritten per run. |\n| `product.json` | `{\"product\": \"platform\"\\|\"oss\", \"language\": \"...\", \"mem0_version\": \"...\", \"write_site\": \"file:line\", \"read_site\": \"file:line\", \"feature_flag\": \"MEM0_ENABLED\"}` — consumed by the verification skill. | Overwritten per run. |\n\n`.mem0-integration\u002F` is added to `.gitignore` on first run. Nothing is\nwritten outside this directory and the repo's source tree.\n\n## Modes\n\n| Mode | Trigger | Behavior |\n|---|---|---|\n| Interactive (default) | TTY present, `MEM0_INTEGRATE_CI` unset | Asks for keys, confirms goal doc, shows recommendations. |\n| CI | `MEM0_INTEGRATE_CI=1` | Requires keys in env, requires `--product`, auto-approves goal doc from `goal.md` if present, fails fast otherwise. |\n\n## Invocation\n\n    \u002Fmem0-integrate                            # interactive, heal ON\n    \u002Fmem0-integrate --no-heal                  # stop after commit; manual verify\n    \u002Fmem0-integrate --heal-max 5               # cap heal attempts per category (default 3)\n    \u002Fmem0-integrate --product platform         # skip the product ask\n    \u002Fmem0-integrate --product oss\n    \u002Fmem0-integrate --ci                       # non-interactive (for test harness)\n\n## Exit codes\n\n| Code | Meaning |\n|---|---|\n| 0 | Success. Feature branch committed; verification skill ready to run. |\n| 1 | Precondition failed (dirty repo, no detectable language, etc.). |\n| 2 | Missing env key in CI mode. |\n| 3 | Goal doc rejected 3+ times — integration is not well-specified. |\n| 4 | Subagent review loop did not converge in 3 rounds. |\n| 5 | Integration plan rejected 3+ times, or no plausible additive call site found. |\n| 6 | Self-healing loop did not converge, detected a non-invasiveness violation, or a pre-existing test failed. |\n\n## Explicitly out of scope\n\n- Surveying the repo for fit points. Humans decide where Mem0 helps before\n  invoking this skill.\n- Replacing any existing memory \u002F session \u002F state system. Always additive\n  and feature-flagged; see \"Integration principles.\"\n- Modifying pre-existing tests, even to \"fix\" them under self-heal. Tests\n  that fail after integration with the flag unset are a non-invasiveness\n  violation, not a bug to patch.\n- Deciding Platform vs OSS silently. Always ask with a recommendation.\n- Switching branches, pushing, or opening PRs. Commits locally and stops\n  (or enters the heal loop, still local).\n- Data migration between stores. Point user at `migration\u002Foss-to-platform`\n  docs if they ask.\n- Provider selection beyond the default LLM for OSS. If they need a custom\n  LLM \u002F embedder \u002F vector store, route to `components\u002F*` docs and re-run\n  step 4 with the new key.\n",{"data":47,"body":53},{"name":4,"description":6,"license":26,"metadata":48},{"author":11,"version":49,"category":50,"tags":51,"mem0_tested_versions":52},"0.1.0","ai-memory","memory, integration, tdd, platform, oss","mem0ai (PyPI) >=2.0.0,\u003C3.0.0; mem0ai (npm) >=3.0.0,\u003C4.0.0",{"type":54,"children":55},"root",[56,63,78,85,106,113,177,183,196,243,249,270,305,311,358,364,377,488,521,527,539,695,714,719,724,807,812,818,824,904,909,915,927,932,1049,1062,1074,1084,1089,1115,1136,1142,1162,1248,1253,1291,1296,1302,1379,1496,1531,1544,1550,1569,1574,1583,1588,1612,1618,1630,1642,1751,1763,1772,1776,1806,1823,1829,1841,1916,1927,1981,1993,2041,2068,2080,2086,2091,2173,2192,2210,2216,2236,2296,2317,2330,2359,2364,2648,2661,2838,2855,2861,2950,2956,2965,2971,3084,3090],{"type":57,"tag":58,"props":59,"children":60},"element","h1",{"id":4},[61],{"type":62,"value":4},"text",{"type":57,"tag":64,"props":65,"children":66},"p",{},[67,69,76],{"type":62,"value":68},"Wire Mem0 into an existing repo with a goal-driven, test-first pipeline.\nPairs with ",{"type":57,"tag":70,"props":71,"children":73},"code",{"className":72},[],[74],{"type":62,"value":75},"mem0-test-integration",{"type":62,"value":77}," for verification.",{"type":57,"tag":79,"props":80,"children":82},"h2",{"id":81},"canonical-sources-fetch-before-deciding-anything",[83],{"type":62,"value":84},"Canonical sources (fetch before deciding anything)",{"type":57,"tag":64,"props":86,"children":87},{},[88,90,96,98,104],{"type":62,"value":89},"The skill MUST ",{"type":57,"tag":70,"props":91,"children":93},{"className":92},[],[94],{"type":62,"value":95},"WebFetch",{"type":62,"value":97}," these URLs before step 3 and cite them in\n",{"type":57,"tag":70,"props":99,"children":101},{"className":100},[],[102],{"type":62,"value":103},"plan.md",{"type":62,"value":105},". They are the ground truth — do not rely on ambient knowledge\nof the Mem0 API.",{"type":57,"tag":107,"props":108,"children":110},"h3",{"id":109},"agent-ready-docs",[111],{"type":62,"value":112},"Agent-ready docs",{"type":57,"tag":114,"props":115,"children":116},"ul",{},[117,131,142,153,166],{"type":57,"tag":118,"props":119,"children":120},"li",{},[121,123],{"type":62,"value":122},"Scope-tagged docs index: ",{"type":57,"tag":124,"props":125,"children":129},"a",{"href":126,"rel":127},"https:\u002F\u002Fdocs.mem0.ai\u002Fllms.txt",[128],"nofollow",[130],{"type":62,"value":126},{"type":57,"tag":118,"props":132,"children":133},{},[134,136],{"type":62,"value":135},"Full docs (single file, deep dives): ",{"type":57,"tag":124,"props":137,"children":140},{"href":138,"rel":139},"https:\u002F\u002Fdocs.mem0.ai\u002Fllms-full.txt",[128],[141],{"type":62,"value":138},{"type":57,"tag":118,"props":143,"children":144},{},[145,147],{"type":62,"value":146},"OpenAPI spec (Platform REST, machine-readable): ",{"type":57,"tag":124,"props":148,"children":151},{"href":149,"rel":150},"https:\u002F\u002Fdocs.mem0.ai\u002Fopenapi.json",[128],[152],{"type":62,"value":149},{"type":57,"tag":118,"props":154,"children":155},{},[156,158,164],{"type":62,"value":157},"Hosted MCP server: ",{"type":57,"tag":124,"props":159,"children":162},{"href":160,"rel":161},"https:\u002F\u002Fmcp.mem0.ai",[128],[163],{"type":62,"value":160},{"type":62,"value":165}," (requires Platform API key)",{"type":57,"tag":118,"props":167,"children":168},{},[169,171],{"type":62,"value":170},"Integrations index: ",{"type":57,"tag":124,"props":172,"children":175},{"href":173,"rel":174},"https:\u002F\u002Fdocs.mem0.ai\u002Fintegrations",[128],[176],{"type":62,"value":173},{"type":57,"tag":107,"props":178,"children":180},{"id":179},"published-mem0-skills-delegate-do-not-reimplement",[181],{"type":62,"value":182},"Published Mem0 skills — delegate; do not reimplement",{"type":57,"tag":64,"props":184,"children":185},{},[186,188,194],{"type":62,"value":187},"Prefer these over writing your own call-site patterns. Each is a\nstandalone ",{"type":57,"tag":70,"props":189,"children":191},{"className":190},[],[192],{"type":62,"value":193},"SKILL.md",{"type":62,"value":195}," with triggers, examples, and version-pinned code.",{"type":57,"tag":114,"props":197,"children":198},{},[199,210,221,232],{"type":57,"tag":118,"props":200,"children":201},{},[202,204],{"type":62,"value":203},"SDK (Python + TS, Platform + OSS): ",{"type":57,"tag":124,"props":205,"children":208},{"href":206,"rel":207},"https:\u002F\u002Fraw.githubusercontent.com\u002Fmem0ai\u002Fmem0\u002Fmain\u002Fskills\u002Fmem0\u002FSKILL.md",[128],[209],{"type":62,"value":206},{"type":57,"tag":118,"props":211,"children":212},{},[213,215],{"type":62,"value":214},"CLI: ",{"type":57,"tag":124,"props":216,"children":219},{"href":217,"rel":218},"https:\u002F\u002Fraw.githubusercontent.com\u002Fmem0ai\u002Fmem0\u002Fmain\u002Fskills\u002Fmem0-cli\u002FSKILL.md",[128],[220],{"type":62,"value":217},{"type":57,"tag":118,"props":222,"children":223},{},[224,226],{"type":62,"value":225},"Vercel AI SDK: ",{"type":57,"tag":124,"props":227,"children":230},{"href":228,"rel":229},"https:\u002F\u002Fraw.githubusercontent.com\u002Fmem0ai\u002Fmem0\u002Fmain\u002Fskills\u002Fmem0-vercel-ai-sdk\u002FSKILL.md",[128],[231],{"type":62,"value":228},{"type":57,"tag":118,"props":233,"children":234},{},[235,237],{"type":62,"value":236},"Editor\u002FMCP plugin glue (9 MCP tools): ",{"type":57,"tag":124,"props":238,"children":241},{"href":239,"rel":240},"https:\u002F\u002Fgithub.com\u002Fmem0ai\u002Fmem0\u002Ftree\u002Fmain\u002Fintegrations\u002Fmem0-plugin",[128],[242],{"type":62,"value":239},{"type":57,"tag":107,"props":244,"children":246},{"id":245},"sdk-source-read-when-docs-are-ambiguous",[247],{"type":62,"value":248},"SDK source (read when docs are ambiguous)",{"type":57,"tag":64,"props":250,"children":251},{},[252,254,260,262,268],{"type":62,"value":253},"Public repo. Cross-check against the ",{"type":57,"tag":70,"props":255,"children":257},{"className":256},[],[258],{"type":62,"value":259},"mem0_tested_versions",{"type":62,"value":261}," range in this\nskill's frontmatter if the ",{"type":57,"tag":70,"props":263,"children":265},{"className":264},[],[266],{"type":62,"value":267},"main",{"type":62,"value":269}," branch has moved past a major.",{"type":57,"tag":114,"props":271,"children":272},{},[273,283,294],{"type":57,"tag":118,"props":274,"children":275},{},[276,278],{"type":62,"value":277},"Repo root: ",{"type":57,"tag":124,"props":279,"children":281},{"href":24,"rel":280},[128],[282],{"type":62,"value":24},{"type":57,"tag":118,"props":284,"children":285},{},[286,288],{"type":62,"value":287},"Python SDK: ",{"type":57,"tag":124,"props":289,"children":292},{"href":290,"rel":291},"https:\u002F\u002Fgithub.com\u002Fmem0ai\u002Fmem0\u002Ftree\u002Fmain\u002Fmem0",[128],[293],{"type":62,"value":290},{"type":57,"tag":118,"props":295,"children":296},{},[297,299],{"type":62,"value":298},"TypeScript SDK: ",{"type":57,"tag":124,"props":300,"children":303},{"href":301,"rel":302},"https:\u002F\u002Fgithub.com\u002Fmem0ai\u002Fmem0\u002Ftree\u002Fmain\u002Fmem0-ts",[128],[304],{"type":62,"value":301},{"type":57,"tag":107,"props":306,"children":308},{"id":307},"quickstarts-for-bootstrapping-unfamiliar-stacks",[309],{"type":62,"value":310},"Quickstarts (for bootstrapping unfamiliar stacks)",{"type":57,"tag":114,"props":312,"children":313},{},[314,325,336,347],{"type":57,"tag":118,"props":315,"children":316},{},[317,319],{"type":62,"value":318},"Platform: ",{"type":57,"tag":124,"props":320,"children":323},{"href":321,"rel":322},"https:\u002F\u002Fdocs.mem0.ai\u002Fplatform\u002Fquickstart",[128],[324],{"type":62,"value":321},{"type":57,"tag":118,"props":326,"children":327},{},[328,330],{"type":62,"value":329},"OSS Python: ",{"type":57,"tag":124,"props":331,"children":334},{"href":332,"rel":333},"https:\u002F\u002Fdocs.mem0.ai\u002Fopen-source\u002Fpython-quickstart",[128],[335],{"type":62,"value":332},{"type":57,"tag":118,"props":337,"children":338},{},[339,341],{"type":62,"value":340},"OSS Node: ",{"type":57,"tag":124,"props":342,"children":345},{"href":343,"rel":344},"https:\u002F\u002Fdocs.mem0.ai\u002Fopen-source\u002Fnode-quickstart",[128],[346],{"type":62,"value":343},{"type":57,"tag":118,"props":348,"children":349},{},[350,352],{"type":62,"value":351},"Platform vs OSS comparison: ",{"type":57,"tag":124,"props":353,"children":356},{"href":354,"rel":355},"https:\u002F\u002Fdocs.mem0.ai\u002Fplatform\u002Fplatform-vs-oss",[128],[357],{"type":62,"value":354},{"type":57,"tag":79,"props":359,"children":361},{"id":360},"integration-principles-non-negotiable",[362],{"type":62,"value":363},"Integration principles (non-negotiable)",{"type":57,"tag":64,"props":365,"children":366},{},[367,369,375],{"type":62,"value":368},"The true goal of this skill is to produce a ",{"type":57,"tag":370,"props":371,"children":372},"strong",{},[373],{"type":62,"value":374},"PR the maintainers can accept\nwithout argument",{"type":62,"value":376},". That rules out anything invasive.",{"type":57,"tag":378,"props":379,"children":380},"ol",{},[381,413,431,441,458,468,478],{"type":57,"tag":118,"props":382,"children":383},{},[384,389,391,396,398,404,406,411],{"type":57,"tag":370,"props":385,"children":386},{},[387],{"type":62,"value":388},"Additive, not replacing.",{"type":62,"value":390}," If the target repo already has a memory\nsystem, a session store, a user-context layer, or anything named\n",{"type":57,"tag":70,"props":392,"children":394},{"className":393},[],[395],{"type":62,"value":14},{"type":62,"value":397}," \u002F ",{"type":57,"tag":70,"props":399,"children":401},{"className":400},[],[402],{"type":62,"value":403},"memory_*",{"type":62,"value":405},", Mem0 sits ",{"type":57,"tag":370,"props":407,"children":408},{},[409],{"type":62,"value":410},"alongside",{"type":62,"value":412}," it, not in place of it.\nThe existing system keeps working unchanged.",{"type":57,"tag":118,"props":414,"children":415},{},[416,421,423,429],{"type":57,"tag":370,"props":417,"children":418},{},[419],{"type":62,"value":420},"Opt-in by default.",{"type":62,"value":422}," Gate all new Mem0 code behind a feature flag\n(env var like ",{"type":57,"tag":70,"props":424,"children":426},{"className":425},[],[427],{"type":62,"value":428},"MEM0_ENABLED=1",{"type":62,"value":430},", a config key, or a strategy selector).\nWith the flag unset, behavior is the repo's original behavior,\nbyte-for-byte.",{"type":57,"tag":118,"props":432,"children":433},{},[434,439],{"type":57,"tag":370,"props":435,"children":436},{},[437],{"type":62,"value":438},"No breakage.",{"type":62,"value":440}," No removed exports, no renamed public functions,\nno changed method signatures, no modified existing tests, no changed\nbehavior of existing tests. All pre-existing tests must pass unchanged\nboth with the flag set and unset.",{"type":57,"tag":118,"props":442,"children":443},{},[444,449,451,456],{"type":57,"tag":370,"props":445,"children":446},{},[447],{"type":62,"value":448},"Minimal dependency surface.",{"type":62,"value":450}," Add ",{"type":57,"tag":70,"props":452,"children":454},{"className":453},[],[455],{"type":62,"value":11},{"type":62,"value":457}," (plus any deps the\ndelegated skill requires) and nothing else. No new vector stores, no\ngraph databases, no provider SDKs the repo does not already use.",{"type":57,"tag":118,"props":459,"children":460},{},[461,466],{"type":57,"tag":370,"props":462,"children":463},{},[464],{"type":62,"value":465},"Separable commits.",{"type":62,"value":467}," Code, tests, and config\u002Fdocs land in separate\ncommits so reviewers can cherry-pick.",{"type":57,"tag":118,"props":469,"children":470},{},[471,476],{"type":57,"tag":370,"props":472,"children":473},{},[474],{"type":62,"value":475},"The null hypothesis wins.",{"type":62,"value":477}," If no additive, gated fit exists after\nstep 6 (plan), exit with code 1 and a rationale. A bad PR is worse\nthan no PR.",{"type":57,"tag":118,"props":479,"children":480},{},[481,486],{"type":57,"tag":370,"props":482,"children":483},{},[484],{"type":62,"value":485},"Backend only.",{"type":62,"value":487}," Mem0 integration lives in server-side code. API keys,\nmemory scope, and user-identity resolution are not safe client-side.\nIf the repo has both backend and frontend, the call sites live in\nbackend files. Frontend-only repos are rejected at preconditions.",{"type":57,"tag":64,"props":489,"children":490},{},[491,493,498,500,505,507,512,514,519],{"type":62,"value":492},"Enforced at four gates: ",{"type":57,"tag":370,"props":494,"children":495},{},[496],{"type":62,"value":497},"preconditions",{"type":62,"value":499}," (reject frontend-only repos\nand repos where additive fit is impossible), ",{"type":57,"tag":370,"props":501,"children":502},{},[503],{"type":62,"value":504},"step 2 comprehension",{"type":62,"value":506},"\n(confirm a backend exists and name candidate surfaces), ",{"type":57,"tag":370,"props":508,"children":509},{},[510],{"type":62,"value":511},"step 6 plan\nreview",{"type":62,"value":513}," (reject plans that mutate existing exports or name client-side\ncall sites), and ",{"type":57,"tag":370,"props":515,"children":516},{},[517],{"type":62,"value":518},"step 10 self-healing loop",{"type":62,"value":520}," (refuse to \"fix\" principle\nviolations — surface them instead).",{"type":57,"tag":79,"props":522,"children":524},{"id":523},"skill-delegation-rules",[525],{"type":62,"value":526},"Skill delegation rules",{"type":57,"tag":64,"props":528,"children":529},{},[530,532,537],{"type":62,"value":531},"Before writing any code, check whether a published skill already covers\nthe target stack. If yes, delegate — copy its call-site pattern into\n",{"type":57,"tag":70,"props":533,"children":535},{"className":534},[],[536],{"type":62,"value":103},{"type":62,"value":538}," and into the tests; do not paraphrase.",{"type":57,"tag":540,"props":541,"children":542},"table",{},[543,567],{"type":57,"tag":544,"props":545,"children":546},"thead",{},[547],{"type":57,"tag":548,"props":549,"children":550},"tr",{},[551,557,562],{"type":57,"tag":552,"props":553,"children":554},"th",{},[555],{"type":62,"value":556},"Detected in target repo",{"type":57,"tag":552,"props":558,"children":559},{},[560],{"type":62,"value":561},"Delegate to",{"type":57,"tag":552,"props":563,"children":564},{},[565],{"type":62,"value":566},"Why",{"type":57,"tag":568,"props":569,"children":570},"tbody",{},[571,629,651,673],{"type":57,"tag":548,"props":572,"children":573},{},[574,599,608],{"type":57,"tag":575,"props":576,"children":577},"td",{},[578,584,586,591,593],{"type":57,"tag":70,"props":579,"children":581},{"className":580},[],[582],{"type":62,"value":583},"@ai-sdk\u002F*",{"type":62,"value":585}," + ",{"type":57,"tag":70,"props":587,"children":589},{"className":588},[],[590],{"type":62,"value":29},{"type":62,"value":592}," in ",{"type":57,"tag":70,"props":594,"children":596},{"className":595},[],[597],{"type":62,"value":598},"package.json",{"type":57,"tag":575,"props":600,"children":601},{},[602],{"type":57,"tag":70,"props":603,"children":605},{"className":604},[],[606],{"type":62,"value":607},"skills\u002Fmem0-vercel-ai-sdk",{"type":57,"tag":575,"props":609,"children":610},{},[611,613,619,621,627],{"type":62,"value":612},"Integration is via ",{"type":57,"tag":70,"props":614,"children":616},{"className":615},[],[617],{"type":62,"value":618},"createMem0",{"type":62,"value":620}," provider wrapper, not raw ",{"type":57,"tag":70,"props":622,"children":624},{"className":623},[],[625],{"type":62,"value":626},"MemoryClient",{"type":62,"value":628},".",{"type":57,"tag":548,"props":630,"children":631},{},[632,637,646],{"type":57,"tag":575,"props":633,"children":634},{},[635],{"type":62,"value":636},"CLI-only repo (Typer, Commander, Click, Cobra) with no LLM call sites",{"type":57,"tag":575,"props":638,"children":639},{},[640],{"type":57,"tag":70,"props":641,"children":643},{"className":642},[],[644],{"type":62,"value":645},"skills\u002Fmem0-cli",{"type":57,"tag":575,"props":647,"children":648},{},[649],{"type":62,"value":650},"Call sites are command handlers, not model wrappers. Consider whether mem0 actually fits first.",{"type":57,"tag":548,"props":652,"children":653},{},[654,659,668],{"type":57,"tag":575,"props":655,"children":656},{},[657],{"type":62,"value":658},"Target is an MCP client \u002F editor config (Claude Code, Cursor, Codex settings)",{"type":57,"tag":575,"props":660,"children":661},{},[662],{"type":57,"tag":70,"props":663,"children":665},{"className":664},[],[666],{"type":62,"value":667},"integrations\u002Fmem0-plugin",{"type":57,"tag":575,"props":669,"children":670},{},[671],{"type":62,"value":672},"Wire via MCP server URL + hooks; no SDK code usually needed.",{"type":57,"tag":548,"props":674,"children":675},{},[676,681,690],{"type":57,"tag":575,"props":677,"children":678},{},[679],{"type":62,"value":680},"Any other Python or TS repo with an LLM call site",{"type":57,"tag":575,"props":682,"children":683},{},[684],{"type":57,"tag":70,"props":685,"children":687},{"className":686},[],[688],{"type":62,"value":689},"skills\u002Fmem0",{"type":57,"tag":575,"props":691,"children":692},{},[693],{"type":62,"value":694},"Default SDK integration path.",{"type":57,"tag":64,"props":696,"children":697},{},[698,700,705,707,712],{"type":62,"value":699},"Record the delegated skill's raw URL in ",{"type":57,"tag":70,"props":701,"children":703},{"className":702},[],[704],{"type":62,"value":103},{"type":62,"value":706}," under a\n",{"type":57,"tag":370,"props":708,"children":709},{},[710],{"type":62,"value":711},"\"Delegated skill:\"",{"type":62,"value":713}," field. The test writer in step 7 and the\nimplementation subagent in step 8 both read this field.",{"type":57,"tag":79,"props":715,"children":716},{"id":497},[717],{"type":62,"value":718},"Preconditions",{"type":57,"tag":64,"props":720,"children":721},{},[722],{"type":62,"value":723},"Refuse to start unless ALL of the following are true:",{"type":57,"tag":114,"props":725,"children":726},{},[727,732,759,794],{"type":57,"tag":118,"props":728,"children":729},{},[730],{"type":62,"value":731},"Current working directory is inside a git repository with a clean index\n(no uncommitted changes). Protects the user's work — every edit lands on\na feature branch, not on top of in-progress changes.",{"type":57,"tag":118,"props":733,"children":734},{},[735,737,742,743,749,751,757],{"type":62,"value":736},"Repo has a detectable language (",{"type":57,"tag":70,"props":738,"children":740},{"className":739},[],[741],{"type":62,"value":598},{"type":62,"value":397},{"type":57,"tag":70,"props":744,"children":746},{"className":745},[],[747],{"type":62,"value":748},"pyproject.toml",{"type":62,"value":750}," \u002F\n",{"type":57,"tag":70,"props":752,"children":754},{"className":753},[],[755],{"type":62,"value":756},"requirements.txt",{"type":62,"value":758},"). No language → exit cleanly with a written rationale.",{"type":57,"tag":118,"props":760,"children":761},{},[762,764,769,771,777,779,785,786,792],{"type":62,"value":763},"Repo has a ",{"type":57,"tag":370,"props":765,"children":766},{},[767],{"type":62,"value":768},"backend",{"type":62,"value":770},". Detected by: a ",{"type":57,"tag":70,"props":772,"children":774},{"className":773},[],[775],{"type":62,"value":776},"backend\u002F",{"type":62,"value":778}," or ",{"type":57,"tag":70,"props":780,"children":782},{"className":781},[],[783],{"type":62,"value":784},"server\u002F",{"type":62,"value":778},{"type":57,"tag":70,"props":787,"children":789},{"className":788},[],[790],{"type":62,"value":791},"api\u002F",{"type":62,"value":793},"\ndirectory; a Python package with FastAPI\u002FFlask\u002FDjango\u002FStarlette; a Node\npackage with Express\u002FFastify\u002FKoa\u002FNestJS\u002FNext-API-routes; an agent-loop\nframework (LangGraph, LangChain, LlamaIndex, Agno). Frontend-only repos\n(pure React\u002FVue\u002FSvelte SPAs, static sites, mobile-only) → exit with\ncode 1 and a rationale. Mem0 is not installed client-side.",{"type":57,"tag":118,"props":795,"children":796},{},[797,799,805],{"type":62,"value":798},"The user has already decided Mem0 fits this repo. This skill does NOT\nsurvey the codebase to justify fit — bring a concrete goal. (Step 2\n",{"type":57,"tag":800,"props":801,"children":802},"em",{},[803],{"type":62,"value":804},"does",{"type":62,"value":806}," read the repo to understand what it does and locate backend\nintegration surfaces; that is mechanics, not fit-justification.)",{"type":57,"tag":64,"props":808,"children":809},{},[810],{"type":62,"value":811},"Exit with a written rationale if any precondition fails. Do not try to\n\"make it work anyway.\"",{"type":57,"tag":79,"props":813,"children":815},{"id":814},"pipeline",[816],{"type":62,"value":817},"Pipeline",{"type":57,"tag":107,"props":819,"children":821},{"id":820},"_1-language-detection",[822],{"type":62,"value":823},"1. Language detection",{"type":57,"tag":540,"props":825,"children":826},{},[827,843],{"type":57,"tag":544,"props":828,"children":829},{},[830],{"type":57,"tag":548,"props":831,"children":832},{},[833,838],{"type":57,"tag":552,"props":834,"children":835},{},[836],{"type":62,"value":837},"Signal",{"type":57,"tag":552,"props":839,"children":840},{},[841],{"type":62,"value":842},"Track",{"type":57,"tag":568,"props":844,"children":845},{},[846,864,882],{"type":57,"tag":548,"props":847,"children":848},{},[849,859],{"type":57,"tag":575,"props":850,"children":851},{},[852,857],{"type":57,"tag":70,"props":853,"children":855},{"className":854},[],[856],{"type":62,"value":598},{"type":62,"value":858}," + TypeScript config",{"type":57,"tag":575,"props":860,"children":861},{},[862],{"type":62,"value":863},"Node \u002F TypeScript",{"type":57,"tag":548,"props":865,"children":866},{},[867,877],{"type":57,"tag":575,"props":868,"children":869},{},[870,875],{"type":57,"tag":70,"props":871,"children":873},{"className":872},[],[874],{"type":62,"value":598},{"type":62,"value":876}," (no TS config)",{"type":57,"tag":575,"props":878,"children":879},{},[880],{"type":62,"value":881},"Node \u002F JavaScript",{"type":57,"tag":548,"props":883,"children":884},{},[885,899],{"type":57,"tag":575,"props":886,"children":887},{},[888,893,894],{"type":57,"tag":70,"props":889,"children":891},{"className":890},[],[892],{"type":62,"value":748},{"type":62,"value":778},{"type":57,"tag":70,"props":895,"children":897},{"className":896},[],[898],{"type":62,"value":756},{"type":57,"tag":575,"props":900,"children":901},{},[902],{"type":62,"value":903},"Python",{"type":57,"tag":64,"props":905,"children":906},{},[907],{"type":62,"value":908},"Monorepo with both → ask which subdirectory to operate in, then recurse.",{"type":57,"tag":107,"props":910,"children":912},{"id":911},"_2-repo-comprehension-what-does-this-repo-do-and-where-is-the-backend",[913],{"type":62,"value":914},"2. Repo comprehension — what does this repo do, and where is the backend?",{"type":57,"tag":64,"props":916,"children":917},{},[918,920,925],{"type":62,"value":919},"Before any decision (product, goal, plan), understand the repo enough\nto locate ",{"type":57,"tag":800,"props":921,"children":922},{},[923],{"type":62,"value":924},"where in the backend",{"type":62,"value":926}," the integration belongs. This is not\nfit-surveying — the user already decided Mem0 fits. This is mechanics:\nyou cannot write a plan without knowing what files matter.",{"type":57,"tag":64,"props":928,"children":929},{},[930],{"type":62,"value":931},"Read, in order, with a token budget — do not scan the whole tree:",{"type":57,"tag":378,"props":933,"children":934},{},[935,954,979,995,1000],{"type":57,"tag":118,"props":936,"children":937},{},[938,944,946,952],{"type":57,"tag":70,"props":939,"children":941},{"className":940},[],[942],{"type":62,"value":943},"README.md",{"type":62,"value":945}," (root) + first-page of any ",{"type":57,"tag":70,"props":947,"children":949},{"className":948},[],[950],{"type":62,"value":951},"README_*.md",{"type":62,"value":953}," variants.",{"type":57,"tag":118,"props":955,"children":956},{},[957,963,964,970,971,977],{"type":57,"tag":70,"props":958,"children":960},{"className":959},[],[961],{"type":62,"value":962},"CONTRIBUTING.md",{"type":62,"value":397},{"type":57,"tag":70,"props":965,"children":967},{"className":966},[],[968],{"type":62,"value":969},"AGENTS.md",{"type":62,"value":397},{"type":57,"tag":70,"props":972,"children":974},{"className":973},[],[975],{"type":62,"value":976},"CLAUDE.md",{"type":62,"value":978}," at root if present —\nthese often spell out architecture and entry points.",{"type":57,"tag":118,"props":980,"children":981},{},[982,987,988,993],{"type":57,"tag":70,"props":983,"children":985},{"className":984},[],[986],{"type":62,"value":598},{"type":62,"value":397},{"type":57,"tag":70,"props":989,"children":991},{"className":990},[],[992],{"type":62,"value":748},{"type":62,"value":994}," scripts + entry points.",{"type":57,"tag":118,"props":996,"children":997},{},[998],{"type":62,"value":999},"The layout of the top two directory levels (not recursive).",{"type":57,"tag":118,"props":1001,"children":1002},{},[1003,1005,1011,1013,1019,1020,1026,1028,1034,1035,1041,1042,1048],{"type":62,"value":1004},"Key config files: ",{"type":57,"tag":70,"props":1006,"children":1008},{"className":1007},[],[1009],{"type":62,"value":1010},"docker-compose.yml",{"type":62,"value":1012},", ",{"type":57,"tag":70,"props":1014,"children":1016},{"className":1015},[],[1017],{"type":62,"value":1018},"Dockerfile",{"type":62,"value":1012},{"type":57,"tag":70,"props":1021,"children":1023},{"className":1022},[],[1024],{"type":62,"value":1025},"Makefile",{"type":62,"value":1027},",\n",{"type":57,"tag":70,"props":1029,"children":1031},{"className":1030},[],[1032],{"type":62,"value":1033},"langgraph.json",{"type":62,"value":1012},{"type":57,"tag":70,"props":1036,"children":1038},{"className":1037},[],[1039],{"type":62,"value":1040},"next.config.*",{"type":62,"value":1012},{"type":57,"tag":70,"props":1043,"children":1045},{"className":1044},[],[1046],{"type":62,"value":1047},"nuxt.config.*",{"type":62,"value":628},{"type":57,"tag":64,"props":1050,"children":1051},{},[1052,1054,1060],{"type":62,"value":1053},"Produce ",{"type":57,"tag":70,"props":1055,"children":1057},{"className":1056},[],[1058],{"type":62,"value":1059},".mem0-integration\u002Frepo-summary.md",{"type":62,"value":1061},":",{"type":57,"tag":1063,"props":1064,"children":1068},"pre",{"className":1065,"code":1067,"language":62},[1066],"language-text","# Repo comprehension\n\n**What this repo does:** \u003Cone paragraph in plain English. Who is\nthe end user? What does the app do for them? What LLM \u002F agent\nbehavior is central? Do not list dependencies — describe behavior.>\n\n**Architecture at a glance:**\n  - Backend: \u003Cpath(s), framework, primary entry point>\n  - Frontend: \u003Cpath(s) if any, framework — for context only; no\n    integration here>\n  - Agent loop \u002F orchestration: \u003CLangGraph? custom? none?>\n  - Existing memory\u002Fsession\u002Fstate systems: \u003Cname them — these are\n    what step 6 Coexistence must preserve>\n\n**Candidate backend integration surfaces** (ranked, best first):\n  1. `\u003Cbackend-file>:\u003Cline_range>` — \u003Cfunction> — \u003Cone-sentence\n     reason this is where write\u002Fread could slot in without\n     replacing anything existing>\n  2. ...\n  3. ...\n\n**Not a fit here:** \u003Clist anything the skill considered but ruled\nout — e.g., \"frontend chat component: client-side, excluded by\nbackend-only rule\"; \"existing memory subsystem X: would require\nreplacement, excluded by additive principle\">\n\n**Sources read:** \u003Clist the files actually opened, with line counts,\nso reviewers can verify coverage.>\n",[1069],{"type":57,"tag":70,"props":1070,"children":1072},{"__ignoreMap":1071},"",[1073],{"type":62,"value":1067},{"type":57,"tag":64,"props":1075,"children":1076},{},[1077,1079],{"type":62,"value":1078},"Show the user the rendered summary and ask: ",{"type":57,"tag":800,"props":1080,"children":1081},{},[1082],{"type":62,"value":1083},"\"Is this understanding\ncorrect? Which of the candidate surfaces (1, 2, 3 ...) should step 3\nforward target?\"",{"type":57,"tag":64,"props":1085,"children":1086},{},[1087],{"type":62,"value":1088},"Gate rules:",{"type":57,"tag":114,"props":1090,"children":1091},{},[1092,1097,1102],{"type":57,"tag":118,"props":1093,"children":1094},{},[1095],{"type":62,"value":1096},"If no backend surface is found → exit code 1. The preconditions\nshould already have caught frontend-only repos; reaching this point\nmeans a more subtle miss (e.g., the \"backend\" is actually just a\nstatic build). Do not force a fit.",{"type":57,"tag":118,"props":1098,"children":1099},{},[1100],{"type":62,"value":1101},"If every candidate surface would require replacing an existing\nmemory\u002Fsession system → exit code 1 with the \"additive principle\"\nrationale. The user can manually point at a non-conflicting location\nand re-run.",{"type":57,"tag":118,"props":1103,"children":1104},{},[1105,1107,1113],{"type":62,"value":1106},"User corrections update ",{"type":57,"tag":70,"props":1108,"children":1110},{"className":1109},[],[1111],{"type":62,"value":1112},"repo-summary.md",{"type":62,"value":1114}," and re-confirm. Max 3\nrounds; beyond that, exit code 1.",{"type":57,"tag":64,"props":1116,"children":1117},{},[1118,1120,1126,1128,1134],{"type":62,"value":1119},"The user's chosen surface index is baked into ",{"type":57,"tag":70,"props":1121,"children":1123},{"className":1122},[],[1124],{"type":62,"value":1125},"product.json",{"type":62,"value":1127}," as\n",{"type":57,"tag":70,"props":1129,"children":1131},{"className":1130},[],[1132],{"type":62,"value":1133},"preferred_site",{"type":62,"value":1135}," and referenced by steps 5 and 6.",{"type":57,"tag":107,"props":1137,"children":1139},{"id":1138},"_3-product-selection-platform-vs-oss-ask-with-a-recommendation",[1140],{"type":62,"value":1141},"3. Product selection — Platform vs OSS (ask with a recommendation)",{"type":57,"tag":64,"props":1143,"children":1144},{},[1145,1147,1153,1155,1160],{"type":62,"value":1146},"Read the ",{"type":57,"tag":70,"props":1148,"children":1150},{"className":1149},[],[1151],{"type":62,"value":1152},"## Identify the User's Setup",{"type":62,"value":1154}," block in\n",{"type":57,"tag":70,"props":1156,"children":1158},{"className":1157},[],[1159],{"type":62,"value":126},{"type":62,"value":1161}," for the Platform-first routing rules, then\napply the heuristics below. Ask, but never blank:",{"type":57,"tag":114,"props":1163,"children":1164},{},[1165,1219,1237],{"type":57,"tag":118,"props":1166,"children":1167},{},[1168,1170,1176,1177,1183,1184,1190,1191,1197,1198,1204,1205,1211,1213,1218],{"type":62,"value":1169},"Other managed-service SDKs present (",{"type":57,"tag":70,"props":1171,"children":1173},{"className":1172},[],[1174],{"type":62,"value":1175},"@clerk\u002F*",{"type":62,"value":1012},{"type":57,"tag":70,"props":1178,"children":1180},{"className":1179},[],[1181],{"type":62,"value":1182},"stripe",{"type":62,"value":1012},{"type":57,"tag":70,"props":1185,"children":1187},{"className":1186},[],[1188],{"type":62,"value":1189},"@supabase\u002F*",{"type":62,"value":1027},{"type":57,"tag":70,"props":1192,"children":1194},{"className":1193},[],[1195],{"type":62,"value":1196},"openai",{"type":62,"value":1012},{"type":57,"tag":70,"props":1199,"children":1201},{"className":1200},[],[1202],{"type":62,"value":1203},"@upstash\u002F*",{"type":62,"value":1012},{"type":57,"tag":70,"props":1206,"children":1208},{"className":1207},[],[1209],{"type":62,"value":1210},"posthog-*",{"type":62,"value":1212},") — 3+ → recommend ",{"type":57,"tag":370,"props":1214,"children":1215},{},[1216],{"type":62,"value":1217},"Platform",{"type":62,"value":628},{"type":57,"tag":118,"props":1220,"children":1221},{},[1222,1224,1229,1231,1236],{"type":62,"value":1223},"Local-infra signals (",{"type":57,"tag":70,"props":1225,"children":1227},{"className":1226},[],[1228],{"type":62,"value":1010},{"type":62,"value":1230}," with postgres \u002F redis \u002F qdrant \u002F\nneo4j, ollama configs, self-hosted auth) — 2+ → recommend ",{"type":57,"tag":370,"props":1232,"children":1233},{},[1234],{"type":62,"value":1235},"OSS",{"type":62,"value":628},{"type":57,"tag":118,"props":1238,"children":1239},{},[1240,1242,1246],{"type":62,"value":1241},"No strong signal → default recommendation: ",{"type":57,"tag":370,"props":1243,"children":1244},{},[1245],{"type":62,"value":1217},{"type":62,"value":1247}," (lower integration\ncost; migration later is supported).",{"type":57,"tag":64,"props":1249,"children":1250},{},[1251],{"type":62,"value":1252},"Example:",{"type":57,"tag":1254,"props":1255,"children":1256},"blockquote",{},[1257],{"type":57,"tag":64,"props":1258,"children":1259},{},[1260,1262,1267,1268,1274,1276,1282,1284,1289],{"type":62,"value":1261},"I see ",{"type":57,"tag":70,"props":1263,"children":1265},{"className":1264},[],[1266],{"type":62,"value":1182},{"type":62,"value":1012},{"type":57,"tag":70,"props":1269,"children":1271},{"className":1270},[],[1272],{"type":62,"value":1273},"@clerk\u002Fnextjs",{"type":62,"value":1275},", and ",{"type":57,"tag":70,"props":1277,"children":1279},{"className":1278},[],[1280],{"type":62,"value":1281},"@supabase\u002Fsupabase-js",{"type":62,"value":1283}," — managed\nservices throughout. I recommend ",{"type":57,"tag":370,"props":1285,"children":1286},{},[1287],{"type":62,"value":1288},"Mem0 Platform",{"type":62,"value":1290}," (4-line integration).\nOverride and use open source?",{"type":57,"tag":64,"props":1292,"children":1293},{},[1294],{"type":62,"value":1295},"Bake the choice into the goal doc in step 5. Do not re-decide later.",{"type":57,"tag":107,"props":1297,"children":1299},{"id":1298},"_4-api-key-check-env-first-then-ask",[1300],{"type":62,"value":1301},"4. API key check (env-first, then ask)",{"type":57,"tag":540,"props":1303,"children":1304},{},[1305,1325],{"type":57,"tag":544,"props":1306,"children":1307},{},[1308],{"type":57,"tag":548,"props":1309,"children":1310},{},[1311,1315,1320],{"type":57,"tag":552,"props":1312,"children":1313},{},[1314],{"type":62,"value":842},{"type":57,"tag":552,"props":1316,"children":1317},{},[1318],{"type":62,"value":1319},"Key",{"type":57,"tag":552,"props":1321,"children":1322},{},[1323],{"type":62,"value":1324},"Where to find",{"type":57,"tag":568,"props":1326,"children":1327},{},[1328,1353],{"type":57,"tag":548,"props":1329,"children":1330},{},[1331,1335,1344],{"type":57,"tag":575,"props":1332,"children":1333},{},[1334],{"type":62,"value":1217},{"type":57,"tag":575,"props":1336,"children":1337},{},[1338],{"type":57,"tag":70,"props":1339,"children":1341},{"className":1340},[],[1342],{"type":62,"value":1343},"MEM0_API_KEY",{"type":57,"tag":575,"props":1345,"children":1346},{},[1347],{"type":57,"tag":124,"props":1348,"children":1351},{"href":1349,"rel":1350},"https:\u002F\u002Fapp.mem0.ai",[128],[1352],{"type":62,"value":1349},{"type":57,"tag":548,"props":1354,"children":1355},{},[1356,1361,1370],{"type":57,"tag":575,"props":1357,"children":1358},{},[1359],{"type":62,"value":1360},"OSS (default LLM)",{"type":57,"tag":575,"props":1362,"children":1363},{},[1364],{"type":57,"tag":70,"props":1365,"children":1367},{"className":1366},[],[1368],{"type":62,"value":1369},"OPENAI_API_KEY",{"type":57,"tag":575,"props":1371,"children":1372},{},[1373],{"type":57,"tag":124,"props":1374,"children":1377},{"href":1375,"rel":1376},"https:\u002F\u002Fplatform.openai.com\u002Fapi-keys",[128],[1378],{"type":62,"value":1375},{"type":57,"tag":64,"props":1380,"children":1381},{},[1382,1384,1389,1391,1395,1397,1402,1404,1410,1412,1418,1419,1425,1427,1433,1434,1440,1441,1447,1449,1455,1457,1463,1465,1471,1473,1479,1481,1486,1488,1494],{"type":62,"value":1383},"If present in env → continue.\nIf ",{"type":57,"tag":70,"props":1385,"children":1387},{"className":1386},[],[1388],{"type":62,"value":1343},{"type":62,"value":1390}," is missing AND the track is ",{"type":57,"tag":370,"props":1392,"children":1393},{},[1394],{"type":62,"value":1217},{"type":62,"value":1396}," → ",{"type":57,"tag":370,"props":1398,"children":1399},{},[1400],{"type":62,"value":1401},"default to Agent Mode",{"type":62,"value":1403},": run ",{"type":57,"tag":70,"props":1405,"children":1407},{"className":1406},[],[1408],{"type":62,"value":1409},"mem0 init --agent --agent-caller \u003Cyour-name> --json",{"type":62,"value":1411}," (after ",{"type":57,"tag":70,"props":1413,"children":1415},{"className":1414},[],[1416],{"type":62,"value":1417},"pip install mem0-cli",{"type":62,"value":778},{"type":57,"tag":70,"props":1420,"children":1422},{"className":1421},[],[1423],{"type":62,"value":1424},"npm install -g @mem0\u002Fcli",{"type":62,"value":1426},"), substituting your agent identity (e.g. ",{"type":57,"tag":70,"props":1428,"children":1430},{"className":1429},[],[1431],{"type":62,"value":1432},"claude-code",{"type":62,"value":1012},{"type":57,"tag":70,"props":1435,"children":1437},{"className":1436},[],[1438],{"type":62,"value":1439},"cursor",{"type":62,"value":1012},{"type":57,"tag":70,"props":1442,"children":1444},{"className":1443},[],[1445],{"type":62,"value":1446},"codex",{"type":62,"value":1448},"). If you forgot to pass ",{"type":57,"tag":70,"props":1450,"children":1452},{"className":1451},[],[1453],{"type":62,"value":1454},"--agent-caller",{"type":62,"value":1456},", run ",{"type":57,"tag":70,"props":1458,"children":1460},{"className":1459},[],[1461],{"type":62,"value":1462},"mem0 identify \u003Cyour-name>",{"type":62,"value":1464}," after init. Cache the key to ",{"type":57,"tag":70,"props":1466,"children":1468},{"className":1467},[],[1469],{"type":62,"value":1470},".env",{"type":62,"value":1472}," (with user consent) and continue. Tell the user to claim later with ",{"type":57,"tag":70,"props":1474,"children":1476},{"className":1475},[],[1477],{"type":62,"value":1478},"mem0 init --email \u003Ctheir-email>",{"type":62,"value":1480}," — same key, no agent disruption.\nIf missing AND ",{"type":57,"tag":370,"props":1482,"children":1483},{},[1484],{"type":62,"value":1485},"CI mode",{"type":62,"value":1487}," (",{"type":57,"tag":70,"props":1489,"children":1491},{"className":1490},[],[1492],{"type":62,"value":1493},"MEM0_INTEGRATE_CI=1",{"type":62,"value":1495},") → exit with code 2 and the name of the missing key.",{"type":57,"tag":64,"props":1497,"children":1498},{},[1499,1501,1507,1509,1514,1516,1521,1523,1529],{"type":62,"value":1500},"Never echo key values into ",{"type":57,"tag":70,"props":1502,"children":1504},{"className":1503},[],[1505],{"type":62,"value":1506},"trace.jsonl",{"type":62,"value":1508},". Persist to ",{"type":57,"tag":70,"props":1510,"children":1512},{"className":1511},[],[1513],{"type":62,"value":1470},{"type":62,"value":1515}," only with\nexplicit user consent, and append ",{"type":57,"tag":70,"props":1517,"children":1519},{"className":1518},[],[1520],{"type":62,"value":1470},{"type":62,"value":1522}," to ",{"type":57,"tag":70,"props":1524,"children":1526},{"className":1525},[],[1527],{"type":62,"value":1528},".gitignore",{"type":62,"value":1530}," if not already there.",{"type":57,"tag":64,"props":1532,"children":1533},{},[1534,1536,1542],{"type":62,"value":1535},"If the user is on OSS and wants a non-OpenAI LLM, route them to the\n",{"type":57,"tag":70,"props":1537,"children":1539},{"className":1538},[],[1540],{"type":62,"value":1541},"components\u002Fllms\u002F*",{"type":62,"value":1543}," docs and re-run this step with the chosen provider's key.",{"type":57,"tag":107,"props":1545,"children":1547},{"id":1546},"_5-goal-doc-the-hard-gate",[1548],{"type":62,"value":1549},"5. Goal doc — the hard gate",{"type":57,"tag":64,"props":1551,"children":1552},{},[1553,1555,1561,1563,1568],{"type":62,"value":1554},"Write ",{"type":57,"tag":70,"props":1556,"children":1558},{"className":1557},[],[1559],{"type":62,"value":1560},".mem0-integration\u002Fgoal.md",{"type":62,"value":1562}," and ",{"type":57,"tag":370,"props":1564,"children":1565},{},[1566],{"type":62,"value":1567},"require user approval before step 6",{"type":62,"value":628},{"type":57,"tag":64,"props":1570,"children":1571},{},[1572],{"type":62,"value":1573},"Template:",{"type":57,"tag":1063,"props":1575,"children":1578},{"className":1576,"code":1577,"language":62},[1066],"# Mem0 Integration Goal\n\n**What gets stored:** \u003Cone sentence — user utterances? extracted\npreferences? a specific domain fact like \"dietary restrictions\"?>\n\n**When it gets retrieved:** \u003Cone sentence — on each user turn? before a\nspecific tool call? at session start?>\n\n**Why:** \u003Cone sentence — the user-visible behavior change. \"Assistant\nremembers previous orders across sessions,\" not \"we added memory.\">\n\n**Product:** Platform | OSS  (locked from step 3, do not change)\n\n**Delegated skill:** \u003Craw URL of the published skill being used\nfrom \"Skill delegation rules\" above, or \"none — custom integration\nagainst `skills\u002Fmem0`\">.\n\n**Out of scope:** \u003Canything explicitly excluded: \"no graph memory,\"\n\"no multimodal,\" \"no migration from existing store\">\n",[1579],{"type":57,"tag":70,"props":1580,"children":1581},{"__ignoreMap":1071},[1582],{"type":62,"value":1577},{"type":57,"tag":64,"props":1584,"children":1585},{},[1586],{"type":62,"value":1587},"Rules:",{"type":57,"tag":114,"props":1589,"children":1590},{},[1591,1596,1607],{"type":57,"tag":118,"props":1592,"children":1593},{},[1594],{"type":62,"value":1595},"User must approve explicitly. If they edit the doc, reload and re-confirm.",{"type":57,"tag":118,"props":1597,"children":1598},{},[1599,1605],{"type":57,"tag":70,"props":1600,"children":1602},{"className":1601},[],[1603],{"type":62,"value":1604},"goal.md",{"type":62,"value":1606}," is the contract the test suite is written against. Never\nrewrite it after step 6 starts.",{"type":57,"tag":118,"props":1608,"children":1609},{},[1610],{"type":62,"value":1611},"Max 3 rejection rounds. On the 4th, exit with code 3 and the rejection\nnotes — the integration is not well-specified enough to proceed.",{"type":57,"tag":107,"props":1613,"children":1615},{"id":1614},"_6-integration-plan-how-and-where-hard-gate",[1616],{"type":62,"value":1617},"6. Integration plan — how and where (hard gate)",{"type":57,"tag":64,"props":1619,"children":1620},{},[1621,1623,1628],{"type":62,"value":1622},"Given ",{"type":57,"tag":70,"props":1624,"children":1626},{"className":1625},[],[1627],{"type":62,"value":1604},{"type":62,"value":1629}," is \"what and why,\" this step produces \"where and how\" and\ngets explicit user sign-off before any code is written.",{"type":57,"tag":64,"props":1631,"children":1632},{},[1633,1635,1640],{"type":62,"value":1634},"The skill does a ",{"type":57,"tag":370,"props":1636,"children":1637},{},[1638],{"type":62,"value":1639},"scoped",{"type":62,"value":1641}," read of the repo (no wide survey):",{"type":57,"tag":114,"props":1643,"children":1644},{},[1645,1686,1720],{"type":57,"tag":118,"props":1646,"children":1647},{},[1648,1650,1656,1657,1663,1664,1670,1671,1677,1678,1684],{"type":62,"value":1649},"Grep for the LLM call sites that match the goal (e.g., ",{"type":57,"tag":70,"props":1651,"children":1653},{"className":1652},[],[1654],{"type":62,"value":1655},"openai.chat.",{"type":62,"value":1027},{"type":57,"tag":70,"props":1658,"children":1660},{"className":1659},[],[1661],{"type":62,"value":1662},"anthropic.messages.",{"type":62,"value":1012},{"type":57,"tag":70,"props":1665,"children":1667},{"className":1666},[],[1668],{"type":62,"value":1669},"model.generateContent",{"type":62,"value":1012},{"type":57,"tag":70,"props":1672,"children":1674},{"className":1673},[],[1675],{"type":62,"value":1676},"ChatOpenAI",{"type":62,"value":1012},{"type":57,"tag":70,"props":1679,"children":1681},{"className":1680},[],[1682],{"type":62,"value":1683},"createLLM",{"type":62,"value":1685},").",{"type":57,"tag":118,"props":1687,"children":1688},{},[1689,1691,1697,1698,1704,1705,1711,1712,1718],{"type":62,"value":1690},"Grep for the user-identity source (",{"type":57,"tag":70,"props":1692,"children":1694},{"className":1693},[],[1695],{"type":62,"value":1696},"req.user",{"type":62,"value":1012},{"type":57,"tag":70,"props":1699,"children":1701},{"className":1700},[],[1702],{"type":62,"value":1703},"session.user",{"type":62,"value":1012},{"type":57,"tag":70,"props":1706,"children":1708},{"className":1707},[],[1709],{"type":62,"value":1710},"auth()",{"type":62,"value":1027},{"type":57,"tag":70,"props":1713,"children":1715},{"className":1714},[],[1716],{"type":62,"value":1717},"ctx.userId",{"type":62,"value":1719},", cookies).",{"type":57,"tag":118,"props":1721,"children":1722},{},[1723,1725,1730,1731,1736,1737,1742,1744,1749],{"type":62,"value":1724},"Check ",{"type":57,"tag":70,"props":1726,"children":1728},{"className":1727},[],[1729],{"type":62,"value":598},{"type":62,"value":397},{"type":57,"tag":70,"props":1732,"children":1734},{"className":1733},[],[1735],{"type":62,"value":748},{"type":62,"value":397},{"type":57,"tag":70,"props":1738,"children":1740},{"className":1739},[],[1741],{"type":62,"value":756},{"type":62,"value":1743}," for\nconflicts (e.g., existing ",{"type":57,"tag":70,"props":1745,"children":1747},{"className":1746},[],[1748],{"type":62,"value":11},{"type":62,"value":1750}," at a different version).",{"type":57,"tag":64,"props":1752,"children":1753},{},[1754,1756,1762],{"type":62,"value":1755},"Then write ",{"type":57,"tag":70,"props":1757,"children":1759},{"className":1758},[],[1760],{"type":62,"value":1761},".mem0-integration\u002Fplan.md",{"type":62,"value":1061},{"type":57,"tag":1063,"props":1764,"children":1767},{"className":1765,"code":1766,"language":62},[1066],"# Mem0 Integration Plan\n\n**Write pattern:** \u003Cone sentence — e.g., \"After each assistant reply,\ncall client.add([user_msg, assistant_msg], user_id=\u003Csource>).\">\n\n**Read pattern:** \u003Cone sentence — e.g., \"Before building the LLM prompt,\ncall client.search(query=latest_user_msg, user_id=\u003Csource>, limit=5)\nand inject results as a system message.\">\n\n**User identifier source:** \u003Ccode path — e.g., `req.auth.userId`,\n`session.user.email`, `ctx.params.user_id`. If none, ask the user.>\n\n**Session scoping:**\n  - user_id: \u003Csource>\n  - agent_id: \u003Cstatic slug | null>\n  - run_id:   \u003Csource | null>\n\n**Write call site:** `\u003Cfile:line_range>` — inside `\u003Cfunction>`\n**Read call site:**  `\u003Cfile:line_range>` — inside `\u003Cfunction>`\n\n**Dependencies to add:**\n  - `\u003Cpackage>@\u003Cversion pinned in frontmatter>`\n\n**Preserved behavior:** \u003Clist the existing repo behaviors that must\nkeep working after this edit — e.g., \"existing OpenAI streaming still\nworks,\" \"existing Redis session store still used,\" \"existing tests\nstill pass unchanged.\">\n\n**Coexistence:** \u003Cone bullet per existing system the integration sits\nalongside. Name the files\u002Fclasses. Example: \"The existing\n`agents\u002Fmemory\u002Fstorage.py` MemoryStorage class remains untouched and\nkeeps its LangGraph SummarizationEvent flow. Mem0 is added as a\nparallel long-term-facts store, in a new file, invoked only when\nMEM0_ENABLED=1 is set.\">\n\n**Feature flag:** \u003Cthe exact mechanism and the default. Required.\nExample: `env MEM0_ENABLED=1`, default unset \u002F off; `config.mem0.enabled`,\ndefault false. With the flag in its default state, the repo must\nbehave exactly like `main`.>\n\n**Sources consulted:** \u003Cminimum 2 URLs from \"Canonical sources\" above\nthat informed this plan. At least one `docs.mem0.ai` URL and one\ndelegated-skill URL. Cite the specific section or heading.>\n\n**E2E recipe:** \u003Chow the verification skill should drive the app\nend-to-end. Omit only if the repo is a pure library with no runnable\nentry point — in which case the E2E step will skip with a warning.>\n\n    start:               \u003Cshell command to launch the app locally,\n                          using $PORT for any network port>\n    ready_probe:         \u003Cone of: url=\u003CURL> status=\u003Ccode>  \u002F\n                          log=\"\u003Csubstring to wait for>\"  \u002F\n                          sleep=\u003Cseconds, last resort>>\n    compose_services:    \u003Coptional: whitespace-separated service\n                          names in docker-compose.yml to start first;\n                          use label mem0-e2e: \"true\" to mark them>\n    write_call:          \u003Ccommand that triggers the Mem0 write path\n                          exactly once; ≤ 60s runtime>\n    write_async_wait_ms: \u003Cmilliseconds to wait after write_call for\n                          async memory flush; default 0>\n    read_call:           \u003Ccommand that triggers the Mem0 read path,\n                          typically a fresh session \u002F new request>\n    read_assert:         \u003Csubstring, regex, or jsonpath=\u003Cexpr>=\u003Cvalue>\n                          that MUST appear in read_call's output for\n                          the E2E to pass. Derived from goal.md's\n                          \"What gets stored.\">\n\n**Rejected alternatives:** \u003Cbriefly, 1–2 bullets — patterns the skill\nconsidered but did not pick, and why. Helps the user decide.>\n",[1768],{"type":57,"tag":70,"props":1769,"children":1770},{"__ignoreMap":1071},[1771],{"type":62,"value":1766},{"type":57,"tag":64,"props":1773,"children":1774},{},[1775],{"type":62,"value":1587},{"type":57,"tag":114,"props":1777,"children":1778},{},[1779,1784,1789,1794],{"type":57,"tag":118,"props":1780,"children":1781},{},[1782],{"type":62,"value":1783},"Show the user the proposed call sites with 10 lines of context around\neach before asking for approval.",{"type":57,"tag":118,"props":1785,"children":1786},{},[1787],{"type":62,"value":1788},"If the skill can't find a plausible call site for either write or read,\nit exits with code 5 and asks the user to name the file(s) manually\n(this is the \"no fit here\" signal — don't guess).",{"type":57,"tag":118,"props":1790,"children":1791},{},[1792],{"type":62,"value":1793},"Max 3 rejection rounds on the plan. On the 4th, exit code 5 with the\nlast plan and the user's notes.",{"type":57,"tag":118,"props":1795,"children":1796},{},[1797,1799,1804],{"type":62,"value":1798},"If the user edits ",{"type":57,"tag":70,"props":1800,"children":1802},{"className":1801},[],[1803],{"type":62,"value":103},{"type":62,"value":1805}," by hand, reload and re-confirm.",{"type":57,"tag":64,"props":1807,"children":1808},{},[1809,1814,1816,1821],{"type":57,"tag":70,"props":1810,"children":1812},{"className":1811},[],[1813],{"type":62,"value":103},{"type":62,"value":1815}," (not ",{"type":57,"tag":70,"props":1817,"children":1819},{"className":1818},[],[1820],{"type":62,"value":1604},{"type":62,"value":1822},") is the contract the subagent implements against\nin step 8.",{"type":57,"tag":107,"props":1824,"children":1826},{"id":1825},"_7-tests-first-tdd",[1827],{"type":62,"value":1828},"7. Tests first (TDD)",{"type":57,"tag":64,"props":1830,"children":1831},{},[1832,1834,1839],{"type":62,"value":1833},"Main agent writes failing tests against ",{"type":57,"tag":70,"props":1835,"children":1837},{"className":1836},[],[1838],{"type":62,"value":1604},{"type":62,"value":1840}," in the repo's native\ntest framework:",{"type":57,"tag":540,"props":1842,"children":1843},{},[1844,1859],{"type":57,"tag":544,"props":1845,"children":1846},{},[1847],{"type":57,"tag":548,"props":1848,"children":1849},{},[1850,1854],{"type":57,"tag":552,"props":1851,"children":1852},{},[1853],{"type":62,"value":842},{"type":57,"tag":552,"props":1855,"children":1856},{},[1857],{"type":62,"value":1858},"Default framework",{"type":57,"tag":568,"props":1860,"children":1861},{},[1862,1878,1903],{"type":57,"tag":548,"props":1863,"children":1864},{},[1865,1869],{"type":57,"tag":575,"props":1866,"children":1867},{},[1868],{"type":62,"value":903},{"type":57,"tag":575,"props":1870,"children":1871},{},[1872],{"type":57,"tag":70,"props":1873,"children":1875},{"className":1874},[],[1876],{"type":62,"value":1877},"pytest",{"type":57,"tag":548,"props":1879,"children":1880},{},[1881,1886],{"type":57,"tag":575,"props":1882,"children":1883},{},[1884],{"type":62,"value":1885},"TypeScript",{"type":57,"tag":575,"props":1887,"children":1888},{},[1889,1895,1897],{"type":57,"tag":70,"props":1890,"children":1892},{"className":1891},[],[1893],{"type":62,"value":1894},"vitest",{"type":62,"value":1896}," if detected, else ",{"type":57,"tag":70,"props":1898,"children":1900},{"className":1899},[],[1901],{"type":62,"value":1902},"jest",{"type":57,"tag":548,"props":1904,"children":1905},{},[1906,1911],{"type":57,"tag":575,"props":1907,"children":1908},{},[1909],{"type":62,"value":1910},"JavaScript",{"type":57,"tag":575,"props":1912,"children":1913},{},[1914],{"type":62,"value":1915},"same",{"type":57,"tag":64,"props":1917,"children":1918},{},[1919,1921,1926],{"type":62,"value":1920},"Test assertion shapes must match the ",{"type":57,"tag":370,"props":1922,"children":1923},{},[1924],{"type":62,"value":1925},"canonical signatures",{"type":62,"value":1061},{"type":57,"tag":114,"props":1928,"children":1929},{},[1930,1956,1976],{"type":57,"tag":118,"props":1931,"children":1932},{},[1933,1935,1940,1942,1948,1949,1955],{"type":62,"value":1934},"Platform method signatures: ",{"type":57,"tag":70,"props":1936,"children":1938},{"className":1937},[],[1939],{"type":62,"value":149},{"type":62,"value":1941},"\n(request body schemas for ",{"type":57,"tag":70,"props":1943,"children":1945},{"className":1944},[],[1946],{"type":62,"value":1947},"\u002Fv1\u002Fmemories\u002F",{"type":62,"value":1562},{"type":57,"tag":70,"props":1950,"children":1952},{"className":1951},[],[1953],{"type":62,"value":1954},"\u002Fv1\u002Fmemories\u002Fsearch\u002F",{"type":62,"value":1685},{"type":57,"tag":118,"props":1957,"children":1958},{},[1959,1961,1966,1968,1974],{"type":62,"value":1960},"OSS method signatures: the delegated skill named in ",{"type":57,"tag":70,"props":1962,"children":1964},{"className":1963},[],[1965],{"type":62,"value":103},{"type":62,"value":1967},"\n(fetched from its raw URL) or ",{"type":57,"tag":70,"props":1969,"children":1971},{"className":1970},[],[1972],{"type":62,"value":1973},"skills\u002Fmem0\u002FSKILL.md",{"type":62,"value":1975}," as the default.",{"type":57,"tag":118,"props":1977,"children":1978},{},[1979],{"type":62,"value":1980},"Do not hand-roll request shapes. If the delegated skill has an\nexample block, lift it verbatim.",{"type":57,"tag":64,"props":1982,"children":1983},{},[1984,1986,1991],{"type":62,"value":1985},"Minimum two test files (paths taken from ",{"type":57,"tag":70,"props":1987,"children":1989},{"className":1988},[],[1990],{"type":62,"value":103},{"type":62,"value":1992}," call sites):",{"type":57,"tag":114,"props":1994,"children":1995},{},[1996,2023],{"type":57,"tag":118,"props":1997,"children":1998},{},[1999,2005,2007,2013,2015,2021],{"type":57,"tag":70,"props":2000,"children":2002},{"className":2001},[],[2003],{"type":62,"value":2004},"test_mem0_write.\u003Cext>",{"type":62,"value":2006}," — asserts ",{"type":57,"tag":70,"props":2008,"children":2010},{"className":2009},[],[2011],{"type":62,"value":2012},"add()",{"type":62,"value":2014}," is called at the Write call\nsite with the right payload shape (Platform messages-array vs OSS string)\nand the right ",{"type":57,"tag":70,"props":2016,"children":2018},{"className":2017},[],[2019],{"type":62,"value":2020},"user_id",{"type":62,"value":2022}," source.",{"type":57,"tag":118,"props":2024,"children":2025},{},[2026,2032,2033,2039],{"type":57,"tag":70,"props":2027,"children":2029},{"className":2028},[],[2030],{"type":62,"value":2031},"test_mem0_read.\u003Cext>",{"type":62,"value":2006},{"type":57,"tag":70,"props":2034,"children":2036},{"className":2035},[],[2037],{"type":62,"value":2038},"search()",{"type":62,"value":2040}," runs before the Read call\nsite and the result is wired into the LLM prompt \u002F response path.",{"type":57,"tag":64,"props":2042,"children":2043},{},[2044,2046,2051,2053,2059,2060,2066],{"type":62,"value":2045},"Tests MUST be importable with ",{"type":57,"tag":70,"props":2047,"children":2049},{"className":2048},[],[2050],{"type":62,"value":1343},{"type":62,"value":2052}," unset. This is the design\npressure that forces step 8's lazy ",{"type":57,"tag":70,"props":2054,"children":2056},{"className":2055},[],[2057],{"type":62,"value":2058},"MemoryClient()",{"type":62,"value":397},{"type":57,"tag":70,"props":2061,"children":2063},{"className":2062},[],[2064],{"type":62,"value":2065},"Memory()",{"type":62,"value":2067},"\nconstruction — eager module-level init hits the API on import and\nbreaks pre-existing test collection when the key is missing.",{"type":57,"tag":64,"props":2069,"children":2070},{},[2071,2073,2078],{"type":62,"value":2072},"Run the tests. They ",{"type":57,"tag":370,"props":2074,"children":2075},{},[2076],{"type":62,"value":2077},"must fail",{"type":62,"value":2079},". If they pass before any implementation,\nthe tests are wrong — rewrite them.",{"type":57,"tag":107,"props":2081,"children":2083},{"id":2082},"_8-implementation-subagent-fresh-context",[2084],{"type":62,"value":2085},"8. Implementation (subagent, fresh context)",{"type":57,"tag":64,"props":2087,"children":2088},{},[2089],{"type":62,"value":2090},"Spawn a subagent with:",{"type":57,"tag":114,"props":2092,"children":2093},{},[2094,2144,2154],{"type":57,"tag":118,"props":2095,"children":2096},{},[2097,2102,2104,2109,2110,2115,2117,2122,2124,2129,2131,2136,2138,2143],{"type":57,"tag":370,"props":2098,"children":2099},{},[2100],{"type":62,"value":2101},"Inputs",{"type":62,"value":2103},": the repo, ",{"type":57,"tag":70,"props":2105,"children":2107},{"className":2106},[],[2108],{"type":62,"value":1604},{"type":62,"value":1012},{"type":57,"tag":70,"props":2111,"children":2113},{"className":2112},[],[2114],{"type":62,"value":103},{"type":62,"value":2116},", the two test files, and\ndirect URLs to: the delegated skill (from ",{"type":57,"tag":70,"props":2118,"children":2120},{"className":2119},[],[2121],{"type":62,"value":103},{"type":62,"value":2123},"), the SDK source\n(pinned per ",{"type":57,"tag":70,"props":2125,"children":2127},{"className":2126},[],[2128],{"type":62,"value":259},{"type":62,"value":2130},"), ",{"type":57,"tag":70,"props":2132,"children":2134},{"className":2133},[],[2135],{"type":62,"value":126},{"type":62,"value":2137},",\nand ",{"type":57,"tag":70,"props":2139,"children":2141},{"className":2140},[],[2142],{"type":62,"value":149},{"type":62,"value":628},{"type":57,"tag":118,"props":2145,"children":2146},{},[2147,2152],{"type":57,"tag":370,"props":2148,"children":2149},{},[2150],{"type":62,"value":2151},"No access",{"type":62,"value":2153}," to main agent's reasoning trace or scratchpad.",{"type":57,"tag":118,"props":2155,"children":2156},{},[2157,2162,2164],{"type":57,"tag":370,"props":2158,"children":2159},{},[2160],{"type":62,"value":2161},"System prompt",{"type":62,"value":2163}," (verbatim):",{"type":57,"tag":1063,"props":2165,"children":2168},{"className":2166,"code":2167,"language":62},[1066],"You are implementing a Mem0 integration for an existing repo.\n\nRead these first:\n- plan.md           (the mechanical contract)\n- goal.md           (the intent — do not change it)\n- the test files    (do not change them either)\n- \u003Cdelegated skill raw URL from plan.md>\n- https:\u002F\u002Fdocs.mem0.ai\u002Fllms.txt\n- https:\u002F\u002Fdocs.mem0.ai\u002Fopenapi.json  (Platform only)\n\nConstraints — all required, all enforced at review:\n\n1. Touch only the files named in plan.md's call sites, or add\n   strictly new files.\n2. Do not remove or rename any existing symbol. Do not change\n   any public signature.\n3. Do not modify any existing test.\n4. Gate every line of new Mem0 code behind the feature flag from\n   plan.md. With the flag in its default state, the repo must\n   behave exactly like `main` — byte-for-byte, including stdout\n   and return values.\n5. Use only the \u003CPlatform | OSS> SDK surface. No new dependencies\n   beyond those listed under plan.md's \"Dependencies to add.\"\n6. Preserve everything listed under plan.md's \"Preserved behavior\"\n   and \"Coexistence.\"\n7. Lazy client construction. `MemoryClient()` validates the API\n   key in `__init__` (it makes a network call). Never instantiate\n   it at module-import time — construct on first use inside the\n   request \u002F handler path. The same rule applies to OSS `Memory()`,\n   which can eagerly initialize embedding and LLM providers. Use\n   a function-local singleton (`functools.lru_cache`, a module-level\n   `_client = None` + getter, or DI scope) — never a top-level\n   global. Eager init breaks the pre-existing test suite at\n   collection time whenever the key is missing or invalid, which\n   is a non-invasiveness violation.\n\nImplement the plan to make the new tests pass while all\npre-existing tests continue to pass unchanged.\n",[2169],{"type":57,"tag":70,"props":2170,"children":2171},{"__ignoreMap":1071},[2172],{"type":62,"value":2167},{"type":57,"tag":64,"props":2174,"children":2175},{},[2176,2178,2183,2185,2190],{"type":62,"value":2177},"Subagent returns a diff. Main agent reviews against ",{"type":57,"tag":70,"props":2179,"children":2181},{"className":2180},[],[2182],{"type":62,"value":103},{"type":62,"value":2184}," (the\nmechanical contract) and ",{"type":57,"tag":70,"props":2186,"children":2188},{"className":2187},[],[2189],{"type":62,"value":1604},{"type":62,"value":2191}," (the intent):",{"type":57,"tag":114,"props":2193,"children":2194},{},[2195,2200,2205],{"type":57,"tag":118,"props":2196,"children":2197},{},[2198],{"type":62,"value":2199},"Approved → apply the diff, commit.",{"type":57,"tag":118,"props":2201,"children":2202},{},[2203],{"type":62,"value":2204},"Rejected → return with specific, actionable feedback (not \"try again\").",{"type":57,"tag":118,"props":2206,"children":2207},{},[2208],{"type":62,"value":2209},"Max 3 review loops. Beyond that → exit code 4 with the last diff and\nreviewer feedback.",{"type":57,"tag":107,"props":2211,"children":2213},{"id":2212},"_9-commit-handoff",[2214],{"type":62,"value":2215},"9. Commit + handoff",{"type":57,"tag":64,"props":2217,"children":2218},{},[2219,2221,2227,2229,2234],{"type":62,"value":2220},"Create branch ",{"type":57,"tag":70,"props":2222,"children":2224},{"className":2223},[],[2225],{"type":62,"value":2226},"mem0-integrate\u002F\u003Cshort-goal-slug>",{"type":62,"value":2228}," and commit in\n",{"type":57,"tag":370,"props":2230,"children":2231},{},[2232],{"type":62,"value":2233},"separate commits",{"type":62,"value":2235}," so reviewers can cherry-pick:",{"type":57,"tag":378,"props":2237,"children":2238},{},[2239,2263,2274,2285],{"type":57,"tag":118,"props":2240,"children":2241},{},[2242,2248,2250,2255,2256,2261],{"type":57,"tag":70,"props":2243,"children":2245},{"className":2244},[],[2246],{"type":62,"value":2247},"mem0: add gated dependency",{"type":62,"value":2249}," — just the ",{"type":57,"tag":70,"props":2251,"children":2253},{"className":2252},[],[2254],{"type":62,"value":748},{"type":62,"value":397},{"type":57,"tag":70,"props":2257,"children":2259},{"className":2258},[],[2260],{"type":62,"value":598},{"type":62,"value":2262},"\nchange.",{"type":57,"tag":118,"props":2264,"children":2265},{},[2266,2272],{"type":57,"tag":70,"props":2267,"children":2269},{"className":2268},[],[2270],{"type":62,"value":2271},"mem0: add integration module",{"type":62,"value":2273}," — the new file(s).",{"type":57,"tag":118,"props":2275,"children":2276},{},[2277,2283],{"type":57,"tag":70,"props":2278,"children":2280},{"className":2279},[],[2281],{"type":62,"value":2282},"mem0: wire into \u003Ccall site>",{"type":62,"value":2284}," — the call-site edit(s), still gated.",{"type":57,"tag":118,"props":2286,"children":2287},{},[2288,2294],{"type":57,"tag":70,"props":2289,"children":2291},{"className":2290},[],[2292],{"type":62,"value":2293},"mem0: add tests",{"type":62,"value":2295}," — the new test files.",{"type":57,"tag":64,"props":2297,"children":2298},{},[2299,2301,2307,2309,2315],{"type":62,"value":2300},"If ",{"type":57,"tag":70,"props":2302,"children":2304},{"className":2303},[],[2305],{"type":62,"value":2306},"--no-heal",{"type":62,"value":2308}," is set → print ",{"type":57,"tag":70,"props":2310,"children":2312},{"className":2311},[],[2313],{"type":62,"value":2314},"Run \u002Fmem0-test-integration to verify.",{"type":62,"value":2316},"\nand exit. Otherwise proceed to step 10.",{"type":57,"tag":107,"props":2318,"children":2320},{"id":2319},"_10-self-healing-loop-default-on-disable-with-no-heal",[2321,2323,2328],{"type":62,"value":2322},"10. Self-healing loop (default ON; disable with ",{"type":57,"tag":70,"props":2324,"children":2326},{"className":2325},[],[2327],{"type":62,"value":2306},{"type":62,"value":2329},")",{"type":57,"tag":64,"props":2331,"children":2332},{},[2333,2335,2341,2343,2349,2351,2357],{"type":62,"value":2334},"Run ",{"type":57,"tag":70,"props":2336,"children":2338},{"className":2337},[],[2339],{"type":62,"value":2340},"\u002Fmem0-test-integration --ci",{"type":62,"value":2342}," in a subprocess. If ",{"type":57,"tag":70,"props":2344,"children":2346},{"className":2345},[],[2347],{"type":62,"value":2348},"scorecard.json",{"type":62,"value":2350},"\nreports ",{"type":57,"tag":70,"props":2352,"children":2354},{"className":2353},[],[2355],{"type":62,"value":2356},"overall: pass",{"type":62,"value":2358}," → done, exit 0.",{"type":57,"tag":64,"props":2360,"children":2361},{},[2362],{"type":62,"value":2363},"Otherwise loop:",{"type":57,"tag":378,"props":2365,"children":2366},{},[2367,2456,2535,2553,2613,2631],{"type":57,"tag":118,"props":2368,"children":2369},{},[2370,2375,2377,2382,2384],{"type":57,"tag":370,"props":2371,"children":2372},{},[2373],{"type":62,"value":2374},"Categorize the failing check",{"type":62,"value":2376}," from ",{"type":57,"tag":70,"props":2378,"children":2380},{"className":2379},[],[2381],{"type":62,"value":2348},{"type":62,"value":2383},". Route per\ncategory:",{"type":57,"tag":114,"props":2385,"children":2386},{},[2387,2405,2416,2427,2438],{"type":57,"tag":118,"props":2388,"children":2389},{},[2390,2396,2397,2403],{"type":57,"tag":70,"props":2391,"children":2393},{"className":2392},[],[2394],{"type":62,"value":2395},"install",{"type":62,"value":397},{"type":57,"tag":70,"props":2398,"children":2400},{"className":2399},[],[2401],{"type":62,"value":2402},"static_checks",{"type":62,"value":2404}," → dependency or import fix.",{"type":57,"tag":118,"props":2406,"children":2407},{},[2408,2414],{"type":57,"tag":70,"props":2409,"children":2411},{"className":2410},[],[2412],{"type":62,"value":2413},"unit_tests",{"type":62,"value":2415}," → wiring or assertion fix.",{"type":57,"tag":118,"props":2417,"children":2418},{},[2419,2425],{"type":57,"tag":70,"props":2420,"children":2422},{"className":2421},[],[2423],{"type":62,"value":2424},"smoke_test",{"type":62,"value":2426}," → API key or SDK call-shape fix.",{"type":57,"tag":118,"props":2428,"children":2429},{},[2430,2436],{"type":57,"tag":70,"props":2431,"children":2433},{"className":2432},[],[2434],{"type":62,"value":2435},"e2e_test",{"type":62,"value":2437}," → recipe, flag-wiring, or integration-point fix.",{"type":57,"tag":118,"props":2439,"children":2440},{},[2441,2454],{"type":57,"tag":370,"props":2442,"children":2443},{},[2444,2446,2452],{"type":62,"value":2445},"Pre-existing test failure (test skill exit code 7,\n",{"type":57,"tag":70,"props":2447,"children":2449},{"className":2448},[],[2450],{"type":62,"value":2451},"non_invasive: false",{"type":62,"value":2453}," in scorecard) → STOP.",{"type":62,"value":2455}," This is a\nnon-invasiveness violation. Do NOT attempt to \"fix\" it (that\nbreaks principle 3). Exit code 6 with rationale.",{"type":57,"tag":118,"props":2457,"children":2458},{},[2459,2464,2466,2471,2472,2477,2478,2484,2485,2490,2492,2498,2499,2505,2506,2512,2513,2519,2520,2524,2526],{"type":57,"tag":370,"props":2460,"children":2461},{},[2462],{"type":62,"value":2463},"Spawn a remediation subagent",{"type":62,"value":2465},", fresh context. Inputs:\n",{"type":57,"tag":70,"props":2467,"children":2469},{"className":2468},[],[2470],{"type":62,"value":103},{"type":62,"value":1012},{"type":57,"tag":70,"props":2473,"children":2475},{"className":2474},[],[2476],{"type":62,"value":1604},{"type":62,"value":1012},{"type":57,"tag":70,"props":2479,"children":2481},{"className":2480},[],[2482],{"type":62,"value":2483},"scorecard.md",{"type":62,"value":1012},{"type":57,"tag":70,"props":2486,"children":2488},{"className":2487},[],[2489],{"type":62,"value":2348},{"type":62,"value":2491},", the last\ncommitted diff, and the relevant log file for the failing category\n(",{"type":57,"tag":70,"props":2493,"children":2495},{"className":2494},[],[2496],{"type":62,"value":2497},"test-stdout.log",{"type":62,"value":397},{"type":57,"tag":70,"props":2500,"children":2502},{"className":2501},[],[2503],{"type":62,"value":2504},"smoke-stdout.log",{"type":62,"value":397},{"type":57,"tag":70,"props":2507,"children":2509},{"className":2508},[],[2510],{"type":62,"value":2511},"e2e-app.log",{"type":62,"value":750},{"type":57,"tag":70,"props":2514,"children":2516},{"className":2515},[],[2517],{"type":62,"value":2518},"e2e-calls.log",{"type":62,"value":1685},{"type":57,"tag":2521,"props":2522,"children":2523},"br",{},[],{"type":62,"value":2525},"System prompt (verbatim):",{"type":57,"tag":1063,"props":2527,"children":2530},{"className":2528,"code":2529,"language":62},[1066],"You are fixing a failing Mem0 integration test.\n\nNon-negotiable constraints:\n- Do not modify test files.\n- Do not remove or rename any existing symbol or signature.\n- Do not change pre-existing behavior. The feature flag from\n  plan.md must still default to OFF, and with the flag in its\n  default state the repo must behave exactly like main.\n- Touch only the files named in plan.md's call sites, or add\n  strictly new files.\n- Return the smallest possible diff that fixes the single\n  failing check listed in scorecard.md. No drive-by cleanup.\n",[2531],{"type":57,"tag":70,"props":2532,"children":2533},{"__ignoreMap":1071},[2534],{"type":62,"value":2529},{"type":57,"tag":118,"props":2536,"children":2537},{},[2538,2543,2545,2551],{"type":57,"tag":370,"props":2539,"children":2540},{},[2541],{"type":62,"value":2542},"Apply the diff",{"type":62,"value":2544},"; commit on the same branch with message\n",{"type":57,"tag":70,"props":2546,"children":2548},{"className":2547},[],[2549],{"type":62,"value":2550},"mem0-heal: \u003Ccategory> attempt \u003CN>",{"type":62,"value":2552},". Do NOT amend earlier commits\n(reviewers need the heal trail).",{"type":57,"tag":118,"props":2554,"children":2555},{},[2556,2566,2568],{"type":57,"tag":370,"props":2557,"children":2558},{},[2559,2561],{"type":62,"value":2560},"Re-run ",{"type":57,"tag":70,"props":2562,"children":2564},{"className":2563},[],[2565],{"type":62,"value":2340},{"type":62,"value":2567},". Outcomes:",{"type":57,"tag":114,"props":2569,"children":2570},{},[2571,2580,2585],{"type":57,"tag":118,"props":2572,"children":2573},{},[2574,2579],{"type":57,"tag":70,"props":2575,"children":2577},{"className":2576},[],[2578],{"type":62,"value":2356},{"type":62,"value":2358},{"type":57,"tag":118,"props":2581,"children":2582},{},[2583],{"type":62,"value":2584},"Same check still failing → increment attempt counter; loop.",{"type":57,"tag":118,"props":2586,"children":2587},{},[2588,2590,2595,2597,2603,2605,2611],{"type":62,"value":2589},"A ",{"type":57,"tag":800,"props":2591,"children":2592},{},[2593],{"type":62,"value":2594},"different",{"type":62,"value":2596}," check now failing → regression. Revert the heal\ncommit (",{"type":57,"tag":70,"props":2598,"children":2600},{"className":2599},[],[2601],{"type":62,"value":2602},"git revert HEAD --no-edit",{"type":62,"value":2604},"), record the regression in\n",{"type":57,"tag":70,"props":2606,"children":2608},{"className":2607},[],[2609],{"type":62,"value":2610},".mem0-integration\u002Fheal-trace.md",{"type":62,"value":2612},", exit code 6.",{"type":57,"tag":118,"props":2614,"children":2615},{},[2616,2621,2623,2629],{"type":57,"tag":370,"props":2617,"children":2618},{},[2619],{"type":62,"value":2620},"Bounded iterations.",{"type":62,"value":2622}," Default 3 attempts per failing category.\nOverride with ",{"type":57,"tag":70,"props":2624,"children":2626},{"className":2625},[],[2627],{"type":62,"value":2628},"--heal-max N",{"type":62,"value":2630}," (hard cap 10). On exhaustion, exit 6\nwith the full attempt trace: each diff, each scorecard, final log\ntail.",{"type":57,"tag":118,"props":2632,"children":2633},{},[2634,2639,2641,2646],{"type":57,"tag":370,"props":2635,"children":2636},{},[2637],{"type":62,"value":2638},"Post-loop summary",{"type":62,"value":2640}," written to ",{"type":57,"tag":70,"props":2642,"children":2644},{"className":2643},[],[2645],{"type":62,"value":2610},{"type":62,"value":2647},":\nwhich category failed, how many attempts, each diff's intent, final\nstatus, and — on success — the delta from initial scorecard to final.",{"type":57,"tag":79,"props":2649,"children":2651},{"id":2650},"artifacts-all-under-mem0-integration",[2652,2654,2660],{"type":62,"value":2653},"Artifacts (all under ",{"type":57,"tag":70,"props":2655,"children":2657},{"className":2656},[],[2658],{"type":62,"value":2659},".mem0-integration\u002F",{"type":62,"value":2329},{"type":57,"tag":540,"props":2662,"children":2663},{},[2664,2685],{"type":57,"tag":544,"props":2665,"children":2666},{},[2667],{"type":57,"tag":548,"props":2668,"children":2669},{},[2670,2675,2680],{"type":57,"tag":552,"props":2671,"children":2672},{},[2673],{"type":62,"value":2674},"File",{"type":57,"tag":552,"props":2676,"children":2677},{},[2678],{"type":62,"value":2679},"Purpose",{"type":57,"tag":552,"props":2681,"children":2682},{},[2683],{"type":62,"value":2684},"Retention",{"type":57,"tag":568,"props":2686,"children":2687},{},[2688,2709,2729,2749,2770,2791,2812],{"type":57,"tag":548,"props":2689,"children":2690},{},[2691,2699,2704],{"type":57,"tag":575,"props":2692,"children":2693},{},[2694],{"type":57,"tag":70,"props":2695,"children":2697},{"className":2696},[],[2698],{"type":62,"value":1112},{"type":57,"tag":575,"props":2700,"children":2701},{},[2702],{"type":62,"value":2703},"Repo comprehension + candidate backend surfaces (step 2).",{"type":57,"tag":575,"props":2705,"children":2706},{},[2707],{"type":62,"value":2708},"Keep across runs.",{"type":57,"tag":548,"props":2710,"children":2711},{},[2712,2720,2725],{"type":57,"tag":575,"props":2713,"children":2714},{},[2715],{"type":57,"tag":70,"props":2716,"children":2718},{"className":2717},[],[2719],{"type":62,"value":1604},{"type":57,"tag":575,"props":2721,"children":2722},{},[2723],{"type":62,"value":2724},"Approved intent. Never rewritten after step 6.",{"type":57,"tag":575,"props":2726,"children":2727},{},[2728],{"type":62,"value":2708},{"type":57,"tag":548,"props":2730,"children":2731},{},[2732,2740,2745],{"type":57,"tag":575,"props":2733,"children":2734},{},[2735],{"type":57,"tag":70,"props":2736,"children":2738},{"className":2737},[],[2739],{"type":62,"value":103},{"type":57,"tag":575,"props":2741,"children":2742},{},[2743],{"type":62,"value":2744},"Approved mechanics (where, how, call sites, preserved behavior).",{"type":57,"tag":575,"props":2746,"children":2747},{},[2748],{"type":62,"value":2708},{"type":57,"tag":548,"props":2750,"children":2751},{},[2752,2760,2765],{"type":57,"tag":575,"props":2753,"children":2754},{},[2755],{"type":57,"tag":70,"props":2756,"children":2758},{"className":2757},[],[2759],{"type":62,"value":1506},{"type":57,"tag":575,"props":2761,"children":2762},{},[2763],{"type":62,"value":2764},"Every tool call, decision, and subagent exchange this run.",{"type":57,"tag":575,"props":2766,"children":2767},{},[2768],{"type":62,"value":2769},"Overwritten per run.",{"type":57,"tag":548,"props":2771,"children":2772},{},[2773,2782,2787],{"type":57,"tag":575,"props":2774,"children":2775},{},[2776],{"type":57,"tag":70,"props":2777,"children":2779},{"className":2778},[],[2780],{"type":62,"value":2781},"diff.patch",{"type":57,"tag":575,"props":2783,"children":2784},{},[2785],{"type":62,"value":2786},"The committed integration as a reviewable patch.",{"type":57,"tag":575,"props":2788,"children":2789},{},[2790],{"type":62,"value":2769},{"type":57,"tag":548,"props":2792,"children":2793},{},[2794,2803,2808],{"type":57,"tag":575,"props":2795,"children":2796},{},[2797],{"type":57,"tag":70,"props":2798,"children":2800},{"className":2799},[],[2801],{"type":62,"value":2802},"heal-trace.md",{"type":57,"tag":575,"props":2804,"children":2805},{},[2806],{"type":62,"value":2807},"Per-attempt record of the self-healing loop (step 10).",{"type":57,"tag":575,"props":2809,"children":2810},{},[2811],{"type":62,"value":2769},{"type":57,"tag":548,"props":2813,"children":2814},{},[2815,2823,2834],{"type":57,"tag":575,"props":2816,"children":2817},{},[2818],{"type":57,"tag":70,"props":2819,"children":2821},{"className":2820},[],[2822],{"type":62,"value":1125},{"type":57,"tag":575,"props":2824,"children":2825},{},[2826,2832],{"type":57,"tag":70,"props":2827,"children":2829},{"className":2828},[],[2830],{"type":62,"value":2831},"{\"product\": \"platform\"|\"oss\", \"language\": \"...\", \"mem0_version\": \"...\", \"write_site\": \"file:line\", \"read_site\": \"file:line\", \"feature_flag\": \"MEM0_ENABLED\"}",{"type":62,"value":2833}," — consumed by the verification skill.",{"type":57,"tag":575,"props":2835,"children":2836},{},[2837],{"type":62,"value":2769},{"type":57,"tag":64,"props":2839,"children":2840},{},[2841,2846,2848,2853],{"type":57,"tag":70,"props":2842,"children":2844},{"className":2843},[],[2845],{"type":62,"value":2659},{"type":62,"value":2847}," is added to ",{"type":57,"tag":70,"props":2849,"children":2851},{"className":2850},[],[2852],{"type":62,"value":1528},{"type":62,"value":2854}," on first run. Nothing is\nwritten outside this directory and the repo's source tree.",{"type":57,"tag":79,"props":2856,"children":2858},{"id":2857},"modes",[2859],{"type":62,"value":2860},"Modes",{"type":57,"tag":540,"props":2862,"children":2863},{},[2864,2885],{"type":57,"tag":544,"props":2865,"children":2866},{},[2867],{"type":57,"tag":548,"props":2868,"children":2869},{},[2870,2875,2880],{"type":57,"tag":552,"props":2871,"children":2872},{},[2873],{"type":62,"value":2874},"Mode",{"type":57,"tag":552,"props":2876,"children":2877},{},[2878],{"type":62,"value":2879},"Trigger",{"type":57,"tag":552,"props":2881,"children":2882},{},[2883],{"type":62,"value":2884},"Behavior",{"type":57,"tag":568,"props":2886,"children":2887},{},[2888,2914],{"type":57,"tag":548,"props":2889,"children":2890},{},[2891,2896,2909],{"type":57,"tag":575,"props":2892,"children":2893},{},[2894],{"type":62,"value":2895},"Interactive (default)",{"type":57,"tag":575,"props":2897,"children":2898},{},[2899,2901,2907],{"type":62,"value":2900},"TTY present, ",{"type":57,"tag":70,"props":2902,"children":2904},{"className":2903},[],[2905],{"type":62,"value":2906},"MEM0_INTEGRATE_CI",{"type":62,"value":2908}," unset",{"type":57,"tag":575,"props":2910,"children":2911},{},[2912],{"type":62,"value":2913},"Asks for keys, confirms goal doc, shows recommendations.",{"type":57,"tag":548,"props":2915,"children":2916},{},[2917,2922,2930],{"type":57,"tag":575,"props":2918,"children":2919},{},[2920],{"type":62,"value":2921},"CI",{"type":57,"tag":575,"props":2923,"children":2924},{},[2925],{"type":57,"tag":70,"props":2926,"children":2928},{"className":2927},[],[2929],{"type":62,"value":1493},{"type":57,"tag":575,"props":2931,"children":2932},{},[2933,2935,2941,2943,2948],{"type":62,"value":2934},"Requires keys in env, requires ",{"type":57,"tag":70,"props":2936,"children":2938},{"className":2937},[],[2939],{"type":62,"value":2940},"--product",{"type":62,"value":2942},", auto-approves goal doc from ",{"type":57,"tag":70,"props":2944,"children":2946},{"className":2945},[],[2947],{"type":62,"value":1604},{"type":62,"value":2949}," if present, fails fast otherwise.",{"type":57,"tag":79,"props":2951,"children":2953},{"id":2952},"invocation",[2954],{"type":62,"value":2955},"Invocation",{"type":57,"tag":1063,"props":2957,"children":2960},{"className":2958,"code":2959,"language":62},[1066],"\u002Fmem0-integrate                            # interactive, heal ON\n\u002Fmem0-integrate --no-heal                  # stop after commit; manual verify\n\u002Fmem0-integrate --heal-max 5               # cap heal attempts per category (default 3)\n\u002Fmem0-integrate --product platform         # skip the product ask\n\u002Fmem0-integrate --product oss\n\u002Fmem0-integrate --ci                       # non-interactive (for test harness)\n",[2961],{"type":57,"tag":70,"props":2962,"children":2963},{"__ignoreMap":1071},[2964],{"type":62,"value":2959},{"type":57,"tag":79,"props":2966,"children":2968},{"id":2967},"exit-codes",[2969],{"type":62,"value":2970},"Exit codes",{"type":57,"tag":540,"props":2972,"children":2973},{},[2974,2990],{"type":57,"tag":544,"props":2975,"children":2976},{},[2977],{"type":57,"tag":548,"props":2978,"children":2979},{},[2980,2985],{"type":57,"tag":552,"props":2981,"children":2982},{},[2983],{"type":62,"value":2984},"Code",{"type":57,"tag":552,"props":2986,"children":2987},{},[2988],{"type":62,"value":2989},"Meaning",{"type":57,"tag":568,"props":2991,"children":2992},{},[2993,3006,3019,3032,3045,3058,3071],{"type":57,"tag":548,"props":2994,"children":2995},{},[2996,3001],{"type":57,"tag":575,"props":2997,"children":2998},{},[2999],{"type":62,"value":3000},"0",{"type":57,"tag":575,"props":3002,"children":3003},{},[3004],{"type":62,"value":3005},"Success. Feature branch committed; verification skill ready to run.",{"type":57,"tag":548,"props":3007,"children":3008},{},[3009,3014],{"type":57,"tag":575,"props":3010,"children":3011},{},[3012],{"type":62,"value":3013},"1",{"type":57,"tag":575,"props":3015,"children":3016},{},[3017],{"type":62,"value":3018},"Precondition failed (dirty repo, no detectable language, etc.).",{"type":57,"tag":548,"props":3020,"children":3021},{},[3022,3027],{"type":57,"tag":575,"props":3023,"children":3024},{},[3025],{"type":62,"value":3026},"2",{"type":57,"tag":575,"props":3028,"children":3029},{},[3030],{"type":62,"value":3031},"Missing env key in CI mode.",{"type":57,"tag":548,"props":3033,"children":3034},{},[3035,3040],{"type":57,"tag":575,"props":3036,"children":3037},{},[3038],{"type":62,"value":3039},"3",{"type":57,"tag":575,"props":3041,"children":3042},{},[3043],{"type":62,"value":3044},"Goal doc rejected 3+ times — integration is not well-specified.",{"type":57,"tag":548,"props":3046,"children":3047},{},[3048,3053],{"type":57,"tag":575,"props":3049,"children":3050},{},[3051],{"type":62,"value":3052},"4",{"type":57,"tag":575,"props":3054,"children":3055},{},[3056],{"type":62,"value":3057},"Subagent review loop did not converge in 3 rounds.",{"type":57,"tag":548,"props":3059,"children":3060},{},[3061,3066],{"type":57,"tag":575,"props":3062,"children":3063},{},[3064],{"type":62,"value":3065},"5",{"type":57,"tag":575,"props":3067,"children":3068},{},[3069],{"type":62,"value":3070},"Integration plan rejected 3+ times, or no plausible additive call site found.",{"type":57,"tag":548,"props":3072,"children":3073},{},[3074,3079],{"type":57,"tag":575,"props":3075,"children":3076},{},[3077],{"type":62,"value":3078},"6",{"type":57,"tag":575,"props":3080,"children":3081},{},[3082],{"type":62,"value":3083},"Self-healing loop did not converge, detected a non-invasiveness violation, or a pre-existing test failed.",{"type":57,"tag":79,"props":3085,"children":3087},{"id":3086},"explicitly-out-of-scope",[3088],{"type":62,"value":3089},"Explicitly out of scope",{"type":57,"tag":114,"props":3091,"children":3092},{},[3093,3098,3103,3108,3113,3118,3131],{"type":57,"tag":118,"props":3094,"children":3095},{},[3096],{"type":62,"value":3097},"Surveying the repo for fit points. Humans decide where Mem0 helps before\ninvoking this skill.",{"type":57,"tag":118,"props":3099,"children":3100},{},[3101],{"type":62,"value":3102},"Replacing any existing memory \u002F session \u002F state system. Always additive\nand feature-flagged; see \"Integration principles.\"",{"type":57,"tag":118,"props":3104,"children":3105},{},[3106],{"type":62,"value":3107},"Modifying pre-existing tests, even to \"fix\" them under self-heal. Tests\nthat fail after integration with the flag unset are a non-invasiveness\nviolation, not a bug to patch.",{"type":57,"tag":118,"props":3109,"children":3110},{},[3111],{"type":62,"value":3112},"Deciding Platform vs OSS silently. Always ask with a recommendation.",{"type":57,"tag":118,"props":3114,"children":3115},{},[3116],{"type":62,"value":3117},"Switching branches, pushing, or opening PRs. Commits locally and stops\n(or enters the heal loop, still local).",{"type":57,"tag":118,"props":3119,"children":3120},{},[3121,3123,3129],{"type":62,"value":3122},"Data migration between stores. Point user at ",{"type":57,"tag":70,"props":3124,"children":3126},{"className":3125},[],[3127],{"type":62,"value":3128},"migration\u002Foss-to-platform",{"type":62,"value":3130},"\ndocs if they ask.",{"type":57,"tag":118,"props":3132,"children":3133},{},[3134,3136,3142],{"type":62,"value":3135},"Provider selection beyond the default LLM for OSS. If they need a custom\nLLM \u002F embedder \u002F vector store, route to ",{"type":57,"tag":70,"props":3137,"children":3139},{"className":3138},[],[3140],{"type":62,"value":3141},"components\u002F*",{"type":62,"value":3143}," docs and re-run\nstep 4 with the new key.",{"items":3145,"total":3233},[3146,3158,3170,3184,3198,3212,3224],{"slug":3147,"name":3147,"fn":3148,"description":3149,"org":3150,"tags":3151,"stars":23,"repoUrl":24,"updatedAt":3157},"context-loader","load project context from Mem0","Searches and injects relevant memories into context before starting work on a task. Use when beginning a new task, switching context, or when project history, past decisions, or coding conventions need to be loaded.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":11},[3152,3153,3156],{"name":18,"slug":19,"type":16},{"name":3154,"slug":3155,"type":16},"Context","context",{"name":14,"slug":15,"type":16},"2026-07-13T06:13:15.682218",{"slug":3159,"name":3159,"fn":3160,"description":3161,"org":3162,"tags":3163,"stars":23,"repoUrl":24,"updatedAt":3169},"dream","consolidate and prune stored memories","Consolidates stored memories by merging duplicates, resolving contradictions, and pruning stale entries. Use when memory count is high, search results feel noisy or repetitive, or periodic cleanup is needed to maintain memory quality.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":11},[3164,3165,3168],{"name":18,"slug":19,"type":16},{"name":3166,"slug":3167,"type":16},"Data Cleaning","data-cleaning",{"name":14,"slug":15,"type":16},"2026-07-13T06:12:54.000421",{"slug":3171,"name":3171,"fn":3172,"description":3173,"org":3174,"tags":3175,"stars":23,"repoUrl":24,"updatedAt":3183},"export","export project memories to Markdown files","Exports all project memories to a portable Markdown file for backup or migration. Use when backing up memories, migrating to another project, sharing memory state with teammates, or archiving before cleanup.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":11},[3176,3179,3180],{"name":3177,"slug":3178,"type":16},"Backup","backup",{"name":14,"slug":15,"type":16},{"name":3181,"slug":3182,"type":16},"Migration","migration","2026-07-13T06:13:05.091831",{"slug":3185,"name":3185,"fn":3186,"description":3187,"org":3188,"tags":3189,"stars":23,"repoUrl":24,"updatedAt":3197},"forget","delete outdated or incorrect memories","Deletes memories by search query or memory ID with confirmation before removal. Use when removing outdated decisions, incorrect memories, sensitive data, or cleaning up after experiments. Also handles undo of recent additions.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":11},[3190,3193,3194],{"name":3191,"slug":3192,"type":16},"Maintenance","maintenance",{"name":14,"slug":15,"type":16},{"name":3195,"slug":3196,"type":16},"Privacy","privacy","2026-07-13T06:13:00.862899",{"slug":3199,"name":3199,"fn":3200,"description":3201,"org":3202,"tags":3203,"stars":23,"repoUrl":24,"updatedAt":3211},"health","diagnose Mem0 connectivity and health","Diagnoses mem0 connectivity, API key validity, and memory read\u002Fwrite functionality. Use when memory operations fail, searches return empty, add_memory errors occur, MCP connection drops, or to verify the plugin is working correctly.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":11},[3204,3207,3208],{"name":3205,"slug":3206,"type":16},"Debugging","debugging",{"name":14,"slug":15,"type":16},{"name":3209,"slug":3210,"type":16},"Monitoring","monitoring","2026-07-13T06:13:06.569475",{"slug":3213,"name":3213,"fn":3214,"description":3215,"org":3216,"tags":3217,"stars":23,"repoUrl":24,"updatedAt":3223},"import","import project memories from Markdown files","Imports memories from an exported Markdown file or MEMORY.md into the current project. Use when migrating from another project, restoring from backup, importing Claude Code native MEMORY.md content, or setting up a new project with existing knowledge.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":11},[3218,3221,3222],{"name":3219,"slug":3220,"type":16},"Markdown","markdown",{"name":14,"slug":15,"type":16},{"name":3181,"slug":3182,"type":16},"2026-07-13T06:12:59.389494",{"slug":3225,"name":3225,"fn":3226,"description":3227,"org":3228,"tags":3229,"stars":23,"repoUrl":24,"updatedAt":3232},"list-projects","list projects with stored memories","Lists all projects with stored memories for the current user, showing memory counts and last activity dates. Use when checking which projects have memories, comparing memory distribution across repos, or finding a specific project scope.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":11},[3230,3231],{"name":18,"slug":19,"type":16},{"name":14,"slug":15,"type":16},"2026-07-13T06:13:27.80043",23,{"items":3235,"total":3233},[3236,3242,3248,3254,3260,3266,3272,3277,3288,3302,3308,3318],{"slug":3147,"name":3147,"fn":3148,"description":3149,"org":3237,"tags":3238,"stars":23,"repoUrl":24,"updatedAt":3157},{"slug":8,"name":9,"logoUrl":10,"githubOrg":11},[3239,3240,3241],{"name":18,"slug":19,"type":16},{"name":3154,"slug":3155,"type":16},{"name":14,"slug":15,"type":16},{"slug":3159,"name":3159,"fn":3160,"description":3161,"org":3243,"tags":3244,"stars":23,"repoUrl":24,"updatedAt":3169},{"slug":8,"name":9,"logoUrl":10,"githubOrg":11},[3245,3246,3247],{"name":18,"slug":19,"type":16},{"name":3166,"slug":3167,"type":16},{"name":14,"slug":15,"type":16},{"slug":3171,"name":3171,"fn":3172,"description":3173,"org":3249,"tags":3250,"stars":23,"repoUrl":24,"updatedAt":3183},{"slug":8,"name":9,"logoUrl":10,"githubOrg":11},[3251,3252,3253],{"name":3177,"slug":3178,"type":16},{"name":14,"slug":15,"type":16},{"name":3181,"slug":3182,"type":16},{"slug":3185,"name":3185,"fn":3186,"description":3187,"org":3255,"tags":3256,"stars":23,"repoUrl":24,"updatedAt":3197},{"slug":8,"name":9,"logoUrl":10,"githubOrg":11},[3257,3258,3259],{"name":3191,"slug":3192,"type":16},{"name":14,"slug":15,"type":16},{"name":3195,"slug":3196,"type":16},{"slug":3199,"name":3199,"fn":3200,"description":3201,"org":3261,"tags":3262,"stars":23,"repoUrl":24,"updatedAt":3211},{"slug":8,"name":9,"logoUrl":10,"githubOrg":11},[3263,3264,3265],{"name":3205,"slug":3206,"type":16},{"name":14,"slug":15,"type":16},{"name":3209,"slug":3210,"type":16},{"slug":3213,"name":3213,"fn":3214,"description":3215,"org":3267,"tags":3268,"stars":23,"repoUrl":24,"updatedAt":3223},{"slug":8,"name":9,"logoUrl":10,"githubOrg":11},[3269,3270,3271],{"name":3219,"slug":3220,"type":16},{"name":14,"slug":15,"type":16},{"name":3181,"slug":3182,"type":16},{"slug":3225,"name":3225,"fn":3226,"description":3227,"org":3273,"tags":3274,"stars":23,"repoUrl":24,"updatedAt":3232},{"slug":8,"name":9,"logoUrl":10,"githubOrg":11},[3275,3276],{"name":18,"slug":19,"type":16},{"name":14,"slug":15,"type":16},{"slug":8,"name":8,"fn":3278,"description":3279,"org":3280,"tags":3281,"stars":23,"repoUrl":24,"updatedAt":3287},"add persistent memory to AI applications","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 \u002F @mem0\u002Fvercel-ai-provider \u002F createMem0 (use mem0-vercel-ai-sdk).\n",{"slug":8,"name":9,"logoUrl":10,"githubOrg":11},[3282,3283,3286],{"name":18,"slug":19,"type":16},{"name":3284,"slug":3285,"type":16},"AI Infrastructure","ai-infrastructure",{"name":14,"slug":15,"type":16},"2026-07-13T06:12:42.552904",{"slug":3289,"name":3289,"fn":3290,"description":3291,"org":3292,"tags":3293,"stars":23,"repoUrl":24,"updatedAt":3301},"mem0-cli","manage Mem0 memory via command line","Mem0 CLI -- the command-line interface for mem0 memory operations. TRIGGER when: user mentions \"mem0 cli\", \"mem0 command line\", \"@mem0\u002Fcli\", \"mem0-cli\", \"pip install mem0-cli\", \"npm install -g @mem0\u002Fcli\", or is running mem0 commands in a terminal\u002Fshell (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\u002Fzsh\u002Fterminal\u002Fshell usage. DO NOT TRIGGER when: user asks about programmatic SDK integration in Python\u002FTS code (use mem0 skill), or Vercel AI SDK provider (use mem0-vercel-ai-sdk skill).\n",{"slug":8,"name":9,"logoUrl":10,"githubOrg":11},[3294,3297,3300],{"name":3295,"slug":3296,"type":16},"Automation","automation",{"name":3298,"slug":3299,"type":16},"CLI","cli",{"name":14,"slug":15,"type":16},"2026-07-13T06:12:48.46494",{"slug":4,"name":4,"fn":5,"description":6,"org":3303,"tags":3304,"stars":23,"repoUrl":24,"updatedAt":25},{"slug":8,"name":9,"logoUrl":10,"githubOrg":11},[3305,3306,3307],{"name":18,"slug":19,"type":16},{"name":21,"slug":22,"type":16},{"name":14,"slug":15,"type":16},{"slug":3309,"name":3309,"fn":3310,"description":3311,"org":3312,"tags":3313,"stars":23,"repoUrl":24,"updatedAt":3317},"mem0-oss-to-platform","migrate Mem0 projects to platform","Plan and then execute a migration of a project from the mem0 open-source \u002F self-hosted SDK (the local `Memory` class) to the mem0 Platform \u002F hosted \u002F managed SDK (the `MemoryClient` class). Use this whenever a developer wants to move, switch, or migrate their mem0 usage off OSS\u002Fself-hosted to the hosted API — e.g. \"migrate my mem0 setup to the platform\", \"switch from self-hosted mem0 to MemoryClient\", \"use my mem0 API key instead of a local Qdrant\", \"move mem0 to the cloud\u002Fhosted\u002Fmanaged service\", or \"replace my local mem0 vector store + embedder config with the platform\". Applies to Python (`from mem0 import Memory` → `from mem0 import MemoryClient`) and TypeScript\u002FJavaScript (`import { Memory } from \"mem0ai\u002Foss\"` → `import MemoryClient from \"mem0ai\"`). Trigger even when the user doesn't say the word \"migrate\" but clearly wants their existing mem0 integration to run against the hosted platform. It first produces a reviewable migration plan, then executes it after the developer approves. Strictly scoped to the mem0 integration — it does not refactor, restructure, or \"improve\" any unrelated code.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":11},[3314,3315,3316],{"name":18,"slug":19,"type":16},{"name":14,"slug":15,"type":16},{"name":3181,"slug":3182,"type":16},"2026-07-13T06:12:43.848266",{"slug":75,"name":75,"fn":3319,"description":3320,"org":3321,"tags":3322,"stars":23,"repoUrl":24,"updatedAt":3331},"verify Mem0 integration tests","Verify a Mem0 integration produced by \u002Fmem0-integrate. Runs in the same workspace on the same branch (loose coupling) — installs dependencies, runs the repo's native test suite, then exercises a real end-to-end smoke flow against the user's API key. Produces a scorecard. TRIGGER when: user has just run \u002Fmem0-integrate and says \"verify\", \"test the integration\", \"run \u002Fmem0-test-integration\", or when a .mem0-integration\u002F directory exists and tests have not been run yet on the current branch. DO NOT TRIGGER when: the user wants to run general project tests (defer to the repo's native test command), or when no prior \u002Fmem0-integrate run exists in the current branch (ask them to run \u002Fmem0-integrate first). This skill ONLY catches compile and runtime bugs by design. Logical integration errors — wrong data stored, wrong time retrieved, wrong user scoping — are on the human reviewer.\n",{"slug":8,"name":9,"logoUrl":10,"githubOrg":11},[3323,3324,3325,3328],{"name":18,"slug":19,"type":16},{"name":14,"slug":15,"type":16},{"name":3326,"slug":3327,"type":16},"QA","qa",{"name":3329,"slug":3330,"type":16},"Testing","testing","2026-07-13T06:12:50.669701"]