By default, OpenClaw / Clawdbot stuffs ~/.openclaw/workspace/MEMORY.md and daily memory/YYYY-MM-DD.md markdown logs into your context window, burning thousands of tokens per message across WhatsApp, Telegram, Discord, and iMessage. Drop / ml in to index all your existing MEMORY.md notes and session logs into a 0.86 ms knowledge graph—cutting prompt tokens by 5×.
# 1. Install slashml/memory (registers the ml-memory skill & MCP server) into OpenClaw / Clawdbot
npx -y @slashml/memory --init-openclaw --skill ml-memory --api-key <SLASHML_API_KEY>
# Or import your existing Clawd markdown memories & session logs via Python:
python3 -c '
import glob, pathlib
from slashml import Memory
mem = Memory(api_key="<SLASHML_API_KEY>")
for p in glob.glob(str(pathlib.Path("~/.openclaw/workspace").expanduser() / "**" / "*.md"), recursive=True):
text = pathlib.Path(p).read_text(encoding="utf-8", errors="ignore").strip()
if text:
mem.add(text, user_id="clawd_owner", metadata={"source_file": p})
print("Migrated Clawd workspace memories into / ml")
'
{
"mcpServers": {
"ml-memory": {
"command": "npx",
"args": ["-y", "@slashml/memory"],
"env": {
"SLASHML_API_KEY": "<SLASHML_API_KEY>"
}
}
}
}
Replace Hermes Agent's flat FTS5 / markdown memory files (~/.hermes/memories/MEMORY.md & USER.md) with / ml. Gives Hermes instant 0.86 ms multi-hop recall across past trajectories, learned skills, and user preferences with zero background LLM summarization lag.
# Add to ~/.hermes/config.yaml
mcp_servers:
ml-memory:
command: "npx"
args:
- "-y"
- "@slashml/memory"
env:
SLASHML_API_KEY: "<SLASHML_API_KEY>"
from pathlib import Path
from slashml import Memory
mem = Memory(api_key="<SLASHML_API_KEY>")
hermes_dir = Path("~/.hermes/memories").expanduser()
for md_file in hermes_dir.glob("*.md"):
for block in md_file.read_text().split("\n## "):
if block.strip():
mem.add(block.strip(), user_id="hermes_user", metadata={"file": md_file.name})
Give OpenHands autonomous software engineering agents persistent cross-task memory and zero-overlap bug localization via its native [mcp] configuration block.
[mcp]
stdio_servers = [
{ name = "ml-memory", command = "npx", args = ["-y", "@slashml/memory", "--workspace", "/workspace"], env = { SLASHML_API_KEY = "<SLASHML_API_KEY>" } }
]
Pi (@mariozechner/pi-coding-agent / @earendil-works/pi-coding-agent) stays minimal by pushing memory and tools into TypeScript extensions and skills. Install @slashml/memory (which registers the ml-memory skill) to replace flat pi-memory-md / MEMORY.md files with 0.86 ms stateful recall and behavioral code search—or bridge via pi-mcp-adapter.
# Option A: Export your API key and install @slashml/memory (registers ml-memory skill)
export SLASHML_API_KEY="<SLASHML_API_KEY>"
pi install npm:@slashml/memory
# Option B: If you use pi-mcp-adapter, add ml-memory to ~/.pi/agent/mcp.json:
# {
# "mcpServers": {
# "ml-memory": {
# "command": "npx",
# "args": ["-y", "@slashml/memory", "--workspace", "."],
# "env": { "SLASHML_API_KEY": "<SLASHML_API_KEY>" }
# }
# }
# }
from pathlib import Path
from slashml import Memory
mem = Memory(api_key="<SLASHML_API_KEY>")
for md in Path("~/.pi/agent").expanduser().rglob("*.md"):
text = md.read_text(encoding="utf-8", errors="ignore").strip()
if text:
mem.add(text, user_id="pi_agent", metadata={"source": str(md)})
OpenCode natively supports MCP servers in ~/.config/opencode/opencode.json (global) or ./opencode.json (project root). Add / ml (ml-memory) to give OpenCode persistent cross-session recall and sub-millisecond behavioral code search.
{
"$schema": "https://opencode.ai/config.json",
"mcp": {
"ml-memory": {
"type": "local",
"command": ["npx", "-y", "@slashml/memory", "--workspace", "."],
"environment": {
"SLASHML_API_KEY": "<SLASHML_API_KEY>"
},
"enabled": true
}
}
}
Give Claude Code the ml-memory skill (from slashml/memory) for persistent cross-session memory, behavioral code search (search_code_by_behavior), and zero-overlap bug localization (find_bug_candidates) in one command.
# Register ml-memory directly via the Claude Code CLI
claude mcp add ml-memory -e SLASHML_API_KEY=<SLASHML_API_KEY> -- npx -y @slashml/memory --workspace .
# Or auto-configure the ml-memory skill & MCP across Claude Code, Cursor & Windsurf:
npx -y @slashml/memory --init --skill ml-memory --api-key <SLASHML_API_KEY>
Add / ml (ml-memory) to ~/.codex/config.toml so Codex CLI remembers architectural decisions, past bug root causes, and repo conventions across every terminal session.
[mcp_servers.ml-memory]
command = "npx"
args = ["-y", "@slashml/memory", "--workspace", "."]
env = { SLASHML_API_KEY = "<SLASHML_API_KEY>" }
Register the ml-memory skill and MCP server in ~/.gemini/settings.json to replace flat GEMINI.md context stuffing with sub-millisecond graph recall and behavioral code search.
{
"mcpServers": {
"ml-memory": {
"command": "npx",
"args": ["-y", "@slashml/memory", "--workspace", "."],
"env": {
"SLASHML_API_KEY": "<SLASHML_API_KEY>"
}
}
}
}
Replace Goose's flat .goosehints and plain-text memory extension with / ml (ml-memory) in ~/.config/goose/config.yaml.
extensions:
ml-memory:
name: ml-memory
type: stdio
enabled: true
cmd: npx
args:
- -y
- "@slashml/memory"
- --workspace
- .
envs:
SLASHML_API_KEY: "<SLASHML_API_KEY>"
Index your existing .aider.chat.history.md and repo conventions into / ml so Aider can query architectural decisions and bug candidates on demand.
python3 -c '
from pathlib import Path
from slashml import Memory
mem = Memory(api_key="<SLASHML_API_KEY>")
hist = Path(".aider.chat.history.md")
if hist.exists():
for block in hist.read_text(errors="ignore").split("\n# "):
if block.strip():
mem.add(block.strip()[:2000], user_id="aider_repo")
print("Indexed Aider chat history into / ml")
'
Add / ml (ml-memory) to amp.mcpServers in ~/.config/amp/settings.json (CLI) or VS Code settings so Amp retains cross-thread engineering memory.
{
"amp.mcpServers": {
"ml-memory": {
"command": "npx",
"args": ["-y", "@slashml/memory", "--workspace", "."],
"env": {
"SLASHML_API_KEY": "<SLASHML_API_KEY>"
}
}
}
}
Run npx -y @slashml/memory --init --skill ml-memory --api-key <SLASHML_API_KEY> or drop this into .cursor/mcp.json (Cursor) or ~/.codeium/windsurf/mcp_config.json (Windsurf).
{
"mcpServers": {
"ml-memory": {
"command": "npx",
"args": ["-y", "@slashml/memory", "--workspace", "."],
"env": {
"SLASHML_API_KEY": "<SLASHML_API_KEY>"
}
}
}
}
Replace Cline and Roo Code's manual memory-bank/*.md file reads with sub-millisecond stateful recall and bug localization via ml-memory.
{
"mcpServers": {
"ml-memory": {
"command": "npx",
"args": ["-y", "@slashml/memory", "--workspace", "${workspaceFolder}"],
"env": {
"SLASHML_API_KEY": "<SLASHML_API_KEY>"
},
"alwaysAllow": ["search_memories", "add_memory", "search_code_by_behavior", "find_bug_candidates"]
}
}
}
Attach / ml (ml-memory) to Continue in VS Code / JetBrains or Zed's native context_servers.
mcpServers:
- name: ml-memory
command: npx
args:
- -y
- "@slashml/memory"
- --workspace
- .
env:
SLASHML_API_KEY: "<SLASHML_API_KEY>"
{
"context_servers": {
"ml-memory": {
"command": {
"path": "npx",
"args": ["-y", "@slashml/memory", "--workspace", "."],
"env": { "SLASHML_API_KEY": "<SLASHML_API_KEY>" }
}
}
}
}
Plug SlashMLLangGraphStore and SlashMLLangGraphCheckpointer directly into StateGraph.compile(), or use SlashMLChatMessageHistory / SlashMLLangChainRetriever in LangChain chains.
from slashml.integrations import SlashMLLangGraphCheckpointer, SlashMLLangGraphStore
store = SlashMLLangGraphStore(api_key="<SLASHML_API_KEY>")
checkpointer = SlashMLLangGraphCheckpointer(api_key="<SLASHML_API_KEY>")
graph = builder.compile(checkpointer=checkpointer, store=store)
# Cross-thread recall in 0.86 ms:
store.put(("users", "u_42"), "db_pref", {"text": "Migrated from Postgres to DuckDB"})
hits = store.search(("users", "u_42"), query="Which database do we use?", limit=3)
Attach / ml as a sub-millisecond memory tool in the OpenAI Agents SDK. Cuts prompt tokens by 5× while achieving 94.5% multi-session accuracy.
from agents import Agent, function_tool
from slashml import Memory
mem = Memory(api_key="<SLASHML_API_KEY>")
@function_tool
def remember(fact: str, user_id: str = "default") -> str:
mem.add(fact, user_id=user_id)
return "Saved."
@function_tool
def recall(query: str, user_id: str = "default") -> str:
hits = mem.search(query, user_id=user_id, limit=5)
return "\n".join(h["memory"] for h in hits["results"])
agent = Agent(name="Assistant", tools=[remember, recall])
Drop @slashml/memory into Next.js / Node.js routes using streamText or generateText.
import { SlashMLMemory } from "@slashml/memory";
import { streamText, tool } from "ai";
import { z } from "zod";
const memory = new SlashMLMemory({ apiKey: "<SLASHML_API_KEY>" });
const result = await streamText({
model: yourModel,
prompt: userMessage,
tools: {
recallMemory: tool({
description: "Recall user facts & multi-hop state in <1 ms",
parameters: z.object({ query: z.string() }),
execute: async ({ query }) => memory.recall({ query, userId: "u_42", topK: 5 }),
}),
},
});
Use SlashMLLlamaIndexVectorStore and SlashMLLlamaIndexRetriever for sub-millisecond stateful retrieval in milliseconds ingest speed.
from slashml.integrations import SlashMLLlamaIndexRetriever, SlashMLLlamaIndexVectorStore
store = SlashMLLlamaIndexVectorStore(api_key="<SLASHML_API_KEY>")
store.add_texts(["Service A authenticates via mTLS client certificates."])
retriever = SlashMLLlamaIndexRetriever(memory=store.memory, top_k=5)
nodes = retriever.retrieve("How does Service A authenticate?")
Replace Mastra's LibSQL / Postgres vector memory provider with / ml for sub-millisecond thread recall and zero-LLM-call ingestion.
import { Agent } from "@mastra/core/agent";
import { SlashMLMemory } from "@slashml/memory";
const memory = new SlashMLMemory({ apiKey: "<SLASHML_API_KEY>" });
export const supportAgent = new Agent({
name: "support-agent",
instructions: "Use / ml memory to recall customer history in <1 ms.",
model: yourModel,
memory: memory.asMastraMemory(),
});
Share a single deterministic memory graph across typed PydanticAI agents, CrewAI crews, or AutoGen (AG2) multi-agent teams with sub-millisecond recall.
from slashml.integrations import SlashMLCrewAIMemory
crew_memory = SlashMLCrewAIMemory(api_key="<SLASHML_API_KEY>", crew_id="prod-release-crew")
crew_memory.save("Checkout spike traced to unindexed foreign key on orders.user_id", agent="db_auditor")
hits = crew_memory.search("What caused the checkout latency spike?", limit=3)
Replace from mem0 import Memory with from slashml import Memory. All .add(), .search(), .get_all(), and .delete() calls work unmodified while eliminating LLM write fees, cutting your downstream prompt token bill by 5× (~1,400 tok at top-20 vs. Mem0's 6,956 tok at top-200), reducing recall latency from 3,550 ms to 0.86 ms, and improving LoCoMo accuracy from 92.5% (top-200; 66.9% at top-10) to 94.5% and BEAM 10M from 48.6% to 77.2%.
View full Mem0 migration page
# 1-line swap in your application code:
# - from mem0 import Memory
from slashml import Memory
m = Memory(api_key="<SLASHML_API_KEY>")
# Optional: Migrate existing Mem0 records with instant synchronous indexing
# for item in old_mem0.get_all(user_id="u_42")["results"]:
# m.add(item["memory"], user_id="u_42", metadata=item.get("metadata"))
Zep and Graphiti require 2–4 background LLM calls per turn plus a heavy Neo4j/FalkorDB graph database, leading to async ingestion queue lag (scoring 58.4% in Mem0's evaluation before the queue finished and 75.1% in Zep's rebuttal, with 1,290 ms search latency and 42.1% on BEAM 10M). / ml is a frontier AI memory system that resolves temporal and multi-hop state in a single synchronous pass (94.5% on LoCoMo and 77.2% on BEAM 10M in 0.86 ms). See full / ml vs Zep & Graphiti benchmarks
from slashml import Memory
slashml_mem = Memory(api_key="<SLASHML_API_KEY>")
# Export messages from Zep session and ingest directly (instant synchronous indexing)
# messages = zep_client.memory.get_session_messages(session_id="sess_01")
for msg in messages:
slashml_mem.add(
f"{msg.role}: {msg.content}",
user_id="user_01",
metadata={"session_id": "sess_01", "created_at": str(msg.created_at)},
)
# Recall with automatic temporal & multi-hop state resolution in 0.86 ms
hits = slashml_mem.search("What is the latest status of the payment migration?", user_id="user_01")
Letta (MemGPT) relies on multi-step agentic inner-monologue LLM calls to page memories in and out of context. Migrate your Letta core memory blocks and archival passages into / ml for deterministic 0.86 ms recall without extra LLM tool-loop latency.
from slashml import Memory
slashml_mem = Memory(api_key="<SLASHML_API_KEY>")
# 1. Import Letta Core Memory blocks (human / persona)
for block in letta_client.agents.blocks.list(agent_id=agent_id):
slashml_mem.add(f"[{block.label}] {block.value}", user_id=agent_id)
# 2. Import Letta Archival Memory passages in milliseconds
for passage in letta_client.agents.passages.list(agent_id=agent_id):
slashml_mem.add(passage.text, user_id=agent_id, metadata={"passage_id": passage.id})
Upgrade from Honcho (89.0% LoCoMo via 1–5s query-time LLM synthesis, 68.5% DolphinBench at $142.85), Hindsight (85.6% OSS / 89.6% Gemini-3 Pro LoCoMo, 69.5% DolphinBench with 158.9s p95 reflection latency), or Supermemory (59.2% DolphinBench at $345.64—scoring 6.5 pts below the 65.7% no-memory baseline) / Cognee to / ml (94.5% LoCoMo at top-20, 80.8% DolphinBench at 33.95s median, 0.86 ms recall) while eliminating per-write and query-time LLM extraction costs.
from slashml import Memory
slashml_mem = Memory(api_key="<SLASHML_API_KEY>")
# Ingest raw session turns or exported JSONL memories directly (no LLM extraction needed)
for turn in exported_turns:
slashml_mem.add(
turn["content"],
user_id=turn["user_id"],
metadata={"session_id": turn.get("session_id"), "timestamp": turn.get("timestamp")},
)