← Blog

View / Wake / Plan / Grade: Four Statement Kinds, One Lexical Core

A foundational tour of Kestrel's four statement kinds, and how an agent authors perception, attention, latency, and trust over one lexical core.

Answer card

Kestrel is an open-source language and runtime for agentic trading with exactly four statement kinds over one lexical core: VIEW (perception: the market as compact text), WAKE (attention: a standing, event-driven subscription), PLAN (latency: a bounded-risk contingent program the runtime fires in milliseconds), and GRADE (trust: the honest, counterfactual result of a run). The agent authors all four; the runtime perceives and executes; Risk sits above every author. That is the whole surface.

Why four kinds, and only four

Most trading interfaces were built for a human staring at a screen and clicking a mouse. An LLM has neither eyes nor a fast trigger finger. This is the Interface Thesis: the two failures of LLM trading are interface (perception and latency), not intelligence. A frontier model can reason about a tape it cannot see, and can decide correctly a full network round-trip too late to matter. Kestrel closes both gaps with statements, not screens.

The division of labor is fixed. The agent authors. It writes VIEW, WAKE, PLAN, and GRADE statements as text, the medium models are already fluent in. The runtime perceives and executes. It renders the market, watches triggers, fires contingent programs, and records what happened. Risk sits above. A dedicated risk layer (L0) can clamp or veto any author, including the agent, and may never open risk; authority only narrows downward.

The four kinds also spend four different budgets. VIEW spends tokens (context). WAKE spends attention (wakes/day), never risk. PLAN spends risk (an R budget). GRADE spends compute (a replay). Keeping the budgets separate is what lets an agent watch a hundred things cheaply while risking capital on only a few.

VIEW: perception

A VIEW renders the market as a compact text Frame: a chart-in-text sized for a context window. The chart is in text. It is a vertical, append-only tape (one row per candle, newest last) where candles are relative, quoted in basis points versus the prior close, and anchored by periodic keyframes so absolute price never drifts out of reach.

The payoff is cache economics. Because the tape only ever appends, re-perceiving costs O(new bars) not O(screen): the KV cache from the previous read stays valid, and the model pays only for the candles that arrived since. A screenshot re-costs the whole image every tick; a Frame does not.

VIEW tape-1m budget 1200
  candles 1m last 60m
  keyframe every 15m
  session vwap hod lod

That is a standing description of how to see, not a one-shot query. Point a WAKE at it and the agent receives the same well-formed Frame every time it is woken.

WAKE: attention

A WAKE is a standing subscription over the trigger algebra: series crossed with predicates, composed with AND/OR/NOT. It is event-driven, not polling: the runtime evaluates the condition and only spends a wake when it fires. A WAKE spends attention, never risk. It can deliver a Frame and cost tokens; it cannot move a dollar.

WAKE vol-spike
  WHEN velocity(5m) >= p95 AND spot > VWAP
  DELIVER tape-1m
  BUDGET 8 wakes/day

This is how an agent stays cheap. Instead of burning inference on a polling loop, it declares the handful of conditions worth its attention and sleeps until one is true, capped here at eight interruptions a day.

PLAN: latency

A PLAN is a standing, bounded-risk contingent program: trigger, actions, bracket, invalidation, and a mandatory TTL. The runtime fires it in milliseconds and wakes the agent in parallel: fire-then-inform. The agent is never in the hot path. Decisions the model already made, encoded ahead of time, execute at machine speed; the model learns about the fill on its own clock.

PLAN headline-chase budget 0.25R ttl 15:55 regime {intraday: trend}
  USING signal SPX exec SPY 0dte
  WHEN spot > HOD AND velocity(5m) >= p95
  DO buy 2 +1 C @ min(fair, mid) peg cap fair
  TP 2.5x frac 0.5 @ fair
  EXIT spot < VWAP held 120s @ fair

Read the price anchors carefully, because a quote is not a value. fair is an intrinsic estimate (VALUE); mid is a point on the book (BOOK); min(fair, mid) ... cap fair says "pay no worse than mid, and never above fair." Prices are expressions, not magic numbers: offsets (fair-3c), leans (lean(bid,fair,0.5)), and guards (min/max, cap, peg) all compose.

You would not paste this template and let it trade. You deploy it into your pod and arm it: the risk envelope, the two-signer authority, and the LIVE controls are yours. This article shows only how an agent could express the intent.

GRADE: trust

A GRADE is the honest, counterfactual result of a run, and it is where Kestrel is most opinionated, because a Grade is never flattering when it is done right. Grades judge judgment, not parameters. The counterfactuals live in the syntax: VS ungated reruns the plan with its regime gate removed and asks whether the gating helped; VS null asks whether it beat doing nothing.

GRADE plan headline-chase OVER 2026-04..2026-06 FILL conservative
  VS ungated
  BY regime

The hard part is contamination. Weights leak what code fences can't stop: an LLM may have memorized the very days you test on. So LLM authors are contamination-fenced: graded only on post-training-cutoff, date-blinded days, so the score reflects reasoning under genuine uncertainty rather than recall. Grades attach to certified Blotters (deterministic session records), so a result is reproducible, not asserted.

How the kinds compose

The lifecycles split cleanly. VIEW, WAKE, and PLAN are standing: they persist and react. GRADE is imperative: you run it against a range and read the answer. A typical loop: a WAKE watches, delivers a VIEW when something moves, the agent reasons and arms a PLAN, the runtime fires it, and later a GRADE tells the honest story. One lexical core (the same triggers, series, and price anchors) runs through all four, so an expression learned in a WAKE reads identically in a PLAN.

Above all of it, Risk can clamp or veto, and the live singleton guarantees one pod never runs live twice. That is the org model in one line: a recursive pod tree where budgets nest and authority only narrows downward.

Where this is honest about status

The language design above is the stable core. On the surrounding platform (kestrel.markets), as of mid-2026: anonymous trial sims, certified Grades, shareable proof URLs, and 402 Offers with Stripe settlement are live; always-on paper presence and the human-signed live path are in build. The free tier needs no signup. Kestrel is also not a fit for slow, discretionary, human-in-the-loop trading; its whole reason to exist is to take the human out of the hot path.


Citable one-liner: Kestrel gives an agent four verbs (VIEW perceives, WAKE attends, PLAN acts, GRADE judges) over one lexical core, so the model supplies judgment and the runtime supplies everything that stays scarce.