Unit 1 of 22 · Beginner

View, Wake, Plan, Grade

The short version

Kestrel is one small language with exactly four kinds of statement, and together they are the whole thing an agent needs to work a market. A View sees the market as attributed text — the panes it needs, at a token budget. A Wake decides when to look — an event, never an arbitrary clock — and hands control back to the agent. A Plan compiles one bounded thesis into a deterministic reflex the runtime fires at the tick, with no wall time, no nondeterminism, and no silent defaults. A Grade evaluates what happened against a baseline and returns a replayable, signed receipt. The whole design is slow judgment compiled into a fast reflex: the deliberating brain authors these statements, then leaves the hot path so machine-speed reaction is deterministic. Two properties keep them safe rather than merely clever — risk is a type (`budget`), and authority expires (`ttl`). This unit teaches how the four fit together.

The whole language is four statements

Kestrel is one small language with exactly four kinds of statement, and together they cover everything an agent does at a trading seat. Most languages are large because they are general. Kestrel is small on purpose: it does one thing — let an agent perceive a market and act in it deterministically — so it needs only four statement kinds. Learn what each one is for and you have the shape of the whole system.

  • A View sees. It selects the panes the agent needs to decide — macro, volatility, tape, levels, chain — at a token budget, and materializes into attributed text the agent reads.
  • A Wake decides when to look. It is a trigger tied to a market event — a phase opening, a velocity spike, a pattern completing — not an arbitrary clock. Between wakes the agent sleeps and spends nothing.
  • A Plan acts. It compiles one bounded thesis into a deterministic reflex the runtime fires at the tick.
  • A Grade judges. It evaluates a run against a baseline and returns a replayable, signed receipt.

The four statements reference specifies each one's exact syntax; this unit is about why the set is what it is.

Slow judgment, compiled into a fast reflex

The single idea underneath all four is a separation of speeds. Deciding what strategy to run is slow, expensive thinking — the kind a frontier model or a person does a few times a day. Reacting when the market moves has to happen in microseconds. If the same brain tried to do both, either the thinking would be too shallow or the reaction too late.

Kestrel splits them. The brain does its slow work up front and writes it down as a Plan — a fixed, contingent program. Then it leaves the hot path entirely. The deterministic runtime fires that Plan at the tick with no wall time, no nondeterminism, no silent defaults, and no commerce callbacks in the reaction path. That is what "written down deterministically" buys: machine pace because the deliberating brain has already left.

Two more properties keep a Plan safe rather than merely fast. budget makes risk a type, not a comment — the runtime enforces it. And ttl expires the authority — a reflex that outlives its thesis stops arming itself. A Plan is a bounded, self-cancelling program, never open-ended permission.

A worked example: one thesis through all four

Take a generic range-bound session — call the instrument GENCO. An agent might express a simple mean-reversion idea across the four kinds:

  • View: watch the tape, the day's levels, and volatility, at a lean budget.
  • Wake: return control when price fails a second time at the high of day.
  • Plan: with a small budget and a short ttl, fade that failed break back toward the session mid, with the exit and invalidation written into the Plan.
  • Grade: after the close, score the run against a do-nothing baseline and emit a signed receipt of exactly what filled and what it was worth.

Notice what the agent never had to do: sit and watch. It declared what to see, when to look, what to do, and how it will be judged — then slept.

See it in kestrel

Run a real range session and watch the whole cycle produce a receipt:

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, so you trust the math rather than the server's word:

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 readingWhy the parser refuses