AGENT SKILL

sdk-memory

Use Mem0 SDKs for hosted Platform clients and local OSS memory in Python and TypeScript, including CRUD, search, async clients, entity filters, metadata, categories, export, feedback, and migration-sensitive API differences.

License 许可
Apache-2.0
最近更新
2026-09-03
Stars
★ 351
Forks
27

01 前言 Front Matter

name
sdk-memory
license
Apache 2.0
metadata
{ "disco-role": "operating" }
description
Use Mem0 SDKs for hosted Platform clients and local OSS memory in Python and TypeScript, including CRUD, search, async clients, entity filters, metadata, categories, export, feedback, and migration-sensitive API differences.
disable-model-invocation
true

02 资源文件 6

03 SKILL.md 正文

Mem0 SDK Memory

Use this sub-skill when the task asks for Mem0, mem0ai, a memory layer, memory CRUD/search, Platform SDK calls, OSS Memory() usage, TypeScript MemoryClient, mem0ai/oss, async memory calls, retrieve-generate-store flows, filters, metadata, categories, exports, feedback, or SDK migration debugging.

Route First

  • Use this sub-skill for Python MemoryClient, AsyncMemoryClient, Memory, AsyncMemory, TypeScript hosted MemoryClient, and TypeScript OSS Memory from mem0ai/oss.
  • Use Python SDK for imports, live signatures, sync/async Python examples, and Platform-vs-OSS differences.
  • Use TypeScript SDK for hosted MemoryClient, OSS Memory, camelCase/snake_case option differences, exports, and feedback.
  • Use Memory Operations for add/search/update/delete patterns, retrieve-generate-store workflows, filters, metadata, categories, export, feedback, and migration notes.
  • Use Troubleshooting for empty search results, import/install failures, API keys, optional backends, validation errors, and SDK misuse.

Sibling Boundaries

  • Route provider, vector store, embedder, LLM, reranker, graph-memory, and optional dependency selection to provider-configuration.
  • Route terminal commands, CLI config, JSON output, stdin/file workflows, import/export through commands, and mem0 init/add/search behavior to cli-memory.
  • Route REST server deployment, Docker Compose, OpenMemory, MCP server hosting, API keys for self-hosted services, migrations, and operational backups to self-hosted-openmemory.
  • Route editor/agent plugins, framework cookbooks, Vercel AI SDK provider wrapping, MCP plugin config, hooks, OpenClaw, and Pi Agent plugin tasks to integrations-plugins.

Fast Decision Tree

  1. Hosted Platform SDK? Use MemoryClient / AsyncMemoryClient in Python or MemoryClient in TypeScript; it needs a Mem0 API key and talks to https://api.mem0.ai by default.
  2. Local OSS memory? Use Python Memory / AsyncMemory or TypeScript Memory from mem0ai/oss; it needs provider/backend configuration, often OpenAI credentials by default.
  3. Search or list memories? Put entity scope in filters, for example filters={"user_id": "alice"} in Python and { filters: { user_id: "alice" } } in TypeScript.
  4. Add or bulk delete by entity? Follow the SDK-specific options in Memory Operations; current SDKs keep top-level entity options for add/delete-all, while search/get-all require filters.
  5. Debug before changing code? Run python scripts/inspect_mem0_sdk.py --json to inspect installed Python exports/signatures without credentials, then python scripts/mem0_sdk_smoke.py --mode plan --language both to generate safe smoke snippets.

Minimal Patterns

Python hosted Platform:

from mem0 import MemoryClient

client = MemoryClient(api_key=os.environ["MEM0_API_KEY"])
client.add("User prefers vegetarian meals", user_id="alice", metadata={"source": "chat"})
results = client.search("dietary preferences", filters={"user_id": "alice"}, top_k=5)

Python OSS:

from mem0 import Memory

memory = Memory()
memory.add("User prefers vegetarian meals", user_id="alice", metadata={"source": "chat"})
results = memory.search("dietary preferences", filters={"user_id": "alice"}, top_k=5)

TypeScript hosted Platform:

import { MemoryClient } from "mem0ai";

const client = new MemoryClient({ apiKey: process.env.MEM0_API_KEY! });
await client.add([{ role: "user", content: "User prefers vegetarian meals" }], { userId: "alice" });
const results = await client.search("dietary preferences", { filters: { user_id: "alice" }, topK: 5 });

TypeScript OSS:

import { Memory } from "mem0ai/oss";

const memory = new Memory();
await memory.add("User prefers vegetarian meals", { userId: "alice", metadata: { source: "chat" } });
const results = await memory.search("dietary preferences", { filters: { user_id: "alice" }, topK: 5 });

Safety Notes

  • Do not print API keys, provider keys, memory contents from production users, or full environment dumps.
  • Prefer read-only inspection before live API calls. The bundled scripts default to help/plan/inspection modes and do not require credentials unless explicitly requested.
  • Never instruct future agents to run source-repository tests or examples; use the bundled references and scripts here.
  • Treat reset, wildcard deletes, and scoped delete_all / deleteAll as destructive. Confirm scope and tenant before running them.

04 同仓库更多 Skills

VectorSpaceLab
VectorSpaceLab/AREX-Skill

passnet-triton-opt

Make a single PassNet Triton kernel fast AND numerically faithful: performance model (when a replacement can win at all), block/grid/warp tuning, autotune policy, launch overhead, and per-op numeric recipes to pass the dtype baseline tolerances. Use when a pass matches and is correct but speedup below expected, or when correctness fails by small numeric margins.

★ 351
VectorSpaceLab
VectorSpaceLab/AREX-Skill

passnet-solve

END-TO-END playbook for solving one PassNet sample: analyze the computation graphs, decide the optimization strategy (what to fuse, what to replace, what to leave alone), drive the iteration loop, and maximize the sample score. This is the ENTRY skill — invoke it first for any PassNet optimization task; it tells you when to use passnet-pattern-fusion, passnet-triton-opt and passnet-feedback.

★ 351
VectorSpaceLab
VectorSpaceLab/AREX-Skill

passnet-skill

PassNet GPU kernel optimization via compiler passes. Design and implement Triton-based optimization passes, create pass files under ./pass_dir/, self-evaluate with pass_evaluator, and iterate to maximize GPU speedup.

★ 351
VectorSpaceLab
VectorSpaceLab/AREX-Skill

passnet-pattern-fusion

Author PassNet pass files: write patterns that actually MATCH the FX graph, pick fusion regions (which ops to absorb into one Triton kernel), and structure multi-pass submissions with the mandatory shared-dispatch architecture. Use when creating or fixing pattern()/replacement_args()/replacement_func() files, when a pass "failed to match", or when deciding how to fuse multiple kernels/ops.

★ 351
VectorSpaceLab
VectorSpaceLab/AREX-Skill

passnet-orchestrate

Round/batch planning and decision support for PassNet graph optimization. Use for multi-sample triage, worker allocation, eval-budget policy, and post-eval keep/revert decisions. For solving one concrete sample end to end, use passnet-solve as the entry skill; consult this skill only when you need broader planning or a specific decision gate.

★ 351
VectorSpaceLab
VectorSpaceLab/AREX-Skill

passnet-feedback

Fast, deterministic feedback for PassNet work: pre-flight pattern/match verification WITHOUT burning a GPU evaluation, per-node bottleneck analysis of a sample's graphs, and eval-log parsing into per-variant status + estimated score + failure classification. Use BEFORE every GPU evaluation (check_pattern), at the START of a sample (analyze_graph), and AFTER every evaluation (parse_eval_log).

★ 351