Developer FAQ
Answers to common questions about sub-50ms deterministic recall, cryptographic tenant isolation, Model Context Protocol (MCP), and multi-turn agent state management.
1. Performance & Latency
Autonomous coding agents and interactive assistants require low-latency state retrieval to avoid stalling user workflows. MemorySync achieves sub-50ms deterministic recall by separating immutable constraint state from unstructured vector search.
MemorySync Scoped MCP
Deterministic edge-indexed key-value retrieval over JSON-RPC 2.0.
- Sub-50ms p95 recall latency globally over HTTPS/SSE.
- O(1) hash lookup eliminates embedding model inference overhead.
- Injects only 800–1,500 tokens of pinned invariants per turn.
Vector Databases (Chroma/Pinecone)
Approximate Nearest Neighbor (ANN) search over high-dimensional embeddings.
- 250ms–500ms CPU/GPU overhead per query for ONNX embedding tokenization.
- Non-deterministic top-k similarity causes semantic bleed and hallucination.
- Inflates prompt context with noisy, unranked conversation fragments.
| Architecture | p50 Latency | p95 Latency | Scaling Bottleneck |
|---|---|---|---|
Local SQLite (:memory:) | 0.02 ms | 0.03 ms | Ephemeral; lost on process/container restart. |
Local ChromaDB (all-MiniLM-L6) | 254.31 ms | 445.52 ms | Host CPU forward passes on embedding inference. |
| Redis Distributed Cache | 2.15 ms | 4.80 ms | Lacks cryptographic tenant isolation & semantic filters. |
| MemorySync Remote MCP | <50.0 ms | <80.0 ms | Deterministic O(1) indexed edge retrieval. |
2. Token Economics & Cost Reduction
Standard multi-turn agent conversations re-send accumulating message history on every prompt. After 20 to 30 turns, prompts routinely balloon past 40,000–60,000 tokens per request.
| Strategy | Avg Input Tokens / Turn | 30-Turn Session (1k Runs) | Relative Token Spend & Efficiency |
|---|---|---|---|
| Raw Context Dumping | 45,000 tokens | 1.35 Billion tokens | 37.5x baseline (Severe token bloat) |
| Window Compaction (5k buffer) | 5,000 tokens | 150 Million tokens | 4.2x baseline (~40% state amnesia) |
| MemorySync Scoped Persistence | 1,200 tokens | 36 Million tokens | 1.0x Baseline (97.3% token savings) |
- Eliminates Prompt Prefill Latency: Transformer attention complexity scales quadratically with prompt length. Shrinking prompts from 50k tokens to 1.2k tokens slashes time-to-first-token (TTFT) by up to 85%.
- Defeats Recency Bias: Standard LLM attention mechanisms suffer from severe recency bias, causing models to drop earlier architectural invariants in favor of recent compiler error traces.
- Deterministic State Anchoring: Pinned memories are injected directly into system instructions as immutable contracts, guaranteeing consistency across 50+ turns.
3. Security, Privacy & Multi-Tenancy
MemorySync was engineered from day one for multi-tenant SaaS environments where data isolation is a non-negotiable compliance requirement.
| Security Layer | Implementation Contract | Verification Guarantee |
|---|---|---|
| Tenant Isolation | Cryptographic SHA-256 namespace partition per tenant. | Zero cross-tenant memory leakage; mathematical partition. |
| Encryption at Rest | AES-256 with per-project rotating encryption keys. | Meets SOC2 Type II and HIPAA data protection guidelines. |
| Encryption in Transit | Strict TLS 1.3 enforcement with HSTS headers. | All API and MCP traffic is encrypted end-to-end. |
| Model Training Policy | Strict Zero-Data Retention policy for AI training. | Zero customer memories are ever used to train foundation models. |
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: Queries strictly filter by end_user_id. An agent acting on behalf of User A can never read or overwrite memories belonging to User B.
- 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 provides a first-class, production-verified Model Context Protocol (MCP) remote server, enabling zero-install persistent memory across modern AI coding environments.
{"mcpServers": {"memorysync": {"command": "npx","args": ["-y", "@memorysync/mcp-server"],"env": {"MEMORYSYNC_API_KEY": "your-api-key","MEMORYSYNC_PROJECT_ID": "your-project-id"}}}}
- Zero Local Dependencies: The remote MCP endpoint connects over standard HTTP/SSE, requiring no local Python venvs, vector stores, or binary dependencies.
- Universal Tool Contracts: Exposes standardized MCP tools: add_memory, search_memory, get_context, and forget_memory.
- Multi-Agent Coordination: Multiple agents (e.g. a planning agent and a coding agent) can read from and write to the same shared memory scope synchronously.
6. Lifecycle & State Invalidation
Autonomous workflows generate changing context over time. MemorySync provides explicit lifecycle primitives to prevent stale or conflicting data from accumulating.
| Lifecycle Feature | Mechanism | Recommended Use Case |
|---|---|---|
TTL Expiration (ttl_minutes) | Automated server-side pruning after a duration. | Time-limited tokens, session flags, ephemeral debugging context. |
Importance Weights (importance) | Floating-point weight from 0.0 to 1.0. | Prioritizing core architectural decisions over minor styling preferences. |
Explicit Invalidation (forget) | Cryptographic hard deletion by ID or query. | Compliance GDPR right to be forgotten and user preference resets. |
Contradiction Edges (relations) | Explicit contradiction and supersedes links. | Tracking architectural decisions that replace earlier technical choices. |
- No Ghost Deletions: When you call forget([id]), the record and all its indexed representations are purged immediately across all edge nodes.
- Lossless Summaries: Summarize historical chains into compact milestone records while preserving the original provenance IDs for audit trails.
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 |
|---|---|---|---|---|
| Primary Protocol | Native Remote MCP & REST | REST & Python SDK | REST & GraphQL | None (Prompt Window) |
| p95 Recall Latency | <50 ms (Deterministic) | 250ms–400ms (Vector) | 200ms–350ms (Vector) | 1,500ms–8,000ms (Prefill) |
| Architecture | Scoped Key-Value & Hybrid | Vector Embeddings | Temporal Knowledge Graph | In-Memory Context |
| Multi-Tenancy | Cryptographic Namespace | User/Session Metadata | User ID Grouping | Manual Ingestion |
| Setup Time | < 2 minutes (Zero-signup docs MCP) | Requires vector configuration | Requires server infrastructure | Zero setup (high ongoing cost) |
| Free Tier | Free developer tier ($0, no card required) | Free tier available (Cloud & Open Source) | Free tier available (Community / Cloud) | Direct LLM token billing |