MemorySync
Core Concepts

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.

Measurementp50p95What it includes
Server-side retrieval time (latency_ms in the response)179 ms980 msRanking and assembling the result on the server.
Round trip from a client far from the API region698 ms1,910 msServer 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.

StrategyInput tokens per turn30-turn sessions × 1,000Relative token spend
Re-send the full history45,000 tokens1.35 billion tokens37.5× the scoped approach
Keep a 5k-token window5,000 tokens150 million tokens4.2×, and older turns are dropped
Retrieve scoped memories1,200 tokens36 million tokens1.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.

AreaWhat MemorySync does
End-user isolationEvery 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 restMemory text is encrypted with a separate key for each end user before it is stored.
Encryption in transitHTTPS only. Plain HTTP is redirected, and the API, the website and the docs send HSTS headers.
Model providersTo 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.

Scoping hierarchy

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-remote bridge, which needs Node.js.
  • Fifteen tools, including search_memory, add_memory, get_memory, update_memory and delete_memory. tools/list returns 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 FeatureMechanismRecommended 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 replacementA 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 linksTyped 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: forget removes 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?

DimensionMemorySyncMem0ZepRaw Context Window
InterfacesREST API, Python and TypeScript SDKs, hosted remote MCP serverREST API, Python and TypeScript SDKs, hosted MCP serverREST API; Python, TypeScript and Go SDKs; hosted MCP serverNone: the history is the prompt
Recall Latency179 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 ZepNothing to fetch, but every turn re-sends the history
RetrievalHybrid keyword + vector searchSemantic, BM25 keyword and entity matching, fusedSemantic and BM25 search over a temporal knowledge graphThe model reads the whole window
Multi-TenancyEnd user required on every API-key call; the API filters every read to ituser_id, agent_id, run_id or app_id filters passed on each callA graph per user, inside a projectWhatever your application sends
Getting StartedEvaluation key from one API call; the docs MCP server needs no signupAccount and API key, or mem0 init --agent; self-hosting needs a vector storeZep Cloud account and API keyNothing to set up; cost grows with every turn
Free Tier10,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 free10,000 credits a monthBilled as model input tokens
Was this page helpful?