harness.lock¶
The lockfile records an agent setup, pinned and hashed. hlock pin
writes one from the setup you already have; hlock resolve writes
one from a search over your tasks, along with the evidence for choosing it. Don't edit it
by hand, and do commit it.
Empty values, tables, and lists are omitted from the examples below for brevity. hlock show --json
prints the complete file.
Example: a pinned lock¶
This is the lock from the Quickstart, after the second pin:
# This file is generated by harness-lock. Do not edit by hand.
lock-version = 1
generated-by = "harness-lock 0.2.0"
kind = "pin"
[stack]
harness = "claude-code"
name = "claude-code"
selection = "pin"
[[llm]]
role = "default"
provider = "anthropic"
model = "opus"
resolved-from = "settings#/model"
[harness]
name = "claude-code"
version = "2.1.0"
config = "sha256:2ef17256801d474189d9c968d1dac48e152b7fe0f39b8f80cbd814cf27e716be"
[[tool]]
name = "github"
kind = "mcp"
source = "npm:@modelcontextprotocol/server-github"
transport = "stdio"
command = "npx"
args = ["-y", "@modelcontextprotocol/server-github"]
scope = "user"
[tool.env]
GITHUB_TOKEN = "${HLOCK_SECRET_GITHUB_GITHUB_TOKEN}"
[[tool]]
name = "linear"
kind = "mcp"
source = "remote"
transport = "http"
url = "https://mcp.linear.app/mcp"
scope = "user"
[[skill]]
name = "review-pr"
origin = "local"
digest = "sha256:15754ae3867d5e73b7ef22ced8ed2e0651cc50dfbe578f83799cf0507974df9e"
enabled = true
editable = false
scope = "user"
path = "{root}/skills/review-pr"
vendored = ".hlock/vendor/claude-code/skills/review-pr"
[[skill]]
name = "write-tests"
origin = "local"
digest = "sha256:7bd0fcc18c07b44f2c15902e531c8c47c8a906770c8a57762d1ba01804ef5633"
enabled = true
editable = false
scope = "user"
path = "{root}/skills/write-tests"
vendored = ".hlock/vendor/claude-code/skills/write-tests"
[[instructions]]
name = "{root}/CLAUDE.md"
digest = "sha256:562063f2a204882f0113c0fc8b89a9e4afc8ecae6c7a6c817337278233c61ec0"
scope = "user"
vendored = ".hlock/vendor/claude-code/instructions/CLAUDE.md"
[provenance]
backend = "pin"
scopes = ["project", "user"]
[[config]]
id = "settings"
path = "{root}/settings.json"
format = "json"
restore = "whole"
digest = "sha256:016233bf39184a6fb6080867efc467b0e121fd3bd56681cdac8f8e275cb1a6ef"
vendored = ".hlock/vendor/claude-code/config/settings.json"
[[config]]
id = "state"
path = "~/.claude.json"
format = "json"
restore = "pointers"
pointers = ["/mcpServers"]
digest = "sha256:b33482f12e0f1d7e62dc9190a2887a1c843d2388759829d2d8bf1255ad94cb92"
vendored = ".hlock/vendor/claude-code/config/state.pointers.json"
[[secret]]
name = "HLOCK_SECRET_GITHUB_GITHUB_TOKEN"
used-by = "mcp github GITHUB_TOKEN"
Example: a resolved lock¶
This is the lock from Finding the best stack:
# This file is generated by harness-lock. Do not edit by hand.
lock-version = 1
generated-by = "harness-lock 0.2.0"
manifest-hash = "sha256:9864f18edb96da298c8e782c79ee38cdc084466dba3f055c4901e3d5d6f7eff8"
[stack]
name = "demo"
selection = "min-cost"
[[llm]]
role = "planner"
provider = "reference"
model = "qwen-7b"
resolved-from = "reference:qwen-7b"
fingerprint = "sha256:5aa2f4197dd24bf9889327f484ae9e7edbc8da533621923fbcae65e99f01bb86"
[decision]
kind = "none"
[harness]
name = "reference"
pattern = "single-agent"
[policy]
retries = 1
max-steps = 40
human-approval = "never"
[context]
isolation = "locked-only"
[evidence]
eval-pack = "./evals"
eval-pack-version = "hlock-demo/evals@0.1.0"
eval-pack-digest = "sha256:1de30d21400e4ebc04033d646b314ba32a1d9011751712f92cba4ddce71d5e1e"
split = "holdout"
trials = 2
[evidence.success-rate]
mean = 1.0
search = 1.0
[evidence.cost-usd-per-task]
mean = 0.0001
[evidence.latency-s-per-task]
p50 = 0.5565
p95 = 0.655
[evidence.behavior]
trials = 2
input-tokens-per-task = 200.0
output-tokens-per-task = 50.0
[provenance]
backend = "local"
[provenance.search]
candidates = 4
holdout-trials = 2
strategy = "grid"
trials = 16
Top-level keys¶
| Key | Description |
|---|---|
lock-version |
Schema version. This release reads and writes 1. |
generated-by |
The harness-lock version that wrote the lock |
manifest-hash |
Hash of the harness.toml the lock was resolved from (for a pinned lock with declared dependencies, of its dependency sections only). Used by hlock check. |
kind |
pin for a pinned lock, localized for a localized one, migrated for a migrated one; absent for a resolved lock |
Sections¶
| Section | Contents |
|---|---|
[stack] |
Stack name, and the select rule that chose it |
[[llm]] |
One entry per role: provider, model, the candidate string it came from, a fingerprint, and params; and the reasoning effort when the manifest declares one. A lock whose effort isn't one of the manifest's levels doesn't load. |
[decision] |
Decision model kind, its decisions, and thresholds |
[harness] |
Harness name and pattern. For a harness with a profile, also the installed version, its install source (e.g. brew-cask:claude-code@2.1.285), and the adapter that ran the trials. |
[policy] |
retries, max-steps, human-approval, risky-actions, tool-allowlist, and [policy.sandbox]: the sandbox the lock runs in (runner, image, network, with hosts for an allowlist, secrets, applies-to, profile = { path, digest }, grader-image), from harness.toml's [sandbox]. Empty means none |
[context] |
Context isolation and compaction settings |
[[tool]], [[skill]], [[instructions]] |
MCP servers, skills, and instruction files, each with a source or digest. A pinned lock fills these in; see below. An [[instructions]] entry may have a role (guardrails, memory, tool-guidance) and sections, the roles it holds as ## Guardrails-style sections |
[[subagent]], [[script]], [[middleware]] |
Subagent definitions, helper scripts, and middleware files (OpenCode plugin files, Codex's .codex/hooks.json): name, path, digest, scope, vendored, format (middleware), source (tune when an optimizer wrote it), and scan. See Harness components |
[[decider]] |
One per decision model the stack uses (see below) |
[evidence] |
simulated = true when an agent CLI's trials ran on the reference harness rather than the agent itself. The eval packs measured: their paths (eval-pack), name@version (eval-pack-version), and a digest of every file in them (eval-pack-digest), which hlock check compares with the packs on disk, warning when they've changed. Then the split measured (holdout when resolve checked the winner on it, with the search score kept as success-rate.search; search otherwise), the trial count, and success-rate, cost, and latency statistics. out-of-tokens, when present, counts the trials that failed because the model ran out of tokens before answering; they count as failed in success-rate. [evidence.judge] records the judge of judge and trace graders: its model, the model that answered, its protocol, a fallback, the share of uncertain-grades, and cost-usd-per-task when |
the provider publishes a price. [evidence.sandbox] records what trials and graders ran in: the runner and network, the kinds that ran sandboxed (applies-to), and a note (agent-CLI trials are simulated). A lock without it predates sandboxes. [evidence.behavior] records how the agent worked, from the trials' traces: input-tokens-per-task, output-tokens-per-task, tool-calls-per-task, longest-silent-stretch (and -max), subagents-per-task, and two heuristics on the last message, approval-request-rate and early-stop-rate. A key is absent when no trace showed it; see How the agent worked. |
|
[verify] |
Runtime verification thresholds: canary-tasks, min-success-rate, fingerprint-tolerance |
[provenance] |
The backend that produced the lock, the search settings (candidates, the number of stacks; trials and holdout-trials run; cached, those reused), for a pinned lock the scopes it captured and any user-include patterns, and openapm ("0.1") when APM packages were resolved |
[[package]] |
APM packages declared dependencies resolved to (see below) |
[environment] |
What harness.toml's [environment] declares the agent needs installed (see below) |
[[secret]] |
The secrets the stack needs: placeholders a pin replaced, and those harness.toml's [[secrets]] declares (see below) |
[workspace] |
What harness.toml's [workspace] seeds the workspace with, each file digested (see below) |
[[command]] |
The slash commands harness.toml's [commands] declares: name, path, digest |
[project] |
harness.toml's [project] display-name and avatar, and the avatar's avatar-digest |
Pinned locks¶
hlock pin writes a lock with kind = "pin", no manifest-hash, and
no evidence. [provenance] scopes says what it captured: ["project"] by default, or
["project", "user"] with hlock pin --user or -i (see
Project and user scope). With -i,
[provenance] user-include lists the patterns that picked the user-level items.
hlock check re-captures the same selection. A pinned lock without scopes was written before scopes existed and
captured both. Its [[llm]] entries may carry endpoint and runtime; [[tool]] entries for
MCP servers carry transport, command, args, url, env, headers, scope and
enabled; [[skill]] entries carry scope, path and vendored. It adds:
| Section | Contents |
|---|---|
[[native]] |
Plugins, packages, extensions and marketplaces: kind (e.g. claude-code.plugin, pi.package), name, version, source, revision, integrity, enabled, config |
[[runtime]] |
Inference runtimes: name, location (local or network), version, source, endpoint, and [[runtime.model]] entries with id, source, revision, digest, size-bytes, present |
[[config]] |
Harness config files: id, path, format, restore (whole, pointers, record), pointers, digest, vendored |
[[secret]] |
Placeholders that replaced secrets: name (the environment variable that supplies it) and used-by, where the value was |
Scans¶
Each [[skill]], [[instructions]], [[config]], [[subagent]], [[script]] and [[middleware]] entry has a scan key: the
hidden-character scan of what it places. clean;
warnings:N (invisible characters such as zero-width spaces); critical:N (characters that
hide text, which sync won't place); or allowed:critical, when they were let through on
purpose with --allow-hidden (and are placed only once they're approved on the machine, by
hlock trust). A lock without scan keys was written by an older hlock, and hlock check
scans it.
A [[skill]] entry also has scripts: the files in the skill's scripts/ directory, which
run. hlock trust approves them by the skill's digest, and sync won't place a skill that
carries scripts its entry doesn't list. A lock without scripts was written by an older hlock:
a skill of it that isn't fetched yet is asked about, since what it runs can't be listed.
Declared dependencies¶
A [[skill]], [[tool]], [[instructions]] or [[native]] entry that
hlock add wrote, or that a harness.toml or apm.yml
declaration resolved to, has these keys besides its usual ones:
| Key | Description |
|---|---|
declared |
true: it's declared, not only found installed |
source |
The source as declared (github:acme/skills/skills/sql@^1.2). An [[instructions]] entry's name is where it's installed (.claude/rules/style.md) |
constraint |
The version range asked for (^1.2) |
resolved-tag, resolved-ref |
The tag a range matched, and the branch or tag the commit came from |
commit |
The git commit it's pinned to. sync fetches this commit and checks the entry's digest; the entry is never vendored |
version, integrity |
For an MCP server from npm or PyPI: the exact version and the package's integrity hash |
required-by |
For what a package brought in: the packages above it, the declared one first |
[skill.evidence] (and [tool.evidence], …) |
What hlock add --eval measured: eval-pack (the packs' digest), split, trials per side, baseline-success-rate, success-rate, the cost of each, and the digest it measured. check reports it as stale when the digest changes |
A [[package]] entry records an APM package: its name, source, digest (the package
tree's hash, computed as APM computes content_hash), depth (1 for one the project
declares), its apm.yml version and license, what it held that hlock doesn't install
(skipped: prompts, agents, hooks), and the same declared, constraint,
resolved-tag, resolved-ref, commit and required-by keys.
Declared environment and secrets¶
resolve, tune and sync record harness.toml's [environment]
and [[secrets]] in the lock, and pin keeps what the previous
pin recorded. sync --frozen fails when they differ from the manifest.
[environment]
apt = ["protobuf-compiler", "ripgrep"]
pip = ["ruff==0.6.9"]
[[environment.binaries]]
url = "https://example.com/tool-1.2.3-linux-x64"
sha256 = "0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef"
path = "/usr/local/bin/tool"
[[secret]]
name = "HLOCK_SECRET_GITHUB_TOKEN"
used-by = ["mcp:github", "skill:release"]
description = "Opens PRs on the user's behalf."
declared = true
[environment] has the manifest's keys: the package lists as declared, and each binary's
url, sha256 and path. hlock sync installs the package lists
through their installers (user-level ones automatically with --install; apt gives a
guided manual step) and reports a binary as satisfied only when the file at path hashes to
its pinned sha256. A step it can't do deterministically is manual and points at
hlock meta run install, the agentic fallback.
A declared secret's [[secret]] entry has these keys besides name, which is the
HLOCK_SECRET_… variable that supplies it:
| Key | Description |
|---|---|
used-by |
The declaration's used-by. A string when there's one value (as every lock before declared secrets has it), else a list. When the declaration gives none, the entry keeps the used-by a pin found |
optional |
true when the declaration says the stack runs without it |
description |
The declaration's description |
declared |
true: harness.toml declares it, not only a pin found it |
When a pin found a placeholder of the same name, the two are one entry. A secret no
longer declared leaves a resolved lock; a pinned one keeps the entry, undeclared, since the
pin may have placed its placeholder, until the next hlock pin.
Workspace, commands, profile and persona¶
resolve, tune and sync also record what harness.toml declares in
[workspace], [commands],
[context] profile and [project]
display-name and avatar, with the digest of each file they name, read when the lock is
written. pin keeps what the previous lock recorded, and sync --frozen fails when any of
it differs from the manifest, an edited command or seed file included.
[context]
profile = "forked"
[[workspace.repos]]
url = "https://github.com/org/repo"
ref = "main"
path = "src/repo"
[[workspace.files]]
path = "./seed/NOTES.md"
target = "NOTES.md"
digest = "sha256:a881945d52b92959c44a8fba023591cb966513b7689644586e52fbb67832ec9f"
[[command]]
name = "review"
path = "./commands/review.md"
digest = "sha256:6352ca70b5dbfc2d51bb53175ad1c02579fdba4835990fcfe856db8afaf9a4b1"
[project]
display-name = "RBAC reviewer"
avatar = "./avatar.png"
avatar-digest = "sha256:e1dd52c4fded473678d49aa9270d577e5a8fb064b45824dc1dd200427ec3cb52"
A directory in [[workspace.files]] has a tree digest, like a skill's. The lock records a
repository's ref as declared, not the commit it resolves to.
Localized locks¶
hlock localize writes a lock with kind = "localized",
base-lock naming the source lock, local [[llm]]/[[runtime]] entries, [[config]]
entries that point the harness at the local endpoint, and a [localize] table recording what
was replaced, the candidates considered, the memory budget, whether it was evaluated, and the
source lock's evidence as a baseline.
Migrated locks¶
hlock migrate writes a lock with kind = "migrated", base-lock
naming the source lock, the new [harness], [[skill]] and [[instructions]] entries at
the paths the new harness reads (with a vendored copy under .hlock/vendor/<harness>/migrate/<lock>/
when they moved), [[decider]] wiring for its hooks, a [[config]] entry that sets its model
and MCP servers, and a [migrate] table: the harness it came from, how many of each part
carried over, what was replaced, notes on what didn't carry, and the source's evidence as a
baseline. Its own [evidence] is empty until you resolve it.
harness.tune.lock¶
hlock tune writes a separate tune lock with the same shape,
plus what tuning produced: the chosen hyperparameters, applied prompts, fine-tune
adapters, the data split, and the budget, all content-addressed. Adopt it into
harness.lock with hlock tune apply, which keeps the old lock in harness.lock.prev.
[tune.hpo] records the grid's axes (with effort when it searched effort levels) and
the best configuration.
[tune.hpo] records the grid's axes, its size, and the best configuration. When the
tuned model rejects temperature (see model parameters),
[tune.hpo.skipped] says so, and the model's params have no temperature.
When the optimize stage ran, [tune.optimizer]
records the optimizer, the backend that hosted its search, what it could edit, its budget
and usage, and a digest of the splits;
[tune.acceptance] records the noise band, the paired test run (base, candidate,
better, worse, p) and its cost, and why edits weren't accepted. Each accepted edit is
a [[tune.edit]] (component, kind, op, before, after, path, rationale), and
the lock's [[instructions]] (with source = "tune") or [[skill]] entry points at its
file under .hlock/tuned/.
harness.meta.lock¶
hlock meta pin writes the meta harness's lock: a pinned lock
(kind = "pin") of hlock's built-in agent, or of an installed harness's own config root.
See the harness.meta.toml reference for what it
records.
harness.lock.prev¶
hlock upgrade --apply saves the previous lock here so
hlock upgrade --rollback can restore it. You can commit it or ignore it.
[[decider]]¶
| Key | Description |
|---|---|
use |
What it decides: approve, stop, route, tool |
provider, model |
The decision model, as the provider names it |
protocol |
systemone or decisions |
endpoint, key-env |
Where it's reached, and the variable its API key is read from. Used only when they're on this machine, the provider's own, or what your harness.toml sets (why) |
runtime |
The local runtime serving it (ollama, ollaya) |
resolved-from |
The harness.toml reference it came from, or the harness setting pin read |
via |
hook (hlock wires it in), native (a setting of the harness's own), env (code harnesses), simulated (the reference harness) |
[[decider.wiring]] |
Where it's wired: the profile's file and the harness event |
may, min-probability, timeout-ms |
What it may answer, how sure it must be, how long a hook waits |
questions |
A digest of hlock's questions for the use; a newer hlock with other questions is drift |
[decider.policy] |
The policy file's path and digest |
Checks¶
A lock can come from someone else's repository (hlock pull), so hlock
checks every lock it reads, before using any of it, for values that become paths or
command-line words:
| Value | Must be |
|---|---|
[harness] name, [[skill]] name |
A plain name: no /, \, or .. |
vendored (skills, instructions, config), [decider.policy] path |
A relative path inside the project: no leading /, no .. |
[harness] version, [[native]] version, [[runtime]] name, version, and each model's id, source and revision, [[llm]] runtime, [[decider]] model, runtime and wiring event |
Letters, digits and ._:/@+-, not starting with - |
[[decider]] use |
approve, stop, route, or tool |
[[secret]] name |
HLOCK_SECRET_ and letters, digits and _ |
[environment] package lists |
One word each, not starting with - |
[environment] ignore |
Program names: no /, spaces, or leading - |
[[environment.binaries]] |
An http(s) url, a sha256 of 64 lowercase hex digits, and an absolute path with no .. |
[[workspace.repos]] |
An https, http, ssh or git@ url; a ref of letters, digits and ._:/@+-, not starting with -; a relative path with no .. |
[[workspace.files]] |
Relative path and target with no .., each place seeded once, and a sha256: digest |
[[command]] |
A name of letters, digits and -_., not starting with - or ., recorded once; a relative path with no .. |
[context] profile |
shared, forked or none |
[project] |
A one-line display-name; a relative avatar with no ..; a sha256: avatar-digest |
A lock that fails a check isn't read: the error names the field. hlock writes locks
atomically (a temporary file, then a rename), and leaves out JSON nulls, which TOML
can't hold.