@maximem/synap-claude-agent
v0.1.1
Published
Synap memory integration for Anthropic's Claude Agent SDK (TypeScript)
Readme
@maximem/synap-claude-agent
Synap memory integration for Anthropic's Claude Agent SDK (TypeScript).
Python sibling published as synap-claude-agent.
Install
npm install @maximem/synap-claude-agent @anthropic-ai/claude-agent-sdk zodTwo plug points
1. Hooks — automatic context injection
import { query } from "@anthropic-ai/claude-agent-sdk";
import { createSynapHooks } from "@maximem/synap-claude-agent";
const sdk = /* your Synap SDK instance */;
for await (const message of query({
prompt: "What did I tell you about my trial?",
options: {
hooks: createSynapHooks({ sdk, userId: "alice", customerId: "acme" }),
},
})) {
console.log(message);
}2. MCP tools — explicit read/write
import { createSynapMcpServer } from "@maximem/synap-claude-agent";
const options = {
mcpServers: { synap: createSynapMcpServer({ sdk, userId: "alice" }) },
allowedTools: ["mcp__synap__synap_search", "mcp__synap__synap_remember"],
};Use both together for automatic context injection plus explicit agent read/write.
Error policy
- Hooks never throw — SDK failures log and fall through (no context injected, no prompt recorded).
synap_searchreturns a "no context available" message on SDK failure — keeps the agent loop alive.synap_rememberreturnsisError: trueon ingestion failure — silent drops would hide outages, so failures surface to the agent explicitly.
