System Architecture Overview

BrainSync is not a standard LLM chat interface. It is a highly optimized, local Intelligence Engine that bridges the gap between your physical IDE environment and any autonomous agent, providing surgically precise, O(1) persistent memory.

1. Local Intelligence Engine Structure

Traditional agents rely heavily on the context window, repeatedly fetching and ingesting your entire codebase for every prompt. This results in massive token bloat, high latency, and severe rate limiting.

BrainSync offloads this burden to a local SQLite database running seamlessly within your IDE extension host. By tracking the physical execution flow of your workspace, BrainSync maps the exact dependencies required for a specific task.

  • Structural AST Indexing: Classes, functions, and object structures are indexed and compressed without internal noise.
  • Zero Data Residency: Everything lives exclusively on your disk in SQLite. There is no cloud backend storing your intellectual property.
  • Multi-Project Awareness: Hot-swapping databases seamlessly via the ~/.bsync_core/projects.json registry.

2. Universal MCP Integration

BrainSync relies on the Model Context Protocol (MCP) to standardize context delivery. Any agent supporting MCP (e.g., Claude Code, Cursor, Windsurf, Aider, Cline) can query the BrainSync SQLite engine instance dynamically.

// Example: Standard MCP resolution flow within the MultiProjectResolver
1. Editor Focus Event -> IDE alerts BrainSync
2. BrainSync Updates ~/.bsync_core/projects.json -> points to active project DB
3. Agent Tool Call -> Intercepted by BrainSync MCP Server
4. Rapid SQL Retrieval -> Returns structured O(1) context

3. Zero-Trust Security Protocols

Because BrainSync handles deeply intimate project knowledge, we built a Zero-Trust local architecture.

  • All local state databases (`state.dat`) are encrypted at rest using SQLCipher implementation standards if requested.
  • Secret tokens are generated and stored strictly inside the OS-native keychain mechanism (`SecretStorage`).
  • The network footprint is minimized. BrainSync only reaches out to `brainsync.dev` to securely validate your Pro License subscription using AES-encrypted payload signatures.