clawft Overview
A Rust-native agent framework for building multi-channel, tool-augmented LLM agents with tiered routing, skill auto-generation, and cost tracking.
What is clawft?
clawft is a Rust agent framework -- the user-space agent runtime that powers WeftOS. It implements a complete agent lifecycle: message consumption, context assembly, LLM pipeline routing, tool execution, skill management, memory persistence, and multi-channel communication.
The framework compiles to native binaries, WASM for browsers, and WASI for server-side sandboxing. The primary binary is weft (the CLI agent).
The workspace contains 22 crates organized in a strict dependency hierarchy that enforces separation of concerns -- shared types at the bottom, platform abstraction above them, then the core engine, with tools, channels, services, plugins, and the CLI at the top. A WASM crate provides a browser-compatible entrypoint.
clawft as an Agent
clawft is not a library for calling LLM APIs. It is a complete agent runtime -- the Rust-native equivalent to frameworks like Hermes (NousResearch) or OpenClaw. The AgentLoop at its center implements a consume-process-respond cycle with tool use:
- Inbound -- A message arrives from any of 11 channels (Telegram, Slack, Discord, etc.) via the
MessageBus. - Session -- The loop retrieves or creates a conversation session.
- Context --
ContextBuilderassembles the system prompt, active skill instructions, memory (MEMORY.md), and conversation history into an LLM-ready message list. - Pipeline -- The message passes through a 6-stage pluggable pipeline: Classifier, Router, Assembler, Transport, Scorer, Learner.
- Tool Loop -- If the LLM responds with tool calls, the agent executes them, appends results, and re-invokes the LLM -- up to
max_tool_iterationsrounds. - Outbound -- The final response is dispatched back through the
MessageBusto the originating channel.
See Agent Loop for the full architecture and Pipeline for stage-by-stage detail.
Positioning
| Concern | clawft | Hermes (Python) |
|---|---|---|
| Language | Rust (native + WASM + WASI) | Python |
| Pipeline | 6-stage pluggable, trait-based | Simple LLM call |
| Tiered routing | Complexity-scored, cost-tracked, permission-aware | Keyword heuristic |
| Skill hot-reload | Filesystem watcher, atomic swap | Not available |
| Cost tracking | Per-tier budget enforcement with daily/monthly limits | Not available |
| Rate limiting | Per-sender | Not available |
| Kernel integration | PID tracking, governance, ExoChain, ECC, WASM sandbox, mesh | None |
clawft's differentiator is the kernel integration layer: when running on WeftOS, agents gain ExoChain cryptographic provenance, three-branch constitutional governance, ECC cognitive substrate, WASM sandboxing, and mesh networking.
Key Features
- 6-stage processing pipeline -- Classify, route, assemble context, transport to LLM, score quality, and feed learning signals. Every stage is trait-based and replaceable.
- Tiered model routing -- Complexity-based routing across four model tiers (Free/Standard/Premium/Elite) with per-sender cost tracking and budget enforcement.
- Skill auto-generation -- Detects repeated tool-call patterns and generates skill candidates after a configurable threshold (default: 3 repetitions). Requires user approval.
- Cost tracking -- Per-tier budget enforcement with daily and monthly spending limits, recording both estimated and actual costs.
- Multi-provider LLM routing -- Nine built-in providers (OpenAI, Anthropic, Groq, DeepSeek, Mistral, Together, OpenRouter, Gemini, xAI) with prefix-based routing, automatic retry, and environment-driven API keys.
- 11 communication channels -- Telegram, Slack, Discord, Email, WhatsApp, Signal, Matrix, IRC, Google Chat, Microsoft Teams, and Web. All share one trait interface and lifecycle.
- Built-in tool system -- File I/O, shell execution, memory, web search/fetch, messaging, voice, and subprocess spawning -- all workspace-sandboxed with security policies.
- Plugin architecture -- Six extension points (Tool, Channel, Pipeline, Skill, Memory, Voice), WASM sandbox (wasmtime), hot-reload, permission system, and slash-command registry.
- Skills and agents -- Reusable prompt bundles (SKILL.md) and named agent personas (agent.yaml) with template variables, tool allowlists, and three-level discovery (workspace, user, builtin).
- MCP integration -- Serve tools to external MCP clients or consume tools from external MCP servers. Internal-only mode for infrastructure servers with skill-based per-turn filtering.
- WASM / browser target -- The
clawft-wasmcrate compiles to WebAssembly for in-browser operation. - Security-first -- Workspace containment, command allowlists, SSRF protection, permission-gated tool access, WASM fuel metering, prompt injection stripping, and 57-check security auditor.
Quick Install
Build from source using the project build script:
git clone https://github.com/clawft/clawft.git
cd clawft
scripts/build.sh nativeThe resulting binary is at target/release/weft.
For debug builds (faster iteration):
scripts/build.sh native-debugFor Docker deployment:
docker pull ghcr.io/clawft/clawft:latest
docker run --rm -it ghcr.io/clawft/clawft:latest --versionFirst Run
Set an API key for any supported provider:
export ANTHROPIC_API_KEY="sk-ant-..."Start an interactive session:
weft agentSend a single message:
weft agent -m "Summarize the Rust async ecosystem"Documentation Sections
- Getting Started -- Installation, first conversation, key concepts
- Architecture -- Crate structure, pipeline, message flow
- Agent Runtime
- Agent Loop -- The consume-process-respond cycle, auto-delegation, tool execution
- Pipeline -- 6-stage processing pipeline, tiered routing, cost tracking
- Skills -- SKILL.md format, discovery chain, auto-generation, hot-reload
- Memory -- MEMORY.md / HISTORY.md, directory resolution, platform abstraction
- Integration
- Infrastructure
- CLI Reference -- Complete command-line reference for
weft - Configuration -- Config file format, environment variables, all keys
- Browser Mode -- WASM build, browser quickstart, test harness
- Deployment -- Docker, WASM, CI/CD pipeline
- Security -- Security model, command policies, SSRF protection, WASM sandbox
- CLI Reference -- Complete command-line reference for