The Problem

Terminal coding agents are dominated by a single vendor's implementation, which ties users to one model provider, ships with opaque telemetry, and is slow to extend. Teams that want a fast, local, multi-provider alternative have had to stitch together scripts or accept vendor lock-in. Claurst is a clean-room Rust reimplementation of that agent paradigm, built to be provider-agnostic and fully self-hosted.

What This Does

Claurst is a TUI-based coding agent with a plugin system, a companion agent ("Rustle"), chat forking, and memory consolidation. The src-rust/ workspace is a Cargo project with 205 Rust files split into focused crates: api (provider adapters), core (state, auth, storage), tools (file/bash/edit operations), commands (slash commands), query (agent orchestration), and tui (the terminal UI). The spec/ directory holds the behavioral spec it was built from, and docs/ covers setup and usage.

The agent supports 30+ providers (Anthropic, OpenAI, Google, Copilot, Ollama, etc.) via the api/src/providers/ directory, and includes an MCP (Model Context Protocol) client in mcp/. It persists sessions in SQLite (core/src/sqlite_storage.rs) and tracks file history for context management.

How It Is Wired

Execution starts in src-rust/crates/cli/src/main.rs. The main function (line 343) and execute (line 79) are the true entry points, reaching 401 and 404 functions respectively. execute is the hub — it's called from 148 places and routes to Error, Message, and success types constantly, making it the single highest-blast-radius function in the codebase. Changing its signature breaks nearly everything.

From there, control flows into src-rust/crates/commands/src/lib.rs (422 functions, 95 types) which defines the slash-command surface, and src-rust/crates/core/src/lib.rs (217 functions) which owns the model-calling logic and database access. The tui/src/app.rs file is a 5,000+ line monolith defining the UI, with run at line 5365 reaching 367 functions.

The system touches the outside world through: 69 functions doing file I/O, 46 calling model inference, 7 making network calls, and 5 hitting the database. A traced path from execute to list_sessions reaches the SQLite connection in two hops. The file_history.rs module is called from 76 files — it's the most depended-upon module and any change there ripples widely.

How To Use It

Setup:

git clone https://github.com/moses-y/claurst
cd claurst/src-rust
cargo build --release --package claurst

Configuration: Set ANTHROPIC_API_KEY (or use /connect inside the TUI to configure any provider). No config file is required for basic use.

Running:

export ANTHROPIC_API_KEY=sk-ant-...
claurst
# or headless:
claurst -p "explain this codebase"

A devcontainer is provided (.devcontainer/Dockerfile) for VS Code Remote Container development.

Real-World Use

A team standardizing on a self-hosted coding agent could run Claurst in a container with a local Ollama endpoint. The agent reads and edits files, runs bash commands, and manages multi-turn context — all without sending data to a third party. For a one-off task:

// From cli/src/main.rs — the headless path
claurst -p "Add error handling to src/main.rs and run cargo test"

Code Health & Issues

Static analysis (not opinion) found 142 issues: 59 high, 83 medium. The three kinds are:

  • High – Deep nesting (48 instances): api/src/lib.rs, api/src/model_registry.rs, providers/anthropic.rs hit indentation depth 8. Fix: early returns, extract blocks.
  • High – Duplicated code (784 repeated 6-line blocks across 120 files): error_handling.rs, bridge/src/lib.rs, buddy/src/lib.rs. Fix: extract shared helpers.
  • High – Oversized files (11 files): cli/src/main.rs (2,841 lines), commands/src/lib.rs, core/src/lib.rs. Fix: split by responsibility.

SDLC observations:

  • High – CI doesn't run the test suite. 20 test files exist, no test command in .github/workflows/.
  • High – Third-party GitHub Actions pinned to tags (dtolnay/rust-toolchain@stable), not commit SHAs — a known supply-chain risk.
  • Med – No dependency update bot (Dependabot/Renovate) configured.
  • Med – Devcontainer base image rust:1-bullseye not pinned by digest.
  • Med – No dependency vulnerability scan in CI.
  • Med – Test coverage is thin: 5 test files against 205 source files (ratio 0.024).
  • Low – No timeout-minutes on workflow jobs.

The Bottom Line

Claurst is a serious, ambitious Rust implementation of a terminal coding agent with real multi-provider support and a clean workspace structure. The codebase is large and has real maintainability debt — the execute hub, oversized files, and duplicated logic will make changes costly. For a team wanting a self-hosted, provider-agnostic agent and willing to invest in refactoring, it's a strong foundation. For a quick drop-in, the CI gaps and test coverage are a concern.