Files
zesdex/docs/CODEMAPS/architecture.md
T
asepharyana a00aa9bec8 Refactor view modules for improved readability and consistency
- Updated markdown rendering logic to use more concise methods for obtaining vector lengths.
- Changed review status display to use the correct flag from settings.
- Cleaned up sidebar rendering code for better formatting and readability.
- Enhanced status bar rendering with improved string formatting and consistent style application.
- Refined workflow panel rendering, ensuring consistent style usage and improved readability.
- Added architecture overview and detailed documentation for backend, data, dependencies, and frontend structures.
2026-07-16 07:56:11 +07:00

4.3 KiB

Architecture Overview

System Layout

Zesdex is an autonomous AI coding agent with a TUI — an LLM client wrapped in a tool-use harness with 37 built-in tools.

┌─────────────────────────────────────────────────────────────┐
│                       Process Mode                           │
│  Single-Process ─── Daemon (background) ─── Attach (client) │
└──────────────────────────┬──────────────────────────────────┘
                           │ IPC (Unix domain socket)
                           ▼
┌─────────────────────────────────────────────────────────────┐
│  src/main.rs                                                │
│  ┌──────────────┐   ┌──────────────┐   ┌────────────────┐  │
│  │  Controller   │──▶│   Runtime    │──▶│     View       │  │
│  │  (input.rs)   │   │ (actions.rs) │   │ (chat,status,…)│  │
│  └──────────────┘   └──────┬───────┘   └────────────────┘  │
│                            │                                 │
│                    ┌───────▼────────┐                       │
│                    │    Harness     │                        │
│                    │  (tool dispatch)│                       │
│                    └───────┬────────┘                       │
│                            │                                 │
│          ┌─────────────────┼─────────────────┐              │
│          ▼                 ▼                  ▼              │
│     ┌─────────┐    ┌────────────┐    ┌───────────────┐      │
│     │  Tools  │    │ Subagents  │    │  Workflow     │      │
│     │ (37x)   │    │ (auto/gen) │    │  Engine       │      │
│     └─────────┘    └────────────┘    │  (hive_mind)  │      │
│                                      └───────────────┘      │
└─────────────────────────────────────────────────────────────┘

Process Modes

Mode Description
Single-process TUI + agent run in the same process. Simplest mode.
Daemon --daemon flag. Agent processes state in background; clients attach to render.
Attach --attach <id> flag. Connect to existing daemon with IPC.

In daemon mode, the daemon runs the full agent loop; clients are stateless renderers that sync via Unix domain sockets with diff-based state synchronization.

Data Flow

  1. Inputcontroller/input.rs handles key events and autocomplete
  2. Dispatchapp/runtime/actions/mod.rs applies actions to state (AppStateRest)
  3. LLM Streamapp/runtime/stream/mod.rs parses SSE chunks into typed events
  4. Tool Executionapp/harness.rs gates and runs tool calls via the Tool trait
  5. Renderingview/ modules read AppStateRest and render via ratatui

Key Files

File Purpose
src/main.rs Entry point, process mode dispatch, TUI init
src/app/state/rest.rs Single source-of-truth state struct
src/app/runtime/actions/mod.rs State reducer (apply_action)
src/app/runtime/stream/mod.rs SSE stream parser
src/app/harness.rs Tool harness with safety gating
src/app/workflow/hive_mind.rs Multi-agent orchestration
src/tool/mod.rs Tool trait + registry (37 tools)
src/view/mod.rs TUI render pipeline