Hillclimb
An AI research loop that hill-climbs one measurable metric in your repo. Site: https://hillclimb-2zy.pages.dev
You give it a command that prints a score, the files it may change, and optionally a
held-out command. Hillclimb asks a coding agent for one hypothesis at a time. The agent
implements it in an isolated git worktree, and Hillclimb measures the result on a
pristine checkout. A change is kept only if it beats the current best by more than the
noise margin and does not regress the held-out score, which the agent never sees.
Accepted changes are committed to hillclimb/best. Your checked-out branch is never
touched.
$ uv run hillclimb run -c examples/alert-rule/hillclimb.toml -n 10
[00:43:19] baseline 55.9394 (std 0 over 3 runs)
[00:43:20] held-out baseline 49.7365
[00:43:35] #1 ACCEPTED: 55.9394 -> 13.062, held-out 18.5913; hillclimb/best now at 9791cb8c3a
...
[00:44:28] #7 rejected: held-out gate: 12.6018 is worse than best held-out 10.1581
[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)
That excerpt is from the real demo run in examples/alert-rule.
It is a synthetic dairy-herd illness alert, scored as false alarms per 100 healthy
animal-weeks at a fixed 80% early recall, with Claude Sonnet as the agent:
| baseline | best | change | |
|---|---|---|---|
| dev (agent can run it) | 55.94 | 1.04 | -98.1% |
| held-out (agent never sees it) | 49.74 | 2.35 | -95.3% |
There were 10 experiments: 5 accepted and 5 rejected. Of the rejections, 1 was
blocked by the held-out gate after winning on dev, 2 didn't clear the margin, 1
conflicted with a newer accepted change, and 1 was reverted by the agent itself after
it measured a loss. Active time was 1.9 minutes, and the
agent cost $0.44 as reported by the Claude CLI. Full outputs are in
examples/alert-rule/results/: the report, the journal,
the final diff and the run log.
Quickstart
Requirements: Python 3.12+, uv, git, and the
Claude Code CLI logged in (claude
on your PATH). No API key is needed. Hillclimb uses your Claude Code login.
git clone <this repo> hillclimb && cd hillclimb
uv sync
# Run the demo for real (about 2 minutes, 10 Sonnet calls):
./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
On your own project:
cd your-repo
uv run --project /path/to/hillclimb 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/**"
# edit the goal in hillclimb.toml, then:
uv run --project /path/to/hillclimb hillclimb run # Ctrl-C any time; rerun to resume
uv run --project /path/to/hillclimb hillclimb ui --open # live dashboard on 127.0.0.1:8765
uv run --project /path/to/hillclimb hillclimb report # morning report: HTML + markdown + journal.json
git diff main hillclimb/best # what it found
Your metric command must print {"score": <number>, ...} or end with a bare number.
Commands
| command | what it does |
|---|---|
hillclimb init |
write a commented hillclimb.toml |
hillclimb run |
measure the baseline, then run the loop. Resumes the latest unfinished run. --new, -n, -w, --minutes, --model, --backend |
hillclimb report |
report.html, report.md, journal.json: score over time, accepted diffs with rationale, rejected ideas, dev vs held-out, cost and time |
hillclimb ui |
local live dashboard, standard library HTTP server, refreshes every 3 s |
hillclimb status |
a few lines in the terminal |
What keeps it honest
- Scope and frozen files. The diff may only touch
editableglobs.frozenfiles are sha256-hashed from the base commit, re-hashed after every attempt, and restored from a pristine copy before every score. Ignored files are purged so planted caches can't shadow code. Symlinks andforbid_patternsin added lines are rejected. - Fresh checkouts. The metric never runs in the agent's worktree. It runs in a new checkout of the candidate commit.
- Held-out isolation. Held-out files are removed from the agent's worktree and
exist only in a gate checkout made after the agent exits. Held-out scores are
stripped from the journal before any prompt is built. A gate rejection reads "not
kept after validation (details withheld)". The agent runs under
claude -p --restricted --safe-mode, so its file tools can't leave the worktree, and Bash is limited to the exact commands you allow. - Noise. The baseline is repeated to estimate σ. A candidate must win by
max(min_improvement, sigmas·σ·sqrt(2/repeats)). - Parallel workers share the journal and see each other's in-flight ideas. A win found on an older best is replayed onto the newer best and measured again. Byte-identical patches aren't measured twice.
- Resumable. Everything is in SQLite. A crash or Ctrl-C marks in-flight attempts
interrupted, and the nextruncleans up and continues.
Details: docs/how-it-works.md. Every config key: docs/config.md.
Backends
claude(default): Claude Code CLI in headless mode. Models:claude-sonnet-5-5(default),claude-opus-5-5,claude-haiku-5-5.command: any program. It gets the prompt on stdin, edits its working directory, and may print{"hypothesis": ...}.fake: scripted, deterministic edits for tests and dry runs.
Development
uv run pytest # 56 tests; uses the fake backend, no network
License
MIT