Install
What’s included
| Export | Language | Purpose |
|---|---|---|
create_synap_hooks | Python + TS | Returns a hooks dict for automatic context injection and turn recording |
create_synap_mcp_server | Python + TS | Returns an MCP server exposing synap_search and synap_remember as tools |
build_synap_tools | TypeScript | Raw tool definitions for manual composition |
Hooks — automatic memory
Use hooks for zero-friction memory: Synap injects context before each turn and records the response after — no tool calls needed from the model.How hooks work
before_query— fetches Synap context and prepends it as a system messageafter_turn— ingests the completed user + assistant turn into Synap
MCP server — explicit memory tools
Use the MCP server when you want the model to decide when to search or store memories. The server exposes two tools:synap_search— search memories by querysynap_remember— store a new memory
Hooks vs. MCP server
| Hooks | MCP server | |
|---|---|---|
| Context injection | Automatic, every turn | On-demand via tool call |
| Memory storage | Automatic, every turn | On-demand via tool call |
| Model awareness | Model doesn’t see the tools | Model can decide when to search/store |
| Best for | Production agents where memory is always needed | Research agents where explicit memory control matters |
TypeScript: buildSynapTools
For manual composition without the full MCP server:Next steps
Vercel AI SDK
Middleware for any Vercel AI SDK model.
Mastra
SynapMemory for the Mastra ADK.