Harness-owned state for the latest user interaction. Long-running work is
represented independently by the RTDL forest; it must not keep older user
text welded into the current goal forever.
Metadata for one in-flight RTDL tree in the forest. Trees are keyed by
pilot-assigned plan_id; this carries what the supervisor and the LLM need
to reason about a running tree (and, later, what the chat UI renders).
One-line protocol reminder sent on every round after the first. The full
~9KB rtdl_protocol.md is sent only on round 0 (and the modelβs own prior
envelopes stay in history), so later rounds re-anchor cheaply instead of
re-shipping the whole spec β a large latency/token win on multi-round turns.
Process-wide monotonic source of node op_ids. The LLM-emitted RTDL does
not carry a usable op_id (it defaults to 0), so pilot assigns one itself
while parsing: a globally-unique, auto-incrementing id starting at 1.
βGlobalβ = across every plan/round in this pilot process, so each node in
the live task-graph forest is uniquely addressable for steering and result
correlation β not merely unique within one plan.
Apply only progress fields from the model. The user-owned goal is immutable
within the standing task; steering is appended by the harness above. The
model may refine the default success criterion once, but cannot erase or
replace an established criterion. Completion is accepted only at a harness
safe point with no new or in-flight execution.
Build the per-round protocol + capability catalog. full_protocol ships the
complete spec (round 0); otherwise a one-line reminder. The capability
catalog is always included because providers can change mid-turn.
Cancel every real task tree owned by this turn before reporting the Pilot
session interrupted. Dropping the Execute stream alone only detaches Pilot;
Executor continues the plan (and synchronous tools such as run_command)
unless its PlanRuntime receives an explicit cancel_plan request.
Claude-Code-style rolling compaction. When the running history grows past
HISTORY_COMPACT_TRIGGER_CHARS, summarize everything except the most recent
HISTORY_KEEP_RECENT messages into a single summary note (preserving goal,
decisions, observations, and current state) and keep the recent turns
verbatim. This shrinks the per-round prompt for the rest of the turn instead
of re-shipping the full transcript every round.
Drive one dispatched planβs Execute stream to completion, forwarding node
states for visualisation and collecting terminal results. Sends exactly one
PlanDone when the stream ends. Runs as its own task so the supervisor loop
never blocks on a single tree β concurrent trees form the forest.
A single empty-sequence root plan, used as the no-op plan when a turn ends in
RTDL recovery. Carries non-empty op_id/description so executorβs
validate_plan accepts it.
Render the in-flight forest as a system-prompt block so the LLM can see what
is still running and reference a plan_id to cancel it. Empty when no tree
is running. Trees are ordered by numeric plan id for stable output.
True when every do node is a plan-control builtin and there is at least
one. Plan-control trees are not themselves cancellable task work; advertising
them makes the model inspect or cancel its own control actions.
Tolerates a prose preamble or trailing commentary around the JSON object
(a common model habit, e.g. a narration line then the JSON on the next
line) by extracting the first balanced {...} before parsing; the raw
string is used unchanged when no object is found, so a genuinely
JSON-less reply still surfaces the original parse error.