Unit 2 of 22 · Beginner

Why the parser refuses

The short version

Kestrel's parser is fail-closed, and that single property is a safety guarantee, not a strictness annoyance. When an agent writes a statement the parser cannot accept, nothing arms: no Plan takes effect, the standing book keeps managing under its existing obligations, and the runtime logs exactly what was refused and why. So the cost of every authoring failure is a missed opportunity — which the Grade records honestly — never an unbounded action. A bad author never becomes a bad position. The parser also refuses whole classes of unsafe statement at parse time, before they can spend, rather than trusting them and hoping. And the syntax itself is measured, not designed by taste: the language evolves from aggregated clusters of real authoring errors, so the grammar bends toward what capable authors actually write. This unit teaches why a refusal is the system working, and why fail-closed is the whole point.

A refusal is the system working

When Kestrel's parser refuses a statement, nothing bad happens — and that is the entire point. The parser is fail-closed: it is exact, it never silently repairs what an agent wrote, and when a statement will not parse the outcome is a stand-down, not a guess. This unit is about why that refusal is a safety guarantee rather than a strictness annoyance. The grammar reference covers the mechanism in full; here we teach why it is built this way.

Fail-closed: a parse error costs opportunity, never money

Consider the worst case in an ordinary programming language: a typo compiles into something that runs, and the wrong thing executes. In a system that spends money, that is unacceptable. So Kestrel inverts it. When an author writes a statement the parser cannot accept:

  • No Plan arms. The unparseable turn takes no effect at all.
  • The standing book keeps managing under its existing, already-authorized obligations — brackets, invalidations, and TTLs the runtime enforces regardless of what the failed turn tried to say.
  • The refusal is logged — exactly what was written, what the parser returned, and why — so nothing fails silently.

The consequence is a clean rule: a bad author never becomes a bad position. The cost of every authoring failure is a missed opportunity, which the Grade records honestly, never an unbounded action. Fail-open would trade the occasional catastrophe for convenience; fail-closed trades a missed trade for never having a catastrophe. In a market, that is the only acceptable trade.

The parser refuses unsafe classes, not just typos

Fail-closed is not only about malformed syntax. The same posture holds one level down: the parser refuses whole classes of unsafe statement at parse time, before they can spend. If a Plan tries to condition an exit on a value that cannot honestly be resolved, or reaches for authority it was not granted, the parser rejects it with a specific, repair-guiding error — rather than accepting it and hoping the situation never arises. The unsafe statement is caught where it is cheapest to catch: before anything is armed.

The syntax is measured, not a matter of taste

A last idea worth carrying: the grammar itself is not defended by a designer's opinion. It is measured. When capable models author Kestrel, their mistakes cluster — in the first live dry run, several independent frontier models wasted a large share of their turns on the very same error. A cluster like that is evidence, and it can be read two ways: teach the language better in the prompt, or bend the grammar toward what capable authors already write. Both are treated as testable responses to the same instrument, prompt changes first because they are cheap and reversible. The syntax evolves from data about real authoring errors, not from taste.

See it in kestrel

Run a real session and watch a Plan author, arm, and settle into a signed record — the happy path the fail-closed parser is there to protect:

npx kestrel.markets sim mean-reversion-range-fade

That runs a deterministic simulation over a generic range-bound session — managed licensed data, no wall time, no signup, no card — and prints a certified proof URL. Point the CLI back at the proof and it recomputes the whole record on your own machine, byte for byte:

npx kestrel.markets certify https://kestrel.markets/proof/art_f576347572a410a52647cf90

Keep it one command away: drop the kestrel.markets MCP server into your client and the next session is already wired up — no account in between.

Recompute it

Every claim in this unit recomputes from a certified proof — no account, no card.

/proof/art_f576347572a410a52647cf90
Keep readingReading a Frame like an agent does