harness
Agent = Model + Harness. This crate is the Harness — the modular scaffolding around an LLM that turns it into an autonomous coding agent.
Rust framework for building production coding agents, based on the
harness engineering discipline as written up by Böckeler (Thoughtworks,
2026) and Lopopolo (OpenAI, 2026). See DESIGN.md for the full
architectural rationale.
What you get
| Layer | What it does | Crate |
|---|---|---|
| Model | OpenAI-compatible + Anthropic-native + scriptable mock | harness-models |
| Tools | fs (read/write/edit/list), shell (risk-classified allowlist) | harness-tools-fs, harness-tools-shell |
| Sensors | cargo check + cargo clippy produce LLM-friendly Signals; auto-fix patches apply automatically |
harness-sensors-rust |
| Skills | strict agentskills.io validator + #[skill] proc-macro + export to spec-compliant directory |
harness-skills, harness-macros |
| Guides | feedforward Markdown context, scoped by task | #[guide] + harness-templates |
| Hooks | 27-event lifecycle bus with deny/inject/mutate | harness-hooks + #[hook] |
| Compactor | 5-stage progressive compaction (auto-triggered by budget) | harness-compactor |
| Loop | ReAct + tool-call dispatch + sensor feedback + auto-fix | harness-loop |
| Blueprint | deterministic + agent state machine with retry/fallback | harness-blueprint |
| Sandbox | git worktree isolation (container/VM in v0.2) | harness-sandbox |
| CLI | harness skills validate / list / export, harness new |
harness-cli |
60-second tour
1. Build a minimal agent
use *;
use AgentLoop;
use ;
use ;
use default_world;
use Arc;
async
2. Register a skill, tool, guide, sensor, or hook with a proc-macro
/// Greet the user politely. Use when the user explicitly asks for a friendly hello.
async
async
async
async
All five auto-register via inventory; AgentLoop::with_macro_hooks() and
SkillRegistry::with_macro_skills() pick them up at runtime.
3. Hybrid deterministic + agent state machine
use ;
let bp = new
.add
.add
.add
.edge.edge
.branch_on_failure;
4. Validate / export skills for any spec-compliant agent
)
The exported directory is consumable by Claude Code, Cursor, Codex, or any agent that follows the agentskills.io spec.
5. Scaffold a new agent project
Testing & verification
$ cargo test --workspace
... 123 tests passing
Three layers of verification:
- Unit tests (per crate) — pure logic, no I/O.
- AgentLoop integration tests (
harness-loop/tests/agent_loop.rs) —MockModeldrives the full pipeline with scripted responses; zero network, deterministic. - Golden-path test (
harness-loop/tests/golden_path.rs) — every component (guide, tool, sensor, auto-fix, hook, compactor) exercised at once against a tmp workspace, final on-disk state asserted. - Live demo (
examples/crate-keeper) — runs against DeepSeek (flashorprotier) for wire-format validation that mocks can't catch.
Examples
See examples/README.md for full descriptions. In order
of increasing surface area:
examples/deepseek-hello— smallest possible Hello-world against DeepSeek.examples/crate-keeper—MockModelsmoke test; no network.examples/personal-assistant— scheduling agent withUserProfile, REPL, brief mode.examples/investor-bot— autonomous web research with multi-engine search fallback + retry.
Status
- v0.0.1 — ✅ initial publish (15 of 18 crates).
- v0.0.2 — ✅ shipped.
UserProfile+ProfileGuide, optionalharness-rs-daemonscheduler, retry/backoff in model adapters, MCP server with resources + prompts, session record/replay, multi-engine search,#[non_exhaustive]sweep, security gates onFixPatch::RunCommand+shell_read. See CHANGELOG. - v0.1+ —
ContainerSandbox/VmSandbox/ first-class blueprintNode::Agentare on the road.
License
Dual-licensed under MIT OR Apache-2.0.