Developer FAQ
Answers to common questions about retrieval latency, tenant isolation, Model Context Protocol (MCP), and multi-turn agent state management.
1. Performance & Latency
MemorySync retrieval is a hybrid search (keyword plus vector) that runs on the server, so its latency is the server time plus the network path between your application and the API. Both numbers below were measured against production, not estimated.
| Measurement | p50 | p95 | What it includes |
|---|---|---|---|
Server-side retrieval time (latency_ms in the response) | 179 ms | 980 ms | Ranking and assembling the result on the server. |
| Round trip from a client far from the API region | 698 ms | 1,910 ms | Server time plus TLS and the network path, one new connection per request. |
- Every query response carries
latency_ms, so you can measure it from your own region rather than trust a published figure. - Round-trip time depends mostly on distance to the API and on connection reuse; a long-lived HTTP client that keeps connections open avoids paying TLS on every call.
- Retrieve once per task, not once per model token or tool call, and memory stays a small part of a turn that is usually dominated by model generation.
2. Token Economics & Cost Reduction
An agent that re-sends its whole history pays for every earlier turn again on each call, so its prompts grow with the length of the session. Retrieving only the memories a task needs keeps the prompt about the same size however long the session runs.
| Strategy | Input tokens per turn | 30-turn sessions × 1,000 | Relative token spend |
|---|---|---|---|
| Re-send the full history | 45,000 tokens | 1.35 billion tokens | 37.5× the scoped approach |
| Keep a 5k-token window | 5,000 tokens | 150 million tokens | 4.2×, and older turns are dropped |
| Retrieve scoped memories | 1,200 tokens | 36 million tokens | 1.0× (about 97% fewer tokens than re-sending everything) |
- Shorter prompts start faster: prefill time grows with prompt length, so sending 1,200 tokens instead of 45,000 shortens time-to-first-token. How much depends on the model and the provider.
- Less gets lost in the middle: models use information at the start and end of a long context better than information in the middle (Liu et al., 2023, "Lost in the Middle"). A short prompt with only the relevant facts avoids burying them.
- Requirements stay in view: integrations that recall memory before each reply put the relevant facts back into the prompt every turn, so a constraint stated early does not scroll out of the window.
3. Security, Privacy & Multi-Tenancy
MemorySync is built for applications that serve many end users from one API key, so every call is scoped to a single end user.
| Area | What MemorySync does |
|---|---|
| End-user isolation | Every API-key call must name an end user in X-End-User-ID, or the API returns 400. Reads, searches and deletes are filtered to that end user, project and environment. |
| Encryption at rest | Memory text is encrypted with a separate key for each end user before it is stored. |
| Encryption in transit | HTTPS only. Plain HTTP is redirected, and the API, the website and the docs send HSTS headers. |
| Model providers | To extract facts and build embeddings, memory text is sent to a model provider (OpenAI today) through its API, which does not train on API data. |
4. Namespaces & End-User Scoping
MemorySync enforces a three-tier hierarchical scope for every write and retrieval operation: project_id, end_user_id, and optional session_id.
Three-Tier Scope Structure
Every memory record is bound to an immutable tenant coordinate.
- project_id
- Application Boundary
Separates environments (production vs staging) and applications.
- end_user_id
- Tenant Partition
Stable opaque identifier for a specific developer or end user.
- session_id
- Ephemeral Context
Optional thread or task identifier for grouping conversational turns.
- Project Boundaries: An API key is permanently scoped to a single project. Requests attempting to access resources from another project are rejected with HTTP 403 Forbidden.
- End-User Isolation: Every query is filtered to the end_user_id it names, so a query made for User A only searches User A’s memories. Your application decides which end user a request is for, so authorize the user in your own app before calling MemorySync.
- Shared Team Standards: To share organizational conventions across all team members, use a workspace-level identifier as the end_user_id (e.g. team-engineering).
5. MCP & IDE Integration
MemorySync runs a hosted MCP server at https://mcp.memorysync.io/mcp, so a coding assistant can store and search memory without a local server. Without an API key, clients sign you in with OAuth on first use.
{"mcpServers": {"memorysync": {"url": "https://mcp.memorysync.io/mcp"},"memorysync-docs": {"url": "https://docs.memorysync.io/mcp"}}}
- No local server: Cursor, Claude Code, VS Code and other clients that accept a URL connect over Streamable HTTP. Claude Desktop’s config file starts local servers only, so it connects through the
mcp-remotebridge, which needs Node.js. - Fifteen tools, including
search_memory,add_memory,get_memory,update_memoryanddelete_memory.tools/listreturns the full set. - Shared memory: two agents that use the same key and end-user ID, such as a planning agent and a coding agent, read and write the same memories.
6. Lifecycle & State Invalidation
Context changes over time. These are the controls MemorySync gives you for keeping it current, and what it does on its own.
| Lifecycle Feature | Mechanism | Recommended Use Case |
|---|---|---|
TTL Expiration (ttl_minutes) | The memory stops applying after the duration you set. | Session flags, temporary debugging context, anything with a known end. |
Importance Weights (importance) | Floating-point weight from 0.0 to 1.0. | Prioritizing core architectural decisions over minor styling preferences. |
| Automatic replacement | A new fact in a slot that holds one value (where someone lives, their job title, their editor theme) supersedes the old one when it is stored. | Keeping one current value without deleting anything yourself. |
Explicit deletion (DELETE /memory/forget) | Hard delete by ID, or by filters with a dry run to preview. | Right-to-be-forgotten requests and preference resets. |
| Relationship links | Typed links between memories, including contradiction. | Checking whether a memory you rely on is contradicted by another. |
- Facts outside those one-value slots are kept side by side with their timestamps: "uses MySQL" and "moved to Postgres" both come back until you delete the old one.
- Deleted memories stay deleted:
forgetremoves the record and its vector, so a deleted memory does not come back in search. - Summaries keep their sources: a summary records the IDs of the memories it condenses.
7. Ecosystem Comparison & Free Tier
How does MemorySync compare to other memory and state solutions in the AI agent ecosystem?
| Dimension | MemorySync | Mem0 | Zep | Raw Context Window |
|---|---|---|---|---|
| Interfaces | REST API, Python and TypeScript SDKs, hosted remote MCP server | REST API, Python and TypeScript SDKs, hosted MCP server | REST API; Python, TypeScript and Go SDKs; hosted MCP server | None: the history is the prompt |
| Recall Latency | 179 ms server-side p50, measured (see section 1) | 0.88 s p50 on LoCoMo, published by Mem0 (managed platform) | 87 ms p50 / 155 ms p95 on LoCoMo, published by Zep | Nothing to fetch, but every turn re-sends the history |
| Retrieval | Hybrid keyword + vector search | Semantic, BM25 keyword and entity matching, fused | Semantic and BM25 search over a temporal knowledge graph | The model reads the whole window |
| Multi-Tenancy | End user required on every API-key call; the API filters every read to it | user_id, agent_id, run_id or app_id filters passed on each call | A graph per user, inside a project | Whatever your application sends |
| Getting Started | Evaluation key from one API call; the docs MCP server needs no signup | Account and API key, or mem0 init --agent; self-hosting needs a vector store | Zep Cloud account and API key | Nothing to set up; cost grows with every turn |
| Free Tier | 10,000 adds and 1,000 retrievals a month ($0, no card required) | Hobby: 10,000 adds and 1,000 retrievals a month; the open-source library is free | 10,000 credits a month | Billed as model input tokens |