AI MEMORY FOR AGENTS · CLAUDE AGENT SDK
Give your Claude agents knowledge they can build on.
We turn a useful decision into knowledge your Claude Agent SDK app can use again. Save the note, find its context and retrieve the original record through our project-scoped MCP example.
Explicit save and recall through your local worker. Running this example uses your selected Claude model and its credits.

KNOWLEDGE THAT LASTS
Your next run can start with what you learned.
Carry decisions into the next run.
We keep the project notes your app chooses to save, so the next task can build on what you already learned.
Find the evidence behind the answer.
Search the project, inspect the timeline and retrieve the original note before relying on it.
Keep memory access deliberate.
Our example fixes the project outside model control and checks each of its four memory tools before allowing the call.
ILLUSTRATIVE NOTE · ACTUAL EXAMPLE WORKFLOW
A decision today. A reference for the next run.
“A restore must reject snapshots missing required worker tables.”
The example gives Claude this synthetic note, then asks it to save, find and quote the original. Keep useful decisions available beyond the conversation that produced them.
- 01
Save the useful note
The example asks Claude to save a synthetic restore decision in your selected project.
- 02
Find its context
Search for restore snapshots inside the same project.
- 03
Inspect the timeline
Review the context around the matching observation.
- 04
Read the original
Retrieve the observation and quote the saved text in the final answer.
START WITH ONE PROJECT
Connect your app. Keep one useful decision.
- Use a Claude-Mem source checkout. Install its documented dependencies, use Bun and start the local worker with your existing settings. Follow the installation guide for worker setup.
- Use supported Claude Agent SDK authentication. The run sends the synthetic note, tool results and recalled memory to your selected model and consumes its credits. Never put keys in code, prompts or command arguments. Set
CLAUDE_MEM_EXAMPLE_MODELto select another supported model. - Build the MCP bundle and choose your project. Run the command from the source checkout. Choose a project you intend to write to: the synthetic note will persist.
npm run build
bun examples/claude-agent-sdk/memory.ts \
--project sdk-practice \
--server plugin/scripts/mcp-server.cjsCheck success. Expect the final answer to quote the saved restore note after all four memory tools succeed. Missing bundle, tool errors and incomplete workflow fail the example.
Adapt memoryOptions and memoryPermission together for your app. Keep project checks outside model control and preserve the ask rules that send each memory call to the permission callback.
AI memory in production
70 days of work. One searchable memory.
Alessandro used our open-source engine across three machines for 70 days. His customized deployment captured the decisions, fixes and discoveries behind the work—and published the data.
- Observations captured
- 22,718
- Bug fixes recorded
- 1,262
- Decisions recorded
- 757
See how he made that knowledge searchable. Then give your own agents a memory to build on.

Before you connect
Does this capture every conversation automatically?
This example saves the selected note explicitly. It stores no SDK session transcript, loads no project settings or other MCP servers, and changes no IDE configuration.
Do I need Pro or model credits?
This local-worker example does not require Pro. It does require supported Claude Agent SDK authentication and uses your selected Claude model’s credits. The synthetic note, tool results and recalled memory are sent to that model.
Which project can the agent read?
The command fixes a local project. The example checks project arguments and adds the selected project restriction to ID-based reads. These filters are not multiuser account authentication. Keep the permission callback and ask rules together when adapting the example.
Can I connect a hosted worker?
This example connects to the local worker through its rebuilt stdio MCP bundle. It does not configure hosted authentication or a cloud-runtime connection. Your worker’s existing sync settings still apply.
What has been verified?
The published guide records macOS verification with SDK 0.3.322. Its fixture exercises the actual SDK, local MCP server and worker using a local fake model, including withholding another project’s record. That verifies integration plumbing, not real-model quality or Windows and Linux acceptance. Use the source checkout’s dependencies; its declared SDK version range is not an exact 0.3.322 pin.
What if a run fails?
Check the running worker, built MCP path, selected project and SDK authentication. An absent bundle, tool error or incomplete four-tool workflow fails the example. Inspect existing memory before retrying a run that may already have saved its note.
How do I disconnect?
Stop the example and remove its MCP configuration from your application. Existing saved notes remain until separately deleted through Claude-Mem.
Build on a working example.
Source reviewed November 20, 2026. The published fixture exercises the actual SDK, rebuilt MCP server and local worker against a fake model. It checks save, search, timeline and selected-project retrieval. It is separate from a paid real-model run and does not measure answer quality.
Give your next agent run a useful starting point.
We keep the knowledge. Your app decides when to use it.