Metadata-Version: 2.4
Name: handyhank
Version: 1.3.0
Summary: Your coding agent draws the plans; Hank does the work — a local LLM executes tasks inside a sandbox while the foreman designs and inspects.
Author: Handy Hank contributors
License-Expression: MIT
Project-URL: Homepage, https://github.com/Fr3nky88/handy-hank
Project-URL: Repository, https://github.com/Fr3nky88/handy-hank
Project-URL: Issues, https://github.com/Fr3nky88/handy-hank/issues
Project-URL: Changelog, https://github.com/Fr3nky88/handy-hank/releases
Keywords: llm,local-model,agent,sandbox,mcp,lm-studio,claude-code
Classifier: Environment :: Console
Classifier: Intended Audience :: Developers
Classifier: Operating System :: POSIX :: Linux
Classifier: Operating System :: MacOS
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Classifier: Topic :: Software Development
Requires-Python: >=3.10
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: PyYAML>=6.0
Provides-Extra: images
Requires-Dist: Pillow>=10.0; extra == "images"
Dynamic: license-file

<p align="center">
  <img src="https://raw.githubusercontent.com/Fr3nky88/handy-hank/main/docs/assets/banner.svg" alt="Handy Hank: your coding agent draws the plans, Hank does the work on your own GPU">
</p>

<p align="center">
  <a href="https://github.com/Fr3nky88/handy-hank/actions/workflows/ci.yml"><img src="https://github.com/Fr3nky88/handy-hank/actions/workflows/ci.yml/badge.svg" alt="CI"></a>
  <a href="https://pypi.org/project/handyhank/"><img src="https://img.shields.io/pypi/v/handyhank?label=pypi&color=blue" alt="PyPI version"></a>
  <a href="https://pypi.org/project/handyhank/"><img src="https://img.shields.io/pypi/pyversions/handyhank?color=blue" alt="Python versions"></a>
  <img src="https://img.shields.io/badge/platform-linux%20%7C%20macos-lightgrey" alt="Platforms: Linux, macOS">
  <a href="https://github.com/Fr3nky88/handy-hank/blob/main/LICENSE"><img src="https://img.shields.io/badge/license-MIT-green" alt="License: MIT"></a>
  <a href="https://github.com/Fr3nky88/handy-hank/stargazers"><img src="https://img.shields.io/github/stars/Fr3nky88/handy-hank?color=yellow" alt="GitHub stars"></a>
</p>

# Handy Hank

**Your coding agent draws the plans. Hank does the work.** A local model runs the task inside a sandbox, checks its own
work against the spec's checks and reports back; your agent spends its tokens only on the design and the review.

```sh
pipx install handyhank                                               # the worker
claude plugin install handy-hank --marketplace Fr3nky88/handy-hank   # the skill and the MCP server for Claude Code
```

Codex, Copilot CLI, Gemini CLI and OpenCode work too ([Using Hank from your coding agent](#using-hank-from-your-coding-agent)).

## Contents

- [What it is](#what-it-is)
- [How it works](#how-it-works)
- [Features](#features)
- [Requirements](#requirements)
- [Quickstart](#quickstart)
- [Configuration](#configuration)
- [The task spec](#the-task-spec)
- [Commands](#commands)
- [Using Hank from your coding agent](#using-hank-from-your-coding-agent)
- [Security](#security)
- [Real work: Hank built Hank](#real-work-hank-built-hank)
- [Benchmarks](#benchmarks)
- [How Hank was tuned](#how-hank-was-tuned)
- [Limitations](#limitations)
- [Tips](#tips)
- [FAQ](#faq)
- [Contributing](#contributing)
- [Star history](#star-history)
- [License](#license)
- [Acknowledgements](#acknowledgements)

## What it is

Handy Hank lets a frontier coding agent — Claude Code, Codex CLI, Gemini CLI, Cursor, OpenCode and others — act as architect, foreman and inspector while a local LLM does the actual work on your machine. The goal: spend frontier-model tokens only on design, decisions and review; let a local GPU do the legwork.

Any task, not only code: documents, research, data analysis, media (video, images, 3D) through scripts and command-line tools. "Local" means cheap and open, not necessarily on the same machine — any OpenAI-compatible endpoint works (LM Studio, llama.cpp `llama-server`, Ollama, vLLM, a hosted open-model provider); API keys only via environment variables.

## How it works

The foreman writes a spec in YAML — the goal and the checks that prove it is done. `hank run` executes it as an agent loop with native tool calling against any OpenAI-compatible server, inside a sandbox. The worker runs the checks itself; finishing is refused while one fails. At the end Hank prints a short report: status, steps and segment, model summary, checks, outputs, changed files and local token usage. The foreman reviews it and records a verdict (`hank verdict <id> pass|fail "note"`).

```
foreman agent (Claude Code, Codex CLI, Gemini CLI...)
        | writes spec.yml: goal + checks
        v
   hank run spec.yml
        | agent loop with native tool calling, inside a sandbox
        v
local model server (LM Studio, llama.cpp, Ollama, vLLM)
        | the worker runs the checks itself; finish is refused while one fails
        v
report on stdout -> foreman reviews -> hank verdict pass|fail
```

What the foreman reads at the end, from a real run of the small model on one RX 6900 XT:

<p align="center">
  <img src="https://raw.githubusercontent.com/Fr3nky88/handy-hank/main/docs/assets/run.svg" alt="The output of hank run slugify.yml: status done after 7 steps and 1.5 minutes, the model's summary, the tests check OK and the new files" width="850">
</p>

## Features

- Any task, not only code — documents, research, data analysis and media through scripts and command-line tools. Domain lessons (video, 3D, docs, data, research) are picked by `topics:` in the spec.
- Sandboxed commands — the whole filesystem read-only except the project, the run's tmp, package caches and `writable_dirs`; your home hidden but for its toolchains and `readable_dirs`; credentials hidden; git read-only; Docker blocked unless `allow_docker: true` (details under Security).
- Checks gate finish — shell commands or judge checks defined in the spec; `finish` is refused while one fails.
- Staged specs — `steps:` split a long task into steps, each with its own goal and optional checks; a finished step restarts the conversation at the next one.
- Dynamic budget segments — when a segment's `max_steps` runs out, the checks are scored and the run gets another segment while they improve (at most 4), else it pauses for the foreman.
- Stall detection — repeated action, repeated error, monologue and ping-pong patterns trigger a warning, then a pause.
- Guards by effect — a step is progress only when it changed the content of a file of the work; after 12 steps without one (small profile) reads are blocked and a command's output is withheld; a bash command that puts files the run changed back to an older version (committed, or as at the run's start) is named in its result, and their content from before is saved under the run's tmp (hank-saved) to copy back; after each edit_file or write_file the project's own formatter runs on the file.
- Lessons per topic, profile and model — short facts injected into the system prompt; `hank lesson` adds one after each correction.
- Judge checks — for results only a viewer can verify (a chart is readable): a fresh request to the worker's or another model with criteria and files.
- Run history — every run recorded in its own folder (state, events, log); `hank stats` numbers per run, `--card` report card, `hank cost` foreman-side token ledger.
- Agent-agnostic — the CLI works with any agent that can run shell commands; an Agent Skill teaches the foreman when to delegate and how to write specs.

## Requirements

- Linux with bubblewrap (`bwrap`), or macOS (its `sandbox-exec` runs the sandbox; checked in CI only). On Windows, run
  Hank inside WSL2 (not tested): see the FAQ.
- Python 3.10 or newer
- A GPU that runs a model with tool calling. Speed depends on the hardware and results on the model it can run: every
  number in this README comes from one AMD RX 6900 XT (16 GB) running inkling-2-mini, a small model.
- An OpenAI-compatible model server with a local model loaded — LM Studio, llama.cpp `llama-server`, Ollama, vLLM; API keys only via environment variables
- Optional: Node + playwright-core for the browser tool; Pillow for image downscaling

## Quickstart

1. Install Hank:

   ```sh
   pipx install handyhank        # or: uv tool install handyhank
   ```

   or the latest code from GitHub: `pipx install git+https://github.com/Fr3nky88/handy-hank`

2. Start a model server such as LM Studio and load a model that supports tool calling. LM Studio's endpoint is `http://localhost:1234/v1/chat/completions`, the package default.

3. Write the config file `~/.config/handyhank/config.yml` (it overrides the package defaults), with the model's id as the server lists it (`curl http://localhost:1234/v1/models`):

   ```yaml
   url: http://localhost:1234/v1/chat/completions
   model: your-model-id
   profile: small
   ```

   Then run `hank doctor`: it sends the model a few small requests and checks the machine, and says how to fix what is
   missing.

4. Write a spec outside the work folder — for example `spec.yml` in your home directory or /tmp, with an absolute path to the project:

   ```yaml
   title: add stopwords to wordfreq
   repo: /absolute/path/of/the/work/folder
   goal: |
     Add a --stopwords FILE option to the CLI that removes those words from the report.
     Keep the existing tests passing.
   checks:
     - name: tests
       cmd: python3 -m unittest -q
   ```

5. Run it — `hank run spec.yml` runs until done or paused and prints the report at the end:

   ```sh
   hank run spec.yml
   ```

   Exit codes: 0 = done, 3 = paused for the foreman (a question, out of steps, a stall, a server error), 1 = failed.

## Configuration

The config file is `~/.config/handyhank/config.yml` (or `$HANDYHANK_CONFIG`); the package defaults in `src/handyhank/default_config.yml` are overridden by it. Every key:

| Key | What it does | Example |
|---|---|---|
| `url` | Chat completions endpoint of the model server (package default: `http://localhost:1234/v1/chat/completions`) | `url: http://localhost:1234/v1/chat/completions` |
| `model` | The model name sent to the server (default: `local-model`) | `model: local-model` |
| `sandbox` | Run commands in the sandbox (bubblewrap on Linux, sandbox-exec on macOS); set `false` only if you accept no isolation (default: `true`) | `sandbox: true` |
| `vision` | Whether the worker can see images (default: `false`) | `vision: false` |
| `language` | Language of the summaries and reports (default: `en`) | `language: en` |
| `web_search` | How web search works: `foreman` (default; pauses for the foreman to search), `searxng` (needs `url`) or `brave` (needs `key_file`) | `web_search: {backend: foreman}` |
| `models` | Several OpenAI-compatible endpoints; each entry can set `url`, `model`, `profile`, `context_tokens` and `api_key_env`. The spec's `model:` picks one (default: the first in file) | see below |
| `default_model` | Which configured model is used when the spec does not pick one (default: the first entry of `models`, else the top-level settings) | `default_model: local` |
| `profile` | `small` (default) / `medium` / `large` — sets max steps per segment, explore budget, plan cadence and stall thresholds | `profile: small` |
| `context_tokens` | Tokens the model is loaded with; read from LM Studio, llama.cpp, Ollama or vLLM when possible, else 32k assumed with a warning — set it for servers that report nothing (default: none) | `context_tokens: 32768` |
| `api_key_env` | Name of an environment variable holding the API key — sent as a Bearer token, never stored in the config file (default: none) | `api_key_env: OPENAI_API_KEY` |
| `extra_body` | Extra JSON fields merged into every request body (default: `{}`) | `extra_body: {top_p: 0.9}` |
| `send_reasoning` | Whether reasoning content is sent back to the model (default: `false`) | `send_reasoning: false` |
| `temperature` | Sampling temperature (default: `0.2`) | `temperature: 0.2` |
| `max_tokens` | Reply cap per request in tokens (default: `24000`) | `max_tokens: 24000` |
| `timeout` | Seconds per request (default: `1800`) | `timeout: 1800` |
| `retry_waits` | Waits between retries on server errors, in seconds (default: `[5, 20, 60]`) | `retry_waits: [5, 20, 60]` |
| `format` | A formatter command per file suffix, with `{file}` for the file's path, run on each file Hank edits; an empty value turns one off (default: none — ruff, black, prettier, gofmt and rustfmt run when the project configures them) | `format: {.java: "google-java-format -i {file}"}` |

Several endpoints — the top level keeps working as a single "default" model; with `models`, the spec's `model:` picks one and `default_model` sets the fallback:

```yaml
url: http://localhost:1234/v1/chat/completions
model: local-model
profile: small
models:
  fast:
    url: http://localhost:1234/v1/chat/completions
    model: local-model
    profile: small
  big:
    url: https://api.example.com/v1/chat/completions
    model: open-large
    api_key_env: OPENAI_API_KEY
default_model: fast
```

### Formatters

A `format` mapping runs the project's own formatter on each file Hank edits — one line per language:

```yaml
format:
  .py: "ruff format {file}"        # or black -q {file}
  .js: "node_modules/.bin/prettier --write {file}"
  .ts: "node_modules/.bin/prettier --write {file}"
  .go: "gofmt -w {file}"
  .rs: "rustfmt --edition 2021 {file}"
  .java: "google-java-format -i {file}"
  .md: ""                           # none
```

The defaults run only when the project configures the tool and its binary is there, in a place the sandbox shows: ruff for a [tool.ruff] or [tool.ruff.*] table in pyproject.toml, a ruff.toml or .ruff.toml; black for [tool.black] in pyproject.toml; prettier for a .prettierrc*, prettier.config.js/.mjs/.cjs or prettier in package.json, with node_modules/.bin/prettier; gofmt for go.mod; rustfmt for Cargo.toml; never a formatter the project does not use, since it would rewrite the whole file. A formatter that fails or is missing is noted in the tool's result and never blocks the edit. A formatter does not split long strings, so keep long texts in constants — measured: in task 21 about 40 steps went to cutting long lines for ruff's E501 one edit at a time.

## The task spec

The foreman writes the spec in YAML, outside the work folder. Every field (one line each):

- `title` — short name of the task; shown in reports and `hank list`. Example: `title: add stopwords to wordfreq`
- `repo` — absolute path of the work folder (a repository or a plain folder). Example: `repo: /absolute/path/of/the/work/folder`
- `goal` — what "done" means, in prose; the first thing in the task message. Optional when every step has its own goal. Example: see the Quickstart spec
- `acceptance` — list of strings shown as acceptance criteria bullets (not enforced by code). Example: `acceptance: [tests pass, README updated]`
- `checks` — list of checks that gate finish; each has a `name` and either a `cmd` or a `judge` (see below). Example: see the Quickstart spec
- `steps` — optional staged plan; each step has its own `goal` and optional `checks`, run in order. Example: `steps: [{goal: part 1}, {goal: part 2}]`
- `outputs` — list of paths (relative to the project) that must exist and be non-empty at finish. Example: `outputs: [report.md]`
- `context_files` — list of files (relative to the project) whose content is injected into the first message. Example: `context_files: [README.md]`
- `topics` — list of domain topics; picks the lessons injected into the system prompt and, for media tasks, the toolkit. Example: `topics: [docs]`
- `tools` — extra tools to send, besides the core tools and those of the topics. Example: `tools: [browser]`
- `model` — picks one of the configured models from the config's `models:` section. Example: `model: fast`
- `worktree` — run in a git worktree instead of the project folder (default: false). Example: `worktree: true`
- `branch` — the new branch for the worktree, created from `base` (default: `handyhank/<run id>`). Example: `branch: hank/add-stopwords`
- `base` — git ref to create the worktree branch from (default: HEAD). Example: `base: main`
- `commit` — commit the changes at the end of a successful run (default: false). Example: `commit: true`
- `writable_dirs` — extra directories writable inside the sandbox, in addition to the project and caches. Example: `writable_dirs: [/tmp/scratch]`
- `readable_dirs` — folders of your home that the task may read, since the sandbox hides the rest of it. Example: `readable_dirs: [~/data/sales]`
- `env` — environment variables for the task's commands (e.g. `LC_NUMERIC=C` is set by default; override with this). Example: `env: {MY_VAR: value}`
- `allow_docker` — allow Docker inside the sandbox (default: false). Example: `allow_docker: true`
- `network` — `false` takes the network away from the task's commands (each keeps its own loopback on Linux; on macOS it can still reach this machine's localhost) and from Hank's web tools. Example: `network: false`
- `secrets` — names of variables in Hank's environment that the task's commands may use; their values read `[secret NAME]` in everything the foreman sees (`hank run`, `resume`, `status`, `report`, `watch`, report.md, events.jsonl, log.txt). They stay in the run's state.json, on this machine. Example: `secrets: [DB_PASSWORD]`
- `private` — `true` for data that must not leave your network: no network, as above, and `hank run` refuses the task unless the model and the judge model are on this machine or its local network. Example: `private: true`
- `judge_model` — picks one of the configured models for judge checks (default: the worker's model). Example: `judge_model: big`
- `max_steps` — overrides the profile's steps per segment; the profile's other knobs (`max_explore`, `plan_every`, `max_segments`, the `stall_*` thresholds) can be overridden the same way. Example: `max_steps: 40`
- `format` — a formatter command per file suffix for this task; it wins over the config's. Example: `format: {.py: "ruff format {file}"}`

Each check in `checks:` (and each step's own `checks:`) has a `name` and either a `cmd` or a `judge`:

- `name` — name of the check; shown in reports. Example: `name: tests`
- `cmd` — shell command for a check; must exit 0 (default timeout 1500 s). Example: `cmd: python3 -m unittest -q`
- `judge` — criteria string for a judge check: a fresh request to the worker's or another model with these files and this question. Example: `judge: "The chart is readable..."`
- `files` — list of paths (relative to the project) attached to a judge check; missing files fail it. Example: `files: [chart.png]`
- `timeout` — seconds before a command check fails (default 1500). Example: `timeout: 600`

A full spec with steps and checks looks like this:

```yaml
title: add stopwords to wordfreq
repo: /absolute/path/of/the/work/folder
goal: |
  Add a --stopwords FILE option to the CLI that removes those words from the report.
steps:
  - goal: implement the flag and its tests
    checks: [{name: unit-tests, cmd: python3 -m unittest -q test_cli}]
  - goal: update the README with the new option
checks: [{name: all-tests, cmd: python3 -m unittest -q}]   # run when the last step finishes
```

## Commands

| Command | What it does |
|---|---|
| `hank run spec.yml [--background]` | Start a task; prints the report at the end, or with `--background` the run id at once while the run goes on detached |
| `hank resume <id> [answer]` | Resume a task paused on a question (or with `--answer-file FILE`); `--background` as for run |
| `hank say <id> [text]` | Queue a note for a running task, or `--stop` to stop it (a resumable pause); refused once the run has ended |
| `hank verdict <id> pass\|fail [note]` | Record the foreman's verdict on a run after reviewing it |
| `hank report <id>` | Print the full report of a run (stdout) |
| `hank status <id>` | A snapshot of a run, with no model call: status, steps, minutes, tokens, the last steps and the question if it paused |
| `hank watch <id>` | Follow a running task; `--steps` also prints step events |
| `hank list` | List all runs with their status and title |
| `hank lesson <topic> <text...>` | Add a lesson for a topic (e.g. `video`, `3d`) to the system prompt |
| `hank stats [--json] [--card] [--sessions PATH...] [ids...]` | Numbers per run, with the foreman's review: minutes from the run's end to its verdict, and the foreman's tokens in that time, from its Claude Code session logs (by default this folder's project); `--card` prints one row per model |
| `hank cost [--since SINCE] [--until UNTIL] [--json] [paths...]` | Token usage in the foreman's session logs (each API call once); defaults to the newest Claude Code session of the current folder |
| `hank doctor [--model NAME \| --all] [--json]` | Check the setup: probe the model live — does it answer, call tools, where its reasoning comes back, the time to the first token and the tokens per second after it (one streamed request), the request field that makes the model think less, whether the chat template renders the reasoning sent back (send_reasoning), whether the server accepts images (vision) and the quantization the server reports — then the machine (the sandbox, ffmpeg, OpenSCAD, Node, playwright-core, Pillow, the web search backend); `--all` checks every configured model first; a fix for each problem, never a config change; exit code 1 when a check fails. See [Model server setup](https://github.com/Fr3nky88/handy-hank/blob/main/docs/MODEL-SERVER.md) |
| `hank mcp` | An MCP server on stdio over these commands, for agents that call tools (see "Using Hank from your coding agent") |

## Using Hank from your coding agent

Install Hank first (see the Quickstart). The plugin then gives your agent two things: the skill, which says when to
delegate and how to write a spec, and the MCP server `hank mcp`, for agents that call tools rather than shell
commands. The same repository serves every agent below.

| agent | install | checked |
|---|---|---|
| Claude Code | `claude plugin install handy-hank --marketplace Fr3nky88/handy-hank` in a terminal; in a session, `/plugin marketplace add Fr3nky88/handy-hank`, then `/plugin install handy-hank@handy-hank` | used for every measurement in this README; a whole task run through `hank mcp`; the one-command install checked from a local copy |
| Codex CLI | `codex plugin marketplace add Fr3nky88/handy-hank`, then `codex plugin add handy-hank@handy-hank` | installed from a local copy; Codex 0.174 connects to `hank mcp`. With a local model Codex hides MCP tools behind its tool search, so the model used Hank through the CLI; not tried with an OpenAI model |
| GitHub Copilot CLI | `copilot plugin marketplace add Fr3nky88/handy-hank`, then `copilot plugin install handy-hank@handy-hank` | installed from a local copy: the skill and the MCP server are registered |
| Gemini CLI | `gemini extensions install https://github.com/Fr3nky88/handy-hank` | the extension validates |
| OpenCode | copy `skills/handy-hank` to `~/.config/opencode/skills/` and add the server below to `~/.config/opencode/opencode.json` | a whole task run through `hank mcp`, with a local model as OpenCode's own |
| any other agent | the CLI through its shell, or `hank mcp` as a stdio MCP server | |

OpenCode's MCP block:

```json
{"mcp": {"servers": {"hank": {"type": "local", "command": ["hank", "mcp"]}}}}
```

A call such as `hank_wait` can take minutes. The plugin asks for a 600-second timeout where the agent reads one; Codex
uses its own default of 60 seconds unless you set `tool_timeout_sec` under `[mcp_servers.hank]` in
`~/.codex/config.toml`.

The foreman writes the spec, reviews the report and records the verdict; Hank never decides what to do or whether it
is done.

## Security

The local model runs commands without a human approving each step, so the worst case must stay small: a mistake or a prompt injection can only touch the project. The sandbox (bubblewrap on Linux, sandbox-exec on macOS) applies this policy:

- **Writable** — the project folder, the run's tmp (mounted as `/tmp` on Linux; `$TMPDIR` on macOS, where `/tmp` is writable too), package caches (`~/.npm`, `~/.m2`, `~/.cache`, `~/.gradle`, `~/.cargo/registry`, `~/Library/Caches` on macOS) and any `writable_dirs` from the spec
- **Read-only** — the system, and the toolchains in your home: the folders on `PATH` (with the `lib/` beside a `bin/`, as in conda) and where their links lead (a pipx or uv tool, Node, Claude Code), `~/.local/lib`, uv's Pythons, `.nvm`, `.pyenv`, `.rbenv`, `.cargo`, `.rustup`, `.sdkman`, `.volta`, `.bun`, `.deno`, `~/go`, your git config, the folders named by `JAVA_HOME`, `GOPATH` and the like, and any `readable_dirs` from the spec
- **Hidden** — the rest of your home: the model sees an empty home. Files a task needs from it go in `readable_dirs` or `context_files`. On macOS the names in the folders above the project and the run's tmp stay visible, not the files themselves: macOS needs them to know the current folder
- **Hidden** — credentials: `.ssh`, `.gnupg`, `.aws`, `.kube`, `.docker`, `.config/gh`, `.password-store` and `.local/share/keyrings` are masked, and `.git-credentials`, `.netrc`, `.claude/.credentials.json`, `.pgpass` and `.my.cnf` are bound to /dev/null
- **Blocked** — writes to git (no checkout, stash or reset of anyone's work; `commit: true` commits outside the sandbox) and Docker, unless `allow_docker: true` (the docker socket is masked otherwise)
- **A clean environment** — the task's commands get only harmless variables of yours (paths, language, toolchains such as `JAVA_HOME`, proxies and certificates) and the spec's `env`; API keys, tokens and the SSH agent's socket stay out. A variable they need goes in the spec's `env`.
- **Network** — open by default; `network: false` or `private: true` in the spec closes it (see the task spec). An allowlist of hosts for ordinary tasks is open in [#3](https://github.com/Fr3nky88/handy-hank/issues/3).

Set `sandbox: false` in the config only if you accept no isolation: every command then runs with your own permissions. To report a vulnerability, see [SECURITY.md](https://github.com/Fr3nky88/handy-hank/blob/main/SECURITY.md).

## Real work: Hank built Hank

Every feature of Hank after the first was written by the version of Hank before it, with Claude Opus as the foreman:
it designed each task, wrote the spec and its acceptance tests, and reviewed the result. The project worked on is this
repository, so all of it is public; [EVIDENCE](https://github.com/Fr3nky88/handy-hank/blob/main/docs/EVIDENCE.md)
has one row per task.

| | |
|---|---|
| tasks | 21, from the package structure to this README |
| local work | 1,573 steps and 840 minutes of inkling-2-mini on one RX 6900 XT |
| tokens on the local GPU, not on the paid model | 1.27M generated and 37.6M read by Hank; the foreman would have generated fewer for the same code, since a small model reasons more and retries, so this is the work moved, not the foreman's saving (the A/B measures that) |
| outcome | from task 7 on, when specs were staged and the small model had its working method, every task ended with its tests green, and every stage but one closed with `finish` (the release cleanup's last stage paused at its step limit, every check green but a size guide) |
| the foreman's review | 7 tasks kept as Hank left them; 8 with small fixes (a docstring, a plainer loop, a shorter function, one bug found with a test); 3 with real rework (the `status` and `watch` commands, the judge checks, the facts of this README); 1 reverted (a code-quality pass that made the code worse); 2 of the first not recorded |

What did not work at first became a feature: the first tasks ran out of steps or left their lint and size checks
open, so specs got stages and the budget grew while the checks improved; the small model reasoned at length or edited
through bash scripts, so it got a working method; runs that stopped on a server error or a stall became pauses that
`hank resume` continues. Two field tests outside the repository, a data summary with a chart and a title video, were
right at the first `run_checks` (EVIDENCE, "Non-code tasks"). How many foreman tokens these tasks saved was not
measured, except for this README, where the foreman's review cost as many output tokens as Hank generated.

## Benchmarks

Minutes depend on the hardware and results on the local model: on this machine inkling-2-mini generated about 37-42 tokens per second, and other models passed fewer tasks ("Other local models" below). A faster GPU, or one that fits a larger model, changes both.

The bench is the local half of the evidence: six standard tasks in `bench/` (bugfix, feature, lint, api-change, data, video) plus harder ones, run by **Hank alone** — no foreman notes and no answers (a question or a pause would count as a failure), each run in a fresh work dir made by the task's `setup.sh`. Date: 2026-12-03. Model: inkling-2-mini (IQ3_S, LM Studio, Vulkan, 64k context, temperature 0.2, profile small, `send_reasoning` on), on one RX 6900 XT.

### Standard tasks

Each task's `check.sh` verifies more than the tests the model sees, with cases the tests do not try.

| task | what the model gets | result |
|---|---|---|
| bugfix | an invoicing package; a failing test of an invoice total with a refund | pass (3 runs) |
| feature | a word-count CLI; add `--stopwords FILE` with a test of it | pass (3 runs) |
| lint | a package with 29 ruff findings and two unformatted files | pass (3 runs) |
| api-change | an app written for geokit 1.x, with geokit 2.0 and its CHANGELOG in the repo | pass (3 runs) |
| data | a CSV of 61 orders: a Markdown table per month with a total and the best month, and a bar chart | pass (3 runs) |
| video | a 3 s 1280x720 title card on #1B2A4A with fades; `ffprobe` and raw frames checked | pass (3 runs) |

18/18 across the three runs of the easy six. The full set is 13 tasks; inkling passed 12/13 — the one failure is 3d-print, see below.

### Harder tasks

| task | what it checks | result (inkling-2-mini, one run each) |
|---|---|---|
| multifile-bug | a package of 6 modules; a booking test fails (a Sunday show priced as a weekday) | pass — 19 steps, 3.9 min |
| refactor | three readers with their own copy of the amount and date parsing: one shared module, the settings passed as parameters | pass — 23 steps, 8.2 min |
| web-page | a to-do list as a static page (ids and classes named, localStorage key and format given); checked in headless Chrome through playwright-core: adding, ticking, deleting, the count, two reloads, no console error or network request | pass — 11 steps, 3.3 min |
| research-offline | four questions about a fictional ferry (20 saved pages); answers in `answer.md`, each with its source page cited next to it | pass — 11 steps, 3.2 min |
| long-chain | a staged spec (3 steps of 2 functions each): parse an access log, count statuses and top paths, requests per UTC hour, a Markdown report in an exact form; checked per step | pass — 34 steps, 11.9 min |
| 3d-print-openscad | the same box with OpenSCAD instead of hand geometry: `make_box.py` writes `box.stl` and the checks verify it (bounding box, edges wound in opposite directions, no degenerate triangle) | pass — 33 steps, 9.3 min |
| 3d-print | a box with a lid lip: `make_box.py` writes `box.stl`; the checks verify the bounding box, every edge in exactly two triangles wound in opposite directions, no degenerate triangle, a positive volume within 1% of 14,988 mm3 and 13 rays along x, y and z | fail — four replies in a row cut at the reply cap (about 440 s each), no file written; over two runs it never wrote one (55 minutes) |

3D geometry is a measured limit of inkling-2-mini in this setup: on the hand-written box it reasons to the reply cap again and again without writing a file, while every other task passed. The same box with OpenSCAD passed in 9.3 minutes. The checks verify that the code works, not that it is well written — the foreman's review stays needed with small models.

### Other local models

One run per task, 2026-12-03 (spark ran all thirteen; minicpm and qwen ran the six easy ones only, because the full set took about five hours with spark):

| model | size, context | easy six | all thirteen | minutes, easy six | generated per request (median) | median model s | cut replies |
|---|---|---|---|---|---|---|---|
| inkling-2-mini (as above) | 128x1.8B MoE, IQ3_S, 64k | 18/18 (3 runs) | 12/13 | about 15 | 281 | 5.8 | 0 on the easy six |
| spark-x2.5-4b | 4.1B, F16, 64k | 4/6 | 6/13 | 147.5 | 2,034 | 10.0 | 12 on the easy six |
| minicpm5-2b | 2.6B, F16, 64k | 4/6 | not run | 16.0 | 239 | 3.5 | 0 |
| qwen3.8-27b-gsq-rco | 27B dense, IQ3_XXS, 32k then 24k | 4/6 at 32k, 6/6 with the two crashed tasks rerun at 24k | not run | 18.3 (5.2 for the reruns) | 379 | 8.7 | 0 |

spark per task (all thirteen): pass on api-change (28 steps, 20.5 min), bugfix (14, 7.9), data (18, 9.5), feature (25, 15.7), refactor (52, 35.0) and web-page (13, 7.1); a `model` pause on 3d-print (8.7 min), 3d-print-openscad (9.1), lint (31.9), long-chain (54.5), multifile-bug (21.5), research-offline (13.3) and video (62.0).

### The A/B: the paid foreman alone, with Hank, with a Haiku subagent

The question: does handing work to Hank save the paid foreman tokens, and against what? `bench/ab.py` runs Claude Code (`claude -p`, Opus 5.5) on the same task in three arms — **alone** (Opus does the work itself, no Agent tool), **Hank** (Opus gets a short guide to the hank CLI and no Agent tool) and **Haiku** (Opus may delegate to a subagent, model haiku). The tasks are 9: the 8 of the bench (bugfix, feature, data, api-change, lint, video, refactor, 3d-print) plus long-chain (a module of six functions with their tests, about 300 lines, a staged spec). Each cell runs in bubblewrap with a clean environment; checks run outside the sandbox after the session. Two settings: **fresh** (an empty conversation) and **full context** (every cell resumes a fork of one warm-up session that read 129k tokens of standard-library source; the warm-up's own usage is subtracted).

Usage is counted in tokens, as Claude Code reports it per model: prices change with the model and the plan, token
counts do not. Output tokens are the ones the foreman generates; input tokens are the ones it reads (cache reads, cache
writes and plain input), so every turn counts the whole conversation again.

| setting | arm | passed | Opus output tokens | Opus input tokens | turns | minutes |
|---|---|---|---|---|---|---|
| fresh | alone | 9/9 | 26,386 | 0.75M | 40 | 4.4 |
| fresh | Hank | 9/9 | 25,577 (-3%) | 1.41M (+88%) | 62 | 37.0 |
| fresh | Haiku | 9/9 | 22,716 (-14%) | 1.21M (+61%) | 51 | 8.9 |
| full | alone | 9/9 | 33,057 | 6.79M | 56 | 5.3 |
| full | Hank | 9/9 | 28,466 (-14%) | 7.37M (+9%) | 57 | 25.5 |
| full | Haiku | 9/9 | 27,195 (-18%) | 7.79M (+15%) | 57 | 9.0 |

The Haiku arm also used the subagent's own tokens (60,710 and 54,525 Haiku output tokens); Hank's tokens are local — 922k read and generated fresh, 685k in the full context.

What it shows:
- Delegating trades the foreman's output for input. With Hank the foreman generated 3% fewer tokens from a fresh session and 14% fewer deep in a long one, and read 88% and 9% more: the spec, the wait and the review take turns, and every turn rereads the conversation.
- Small changes do not pay: on a bug fix of a few lines the foreman generated 42% and 27% more tokens with Hank than alone, and read 82% and 68% more.
- It pays where the result is much longer than its description: on long-chain the foreman's output fell by 50% fresh and 51% in the full context (6,084 to 3,062 and 7,244 to 3,516 tokens), for 60% and 18% more input.
- A spec that spells the code out saves little: on refactor (specs describing each function) the foreman's output fell only 11% and 4%.
- Hank is the slowest arm: 5 to 8 times the foreman alone, 3 to 4 times the Haiku arm.
- Per-task figures are single runs and move a lot; read the totals, not the rows.

### Reproducing them

```sh
python3 bench/run.py --model <name>              # every task, with a model from your Hank config
python3 bench/run.py bugfix feature --repeat 2   # some tasks, twice each
python3 bench/ab.py bugfix --arms alone hank     # the A/B: runs Claude Code with your login, real usage
```

`bench/run.py` writes one JSONL row per run to `bench/results/<model>-<date>.jsonl`. `bench/ab.py` runs each cell in its own bubblewrap sandbox; its docstring and `docs/EVIDENCE.md` give the setup and the limits.

## How Hank was tuned

- It was developed and field-tested mostly with one small local model, inkling-2-mini (IQ3_S). Every number in this README comes from that model unless a table says otherwise.
- Only the `small` profile gets the HOW TO WORK lesson, the reading limits and the advice to stage specs.
- Every model uses the no-fail runs, stall detection, the dynamic budget, checkpoints, compaction, judge checks and the sandbox.
- The risk is overfitting to one model. inkling passed 12/13 of the full set (18/18 on the easy six); spark-x2.5-4b passed 6/13, minicpm5-2b 4/6 and qwen3.8-27b 6/6 on the easy six (see "Other models" above). Every one of spark's failures was the model reasoning up to the reply limit, not Hank, the spec or the sandbox.

## Limitations

From `docs/EVIDENCE.md` ("Where it struggles") and the limits of the A/B:
- **Linux and macOS.** macOS is checked in CI only, not in real runs; Windows only through WSL2, not tested.
- **Small tasks do not pay.** Delegating them saved the foreman few output tokens or none and made it read more (see the A/B), and Hank is 5 to 8 times slower.
- **Tuned on one model** (see "How Hank was tuned").
- **What small models get wrong:** 3D geometry by hand (inkling reasoned to the reply limit without writing a file, 55 minutes over two runs), holistic refactors, edits through bash scripts with quoting problems, long reasoning when confused.
- **The checks verify that the code works, not that it is well written.** Hank's code passed every check of the A/B but had more style issues than the foreman's own: review what you get.
- **The network is open** inside the sandbox (see Security).
- **One request at a time:** LM Studio served one request at a time here, so parallel runs queue.
- **The A/B's limits:** one run per cell, on small tasks; one foreman model and one local model; the warm-up context is source code read, not a real conversation. Per-task figures move a lot from run to run: read the totals, not the rows.

## Tips

- **A model that reasons too long.** On LM Studio, `reasoning_effort: "none"` at the top level of a model's
  `extra_body` turned the reasoning off for spark-x2.5-4b, minicpm5-2b and qwen3.8-27b in a short test (two samples
  each; they still called the tool, with about 5x fewer tokens). It did nothing for inkling-2-mini, the model of every
  other number here. Not measured on real tasks: try it when a model reasons up to the reply limit, as spark did on
  every task it failed, and compare on `bench/`.

  ```yaml
  models:
    spark:
      model: spark-x2.5-4b
      extra_body: {reasoning_effort: "none"}
  ```

- If the server does not report the context size, Hank warns once and assumes 32k: set `context_tokens` to the size the model is loaded with.
- A community tip, not measured here: a q8_0 KV cache in LM Studio's load settings takes about half the memory of the default, which leaves room for a longer context.

## FAQ

**Does Hank save my foreman's tokens?** Where the result is much longer than its description, yes: on long-chain the foreman's output tokens fell by 50% fresh and 51% in the full context. On small tasks it saves few output tokens or none (-3% fresh, -14% deep in a long session) and the foreman reads more (+88% and +9%). Weigh the two by what each kind of token costs you; the README gives tokens, not money, because prices change with the model and the plan.

**Do I need a GPU?** You need a model server. Usually that is a local one on your GPU (LM Studio, llama.cpp, Ollama, vLLM), but any OpenAI-compatible endpoint works. The numbers here come from one RX 6900 XT with 16 GB.

**Can any coding agent use it?** Any shell-capable agent can drive the CLI; copying the skill to your skills folder (see "Using Hank from your coding agent") gives an agent that supports skills a short guide on when to delegate and how.

**What does Hank cost me in time?** It depends on your hardware and model; on one RX 6900 XT with inkling-2-mini it was the slowest arm: 5 to 8 times the foreman alone, 3 to 4 times the Haiku subagent (37.0 min vs 4.4 fresh; 25.5 vs 5.3 full).

**Is it safe?** Commands run in a sandbox (bubblewrap on Linux, sandbox-exec on macOS): writes outside the project are refused, your home is hidden but for its toolchains, git is read-only, credential files are hidden and the commands get no API keys. The network is open; see "Security". The checks prove that the work passes them, not that it is good: review what you get.

**Does it run on Windows?** Through WSL2, which is Linux: install Hank and bubblewrap inside it (`sudo apt install bubblewrap pipx`). A model server on the Windows side is reached from WSL at the host's address, or at `localhost` with WSL's mirrored networking. Not tested yet.

## Contributing

See [CONTRIBUTING.md](https://github.com/Fr3nky88/handy-hank/blob/main/CONTRIBUTING.md) — setup, rules, lessons, bug reports and a pull request checklist.

## Star history

<a href="https://star-history.com/#Fr3nky88/handy-hank&Date">
  <img src="https://api.star-history.com/svg?repos=fr3nky88%2Fhandy-hank&type=Date" alt="Star history of Handy Hank" width="600">
</a>

## License

MIT — see [LICENSE](https://github.com/Fr3nky88/handy-hank/blob/main/LICENSE).

## Acknowledgements

Ideas taken from, or tested against Hank's runs because of, other harnesses: OpenHands (stall detection and its thresholds), SWE-agent (a syntax check on edits; collapsing old tool outputs, on the [roadmap](https://github.com/Fr3nky88/handy-hank/blob/main/docs/ROADMAP.md)), Codex (a short final summary), Aider (whitespace-tolerant edits, tested and not needed) and mini-swe-agent (one action per reply, tested). The trajectories of Claude Opus and Haiku in Claude Code gave the working method of Hank's small-model lesson.
