artec/clat

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

项目介绍Project Overview

CLAT 是本地优先的命令行编码代理基础,以单个 Rust 二进制提供仓库检查、文件编辑、命令运行、外部工具调用和持久会话;适用于 TUI、脚本/CI、本地 Web 工作台及 DSH 主机协作。注意:核心无需 JS/Python,但可选 MCP 服务器与 DSH 适配器可能需要各自运行时。

CLAT is a local-first command-line coding agent foundation shipped as one Rust binary. It inspects repositories, edits files, runs commands, calls external tools, and keeps durable sessions, for interactive TUI work, headless scripts/CI, a local web workbench, or use with a DSH host. Caveat: the core needs no JavaScript or Python runtime, but optional MCP servers and the DSH adapter may require their own.

或使用命令行安装(适合开发者)Or use CLI install (for developers)

命令行安装CLI Install

dsh plugin --profile web add github:artec/clat

artec/clat 加入你的 DSH 配置(web profile)即可启用。

READMEREADME

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

Interface Best for Entry point
Terminal UI Daily interactive repository work clat
Headless runner Scripts, CI, git hooks, editor integrations clat exec
Web workbench An installable local PWA and HTTP+SSE clients clat serve
DSH client Using CLAT's TUI with a local DeepSeek Harness host clat dsh
Plugin manager Browsing the signed market; installing, updating, auditing, or rolling back packages clat plugin / pi.at.cn
Offline demo Verifying the core loop without credentials clat 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.

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, and Kimi presets; named custom profiles; OpenAI Responses and OpenAI-compatible protocols; reasoning, usage, cache, context, and quota telemetry.
  • Native tools — bounded Git-aware literal/regex/glob search, file listing and reading, 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 future clients consume the same Application facade and event vocabulary.

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:

Goal Document
Use the TUI, exec, serve, or dsh Using CLAT
Configure a preset or custom model Model editor
Understand approvals, modes, and path boundaries Permissions
Configure MCP servers MCP integration
Understand plugin runtimes, packages, and the signed market CLAT plugins
Install or author a WASM component WASM plugins
Port a DSH/Cordis plugin DSH plugin compatibility guide
Audit evidence-backed DSH compatibility claims DSH compatibility matrix
Understand core boundaries and lifecycle Architecture
Understand provider adapters and retry behavior Providers
Understand files, journals, and recovery Persistent state
Build and publish a release Release signing
Run credentialed smoke tests Live-model validation

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

Development

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:

Path Purpose
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

上一个 Prev Caushell 下一个 Next deepseek-harness-dsh-for-vscode