# mtecnic/code-atlas architecture

> Architecture diagram of the GitHub repository mtecnic/code-atlas, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-20). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/mtecnic/code-atlas
- Repository: https://github.com/mtecnic/code-atlas

## Overview

Code Atlas is an Electron desktop application that analyzes a repository and presents it as an interactive 3D codebase. The principal workflow is opening a folder, scanning and parsing its files, resolving dependencies and Git history, then sending a snapshot to the renderer for city and galaxy exploration. Users can also inspect symbol-level molecules, apply insight and health views, edit files, scrub history, and use AI features. The graph includes documented capabilities whose implementation was not sampled; dashed, uncited links mark relationships not verified in the excerpts.

Main entry points: [`src/renderer/src/App.tsx`](https://github.com/mtecnic/code-atlas/blob/master/src/renderer/src/App.tsx) (Renderer application), [`src/main/ipc.ts`](https://github.com/mtecnic/code-atlas/blob/master/src/main/ipc.ts) (IPC handlers), [`src/preload/index.ts`](https://github.com/mtecnic/code-atlas/blob/master/src/preload/index.ts) (Preload API), [`src/main/analyzer/analyzer.ts`](https://github.com/mtecnic/code-atlas/blob/master/src/main/analyzer/analyzer.ts) (Analysis coordinator)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_analysis["Repository analysis"]
  node_analyzer["Analysis coordinator<br/>[analyzer.ts]"]
  node_scanner["Repository scanner<br/>[scanner.ts]"]
  node_parser["Tree-sitter worker<br/>[parse-worker.ts]"]
  node_resolver["Import resolver<br/>[import-resolver.ts]"]
  node_git["Git history<br/>[churn.ts]"]
  node_symbols["Symbol graph<br/>[symbol-graph.ts]"]
  node_state[("Analysis and settings store<br/>[store.ts]")]
end

subgraph group_desktop["Desktop bridge"]
  node_main["Electron host<br/>[index.ts]"]
  node_ipc["IPC handlers<br/>[ipc.ts]"]
  node_preload["Preload API<br/>[index.ts]"]
  node_contract["IPC contract<br/>[ipc-contract.ts]"]
  node_model["Shared data model<br/>[model.ts]"]
end

subgraph group_visual["3D exploration"]
  node_app["Renderer application<br/>[App.tsx]"]
  node_scene["Scene manager<br/>[SceneManager.ts]"]
  node_world["City and galaxy<br/>[WorldLayer.ts]"]
  node_molecule["Symbol molecule<br/>[MoleculeLayer.ts]"]
  node_moleculedata["Molecule view state<br/>[molecule.ts]"]
  node_timeline["History playback<br/>[TimeMachine.ts]"]
  node_rendererstate[("Renderer state<br/>[store.ts]")]
  node_editor["File editor<br/>[EditorPanel.tsx]"]
  node_search["File search<br/>[SearchPalette.tsx]"]
end

subgraph group_insights["Code insights"]
  node_lenses["Insight lenses<br/>[lenses.ts]"]
  node_health["Architecture health<br/>[graph-health.ts]"]
  node_graphops["Dependency graph operations<br/>[graphops.ts]"]
end

subgraph group_assistant["AI assistance"]
  node_llm["LLM chat bridge<br/>[llm.ts]"]
  node_aitools["Scene tool registry<br/>[index.ts]"]
  node_agent["AI agent loop<br/>[agent-loop.ts]"]
  node_chat["LLM chat service<br/>[chat.ts]"]
  node_probe["Endpoint detection<br/>[probe.ts]"]
  node_summaries["Semantic summaries<br/>[summaries.ts]"]
end

node_user(("Developer"))
node_repository["Repository folder"]
node_llmservice{{"Configured LLM endpoint"}}

node_user -->|"opens app"| node_app
node_user -.->|"chooses folder"| node_repository
node_app -.->|"requests analysis"| node_preload
node_preload -->|"invokes channels"| node_ipc
node_main -->|"registers handlers"| node_ipc
node_ipc -->|"starts analysis"| node_analyzer
node_analyzer -->|"scans files"| node_scanner
node_analyzer -->|"dispatches parsing"| node_parser
node_analyzer -.->|"resolves imports"| node_resolver
node_analyzer -->|"reads history"| node_git
node_analyzer -.->|"updates analysis state"| node_state
node_state -->|"builds symbol graph"| node_symbols
node_ipc -->|"reads analysis state"| node_state
node_ipc -.->|"sends snapshots"| node_preload
node_preload -.->|"delivers snapshot"| node_app
node_app -->|"creates scene"| node_scene
node_scene -->|"renders world"| node_world
node_scene -->|"renders symbols"| node_molecule
node_scene -->|"replays history"| node_timeline
node_scene -->|"reacts to state"| node_rendererstate
node_scene -->|"applies lens"| node_lenses
node_moleculedata -->|"updates molecule state"| node_rendererstate
node_app -->|"shows editor"| node_editor
node_app -->|"shows search"| node_search
node_app -.->|"shows findings"| node_health
node_app -.->|"exposes graph actions"| node_graphops
node_editor -.->|"reads and writes files"| node_preload
node_app -.->|"starts chat"| node_llm
node_llm -->|"dispatches tool calls"| node_aitools
node_llm -->|"streams chat requests"| node_preload
node_ipc -->|"routes chat"| node_chat
node_chat -->|"runs agent"| node_agent
node_agent -.->|"returns tool calls"| node_preload
node_ipc -->|"probes endpoint"| node_probe
node_ipc -->|"builds summaries"| node_summaries
node_chat -.->|"sends requests"| node_llmservice
node_probe -.->|"detects endpoint"| node_llmservice
node_summaries -.->|"generates summaries"| node_llmservice

click node_main "https://github.com/mtecnic/code-atlas/blob/master/src/main/index.ts"
click node_ipc "https://github.com/mtecnic/code-atlas/blob/master/src/main/ipc.ts"
click node_preload "https://github.com/mtecnic/code-atlas/blob/master/src/preload/index.ts"
click node_contract "https://github.com/mtecnic/code-atlas/blob/master/src/shared/ipc-contract.ts"
click node_analyzer "https://github.com/mtecnic/code-atlas/blob/master/src/main/analyzer/analyzer.ts"
click node_scanner "https://github.com/mtecnic/code-atlas/blob/master/src/main/analyzer/scanner.ts"
click node_parser "https://github.com/mtecnic/code-atlas/blob/master/src/main/analyzer/parse-worker.ts"
click node_resolver "https://github.com/mtecnic/code-atlas/blob/master/src/main/analyzer/import-resolver.ts"
click node_git "https://github.com/mtecnic/code-atlas/blob/master/src/main/git/churn.ts"
click node_symbols "https://github.com/mtecnic/code-atlas/blob/master/src/main/analyzer/symbol-graph.ts"
click node_state "https://github.com/mtecnic/code-atlas/blob/master/src/main/store.ts"
click node_model "https://github.com/mtecnic/code-atlas/blob/master/src/shared/model.ts"
click node_app "https://github.com/mtecnic/code-atlas/blob/master/src/renderer/src/App.tsx"
click node_scene "https://github.com/mtecnic/code-atlas/blob/master/src/renderer/src/scene/SceneManager.ts"
click node_world "https://github.com/mtecnic/code-atlas/blob/master/src/renderer/src/scene/WorldLayer.ts"
click node_molecule "https://github.com/mtecnic/code-atlas/blob/master/src/renderer/src/scene/MoleculeLayer.ts"
click node_moleculedata "https://github.com/mtecnic/code-atlas/blob/master/src/renderer/src/molecule.ts"
click node_timeline "https://github.com/mtecnic/code-atlas/blob/master/src/renderer/src/scene/TimeMachine.ts"
click node_rendererstate "https://github.com/mtecnic/code-atlas/blob/master/src/renderer/src/store.ts"
click node_lenses "https://github.com/mtecnic/code-atlas/blob/master/src/renderer/src/lenses.ts"
click node_health "https://github.com/mtecnic/code-atlas/blob/master/src/renderer/src/analysis/graph-health.ts"
click node_graphops "https://github.com/mtecnic/code-atlas/blob/master/src/renderer/src/graphops.ts"
click node_editor "https://github.com/mtecnic/code-atlas/blob/master/src/renderer/src/ui/EditorPanel.tsx"
click node_search "https://github.com/mtecnic/code-atlas/blob/master/src/renderer/src/ui/SearchPalette.tsx"
click node_llm "https://github.com/mtecnic/code-atlas/blob/master/src/renderer/src/llm.ts"
click node_aitools "https://github.com/mtecnic/code-atlas/blob/master/src/renderer/src/ai-tools/index.ts"
click node_agent "https://github.com/mtecnic/code-atlas/blob/master/src/main/llm/agent-loop.ts"
click node_chat "https://github.com/mtecnic/code-atlas/blob/master/src/main/llm/chat.ts"
click node_probe "https://github.com/mtecnic/code-atlas/blob/master/src/main/llm/probe.ts"
click node_summaries "https://github.com/mtecnic/code-atlas/blob/master/src/main/llm/summaries.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_analyzer,node_scanner,node_parser,node_resolver,node_git,node_symbols,node_state toneBlue
class node_main,node_ipc,node_preload,node_contract,node_model toneAmber
class node_app,node_scene,node_world,node_molecule,node_moleculedata,node_timeline,node_rendererstate,node_editor,node_search toneMint
class node_lenses,node_health,node_graphops toneRose
class node_llm,node_aitools,node_agent,node_chat,node_probe,node_summaries,node_user,node_repository,node_llmservice toneIndigo
```

## Components

### Repository analysis

- [Analysis coordinator](https://github.com/mtecnic/code-atlas/blob/master/src/main/analyzer/analyzer.ts): `src/main/analyzer/analyzer.ts`
- [Repository scanner](https://github.com/mtecnic/code-atlas/blob/master/src/main/analyzer/scanner.ts): `src/main/analyzer/scanner.ts`
- [Tree-sitter worker](https://github.com/mtecnic/code-atlas/blob/master/src/main/analyzer/parse-worker.ts): `src/main/analyzer/parse-worker.ts`
- [Import resolver](https://github.com/mtecnic/code-atlas/blob/master/src/main/analyzer/import-resolver.ts): `src/main/analyzer/import-resolver.ts`
- [Git history](https://github.com/mtecnic/code-atlas/blob/master/src/main/git/churn.ts): `src/main/git/churn.ts`
- [Symbol graph](https://github.com/mtecnic/code-atlas/blob/master/src/main/analyzer/symbol-graph.ts): `src/main/analyzer/symbol-graph.ts`
- [Analysis and settings store](https://github.com/mtecnic/code-atlas/blob/master/src/main/store.ts): `src/main/store.ts`

### Desktop bridge

- [Electron host](https://github.com/mtecnic/code-atlas/blob/master/src/main/index.ts): `src/main/index.ts`
- [IPC handlers](https://github.com/mtecnic/code-atlas/blob/master/src/main/ipc.ts): `src/main/ipc.ts`
- [Preload API](https://github.com/mtecnic/code-atlas/blob/master/src/preload/index.ts): `src/preload/index.ts`
- [IPC contract](https://github.com/mtecnic/code-atlas/blob/master/src/shared/ipc-contract.ts): `src/shared/ipc-contract.ts`
- [Shared data model](https://github.com/mtecnic/code-atlas/blob/master/src/shared/model.ts): `src/shared/model.ts`

### 3D exploration

- [Renderer application](https://github.com/mtecnic/code-atlas/blob/master/src/renderer/src/App.tsx): `src/renderer/src/App.tsx`
- [Scene manager](https://github.com/mtecnic/code-atlas/blob/master/src/renderer/src/scene/SceneManager.ts): `src/renderer/src/scene/SceneManager.ts`
- [City and galaxy](https://github.com/mtecnic/code-atlas/blob/master/src/renderer/src/scene/WorldLayer.ts): `src/renderer/src/scene/WorldLayer.ts`
- [Symbol molecule](https://github.com/mtecnic/code-atlas/blob/master/src/renderer/src/scene/MoleculeLayer.ts): `src/renderer/src/scene/MoleculeLayer.ts`
- [Molecule view state](https://github.com/mtecnic/code-atlas/blob/master/src/renderer/src/molecule.ts): `src/renderer/src/molecule.ts`
- [History playback](https://github.com/mtecnic/code-atlas/blob/master/src/renderer/src/scene/TimeMachine.ts): `src/renderer/src/scene/TimeMachine.ts`
- [Renderer state](https://github.com/mtecnic/code-atlas/blob/master/src/renderer/src/store.ts): `src/renderer/src/store.ts`
- [File editor](https://github.com/mtecnic/code-atlas/blob/master/src/renderer/src/ui/EditorPanel.tsx): `src/renderer/src/ui/EditorPanel.tsx`
- [File search](https://github.com/mtecnic/code-atlas/blob/master/src/renderer/src/ui/SearchPalette.tsx): `src/renderer/src/ui/SearchPalette.tsx`

### Code insights

- [Insight lenses](https://github.com/mtecnic/code-atlas/blob/master/src/renderer/src/lenses.ts): `src/renderer/src/lenses.ts`
- [Architecture health](https://github.com/mtecnic/code-atlas/blob/master/src/renderer/src/analysis/graph-health.ts): `src/renderer/src/analysis/graph-health.ts`
- [Dependency graph operations](https://github.com/mtecnic/code-atlas/blob/master/src/renderer/src/graphops.ts): `src/renderer/src/graphops.ts`

### AI assistance

- [LLM chat bridge](https://github.com/mtecnic/code-atlas/blob/master/src/renderer/src/llm.ts): `src/renderer/src/llm.ts`
- [Scene tool registry](https://github.com/mtecnic/code-atlas/blob/master/src/renderer/src/ai-tools/index.ts): `src/renderer/src/ai-tools/index.ts`
- [AI agent loop](https://github.com/mtecnic/code-atlas/blob/master/src/main/llm/agent-loop.ts): `src/main/llm/agent-loop.ts`
- [LLM chat service](https://github.com/mtecnic/code-atlas/blob/master/src/main/llm/chat.ts): `src/main/llm/chat.ts`
- [Endpoint detection](https://github.com/mtecnic/code-atlas/blob/master/src/main/llm/probe.ts): `src/main/llm/probe.ts`
- [Semantic summaries](https://github.com/mtecnic/code-atlas/blob/master/src/main/llm/summaries.ts): `src/main/llm/summaries.ts`

### Other components

- **Developer**
- **Repository folder**
- **Configured LLM endpoint**

## Connections

- Developer → Renderer application: opens app (evidence: `src/renderer/src/App.tsx`)
- Developer → Repository folder: chooses folder
- Renderer application → Preload API: requests analysis (evidence: `src/renderer/src/App.tsx`)
- Preload API → IPC handlers: invokes channels
- Electron host → IPC handlers: registers handlers (evidence: `src/main/index.ts`)
- IPC handlers → Analysis coordinator: starts analysis (evidence: `src/main/ipc.ts`)
- Analysis coordinator → Repository scanner: scans files (evidence: `src/main/analyzer/analyzer.ts`)
- Analysis coordinator → Tree-sitter worker: dispatches parsing (evidence: `src/main/analyzer/analyzer.ts`)
- Analysis coordinator → Import resolver: resolves imports (evidence: `src/main/analyzer/analyzer.ts`)
- Analysis coordinator → Git history: reads history (evidence: `src/main/analyzer/analyzer.ts`)
- Analysis coordinator → Analysis and settings store: updates analysis state (evidence: `src/main/analyzer/analyzer.ts`)
- Analysis and settings store → Symbol graph: builds symbol graph (evidence: `src/main/store.ts`)
- IPC handlers → Analysis and settings store: reads analysis state (evidence: `src/main/ipc.ts`)
- IPC handlers → Preload API: sends snapshots
- Preload API → Renderer application: delivers snapshot
- Renderer application → Scene manager: creates scene (evidence: `src/renderer/src/App.tsx`)
- Scene manager → City and galaxy: renders world (evidence: `src/renderer/src/scene/SceneManager.ts`)
- Scene manager → Symbol molecule: renders symbols (evidence: `src/renderer/src/scene/SceneManager.ts`)
- Scene manager → History playback: replays history (evidence: `src/renderer/src/scene/SceneManager.ts`)
- Scene manager → Renderer state: reacts to state (evidence: `src/renderer/src/scene/SceneManager.ts`)
- Scene manager → Insight lenses: applies lens (evidence: `src/renderer/src/scene/SceneManager.ts`)
- Molecule view state → Renderer state: updates molecule state (evidence: `src/renderer/src/molecule.ts`)
- Renderer application → File editor: shows editor (evidence: `src/renderer/src/App.tsx`)
- Renderer application → File search: shows search (evidence: `src/renderer/src/App.tsx`)
- Renderer application → Architecture health: shows findings (evidence: `src/renderer/src/App.tsx`)
- Renderer application → Dependency graph operations: exposes graph actions (evidence: `src/renderer/src/App.tsx`)
- File editor → Preload API: reads and writes files (evidence: `src/renderer/src/ui/EditorPanel.tsx`)
- Renderer application → LLM chat bridge: starts chat (evidence: `src/renderer/src/App.tsx`)
- LLM chat bridge → Scene tool registry: dispatches tool calls (evidence: `src/renderer/src/llm.ts`)
- LLM chat bridge → Preload API: streams chat requests (evidence: `src/renderer/src/llm.ts`)
- IPC handlers → LLM chat service: routes chat (evidence: `src/main/ipc.ts`)
- LLM chat service → AI agent loop: runs agent (evidence: `src/main/llm/chat.ts`)
- AI agent loop → Preload API: returns tool calls
- IPC handlers → Endpoint detection: probes endpoint (evidence: `src/main/ipc.ts`)
- IPC handlers → Semantic summaries: builds summaries (evidence: `src/main/ipc.ts`)
- LLM chat service → Configured LLM endpoint: sends requests (evidence: `src/main/llm/chat.ts`)
- Endpoint detection → Configured LLM endpoint: detects endpoint (evidence: `src/main/llm/probe.ts`)
- Semantic summaries → Configured LLM endpoint: generates summaries (evidence: `src/main/llm/summaries.ts`)
