# redhuang-0622/seelex architecture

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

- Interactive diagram: https://gitdiagram.com/redhuang-0622/seelex
- Repository: https://github.com/redhuang-0622/seelex

## Overview

Seelex is a local coding-agent harness built around a shared application core and Seele runtime. A user submits a coding task through a frontend; the core coordinates model turns, project-scoped tools, optional plans and subagents, context management, approvals, and durable session state, then presents the resulting conversation and status. The README documents the principal capability relationships; sampled source confirms selected application/runtime and context/storage boundaries. Several subsystem implementations were not sampled, so their links below rely on README statements rather than inspected call sites.

Main entry points: [`seelebridge/runtime.go`](https://github.com/redhuang-0622/seelex/blob/main/seelebridge/runtime.go) (Seele runtime), [`application/application.go`](https://github.com/redhuang-0622/seelex/blob/main/application/application.go) (Application core), [`seelebridge/tools/router.go`](https://github.com/redhuang-0622/seelex/blob/main/seelebridge/tools/router.go) (Tool routing), [`tui/tui.go`](https://github.com/redhuang-0622/seelex/blob/main/tui/tui.go) (TUI)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interaction["User interaction"]
  node_tui["TUI<br/>[tui.go]"]
  node_gui["Desktop GUI<br/>[bridge.go]"]
  node_headless["Headless RPC<br/>[headless.go]"]
  node_backend["Backend console<br/>[backend_console.go]"]
end

subgraph group_execution["Agent execution"]
  node_app["Application core<br/>[application.go]"]
  node_adapter["Runtime adapter<br/>[engine_port.go]"]
  node_runtime["Seele runtime<br/>[runtime.go]"]
  node_approval["Approval broker<br/>[broker.go]"]
end

subgraph group_work["Task capabilities"]
  node_tools["Tool routing<br/>[router.go]"]
  node_workspace["Workspace operations<br/>[workspace.go]"]
  node_planning["Plans and subagents<br/>[executor.go]"]
  node_teamwork["Agent teamwork<br/>[coordinator.go]"]
  node_goals["Goal governance<br/>[controller.go]"]
end

subgraph group_context_state["Context and state"]
  node_context["Context pipeline<br/>[runtime_context.go]"]
  node_history[("Session persistence<br/>[sessionstore.go]")]
end

subgraph group_extensions["Integrations"]
  node_extensions["Plugins, skills, MCP<br/>[manager.go]"]
  node_accounts["Account routing<br/>[manager.go]"]
  node_scheduler["Scheduled jobs<br/>[scheduler.go]"]
  node_search["Search and computer<br/>[builtin.go]"]
end

node_user(("Engineer"))
node_model_service{{"LLM endpoint"}}

node_user -->|"submits task"| node_tui
node_user -->|"submits task"| node_gui
node_user -->|"submits action"| node_headless
node_user -->|"requests diagnostics"| node_backend
node_tui -->|"submits actions"| node_app
node_gui -->|"submits actions"| node_app
node_headless -->|"submits actions"| node_app
node_backend -->|"reads state"| node_app
node_app -->|"uses engine port"| node_adapter
node_adapter -->|"adapts runtime"| node_runtime
node_runtime -->|"streams requests"| node_model_service
node_runtime -->|"routes model account"| node_accounts
node_runtime -->|"dispatches calls"| node_tools
node_tools -->|"performs project I/O"| node_workspace
node_tools -->|"requests approval"| node_approval
node_runtime -->|"executes optional plan"| node_planning
node_planning -.->|"coordinates agents"| node_teamwork
node_runtime -->|"governs completion"| node_goals
node_runtime -->|"assembles context"| node_context
node_context -->|"reads and writes"| node_history
node_runtime -->|"persists sessions"| node_history
node_runtime -->|"loads capabilities"| node_extensions
node_runtime -->|"dispatches scheduled work"| node_scheduler
node_tools -.->|"offers search tools"| node_search
node_app -->|"publishes state"| node_tui
node_app -->|"publishes state"| node_gui

click node_tui "https://github.com/redhuang-0622/seelex/blob/main/tui/tui.go"
click node_gui "https://github.com/redhuang-0622/seelex/blob/main/gui/bridge.go"
click node_headless "https://github.com/redhuang-0622/seelex/blob/main/gui/headless.go"
click node_backend "https://github.com/redhuang-0622/seelex/blob/main/application/console/backend_console.go"
click node_app "https://github.com/redhuang-0622/seelex/blob/main/application/application.go"
click node_adapter "https://github.com/redhuang-0622/seelex/blob/main/internal/adapters/engine_port.go"
click node_runtime "https://github.com/redhuang-0622/seelex/blob/main/seelebridge/runtime.go"
click node_tools "https://github.com/redhuang-0622/seelex/blob/main/seelebridge/tools/router.go"
click node_workspace "https://github.com/redhuang-0622/seelex/blob/main/workspace/workspace.go"
click node_planning "https://github.com/redhuang-0622/seelex/blob/main/seelebridge/plan/executor.go"
click node_teamwork "https://github.com/redhuang-0622/seelex/blob/main/seelebridge/teamwork/coordinator.go"
click node_goals "https://github.com/redhuang-0622/seelex/blob/main/application/core/goal/controller.go"
click node_context "https://github.com/redhuang-0622/seelex/blob/main/seelebridge/runtime_context.go"
click node_history "https://github.com/redhuang-0622/seelex/blob/main/sessionstore/sessionstore.go"
click node_approval "https://github.com/redhuang-0622/seelex/blob/main/application/approval/broker.go"
click node_extensions "https://github.com/redhuang-0622/seelex/blob/main/plugin/manager.go"
click node_accounts "https://github.com/redhuang-0622/seelex/blob/main/seelebridge/account/manager.go"
click node_scheduler "https://github.com/redhuang-0622/seelex/blob/main/seelebridge/scheduler/scheduler.go"
click node_search "https://github.com/redhuang-0622/seelex/blob/main/seelebridge/search/builtin.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_tui,node_gui,node_headless,node_backend toneBlue
class node_app,node_adapter,node_runtime,node_approval toneAmber
class node_tools,node_workspace,node_planning,node_teamwork,node_goals toneMint
class node_context,node_history toneRose
class node_extensions,node_accounts,node_scheduler,node_search,node_user,node_model_service toneIndigo
```

## Components

### User interaction

- [TUI](https://github.com/redhuang-0622/seelex/blob/main/tui/tui.go): `tui/tui.go`
- [Desktop GUI](https://github.com/redhuang-0622/seelex/blob/main/gui/bridge.go): `gui/bridge.go`
- [Headless RPC](https://github.com/redhuang-0622/seelex/blob/main/gui/headless.go): `gui/headless.go`
- [Backend console](https://github.com/redhuang-0622/seelex/blob/main/application/console/backend_console.go): `application/console/backend_console.go`

### Agent execution

- [Application core](https://github.com/redhuang-0622/seelex/blob/main/application/application.go): `application/application.go`
- [Runtime adapter](https://github.com/redhuang-0622/seelex/blob/main/internal/adapters/engine_port.go): `internal/adapters/engine_port.go`
- [Seele runtime](https://github.com/redhuang-0622/seelex/blob/main/seelebridge/runtime.go): `seelebridge/runtime.go`
- [Approval broker](https://github.com/redhuang-0622/seelex/blob/main/application/approval/broker.go): `application/approval/broker.go`

### Task capabilities

- [Tool routing](https://github.com/redhuang-0622/seelex/blob/main/seelebridge/tools/router.go): `seelebridge/tools/router.go`
- [Workspace operations](https://github.com/redhuang-0622/seelex/blob/main/workspace/workspace.go): `workspace/workspace.go`
- [Plans and subagents](https://github.com/redhuang-0622/seelex/blob/main/seelebridge/plan/executor.go): `seelebridge/plan/executor.go`
- [Agent teamwork](https://github.com/redhuang-0622/seelex/blob/main/seelebridge/teamwork/coordinator.go): `seelebridge/teamwork/coordinator.go`
- [Goal governance](https://github.com/redhuang-0622/seelex/blob/main/application/core/goal/controller.go): `application/core/goal/controller.go`

### Context and state

- [Context pipeline](https://github.com/redhuang-0622/seelex/blob/main/seelebridge/runtime_context.go): `seelebridge/runtime_context.go`
- [Session persistence](https://github.com/redhuang-0622/seelex/blob/main/sessionstore/sessionstore.go): `sessionstore/sessionstore.go`

### Integrations

- [Plugins, skills, MCP](https://github.com/redhuang-0622/seelex/blob/main/plugin/manager.go): `plugin/manager.go`
- [Account routing](https://github.com/redhuang-0622/seelex/blob/main/seelebridge/account/manager.go): `seelebridge/account/manager.go`
- [Scheduled jobs](https://github.com/redhuang-0622/seelex/blob/main/seelebridge/scheduler/scheduler.go): `seelebridge/scheduler/scheduler.go`
- [Search and computer](https://github.com/redhuang-0622/seelex/blob/main/seelebridge/search/builtin.go): `seelebridge/search/builtin.go`

### Other components

- **Engineer**
- **LLM endpoint**

## Connections

- Engineer → TUI: submits task (evidence: `README.md`)
- Engineer → Desktop GUI: submits task (evidence: `README.md`)
- Engineer → Headless RPC: submits action (evidence: `README.md`)
- Engineer → Backend console: requests diagnostics (evidence: `README.md`)
- TUI → Application core: submits actions (evidence: `README.md`)
- Desktop GUI → Application core: submits actions
- Headless RPC → Application core: submits actions (evidence: `README.md`)
- Backend console → Application core: reads state (evidence: `README.md`)
- Application core → Runtime adapter: uses engine port (evidence: `application/application.go`)
- Runtime adapter → Seele runtime: adapts runtime (evidence: `internal/adapters/engine_port.go`)
- Seele runtime → LLM endpoint: streams requests (evidence: `README.md`)
- Seele runtime → Account routing: routes model account (evidence: `README.md`)
- Seele runtime → Tool routing: dispatches calls (evidence: `README.md`)
- Tool routing → Workspace operations: performs project I/O (evidence: `README.md`)
- Tool routing → Approval broker: requests approval
- Seele runtime → Plans and subagents: executes optional plan (evidence: `README.md`)
- Plans and subagents → Agent teamwork: coordinates agents
- Seele runtime → Goal governance: governs completion (evidence: `README.md`)
- Seele runtime → Context pipeline: assembles context (evidence: `seelebridge/runtime_context.go`)
- Context pipeline → Session persistence: reads and writes (evidence: `seelebridge/runtime_context.go`)
- Seele runtime → Session persistence: persists sessions
- Seele runtime → Plugins, skills, MCP: loads capabilities (evidence: `README.md`)
- Seele runtime → Scheduled jobs: dispatches scheduled work (evidence: `README.md`)
- Tool routing → Search and computer: offers search tools
- Application core → TUI: publishes state (evidence: `README.md`)
- Application core → Desktop GUI: publishes state (evidence: `README.md`)
