handyhank 1.0.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (59) hide show
  1. handyhank-1.0.0/LICENSE +21 -0
  2. handyhank-1.0.0/PKG-INFO +433 -0
  3. handyhank-1.0.0/README.md +403 -0
  4. handyhank-1.0.0/pyproject.toml +59 -0
  5. handyhank-1.0.0/setup.cfg +4 -0
  6. handyhank-1.0.0/src/handyhank/__init__.py +3 -0
  7. handyhank-1.0.0/src/handyhank/agent.py +528 -0
  8. handyhank-1.0.0/src/handyhank/checks/web_smoke.py +147 -0
  9. handyhank-1.0.0/src/handyhank/cli.py +340 -0
  10. handyhank-1.0.0/src/handyhank/config.py +39 -0
  11. handyhank-1.0.0/src/handyhank/default_config.yml +23 -0
  12. handyhank-1.0.0/src/handyhank/lessons/3d.md +5 -0
  13. handyhank-1.0.0/src/handyhank/lessons/data.md +5 -0
  14. handyhank-1.0.0/src/handyhank/lessons/docs.md +5 -0
  15. handyhank-1.0.0/src/handyhank/lessons/profile-small.md +4 -0
  16. handyhank-1.0.0/src/handyhank/lessons/research.md +5 -0
  17. handyhank-1.0.0/src/handyhank/lessons/software.md +4 -0
  18. handyhank-1.0.0/src/handyhank/lessons/video.md +5 -0
  19. handyhank-1.0.0/src/handyhank/lib/browser.cjs +40 -0
  20. handyhank-1.0.0/src/handyhank/mcp.py +158 -0
  21. handyhank-1.0.0/src/handyhank/models.py +96 -0
  22. handyhank-1.0.0/src/handyhank/prompt.md +23 -0
  23. handyhank-1.0.0/src/handyhank/prompts.py +90 -0
  24. handyhank-1.0.0/src/handyhank/report.py +62 -0
  25. handyhank-1.0.0/src/handyhank/run.py +39 -0
  26. handyhank-1.0.0/src/handyhank/sandbox.py +86 -0
  27. handyhank-1.0.0/src/handyhank/stall.py +73 -0
  28. handyhank-1.0.0/src/handyhank/stats.py +109 -0
  29. handyhank-1.0.0/src/handyhank/toolkit.py +87 -0
  30. handyhank-1.0.0/src/handyhank/tools.py +521 -0
  31. handyhank-1.0.0/src/handyhank/util.py +9 -0
  32. handyhank-1.0.0/src/handyhank.egg-info/PKG-INFO +433 -0
  33. handyhank-1.0.0/src/handyhank.egg-info/SOURCES.txt +57 -0
  34. handyhank-1.0.0/src/handyhank.egg-info/dependency_links.txt +1 -0
  35. handyhank-1.0.0/src/handyhank.egg-info/entry_points.txt +2 -0
  36. handyhank-1.0.0/src/handyhank.egg-info/requires.txt +4 -0
  37. handyhank-1.0.0/src/handyhank.egg-info/top_level.txt +1 -0
  38. handyhank-1.0.0/tests/test_any_task.py +183 -0
  39. handyhank-1.0.0/tests/test_background.py +60 -0
  40. handyhank-1.0.0/tests/test_bench.py +133 -0
  41. handyhank-1.0.0/tests/test_budget.py +114 -0
  42. handyhank-1.0.0/tests/test_compact.py +35 -0
  43. handyhank-1.0.0/tests/test_context_warning.py +41 -0
  44. handyhank-1.0.0/tests/test_e2e.py +103 -0
  45. handyhank-1.0.0/tests/test_judge.py +143 -0
  46. handyhank-1.0.0/tests/test_lessons.py +49 -0
  47. handyhank-1.0.0/tests/test_mcp.py +140 -0
  48. handyhank-1.0.0/tests/test_messages.py +95 -0
  49. handyhank-1.0.0/tests/test_model_trouble.py +129 -0
  50. handyhank-1.0.0/tests/test_models.py +165 -0
  51. handyhank-1.0.0/tests/test_never_fail.py +133 -0
  52. handyhank-1.0.0/tests/test_progress.py +78 -0
  53. handyhank-1.0.0/tests/test_sandbox.py +97 -0
  54. handyhank-1.0.0/tests/test_small_models.py +87 -0
  55. handyhank-1.0.0/tests/test_stall.py +139 -0
  56. handyhank-1.0.0/tests/test_stats.py +231 -0
  57. handyhank-1.0.0/tests/test_steps.py +167 -0
  58. handyhank-1.0.0/tests/test_toolkit.py +48 -0
  59. handyhank-1.0.0/tests/test_topics.py +123 -0
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Handy Hank contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,433 @@
1
+ Metadata-Version: 2.4
2
+ Name: handyhank
3
+ Version: 1.0.0
4
+ 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.
5
+ Author: Handy Hank contributors
6
+ License-Expression: MIT
7
+ Project-URL: Homepage, https://github.com/Fr3nky88/handy-hank
8
+ Project-URL: Repository, https://github.com/Fr3nky88/handy-hank
9
+ Project-URL: Issues, https://github.com/Fr3nky88/handy-hank/issues
10
+ Project-URL: Changelog, https://github.com/Fr3nky88/handy-hank/releases
11
+ Keywords: llm,local-model,agent,sandbox,mcp,lm-studio,claude-code
12
+ Classifier: Environment :: Console
13
+ Classifier: Intended Audience :: Developers
14
+ Classifier: Operating System :: POSIX :: Linux
15
+ Classifier: Operating System :: MacOS
16
+ Classifier: Programming Language :: Python :: 3
17
+ Classifier: Programming Language :: Python :: 3.10
18
+ Classifier: Programming Language :: Python :: 3.11
19
+ Classifier: Programming Language :: Python :: 3.12
20
+ Classifier: Programming Language :: Python :: 3.13
21
+ Classifier: Programming Language :: Python :: 3.14
22
+ Classifier: Topic :: Software Development
23
+ Requires-Python: >=3.10
24
+ Description-Content-Type: text/markdown
25
+ License-File: LICENSE
26
+ Requires-Dist: PyYAML>=6.0
27
+ Provides-Extra: images
28
+ Requires-Dist: Pillow>=10.0; extra == "images"
29
+ Dynamic: license-file
30
+
31
+ # Handy Hank
32
+
33
+ Your coding agent draws the plans. Hank does the work.
34
+
35
+ [![CI](https://github.com/Fr3nky88/handy-hank/actions/workflows/ci.yml/badge.svg)](https://github.com/Fr3nky88/handy-hank/actions/workflows/ci.yml)
36
+ ![License: MIT](https://img.shields.io/badge/license-MIT-blue)
37
+ ![Python 3.10+](https://img.shields.io/badge/python-3.10%2B-blue)
38
+ ![Platforms: Linux, macOS](https://img.shields.io/badge/platform-linux%20%7C%20macos-lightgrey)
39
+ ![Code style: ruff](https://img.shields.io/badge/code%20style-ruff-blue)
40
+
41
+ ## Contents
42
+
43
+ - [What it is](#what-it-is)
44
+ - [How it works](#how-it-works)
45
+ - [Features](#features)
46
+ - [Requirements](#requirements)
47
+ - [Quickstart](#quickstart)
48
+ - [Configuration](#configuration)
49
+ - [The task spec](#the-task-spec)
50
+ - [Commands](#commands)
51
+ - [Using Hank from your coding agent](#using-hank-from-your-coding-agent)
52
+ - [Security](#security)
53
+ - [Benchmarks](#benchmarks)
54
+ - [How Hank was tuned](#how-hank-was-tuned)
55
+ - [Limitations](#limitations)
56
+ - [Tips](#tips)
57
+ - [FAQ](#faq)
58
+ - [Contributing](#contributing)
59
+ - [License](#license)
60
+ - [Acknowledgements](#acknowledgements)
61
+
62
+ ## What it is
63
+
64
+ 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.
65
+
66
+ 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.
67
+
68
+ ## How it works
69
+
70
+ 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"`).
71
+
72
+ ```
73
+ foreman agent (Claude Code, Codex CLI, Gemini CLI...)
74
+ | writes spec.yml: goal + checks
75
+ v
76
+ hank run spec.yml
77
+ | agent loop with native tool calling, inside a sandbox
78
+ v
79
+ local model server (LM Studio, llama.cpp, Ollama, vLLM)
80
+ | the worker runs the checks itself; finish is refused while one fails
81
+ v
82
+ report on stdout -> foreman reviews -> hank verdict pass|fail
83
+ ```
84
+
85
+ ## Features
86
+
87
+ - 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.
88
+ - Sandboxed commands — the whole filesystem read-only except the project, the run's tmp, package caches and `writable_dirs`; credentials hidden; git read-only; Docker blocked unless `allow_docker: true` (details under Security).
89
+ - Checks gate finish — shell commands or judge checks defined in the spec; `finish` is refused while one fails.
90
+ - 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.
91
+ - 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.
92
+ - Stall detection — repeated action, repeated error, monologue and ping-pong patterns trigger a warning, then a pause.
93
+ - Lessons per topic, profile and model — short facts injected into the system prompt; `hank lesson` adds one after each correction.
94
+ - 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.
95
+ - 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.
96
+ - 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.
97
+
98
+ ## Requirements
99
+
100
+ - Linux with bubblewrap (`bwrap`), or macOS (its `sandbox-exec` runs the sandbox; checked in CI only). On Windows, run
101
+ Hank inside WSL2 (not tested): see the FAQ.
102
+ - Python 3.10 or newer
103
+ - An OpenAI-compatible model server with a local model loaded — LM Studio, llama.cpp `llama-server`, Ollama, vLLM; API keys only via environment variables
104
+ - Optional: Node + playwright-core for the browser tool; Pillow for image downscaling
105
+
106
+ ## Quickstart
107
+
108
+ 1. Install Hank:
109
+
110
+ ```sh
111
+ pipx install handyhank # or: uv tool install handyhank
112
+ ```
113
+
114
+ or the latest code from GitHub: `pipx install git+https://github.com/Fr3nky88/handy-hank`
115
+
116
+ 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.
117
+
118
+ 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`):
119
+
120
+ ```yaml
121
+ url: http://localhost:1234/v1/chat/completions
122
+ model: your-model-id
123
+ profile: small
124
+ ```
125
+
126
+ 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:
127
+
128
+ ```yaml
129
+ title: add stopwords to wordfreq
130
+ repo: /absolute/path/of/the/work/folder
131
+ goal: |
132
+ Add a --stopwords FILE option to the CLI that removes those words from the report.
133
+ Keep the existing tests passing.
134
+ checks:
135
+ - name: tests
136
+ cmd: python3 -m unittest -q
137
+ ```
138
+
139
+ 5. Run it — `hank run spec.yml` runs until done or paused and prints the report at the end:
140
+
141
+ ```sh
142
+ hank run spec.yml
143
+ ```
144
+
145
+ Exit codes: 0 = done, 3 = paused for the foreman (a question, out of steps, a stall, a server error), 1 = failed.
146
+
147
+ ## Configuration
148
+
149
+ 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:
150
+
151
+ | Key | What it does | Example |
152
+ |---|---|---|
153
+ | `url` | Chat completions endpoint of the model server (package default: `http://localhost:1234/v1/chat/completions`) | `url: http://localhost:1234/v1/chat/completions` |
154
+ | `model` | The model name sent to the server (default: `local-model`) | `model: local-model` |
155
+ | `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` |
156
+ | `vision` | Whether the worker can see images (default: `false`) | `vision: false` |
157
+ | `language` | Language of the summaries and reports (default: `en`) | `language: en` |
158
+ | `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}` |
159
+ | `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 |
160
+ | `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` |
161
+ | `profile` | `small` (default) / `medium` / `large` — sets max steps per segment, explore budget, plan cadence and stall thresholds | `profile: small` |
162
+ | `context_tokens` | Tokens the model is loaded with; read from LM Studio or llama.cpp when possible, else 32k assumed with a warning: set it for servers that do not report it, such as Ollama or vLLM (default: none) | `context_tokens: 32768` |
163
+ | `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` |
164
+ | `extra_body` | Extra JSON fields merged into every request body (default: `{}`) | `extra_body: {top_p: 0.9}` |
165
+ | `send_reasoning` | Whether reasoning content is sent back to the model (default: `false`) | `send_reasoning: false` |
166
+ | `temperature` | Sampling temperature (default: `0.2`) | `temperature: 0.2` |
167
+ | `max_tokens` | Reply cap per request in tokens (default: `24000`) | `max_tokens: 24000` |
168
+ | `timeout` | Seconds per request (default: `1800`) | `timeout: 1800` |
169
+ | `retry_waits` | Waits between retries on server errors, in seconds (default: `[5, 20, 60]`) | `retry_waits: [5, 20, 60]` |
170
+
171
+ 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:
172
+
173
+ ```yaml
174
+ url: http://localhost:1234/v1/chat/completions
175
+ model: local-model
176
+ profile: small
177
+ models:
178
+ fast:
179
+ url: http://localhost:1234/v1/chat/completions
180
+ model: local-model
181
+ profile: small
182
+ big:
183
+ url: https://api.example.com/v1/chat/completions
184
+ model: open-large
185
+ api_key_env: OPENAI_API_KEY
186
+ default_model: fast
187
+ ```
188
+
189
+ ## The task spec
190
+
191
+ The foreman writes the spec in YAML, outside the work folder. Every field (one line each):
192
+
193
+ - `title` — short name of the task; shown in reports and `hank list`. Example: `title: add stopwords to wordfreq`
194
+ - `repo` — absolute path of the work folder (a repository or a plain folder). Example: `repo: /absolute/path/of/the/work/folder`
195
+ - `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
196
+ - `acceptance` — list of strings shown as acceptance criteria bullets (not enforced by code). Example: `acceptance: [tests pass, README updated]`
197
+ - `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
198
+ - `steps` — optional staged plan; each step has its own `goal` and optional `checks`, run in order. Example: `steps: [{goal: part 1}, {goal: part 2}]`
199
+ - `outputs` — list of paths (relative to the project) that must exist and be non-empty at finish. Example: `outputs: [report.md]`
200
+ - `context_files` — list of files (relative to the project) whose content is injected into the first message. Example: `context_files: [README.md]`
201
+ - `topics` — list of domain topics; picks the lessons injected into the system prompt and, for media tasks, the toolkit. Example: `topics: [docs]`
202
+ - `tools` — extra tools to send, besides the core tools and those of the topics. Example: `tools: [browser]`
203
+ - `model` — picks one of the configured models from the config's `models:` section. Example: `model: fast`
204
+ - `worktree` — run in a git worktree instead of the project folder (default: false). Example: `worktree: true`
205
+ - `branch` — the new branch for the worktree, created from `base` (default: `handyhank/<run id>`). Example: `branch: hank/add-stopwords`
206
+ - `base` — git ref to create the worktree branch from (default: HEAD). Example: `base: main`
207
+ - `commit` — commit the changes at the end of a successful run (default: false). Example: `commit: true`
208
+ - `writable_dirs` — extra directories writable inside the sandbox, in addition to the project and caches. Example: `writable_dirs: [/tmp/scratch]`
209
+ - `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}`
210
+ - `allow_docker` — allow Docker inside the sandbox (default: false). Example: `allow_docker: true`
211
+ - `judge_model` — picks one of the configured models for judge checks (default: the worker's model). Example: `judge_model: big`
212
+ - `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`
213
+
214
+ Each check in `checks:` (and each step's own `checks:`) has a `name` and either a `cmd` or a `judge`:
215
+
216
+ - `name` — name of the check; shown in reports. Example: `name: tests`
217
+ - `cmd` — shell command for a check; must exit 0 (default timeout 1500 s). Example: `cmd: python3 -m unittest -q`
218
+ - `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..."`
219
+ - `files` — list of paths (relative to the project) attached to a judge check; missing files fail it. Example: `files: [chart.png]`
220
+ - `timeout` — seconds before a command check fails (default 1500). Example: `timeout: 600`
221
+
222
+ A full spec with steps and checks looks like this:
223
+
224
+ ```yaml
225
+ title: add stopwords to wordfreq
226
+ repo: /absolute/path/of/the/work/folder
227
+ goal: |
228
+ Add a --stopwords FILE option to the CLI that removes those words from the report.
229
+ steps:
230
+ - goal: implement the flag and its tests
231
+ checks: [{name: unit-tests, cmd: python3 -m unittest -q test_cli}]
232
+ - goal: update the README with the new option
233
+ checks: [{name: all-tests, cmd: python3 -m unittest -q}] # run when the last step finishes
234
+ ```
235
+
236
+ ## Commands
237
+
238
+ | Command | What it does |
239
+ |---|---|
240
+ | `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 |
241
+ | `hank resume <id> [answer]` | Resume a task paused on a question (or with `--answer-file FILE`); `--background` as for run |
242
+ | `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 |
243
+ | `hank verdict <id> pass\|fail [note]` | Record the foreman's verdict on a run after reviewing it |
244
+ | `hank report <id>` | Print the full report of a run (stdout) |
245
+ | `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 |
246
+ | `hank watch <id>` | Follow a running task; `--steps` also prints step events |
247
+ | `hank list` | List all runs with their status and title |
248
+ | `hank lesson <topic> <text...>` | Add a lesson for a topic (e.g. `video`, `3d`) to the system prompt |
249
+ | `hank stats [--json] [--card] [ids...]` | Numbers per run; `--card` prints one row per model |
250
+ | `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 |
251
+ | `hank mcp` | An MCP server on stdio over these commands, for agents that call tools (see "Using Hank from your coding agent") |
252
+
253
+ ## Using Hank from your coding agent
254
+
255
+ Install Hank first (see the Quickstart). The plugin then gives your agent two things: the skill, which says when to
256
+ delegate and how to write a spec, and the MCP server `hank mcp`, for agents that call tools rather than shell
257
+ commands. The same repository serves every agent below.
258
+
259
+ | agent | install | checked |
260
+ |---|---|---|
261
+ | 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 |
262
+ | 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 |
263
+ | 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 |
264
+ | Gemini CLI | `gemini extensions install https://github.com/Fr3nky88/handy-hank` | the extension validates |
265
+ | 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 |
266
+ | any other agent | the CLI through its shell, or `hank mcp` as a stdio MCP server | |
267
+
268
+ OpenCode's MCP block:
269
+
270
+ ```json
271
+ {"mcp": {"servers": {"hank": {"type": "local", "command": ["hank", "mcp"]}}}}
272
+ ```
273
+
274
+ A call such as `hank_wait` can take minutes. The plugin asks for a 600-second timeout where the agent reads one; Codex
275
+ uses its own default of 60 seconds unless you set `tool_timeout_sec` under `[mcp_servers.hank]` in
276
+ `~/.codex/config.toml`.
277
+
278
+ The foreman writes the spec, reviews the report and records the verdict; Hank never decides what to do or whether it
279
+ is done.
280
+
281
+ ## Security
282
+
283
+ 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:
284
+
285
+ - **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`) and any `writable_dirs` from the spec
286
+ - **Read-only** — everything else, your home included: the model can read your files
287
+ - **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
288
+ - **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)
289
+ - **Not isolated** — the network is open, and the task's commands inherit your environment variables, API keys included: start Hank from a shell without secrets you would not show the model. A hidden home and a clean environment are on the [roadmap](https://github.com/Fr3nky88/handy-hank/blob/main/docs/ROADMAP.md).
290
+
291
+ Set `sandbox: false` in the config only if you accept no isolation: every command then runs with your own permissions.
292
+
293
+ ## Benchmarks
294
+
295
+ 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 6800 XT.
296
+
297
+ ### Standard tasks
298
+
299
+ Each task's `check.sh` verifies more than the tests the model sees, with cases the tests do not try.
300
+
301
+ | task | what the model gets | result |
302
+ |---|---|---|
303
+ | bugfix | an invoicing package; a failing test of an invoice total with a refund | pass (3 runs) |
304
+ | feature | a word-count CLI; add `--stopwords FILE` with a test of it | pass (3 runs) |
305
+ | lint | a package with 29 ruff findings and two unformatted files | pass (3 runs) |
306
+ | api-change | an app written for geokit 1.x, with geokit 2.0 and its CHANGELOG in the repo | pass (3 runs) |
307
+ | 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) |
308
+ | video | a 3 s 1280x720 title card on #1B2A4A with fades; `ffprobe` and raw frames checked | pass (3 runs) |
309
+
310
+ 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.
311
+
312
+ ### Harder tasks
313
+
314
+ | task | what it checks | result (inkling-2-mini, one run each) |
315
+ |---|---|---|
316
+ | multifile-bug | a package of 6 modules; a booking test fails (a Sunday show priced as a weekday) | pass — 19 steps, 3.9 min |
317
+ | 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 |
318
+ | 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 |
319
+ | 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 |
320
+ | 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 |
321
+ | 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 |
322
+ | 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) |
323
+
324
+ 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.
325
+
326
+ ### Other local models
327
+
328
+ 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):
329
+
330
+ | model | size, context | easy six | all thirteen | minutes, easy six | generated per request (median) | median model s | cut replies |
331
+ |---|---|---|---|---|---|---|---|
332
+ | 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 |
333
+ | spark-x2.5-4b | 4.1B, F16, 64k | 4/6 | 6/13 | 147.5 | 2,034 | 10.0 | 12 on the easy six |
334
+ | minicpm5-2b | 2.6B, F16, 64k | 4/6 | not run | 16.0 | 239 | 3.5 | 0 |
335
+ | 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 |
336
+
337
+ 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).
338
+
339
+ ### The A/B: the paid foreman alone, with Hank, with a Haiku subagent
340
+
341
+ 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).
342
+
343
+ Usage is counted in tokens, as Claude Code reports it per model: prices change with the model and the plan, token
344
+ counts do not. Output tokens are the ones the foreman generates; input tokens are the ones it reads (cache reads, cache
345
+ writes and plain input), so every turn counts the whole conversation again.
346
+
347
+ | setting | arm | passed | Opus output tokens | Opus input tokens | turns | minutes |
348
+ |---|---|---|---|---|---|---|
349
+ | fresh | alone | 9/9 | 26,386 | 0.75M | 40 | 4.4 |
350
+ | fresh | Hank | 9/9 | 25,577 (-3%) | 1.41M (+88%) | 62 | 37.0 |
351
+ | fresh | Haiku | 9/9 | 22,716 (-14%) | 1.21M (+61%) | 51 | 8.9 |
352
+ | full | alone | 9/9 | 33,057 | 6.79M | 56 | 5.3 |
353
+ | full | Hank | 9/9 | 28,466 (-14%) | 7.37M (+9%) | 57 | 25.5 |
354
+ | full | Haiku | 9/9 | 27,195 (-18%) | 7.79M (+15%) | 57 | 9.0 |
355
+
356
+ 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.
357
+
358
+ What it shows:
359
+ - 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.
360
+ - 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.
361
+ - 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.
362
+ - A spec that spells the code out saves little: on refactor (specs describing each function) the foreman's output fell only 11% and 4%.
363
+ - Hank is the slowest arm: 5 to 8 times the foreman alone, 3 to 4 times the Haiku arm.
364
+ - Per-task figures are single runs and move a lot; read the totals, not the rows.
365
+
366
+ ### Reproducing them
367
+
368
+ ```sh
369
+ python3 bench/run.py --model <name> # every task, with a model from your Hank config
370
+ python3 bench/run.py bugfix feature --repeat 2 # some tasks, twice each
371
+ python3 bench/ab.py bugfix --arms alone hank # the A/B: runs Claude Code with your login, real usage
372
+ ```
373
+
374
+ `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.
375
+
376
+ ## How Hank was tuned
377
+
378
+ - 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.
379
+ - Only the `small` profile gets the HOW TO WORK lesson, the reading limits and the advice to stage specs.
380
+ - Every model uses the no-fail runs, stall detection, the dynamic budget, checkpoints, compaction, judge checks and the sandbox.
381
+ - 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.
382
+
383
+ ## Limitations
384
+
385
+ From `docs/EVIDENCE.md` ("Where it struggles") and the limits of the A/B:
386
+ - **Linux and macOS.** macOS is checked in CI only, not in real runs; Windows only through WSL2, not tested.
387
+ - **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.
388
+ - **Tuned on one model** (see "How Hank was tuned").
389
+ - **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.
390
+ - **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.
391
+ - **The sandbox does not hide your home or your environment variables** (see Security).
392
+ - **One request at a time:** LM Studio served one request at a time here, so parallel runs queue.
393
+ - **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.
394
+
395
+ ## Tips
396
+
397
+ - On LM Studio, `reasoning_effort: "none"` at the top level of a model's `extra_body` turns its reasoning off: none in two samples each for spark-x2.5-4b, minicpm5-2b and qwen3.8-27b, which still called the tool, with about 5x fewer tokens. "low", `chat_template_kwargs` and `think: false` did nothing measurable. Whether it helps on real tasks is not measured yet.
398
+
399
+ ```yaml
400
+ models:
401
+ spark:
402
+ model: spark-x2.5-4b
403
+ extra_body: {reasoning_effort: "none"}
404
+ ```
405
+
406
+ - 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.
407
+ - 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.
408
+
409
+ ## FAQ
410
+
411
+ **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.
412
+
413
+ **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 6800 XT with 16 GB.
414
+
415
+ **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.
416
+
417
+ **What does Hank cost me in time?** It is 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).
418
+
419
+ **Is it safe?** Commands run in a sandbox (bubblewrap on Linux, sandbox-exec on macOS): writes outside the project are refused, git is read-only and credential files are hidden. The model can still read the rest of your home and your environment variables, and the network is open; see "Security". The checks prove that the work passes them, not that it is good: review what you get.
420
+
421
+ **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.
422
+
423
+ ## Contributing
424
+
425
+ See [CONTRIBUTING.md](https://github.com/Fr3nky88/handy-hank/blob/main/CONTRIBUTING.md) — setup, rules, lessons, bug reports and a pull request checklist.
426
+
427
+ ## License
428
+
429
+ MIT — see [LICENSE](https://github.com/Fr3nky88/handy-hank/blob/main/LICENSE).
430
+
431
+ ## Acknowledgements
432
+
433
+ 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.