Architecture
High-Level Layers
ClawGo can be understood in four layers:
- Entry layer CLI, Gateway HTTP, WebUI, cron, and external channels
- Agent runtime layer
AgentLoop, router, session planner, message bus, and subagent manager - Execution capability layer tools, skills, nodes, browser, shell, memory, and filesystem
- Persistence and observability layer sessions, threads, messages, jsonl audit logs, logs, EKG, and task audit
Main Entry
The entrypoint is cmd/clawgo/main.go. Top-level commands include:
onboardagentgatewaystatusproviderconfigcronchannelskillsuninstall
agent is direct local interaction. gateway run starts the fuller runtime.
AgentLoop
pkg/agent/loop.go contains AgentLoop, the core runtime loop. Its responsibilities include:
- managing the active provider and fallback providers
- maintaining the session manager
- registering built-in tools
- building model context
- processing user, system, and internal messages
- coordinating subagent execution and runtime state access
- maintaining EKG and trigger audit
Task Planning
pkg/agent/session_planner.go can split one user request into multiple tasks and run them concurrently.
Typical triggers:
- numbered or bulleted lists
- strong separators such as semicolons
Each planned task gets:
- its own derived resource keys
- its own call into
processMessage - optional progress publication back into the system
Subagent Model
Subagents are configured in agents.subagents. They can be:
- local workers
- local routers
- remote node-backed branches
Important fields include:
typetransportnode_idparent_agent_idnotify_main_policysystem_prompt_filememory_namespaceaccept_fromcan_talk_totools.allowlistruntime.*
Messages and Threads
Agent collaboration is not just plain string forwarding. It uses a message and thread model:
communication.modecontrols collaboration modepersist_threadsandpersist_messagescontrol persistence- each agent message may carry
reply_to,correlation_id, andrequires_reply
That is why the WebUI can reconstruct topology, internal streams, and task state.
Gateway and WebUI
pkg/api/server.go exposes two broad surfaces:
- node registration and heartbeat endpoints
- WebUI pages and
/webui/api/*endpoints
It is both the runtime API gateway and the host for the static UI.