Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Architecture Overview

┌─────────────────────────────────────────────────────┐
│                    kerux-cli                         │
│  TUI (ratatui) │ serve (gateway) │ autonomous mode  │
└────────────────────────┬────────────────────────────┘
                         │
┌────────────────────────▼────────────────────────────┐
│                   kerux-core                         │
│                                                      │
│  ┌──────────┐  ┌──────────┐  ┌───────────────────┐  │
│  │  Agent   │  │  Client  │  │      Gateway      │  │
│  │  (ReAct) │  │  (LLM)   │  │ Telegram│WhatsApp │  │
│  └────┬─────┘  └──────────┘  └───────────────────┘  │
│       │                                              │
│  ┌────▼─────────────────────────────────────────┐   │
│  │  Tools: file, patch, terminal, code_exec,    │   │
│  │  web, memory, todo, sub_agent, mcp, skills   │   │
│  └──────────────────────────────────────────────┘   │
│                                                      │
│  ┌──────────────────────────────────────────────┐   │
│  │  Persistence: sessions, memory, todos, cron  │   │
│  │  (~/.kerux/ — atomic JSON writes)            │   │
│  └──────────────────────────────────────────────┘   │
└──────────────────────────────────────────────────────┘

Core Subsystems

ModuleResponsibility
agent.rsReAct loop, streaming, cooperative cancellation, approval gate, context compaction
client.rsLLM provider abstraction (OpenAI-compatible, Anthropic, Gemini), fallback chain
gateway.rsPlatform adapters (Telegram long-polling, WhatsApp bridge), markdown conversion, message chunking
session_store.rsPer-channel conversation persistence (format v2 with summary)
persist.rsShared atomic JSON write helpers (~/.kerux/)
approval.rsTool approval gate (inline keyboard via Telegram callback_query)
scheduler.rsCron-style job scheduler with disk persistence
tools/Built-in tool implementations
platform.rsOS paths (kerux_home(), config/data/sessions dirs)