# State

The state is what the engine evaluates: a support message, a document, an application record. It goes in the `state` field next to the questions.

## Formats

- a string: `"My card was charged twice."`
- an object with named fields: `{"message": "My card was charged twice.", "order_id": "A-104"}`
- an array of strings: `["Hi", "My customer number is TS1337.", "My card was charged twice."]`

Text only; images, audio and video are not read. English first: Jers's English checkpoint is the measured one; its multilingual checkpoint covers more languages with lower accuracy.

## How much the engine reads

The request body is capped at 1 MB, but the engine reads far less. Each question is read together with the state in one window, and the question and its options take their share first. Measured on 2026-09-23 with a long state:

| Checkpoint | Window | State read with a short question | With 10 to 20 options |
|---|---|---|---|
| `jers-english` | 512 tokens | about 475 tokens | about 330 tokens |
| `jers-multilingual` | 1024 tokens | about 990 tokens | about 780 tokens |
| `jers-typed-decisions` | 1024 tokens | about 990 tokens | about 790 tokens |

The rest of the state is cut from the end. Memory lines and computed facts are placed before the state (below), so they take their share of the same room first. Every answer says what was read: `reading` per question (`state_tokens`, `read`, `room`, `chars_read`, `truncated`; with memory or `derive` these count the lines placed before the state too, and `context_lines_read` says how many of those lines were read) and, in `usage`, `state_tokens`, `state_tokens_read` and `state_truncated`. A cut state also brings a `state_cut` warning.

What to do about a long state:

- Put the part that matters first, or send only that part.
- Send `"windows": true`: when the state is cut, the engine reads it in overlapping windows (neighbours share 32 tokens), at most 16; a longer state is read up to the 16th window, `windows.covered_all` is false and the `state_cut` warning stays. By default a yes/no question takes the window with the highest yes, a score the highest level, and a choice the most confident window (for a choice `min` and `max` both take the most confident window); `"windows": {"combine": {"question_id": "mean"}}` sets `min`, `max` or `mean` per question. Each window bills the request's answers once more; see Request options.

## What the memory adds

When the request names a subject, the recalled lines are placed **before** the state, so the engine's cut from the end can never remove them: for a string, a block headed `What this customer's memory knows:` with one line per fact (the wording every measurement here was made with); for an object, a `known_facts` key placed first; for an array, a leading element. Facts computed by `derive` come first of all: under `Computed by the system:` in a string or an array, as a `computed_facts` key in an object. The answer's `memory.hits` lists the recalled lines and `memory.lines_seen` how many of them the engine actually read.

## Guidance

- Put facts in the state and judgments in the questions.
- Use an object when several things must be compared: the message, the order, the policy.
- Decompose: one state per subject, not a batch of unrelated records.
- Reference fields from the instructions with their names in backticks, `` `order.total` ``, when the question is about one field.
