← Back to home@artec

clat

Cmd-Line Agent, a Rust foundation compatible with the DeepSeek Harness framework. 命令行智能体,兼容深度探索驾具的 Rust 基座。

Stars
5
Language
Rust
Created
Dec 7, 2025
Updated
Sep 16, 2026

Introduction

CLAT

English | 中文

cl + at = command-line agent · Homepage

CLAT is a local-first coding agent foundation shipped as one Rust binary. It can inspect a repository, edit files, run commands, use external tools, and keep durable conversations without requiring a JavaScript or Python runtime. That guarantee covers the shipped CLAT core; optional MCP servers and the DSH adapter may declare their own runtimes.

The project is built by dogfooding real repository work and turning recurring needs into reusable, provider-neutral capabilities.

Quick start

# Open the terminal UI in the current repository.
clat

# Then run /model once to choose a preset and enter an API key.

# Headless use: positional text is the instruction; piped input is context.
clat exec "explain this repository in one sentence"
git diff | clat exec "review this diff"

# Deterministic offline proof of the model -> tool -> model loop.
clat demo

# Check whether a signed upgrade is available.
clat upgrade --check

Run clat --help for the complete command-line surface.

Interfaces

InterfaceBest forEntry point
Terminal UIDaily interactive repository workclat
Headless runnerScripts, CI, git hooks, editor integrationsclat exec
Web workbenchAn installable local PWA and HTTP+SSE clientsclat serve
WeChat remoteOfficial iLink text, image, steering, and approvalsclat serve --im wechat
DSH clientUsing CLAT's TUI with a local DeepSeek Harness hostclat dsh
Plugin managerBrowsing the signed market; installing, updating, auditing, or rolling back packagesclat plugin / pi.at.cn
Offline demoVerifying the core loop without credentialsclat demo

clat serve binds only to 127.0.0.1:2691 by default. API access uses a persistent ~/.clat/web-token Bearer credential; the token is never placed in the URL. The same binary serves the responsive three-panel PWA. An optional official-iLink WeChat frontend can be bound and paired explicitly; it remains off unless serve is started with --im wechat.

What is included

  • Agent workflow — an unbounded model → tool → model loop, in-run steering, user questions, per-session todos, automatic titles, and context compaction that preserves the original journal.
  • Workflow intelligence — durable Plan Mode with structurally filtered tool access; bundled/user/project Markdown skills with lazy bounded loading; optional user-configured read-only LSP navigation (definition, references, implementation, hover) through CLAT-managed sandboxed stdio; and /context for a one-shot estimate of the model-facing context breakdown.
  • Bounded agent intelligence — explicit local project/user memory with no model writes; one durable CAS goal per session with user-armed, capped continuation; and a default-off, depth-1 explorer/reviewer experiment whose children are confined to three project-relative read tools.
  • Models — built-in DeepSeek, GLM, Qwen, Kimi, and Tencent Hy presets; named custom profiles; OpenAI Responses and OpenAI-compatible protocols; reasoning, usage, cache, context, and quota telemetry. Probe-verified vision routes use a structured TUI image draft with multi-path selection, explicit clipboard import, image-only prompts, and in-run image steering.
  • Native tools — bounded Git-aware literal/regex/glob search, file listing and reading, capability-gated visual inspection, atomic writes, exact edits, single-file multi-hunk patches, and run-owned command sessions with incremental output, stdin, PTY and owned process-group cleanup. macOS commands use functionally probed Seatbelt write/network confinement outside Full Access; other platforms report supervised fallback honestly. Scoped project instructions refresh as successful file tools reach nested paths.
  • Permissions — Read Only, Project Write, and Full Access modes; complete argument review; project trust; path fences; fail-closed headless behavior.
  • Sessions — crash-resilient, append-only, DSH-compatible journals under ~/.clat, with local replay and per-project resume state.
  • Extensions — MCP over stdio or Streamable HTTP, sandboxed WebAssembly components, and a static Cordis compatibility adapter for portable DSH plugin capabilities; one transactional package manager installs both WASM and executable MCP packages with signed market discovery, dependency solving, publisher/revocation checks, capability review and rollback.
  • Client-neutral core — the TUI, headless runner, local server, and optional WeChat frontend consume the same Application facade, permission pipeline, attachment admission, and event vocabulary. By default clat discovers or starts one background host on 127.0.0.1:2691, so the terminal UI and the web workbench can stay open on the same sessions at the same time; clat standalone keeps the traditional in-process TUI.

Install

macOS / Linux:

curl -fsSL https://raw.githubusercontent.com/artec/clat/main/install.sh | sh

Windows (PowerShell):

irm https://raw.githubusercontent.com/artec/clat/main/install.ps1 | iex

The installers prefer prebuilt release artifacts and fall back to a source build when an artifact is unavailable. Prebuilt binaries cover macOS arm64 and x86_64, Windows x86_64 and arm64, and Linux x86_64 and aarch64 with glibc 2.39+. Older Linux systems can build from source with the stable Rust toolchain. See release signing for the trust model and platform baselines.

Prebuilt installs go to ~/.local/bin/clat on macOS/Linux and %LOCALAPPDATA%\clat\bin\clat.exe on Windows; the installer prints a PATH hint when needed. A source fallback uses Cargo's bin directory, normally ~/.cargo/bin. To uninstall, remove that executable. User state under ~/.clat is deliberately left intact unless you remove it separately.

Documentation

Start with the document that matches your task:

GoalDocument
Use the TUI, exec, serve, or dshUsing CLAT
Configure a preset or custom modelModel editor
Understand approvals, modes, and path boundariesPermissions
Configure MCP serversMCP integration
Understand plugin runtimes, packages, and the signed marketCLAT plugins
Install or author a WASM componentWASM plugins
Port a DSH/Cordis pluginDSH plugin compatibility guide
Audit evidence-backed DSH compatibility claimsDSH compatibility matrix
Understand core boundaries and lifecycleArchitecture
Understand provider adapters and retry behaviorProviders
Understand files, journals, and recoveryPersistent state
Build and publish a releaseRelease signing
Run credentialed smoke testsLive-model validation

The DSH adapter package also has standalone English and Chinese package documentation.

Development

For short edit feedback use scripts/gates.sh [test-filter ...]; run scripts/gates.sh --full once before delivery. See Testing.

Prerequisites are Git and the current stable Rust toolchain:

git clone https://github.com/artec/clat.git
cd clat
cargo test --all-targets --all-features
cargo build
./target/debug/clat demo

Useful repository paths:

PathPurpose
src/Rust core and frontends
web/Zero-build assets embedded by clat serve
wit/WASM plugin contract
schemas/Machine-readable plugin/package schemas
sdk/clat-plugin/Rust SDK for WASM plugin authors
sdk/dsh-adapter/npm adapter for DSH plugin authors
plugins/WASM examples and pilot plugins
market/independently deployable pi.at.cn catalog and signed-index release tooling

Live provider checks are intentionally separate from the normal test suite because they require user credentials and may incur charges. Follow live-model validation when provider behavior is in scope. Contributors and coding agents should also read the project constitution in AGENTS.md.

Principles

Local first · one binary · model agnostic · MCP native · project aware · permission first · dogfood driven · generalize, never special-case.

License

MIT