The package manager for agent harnesses

Your agent harness
made portable.

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: harness.lock tracks all of its dependencies, so you can commit it to git and restore it anywhere.

Get started

Works with Claude Code, Codex, Pi, OpenCode, Cursor, Gemini CLI and more.

The problem

It took you weeks to get your agent just right.
Now try doing it again.

The setup that makes your agent good is scattered across your home directory, hand-edited, and invisible to git. It lives on exactly one machine: yours.

~
~/.claude/settings.json ~/.claude.json /mcpServers CLAUDE.md AGENTS.md skills/review-pr/ ~/.agents/skills/ mcp · github (stdio) mcp · linear (http) ~/.codex/config.toml ~/.pi/agent/models.json plugin · code-review@1.4.0 GITHUB_TOKEN=ghp_8kQ… opencode.json model: opus

Works on my machine

Your harness has no lockfile. Rebuilding it means archaeology through dotfiles and shell history.

“New laptop. Which MCP servers did I even have?”

Unshareable

The config that makes your agent good can't be reviewed, diffed, or handed to a teammate or a CI runner.

“How is your Claude so good? Can you send me your setup?”

Silent drift

A plugin updates, a model default flips, a settings file gets edited. Nothing tells you.

“It worked yesterday. What changed?”

Secrets everywhere

API keys sit inline next to the config you'd want to version, so none of it gets versioned.

“I can't commit this. There's a token in it.”

The fix

One file.
Every dependency.

hlock pin reads the harness you already use and writes everything it depends on into harness.lock: versions, sources, digests. Hand-written skills and config are vendored next to it in .hlock/, so the pair is self-contained.

  • Harness version and install source
  • Models per role, and where each came from
  • MCP servers, normalized across config formats
  • Skills, plugins & instructions, each with a digest
  • Secrets as placeholders, never values
harness.lock kind = "pin"
# generated by harness-lock. Do not edit by hand.lock-version = 1kind = "pin" [harness]name    = "claude-code"version = "2.1.285"source  = "brew-cask:claude-code@2.1.285" [[llm]]role     = "default"provider = "anthropic"model    = "opus" [[tool]]name   = "github"kind   = "mcp"source = "npm:@modelcontextprotocol/server-github"[tool.env]GITHUB_TOKEN = "${HLOCK_SECRET_GITHUB_GITHUB_TOKEN}" [[skill]]name   = "review-pr"origin = "local"digest = "sha256:15754ae3867d…74df9e" [[config]]path     = "~/.claude.json"restore  = "pointers"pointers = ["/mcpServers"]digest   = "sha256:b33482f12e0f…ad94cb92"

Familiar by design

You already know how this works.

If you've used uv, cargo, or npm, you already know the shape of hlock.

uv.lock · Cargo.lockharness.lock

Every dependency of your harness, pinned and hashed.

pip freezehlock pin

Record the setup you already have. Re-pin as it grows.

--lockedhlock check

Show exactly what changed since the pin.

uv sync · npm cihlock sync

Rehydrate the locked setup on any machine.

uv runhlock launch

Start a session on the locked setup, isolated from your config.

Bring your own harness

Lock the agent you already use.

claude-codecodexpiopencodecursor-agentgemini-clihermescopilot-cligooseamppydantic-ailanggraphopenai-agentsclaude-agent-sdkgoogle-adksmolagentscrewaideepagentsollamalm-studiodocker-model-runnervllmtrae

See supported harnesses

The workflow

Pin it. Check it. Bring it anywhere.

laptop — zsh

          

Safe to commit

Secrets stay out.
Always.

pin never writes a secret. API keys, tokens, auth headers, and credential-looking values become HLOCK_SECRET_* placeholders. You supply the values when you sync, and a real secret is never replaced with a placeholder.

~/.claude.json
"github": {
  "command": "npx",
  "env": {
    "GITHUB_TOKEN": "ghp_8kQx2LmZ0vYt…""${HLOCK_SECRET_GITHUB_GITHUB_TOKEN}"
  }
}
1 secret redacted · supplied as HLOCK_SECRET_* when syncing

Rehydrate anywhere

Same agent. Any machine.

hlock sync builds a plan: what's already satisfied, what it does for you, and the exact command for anything it can't.

A new laptop

Clone the repo, sync, set your secrets. Your config, skills, and plugins land where the harness expects them.

$ git clone …/my-app && cd my-app
$ hlock sync --install

An isolated env

Like a virtualenv for your harness. Materialize the lock into its own config root and leave yours untouched.

$ hlock sync --prefix .hlock/env
✓ in sync at .hlock/env/claude-code/config

A container

Write a Docker build context with the restored config baked into the image's home. Ship your agent to CI or a cluster.

$ hlock sync --docker
✓ wrote .hlock/docker/pi/Dockerfile
tip

Some steps need a human, like installing an app or setting a secret. hlock sync --skill writes an Agent Skill from the plan, so any agent can finish the job for you.

Go local

Localize your proprietary harness.

hlock localize turns any lock into an equivalent on an open-source harness and models served by Ollama or LM Studio. Like cross-compiling: your MCP servers, skills, and instructions come along, and nothing leaves your machine.

Read the hlock localize guide
$ hlock localize
- harness  claude-code
+ harness  opencode
- llm      anthropic:opus
+ llm      ollama:gemma3:12b
  tool     mcp · github
  tool     mcp · linear
  skill    review-pr
  config   AGENTS.md

Lock without lock-in

Feeling FOMO on
yet another new harness?

Every week there's a fresh harness — or a proprietary model gated behind one — and it starts to out-shine yours. But your setup won't move. hlock migrate moves the whole thing in one command: skills, MCP servers, and prompts rewritten to where the new harness reads them, models mapped to a provider it supports.

  • Try it tonight — a migrated lock runs in isolation before you commit
  • Skills & instructions move to the directories it reads (CLAUDE.md → AGENTS.md)
  • Models remapped to a provider the new harness supports
  • Source lock untouched — no risk switching back

Any lock works as the source — pinned, resolved, tuned, or pulled. hlock localize is just a migration that also goes local. Because the lock is a committed file, review what moves with hlock diff before you switch.

Read the hlock migrate guide
~/projects/my-app
$ hlock migrate --to codex
✓ wrote harness.codex.lock (from harness.lock)

⇄ harness.codex.lock · migrated
  harness  claude-code → codex
  llm      anthropic:opus → openai:gpt-5.5
  carried  2 MCP servers · 1 skill · 1 instruction

next → hlock sync harness.codex.lock
      → hlock launch --lock harness.codex.lock
~/projects/my-app

        

The meta harness

Let an agent do
the busywork.

Some jobs need judgment, not a script. hlock meta hands them to an agent, the meta harness, so you don't have to do them by hand.

  • installInstalls what the sync plan leaves to you, then runs hlock sync --yes.
  • bootstrap-evalsFills your eval packs with real tasks from your repo.
  • updateMoves skills, MCP servers, and plugins to their latest releases. --pin records it in the lock.

Use the built-in agent or a harness you already have (Pi, Codex, Goose, OpenCode, Hermes), with --local for open-weight models. It asks before every command, or runs --headless against an allowlist.

Read the meta harness guide
~/projects/my-app — CI
$ hlock check          # manifest ↔ lock in sync
✓ harness.lock matches harness.toml

$ hlock audit --ci
✗ SKILL.md:1:17  U+202E   (hidden text)
✓ 0 executables to approve · policy ok

$ hlock launch
▶ Claude Code in docker (network open)
    --cap-drop=ALL · ~/ and /var/run/docker.sock never mounted

Trust & containment

It's a lock, but is it
safe to run?

A lock you pull from someone else is a program you're about to run. hlock checks what a lock would place before you run it, then runs the agent where it can't touch the rest of your machine.

  • auditScans for hidden characters and executables, enforces your hlock-policy.toml, and writes an SBOM.
  • sandboxRuns the agent through Docker or OpenShell with no capabilities — your home dir and Docker socket are never mounted.
  • check --lockedFails the build if harness.toml and harness.lock drift, like uv sync --locked. audit --ci emits SARIF for code scanning.

The sandbox is recorded in the lock, so a teammate who pulls it gets the same one. In a shared repo, each contributor keeps their own harness.<handle>.lock, and hlock diff shows the text behind any digest that changed.

Read the audit & sandbox guides

Then make it better

A locked harness is a baseline.

Once your setup is reproducible, you can measure it. Every lock hlock resolves records its success rate, cost, and latency on your own tasks.

hlock resolve

Find the best stack for your tasks

Draft an eval pack from the sessions your agent already logged, list the models and harnesses to try in harness.toml, and lock the winner with its evidence.

success-rate ≥ 0.5 cost → success → locked: min-cost
Read the hlock resolve guide
hlock tune

Tune what's inside

Go past model choice into prompts, hyperparameters, and fine-tuned small models, on your evals. Run locally, on a devbox, or lift trials to a Flyte cluster for GPUs.

$ hlock tune --backend cluster --depth ft
Read the hlock tune guide
hlock upgrade

Stay current, automatically

New models and components come out all the time. hlock upgrade tells you which locked pieces have newer versions, re-measures the stack on your evals, and keeps the previous lock so you can roll back. If the success rate drops, it rolls back on its own.

$ hlock upgrade --all --apply
✓ planner qwen-7b → qwen-32b
Read the hlock upgrade guide

hlock cloud · early access

Rather not run the trials yourself?

hlock cloud can auto-tune your harness on your logged sessions and open a PR with the better lock.

Lock it in under a minute.

quickstart
$ pip install hlock
$ hlock pin                      # lock your current setup into harness.lock
$ git add harness.lock .hlock/   # version it (secrets are placeholders)
$ hlock check                    # see what changed since the pin
$ hlock sync                     # on another machine: rehydrate it
$ hlock launch                   # start a session on the locked setup

Open source · Apache-2.0 · Rust core with Python bindings · pip, uv, or cargo add hlock

hlock cloud · early access

Your harness,
stored and tuned in the cloud.

I'm interested in

One email when your spot opens. No spam, unsubscribe anytime.

01 A registry for harness.lock

Publish setups that work. Find proven ones, and pull one in a single command.

cloud.hlock.ai / registry
acme/review-botmcp · github3 skillsopus
you/strict-reviewermcp · linear2 skillsgpt-5
oss/review-localollama4 skillsruns offline
$ hlock pull acme/review-bot ✓ harness.lock · 3 skills · 1 mcp

02 Harness optimization, as a service

Point it at your logged sessions. It runs the trials and hands back a better lock, with evidence.

cloud.hlock.ai / acme / review-bot / optimize running trials
candidatestatus
claude-code · opusbaselinetrying✓ tried
codex · gpt-5-minitrying✓ tried
opencode · qwen3-codertrying✓ tried
claude-code · sonnet + tunedtrying✓ triedwinner
Opened a PR · update harness.lock