Skip to main content

Hone

Ask DeepWiki

Hone automates software optimization. Give it a goal and a benchmark. It rewrites your code until it wins.

It runs entirely in your terminal. It writes code, runs your benchmark, reads the score, and loops. It learns from its own tracebacks. It stops when it hits your target or exhausts its budget.

41x faster in 20 iterations. No human in the loop.

Inspired by Karpathy's autoresearch project.


How it works

Hone combines minimal orchestration with LLMs. Each experiment runs cleanly.

  • Statefulness — tracks cost, tokens, and git diffs per iteration
  • Self-healing — catches its own Python tracebacks and feeds them back into context
  • Simplicity — prefers simpler code over complex, marginal gains
  • Traceability — logs a chronological timeline of every hypothesis and benchmark score

Installation

pip install hone-ai

Or from source:

git clone https://github.com/laxmena/hone.git
cd hone
python -m venv venv
source venv/bin/activate
pip install -e .

You need a .env file with your API keys. Hone defaults to claude-haiku-4-5.


Usage

Define your goal and point Hone at your benchmark script.

hone "Optimize process_logs.py to run under 0.02 seconds. Think creatively." \
     --bench "python bench_logs.py" \
     --files "process_logs.py" \
     --optimize lower \
     --target 0.02 \
     --budget 2.0

For complex goals with detailed context, write them to a file and pass it with --goal-file:

hone --goal-file goal.md \
     --bench "python bench_logs.py" \
     --files "process_logs.py" \
     --optimize lower \
     --target 0.02 \
     --budget 2.0

--goal-file accepts any plain text or markdown file. It is equivalent to passing the file's contents as the GOAL argument — existing usage is unaffected.

Hone handles the rest.


Experiment 1: The Log Parser

A naive Python log parser. 150,000-line server log. Baseline: 1.54 seconds.

hone "Optimize process_logs.py to run under 0.02 seconds. Instead of tracking unique IP strings, implement a probabilistic data structure like a fast HyperLogLog to estimate IP uniqueness, or bypass loading string parts entirely." \
     --bench "python examples/log_parser/bench_logs.py" \
     --files "examples/log_parser/process_logs.py" \
     --optimize lower \
     --target 0.02 \
     --score-pattern "Time Taken:\s*(\d+\.\d+)" \
     --budget 2.0

Hone ran 20 iterations. It stripped slow Python dictionaries. It bypassed readlines(). It pre-bound set.add to skip attribute lookup overhead. It hit the ceiling of single-threaded Python at 0.07 seconds.

Then it changed the rules. It abandoned line-by-line parsing. It read the file as a raw binary blob. It deployed re.findall() across the entire content in one pass.

Final result: 1.54s → 0.037s. A 41x speedup.

Log parser optimization — 41x speedup over 20 iterations

Iter | Status | Score  | Description
...
18   | keep   | 0.0507 | The real bottleneck is the Python loop and split() calls. Try a compiled regex to extract endpoint in one operation...
19   | keep   | 0.0473 | Regex is faster. Use a simpler, more efficient pattern.
20   | keep   | 0.0370 | Try re.findall() to process the entire file at once and avoid line iteration overhead...

Run 1 report | Run 2 report


Experiment 2: The Distance Calculation

Real-time taxi dispatch. 500 riders, 1,000 drivers. Brute-force O(R×D) baseline: 2.18 seconds.

Run 1 — Hone built a spatial grid, bucketed drivers into cells, and used Manhattan distance pre-filtering to skip distant candidates. Result: 0.1496 seconds. A 14.6x speedup.

Run 2 — Hone found what Run 1 missed. The grid search still checked every candidate cell, even after finding a close driver. The fix: stop the moment you find one. Expand the radius incrementally instead of exhaustively. Result: 0.069 seconds. Another 2.1x.

The AI learned that algorithm beats data structure. Grid resolution barely mattered. Early termination dominated.

Distance calculation — two runs, 31x total speedup

Run 1 report | Run 2 report


Read more

Full write-up, learnings, and experiment breakdowns on the blog: I Built a Tool That Optimizes Code While You Sleep

Release files for hone-ai 1.2.1

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

Source distribution (sdist)

Source distribution for hone-ai 1.2.1
File Size Uploaded
hone_ai-1.2.1.tar.gz 65.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for hone-ai 1.2.1
File Interpreter ABI Platform
hone_ai-1.2.1-py3-none-any.whl Python 3 none any Details

Total release size: 85.4 kB

Release files / hone_ai-1.2.1.tar.gz

Download URL hone_ai-1.2.1.tar.gz
Size 65.7 kB
Tags Source
SHA-256 checksum
How to use checksums
3604c00fa459d6e22b395fdfa9e7dab6d26930101b5b0902ae5637d747ea1842
BLAKE2b-256 checksum
How to use checksums
3b8872e680d84c1fa140a9f7aca75d096ea9805862d02813a6345b0a0464d0b4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.9.6

Release files / hone_ai-1.2.1-py3-none-any.whl

Download URL hone_ai-1.2.1-py3-none-any.whl
Size 19.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1d3a9223fe216160bfe56af498604a95c6b2422b7ca0df382d0f34f9e012a647
BLAKE2b-256 checksum
How to use checksums
8c88d6589fc219ca90ef1fdfd8fec906c9cf2b3e4f8d4c82a31e52c90e409b27
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.9.6

Release history Release notifications | RSS feed

This release

1.2.1 This release

2 release files

1.2.0

2 release files

1.1.0

2 release files

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