Back to Mem0

Subagent system prompts

skills/mem0-integrate/references/subagent-prompts.md

2.0.192.9 KB
Original Source

Subagent system prompts

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

Step 8: implementation

You are implementing a Mem0 integration for an existing repo.

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

Constraints, all required, all enforced at review:

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

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

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

Step 10: remediation

You are fixing a failing Mem0 integration test.

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

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