-
policy.room({ port, conf?, reserve?, result_share?, beat_share?, call_reserve? }) is the window as one value: the Port's profile read once,
and the one division of it every window policy reads — limit and held
for the prompt's side, result_limit for one tool result, beat_budget
for one beat's results together, reply(used) for the reply's side,
thinking_stop(used, budget?) for the reasoning, count / count_text
through the Port, split(used?) as the value policy.split has always
answered, and limits_for_tools() in the shape std.fs.tool_specs{ limits } takes. It is frozen like a device and checked where it is declared: a
share outside (0, 1], a beat_share under the result_share, a reserve
that leaves no room, a profile naming no window are errors at construction,
in the caller's frame, before any beat. policy.is_room(v) tells one from a
table. window, tokens, result_cap, thinking_cap and room_note take
room in place of { port, conf, <their share> } — one or the other, not
both — and the older form builds a room of its own, so nothing a caller
wrote changes; a caller that builds one room and hands it to every seam has
the division stated once, which the five opts never did [the shape that
found the gap, measured 2026-10-01: three reads in one beat, each under
0.3 of a 5,952 limit, 6,534 together with the seed; no cap saw the sum].
-
policy.beat_cap({ room }) holds one beat's tool results together under the
room's beat_budget (default half of limit). A binder like repeat_cap:
bound to the session, it reads the results the beat now running has already
recorded off the log — the kernel writes each pair as it runs, in response
order — and answers the call that would cross the line { ok = false, reason = "beat_budget", tokens, used, limit, error }, naming what this result cost,
what the beat had taken, and what a beat may take, so the model asks again on
its next turn. The first result of a beat is never refused by it alone
(beat_share >= result_share). It goes outside result_cap: one result's
own limit first, the sum over what that let through. coding.run installs
it, with beat_share as an Exec knob (default 0.5, under strict, in
config), and hands the room's limits_for_tools() to std.fs.tool_specs,
so a read fits itself to the result limit and says where to resume instead
of being refused whole — the mechanism std.fs has carried since 0.38 for a
policy.result_budget that did not exist until this room did.
-
policy.compact({ at?, min_beats?, prompt?, fold }) answers the question a
loop asks before a beat — is the window nearly full? — and the fold the one
beat that writes a summary runs with. due(session) reads the window report
knl.beat already records on every llm_request since the latest summary:
"dropped" when the last fold left beats out, "share" when the last
request took at of the fold's limit or more (default 0.8), nil below that
and until min_beats beats (default 2) have followed the last summary. The
fold is the caller's own with the instruction appended as the last user
message and the tools left off: a summary is prose. Nothing here appends —
the summarising beat is the loop's, and the summary event
(policy.shapes.summary: the model's text and a ledger) is the loop's to
append — and policy.window{ from_summary = true } is the reader: from the
latest summary on, the request is the seed, the summary as one user
message, and the beats after it, windowed as before. The summary's place in
the log is the cut, so the summarising beat is behind it, and the log keeps
every event. Every harness that runs long compacts this way past a share of
the window [Claude Code, Codex, OpenHands, pi, Goose; surveyed 2026-10-01];
what was missing here was the shape the module's rules allow, and this is
it: three values in three seams, the loop between them. Between
compactions the request's head does not move, which is also what keeps a
provider's prompt cache warm — a window that only dropped beats moved its
head on every beat once full.
-
policy.ledger({ track?, kinds? }) reads the facts of a run off the log —
the beats and summaries so far, how many times each tool was called, the
distinct values each tool was handed under the track keys (default
path: the files read and edited), and for each kinds event (default
verify) how many checks ran, how many passed, and what the last one said
— as counts and names, never sentences, so there is nothing in it to
disagree with the record. A summary is the model's account of its own run
and the facts it most often loses are the ones it got wrong; the ledger goes
beside the summary in the summary event and window{ from_summary }
renders it under the summary, one line per fact (policy.shapes.ledger).
-
policy.room_note({ port, conf? }) ends every request with one line —
[window] 24984 of 32768 tokens used; 7784 left for the reply — off the
Port's count of the request and the split its profile gives, so the model
can read less, edit now, or stop re-reading before it is told to. The
sibling lane has sent this line since 2026-09-14; it is a filter like
thinking_cap, reads no log, and appends after a tool_result batch rather
than into one.
-
coding.run{ compact = { at?, min_beats? } | false } folds the record into
a summary when the window is nearly full, and it is on by default: before
every beat the loop asks policy.compact, and when it answers the loop
runs one beat with the summarising device (the same model and system line,
the window's own fold, no tools), appends the summary event with
policy.ledger's facts — the files the std.fs tools were handed and the
verify's answers — and every request after it is the seed, the summary and
the beats since (policy.window{ from_summary }). policy.room_note ends
every request with what it took of the window. compact is an Exec knob —
strict requires it, the config event and result.config name it — and
the result carries compactions, how many times the record was folded.
The summarising beats come out of the same grant of beats, one per
compaction. A summary that came back empty is not recorded; the loop
appends compact_skipped (policy.shapes.compact_skipped) in its place,
compact counts min_beats from that mark as from a summary, and the run
goes on over the window it had [measured 2026-10-01 against
gemini-2.5-flash over its OpenAI-compatible endpoint, window declared at
8,000: three compactions in one run, each cutting the next request from
~5,200 to ~3,100 tokens by the Port's count, with the ledger naming the
files read and edited and the verify's answers; 9 of 12 summary requests
came back with 0 output tokens, which is what the mark is for]. The
rendered summary says the ledger is newer than any state the task message
describes [measured in the same run: after a compaction the model read the
seed's red baseline as current while the ledger said the last verify
passed].
-
agent.run{ compact = true | { at?, min_beats?, reserve? } } is the same
for the generic agent, opt-in: it needs context_window beside the model
and the reply's room — max_tokens, or compact.reserve — and refuses the
run otherwise rather than filling either in. With it, the device folds with
policy.window{ fit, keep_seed, from_summary } and ends each request with
the window line, the loop asks policy.compact before every beat, and a
request that would not fit even compacted ends the run with context: as
the error instead of the provider's 400.