Skip to main content
hlock logo

hlock

Your agent harness
made portable.

Pin your harness, models, MCP servers, skills, and config in
a harness.lock, version it, and rehydrate it anywhere.

PyPI crates.io CI Docs Python License hlock

Documentation · Quickstart · CLI reference · Design specs


Your agent is more than a model. It's a harness, MCP servers, skills, and config, hand-tuned on one machine. hlock is the missing harness packaging layer, written in Rust 🦀: harness.lock tracks all of its dependencies, so you can commit it to git and restore it anywhere. When you're ready, it measures your stack against your own tasks and finds a better one.

You know this from package managers In hlock
🔒 uv.lock / Cargo.lock harness.lock: every dependency of your harness, pinned and hashed
📌 pip freeze hlock pin: record the setup you already have, and re-pin as it grows
✅ --locked check hlock check: show what changed since the pin
📦 uv sync / npm ci hlock sync: rehydrate the locked setup on any machine
▶️ uv run hlock launch and hlock run: start sessions and run prompts on the locked setup

An hlock session: pin a Claude Code setup into harness.lock and push it to GitHub, then pull and sync it on another machine

Install

pip install hlock        # or: uv add hlock  ·  uvx hlock --help

Prebuilt wheels cover Linux (x86_64, aarch64), macOS (arm64, x86_64), and Windows (x64) for CPython 3.9+. For Rust, use cargo add hlock.

Quickstart

Pin the harness you already use (Claude Code, Codex, Pi, OpenCode, Cursor, Gemini CLI, and more), then bring it back anywhere:

hlock pin --user                # lock your setup (yours in ~/.claude etc., and the project's) into harness.lock
git add harness.lock .hlock/    # version it (secrets are placeholders, never values)
hlock check                     # see what changed since the pin; re-pin to lock it
hlock sync                      # on another machine: rehydrate it into .hlock/env (or --in-place, --docker)
hlock launch                    # start a session on the locked setup, isolated from your config
hlock run "summarize README.md"  # or run one prompt through it (claude -p, codex exec, …)
hlock pull github:alice/agents  # get someone else's pinned setup; then hlock launch --lock alice
hlock add skill github:anthropics/skills/skills/pdf   # declare a dependency, pin it, install it
hlock audit                     # integrity, hidden characters, what it runs, policy, secrets

Plain hlock pin records only the project's own skills, MCP servers and config, so your personal setup stays out of the repository; --user adds it.

For your own work, hlock evals init -t coding (or data, research, support) writes an eval pack template plus an Agent Skill, so the agent you already use can fill it in with real tasks from your project. See Eval packs.

See the Quickstart, Pinning your setup, Rehydrating with sync, and Launching a locked harness.

Manage your team's agents

Contributors to one repository rarely share an agent setup. Each person can commit their own lock to .hlock/locks/harness.<handle>.lock, next to the code it was used on, and anyone with a clone can try a teammate's setup in isolation:

hlock pin -o .hlock/locks/harness.alice.lock         # your harness and model, with the repo's setup
hlock launch --lock .hlock/locks/harness.bob.lock    # try a teammate's, isolated from yours

Add the hlock badge to your README to point readers at the locks. See Team repositories for the layout, the conventions, and pulling a teammate's lock from outside the repository.

Then make it better

Optimize your harness. Draft an eval pack from the requests you've already made to your agent with hlock evals init --from-traces (it reads the sessions Claude Code, Codex, and Pi logged for the project), and review it with your agent using the Agent Skill it writes. List the models, decision models and harnesses to try in a harness.toml, and let hlock resolve lock the best combination with its success rate, cost, and latency. hlock tune goes further, into prompts, hyperparameters, and fine-tuned small models. The built-in reference provider is offline, so you can try the loop with no API keys:

hlock evals init                          # write a hello-world eval pack to ./evals
hlock init --name demo                    # write a starter harness.toml
hlock resolve                             # measure every combination -> harness.lock
hlock run "count the words in words.txt"  # run the locked agent

Switch harnesses, or go local. hlock migrate --to codex moves a lock onto another harness, with your MCP servers, skills, and instructions rewritten to where it reads them. hlock localize does the same onto an open-source harness and models served by Ollama or LM Studio.

Let an agent do the busywork. hlock meta hands work that needs judgment (installing what a lock needs on a new machine, filling in an eval pack, updating skills and MCP servers) to a pinned agent and checks the result itself. The default is an agent built into hlock, so there's nothing to install: give it an API key or a local model.

hlock meta init                 # pick a model for the built-in agent, and pin it
hlock meta run install          # install what harness.lock still needs, then verify

See Finding the best stack, Eval packs, Tuning, and Switching harnesses, Going local, and The meta harness.

Python API
import json
import hlock
from hlock import SearchSpace, Objective, Budget

space = SearchSpace(
    llm={"planner": ["reference:qwen-7b", "reference:qwen-32b"]},
    decision=["none", "rules:default"],
    harness=["reference"],
    objective=Objective(select="min-cost", constraints={"success-rate": ">=0.5"}),
    budget=Budget(max_trials=50),
    evals=json.dumps({"packs": ["./evals"], "seeds": 2}),
)
lock = hlock.resolve(space, backend="offline")   # writes ./harness.lock
print(lock.summary())

agent = hlock.load("harness.lock")
print(agent.run("clean ./data/orders.csv"))   # {"success": true, "model": "qwen-7b", ...}

How it works

How hlock works: hlock pin captures your setup, or hlock resolve searches harness.toml and eval packs; either writes harness.lock for hlock check, sync, and launch

Architecture

A Rust core does all the deterministic work. Anything that needs the Python ML ecosystem or a GPU runs on a backend: hlock's Python worker on this machine, Flyte tasks on a cluster, or a backend you write in Rust or Python.

hlock architecture: Python CLI and API over a Rust core via PyO3; offline runs in process, local and flyte hand work to a Python worker that can lift stages to Flyte tasks, and custom backends speak the same contract

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 hlock._hlock and shipped only inside the wheel.
crates/hlock, crates/harness-lock Thin crates that re-export the core (harness-lock is the alias).
hlock/ The Python package: the hlock CLI and the heavy-work worker (tasks/worker.py).
harness_lock/ A shim that re-exports hlock, so import harness_lock 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
offline (default) in-process Rust reference harness trying it out, CI, deterministic tests
local Python worker on this machine real LLM calls, your own traces, LoRA on a local GPU
flyte each work item as a Flyte 2 task on your cluster GPUs, durable caching, shared results
your own wherever your backend sends it Ray, Modal, Kubernetes, Slurm, an internal runner
hlock tune --backend local --depth probe --max-trials 10
# real LLM calls: export HL_LLM_BASE_URL=http://… HL_LLM_MODEL=qwen-32b [HL_LLM_API_KEY=…]
hlock tune --backend flyte --depth ft --data user:./runs   # LoRA on a GPU worker

Backends are pluggable: a Python class registered in the hlock.backends entry point group, or any executable named hlock-backend-<name> (Rust has a serve helper). See Backends for setup, the HL_* environment variables, and how to write your own.

hlock builds on, and borrows from, a lot of good work. Package managers install agent config, dotfile managers and Nix reproduce it, eval frameworks measure it, and optimizers generate it. hlock isn't trying to replace any of them; it has different devex goals:

  • speed: one command pins the setup you already have
  • quick portability: the whole stack, from harness version and models to MCP servers, skills and config, in one lock you can rehydrate anywhere
  • tunability: eval packs, the resolver and the tuner measure your stack against your own tasks
  • let agents do the busy work: some packaging and syncing work that users need to do around hlock can be further automated with a meta agent.
If you want to… Reach for Where hlock fits
Install skills, instructions and MCP servers from git into many agents, with org policy APM hlock reads apm.yml, resolves apm: packages by the same rules, and exports apm.lock.yaml; it also pins the rest of the stack and measures whether a package helps
Keep one set of rules in sync across many agents rulesync, Ruler They translate config; hlock locks it, with digests and drift checks
Add skills from the open ecosystem npx skills hlock pin records them with the rest of your setup
Carry your dotfiles to every machine chezmoi, yadm hlock knows what a harness's files mean: versions, models, secrets, drift
Reproduce a toolchain bit for bit Nix, mise, Dev Containers Nix pins inputs; a resolved harness.lock also records how well the stack did
Run agent evals and benchmarks at scale Harbor, Inspect, promptfoo They measure the variants you list; hlock searches, selects, and locks the winner
Write better prompts and programs DSPy, GEPA They generate candidates; hlock picks among stacks and makes the pick reproducible

The comparison page goes through each one, including "why not just dotfiles / chezmoi / Nix / APM?". Already using APM? See Coming from APM.

Development

Development uses uv and a Rust toolchain.

uv sync                            # create .venv, build the Rust extension, install dev tools
uv run pytest                      # Python bindings, CLI, worker
uv run ruff check harness_lock hlock tests
cargo test -p harness-lock-core    # Rust core + integration tests

uv run --group docs zensical serve # docs at http://localhost:8000

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.

License

Apache-2.0

Metadata

Release files for hlock 0.8.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for hlock 0.8.0
File Size Uploaded Provenance Actions
hlock-0.8.0.tar.gz 762.5 kB With provenance Details for hlock-0.8.0.tar.gz

Built distributions (wheels)

Table of built distributions (wheels) for hlock 0.8.0
File Actions
hlock-0.8.0-cp39-abi3-win_amd64.whl CPython 3.9 abi3 Windows x86-64 Details for hlock-0.8.0-cp39-abi3-win_amd64.whl
hlock-0.8.0-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.9 abi3 Linux glibc 2.17+ x86-64 Details for hlock-0.8.0-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
hlock-0.8.0-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl CPython 3.9 abi3 Linux glibc 2.17+ ARM64 Details for hlock-0.8.0-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
hlock-0.8.0-cp39-abi3-macosx_11_0_arm64.whl CPython 3.9 abi3 macOS 11.0+ ARM64 Details for hlock-0.8.0-cp39-abi3-macosx_11_0_arm64.whl
hlock-0.8.0-cp39-abi3-macosx_10_12_x86_64.whl CPython 3.9 abi3 macOS 10.12+ x86-64 Details for hlock-0.8.0-cp39-abi3-macosx_10_12_x86_64.whl

Total release size: 33.1 MB

Release files / hlock-0.8.0.tar.gz

Download URL hlock-0.8.0.tar.gz
Size 762.5 kB
Tags Source
SHA-256 checksum
How to use checksums
ecdf6923513278da3f4ae87750bd00d4b14f7bac92ea8336136450791d9126ce
BLAKE2b-256 checksum
How to use checksums
e2a3c661f0600818199158466e0de8604bb5776f26f32496d742fbdf89266766
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 25, 2026.

Transparency log

Release files / hlock-0.8.0-cp39-abi3-win_amd64.whl

Download URL hlock-0.8.0-cp39-abi3-win_amd64.whl
Size 6.5 MB
Tags CPython 3.9 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
870ad0614898f0e31b95420dba54eb9b98aca18c97a8dcdc6b1158fe51ec0551
BLAKE2b-256 checksum
How to use checksums
872697d4a77aee8109318791d83436017c00f382f155e4bcc14f9b839f8faedd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 25, 2026.

Transparency log

Release files / hlock-0.8.0-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL hlock-0.8.0-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 6.7 MB
Tags CPython 3.9 Linux glibc 2.17+ x86-64 abi3
SHA-256 checksum
How to use checksums
37c2f21b56804369bb02d4fd2afce5e8e47f2e0ed03f2eaeff494f24c4054bfd
BLAKE2b-256 checksum
How to use checksums
e001ceb3a07d7b1ce4ea7a914a468522d3cb652852930e73a4dcc2d1a5a788b0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 25, 2026.

Transparency log

Release files / hlock-0.8.0-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl

Download URL hlock-0.8.0-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Size 6.6 MB
Tags CPython 3.9 Linux glibc 2.17+ ARM64 abi3
SHA-256 checksum
How to use checksums
2941af3aa2b55f15b49a954d61b5a760e48d50e3991580ddd44090ea0dd5fbd4
BLAKE2b-256 checksum
How to use checksums
782a60f6802c276f7c1ff0f9923a5c004b3ced1ff32aee1299f5063b76218f10
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 25, 2026.

Transparency log

Release files / hlock-0.8.0-cp39-abi3-macosx_11_0_arm64.whl

Download URL hlock-0.8.0-cp39-abi3-macosx_11_0_arm64.whl
Size 6.1 MB
Tags CPython 3.9 abi3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
6daaaa09d90ba26d26319f1eff0929334085a2db8aafc34a30eb071c8be3c289
BLAKE2b-256 checksum
How to use checksums
0a20e81ec50e51949f049f058e31785446e4c1b0cfc47005ccde468e7ee31c4a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 25, 2026.

Transparency log

Release files / hlock-0.8.0-cp39-abi3-macosx_10_12_x86_64.whl

Download URL hlock-0.8.0-cp39-abi3-macosx_10_12_x86_64.whl
Size 6.4 MB
Tags CPython 3.9 abi3 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
a33b7b4f9a5edd44cf14054b542aa1ccb3750f6f1e75809a260e35b87f51e970
BLAKE2b-256 checksum
How to use checksums
27c705b9f3aa69be7f9d8a66e84571fe1ca39678e70bf054dafd9a3134b9cc16
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 25, 2026.

Transparency log

Security for hlock 0.8.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 6 files in this release have been uploaded with provenance metadata.

Select from 6 files

Attestation for hlock-0.8.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 25, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page