> ## Documentation Index
> Fetch the complete documentation index at: https://hibi.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# The judge

> Optional, advisory ranking by TypeSafe's Jev model: what it does, what it sends, and what it never changes.

Three optional features ask a language model for a ranking. They are
advisory: no answer is written to the store or changes a claim's state, and
`status --judge-order` lists the same claims as `status`. They only rank and
label; `triage` and `suggest-evidence` print the top of the ranking, up to
`--limit`.

| Command | Ranks |
| - | - |
| `hibi triage` | Uncovered prose units, by how likely each states a fact that code or configuration could confirm, and where the evidence would be |
| `hibi suggest-evidence <statement> --in <glob>` | Code units that may decide whether a statement is true, with a signal when none fits |
| `hibi status --judge-order` | The listed stale claims, most likely broken first |

They exist for bulk an agent would not read itself: thousands of uncovered
sentences, or every function of a large codebase. For a single statement the
agent is about to re-check anyway, the judge adds nothing.

> [!WARNING]
>
> These commands send text to TypeSafe's API at
> `https://api.typesafe.ai/v1/systemone`, authenticated with your
> `TYPESAFE_API_KEY`. Read the next section before you set the key.

## What is sent

Every request names the model `jev-1.14.0` and carries hibi's fixed
question wording, with the key in the `Authorization` header. Each
`suggest-evidence` candidate and each stale claim is one question, and each
`triage` unit is two. The unit text of `triage`, the candidate text of
`suggest-evidence` and the side text of `status --judge-order` are each cut
to their first 4,000 characters; headings and a candidate's locator and
label are not cut. A question whose answer is cached is not sent.

| Command | Sent per request | Sent per item |
| - | - | - |
| `triage` | The task name and the locator of the document | The unit's text and the headings above it, with two questions: is this a checkable fact, and where would it be confirmed (code, configuration, another document, outside the repository, or no checkable fact) |
| `suggest-evidence` | The task name and your statement | The candidate unit's locator, label and text |
| `status --judge-order` | The task name and the claim's statement | The current text of each side of the stale claim |

Text from files is sent only when git lists the file, in the root or in an
allowed sibling repository: tracked, or untracked and not ignored. Text of an
ignored file is never sent. What happens to an item whose text is not sent
depends on the command:

* `triage` counts it in `skipped`.
* `suggest-evidence` takes candidates only from files git lists, so an
  ignored file never yields a candidate. A candidate whose text cannot be
  rendered is neither sent nor counted.
* `status --judge-order` treats the claim as one that cannot be rendered (see
  below).

Text from an external provider is what its `render` returns.

Each request is a `POST` to the service address with the headers
`Authorization: Bearer <TYPESAFE_API_KEY>`, `Content-Type: application/json`
and `User-Agent: hibi/<version>`. Redirects are not followed, so the key is
never sent to a second host; a redirect answer fails the request.

Nothing else reads `TYPESAFE_API_KEY` or uses the network. Without the key
every other command works.

## Availability

Without the key the three commands fail before doing anything else:

```text output theme={null}
$ hibi triage
error: judge_unavailable: TYPESAFE_API_KEY is not set; the judge commands need it
  fix: Set TYPESAFE_API_KEY. This command has no form without the judge.
```

```text output theme={null}
$ TYPESAFE_API_KEY= hibi status --judge-order
error: judge_unavailable: TYPESAFE_API_KEY is empty; the judge commands need it
  fix: Set TYPESAFE_API_KEY, or run hibi status without --judge-order.
```

Plain `hibi status` needs no key. With the key set, the commands next find
the root, then check git, then read the configuration, all before any network
contact. They fail with `not_a_git_repository` or `git_too_old` when the root
is not the top level of a git work tree or git is older than 2.45.0.

## Results

The outputs below are described from their JSON Schemas
(`hibi schema triage-output`, `hibi schema suggest-evidence-output`), not
recorded from a live call.

### `triage`

Input: the uncovered units that `hibi cover` would list with the same
`--scope` and `--since`, restricted to prose kinds (`sentence`, `list-item`,
`table-row`, `heading`) of the file provider. Other uncovered units are not
sent and are counted in `skipped`.

| Field | Meaning |
| - | - |
| `items[].checkable` | The model's probability that the unit states a checkable fact |
| `items[].band` | `likely` at 0.7 or more, `unlikely` at 0.3 or less, otherwise `unsure` |
| `items[].evidence` | `code`, `config`, `doc`, `external` or `none` when the chosen option's probability is at least 0.6, otherwise `unsure` |
| `items[].loc`, `unit`, `text`, `anchor` | The unit, as in `cover`; `anchor` can be passed to `hibi claim --stdin` |
| `considered` | Units ranked, before `--limit` (default 50, 0 for all) |
| `skipped` | Uncovered units that were not sent |

Items are ordered by `checkable`, highest first. The human output ends with
"This is a ranking to read, not a finding."

### `suggest-evidence`

Candidates are every unit of the kinds given by `--kind` (default `function`,
`method`, `class`, `struct`, `interface`, `trait`, `enum`, `type`,
`variable`) in the files matched by `--in`, which takes `file:` or `repo:`
globs. More than 10,000 candidates is the error `too_many_candidates`.

| Field | Meaning |
| - | - |
| `candidates[].p` | The model's probability that reading this unit would confirm or refute the statement |
| `candidates[].fits` | `true` when `p` is 0.7 or more |
| `noneFits` | `true` when no candidate reaches 0.7 |
| `candidates[].loc`, `unit`, `anchor` | The unit and an anchor usable as evidence |
| `considered` | Candidates ranked, before `--limit` (default 10) |

A candidate is a suggestion to read, never a finding. The human output ends
with "These are units to read, not findings."

### `status --judge-order`

Only the order of the listed claims changes: stale claims come first, most
likely broken first, and every listed claim that is not stale follows, by
id. A side
cannot be rendered when it does not resolve to exactly one unit (it is
missing, ambiguous or unavailable), when its provider does not offer
`render` or `render` fails, or when it is a `file:` or `repo:` side whose
file git does not list. Claims with such a side are not sent and come first,
ordered by id. A claim whose sentence was edited at its quote is usually in
this group, because the side is `missing` (`not_exact`); the ranking covers
claims whose sides all resolve. The answer itself is not printed.

## Repeatability and failures

The model gives no determinism guarantee. hibi caches every answer in the
local [cache database](https://hibi.mintlify.site/configuration.md#cache), keyed on the model, the request
state and the exact question, and does not ask a cached question again. Delete
the cache, or run with `--no-cache`, and a new call may return different
probabilities.

Each request is tried up to 3 times with backoff on timeouts, connection
errors and status 408, 429 and 5xx, with at most 6 requests in flight. If a
request still fails, the command fails with `judge_failed` and prints no
partial result. A failed call is never read as a "no".

`HIBI_JEV_URL` replaces the service address. It exists for tests. It must be
an `https://` URL, or an `http://` URL to `127.0.0.1`, `[::1]` or
`localhost`; an empty value means the default address, and any other value
is `invalid_argument` before anything is sent.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.