Building compounding memory with knowledge graphs and agentic RAG
Blog post from SurrealDB
Synapse is a memory-first reflection agent designed to transform journal entries into a persistent knowledge graph structured around therapeutic frameworks such as CBT, DBT, IFS, and Schema Therapy. Developed for the London LangChain x SurrealDB Hackathon, it helps users track emotional and behavioral patterns over time by linking new reflections to existing data and extracting insights. The system uses a LangGraph pipeline to enhance memory compounding, allowing the chat agent to provide informed answers by leveraging a structured graph of patterns, emotions, and relationships. To ensure effectiveness, Synapse undergoes rigorous evaluation for extraction quality, graph integrity, chat grounding, and pipeline performance. Key features include crisis detection, non-diagnostic language, and voice input via Telegram integration. Despite challenges like latency, improvements were made through parallel processing, batching, and SSE streaming, with the Anthropic claude-sonnet-4-6 model chosen for its deep extraction capabilities. The development process emphasized orchestration and prompt design, facilitated by tools such as LangChain, FastAPI, and SurrealDB.