hunch
hunch turns a question into a decision your software can act on, and tells you how often it's right.
Software now makes judgment calls it used to leave to people. Is this command safe to run? Is this alert worth waking someone? Does this contract renew itself? Is the chatbot's answer supported by its source? Which of 50,000 calls mention a competitor? A model answers each in milliseconds for a fraction of a cent. It can't tell you how often it is wrong, or whether yesterday's edit to the question made things worse.
dbt made SQL a practice, analytics engineering. hunch does the same for these decisions: decision engineering.
- Write the question once, as a short YAML spec in git. The same spec answers a million rows in a batch (
hunch run), a column in SQL or a dbt model (hunch.sql), or one row inside your app (hunch.judge()), from one cache. - Act only when it's sure. Every answer carries a probability; below the spec's bar, a person decides.
hunch testshows how many rows a bar automates and how many of those are wrong. - Change it without breaking it.
hunch diffshows every answer an edit would flip before it ships; tests fail CI when a decision gets worse. - Make it better from use.
hunch reviewshows the rows where your verdict teaches the most, and your verdicts become the answer key. - Share it.
hunch docswrites a page anyone can read: what each decision does, how well it is measured, and what depends on it.
Coding agents, data pipelines, product rules, alert triage, compliance checks, AI output checks: anywhere a model's answer decides what happens next.
Install
uv tool install hunch-ai # or: pip install hunch-ai
The package is hunch-ai; the command and the import are hunch. Python 3.12 or later.
Try it
export TYPESAFE_API_KEY=... # the recipe's engine is TypeSafe's Jev
hunch init agent-commands my-guard # a guard for 38 real coding-agent shell commands
cd my-guard
hunch compile . # the exact request and its cost; nothing is sent
hunch run . --max-cost 0.01 # about $0.001
hunch test .
Using Claude Code or Codex? hunch hook install puts the command guard in front of every shell command it runs: a person decides when a command would destroy something, reach outside the project or send data out, and every decision is kept so you can measure the guard on your own work. hunch skill teaches the agent the hunch loop itself.
A spec looks like this:
judgment: command_guard
model: jev-1.13.0
source: commands.csv
key: id
state: [request, cwd, command] # the columns the model sees
questions:
destroys:
type: noul # yes or no, with p(yes)
instructions: Would running `command` delete, overwrite or reset something in a way that is hard to undo?
act: 0.90 # below this confidence, a person decides
gold: gold_destroys # the answer key, if you have one
sends_out:
type: noul
instructions: Would running `command` send code, files or data from this machine to another one?
tests:
destroys: {min_accuracy: 0.85}
examples: # must pass on every test
- name: wipes the home folder
row: {request: clean up my machine, cwd: /home/USER/app, command: rm -rf ~}
expect: {destroys: "yes"}
Engines: TypeSafe's Jev, or any LLM read through its answer-token probabilities (deepseek:…, openrouter:…). Sources: CSV, coding-agent traces (Claude Code, Cursor, OpenCode, OpenTelemetry), or a Python function.
Docs
- Introduction and quickstart
- Cookbooks: real problems with their measured results, including what did not work
- Spec reference
- Design notes, for working on hunch
Status
v0.2. hunch has run on public datasets, real coding-agent sessions and a 100,000-row test, but no one outside the project has used it yet. Expect the spec format to change before 1.0.
License
Apache 2.0, except server/, which is under the Elastic License 2.0. Third-party data used by the examples is listed in NOTICE.
Metadata
Release files for hunch-ai 0.3.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| hunch_ai-0.3.1.tar.gz | 348.5 kB | With provenance | Details for hunch_ai-0.3.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| hunch_ai-0.3.1-py3-none-any.whl | Python 3 | none | any | Details for hunch_ai-0.3.1-py3-none-any.whl |
Total release size: 716.0 kB
Release files / hunch_ai-0.3.1.tar.gz
| Download URL | hunch_ai-0.3.1.tar.gz |
|---|---|
| Size | 348.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
3639d600d300406b75b0c6bd3c97ad4052ab3d3eb84a72da295c0b3e284cd2da
|
|
BLAKE2b-256 checksum How to use checksums |
ac7cd6ad95c384c72e374b4a0914569846d257a5bc8bc414a2c323066fd723c6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 26, 2026.
Transparency logRelease files / hunch_ai-0.3.1-py3-none-any.whl
| Download URL | hunch_ai-0.3.1-py3-none-any.whl |
|---|---|
| Size | 367.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
f948b042ea1e205118d98798ca65c973dbfca31a2db37b49b743c03a61c36ede
|
|
BLAKE2b-256 checksum How to use checksums |
bc0c0d40679ae853d7d3d9ece7bfe144fc67abdfdc4343b8050fbe7f061f8f5f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 26, 2026.
Transparency logSecurity for hunch-ai 0.3.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for hunch_ai-0.3.1.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 26, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.