# threenebula23/lorne architecture

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

- Interactive diagram: https://gitdiagram.com/threenebula23/lorne
- Repository: https://github.com/threenebula23/lorne

## Overview

Lorne is a vi-like terminal IDE with an AI coding agent. Users enter through the TUI or classic CLI, choose a mode, and send a request that the agent handles with model calls and tools; results stream back into the interface. Major branches include parallel Creator and checkpointed Deep work, project indexing and RAG, and persistent sessions and file version history. Edges follow explicit README statements or source-index references; several subsystems are documented but their internal call paths were not sampled, so those links are omitted.

Main entry points: [`Agent/agent/_impl_classic.py`](https://github.com/threenebula23/lorne/blob/main/Agent/agent/_impl_classic.py) (Classic agent), [`Agent/agent/_impl_prepare.py`](https://github.com/threenebula23/lorne/blob/main/Agent/agent/_impl_prepare.py) (Agent preparation), [`Agent/tool_registry.py`](https://github.com/threenebula23/lorne/blob/main/Agent/tool_registry.py) (Tool registry), [`Terminal/runner.py`](https://github.com/threenebula23/lorne/blob/main/Terminal/runner.py) (CLI launcher)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["Entry and interaction"]
  node_terminal["CLI launcher<br/>[runner.py]"]
  node_classic["Classic agent<br/>[_impl_classic.py]"]
  node_tui["TUI application<br/>[tui_app.py]"]
  node_tui_bridge["TUI bridge<br/>[tui_bridge.py]"]
  node_chat_ui["Streaming chat panel<br/>[_mixin_stream.py]"]
  node_editor["Vi editor<br/>[vi_textarea.py]"]
end

subgraph group_agent["Agent and execution"]
  node_runtime["Agent preparation<br/>[_impl_prepare.py]"]
  node_router["Command router<br/>[_main.py]"]
  node_llm["Model provider<br/>[llm_provider.py]"]
  node_registry["Tool registry<br/>[tool_registry.py]"]
  node_tool_impl["Core tools<br/>[compact_tools.py]"]
  node_creator["Creator workers"]
  node_deep["Deep solver<br/>[_impl_a.py]"]
end

subgraph group_knowledge["Project knowledge"]
  node_brain["Project Brain"]
  node_brain_policy["Brain policy<br/>[policy.py]"]
  node_rag["RAG index<br/>[__init__.py]"]
end

subgraph group_state["Sessions and history"]
  node_session[("Session checkpoints<br/>[__init__.py]")]
  node_versions[("File versions<br/>[__init__.py]")]
end

subgraph group_workspace["Workspace capabilities"]
  node_filesystem[("Project files")]
  node_git["Git integration<br/>[git_integration.py]"]
end

node_user(("User"))
node_models{{"Model services"}}

node_user -->|"launches"| node_terminal
node_terminal -->|"starts"| node_classic
node_terminal -->|"starts"| node_tui
node_user -->|"interacts"| node_tui
node_tui -->|"bridges chat"| node_tui_bridge
node_tui_bridge -->|"streams updates"| node_chat_ui
node_user -->|"edits in"| node_editor
node_classic -->|"prepares agent"| node_runtime
node_classic -->|"routes commands"| node_router
node_runtime -->|"configures"| node_llm
node_runtime -->|"builds tools"| node_registry
node_llm -->|"calls"| node_models
node_registry -->|"registers tools"| node_tool_impl
node_runtime -->|"sets up Creator"| node_creator
node_deep -->|"uses provider"| node_llm
node_deep -->|"uses tools"| node_registry
node_runtime -->|"loads brain context"| node_brain
node_brain -->|"applies policy"| node_brain_policy
node_brain -->|"reindexes brain"| node_rag
node_classic -->|"searches project"| node_rag
node_classic -->|"saves sessions"| node_session
node_session -->|"snapshots workspace"| node_versions
node_registry -->|"operates on files"| node_filesystem
node_registry -->|"offers Git tools"| node_git
node_user -->|"selects chats"| node_session

click node_terminal "https://github.com/threenebula23/lorne/blob/main/Terminal/runner.py"
click node_classic "https://github.com/threenebula23/lorne/blob/main/Agent/agent/_impl_classic.py"
click node_tui "https://github.com/threenebula23/lorne/blob/main/Interface/tui_app.py"
click node_tui_bridge "https://github.com/threenebula23/lorne/blob/main/Interface/tui_bridge.py"
click node_chat_ui "https://github.com/threenebula23/lorne/blob/main/Interface/panels/ai_chat/_mixin_stream.py"
click node_editor "https://github.com/threenebula23/lorne/blob/main/Interface/panels/vi_textarea.py"
click node_runtime "https://github.com/threenebula23/lorne/blob/main/Agent/agent/_impl_prepare.py"
click node_router "https://github.com/threenebula23/lorne/blob/main/Agent/command_router/_main.py"
click node_llm "https://github.com/threenebula23/lorne/blob/main/Agent/llm_provider.py"
click node_registry "https://github.com/threenebula23/lorne/blob/main/Agent/tool_registry.py"
click node_tool_impl "https://github.com/threenebula23/lorne/blob/main/Agent/tools/compact_tools.py"
click node_creator "https://github.com/threenebula23/lorne/blob/main/Agent/creator_provider.py"
click node_deep "https://github.com/threenebula23/lorne/blob/main/Agent/deep_solver/_impl_a.py"
click node_brain "https://github.com/threenebula23/lorne/blob/main/Agent/project_brain/agent_architecture.py"
click node_brain_policy "https://github.com/threenebula23/lorne/blob/main/Agent/project_brain/policy.py"
click node_rag "https://github.com/threenebula23/lorne/blob/main/Agent/rag/__init__.py"
click node_session "https://github.com/threenebula23/lorne/blob/main/Agent/checkpoint/__init__.py"
click node_versions "https://github.com/threenebula23/lorne/blob/main/Agent/versioning/__init__.py"
click node_git "https://github.com/threenebula23/lorne/blob/main/Agent/git_integration.py"

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_terminal,node_classic,node_tui,node_tui_bridge,node_chat_ui,node_editor,node_user toneBlue
class node_runtime,node_router,node_llm,node_registry,node_tool_impl,node_creator,node_deep toneAmber
class node_brain,node_brain_policy,node_rag toneMint
class node_session,node_versions toneRose
class node_filesystem,node_git,node_models toneIndigo
```

## Components

### Entry and interaction

- [CLI launcher](https://github.com/threenebula23/lorne/blob/main/Terminal/runner.py): `Terminal/runner.py`
- [Classic agent](https://github.com/threenebula23/lorne/blob/main/Agent/agent/_impl_classic.py): `Agent/agent/_impl_classic.py`
- [TUI application](https://github.com/threenebula23/lorne/blob/main/Interface/tui_app.py): `Interface/tui_app.py`
- [TUI bridge](https://github.com/threenebula23/lorne/blob/main/Interface/tui_bridge.py): `Interface/tui_bridge.py`
- [Streaming chat panel](https://github.com/threenebula23/lorne/blob/main/Interface/panels/ai_chat/_mixin_stream.py): `Interface/panels/ai_chat/_mixin_stream.py`
- [Vi editor](https://github.com/threenebula23/lorne/blob/main/Interface/panels/vi_textarea.py): `Interface/panels/vi_textarea.py`

### Agent and execution

- [Agent preparation](https://github.com/threenebula23/lorne/blob/main/Agent/agent/_impl_prepare.py): `Agent/agent/_impl_prepare.py`
- [Command router](https://github.com/threenebula23/lorne/blob/main/Agent/command_router/_main.py): `Agent/command_router/_main.py`
- [Model provider](https://github.com/threenebula23/lorne/blob/main/Agent/llm_provider.py): `Agent/llm_provider.py`
- [Tool registry](https://github.com/threenebula23/lorne/blob/main/Agent/tool_registry.py): `Agent/tool_registry.py`
- [Core tools](https://github.com/threenebula23/lorne/blob/main/Agent/tools/compact_tools.py): `Agent/tools/compact_tools.py`
- [Creator workers](https://github.com/threenebula23/lorne/blob/main/Agent/creator_provider.py): `Agent/creator_provider.py`
- [Deep solver](https://github.com/threenebula23/lorne/blob/main/Agent/deep_solver/_impl_a.py): `Agent/deep_solver/_impl_a.py`

### Project knowledge

- [Project Brain](https://github.com/threenebula23/lorne/blob/main/Agent/project_brain/agent_architecture.py): `Agent/project_brain/agent_architecture.py`
- [Brain policy](https://github.com/threenebula23/lorne/blob/main/Agent/project_brain/policy.py): `Agent/project_brain/policy.py`
- [RAG index](https://github.com/threenebula23/lorne/blob/main/Agent/rag/__init__.py): `Agent/rag/__init__.py`

### Sessions and history

- [Session checkpoints](https://github.com/threenebula23/lorne/blob/main/Agent/checkpoint/__init__.py): `Agent/checkpoint/__init__.py`
- [File versions](https://github.com/threenebula23/lorne/blob/main/Agent/versioning/__init__.py): `Agent/versioning/__init__.py`

### Workspace capabilities

- **Project files**
- [Git integration](https://github.com/threenebula23/lorne/blob/main/Agent/git_integration.py): `Agent/git_integration.py`

### Other components

- **User**
- **Model services**

## Connections

- User → CLI launcher: launches (evidence: `README.md`)
- CLI launcher → Classic agent: starts (evidence: `README.md`)
- CLI launcher → TUI application: starts (evidence: `README.md`)
- User → TUI application: interacts (evidence: `README.md`)
- TUI application → TUI bridge: bridges chat (evidence: `Interface/tui_bridge.py`)
- TUI bridge → Streaming chat panel: streams updates (evidence: `Interface/tui_bridge.py`)
- User → Vi editor: edits in (evidence: `README.md`)
- Classic agent → Agent preparation: prepares agent (evidence: `Agent/agent/_impl_classic.py`)
- Classic agent → Command router: routes commands (evidence: `Agent/agent/_impl_classic.py`)
- Agent preparation → Model provider: configures (evidence: `Agent/agent/_impl_prepare.py`)
- Agent preparation → Tool registry: builds tools (evidence: `Agent/agent/_impl_prepare.py`)
- Model provider → Model services: calls (evidence: `README.md`)
- Tool registry → Core tools: registers tools (evidence: `Agent/tool_registry.py`)
- Agent preparation → Creator workers: sets up Creator (evidence: `Agent/agent/_impl_prepare.py`)
- Deep solver → Model provider: uses provider (evidence: `Agent/deep_solver/_impl_a.py`)
- Deep solver → Tool registry: uses tools (evidence: `Agent/deep_solver/_impl_a.py`)
- Agent preparation → Project Brain: loads brain context (evidence: `Agent/agent/_impl_prepare.py`)
- Project Brain → Brain policy: applies policy (evidence: `Agent/project_brain/__init__.py`)
- Project Brain → RAG index: reindexes brain (evidence: `Agent/project_brain/agent_architecture.py`)
- Classic agent → RAG index: searches project (evidence: `Agent/agent/_impl_classic.py`)
- Classic agent → Session checkpoints: saves sessions (evidence: `README.md`)
- Session checkpoints → File versions: snapshots workspace (evidence: `Agent/checkpoint/__init__.py`)
- Tool registry → Project files: operates on files (evidence: `README.md`)
- Tool registry → Git integration: offers Git tools (evidence: `Agent/tool_registry.py`)
- User → Session checkpoints: selects chats (evidence: `README.md`)
