[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M7FFBAZRHJ6GB63SD4GSP7PF":3,"skill-same:01M7FFBAZRHJ6GB63SD4GSP7PF":60},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":19,"linkOnly":20,"markdownContent":21,"markdownBody":22,"frontMatter":23,"refName":32,"commitSha":33,"skillDirectory":34,"forksCount":35,"repositoryHtmlUrl":36,"repositoryHomepageUrl":6,"ownerHtmlUrl":37,"ownerBlogUrl":6,"ownerDescription":38,"updatedAt":39,"install":40,"resources":53},"01M7FFBAZRHJ6GB63SD4GSP7PF","mem0-test-integration",null,"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.","lza6\u002FArmor-piercing-system-prompts","lza6","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F128880206?v=4","01M7EB3K7WPX5T28EJ2NVHE6EG","Chinese-tingfeng","01M7EB3K97E1KQ16QWKJMFNGX8",11,"Apache-2.0","https:\u002F\u002Fgithub.com\u002Flza6\u002FArmor-piercing-system-prompts\u002Fblob\u002Fmain\u002F07-后端与架构\u002Fmem0-test-integration\u002FSKILL.md",[],[],"2026-11-16 10:05:34",false,"---\nname: mem0-test-integration\ndescription: >\n  Verify a Mem0 integration produced by \u002Fmem0-integrate. Runs in the same\n  workspace on the same branch (loose coupling) — installs dependencies,\n  runs the repo's native test suite, then exercises a real end-to-end\n  smoke flow against the user's API key. Produces a scorecard.\n  TRIGGER when: user has just run \u002Fmem0-integrate and says \"verify\",\n  \"test the integration\", \"run \u002Fmem0-test-integration\", or when a\n  .mem0-integration\u002F directory exists and tests have not been run yet\n  on the current branch.\n  DO NOT TRIGGER when: the user wants to run general project tests\n  (defer to the repo's native test command), or when no prior \u002Fmem0-integrate\n  run exists in the current branch (ask them to run \u002Fmem0-integrate first).\n  This skill ONLY catches compile and runtime bugs by design. Logical\n  integration errors — wrong data stored, wrong time retrieved, wrong\n  user scoping — are on the human reviewer.\nlicense: Apache-2.0\nmetadata:\n  author: mem0ai\n  version: \"0.1.0\"\n  category: ai-memory\n  tags: \"memory, integration, testing, tdd, platform, oss\"\n  coupling: loose\n  mem0_tested_versions: \"mem0ai (PyPI) >=2.0.0,\u003C3.0.0; mem0ai (npm) >=3.0.0,\u003C4.0.0\"\n---\n\n# mem0-test-integration\n\nVerifies what `\u002Fmem0-integrate` produced. Runs in the same workspace,\non the same feature branch. Loose coupling — fast, catches compile and\nruntime bugs, does not catch logical errors.\n\n## Canonical sources (use these, not ambient knowledge)\n\nAll static checks and smoke-test shapes validate against these URLs.\n`WebFetch` each before running step 3.\n\n- Scope-tagged docs index: https:\u002F\u002Fdocs.mem0.ai\u002Fllms.txt\n- OpenAPI (Platform REST): https:\u002F\u002Fdocs.mem0.ai\u002Fopenapi.json\n- Published SDK skill (canonical call patterns): https:\u002F\u002Fraw.githubusercontent.com\u002Fmem0ai\u002Fmem0\u002Fmain\u002Fskills\u002Fmem0\u002FSKILL.md\n- Vercel AI SDK skill (if the target repo uses `@ai-sdk\u002F*`): https:\u002F\u002Fraw.githubusercontent.com\u002Fmem0ai\u002Fmem0\u002Fmain\u002Fskills\u002Fmem0-vercel-ai-sdk\u002FSKILL.md\n- SDK source (cross-check version against frontmatter `mem0_tested_versions`):\n  - Repo root: https:\u002F\u002Fgithub.com\u002Fmem0ai\u002Fmem0\n  - Python: https:\u002F\u002Fgithub.com\u002Fmem0ai\u002Fmem0\u002Ftree\u002Fmain\u002Fmem0\n  - TypeScript: https:\u002F\u002Fgithub.com\u002Fmem0ai\u002Fmem0\u002Ftree\u002Fmain\u002Fmem0-ts\n\nRead the `Delegated skill:` field in `.mem0-integration\u002Fplan.md` — if it\nnames a skill URL, fetch that skill and use its example blocks as the\nreference for both static checks (step 3) and the smoke test (step 5).\n\n## Non-invasiveness contract\n\nEvery check in this skill assumes the integration is **additive and\nfeature-flagged** (see `\u002Fmem0-integrate` \"Integration principles\").\nSpecifically:\n\n- `product.json` must contain a `feature_flag` field.\n- Steps 4–6 run in two passes:\n  - **Pass A — flag unset.** All pre-existing tests must pass, smoke\u002FE2E\n    skip. The repo must behave like `main`. Any failure here is a\n    **hard fail** — do not let the self-heal loop attempt a patch.\n  - **Pass B — flag set.** New tests must pass, smoke and E2E run.\n- If Pass A fails, the scorecard marks `non_invasive: false` and sets\n  `overall: fail` with a distinct reason code the integrator's heal\n  loop refuses to touch.\n\n## Preconditions\n\nRefuse to start unless ALL of the following are true:\n\n- `.mem0-integration\u002F` directory exists in the repo root.\n- `.mem0-integration\u002Fproduct.json`, `goal.md`, and `plan.md` are readable\n  and internally consistent (JSON parses, docs non-empty).\n- Current branch name begins with `mem0-integrate\u002F` (set by the companion\n  skill). Prevents accidental runs on unrelated branches.\n- Working tree is clean. The skill never modifies source files; any dirty\n  state means the integration is mid-edit and not ready to verify.\n- The same API key the integration used is available in the environment\n  (`MEM0_API_KEY` for Platform, `OPENAI_API_KEY` for OSS — read which from\n  `product.json`). Interactive mode asks if missing; CI mode exits 2.\n\nExit with a written rationale on any precondition failure. Never attempt\nto \"fix up\" state.\n\n## Pipeline\n\n### 1. Read the contract\n\nLoad:\n\n- `product.json` → which language, which product (Platform vs OSS), which\n  mem0 version, `write_site`, `read_site`.\n- `plan.md` → the mechanical contract (write pattern, read pattern,\n  preserved behavior).\n- `goal.md` → the intent (displayed in the scorecard only; not tested).\n\n### 2. Install dependencies\n\nRoute by language from `product.json`:\n\n| Language | Command |\n|---|---|\n| Python | `pip install -e .` if editable, else `pip install -r requirements.txt`. Then `pip install mem0ai` if not already present at the pinned version. |\n| TypeScript \u002F JavaScript | `npm install` (or `pnpm install` \u002F `yarn install` if detected by lockfile). |\n\nIf install fails → exit code 2 with stderr tail. Never move to testing\nif dependencies don't resolve.\n\n### 3. Static sanity checks (fast, local, no API calls)\n\n- **Import check**: does the write-site file import the expected Mem0\n  surface? Authoritative list comes from `## Identify the User's Setup`\n  in `https:\u002F\u002Fdocs.mem0.ai\u002Fllms.txt`:\n  - Platform Python → `from mem0 import MemoryClient`\n  - Platform TS → `import MemoryClient from \"mem0ai\"`\n  - OSS Python → `from mem0 import Memory`\n  - OSS TS → `import { Memory } from \"mem0ai\u002Foss\"`\n\n  If `plan.md` names a delegated skill (e.g., Vercel AI), use *that*\n  skill's import signature instead of the list above. Mismatch → fail\n  with line number.\n- **Version check**: installed `mem0ai` version falls in the range from\n  this skill's `mem0_tested_versions`. Out of range → warn but continue.\n- **Type check** (TS tracks only): run `tsc --noEmit` or `tsup --dts`.\n  Non-zero → fail.\n- **Lint** (if the repo has a linter configured): run the repo's own\n  lint command. Lint failures from this skill's changes → fail; pre-existing\n  lint failures → surface as a warning.\n- **Eager-init check**: grep the `write_site` and `read_site` files (paths\n  from `product.json`) for `MemoryClient(` or `Memory(` at module scope —\n  i.e., not inside a function, method, or class body. `MemoryClient()`\n  validates the API key in `__init__` (network call) and OSS `Memory()`\n  can eagerly initialize embedding\u002FLLM providers — module-level\n  instantiation hits the wire on import and breaks Pass A's test\n  collection whenever the key is unset. Hit → fail with `file:line` and\n  the lazy-init guidance from `\u002Fmem0-integrate` step 8 constraint #7.\n\n### 4. Run the repo's native test suite (two passes)\n\n| Language | Test command (in priority order) |\n|---|---|\n| Python | `pytest` with the test files from step 5 of the companion skill, else `python -m unittest discover`. |\n| TypeScript \u002F JavaScript | `npm test` if defined in package.json; else auto-detect `vitest` or `jest`. |\n\n**Pass A — `feature_flag` unset.** Run the *entire* pre-existing suite\n(excluding the new `test_mem0_*` files). **Must be 100% green.** Any\nfailure here marks `non_invasive: false` in the scorecard and is\na **hard fail** — the integrator's self-heal loop refuses to touch it.\n\n**Pass B — `feature_flag` set** (value from `product.json`). Run the\nfull suite including the new tests. All must pass.\n\nIsolate integration-introduced failures using `git diff main..HEAD\n--name-only`. A test file that exists on `main` and fails only under\nthe integration branch (flag set *or* unset) counts against the\nscorecard regardless of pass. A test file that already failed on `main`\nis surfaced as `pre_existing_unrelated` and does not count — but is\nstill reported so the user can clean it up.\n\nCapture output to `.mem0-integration\u002Ftest-stdout-flag-off.log` and\n`.mem0-integration\u002Ftest-stdout-flag-on.log`. Scorecard reports pass\u002Ffail\nper pass.\n\n### 5. Smoke test (real API call, shortest round-trip)\n\nScripted end-to-end flow tailored to `product.json`. The call shapes\nbelow are the minimal ones; if `plan.md` names a delegated skill, use\n*that skill's* minimal example verbatim instead — it is the canonical\nshape for the detected stack.\n\n**Platform (Python):**\n\n    from mem0 import MemoryClient\n    c = MemoryClient()                               # uses MEM0_API_KEY\n    uid = f\"mem0-test-integration-{os.urandom(4).hex()}\"\n    c.add([{\"role\": \"user\", \"content\": \"I prefer aisle seats\"}], user_id=uid)\n    hits = c.search(\"seat preference\", user_id=uid)\n    assert any(\"aisle\" in h.get(\"memory\", \"\") for h in hits), hits\n    c.delete_all(user_id=uid)                        # clean up\n\n**Platform (TS):** same shape with `MemoryClient` from `\"mem0ai\"`.\n\n**OSS (Python \u002F TS):** uses `Memory()` \u002F `new Memory()` with default config\n(OpenAI LLM via `OPENAI_API_KEY`, local Qdrant). If the repo ships a\n`docker-compose.yml` with a Qdrant service, the skill starts it first and\ntears it down after. If no backing store is reachable → fail with a\nclear message naming the fix.\n\nThe smoke test always uses a **disposable random user_id** prefixed with\n`mem0-test-integration-` so a failed cleanup doesn't pollute the user's\nreal data. A background tidy step deletes any prefix-matching entries\nolder than 24 hours on the next run.\n\nCapture output to `.mem0-integration\u002Fsmoke-stdout.log`.\n\n### 6. E2E integration test (run the app, exercise the flow)\n\nUnit tests + smoke prove the SDK works in isolation. This step is the\nreal signal: **does memory actually appear in the app's user-visible\noutput when the integration runs end-to-end?**\n\nRequires `plan.md` to contain an `E2E recipe:` section (authored by\n`\u002Fmem0-integrate` step 5). If absent → status `skipped` (not `fail`),\nnote in scorecard that the repo has no runnable entry point.\n\nRecipe fields the skill reads:\n\n- `start` — shell command to launch the app using `$PORT` for any network\n  port. Run in background with stdout\u002Fstderr teed to\n  `.mem0-integration\u002Fe2e-app.log`.\n- `ready_probe` — how to detect readiness. `url=... status=...` polls an\n  HTTP endpoint; `log=\"...\"` waits for a substring in `e2e-app.log`;\n  `sleep=N` waits N seconds (last resort). 60-second hard timeout.\n- `compose_services` — optional. If set, bring them up via\n  `docker compose up -d \u003Cservices>` before `start`, tear them down with\n  `docker compose down` at the end.\n- `write_call` — triggers the Mem0 write path exactly once. Output is\n  captured and surfaced on failure. 60-second hard timeout.\n- `write_async_wait_ms` — pause after `write_call` to let async memory\n  flushes land. Default 0.\n- `read_call` — triggers the Mem0 read path. Typically a fresh session\n  or new request that should surface the stored memory.\n- `read_assert` — substring, `regex=...`, or `jsonpath=\u003Cexpr>=\u003Cvalue>`\n  that must appear in `read_call`'s stdout. This is the E2E pass gate.\n\nExecution order:\n\n1. Allocate an ephemeral TCP port; export as `PORT`.\n2. Set `MEM0_USER_ID` to a disposable `mem0-test-integration-\u003Crand>` value\n   and export it, so the app can use the same scoping the smoke test does\n   if the recipe wants cleanup.\n3. Bring up `compose_services` if named.\n4. Run `start` in the background.\n5. Poll `ready_probe` until success or 60s timeout. Timeout → fail.\n6. Run `write_call`. Non-zero exit → fail (but continue to cleanup).\n7. Sleep `write_async_wait_ms`.\n8. Run `read_call`.\n9. Evaluate `read_assert` against `read_call`'s stdout. Miss → fail.\n10. Cleanup (always, even on failure): SIGTERM the app, SIGKILL after\n    5s, `docker compose down` if services were started, `delete_all`\n    memories matching `mem0-test-integration-*` on Platform scenarios.\n\nOn any failure, the scorecard includes:\n\n- Last 40 lines of `e2e-app.log`\n- Full `write_call` output\n- Full `read_call` output\n- The expected vs actual for `read_assert`\n\n### 7. Scorecard\n\nWrite `.mem0-integration\u002Fscorecard.md` and `.mem0-integration\u002Fscorecard.json`:\n\n    {\n      \"timestamp\": \"2026-04-20T14:03:11Z\",\n      \"branch\": \"mem0-integrate\u002Fremember-user-preferences\",\n      \"product\": \"platform\",\n      \"language\": \"python\",\n      \"mem0_version\": \"2.0.0\",\n      \"non_invasive\": true,\n      \"feature_flag\": \"MEM0_ENABLED\",\n      \"results\": {\n        \"install\":      {\"status\": \"pass\", \"duration_ms\": 12043},\n        \"static_checks\":{\"status\": \"pass\", \"duration_ms\": 812},\n        \"unit_tests_flag_off\": {\"status\": \"pass\", \"duration_ms\": 3920, \"count\": 47,\n                                \"reason\": \"all pre-existing tests green with flag unset\"},\n        \"unit_tests_flag_on\":  {\"status\": \"pass\", \"duration_ms\": 4321, \"count\": 49},\n        \"smoke_test\":   {\"status\": \"pass\", \"duration_ms\": 2890, \"memory_id\": \"mem_...\"},\n        \"e2e_test\":     {\"status\": \"pass\", \"duration_ms\": 14200,\n                         \"ready_probe_ms\": 3100, \"write_exit\": 0,\n                         \"read_assert_matched\": true}\n      },\n      \"friction\": {\n        \"dependency_install_retries\": 0,\n        \"pre_existing_test_failures\": 0,\n        \"warnings\": [\"mem0ai 2.0.0 pinned; consider 2.0.1 for fix X\"]\n      },\n      \"overall\": \"pass\"\n    }\n\nThe markdown version is human-readable and includes:\n\n- Goal doc + plan doc reprinted at top (so reviewers don't have to hunt).\n- Each check with pass\u002Ffail + log excerpt.\n- Friction summary.\n- Verbatim warnings from mem0 SDK (if any — e.g., deprecated field usage).\n- **Explicit \"NOT checked\" section** listing what loose coupling misses:\n  \"Whether the stored data is what the user wants stored. Whether search\n  runs at the right moment. Whether user_id matches the actual session\n  scope. Human review required.\"\n\n### 8. Report + exit\n\n- Print the scorecard path + overall pass\u002Ffail to stdout.\n- **Do not commit the scorecard files.** They live in `.mem0-integration\u002F`,\n  which is gitignored. The user can inspect and optionally pin.\n- On fail: print the first failing step's log tail (last 40 lines) and\n  stop. Do not attempt to fix anything.\n\n## Artifacts (all under `.mem0-integration\u002F`)\n\n| File | Purpose | Retention |\n|---|---|---|\n| `scorecard.md` | Human-readable verdict. | Overwritten per run. |\n| `scorecard.json` | Machine-readable verdict. Consumed by the CI scorecard workflow later. | Overwritten per run. |\n| `test-stdout-flag-off.log` | Step 4 Pass A (pre-existing suite, flag unset). | Overwritten per run. |\n| `test-stdout-flag-on.log` | Step 4 Pass B (full suite, flag set). | Overwritten per run. |\n| `smoke-stdout.log` | Full output from step 5. | Overwritten per run. |\n| `e2e-app.log` | Background app stdout\u002Fstderr from step 6. | Overwritten per run. |\n| `e2e-calls.log` | write_call + read_call invocations and outputs. | Overwritten per run. |\n\n## Modes\n\n| Mode | Trigger | Behavior |\n|---|---|---|\n| Interactive (default) | TTY present, `MEM0_TEST_CI` unset | Asks for missing keys, prints friendly summaries. |\n| CI | `MEM0_TEST_CI=1` | Keys must be in env, no prompts, non-zero exit on any fail. JSON scorecard goes to stdout's tail for workflow parsing. |\n\n## Invocation\n\n    \u002Fmem0-test-integration                       # interactive, all steps\n    \u002Fmem0-test-integration --ci                  # non-interactive\n    \u002Fmem0-test-integration --skip-smoke          # no API calls, no E2E\n    \u002Fmem0-test-integration --skip-e2e            # unit + smoke only (faster CI)\n    \u002Fmem0-test-integration --only-smoke          # just smoke\n    \u002Fmem0-test-integration --only-e2e            # just E2E (assumes deps installed)\n\nComposition: `--skip-*` can stack (`--skip-smoke --skip-e2e` = static +\nunit only, zero API cost). `--only-*` is mutually exclusive with all\nother flags.\n\n## Exit codes\n\n| Code | Meaning |\n|---|---|\n| 0 | All checks passed. |\n| 1 | Precondition failed (no `.mem0-integration\u002F`, wrong branch, dirty tree). |\n| 2 | Missing env key (CI mode) or dependency install failure. |\n| 3 | Static sanity check failed (wrong import, type error). |\n| 4 | Unit tests failed (Pass B — integration itself broken). |\n| 5 | Smoke test failed. |\n| 6 | E2E test failed (ready_probe timeout, write\u002Fread call failed, or read_assert miss). |\n| 7 | Non-invasiveness violation: Pass A failed (pre-existing tests broke). Integrator's heal loop refuses to touch this. |\n| 8 | Internal error (skill bug — report it). |\n\n## Explicitly out of scope\n\n- **Modifying source files.** The skill is read-only against the repo.\n  If verification exposes a bug, re-run `\u002Fmem0-integrate` on the same\n  goal + plan; do not hand-patch.\n- **Fixing broken tests.** Failing unit tests are a signal that the\n  integration is wrong, not that the tests are wrong. The skill does\n  not \"try a different test.\"\n- **Deep logical correctness.** The E2E step proves \"something the user\n  said earlier comes back later,\" which is a useful but shallow signal.\n  It does NOT prove the integration picks the *right* facts to store,\n  scopes `user_id` correctly across real users, or handles conflict\n  resolution well. That's human review territory.\n- **Self-healing.** This skill never modifies source files. The paired\n  `\u002Fmem0-integrate` skill in its default `--heal` mode consumes the\n  scorecard produced here and drives its own remediation loop. Exit\n  code 7 (non-invasiveness violation) is the explicit signal the heal\n  loop must stop and surface to the user.\n- **Cross-branch comparisons.** No `main` baseline diffing. The\n  scorecard reflects this branch only.\n- **Running against production data.** Every smoke test uses a disposable\n  random user_id and cleans up after. Never touches any other user's data.\n","# mem0-test-integration\n\nVerifies what `\u002Fmem0-integrate` produced. Runs in the same workspace,\non the same feature branch. Loose coupling — fast, catches compile and\nruntime bugs, does not catch logical errors.\n\n## Canonical sources (use these, not ambient knowledge)\n\nAll static checks and smoke-test shapes validate against these URLs.\n`WebFetch` each before running step 3.\n\n- Scope-tagged docs index: https:\u002F\u002Fdocs.mem0.ai\u002Fllms.txt\n- OpenAPI (Platform REST): https:\u002F\u002Fdocs.mem0.ai\u002Fopenapi.json\n- Published SDK skill (canonical call patterns): https:\u002F\u002Fraw.githubusercontent.com\u002Fmem0ai\u002Fmem0\u002Fmain\u002Fskills\u002Fmem0\u002FSKILL.md\n- Vercel AI SDK skill (if the target repo uses `@ai-sdk\u002F*`): https:\u002F\u002Fraw.githubusercontent.com\u002Fmem0ai\u002Fmem0\u002Fmain\u002Fskills\u002Fmem0-vercel-ai-sdk\u002FSKILL.md\n- SDK source (cross-check version against frontmatter `mem0_tested_versions`):\n  - Repo root: https:\u002F\u002Fgithub.com\u002Fmem0ai\u002Fmem0\n  - Python: https:\u002F\u002Fgithub.com\u002Fmem0ai\u002Fmem0\u002Ftree\u002Fmain\u002Fmem0\n  - TypeScript: https:\u002F\u002Fgithub.com\u002Fmem0ai\u002Fmem0\u002Ftree\u002Fmain\u002Fmem0-ts\n\nRead the `Delegated skill:` field in `.mem0-integration\u002Fplan.md` — if it\nnames a skill URL, fetch that skill and use its example blocks as the\nreference for both static checks (step 3) and the smoke test (step 5).\n\n## Non-invasiveness contract\n\nEvery check in this skill assumes the integration is **additive and\nfeature-flagged** (see `\u002Fmem0-integrate` \"Integration principles\").\nSpecifically:\n\n- `product.json` must contain a `feature_flag` field.\n- Steps 4–6 run in two passes:\n  - **Pass A — flag unset.** All pre-existing tests must pass, smoke\u002FE2E\n    skip. The repo must behave like `main`. Any failure here is a\n    **hard fail** — do not let the self-heal loop attempt a patch.\n  - **Pass B — flag set.** New tests must pass, smoke and E2E run.\n- If Pass A fails, the scorecard marks `non_invasive: false` and sets\n  `overall: fail` with a distinct reason code the integrator's heal\n  loop refuses to touch.\n\n## Preconditions\n\nRefuse to start unless ALL of the following are true:\n\n- `.mem0-integration\u002F` directory exists in the repo root.\n- `.mem0-integration\u002Fproduct.json`, `goal.md`, and `plan.md` are readable\n  and internally consistent (JSON parses, docs non-empty).\n- Current branch name begins with `mem0-integrate\u002F` (set by the companion\n  skill). Prevents accidental runs on unrelated branches.\n- Working tree is clean. The skill never modifies source files; any dirty\n  state means the integration is mid-edit and not ready to verify.\n- The same API key the integration used is available in the environment\n  (`MEM0_API_KEY` for Platform, `OPENAI_API_KEY` for OSS — read which from\n  `product.json`). Interactive mode asks if missing; CI mode exits 2.\n\nExit with a written rationale on any precondition failure. Never attempt\nto \"fix up\" state.\n\n## Pipeline\n\n### 1. Read the contract\n\nLoad:\n\n- `product.json` → which language, which product (Platform vs OSS), which\n  mem0 version, `write_site`, `read_site`.\n- `plan.md` → the mechanical contract (write pattern, read pattern,\n  preserved behavior).\n- `goal.md` → the intent (displayed in the scorecard only; not tested).\n\n### 2. Install dependencies\n\nRoute by language from `product.json`:\n\n| Language | Command |\n|---|---|\n| Python | `pip install -e .` if editable, else `pip install -r requirements.txt`. Then `pip install mem0ai` if not already present at the pinned version. |\n| TypeScript \u002F JavaScript | `npm install` (or `pnpm install` \u002F `yarn install` if detected by lockfile). |\n\nIf install fails → exit code 2 with stderr tail. Never move to testing\nif dependencies don't resolve.\n\n### 3. Static sanity checks (fast, local, no API calls)\n\n- **Import check**: does the write-site file import the expected Mem0\n  surface? Authoritative list comes from `## Identify the User's Setup`\n  in `https:\u002F\u002Fdocs.mem0.ai\u002Fllms.txt`:\n  - Platform Python → `from mem0 import MemoryClient`\n  - Platform TS → `import MemoryClient from \"mem0ai\"`\n  - OSS Python → `from mem0 import Memory`\n  - OSS TS → `import { Memory } from \"mem0ai\u002Foss\"`\n\n  If `plan.md` names a delegated skill (e.g., Vercel AI), use *that*\n  skill's import signature instead of the list above. Mismatch → fail\n  with line number.\n- **Version check**: installed `mem0ai` version falls in the range from\n  this skill's `mem0_tested_versions`. Out of range → warn but continue.\n- **Type check** (TS tracks only): run `tsc --noEmit` or `tsup --dts`.\n  Non-zero → fail.\n- **Lint** (if the repo has a linter configured): run the repo's own\n  lint command. Lint failures from this skill's changes → fail; pre-existing\n  lint failures → surface as a warning.\n- **Eager-init check**: grep the `write_site` and `read_site` files (paths\n  from `product.json`) for `MemoryClient(` or `Memory(` at module scope —\n  i.e., not inside a function, method, or class body. `MemoryClient()`\n  validates the API key in `__init__` (network call) and OSS `Memory()`\n  can eagerly initialize embedding\u002FLLM providers — module-level\n  instantiation hits the wire on import and breaks Pass A's test\n  collection whenever the key is unset. Hit → fail with `file:line` and\n  the lazy-init guidance from `\u002Fmem0-integrate` step 8 constraint #7.\n\n### 4. Run the repo's native test suite (two passes)\n\n| Language | Test command (in priority order) |\n|---|---|\n| Python | `pytest` with the test files from step 5 of the companion skill, else `python -m unittest discover`. |\n| TypeScript \u002F JavaScript | `npm test` if defined in package.json; else auto-detect `vitest` or `jest`. |\n\n**Pass A — `feature_flag` unset.** Run the *entire* pre-existing suite\n(excluding the new `test_mem0_*` files). **Must be 100% green.** Any\nfailure here marks `non_invasive: false` in the scorecard and is\na **hard fail** — the integrator's self-heal loop refuses to touch it.\n\n**Pass B — `feature_flag` set** (value from `product.json`). Run the\nfull suite including the new tests. All must pass.\n\nIsolate integration-introduced failures using `git diff main..HEAD\n--name-only`. A test file that exists on `main` and fails only under\nthe integration branch (flag set *or* unset) counts against the\nscorecard regardless of pass. A test file that already failed on `main`\nis surfaced as `pre_existing_unrelated` and does not count — but is\nstill reported so the user can clean it up.\n\nCapture output to `.mem0-integration\u002Ftest-stdout-flag-off.log` and\n`.mem0-integration\u002Ftest-stdout-flag-on.log`. Scorecard reports pass\u002Ffail\nper pass.\n\n### 5. Smoke test (real API call, shortest round-trip)\n\nScripted end-to-end flow tailored to `product.json`. The call shapes\nbelow are the minimal ones; if `plan.md` names a delegated skill, use\n*that skill's* minimal example verbatim instead — it is the canonical\nshape for the detected stack.\n\n**Platform (Python):**\n\n    from mem0 import MemoryClient\n    c = MemoryClient()                               # uses MEM0_API_KEY\n    uid = f\"mem0-test-integration-{os.urandom(4).hex()}\"\n    c.add([{\"role\": \"user\", \"content\": \"I prefer aisle seats\"}], user_id=uid)\n    hits = c.search(\"seat preference\", user_id=uid)\n    assert any(\"aisle\" in h.get(\"memory\", \"\") for h in hits), hits\n    c.delete_all(user_id=uid)                        # clean up\n\n**Platform (TS):** same shape with `MemoryClient` from `\"mem0ai\"`.\n\n**OSS (Python \u002F TS):** uses `Memory()` \u002F `new Memory()` with default config\n(OpenAI LLM via `OPENAI_API_KEY`, local Qdrant). If the repo ships a\n`docker-compose.yml` with a Qdrant service, the skill starts it first and\ntears it down after. If no backing store is reachable → fail with a\nclear message naming the fix.\n\nThe smoke test always uses a **disposable random user_id** prefixed with\n`mem0-test-integration-` so a failed cleanup doesn't pollute the user's\nreal data. A background tidy step deletes any prefix-matching entries\nolder than 24 hours on the next run.\n\nCapture output to `.mem0-integration\u002Fsmoke-stdout.log`.\n\n### 6. E2E integration test (run the app, exercise the flow)\n\nUnit tests + smoke prove the SDK works in isolation. This step is the\nreal signal: **does memory actually appear in the app's user-visible\noutput when the integration runs end-to-end?**\n\nRequires `plan.md` to contain an `E2E recipe:` section (authored by\n`\u002Fmem0-integrate` step 5). If absent → status `skipped` (not `fail`),\nnote in scorecard that the repo has no runnable entry point.\n\nRecipe fields the skill reads:\n\n- `start` — shell command to launch the app using `$PORT` for any network\n  port. Run in background with stdout\u002Fstderr teed to\n  `.mem0-integration\u002Fe2e-app.log`.\n- `ready_probe` — how to detect readiness. `url=... status=...` polls an\n  HTTP endpoint; `log=\"...\"` waits for a substring in `e2e-app.log`;\n  `sleep=N` waits N seconds (last resort). 60-second hard timeout.\n- `compose_services` — optional. If set, bring them up via\n  `docker compose up -d \u003Cservices>` before `start`, tear them down with\n  `docker compose down` at the end.\n- `write_call` — triggers the Mem0 write path exactly once. Output is\n  captured and surfaced on failure. 60-second hard timeout.\n- `write_async_wait_ms` — pause after `write_call` to let async memory\n  flushes land. Default 0.\n- `read_call` — triggers the Mem0 read path. Typically a fresh session\n  or new request that should surface the stored memory.\n- `read_assert` — substring, `regex=...`, or `jsonpath=\u003Cexpr>=\u003Cvalue>`\n  that must appear in `read_call`'s stdout. This is the E2E pass gate.\n\nExecution order:\n\n1. Allocate an ephemeral TCP port; export as `PORT`.\n2. Set `MEM0_USER_ID` to a disposable `mem0-test-integration-\u003Crand>` value\n   and export it, so the app can use the same scoping the smoke test does\n   if the recipe wants cleanup.\n3. Bring up `compose_services` if named.\n4. Run `start` in the background.\n5. Poll `ready_probe` until success or 60s timeout. Timeout → fail.\n6. Run `write_call`. Non-zero exit → fail (but continue to cleanup).\n7. Sleep `write_async_wait_ms`.\n8. Run `read_call`.\n9. Evaluate `read_assert` against `read_call`'s stdout. Miss → fail.\n10. Cleanup (always, even on failure): SIGTERM the app, SIGKILL after\n    5s, `docker compose down` if services were started, `delete_all`\n    memories matching `mem0-test-integration-*` on Platform scenarios.\n\nOn any failure, the scorecard includes:\n\n- Last 40 lines of `e2e-app.log`\n- Full `write_call` output\n- Full `read_call` output\n- The expected vs actual for `read_assert`\n\n### 7. Scorecard\n\nWrite `.mem0-integration\u002Fscorecard.md` and `.mem0-integration\u002Fscorecard.json`:\n\n    {\n      \"timestamp\": \"2026-04-20T14:03:11Z\",\n      \"branch\": \"mem0-integrate\u002Fremember-user-preferences\",\n      \"product\": \"platform\",\n      \"language\": \"python\",\n      \"mem0_version\": \"2.0.0\",\n      \"non_invasive\": true,\n      \"feature_flag\": \"MEM0_ENABLED\",\n      \"results\": {\n        \"install\":      {\"status\": \"pass\", \"duration_ms\": 12043},\n        \"static_checks\":{\"status\": \"pass\", \"duration_ms\": 812},\n        \"unit_tests_flag_off\": {\"status\": \"pass\", \"duration_ms\": 3920, \"count\": 47,\n                                \"reason\": \"all pre-existing tests green with flag unset\"},\n        \"unit_tests_flag_on\":  {\"status\": \"pass\", \"duration_ms\": 4321, \"count\": 49},\n        \"smoke_test\":   {\"status\": \"pass\", \"duration_ms\": 2890, \"memory_id\": \"mem_...\"},\n        \"e2e_test\":     {\"status\": \"pass\", \"duration_ms\": 14200,\n                         \"ready_probe_ms\": 3100, \"write_exit\": 0,\n                         \"read_assert_matched\": true}\n      },\n      \"friction\": {\n        \"dependency_install_retries\": 0,\n        \"pre_existing_test_failures\": 0,\n        \"warnings\": [\"mem0ai 2.0.0 pinned; consider 2.0.1 for fix X\"]\n      },\n      \"overall\": \"pass\"\n    }\n\nThe markdown version is human-readable and includes:\n\n- Goal doc + plan doc reprinted at top (so reviewers don't have to hunt).\n- Each check with pass\u002Ffail + log excerpt.\n- Friction summary.\n- Verbatim warnings from mem0 SDK (if any — e.g., deprecated field usage).\n- **Explicit \"NOT checked\" section** listing what loose coupling misses:\n  \"Whether the stored data is what the user wants stored. Whether search\n  runs at the right moment. Whether user_id matches the actual session\n  scope. Human review required.\"\n\n### 8. Report + exit\n\n- Print the scorecard path + overall pass\u002Ffail to stdout.\n- **Do not commit the scorecard files.** They live in `.mem0-integration\u002F`,\n  which is gitignored. The user can inspect and optionally pin.\n- On fail: print the first failing step's log tail (last 40 lines) and\n  stop. Do not attempt to fix anything.\n\n## Artifacts (all under `.mem0-integration\u002F`)\n\n| File | Purpose | Retention |\n|---|---|---|\n| `scorecard.md` | Human-readable verdict. | Overwritten per run. |\n| `scorecard.json` | Machine-readable verdict. Consumed by the CI scorecard workflow later. | Overwritten per run. |\n| `test-stdout-flag-off.log` | Step 4 Pass A (pre-existing suite, flag unset). | Overwritten per run. |\n| `test-stdout-flag-on.log` | Step 4 Pass B (full suite, flag set). | Overwritten per run. |\n| `smoke-stdout.log` | Full output from step 5. | Overwritten per run. |\n| `e2e-app.log` | Background app stdout\u002Fstderr from step 6. | Overwritten per run. |\n| `e2e-calls.log` | write_call + read_call invocations and outputs. | Overwritten per run. |\n\n## Modes\n\n| Mode | Trigger | Behavior |\n|---|---|---|\n| Interactive (default) | TTY present, `MEM0_TEST_CI` unset | Asks for missing keys, prints friendly summaries. |\n| CI | `MEM0_TEST_CI=1` | Keys must be in env, no prompts, non-zero exit on any fail. JSON scorecard goes to stdout's tail for workflow parsing. |\n\n## Invocation\n\n    \u002Fmem0-test-integration                       # interactive, all steps\n    \u002Fmem0-test-integration --ci                  # non-interactive\n    \u002Fmem0-test-integration --skip-smoke          # no API calls, no E2E\n    \u002Fmem0-test-integration --skip-e2e            # unit + smoke only (faster CI)\n    \u002Fmem0-test-integration --only-smoke          # just smoke\n    \u002Fmem0-test-integration --only-e2e            # just E2E (assumes deps installed)\n\nComposition: `--skip-*` can stack (`--skip-smoke --skip-e2e` = static +\nunit only, zero API cost). `--only-*` is mutually exclusive with all\nother flags.\n\n## Exit codes\n\n| Code | Meaning |\n|---|---|\n| 0 | All checks passed. |\n| 1 | Precondition failed (no `.mem0-integration\u002F`, wrong branch, dirty tree). |\n| 2 | Missing env key (CI mode) or dependency install failure. |\n| 3 | Static sanity check failed (wrong import, type error). |\n| 4 | Unit tests failed (Pass B — integration itself broken). |\n| 5 | Smoke test failed. |\n| 6 | E2E test failed (ready_probe timeout, write\u002Fread call failed, or read_assert miss). |\n| 7 | Non-invasiveness violation: Pass A failed (pre-existing tests broke). Integrator's heal loop refuses to touch this. |\n| 8 | Internal error (skill bug — report it). |\n\n## Explicitly out of scope\n\n- **Modifying source files.** The skill is read-only against the repo.\n  If verification exposes a bug, re-run `\u002Fmem0-integrate` on the same\n  goal + plan; do not hand-patch.\n- **Fixing broken tests.** Failing unit tests are a signal that the\n  integration is wrong, not that the tests are wrong. The skill does\n  not \"try a different test.\"\n- **Deep logical correctness.** The E2E step proves \"something the user\n  said earlier comes back later,\" which is a useful but shallow signal.\n  It does NOT prove the integration picks the *right* facts to store,\n  scopes `user_id` correctly across real users, or handles conflict\n  resolution well. That's human review territory.\n- **Self-healing.** This skill never modifies source files. The paired\n  `\u002Fmem0-integrate` skill in its default `--heal` mode consumes the\n  scorecard produced here and drives its own remediation loop. Exit\n  code 7 (non-invasiveness violation) is the explicit signal the heal\n  loop must stop and surface to the user.\n- **Cross-branch comparisons.** No `main` baseline diffing. The\n  scorecard reflects this branch only.\n- **Running against production data.** Every smoke test uses a disposable\n  random user_id and cleans up after. Never touches any other user's data.\n",{"name":5,"license":15,"metadata":24,"description":31},{"tags":25,"author":26,"version":27,"category":28,"coupling":29,"mem0_tested_versions":30},"memory, integration, testing, tdd, platform, oss","mem0ai","0.1.0","ai-memory","loose","mem0ai (PyPI) >=2.0.0,\u003C3.0.0; mem0ai (npm) >=3.0.0,\u003C4.0.0","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","main","d69096e239f2a89aabc2cd078c47664a9d3b1e11","07-后端与架构\u002Fmem0-test-integration",3,"https:\u002F\u002Fgithub.com\u002Flza6\u002FArmor-piercing-system-prompts","https:\u002F\u002Fgithub.com\u002Flza6","个人vx：Tf00798\r\n个人✈：@TFGY999","2026-10-08 14:29:22",{"source":8,"skillName":5,"commands":41,"prompt":51,"zipAvailable":52},[42,45,48],{"tool":43,"command":44},"npx","npx skills add lza6\u002FArmor-piercing-system-prompts --skill mem0-test-integration",{"tool":46,"command":47},"bunx","bunx skills add lza6\u002FArmor-piercing-system-prompts --skill mem0-test-integration",{"tool":49,"command":50},"pnpm","pnpm dlx skills add lza6\u002FArmor-piercing-system-prompts --skill mem0-test-integration","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Flza6\u002FArmor-piercing-system-prompts\u002Fblob\u002Fmain\u002F07-后端与架构\u002Fmem0-test-integration\u002FSKILL.md",true,[54],{"path":55,"resourceType":56,"resourceTypeDesc":57,"sizeBytes":58,"sourceHtmlUrl":59},"README.md","REFERENCE","参考文档",3349,"https:\u002F\u002Fgithub.com\u002Flza6\u002FArmor-piercing-system-prompts\u002Fblob\u002Fmain\u002F07-后端与架构\u002Fmem0-test-integration\u002FREADME.md",[61,69,74,81,88,95],{"skillNo":62,"name":63,"nameZh":6,"description":64,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":65,"licenseFileUrl":6,"sourceHtmlUrl":66,"categories":67,"keywords":68,"publishedAt":19},"01M7FFG485KY83TD6HSC4YPCMC","obsidian-clipper-template-creator","Guide for creating templates for the Obsidian Web Clipper. Use when you want to create a new clipping template, understand available variables, or format clipped content.","MIT","https:\u002F\u002Fgithub.com\u002Flza6\u002FArmor-piercing-system-prompts\u002Fblob\u002Fmain\u002F07-后端与架构\u002Fobsidian-clipper-template-creator\u002FSKILL.md",[],[],{"skillNo":70,"name":63,"nameZh":6,"description":64,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":65,"licenseFileUrl":6,"sourceHtmlUrl":71,"categories":72,"keywords":73,"publishedAt":19},"01M7FFG0T6AZ0STEJPSB3CX84K","https:\u002F\u002Fgithub.com\u002Flza6\u002FArmor-piercing-system-prompts\u002Fblob\u002Fmain\u002F07-后端与架构\u002Fobsidian-clipper-template-creator-antigravity-awesome-skills-main\u002FSKILL.md",[],[],{"skillNo":75,"name":76,"nameZh":6,"description":77,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":65,"licenseFileUrl":6,"sourceHtmlUrl":78,"categories":79,"keywords":80,"publishedAt":19},"01M7FFFY0QEM14SKWPDYGMXM2P","python-api","Programmatic Object-Detection-Metrics API guidance for BoundingBox, BoundingBoxes, Evaluator, enums, coordinate conversion, AP\u002FmAP semantics, and source-style import diagnostics.","https:\u002F\u002Fgithub.com\u002Flza6\u002FArmor-piercing-system-prompts\u002Fblob\u002Fmain\u002F07-后端与架构\u002Fobject-detection-metrics\u002Fsub-skills\u002Fpython-api\u002FSKILL.md",[],[],{"skillNo":82,"name":83,"nameZh":6,"description":84,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":65,"licenseFileUrl":6,"sourceHtmlUrl":85,"categories":86,"keywords":87,"publishedAt":19},"01M7FFFVZQZ2GJ0C0TGP7JHD20","file-evaluation","Folder-based PASCAL VOC AP\u002FmAP evaluation from ground-truth and detection text files.","https:\u002F\u002Fgithub.com\u002Flza6\u002FArmor-piercing-system-prompts\u002Fblob\u002Fmain\u002F07-后端与架构\u002Fobject-detection-metrics\u002Fsub-skills\u002Ffile-evaluation\u002FSKILL.md",[],[],{"skillNo":89,"name":90,"nameZh":6,"description":91,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":65,"licenseFileUrl":6,"sourceHtmlUrl":92,"categories":93,"keywords":94,"publishedAt":19},"01M7FFFSFNYSE77SJ6PE1CK2DA","object-detection-metrics","Guides legacy Object-Detection-Metrics PASCAL VOC AP\u002FmAP evaluation from detection text folders and direct Python API classes.","https:\u002F\u002Fgithub.com\u002Flza6\u002FArmor-piercing-system-prompts\u002Fblob\u002Fmain\u002F07-后端与架构\u002Fobject-detection-metrics\u002FSKILL.md",[],[],{"skillNo":96,"name":97,"nameZh":6,"description":98,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":65,"licenseFileUrl":6,"sourceHtmlUrl":99,"categories":100,"keywords":101,"publishedAt":19},"01M7FFFP0GCK1RVXBCPQ8APBMT","nx-workspace-patterns","Configure and optimize Nx monorepo workspaces. Use when setting up Nx, configuring project boundaries, optimizing build caching, or implementing affected commands.","https:\u002F\u002Fgithub.com\u002Flza6\u002FArmor-piercing-system-prompts\u002Fblob\u002Fmain\u002F07-后端与架构\u002Fnx-workspace-patterns\u002FSKILL.md",[],[]]