Zero-Knowledge Memory Sync: How We Built End-to-End Encrypted Sync for AI Coding Agents
As software engineers transition from conversational chat models to autonomous, multi-turn coding agents (Claude Code, Cursor, Codex, OpenCode), context loss has become the primary bottleneck. An agent without long-term
As software engineers transition from conversational chat models to autonomous, multi-turn coding agents (Claude Code, Cursor, Codex, OpenCode), context loss has become the primary bottleneck.
An agent without long-term memory is forced to rediscover your architecture from scratch on every run. But giving an agent persistent memory across multiple workstations introduces a serious security hurdle: how do you synchronize sensitive project knowledge, database schemas, and API conventions across devices without exposing them to cloud providers in plaintext?
In this post, we explain the architecture behind Engraphis Cloud Sync: a local-first, zero-knowledge memory system for AI coding agents.
The Problem: Multi-Device Context Drift
Modern developers rarely code on a single machine. You might write code on an office desktop, review PRs on a laptop, and execute agent tasks on a cloud VM.
Without cross-device memory synchronization:
- Architectural conventions established on one machine are unknown to agents on another.
- Bug root-cause analyses must be re-explained repeatedly.
- Agents recommend deprecated patterns that you fixed hours earlier on another device.
Centralized cloud databases solve synchronization, but they destroy privacy: your proprietary code decisions and infrastructure layouts live unencrypted on third-party servers.
The Architecture: Local-First Core + E2EE Relay
Engraphis resolves this tension with a split architecture:
The Local Engine (Apache-2.0):
Every machine runs a local instance of Engraphis backed by SQLite. It provides hybrid retrieval (vector embeddings + BM25 lexical search + entity knowledge graph) through the Model Context Protocol (MCP).On-Device Encryption:
Before any sync payload leaves the local machine, it is packaged into a compressed binary bundle and encrypted using client-side AES-GCM-256. The encryption key (ENGRAPHIS_SYNC_E2EE_KEY) is generated on your device and never transmitted to Engraphis Cloud.Authenticated Zero-Knowledge Relay:
The cloud relay acts strictly as an authenticated storage coordinator. It verifies workspace entitlements and organizes encrypted revisions by timestamp and device ID, but it has zero insight into the bundle contents.Deterministic Conflict Resolution:
When a peer device pulls down updates, it decrypts the bundle locally using the shared workspace key. The deterministic merge engine reconciles memory entities:Additive inserts are integrated immediately.
Updates to existing memories use monotonic versioning and cryptographic content hashing.
Temporal history is preserved rather than silently overwritten, allowing agents to trace how a decision evolved over time.
Fail-Closed Privacy Guarantees
Cloud Sync enforces strict data boundaries:
- Scope Filtering: Personal workspaces, session-scoped transients, and entries marked with secret sensitivity are filtered out before bundling.
- Strict Key Validation: If a device lacks an encryption key or supplies an invalid format, sync immediately aborts. There is no silent fallback to unencrypted transport.
User Experience: Real-Time Visibility
In the latest v1.30 update, sync health is permanently visible:
- Sidebar status card with glowing state dot and live counts (e.g., "All 9/9 workspaces in sync").
- Direct one-click "Sync now" action from any view.
- Persistent green "In sync" badges in the Settings view and Cloud Sync tab.
- Floating viewport toasts that confirm sync completion with clear dismiss controls.
Summary
AI agents are only as capable as the context they retain. By combining local-first SQLite performance with zero-knowledge end-to-end encryption, developers can run synchronized coding agents across all their machines without sacrificing security.
Get started with Engraphis on GitHub:
https://github.com/Coding-Dev-Tools/engraphis
Originally published by Dev.to AI. Aggregated on AIWithGhost for educational purposes — full credit and traffic to the original publisher.