Book is a modular, strictly layered system following Clean Architecture principles. Core logic stays independent of external frameworks β€” LLM providers, terminal rendering libraries, all of it.

This page is the architecture hub. The detail lives in two pages:

  • Architecture Overview β€” :domain core abstractions, logging architecture, design philosophies, key dependencies

  • Module Map β€” per-package breakdown of :infrastructure, :core:providers:koog, :features:mcp, :features:acp, and :cli; architecture diagram catalogue

The Six Modules

Module Ring Summary

:domain

Innermost

Core abstractions and business logic: Agent, AgentLoop, Tool, guards, compaction, events. Zero framework imports.

:infrastructure

Middle

Implements :domain interfaces with real tech: script loading, sandboxed filesystem, session persistence, config.

:core:providers:koog

Outer adapter

LLM integration via the Koog framework: KoogAgent, streaming, retry, model listing.

:core:providers:litertlm

Outer adapter

On-device LLM integration via LiteRT-LM SDK: LitertLmAgent, eager warmup, real-time delta streaming.

:features:mcp

Outer adapter

Self-contained MCP client. Public surface: McpClientFacade only.

:features:acp

Outer adapter

ACP server for IDE integration. Per-session isolation, capability-driven environment.

:cli

Outermost

Clikt commands, TUI, DI graph (AppGraph), process entry.

Dependency direction: :cli β†’ features/providers β†’ :infrastructure β†’ :domain. Nothing in an inner ring imports from an outer ring.

Where to go next

If you want to… Read

Understand the domain abstractions & design rules

Architecture Overview

Work on a specific module’s packages

Module Map

Understand the agent execution loop in depth

Agent Loop

Modify LLM integration / add a provider

Koog Provider Layer

Trace the Metro DI graph

DI & Wiring

Browse diagrams

Diagram catalogue