Skip to main content

System Overview

klaw is built as a modular, distributed system inspired by Kubernetes. Each component has a clear responsibility and communicates through well-defined interfaces.

Core Components

Channels

Channels are the communication interfaces—how users interact with agents. Interface:

Orchestrator

Routes messages to appropriate agents based on content, rules, or AI decision. Routing Modes:
  • Disabled: Single agent, no routing
  • Rules: Regex pattern matching
  • AI: LLM-based routing decisions
  • Hybrid: Rules first, AI fallback

Agent

The core execution unit. Coordinates:
  • Conversation history management
  • LLM communication
  • Tool execution loop
  • Memory integration
Agent Loop:

Provider

LLM abstraction layer supporting multiple backends. Interface:

Tools

Actions agents can perform. Built-in tools cover common operations.

Memory

Persistent context system with workspace files.

Scheduler

Cron-based task scheduling for automated workflows.

Deployment Modes

Single-Node

Everything runs on one machine:
Commands: klaw chat, klaw start

Distributed

Controller manages multiple worker nodes:
Commands: klaw controller start, klaw node join

Container

Agents run in isolated Podman containers:
Commands: klaw build, klaw run, klaw ps

Data Flow

Chat Flow

Slack Flow

Task Dispatch Flow

State Management

Local State

  • Config: ~/.klaw/config.toml
  • Agents: ~/.klaw/agents/*.toml
  • Skills: ~/.klaw/skills/
  • Sessions: ~/.klaw/sessions/

Distributed State

Controller maintains:
  • Node registry (connected nodes)
  • Agent registry (available agents per node)
  • Task queue (pending/running/completed)
Optional etcd backend for HA:

Extension Points

Next Steps

Agent Loop

Deep dive into agent execution

Distributed Mode

Controller-node architecture