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.| Channel | Use Case | Features |
|---|---|---|
| Terminal | CLI interaction | Styled output, streaming |
| TUI | Rich terminal | Bubble Tea, syntax highlight |
| Slack | Team collaboration | Thread support, Socket Mode |
| API | Programmatic | REST, streaming |
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
Provider
LLM abstraction layer supporting multiple backends.| Provider | Models | Features |
|---|---|---|
| Anthropic | Claude family | Native streaming |
| OpenRouter | 100+ models | Gateway |
| each::labs | 300+ models | Unified API |
Tools
Actions agents can perform. Built-in tools cover common operations.| Category | Tools |
|---|---|
| Execution | bash |
| File ops | read, write, edit, glob, grep |
| Web | web_fetch, web_search |
| Meta | agent_spawn, skill, cron |
Memory
Persistent context system with workspace files.Scheduler
Cron-based task scheduling for automated workflows.Deployment Modes
Single-Node
Everything runs on one machine:klaw chat, klaw start
Distributed
Controller manages multiple worker nodes:klaw controller start, klaw node join
Container
Agents run in isolated Podman containers: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)
Extension Points
| Extension | Mechanism |
|---|---|
| New channels | Implement Channel interface |
| New providers | Implement Provider interface |
| New tools | Implement Tool interface |
| New skills | TOML definition + optional Go code |

