Skip to content
Source on GitHub (opens in a new tab)

A model that stops talking hasn’t necessarily finished. zelk decides when a run is done from what the run did, and records why.

Every run has a goal. By default it is the request that started the run; each new request revises it. A host can set an explicit goal that holds across later messages and compaction (zelk.SetGoal), and clear it again. Only the host sets goals: the model has no tool for it.

A message sent while a run is going, a steer, joins the run’s next model turn, and the run can’t finish before the model has seen it.

A run ends when the model calls ReportOutcome. It says whether the goal is met, partial, not_met or blocked (and by what), gives a summary that becomes the run’s final message, lists what is still open, and, for a met report, names each requirement and how it was confirmed.

zelk doesn’t take the report on trust. The record of the ending is recomputed from the log, so a report can’t claim what the log doesn’t show: which files the run changed, which checks it ran and how they ended, and which claims in the final message no evidence supports.

The Verify tool runs a project check and records its evidence: the command, its exit status, the end of its output, and the state of the workspace it ran against. The model supplies none of that. A host names its checks (-verify 'test=go test ./...' on the command line, WithVerify in Go); the model may add its own for its run. A command written to hide its own failure, such as one ending in || true, is refused as evidence. Plain Bash runs are never evidence.

Evidence goes stale when the workspace changes after the check ran.

When the model ends its turn, the run goes through one check before it ends. It fails when:

  • a check’s latest evidence failed, or is stale;
  • the final message claims that tests, builds or lint pass, and fresh passing evidence doesn’t back it;
  • there is no report.

A failed check sends the run back to the model with a note saying why, at most three times per run; after that the run ends incomplete. A model that repeats the same failing action, or retries a call the policy refused, is told to step back, and then stopped.

  1. A claim needs evidence. The model said the tests pass without running anything, so the check fails and sends it back with a note saying why. It calls Verify, which runs go test ./... and records exit 0, and the next check passes: the run ends success.
  2. Evidence goes stale. Verify passed, but the model then edited a file. A check that ran before the workspace last changed no longer counts, so the evidence is stale and the claim has nothing fresh behind it. A new Verify passes and the run ends success.
  3. Sent back at most 3 times. The check keeps failing, and each failure returns the run to the model. After 3 returns the next failure doesn’t send it back again: the run ends incomplete.
Outcome Means
success the goal was reported met and the completion check passed
incomplete the run ended without meeting the goal, or ran out of chances to
blocked the run needs something only a person can give, and none is available
unverified done as far as the model can tell, but a requirement remains it had no way to check
max_turns, max_budget a limit the host set ended the run
interrupted the host or the user stopped it
suspended the run waits for an answer the host will give later
refused the model refused the request
error a model call failed, and retries didn’t clear it

The zelk command shows the report at the end of a run and exits 0 only for success; zelk sessions report lists every action of a run and how it was decided. In Go, the outcome and report are on zelk.Result.

The completion contract specifies every rule here: how evidence is labelled, which checks apply to which run, the shortcut flags, and how decisions are recorded.