What Claude Agent SDK already keeps
The SDK manages the conversation and context of a session and can compact it. Facts that must outlive sessions, be shared across a team, or be scoped per customer need a store.
Where Auld fits
Define one custom tool with an action of recall or remember, served from an in-process MCP server, or connect the remote Auld MCP server directly in the SDK’s MCP configuration.
| Concern | Claude Agent SDK | Auld |
|---|---|---|
| Current conversation | Yes | Not needed |
| Facts across sessions and channels | Your code | Yes |
| Which fact is current after a change | Your code | Yes, with history |
| What was true on a date | Your code | Yes (asOf) |
| Who may see a memory | Your code | Identities and audiences |
| Source for each statement | Your code | Returned with every memory |
Implementation sequence
Choose in-process or remote
In-process tools let you inject the user id; remote MCP is less code.
Define the tool
Use the SDK’s tool decorator with a small input schema.
Register the server
Add it to the options’ MCP servers and allow the tool.
Add a hook (optional)
A session-end hook can ingest a summary.
Example
import os, requests
AULD = os.environ["AULD_API_BASE"] # e.g. https://YOUR-AULD-HOST
HEADERS = {"Authorization": f"Bearer {os.environ['AULD_API_KEY']}"}
def auld_post(path: str, body: dict) -> dict:
r = requests.post(f"{AULD}/v1/{path}", json=body, headers=HEADERS, timeout=30)
r.raise_for_status()
return r.json()
def remember(text: str, user_id: str, source_id: str, occurred_at: str) -> str:
"""Store a dated record for one user. Returns the job id."""
return auld_post("records", {"sourceId": source_id, "text": text,
"occurredAt": occurred_at, "author": user_id,
"visibility": f"user:{user_id}"})["jobId"]
def recall(query: str, user_id: str, max_tokens: int = 2000) -> str:
"""Current memories with sources, formatted for a prompt."""
res = auld_post("recall", {"query": query, "viewer": user_id, "maxTokens": max_tokens})
return "\n".join(f"- {m['text']} ({m['sources'][0]['title']}, {m['sources'][0]['occurredAt'][:10]})"
for m in res["memories"]) or "No relevant memory."from claude_agent_sdk import tool, create_sdk_mcp_server, ClaudeAgentOptions
from memory_client import recall, remember
USER_ID = "user_42" # from your auth layer
@tool("memory", "Recall or save durable facts about the current user",
{"action": str, "text": str})
async def memory(args):
if args["action"] == "recall":
out = recall(args["text"], USER_ID)
else:
remember(args["text"], USER_ID, f"sdk-{USER_ID}", "2026-10-19T00:00:00Z")
out = "saved"
return {"content": [{"type": "text", "text": out}]}
server = create_sdk_mcp_server(name="auld", version="1.0.0", tools=[memory])
options = ClaudeAgentOptions(mcp_servers={"auld": server}, allowed_tools=["mcp__auld__memory"])Illustrative example · standard HTTP · check the framework’s current docs for exact signatures
Or connect the MCP server
If your Claude Agent SDK setup can use MCP tools, point it at the Auld MCP endpoint instead of writing wrappers. The model gets remember, recall, forget and memory_status. Use wrappers when you need to inject the user id yourself or post-process results; use MCP for speed of setup.
Custom integration recipe using standard HTTP/MCP tools
- This recipe wires Claude Agent SDK’s own tool interface to the Auld REST API or MCP server; there is nothing Auld-specific to install.
- Bind the viewer id from your authentication layer, not from model output.
- Ingestion is asynchronous — poll the job before depending on a just-sent fact in tests.
- Recall returns up to your plan’s token limit (8,000 on Pay as you go and Flex).
Frequently asked questions
How is this different from the Claude Code plugin page?
This page is for applications you build with the SDK. The Claude Code plugin page covers memory for developers using Claude Code itself.
Can teams share memory?
Yes, via an audience that includes every team member’s identity.