mem-machine
Use MemMachine to build, configure, troubleshoot, and integrate persistent memory for AI agents through the Python SDK, REST API, CLI, MCP server, TypeScript client, self-hosted server, and framework integrations.
- License 许可
- Apache-2.0
- 最近更新
- 2026-09-03
- Stars
- ★ 351
- Forks
- 27
01 前言 Front Matter
- name
- mem-machine
- license
- Apache 2.0
- metadata
- { "disco-role": "operating" }
- description
- Use MemMachine to build, configure, troubleshoot, and integrate persistent memory for AI agents through the Python SDK, REST API, CLI, MCP server, TypeScript client, self-hosted server, and framework integrations.
- disable-model-invocation
- true
02 资源文件 7
- 参考文档references/package-overview.md4.3 KB
- 参考文档references/repo-provenance.md2.2 KB
- 参考文档references/repo-routing-metadata.json415 B
- 参考文档references/rest-api-and-data-models.md4.8 KB
- 参考文档references/troubleshooting.md4.8 KB
- 脚本scripts/check_memmachine_install.py4.7 KB
- 脚本scripts/memmachine_server_doctor.py4.9 KB
03 SKILL.md 正文
MemMachine
Use this skill when a task names MemMachine, memmachine-client,
memmachine-server, memmachine_common, @memmachine/client, mem-cli,
memmachine-server, persistent agent memory, episodic memory, semantic/profile
memory, MemMachine MCP, or a self-hosted MemMachine API server.
MemMachine is a client-server memory layer for AI agents. The server stores and retrieves memories; application code usually talks to it through the Python SDK, TypeScript REST client, CLI, REST API, or MCP tools.
First Steps
- Decide whether the user is using MemMachine as a package or configuring a server. Package-only tasks need a running MemMachine API server; server tasks need configuration, storage resources, and provider credentials.
- If a Python environment is available, run the bundled read-only checker from
this skill directory:
python scripts/check_memmachine_install.py --summary - Route to the focused sub-skill before giving detailed commands.
- Do not expose API keys, provider credentials, database passwords, or local memory contents in answers. Use placeholders when showing commands.
Route By Task
- Python SDK and CLI: use
python-sdk-and-cli for
MemMachineClient,Project,Memory,Config,mem-cli,memmachine, project context, add/search/list/delete memory, semantic categories/tags, filters, formatted output, and LangGraph tool helpers. - Server, configuration, REST, MCP, and memory engines: use
server-configuration-and-memory-engines
for
memmachine-server, YAML configuration, Docker Compose/Helm deployment, storage backends, provider resources, REST endpoint families, MCP stdio/HTTP, event/declarative long-term memory, semantic memory, and retrieval-agent behavior. - Integrations and migration: use integrations-and-migration for LangGraph/LangChain/LlamaIndex/CrewAI/AWS Strands/OpenClaw/Dify/n8n/FastGPT integrations, example-agent adaptation, and ChatGPT/OpenAI/LoCoMo conversation export migration.
- TypeScript REST client: use
typescript-rest-client for
@memmachine/client, Node/TypeScript install/build/test,MemMachineClient,MemMachineProject,MemMachineMemory, Axios/API errors, and TS examples.
Shared References And Scripts
- Read repo-provenance.md to check the source commit, package-version baseline, and refresh triggers before relying on this skill for a changed MemMachine release.
- Read package-overview.md for package names, version baseline, install variants, runtime architecture, and safe smoke checks.
- Read rest-api-and-data-models.md when translating between SDK calls, CLI commands, REST payloads, and shared data models.
- Read troubleshooting.md for cross-cutting install/import, server, auth, provider, storage, optional dependency, and API-path failures.
- Run check_memmachine_install.py to inspect installed Python packages, public entry points, and key signatures without starting a server.
- Run memmachine_server_doctor.py to inspect server prerequisites, optional Docker availability, and config-file shape without starting or stopping services.
Package And Runtime Boundaries
Install only the surface needed for the task:
python -m pip install memmachine-client # application/client code
python -m pip install memmachine-server # self-hosted server workflows
npm install @memmachine/client # TypeScript applications
- Python package names:
memmachine-client,memmachine-common,memmachine-server, and meta packagememmachine. - TypeScript package name:
@memmachine/client. - Python client calls require a MemMachine API base URL. Use
http://localhost:8080only when a local server is actually running. - Cloud or secured deployments may require a bearer API key; never print the key after loading it from an environment variable or secret store.
- Self-hosted server workflows may require PostgreSQL/pgvector, Neo4j, Qdrant, Milvus, Nebula, provider credentials, or Docker. Treat those as explicit prerequisites, not as implicit side effects.
- Optional local NLP/model features, including spaCy multi-hop decomposition and sentence-transformer embeddings, require extra dependencies. Do not claim GPU or external-provider behavior is verified from a plain import check.
Minimal Python Usage Shape
from memmachine_client import MemMachineClient
client = MemMachineClient(base_url="http://localhost:8080", api_key=None)
project = client.get_or_create_project(org_id="my-org", project_id="my-project")
memory = project.memory(metadata={"user_id": "alice", "agent_id": "assistant"})
memory.add("Alice prefers aisle seats.", metadata={"category": "travel"})
result = memory.search("What seating does Alice prefer?", limit=5)
client.close()
For CLI usage, put global client flags before the subcommand and project context on the project or memory command:
mem-cli --base-url "http://localhost:8080" memory search \
"What seating does Alice prefer?" \
--org-id "my-org" --project-id "my-project" --limit 5
Verification Notes
Prefer read-only checks first: imports, --help, health checks, config parsing,
and mocked/unit-level command construction. Only start Docker services, call LLM
providers, upload memories, or run integration benchmarks after the user has
provided the required credentials, service endpoints, and permission for side
effects.
04 同仓库更多 Skills
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.
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.
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.
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.
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.
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).