# The four statements (/docs/concepts/statements)



Kestrel is four kinds of statement. Slow judgment, compiled into a fast reflex.
Every snippet on this page is real Kestrel that passes the pinned parser; parsing
is fail-closed, so anything less would be rejected before it could spend.

A Kestrel strategy is a **compilable document**, not a script you hope will behave.
It stays small enough to hold in an agent's context, deterministic enough to grade,
and diffable enough to review line by line — the properties SQL gave data access,
brought to trading reflexes. Speed follows for free: because the deliberating brain
has structurally left the hot path, the compiled reflex fires at the tick. Speed
isn't a knob you tune; it's a corollary of having written the strategy down.

## View — see the market as text [#view--see-the-market-as-text]

A **View** selects the panes your agent needs to decide (macro, volatility, tape,
levels, chain) at a token budget. It materializes into an attributed Frame; the
renderer never invents a value.

```kestrel
VIEW open budget 1800
  macro week quarter rv20
  vol straddle expected-move
  tape skyline 5m vwap detector-strip
  levels registry
  chain fair realness
```

## Wake — decide when to look [#wake--decide-when-to-look]

A **Wake** is a trigger that returns control to the agent. Wakes are event-driven,
never an arbitrary clock: a market-phase window opening, a velocity spike, a
structural pattern completing. Between wakes, the agent sleeps and spends nothing.

```kestrel
WAKE session-open
  WHEN phase open
  DELIVER open MANDATORY

WAKE fast-move
  WHEN velocity(1m) > p99
  DELIVER zoom-1m KEYFRAME

WAKE fade-setup
  WHEN second failed-break of hod within 30m
  DELIVER execution
  BUDGET 12 wakes/day
```

## Plan — compile judgment into a reflex [#plan--compile-judgment-into-a-reflex]

A **Plan** is one bounded thesis, compiled into a deterministic reflex the runtime
fires at the tick: no wall time, no nondeterminism, no silent defaults, no
commerce callbacks in the reaction path. `budget` makes risk a type, not a
comment; `ttl` expires the authority.

```kestrel
PLAN momentum-breakout budget 0.25R ttl +30m regime {intraday: trend}
  USING signal SPX exec SPY 0dte
  WHEN spot crosses above hod AND velocity(1m) >= p95
  DO buy 2 +1 C @ min(fair-3c, mid) peg esc fair 2m esc ask 4m cap fair cancel-if spot < vwap
  EXIT spot < vwap held 60s @ fair esc mid 30s
```

**Run the option leg free.** The plan above is the full-dress version. This trimmed
twin trades the same `+1 C @ min(fair, mid) peg cap fair` leg end-to-end on the free
`ODX` 0DTE cell — the free catalog's options-chain session — so you can watch an
option leg actually fill and settle a certified grade before you sign up:

```kestrel
PLAN momentum-breakout budget 0.5R ttl +360m
  WHEN spot > 0
  DO buy 2 +1 C @ min(fair, mid) peg cap fair
```

```bash
npx -y kestrel.markets sim 0dte-options-opening-drive --plans breakout.kestrel --json
# order_count ≥ 1, fill_count ≥ 1 — the +1 call rests a fair-anchored bid at the open,
# fills on the retest offer, and the breakout carries it in-the-money.
```

## Grade — get a black-box receipt [#grade--get-a-black-box-receipt]

A **Grade** is a counterfactual evaluation under pinned data and pinned fill
models, with a replayable certified receipt. You name the plan, the window, the
fill model, a baseline to compare against, and the cells to break the result by:

```kestrel
GRADE plan fade-ladder OVER 2025-01..2026-06 FILL maker-v1
  VS ungated null
  BY regime.intraday, lineage
```

There is no letter grade. A Grade reports honest, separated numbers: a realized
**floor** in dollars under the deterministic strict-cross fill model (the lower
bound: only definite fills count), an **expected** value under the analytic fill
survival model (a bound beside the realization, never the headline), and a
**bankable EV** that refuses to count expectation resting on extrapolated support.
Every certified Grade is replay-stable and signed; see
[Evidence](/docs/concepts/evidence). A Grade earned over the public practice
catalog is a practice Grade, structurally labeled non-ranking, and never
performance evidence.

## Why determinism is load-bearing [#why-determinism-is-load-bearing]

The four statements share one substrate property, and it is the one everything
above them is built on: an Episode replays **byte-identically**. The same
plan, over the same pinned data, under the same fill model, produces the same
result — on any JavaScript engine, today or a year from now.

That is what turns a Grade into a *receipt* instead of an opinion. Certification
is only possible because a separate verifier can recompute the exact bundle and
get the exact bytes back (see [Evidence](/docs/concepts/evidence)); a black-box
number you cannot reproduce is a claim, not proof. Determinism sits upstream of
the whole accountability chain — it is why a Grade can be signed, why a proof URL
can be re-verified by the person who receives it, and why promotion from sim to
paper to live rides signed receipts rather than trust.

Managed orchestration inherits the same discipline. The runtime introduces no
wall time, no nondeterminism, no silent defaults, and no commerce callbacks into
a reaction path: the reflex you wrote is exactly the reflex that fires. Everything
the platform sells above the language — the certified receipt, the recomputable
track record — exists because the substrate underneath it is deterministic.
