# intina47/context-sync architecture

> Architecture diagram of the GitHub repository intina47/context-sync, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-28). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/intina47/context-sync
- Repository: https://github.com/intina47/context-sync

## Overview

Context Sync is a local-first MCP server that gives AI coding tools persistent, project-specific memory and codebase context. The main session workflow is to select a project, recover stored context, explore its files, and save new decisions or work so they can be recalled later. Separate tool branches provide git-aware analysis and optional read-only Notion lookup. The graph reflects README capabilities and sampled engine behavior; some handler-to-engine wiring is inferred from module roles, while unsampled internal call details are omitted.

Main entry points: [`src/server.ts`](https://github.com/intina47/context-sync/blob/main/src/server.ts) (MCP server), [`src/read-file-engine.ts`](https://github.com/intina47/context-sync/blob/main/src/read-file-engine.ts) (File context), [`src/workspace-tool-handler.ts`](https://github.com/intina47/context-sync/blob/main/src/workspace-tool-handler.ts) (Workspace tools), [`src/core-tools.ts`](https://github.com/intina47/context-sync/blob/main/src/core-tools.ts) (Memory tools)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interface["MCP Interface"]
  node_server["MCP server<br/>[server.ts]"]
  node_project_tool["Project selection"]
  node_memory_tools["Memory tools<br/>[core-tools.ts]"]
  node_workspace_tools["Workspace tools"]
  node_git_tool["Git tool"]
  node_notion_tool["Notion tool"]
end

subgraph group_memory["Project Memory"]
  node_detector["Project detection"]
  node_profiler["Project profiling"]
  node_remember["Remember engine<br/>[remember-engine.ts]"]
  node_recall["Recall engine<br/>[recall-engine.ts]"]
  node_storage[("SQLite storage<br/>[storage.ts]")]
end

subgraph group_workspace["Workspace Tools"]
  node_readfile["File context"]
  node_search["Search engine<br/>[search-engine.ts]"]
  node_structure["Structure engine"]
end

subgraph group_integrations["Integrations"]
  node_git_status["Git status"]
  node_git_context["Git context"]
  node_git_hooks["Git hooks"]
  node_notion_handlers["Notion handlers<br/>[notion-handlers.ts]"]
end

node_developer(("AI coding tool"))
node_notion_api["Notion API"]
node_workspace_fs[("Project files")]
node_git_repo[("Git repository")]

node_developer -->|"uses MCP"| node_server
node_server -->|"dispatches tools"| node_project_tool
node_server -->|"dispatches tools"| node_memory_tools
node_server -->|"dispatches tools"| node_workspace_tools
node_server -->|"dispatches tools"| node_git_tool
node_server -.->|"dispatches tools"| node_notion_tool
node_project_tool -->|"selects project"| node_detector
node_detector -->|"profiles project"| node_profiler
node_memory_tools -->|"stores context"| node_remember
node_memory_tools -->|"recovers context"| node_recall
node_remember -->|"writes memory"| node_storage
node_recall -->|"reads memory"| node_storage
node_workspace_tools -->|"searches files"| node_search
node_workspace_tools -->|"maps structure"| node_structure
node_workspace_tools -->|"reads file context"| node_readfile
node_search -->|"enriches matches"| node_readfile
node_structure -->|"analyzes context"| node_readfile
node_readfile -->|"reads files"| node_workspace_fs
node_search -->|"searches files"| node_workspace_fs
node_structure -->|"scans directories"| node_workspace_fs
node_git_tool -->|"gets status"| node_git_status
node_git_tool -->|"gets context"| node_git_context
node_git_status -->|"reads status"| node_git_repo
node_git_context -->|"reads history"| node_git_repo
node_git_status -->|"enriches changes"| node_readfile
node_git_context -->|"adds file context"| node_readfile
node_project_tool -.->|"can install hooks"| node_git_hooks
node_notion_tool -.->|"handles lookup"| node_notion_handlers
node_notion_handlers -.->|"searches and reads"| node_notion_api

click node_server "https://github.com/intina47/context-sync/blob/main/src/server.ts"
click node_project_tool "https://github.com/intina47/context-sync/blob/main/src/workspace-tool-handler.ts"
click node_memory_tools "https://github.com/intina47/context-sync/blob/main/src/core-tools.ts"
click node_workspace_tools "https://github.com/intina47/context-sync/blob/main/src/workspace-tool-handler.ts"
click node_git_tool "https://github.com/intina47/context-sync/blob/main/src/git-tool-handler.ts"
click node_notion_tool "https://github.com/intina47/context-sync/blob/main/src/notion-tool-handler.ts"
click node_detector "https://github.com/intina47/context-sync/blob/main/src/project-detector.ts"
click node_profiler "https://github.com/intina47/context-sync/blob/main/src/project-profiler.ts"
click node_remember "https://github.com/intina47/context-sync/blob/main/src/remember-engine.ts"
click node_recall "https://github.com/intina47/context-sync/blob/main/src/recall-engine.ts"
click node_storage "https://github.com/intina47/context-sync/blob/main/src/storage.ts"
click node_readfile "https://github.com/intina47/context-sync/blob/main/src/read-file-engine.ts"
click node_search "https://github.com/intina47/context-sync/blob/main/src/search-engine.ts"
click node_structure "https://github.com/intina47/context-sync/blob/main/src/structure-engine.ts"
click node_git_status "https://github.com/intina47/context-sync/blob/main/src/git-status-engine.ts"
click node_git_context "https://github.com/intina47/context-sync/blob/main/src/git-context-engine.ts"
click node_git_hooks "https://github.com/intina47/context-sync/blob/main/src/git-hook-manager.ts"
click node_notion_handlers "https://github.com/intina47/context-sync/blob/main/src/notion-handlers.ts"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_server,node_project_tool,node_memory_tools,node_workspace_tools,node_git_tool,node_notion_tool toneBlue
class node_detector,node_profiler,node_remember,node_recall,node_storage,node_workspace_fs,node_git_repo toneAmber
class node_readfile,node_search,node_structure,node_notion_api toneMint
class node_git_status,node_git_context,node_git_hooks,node_notion_handlers toneRose
class node_developer toneIndigo
```

## Components

### MCP Interface

- [MCP server](https://github.com/intina47/context-sync/blob/main/src/server.ts): `src/server.ts`
- [Project selection](https://github.com/intina47/context-sync/blob/main/src/workspace-tool-handler.ts): `src/workspace-tool-handler.ts`
- [Memory tools](https://github.com/intina47/context-sync/blob/main/src/core-tools.ts): `src/core-tools.ts`
- [Workspace tools](https://github.com/intina47/context-sync/blob/main/src/workspace-tool-handler.ts): `src/workspace-tool-handler.ts`
- [Git tool](https://github.com/intina47/context-sync/blob/main/src/git-tool-handler.ts): `src/git-tool-handler.ts`
- [Notion tool](https://github.com/intina47/context-sync/blob/main/src/notion-tool-handler.ts): `src/notion-tool-handler.ts`

### Project Memory

- [Project detection](https://github.com/intina47/context-sync/blob/main/src/project-detector.ts): `src/project-detector.ts`
- [Project profiling](https://github.com/intina47/context-sync/blob/main/src/project-profiler.ts): `src/project-profiler.ts`
- [Remember engine](https://github.com/intina47/context-sync/blob/main/src/remember-engine.ts): `src/remember-engine.ts`
- [Recall engine](https://github.com/intina47/context-sync/blob/main/src/recall-engine.ts): `src/recall-engine.ts`
- [SQLite storage](https://github.com/intina47/context-sync/blob/main/src/storage.ts): `src/storage.ts`

### Workspace Tools

- [File context](https://github.com/intina47/context-sync/blob/main/src/read-file-engine.ts): `src/read-file-engine.ts`
- [Search engine](https://github.com/intina47/context-sync/blob/main/src/search-engine.ts): `src/search-engine.ts`
- [Structure engine](https://github.com/intina47/context-sync/blob/main/src/structure-engine.ts): `src/structure-engine.ts`

### Integrations

- [Git status](https://github.com/intina47/context-sync/blob/main/src/git-status-engine.ts): `src/git-status-engine.ts`
- [Git context](https://github.com/intina47/context-sync/blob/main/src/git-context-engine.ts): `src/git-context-engine.ts`
- [Git hooks](https://github.com/intina47/context-sync/blob/main/src/git-hook-manager.ts): `src/git-hook-manager.ts`
- [Notion handlers](https://github.com/intina47/context-sync/blob/main/src/notion-handlers.ts): `src/notion-handlers.ts`

### Other components

- **AI coding tool**
- **Notion API**
- **Project files**
- **Git repository**

## Connections

- AI coding tool → MCP server: uses MCP
- MCP server → Project selection: dispatches tools
- MCP server → Memory tools: dispatches tools
- MCP server → Workspace tools: dispatches tools
- MCP server → Git tool: dispatches tools
- MCP server → Notion tool: dispatches tools
- Project selection → Project detection: selects project
- Project detection → Project profiling: profiles project
- Memory tools → Remember engine: stores context
- Memory tools → Recall engine: recovers context
- Remember engine → SQLite storage: writes memory
- Recall engine → SQLite storage: reads memory
- Workspace tools → Search engine: searches files
- Workspace tools → Structure engine: maps structure
- Workspace tools → File context: reads file context
- Search engine → File context: enriches matches
- Structure engine → File context: analyzes context
- File context → Project files: reads files
- Search engine → Project files: searches files
- Structure engine → Project files: scans directories
- Git tool → Git status: gets status
- Git tool → Git context: gets context
- Git status → Git repository: reads status
- Git context → Git repository: reads history
- Git status → File context: enriches changes
- Git context → File context: adds file context
- Project selection → Git hooks: can install hooks
- Notion tool → Notion handlers: handles lookup
- Notion handlers → Notion API: searches and reads
