open source · MIT · Python · runs on your machine
Hand an agent a metric. Keep only what really moves it.
Hillclimb is a research loop for any problem you can score with a command. A coding agent tests one hypothesis at a time in an isolated git worktree. Hillclimb keeps a change only if it beats the current best by more than the noise, and only if it holds up on held-out data the agent never sees.
Step chart. The best dev score falls from 55.94 to 1.04 over 5 accepted changes; the held-out score of the best falls from 49.74 to 2.35.
01 / the loop
One hypothesis per attempt, scored on a clean checkout.
- BaselineYour metric command runs several times on the current code. The spread sets the noise margin.
- ProposeThe agent reads the goal, the journal of every past attempt (hypothesis, diff, score, why it lost) and the current best, then picks one idea nobody has tried.
- ImplementIt edits a git worktree branched from the best. It can run the dev metric itself. Nothing else is reachable.
- GuardThe diff is checked against your editable globs, frozen files are re-hashed, and planted caches and symlinks are refused.
- MeasureThe metric runs on a fresh checkout of the candidate, with frozen files restored from a pristine copy.
- GateA dev winner is scored once by your held-out command. A regression there blocks it.
- AcceptThe commit lands on
hillclimb/best. Your checked-out branch never moves.
[00:43:19] baseline 55.9394 (std 0 over 3 runs) [00:43:20] held-out baseline 49.7365 [00:43:20] best so far 55.9394; noise margin 0.25; 2 worker(s), backend claude [00:43:32] #1 hypothesis: Replace the 7-day mean/stdev rumination z-score with a 14-day median/MAD baseline that skips partial-coverage days (<0.6)... [00:43:35] #1 ACCEPTED: 55.9394 -> 13.062, held-out 18.5913; hillclimb/best now at 9791cb8c3a [00:43:36] #2 beat its parent but the best moved; replaying on 9791cb8c3a [00:43:53] #3 ACCEPTED: 13.062 -> 9.0393, held-out 12.5539; hillclimb/best now at fa65afa6de [00:43:58] #4 beat its parent but the best moved; replaying on fa65afa6de [00:44:11] #5 ACCEPTED: 9.0393 -> 6.2944, held-out 10.1581; hillclimb/best now at eda8cc4f09 [00:44:24] #6 hypothesis: Subtract the herd-wide median of today's per-animal multi-signal score from each animal's score, and do the same for yest... [00:44:28] #7 rejected: held-out gate: 12.6018 is worse than best held-out 10.1581 [00:44:28] #6 beat its parent but the best moved; replaying on eda8cc4f09 [00:44:35] #6 ACCEPTED: 6.2944 -> 1.4198, held-out 2.4916; hillclimb/best now at 8f97fa3b16 [00:44:57] #9 ACCEPTED: 1.4198 -> 1.0412, held-out 2.3479; hillclimb/best now at 7378421525 [00:45:13] run 1 done: iteration budget reached (10) baseline 55.9394 -> best 1.0412 (min)
02 / anti-cheat
The only way to win is to improve the code you meant.
An agent told to make a number go down will find the shortest path. Hillclimb closes the obvious ones before a score is counted. Each check below is covered by a test in the repository.
- Scope
- Every changed, added or deleted path must match an editable glob. Touch anything else and the attempt is rejected, and the path is named in the journal.
- Frozen files, hashed
- The scorer and its data are sha256-hashed from the base commit and re-hashed after every attempt. That catches edits hidden behind
git update-index --assume-unchanged. - Pristine scoring
- The metric never runs where the agent worked. It runs on a fresh checkout of the candidate commit, with frozen files rewritten from the pristine copy.
- No hidden files
- Ignored files are purged before checks, so a planted
.pyccan't shadow the scorer. Symlinks are refused. - Forbidden code
- Optional regexes, such as
open\(orimport os, are checked against every added line. - A sandboxed agent
claude -p --restricted --safe-mode: file tools stay inside the worktree, nothing loads from your machine's Claude config, and Bash runs only the exact commands you list.
What it can't stop: code inside the editable files that games your metric's meaning, such as a rule that reads labels at runtime. Keep the editable globs narrow and make the scorer check its inputs. The demo's scorer lints imports and file access. The held-out gate catches the rest.
03 / held-out gate
A second score the agent never sees.
Dev wins can be overfitting. Give Hillclimb a held-out command, and the tracked files it reads. Those files are removed from every agent worktree, and they exist on disk only in a gate checkout made after the agent has exited.
The held-out score is stored for you and stripped from the journal before any prompt is built. A blocked candidate reaches the next agent as "not kept after validation", and nothing more. The report counts how many times the gate was consulted, so you know how used up your held-out set is.
From the demo: experiment #7
Add 0.35 times the multi-signal score from two days ago to the existing today + 0.6×yesterday sum, so evidence over three days counts rather than two.
| before | after | verdict | |
|---|---|---|---|
| dev | 6.29 | 5.82 | better |
| held-out | 10.16 | 12.60 | worse: blocked |
How it appears in every later prompt:
#7 REJECTED score 5.8211 (best then 6.2944): Add 0.35 times the multi-signal score from two days ago to the existing today + 0.6×yesterday sum, so evidence over three days counts rather than two.
diff: alert_rule.py +2 -0
why: not kept after validation (details withheld)
04 / the demo, in full
Ten experiments on a herd alert rule, as they happened.
The problem is self-contained and synthetic. There are two 120-cow herds on two farms, with 150 days of collar data each. The data has everything that makes real alerts noisy: heat days, a weekly late feed truck, oestrus bursts, collar dropouts, and partial days. The score is false alarms per 100 healthy animal-weeks at the threshold that catches 80% of illnesses early. The agent could edit only alert_rule.py. These are the changes it kept:
- #1Replace the 7-day mean/stdev rumination z-score with a 14-day median/MAD baseline that skips partial-coverage days (<0.6) and sums clipped z-scores of rumination, activity and lying.55.94 → 13.06held-out 18.59
- #3Add 0.6 times yesterday's multi-signal score (computed from history before yesterday) to today's score, so persistent multi-day deviations count more than one-day blips.13.06 → 9.04held-out 12.55
- #5Compute each animal's median/MAD baseline from days 3–16 back, skipping the most recent 2 days, so the onset of illness doesn't contaminate its own baseline.9.04 → 6.29held-out 10.16
- #6Subtract the herd-wide median of today's per-animal multi-signal score from each animal's score, and do the same for yesterday's term. Weather and management shifts that hit the whole herd then cancel out, and only animal-specific deviations raise an alert.6.29 → 1.42held-out 2.49
- #9Widen each animal's median/MAD baseline window from 14 to 21 days (still skipping the latest 2 days and partial-coverage days), so the per-animal baseline is steadier and less affected by missing days.1.42 → 1.04held-out 2.35
hillclimb report: the morning report from this run. Open the real report · journal.json · final diff
hillclimb ui: the live dashboard, captured 43 seconds into the same run with two workers in flight.05 / quickstart
Point it at your repo.
You need Python 3.12+, uv and git, plus the Claude Code CLI, logged in. Hillclimb drives claude -p headless with your existing login, so no API key is needed. Your metric command prints {"score": x} or ends with a number.
# the demo, for real (about 2 minutes)
uv sync
./examples/alert-rule/setup.sh
uv run hillclimb run -c examples/alert-rule/hillclimb.toml
uv run hillclimb report -c examples/alert-rule/hillclimb.toml --open
# your project hillclimb init --metric "python3 eval.py --split dev" \ --direction max --editable "src/model/**" \ --frozen eval.py --frozen "data/dev/**" \ --heldout "python3 eval.py --split test" \ --heldout-path "data/test/**" hillclimb run # Ctrl-C any time; rerun resumes hillclimb ui --open # live dashboard git diff main hillclimb/best
The demo's hillclimb.toml, unedited
[project]
name = "herd-alert-rule"
repo = ".work/target"
state_dir = ".work/state"
best_branch = "hillclimb/best"
goal = """
Lower the false-alarm rate of a dairy-herd illness alert rule: false alarms per 100 healthy animal-weeks,
measured at a fixed 80% early recall. Read README.md for the data and the rules of the scorer, then
improve risk() in alert_rule.py. Ideas must generalize to a different herd on a different farm.
"""
[metric]
command = "python3 score.py --split dev"
direction = "min"
timeout_s = 180
[files]
editable = ["alert_rule.py"]
frozen = ["score.py", "generate.py", "README.md", "data/dev_*"]
# Belt and braces on top of score.py's own lint: no file or interpreter access in added code.
forbid_patterns = ['\bopen\(', 'import os', 'subprocess', '__import__', 'importlib', 'pathlib', 'heldout']
[heldout]
command = "python3 score.py --split heldout"
paths = ["data/heldout_*"]
policy = "gate"
tolerance = 0.0
timeout_s = 180
[noise]
repeats = 1
baseline_repeats = 3 # the scorer is deterministic; three runs prove it (std 0)
min_improvement = 0.25 # about 5 fewer false alarms on dev
sigmas = 2.0
[budget]
iterations = 8
wall_clock_minutes = 120
max_workers = 2
max_cost_usd = 0
[agent]
backend = "claude"
model = "claude-sonnet-5-5"
timeout_s = 1200
max_turns = 40
allowed_bash = ["python3 score.py --split dev"]
directions = [
"robust per-animal baselines and handling of missing or partial-coverage days",
"herd-level and weather context: separate what happens to one animal from what happens to the whole herd",
"combining rumination, activity and lying, and evidence across several days",
"telling illness apart from oestrus and other short benign bursts",
]