Repository navigation
Filling the gaps
Almost no request says everything. "Add a --json flag" does not say what happens with no rows, with a broken row, or with a million rows. A plain agent guesses quietly. Herd fills each gap on purpose, writes down what it chose, and shows you.
Herd does not ask you about each gap: it states its assumptions and keeps going. It asks you only before an irreversible action, for a real trade-off, or once before building a high-risk change.
The Example run had this request, shortened here:
Add a slugify(text) function in textutil.py ... so slugify("Hello, World!") returns "hello-world".
python3 -m textutil TEXTprints the slug. Criteria: Given 'Hello, World!', when slugify runs, then it returns 'hello-world'. ASCII text only.
That gives two criteria and one example. It says nothing about empty input, non-ASCII input, several words on the command line, or what "ASCII" covers. Below is what Herd did about each.
Herd records your /herd:run message from the session log. Each criterion you wrote becomes a human criterion, copied word for word. Herd checks that the quote matches your request: herd done refuses one that does not. Your criteria are frozen at the first herd verify, so the agent cannot narrow them later.
In the example, "ASCII text only." became criterion C2, exactly as written.
herd triage sets a risk floor from path rules in herd.toml. By default, migrations/**, auth/**, billing/** and herd.toml are high, api/** is medium, and any other path is medium. The agent can raise the risk, never lower it. Higher risk asks for more: at medium and high, Herd refuses to finish without a test budget, known limits, a coverage note on each human criterion and the inputs list. At high risk the agent stops once to show you the criteria and asks for your approval.
The agent fills in criteria until there are 3 to 6 in all. Its own are marked agent-proposed, so you can tell them from yours. At least one must cover an edge or failure case: wrong input, an empty state, or something that must not change.
In the example, Herd added three:
| id | Added by Herd |
|---|---|
| C3 | Random ASCII strings give the same result as a separately written reference. |
| C4 |
python3 -m textutil TEXT prints the slug and exits 0. |
| C5 | No argument or non-ASCII text gives one message on stderr, a non-zero exit, and no traceback. |
Some words promise more than one example can prove:
- "every", "any", "all", "each", "many" lead to generated test cases of different shapes, random ones included.
- "big", "large", "huge", "thousands" lead to a scale test with a time limit.
If the agent covers only part of such a claim, it must say so. A limit that narrows an "every" claim is shown to you as not proven.
For every input, Herd writes two things: the input as you described it, and the input as the program receives it. Then it lists at least two ways a person could read your words. The program has to handle every reading itself; you never have to convert your data first.
In the example, python3 -m textutil TEXT had two readings: one quoted argument, or several words typed without quotes. Herd's answer, logged as a decision, was to join several arguments with one space, so both work.
Before the attacks, herd design-brief asks the design model to challenge its own understanding of the request. The answer goes in ANSWERS.md: what it first assumed, and what it decided after thinking it through. Every criterion and input must then say exactly what the program accepts, what it does with it, and what it refuses. The first herd verify refuses to run without this file.
Every standard task gets the same six attacks, planned and logged before any code:
| Attack | The question it asks |
|---|---|
| bad-input | What happens with missing, empty, malformed or wrong-type input at each entry point? |
| collision | What if two entries share a name, or one entry is given twice with different data? |
| one-bad-part | If one part of the input is broken, can that change the answer? If so, refuse. |
| recount | Do the reported numbers add up when counted again with separate code? |
| refusal | Is everything the program refuses really impossible to serve? |
| other-reading | Does the program work for every way of reading your input? |
An attack that cannot apply is marked n/a with a reason, and the report shows it. In the example, collision was n/a because "the tool takes one text value". See Attacks.
Before any code, the agent solves one small case by hand and writes down the expected output. It cannot paste the program's own output instead. The answer is frozen at the first run.
In the example: python3 -m textutil ' A--b_2! ' must print a-b-2.
Each gap that needs a choice becomes a logged decision with three parts: what was decided, why, and how to override it. In the example:
Refuse non-ASCII text (ValueError; CLI exit 1) instead of treating it as a separator; 'ASCII text only' and silent loss of letters; override by asking for separator behaviour
If you disagree, ask for the other behaviour in your next request.
The agent must write down what its tests cover and what they do not:
-
coverageon each human criterion: what the check proves and misses. -
test_budget: what is tested, and at which level. -
known_limits: when the result may still fail.
In the example, the known limits said non-ASCII text is refused, not converted, and that the shell limits how long a command-line argument can be.
-
herd detectfinds your project's real test command instead of guessing. -
herd checkwarns about checks that run no project code, such astrue,echoortest -f. - Every check must fail before the work starts. One that already passes proves nothing and must be tightened.
- A check that exits 0 but ran zero tests is flagged.
- A criterion that nothing can check stays
unchecked. It is never counted as met.
- The criteria table, shown before the build.
- The final report: the
Decisions,LimitsandNot provenlines. -
evidence.mdin.herd/tasks/<slug>/, and the PR description's "What is not proven" section when you useherd pr.
To guide the gaps yourself, put more in the request: criteria, inputs, what must not change. Examples are on the Quickstart. To plan the evidence with Herd before a task, run /herd:evidence.