Skip to main content
Membase transforms raw conversations and external data into structured, retrievable context. This page walks through the full lifecycle: how context enters Membase, how it gets processed, and how your agents use it.

Architecture Overview

Membase architecture diagram
Context flows into Membase from two sources: your AI agents and external data. Membase digests everything into a knowledge graph, and when an agent needs context, it retrieves only what’s relevant.

1. Agent to Membase

When you chat with an AI agent connected to Membase, the agent can save context using the add_memory tool.
1

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.
2

Agent calls add_memory

The agent sends the relevant context to Membase via MCP. This happens automatically as part of the conversation flow.
Example
You: "Let's use Zustand instead of Redux for this project.
      Also, I prefer functional components over class components."

→ Agent calls add_memory with this context
3

Membase receives and acknowledges

The MCP server receives the memory and queues it for processing. The agent can continue the conversation immediately.

2. External Sources to Membase

External data sources like Gmail and Google Calendar feed context into Membase independently of your agent conversations.
1

You connect a data source

From the Integrations tab in your dashboard, authorize Membase to access a data source (e.g., Gmail, Google Calendar).
2

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

Data is queued for processing

Incoming data is treated the same as agent conversations: it goes through the same digesting pipeline to extract structured context.
External data enriches your agents’ context beyond what you explicitly tell them. Your agent can reference an email thread or know about an upcoming meeting without you bringing it up.

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.
1

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.
2

Entity extraction

Membase identifies key entities from the episode: people, projects, tools, preferences, decisions, dates, and other meaningful concepts.
Example entities from a conversation
"Let's use Zustand instead of Redux"
→ Entities: Zustand, Redux, state management decision
3

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

Deduplication and merging

If the same fact appears in multiple episodes, Membase merges them. When information conflicts (e.g., you changed a preference), the latest data takes priority.
The result is a continuously growing knowledge graph where entities, relationships, and episodes are all interconnected.
Membase knowledge graph

4. Membase to Your Agent

When an agent needs context to respond, it calls search_memory to query Membase.
1

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
You: "Set up a new component for the settings page."

→ Agent calls search_memory: "project tech stack, component preferences"
2

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”
3

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.
4

Agent responds with full context

The agent uses the retrieved context to generate a response that’s grounded in your actual preferences and project details, without you having to repeat any of it.
Here’s a real example: Claude retrieving a git workflow from Membase’s knowledge graph during a conversation.
This entire cycle (save → digest → retrieve) happens continuously as you use your agents. The more you interact, the richer your knowledge graph becomes, and the smarter your agents get.

Next Steps