MemorySync
Core Concepts

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.

Latency & Lookup Mechanics

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.
Architecturep50 Latencyp95 LatencyScaling Bottleneck
Local SQLite (:memory:)0.02 ms0.03 msEphemeral; lost on process/container restart.
Local ChromaDB (all-MiniLM-L6)254.31 ms445.52 msHost CPU forward passes on embedding inference.
Redis Distributed Cache2.15 ms4.80 msLacks cryptographic tenant isolation & semantic filters.
MemorySync Remote MCP<50.0 ms<80.0 msDeterministic 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.

StrategyAvg Input Tokens / Turn30-Turn Session (1k Runs)Relative Token Spend & Efficiency
Raw Context Dumping45,000 tokens1.35 Billion tokens37.5x baseline (Severe token bloat)
Window Compaction (5k buffer)5,000 tokens150 Million tokens4.2x baseline (~40% state amnesia)
MemorySync Scoped Persistence1,200 tokens36 Million tokens1.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 LayerImplementation ContractVerification Guarantee
Tenant IsolationCryptographic SHA-256 namespace partition per tenant.Zero cross-tenant memory leakage; mathematical partition.
Encryption at RestAES-256 with per-project rotating encryption keys.Meets SOC2 Type II and HIPAA data protection guidelines.
Encryption in TransitStrict TLS 1.3 enforcement with HSTS headers.All API and MCP traffic is encrypted end-to-end.
Model Training PolicyStrict 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.

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: 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 FeatureMechanismRecommended 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?

DimensionMemorySyncMem0ZepRaw Context Window
Primary ProtocolNative Remote MCP & RESTREST & Python SDKREST & GraphQLNone (Prompt Window)
p95 Recall Latency<50 ms (Deterministic)250ms–400ms (Vector)200ms–350ms (Vector)1,500ms–8,000ms (Prefill)
ArchitectureScoped Key-Value & HybridVector EmbeddingsTemporal Knowledge GraphIn-Memory Context
Multi-TenancyCryptographic NamespaceUser/Session MetadataUser ID GroupingManual Ingestion
Setup Time< 2 minutes (Zero-signup docs MCP)Requires vector configurationRequires server infrastructureZero setup (high ongoing cost)
Free TierFree developer tier ($0, no card required)Free tier available (Cloud & Open Source)Free tier available (Community / Cloud)Direct LLM token billing
Was this page helpful?