Architecture Overview

1. Agent to Membase
When you chat with an AI agent connected to Membase, the agent can save context using theadd_memory tool.
You have a conversation
You talk to your agent normally. During the conversation, the agent picks up on preferences, decisions, project details, and other important context.
Agent calls add_memory
The agent sends the relevant context to Membase via MCP. This happens automatically as part of the conversation flow.
Example
2. External Sources to Membase
External data sources like Gmail and Google Calendar feed context into Membase independently of your agent conversations.You connect a data source
From the Integrations tab in your dashboard, authorize Membase to access a data source (e.g., Gmail, Google Calendar).
Membase syncs automatically
Membase syncs with connected sources in real time. Emails, calendar events, and other data are ingested as they arrive, without any manual action.
3. Digesting and Graph Construction
This is where raw text becomes structured knowledge. Every piece of incoming context (from agents or external sources) goes through the same pipeline.Episode creation
The raw input is saved as an episode, a snapshot of a conversation or data event. Episodes are the building blocks of your memory.
Entity extraction
Membase identifies key entities from the episode: people, projects, tools, preferences, decisions, dates, and other meaningful concepts.
Example entities from a conversation
Graph construction
Extracted entities are added to your knowledge graph. Membase creates connections between them and links new entities to existing ones when they overlap.For example, if “Zustand” was mentioned before in a different context, the new episode gets linked to the existing entity rather than creating a duplicate.

4. Membase to Your Agent
When an agent needs context to respond, it callssearch_memory to query Membase.
Agent calls search_memory
The agent sends a query describing what context it needs. This happens automatically when the agent determines that prior context would improve its response.
Example
Membase searches the knowledge graph
The query is matched against your knowledge graph using semantic search. Membase finds relevant episodes, entities, and their connections.Relevant results might include:
- “Uses Next.js with TypeScript”
- “Prefers functional components”
- “State management: Zustand”
- “Styling: Tailwind CSS”
Ranked results returned to agent
Results are scored by relevance and returned to the agent. Only the most useful context is included, keeping the agent’s context window clean and focused.



