# lkarlslund/koder architecture

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

- Interactive diagram: https://gitdiagram.com/lkarlslund/koder
- Repository: https://github.com/lkarlslund/koder
- Video tour (about a minute): https://gitdiagram.com/lkarlslund/koder/video

## Overview

Koder is a local-first coding and computer-use agent. A user works through the browser workspace: the web server routes session and chat actions to the app controller and agent; the agent conducts model-backed turns and invokes approved tools, whose results return to the chat. Sessions also support planning and persistent memory. Major side capabilities include shared Chrome automation, MCP extensions, and Android voice calls. The README documents the broad workflow; sampled source excerpts confirm selected storage, controller, browser, MCP, execution, and Android-service details, so uncertain internal wiring is omitted.

Main entry points: [`internal/toolruntime/runtime.go`](https://github.com/lkarlslund/koder/blob/main/internal/toolruntime/runtime.go) (Tool Runtime), [`internal/webui/server.go`](https://github.com/lkarlslund/koder/blob/main/internal/webui/server.go) (Browser UI), [`internal/app/controller.go`](https://github.com/lkarlslund/koder/blob/main/internal/app/controller.go) (App Controller), [`internal/agent/agent.go`](https://github.com/lkarlslund/koder/blob/main/internal/agent/agent.go) (Agent Engine)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interaction["Workspace"]
  node_browser_ui["Browser UI<br/>[server.go]"]
  node_controller["App Controller<br/>[controller.go]"]
  node_android["Android Voice"]
end

subgraph group_agent["Agent Runtime"]
  node_agent["Agent Engine<br/>[agent.go]"]
  node_chat["Chat Turns<br/>[model_loop.go]"]
  node_model_runtime["Model Runtime<br/>[runtime.go]"]
end

subgraph group_capabilities["Agent Capabilities"]
  node_tools["Tool Runtime<br/>[runtime.go]"]
  node_repo_tools["Repository Tools<br/>[all.go]"]
  node_execution["Command Execution<br/>[manager.go]"]
  node_planning["Planning Board<br/>[planning.go]"]
  node_memory["Persistent Memory<br/>[service.go]"]
end

subgraph group_state["Session State"]
  node_session["Sessions and Chats<br/>[session.go]"]
  node_store[("Local Persistence<br/>[store.go]")]
  node_workspace["Workspace State<br/>[status.go]"]
end

subgraph group_integrations["Integrations"]
  node_browser_automation["Chrome Automation<br/>[manager.go]"]
  node_mcp["MCP Extensions<br/>[manager.go]"]
  node_voice["Voice Service<br/>[coordinator.go]"]
end

node_user(("User"))
node_provider{{"Model Provider"}}
node_chrome{{"Chrome"}}
node_mcp_servers{{"MCP Servers"}}

node_user -->|"interacts"| node_browser_ui
node_browser_ui -->|"routes actions"| node_controller
node_controller -->|"starts turns"| node_agent
node_agent -->|"manages chats"| node_chat
node_chat -->|"prepares requests"| node_model_runtime
node_model_runtime -->|"sends prompts"| node_provider
node_provider -->|"streams responses"| node_model_runtime
node_agent -->|"dispatches tools"| node_tools
node_tools -->|"provides tools"| node_repo_tools
node_repo_tools -->|"runs commands"| node_execution
node_controller -->|"manages sessions"| node_session
node_session -->|"persists records"| node_store
node_tools -->|"updates plans"| node_planning
node_tools -->|"uses memory"| node_memory
node_browser_ui -->|"shows repository state"| node_workspace
node_tools -.->|"invokes browser"| node_browser_automation
node_browser_automation -.->|"controls browser"| node_chrome
node_tools -.->|"invokes extensions"| node_mcp
node_mcp -.->|"connects tools"| node_mcp_servers
node_android -.->|"streams audio"| node_voice
node_voice -.->|"uses voice models"| node_provider

click node_browser_ui "https://github.com/lkarlslund/koder/blob/main/internal/webui/server.go"
click node_controller "https://github.com/lkarlslund/koder/blob/main/internal/app/controller.go"
click node_android "https://github.com/lkarlslund/koder/blob/main/clients/android/app/src/main/kotlin/com/lkarlslund/koder/voice/VoiceCallService.kt"
click node_agent "https://github.com/lkarlslund/koder/blob/main/internal/agent/agent.go"
click node_chat "https://github.com/lkarlslund/koder/blob/main/internal/chat/model_loop.go"
click node_model_runtime "https://github.com/lkarlslund/koder/blob/main/internal/modelruntime/runtime.go"
click node_tools "https://github.com/lkarlslund/koder/blob/main/internal/toolruntime/runtime.go"
click node_repo_tools "https://github.com/lkarlslund/koder/blob/main/internal/tools/all/all.go"
click node_execution "https://github.com/lkarlslund/koder/blob/main/internal/execruntime/manager.go"
click node_planning "https://github.com/lkarlslund/koder/blob/main/internal/planning/planning.go"
click node_memory "https://github.com/lkarlslund/koder/blob/main/internal/memory/service/service.go"
click node_session "https://github.com/lkarlslund/koder/blob/main/internal/session/session.go"
click node_store "https://github.com/lkarlslund/koder/blob/main/internal/store/store.go"
click node_workspace "https://github.com/lkarlslund/koder/blob/main/internal/workspace/status.go"
click node_browser_automation "https://github.com/lkarlslund/koder/blob/main/internal/browser/manager.go"
click node_mcp "https://github.com/lkarlslund/koder/blob/main/internal/mcp/manager.go"
click node_voice "https://github.com/lkarlslund/koder/blob/main/internal/voice/coordinator.go"

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_browser_ui,node_controller,node_android,node_user toneBlue
class node_agent,node_chat,node_model_runtime toneAmber
class node_tools,node_repo_tools,node_execution,node_planning,node_memory,node_mcp_servers toneMint
class node_session,node_store,node_workspace toneRose
class node_browser_automation,node_mcp,node_voice,node_provider,node_chrome toneIndigo
```

## Components

### Workspace

- [Browser UI](https://github.com/lkarlslund/koder/blob/main/internal/webui/server.go): `internal/webui/server.go`
- [App Controller](https://github.com/lkarlslund/koder/blob/main/internal/app/controller.go): `internal/app/controller.go`
- [Android Voice](https://github.com/lkarlslund/koder/blob/main/clients/android/app/src/main/kotlin/com/lkarlslund/koder/voice/VoiceCallService.kt): `clients/android/app/src/main/kotlin/com/lkarlslund/koder/voice/VoiceCallService.kt`

### Agent Runtime

- [Agent Engine](https://github.com/lkarlslund/koder/blob/main/internal/agent/agent.go): `internal/agent/agent.go`
- [Chat Turns](https://github.com/lkarlslund/koder/blob/main/internal/chat/model_loop.go): `internal/chat/model_loop.go`
- [Model Runtime](https://github.com/lkarlslund/koder/blob/main/internal/modelruntime/runtime.go): `internal/modelruntime/runtime.go`

### Agent Capabilities

- [Tool Runtime](https://github.com/lkarlslund/koder/blob/main/internal/toolruntime/runtime.go): `internal/toolruntime/runtime.go`
- [Repository Tools](https://github.com/lkarlslund/koder/blob/main/internal/tools/all/all.go): `internal/tools/all/all.go`
- [Command Execution](https://github.com/lkarlslund/koder/blob/main/internal/execruntime/manager.go): `internal/execruntime/manager.go`
- [Planning Board](https://github.com/lkarlslund/koder/blob/main/internal/planning/planning.go): `internal/planning/planning.go`
- [Persistent Memory](https://github.com/lkarlslund/koder/blob/main/internal/memory/service/service.go): `internal/memory/service/service.go`

### Session State

- [Sessions and Chats](https://github.com/lkarlslund/koder/blob/main/internal/session/session.go): `internal/session/session.go`
- [Local Persistence](https://github.com/lkarlslund/koder/blob/main/internal/store/store.go): `internal/store/store.go`
- [Workspace State](https://github.com/lkarlslund/koder/blob/main/internal/workspace/status.go): `internal/workspace/status.go`

### Integrations

- [Chrome Automation](https://github.com/lkarlslund/koder/blob/main/internal/browser/manager.go): `internal/browser/manager.go`
- [MCP Extensions](https://github.com/lkarlslund/koder/blob/main/internal/mcp/manager.go): `internal/mcp/manager.go`
- [Voice Service](https://github.com/lkarlslund/koder/blob/main/internal/voice/coordinator.go): `internal/voice/coordinator.go`

### Other components

- **User**
- **Model Provider**
- **Chrome**
- **MCP Servers**

## Connections

- User → Browser UI: interacts
- Browser UI → App Controller: routes actions
- App Controller → Agent Engine: starts turns
- Agent Engine → Chat Turns: manages chats
- Chat Turns → Model Runtime: prepares requests
- Model Runtime → Model Provider: sends prompts
- Model Provider → Model Runtime: streams responses
- Agent Engine → Tool Runtime: dispatches tools
- Tool Runtime → Repository Tools: provides tools
- Repository Tools → Command Execution: runs commands
- App Controller → Sessions and Chats: manages sessions
- Sessions and Chats → Local Persistence: persists records
- Tool Runtime → Planning Board: updates plans
- Tool Runtime → Persistent Memory: uses memory
- Browser UI → Workspace State: shows repository state
- Tool Runtime → Chrome Automation: invokes browser
- Chrome Automation → Chrome: controls browser
- Tool Runtime → MCP Extensions: invokes extensions
- MCP Extensions → MCP Servers: connects tools
- Android Voice → Voice Service: streams audio
- Voice Service → Model Provider: uses voice models
