hlock
Make your agent harness pinnable, portable, and tunable.
Tune your agent stack against your own tasks, then pin the winner in a harness.lock.
Documentation · Quickstart · CLI reference · Design spec
hlock treats an agent system the way a package manager treats dependencies. You
bring your domain tasks, the models you're allowed to use, and the harness you like.
hlock searches the stack, measures every candidate against your tasks, and writes a
harness.lock: a pinned, version-controlled, enforceable description of the agent that
actually works for your domain, along with the evidence for choosing it.
| You know this from package managers | In hlock |
|---|---|
📄 pyproject.toml |
harness.toml, the manifest: what the resolver may try, and what "best" means |
| 🧮 dependency resolver | the resolver: search over LLMs × decision models × harnesses × policies |
🔒 uv.lock / Cargo.lock |
harness.lock, the lockfile: what was chosen, pinned and hashed, plus the evidence |
✅ CI --locked check |
hlock check: fail when the manifest drifts from the lock |
Install
Prebuilt wheels cover Linux (x86_64, aarch64), macOS (arm64, x86_64), and Windows (x64)
for CPython 3.9+. For Rust, use cargo add hlock.
[!NOTE]
harness-lockis an alias forhlock. Both names install the same package at the same version, soimport hlockandimport harness_lockare the same API.
Quickstart
No accounts or API keys needed. The built-in reference provider and harness are
deterministic and offline, so the whole loop runs on a laptop.
From there: hlock show prints the locked stack and its evidence, hlock tree prints the
component graph, hlock upgrade plans model upgrades, and hlock optimize tunes prompts,
hyperparameters, and small models into a harness.opt.lock.
Already have a harness set up?
Pin it. hlock pin captures your Claude Code, Codex, Pi, OpenCode, Hermes or Cursor setup
into harness.lock: the harness version, the models and local runtimes it uses, MCP
servers, skills, plugins, and config, with secrets replaced by placeholders.
See Harnesses and Pinning your setup, Rehydrating with sync, and Launching a locked harness.
=
= # writes ./harness.lock
=
# {"success": true, "model": "qwen-7b", ...}
How it works
Architecture
A Rust core does all the deterministic work. Anything that needs the Python ML ecosystem or a GPU runs in a Python worker, which can lift each piece of work to a Flyte task on a cluster.
| Path | What lives there |
|---|---|
crates/harness-lock-core |
The core library (pure Rust): manifests, lockfiles, search planning, trial bookkeeping, evidence, lock construction. It orchestrates and aggregates, and never does heavy compute itself. |
crates/harness-lock-py |
PyO3 bindings, compiled into harness_lock._harness_lock and shipped only inside the wheel. |
crates/hlock, crates/harness-lock |
Thin crates that re-export the core (harness-lock is the alias). |
harness_lock/ |
The Python package: the hlock CLI and the heavy-work worker (tasks/worker.py). |
hlock/ |
A shim that re-exports harness_lock, so import hlock works. |
packaging/harness-lock |
The harness-lock PyPI alias, which pins the matching hlock release. |
docs/ |
The documentation site (Zensical), published to GitHub Pages. |
Backends
| Backend | Where trials run | Use it for |
|---|---|---|
local (default) |
in-process Rust reference harness | trying it out, CI, deterministic tests |
devbox |
Python worker on this machine | real LLM calls, your own traces, flyte local |
cluster |
Python worker that lifts each stage to Flyte/Union | GPUs, fan-out, durable caching, shared results |
# real LLM calls: export HL_LLM_BASE_URL=http://… HL_LLM_MODEL=qwen-32b [HL_LLM_API_KEY=…]
See Backends for setup and
the HL_* environment variables.
Development
Development uses uv and a Rust toolchain.
uv run rebuilds the extension automatically when Rust sources change.
Want to help? See the contributing guide. Releases are cut from tags. See RELEASING.md.
Status
hlock is at v0.1. What works today: manifest and lockfile schema v1, a
content-addressed store, task packs with graders, the reference provider and harness,
grid search with Pareto selection, upgrade (plan/apply/rollback), and optimize across
the local, devbox, and cluster backends. SPEC.md describes the full design,
much of which is still on the roadmap.