Repository navigation
0.40.0 - 2026-09-29
Release Notes
Added
-
policy.split({ port, conf?, reserve?, used? })hands the window's split
back as a value:{ window, max_output, limit, held }— the profile's
window and the wire's cap (0 for none), the most a request may cost, and
whatreserveheld back beyond the cap — withroombeside them when
usednames what a request costs: the reply's side,min(window − used, max_output). They are the same readingspolicy.window,result_capand
thinking_capmake for themselves, off the same profile through the same
three functions, so a caller can log the numbers a run is sized by, check
a conf before opening a session, or size something of its own against the
split rather than a second guess at it. A reading, not a policy: it plugs
into no seam and changes nothing by being called. The shape is
policy.shapes.split. -
policy.thinking_cap({ port, conf, call_reserve, budget? })sends the
reasoning's stop point with every request, andcoding.run{ call_reserve = N }is the opt that puts it on a run. The model cannot see its room, and
its reasoning comes out of the same allowance as the answer: a beat whose
prompt has grown has less left for both, nothing in the conversation says so,
and the tool call the model was about to make never gets written [measured
2026-09-13 in a sibling lane: a prompt of 24,984 tokens in a 32k window,
7,121 of them spent thinking, and the call that followed arrived as{}].
The filter takes the reply's room — the window less the Port's count of the
request, and no more thanprofile.max_outputwhere the wire carries that
cap — lesscall_reserve, capped bybudgetwhen the caller has one, and
sends it asrequest.thinking.budget_tokens; under one token it sends
nothing, since "stop after 0 tokens" is not a stop point. The room is read
off the same profilepolicy.windowsplits the window by, through a
reply_roombeside itsrequest_limit, so the split between prompt and
reply is decided in one place; what the fold held back asreserveis not
named to this filter and not subtracted again — it is that room. The conf
has to turn reasoning on (thinking = true, or a table whoseenabledis
not false), and the filter refuses one that does not: the adapter reads a
thinking table on the request as reasoning on, and the request's replaces
the conf's, so a budget over a conf that asked for no reasoning would switch
it on by itself. It reads no log and keeps nothing between beats — the room
comes from the Port's own count of the request the fold has just built, which
is the count the fold already asked for when nothing before this filter
changed the request. No other harness sizes reasoning per request; the ones surveyed fix
an effort for the run, and what varies with the remaining room is done
provider-side where it is done at all. The evidence for doing it here is a
sibling lane's [measured 2026-09-14: on a 32k window, the beats where the
stop point fired still delivered their tool call, where the unbounded ones
filled the window and delivered nothing]. It is opt-in and reaches the wire
only on a dialect that takes a per-request budget — vLLM's
thinking_token_budget;llm_proto.openaiwarns and sends nothing on the
others, and Anthropic deprecated its ownbudget_tokensin 4.6. -
coding.run{ seed = "names" }seeds the targets by path instead of by
content, and it is the default: the spec, then the list of files to edit,
and the model reads the parts it needs with the read tool.
coding.seed(spec, targets, { mode = "names" })is the same thing as a
function;seed = "full"is every target whole and line-numbered, the shape
the loop had before. Names is the shape every run in the sibling lane has
taken since 2026-09-14 — the rework runs it judged correct (4 of 6), and a
1,991-line target (2 of 2) that no window in that lane could have held whole
— and the one published comparison prefers it too: a viewer-based agent
measured whole-file seeding worst of its options (SWE-agent ACI, 12.7
against 18.0 for a 100-line viewer). Full has no run behind it since the
lane switched.seedjoins the knobsstrictrequires a caller to state,
and goes into theconfigrecord with the rest. -
std.fshas anappendop, andcoding.run{ ops }says which ops the model
is handed. Appending is how a file too large for one reply gets written:
writethe first part, append the rest, one call at a time. Without it a
model that runs out of room mid-file has nothing to continue with — it
rewrites from the top and loses what it had, or leaves the file empty
[measured 2026-09-17 in a sibling lane: a run said it would add its tests on
the next turn, hit the window, and left a 0-byte file. In the one run of
that task the lane later judged correct, the model's first write arrived
without its content and was refused, the reply was cut, and the file was
then written and extended by three appends; the other runs of the task used
append as well and were still judged wrong — append got the file written,
it did not get the task right]. The op reads and writes through the
same primitives the other ops use, holds to the samepath_lock, and refuses
a file that is not there rather than creating one: the op that creates a file
iswrite, and one call that either creates or extends is a call whose
result the caller cannot predict.coding.run{ ops = { read = "read", edit = { "search_replace", "write", "append" } } }picks the tool set; the default
is{ read = "read", edit = { "search_replace" } }, the two tools the loop
has always handed out. Every edit op is path-locked to the targets, every one
counts toward the edits a run has landed, and every one resets
policy.repeat_cap— what makes an old read new again is the file having
changed, and any of them changes it. The system line names the edit tools it
was given, an opstd.fsdoes not have is refused by name, andopsjoins
the knobsstrictrequires a caller to state. -
policy.require_args()refuses a tool call whose required arguments did not
all arrive, before the handler runs:{ ok = false, reason = "argument_missing", missing = <key> }, naming the argument and saying where
a call like that comes from. A reply that runs out of room stops wherever it
had got to, and that may be the middle of a call's arguments — the call
reaches the tool with apathand nocontent, and the tool answers in its
own vocabulary for a field it found missing, which says nothing about the
reply having been cut [measured 2026-09-17 in a sibling lane: fivefs_write
calls arrived with nocontentand three of them drew no word about it, so
the model sent the same shape again]. The check is on the arguments rather
than onfinish_reason, because the servers do not fill that field reliably
— vLLM reports a call cut at the output ceiling as a whole one — and nothing
is retried or repaired: re-sending on the harness's own initiative is the
loop other harnesses report. A tool declaring norequiredlist is handed
back as it is.coding.runwraps its tools with it, outermost of the three:
a call that arrived without its arguments is not a repeat of anything and has
no result to measure. Beside it, a beat whose answer stopped at the output
limit (stop_reason=max_tokens/length) is no longer read as the
model declaring it is done, and the next request carries the fact as one
harness line. -
coding.config_of(opts, resolved)andcoding.result_of(st, max_iters)are
the two halves of a run that were built inline: what the run was configured
with — every knob with its value and whether that value came from the
caller, this module'sdefault, or wasdiscoveredby asking the port —
and the result the run answers with. Both are functions of their arguments,
so what aconfigevent will say, and what a given end state reports, can be
checked without opening a session. -
knl.shapes.tool_specdeclares what a tool is — its name, what the model is
told about it, its input schema, and the function that runs it. That triple
was written three times and nowhere declared:std.fs.tool_specsanswers
with it,knl_adapter.toolstakes an array of it, and a device's map holds
it under the name. Now the kernel owns the one declaration and the other two
are projections of it — a device's entry is the spec minus the name its map
keys on, andknl_adapter.shapes.tool_decl(what a provider is shown) is the
spec minus the handler, both taken from its fields rather than restated.
knl.devicechecks each entry against that shape instead of a hand-written
reading of it beside it, so a tool with no handler, or one whose handler is
not a function, is refused where the device is built and the message names
the tool. -
coding.runsplits its opts by where a value comes from, and refuses to
start without the ones it cannot answer. Three facts about the model are
tripwires rather than defaults, because a default here is a number invented
about somebody else's server: the reply's room (llm.conf.max_tokens, the
cap the wire carries, or the newreserveopt, the tokens the fold holds
back when no cap is sent), the window (llm.conf.context_window, or a port
whose profile can ask its server — asked up front now, so the refusal comes
before the baseline verify rather than out of the fold a command later), and
the reply's seconds (llm.conf.timeout, the lineagent.runalready draws).
All three are checked together and the refusal names each missing one and
the opt it goes in.thinking, the sampling knobs andreasoning_effortare
not tripwires: absent, they are not sent, and the server's own default
stands. The loop's own policy — iterations, turns, the verify's timeout
curve, the caps,done— keeps every default it had, andstrict = true
gives those defaults up: each such knob must then be named by the caller,
and the run refuses while any is not, listing all of them at once.strict
is a lever the top level pulls on itself and is never read from the
environment here, for the reason rustc has--cap-lints. What a run was
configured with is written into the record as oneconfigevent and handed
back asresult.config: every knob with the value it ran at and where that
value came from —caller,default, ordiscoveredfor a window a port
asked its server for — so what a run did is read off its own log instead of
reconstructed from the caller's source. -
policy.window{ fit = { reserve } }holds tokens back for the reply. The
limit a fitted window measures against is the context window less
profile.max_output, so a port that sends no answer cap leaves the whole of
it to the request: the fold fills it with prompt and the model has nowhere
left to answer [measured 2026-09-13 in a sibling lane: in=32,718 / out=50
for two beats in a row].reserveis a whole number of tokens held back
beyond what the wire's cap already covers —max(0, reserve - max_output),
so a reserve at or under a cap that is there holds nothing extra — and a
reserve leaving the request less than one token raises rather than sending a
window of nothing. The fold's report says how many were held (reserve)
beside the number the candidate was measured against (limit), and the
predicatefithands back is held against that same number. Absent, the
window is the one it was. -
A
coding.runends when the model says it does, and a green verify alone no
longer ends one. The verify passing is one fact and never the whole of it: a
spec spanning a function and the test it asked for goes green on the part
that had to compile while the test is not written yet [measured
2026-09-11/12: of 9 runs, the 4 that landed a single edit converged on a
green before any test existed].done = "declare"— the default, so a
caller that says nothing gets it — ends a run when the model answers WITHOUT
a tool call while the verify is green and an edit has landed.done = "plan"
adds aplantool: the model first files the steps it will take, each with a
shell command that exits 0 once that step is done; the harness runs every
check after each iteration and hands the results back as facts, and the run
ends only when all of them pass as well.check_timeoutis the seconds one
such check may take, and is required in that mode. The result says which mode
ran (done) and, in plan mode, what the checks came to —plan = { total, passed, filed, failing }, wherefailingnames the checks still
red when the run ended rather than leaving a caller with a count. -
A failed
fs_search_replacesays what is actually there. "Not found" on its
own was the one failure a model could not act on: it said the guess was
wrong without saying what the file holds, so a model that believes the code
reads one way re-sends the same belief [measured 2026-09-11: one run sent
collect::<Vec<u32>>()four times; the file held what the model itself had
written two edits earlier, and it took narrowing the read twice and six
attempts to copy it]. The sibling failures already did better —
search_ambiguousreturns the match count,result_too_largethe size and
the limit — and this closes the last one. The result now carries the point
where the search stopped agreeing with the file and the file's own text from
there, in the shape the search tried to name; when not even the first line
occurs, the line sharing the most identifiers with it, which is the case a
model working from a paraphrase of the seed lands in. An edit whose{minus
}count differs from what it replaced is reported as well, so a snippet
appended after a block without its closing brace is answered by the tool
rather than by the verify two iterations later. -
std.fs.tool_specs/register_toolsrequireopts.allowed. Which tools a
model is handed is the caller's decision and nobody else's; a default meant a
caller that said nothing still got a surface someone else picked, and then had
no way to know what its model was holding. The old default{"read","edit"}
handed out the line-addressed edit in particular, which a loop then
compensated for by telling the model in prose which tool to call — and a
spec's own "read this file first" was overridden that way [measured
2026-09-12]. There is no opt-in tier any more either:write,rollbackand
search_replacesit beside the other two, named or absent. -
The Lua half of the
std.fs/std.ts/std.sql/std.kvbridges is an
embedded module rather than a source file compiled into one call site.
fs_tools/ts_tools/sql_tools/kv_toolsnow live under
blocks/lib/, each bridgerequires its own by name after registering the
Rust half, and the require path answers the way it does for every other
module: a project's.agent-block/lib/fs_tools/wins, the embedded source is
the fallback. Soagent-block vendor fs_toolschanges which file operations a
model is handed, under what names and locked to which paths, with no install
in between. A VM with no require registry — a unit test's bareLua::new()—
still gets the embedded source directly; only "module not found" falls back,
so a syntax error inside a project's copy is reported rather than silently
replaced. -
A module vendors with its specs.
vendor policywrites
.agent-block/lib/policy/spec/*.luabesideinit.lua— the same mlua-lspec
specs that check the embedded module — andlua-spec-runner --project <dir>
(just test-lua-project <dir>) runs a project's vendored specs with its
.agent-block/lib/first on the require path, so the copy that was edited is
the one they check.--listshows the count (policy (spec/: 11)). The
specs are listed bybuild.rsfrom the tree (blocks/{,lib/}<module>/spec/),
not by hand; the lspec fixtures foragent,codingandllm_protomoved
fromtests/fixtures/into thosespec/directories, andlua-spec-runner
looks in bothblocks/<name>/spec/andblocks/lib/<name>/spec/. -
-p/--projectreadsAGENT_BLOCK_PROJECTfrom the environment, so a fixture
suite (AGENT_BLOCK_PROJECT=<dir> cargo test -p agent-block) can be pointed at
a project's vendored copies. An explicit-pstill wins. -
agent-block knl sessions [--after <ID>] [--limit <N>] [--store <PATH>]and
agent-block knl backup --to <PATH> [--store <PATH>]: the two questions a
reader outside the host could not ask of a kernel store.export --session
needs an id, and the only listing of a store's sessions was
knl.views.sessions, which is Lua running inside the host;sessionsis
that listing as JSON Lines,{ "session": <id>, "head_seq": <n> }one
record a line, paged by an exclusive cursor (the last id printed is the next
call's--after, and the default limit is 1000). It reads the stream
counter rather than the events, so it is the truth of which sessions exist
rather than of which still hold rows.backupcopies a store that something
is writing to, whichcpis not: in WAL mode the-walfile holds
committed pages the main file does not yet, and a copy taken between two
writes can carry half a transaction. The copy is the whole file taken in one
step under one read transaction, so it opens as an ordinary kernel database
andexport --store <copy>reads it; the destination must not exist, and a
path that already holds something is refused rather than overwritten. Both
resolve--storethe wayexportdoes and fail the same way — one line on
stderr and exit 1 — except that an empty listing is an answer rather than a
failure.Three other additions of the release are deliberately not taken.
archive_then_retainand itsSinkwould need a retention policy this
project has not decided — when a run's log may go, and where it goes first —
and the door stays open upstream for when it does.ProjectionRunner::follow
has nothing to run: the kernel builds no eventsdb projections. And
Filter::stream_prefixselects nothing meaningful here, because this
kernel's session ids are UUIDs.
Changed
-
The two consumers,
agentandcoding, are written in Teal and live
underblocks/lib/with every other embedded module
(blocks/lib/agent/init.tl,blocks/lib/coding/init.tl). They were the
last embedded modules in Lua, and they sat wherehtl checkcould not
see them: the checker reads the modules underblocks/lib, and a block
atblocks/<name>/belongs to none of them. Nothing changes for a
caller —require("agent")andrequire("coding")answer the same
tables,agent-block vendor agentstill writeslib/agent/init.lua(the
Lua the binary embeds, as for every Teal module), andinspect_tools
reports the same two blocks. Both take one shape now, stated in the code
rather than the header:preparetakes the opts to aRun— foragent
the provider, the MCP servers connected and every tool source bound into
one map; forcodingthe tripwires, the targets, the fs tools locked to
them, the seed, the system line and the seams —run_loopdrives the
beats, andresult_ofreads what it answered into the result callers
have always read.host_types.d.tldeclares what the two read of the
host that nothing had declared:tool.call/tool.schema, themcp
functions, andstd.fs.tool_specs.policy.require_args's published
type takes its opts as optional, as the function always did. -
The kernel's shapes are a sub-module,
knl.shapes(blocks/lib/knl/ shapes.tl).knl/init.tlheld the code and, in the middle of it, a
thousand lines of data — every public contract as an lshape and the
registry that names the shape of each export. The data reads nothing of the
code's, so it is in a file of its own now, required byinit.tland
published asknl.shapesunchanged: a caller readsrequire("knl").shapes
as before and the 33 keys are the ones they were. What is visible from
outside isagent-block vendor knl, which writeslib/knl/shapes.lua
besidelib/knl/init.luaas it writes every module with its sub-modules,
and the spec runner, whose freshness check reads every.tlbeside a
module'sinit.tlrather than that file alone.fs_tools.tool_specsis
one builder per op behind a<total>map and a context built once, from a
single 725-line function, and answers the same specs in the same order.
The Lua specs stand in for theknlbridge with one fake,
knl/spec/fake_bridge.lua, where four carried their own; a spec of the
fake pins what it mirrors. -
knlis written in Teal, and its declaration is the module. The kernel was
the last of the embedded modules still in Lua, typed for the ones above it
by a hand-writtenblocks/lib/knl.d.tlthat a drift test held to the
module's exported names. The records that file declared —Session,
Device,Request,Outcomeand the rest — are inblocks/lib/knl/ init.tlnow, beside the module's table and aliased into it withtype X = X, sokernel.Sessionstill names the type from a module that requires
this one and the two can no longer say different things: Teal holds the
module to its own record at build time, which is what the declaration was
standing in for. They are declared BESIDE the table rather than inside it
because a record nested in the module record is a KEY of it in the
generated Lua, andknl/spec/api_spec.luawalks those keys — every export
must have a registry entry.knl.d.tlis gone, and the drift test now
reads the module's own record, which is a tighter check than before: the
fourOutcomeconstructors the old declaration left out are declared now.
The bridge's types come fromknl_typesthrough alocal typeimport, so
the kernel's load-time requires are the one they have always been
(lshape) — a hardrequirewould raise in the VMs that have no
knl_types, which is the case the registry'spcallfallback exists for.
Nothing a caller sees moved:require("knl")answers the same table with
the same exports,knl.shapes,knl.viewsandknl.Outcomehold the same
names, and every spec runs unchanged against the Lua Teal generates. One
local function was renamed on the way —record, which appends an event
through the dev-mode contract, isrecord_event, becauserecordis how
Teal spells a type declaration and a local cannot take that name. -
just genregenerates every file in the tree a generator owns, andjust checkruns it first:gen lint test test-lua check-tl test-tl. Two files
are rendered from Rust —blocks/lib/knl_types.d.tlfor the checker and
blocks/lib/knl_types.luafor the two runners with no host — by the test
that also pins them byte for byte, which writes instead of comparing under
AGENT_BLOCK_WRITE_DTS. Nothing incheckhad ever run it, so the gate
could only REPORT that one of them was stale and leave the person to
remember acargo testincantation. With the generator first the run
converges from any starting state — stale, hand-edited or clean all end at
the same bytes — and a secondjust checkchanges nothing. The paths are
onegeneratedvariable in the justfile rather than a list per consumer.
It converges only because the formatters leave those two alone, which is
what the.styluaignoreentry is for:styluareformatting one after the
generator wrote it is what putjust lintandcargo test -p agent-block-coreat odds in the first place. -
.githooks/pre-commit, tracked and opt-in, refuses a commit whose generated
files disagree with their generator: it runsjust genand stops if that
changed anything, naming the recipe that settles it.just hookspoints
core.hooksPathat the directory; nothing installs it for you, because
core.hooksPathis a setting in your own clone.git commit --no-verifyis
the way past it, for the commit that is changing the generator itself. -
The host's globals are declared in one place,
blocks/lib/host_types.d.tl,
and a module written in Teal states none of its own. It used to write the
pair —local host = require("host_types")and thenglobal std: host.Std
— and a project's own.tlwas told to do the same; now it requires the
file and the globals come with it.std,tool,sh,http,mcpand
logare declared there against the records already beside them, and the
knlsyscall bridge with them, loose (a map of syscalls) for the reason
Mcpis loose: naming its vocabulary would have the file readknlback.
The reason it has to be one place is a checker one and is written at the
declarations: aglobaldeclared in a.tlthat other modules REQUIRE
splits that module's record types, so two consumers in one check run each
get their ownknl.Sessionand a value cannot pass between them [htl
0.8.0]. Nothing at run time changed — a declaration generates no code, the
globals are still the host's, and a spec can still install a fakestd
before requiring the module. -
policyis one module in five files.blocks/lib/policy/init.luahad
grown past three thousand lines, and it is now the door — the header, the
eleven gathered by name,policy.shapes, the api registry and its dev-mode
gate — over four files grouped by what their policies read:room
(window, tokens, result_cap, thinking_cap — the ones that size against the
model's window, and the one split of it they share,request_limitfor the
prompt andreply_roomfor the reply),tools(repeat_cap, require_args —
the ones that wrap the device's tools map),carry(the one filter that
reads the log) andloop(verdict, stagnation, retry, escalate — what the
loop asks between beats);sharedholds the defaults, the log readers, the
contract prelude and the shapes more than one file hands out. Nothing a
caller sees moved:require("policy")answers the same table with the same
eleven exports and the sameshapes, every spec runs unchanged against it,
andagent-block vendor policycopies the six files as one module
(policy.<name>is how a sub-file is named, asllm_proto.openaiis). The
every-module fixture counts twenty-seven embedded names where it counted
twenty-two. -
coding.runseeds the targets by name unless told otherwise:seed
defaults to"names", where the loop had always handed every target over
whole and line-numbered. A caller that wants the old shape saysseed = "full".coding.seedthe helper is unchanged — itsmodeleft nil still
reads as"full"— the default moved on the loop alone. The reasons are
under Added, with the opt. -
The
codingloop's state is one table and its steps are plain functions.
coding.run's implementation held its state in a dozen mutable locals that
a dozen nested closures read and wrote: theplantool handler wrote the
steps into a local, the verdict'schangedread an edit counter the loop
moved, theOutcome.matcharms smuggled the answer out through a sink table
and recorded a failure by side effect, and the run's own result was built
inline around an immediately-invoked function. What a step touched could
only be learnt by reading everything above it. The loop now holds onest
table with every moving field named and initialised in one place, and each
step is a module-level function of its arguments —run_verify,
run_checks,edits_in,failing_of,beat_outcome(whose arms return
the answer, or the reason there is none, instead of writing it somewhere),
run_iteration, and the two below.coding.run's behaviour is unchanged,
and is now covered end to end: four tests drive the real binary and the real
bridges against a scripted in-process model — the model declaring on a green
verify, a green that does not end the run while tools are still being
called,done = "plan"ending when every filed check passes, and the
tripwire that refuses a run naming the reply no room. -
The four bridge tool modules are libraries, and the bridge does the wiring.
fs_tools/kv_tools/sql_tools/ts_toolswere still the scripts
they had been before they moved underblocks/lib/: each assigned onto
std.fs/std.kv/std.sql/std.tsas a side effect and returned
nothing, sorequire("fs_tools")answeredtrueand the delegation idiom
the README gives for every other module —local base = require("embedded.fs_tools"), wrap what it answers — had nothing to wrap.
Each now ends withreturn M, like every other embedded module, and the
bridge installs the functions that table holds ontostd.<x>after
requirehas found it. A vendored copy is installed the same way, and
through its__indexchain as well, so a copy that wraps one function and
inherits the rest is whole on both sides:std.fs.tool_specsis the
wrapper,std.fs.register_toolsis the base's. A copy still written the old
way is refused by name, with the command that rewrites it, rather than
leaving the tools silently missing.Each module publishes its opts contract as data under
M.shapesand asserts
it in dev beside the refusals it already had — the hand-written ones stay,
and stay loud in both modes, because a caller that omitsallowedomits it
in production too. Each has a spec of its own now
(blocks/lib/<name>/spec/), and one e2e test holds the whole set to the
rule: every embedded module answers a table, under its own name and under
theembedded.alias. -
The OpenAI adapter sends no answer cap when the caller names none, and
profileanswersmax_output = nilto match. The server's own limit is then
the window less the prompt, which is the cap a self-hosted model actually
has; the 4,096 this adapter used to invent was a second, smaller one, and it
was the one that cut replies [measured 2026-09-12: 103 of 415 beats ended
mid-reasoning without reaching a tool call, 26 of them at exactly 4,096. The
server was vLLM, which has only--max-model-len 32768and treats a request
with nomax_tokensas asking for the whole remainder]. The generic backend
no longer fills the field either —max_tokensis the request's or the
conf's, or absent. The knl_adapter's openai Port therefore declares no
default_max_output, so a fold sized by the profile holds nothing back for
room the wire never asked for. A conf that namesmax_tokensis unaffected.The Anthropic adapter still sends one, because
max_tokensis a required
field of the Messages API, and its module says why rather than sharing a
constant that reads as a policy.profilereports the model's own maximum
asmax_output_limitfor a caller that wants to raise the cap. -
agent.runrequirestimeoutandmax_iterations, and passesmax_tokens
through as named or not at all. The line is whether the caller knows the
value and the module cannot: how long this model's reply may take and how
many beats the run is granted are the run's — the 120 and 20 that stood in
for them were the same second ceiling as the 4,096 above, under other names.
A run that names neither answersok = falsesaying which, as it does for
a missing prompt. What stays in the module is what a caller has no basis to
choose: the retry curve after a transport or API error, the stagnation and
repeat thresholds, the verify timeout read off the log.job.tomlrequirestimeoutandjob.tickrequiresmax_runson the same
line: how long its block may run is the job's to say, how many runs the host
carries is the manager's (agent-block serve --max-runs, which it already
passed).ScriptSource::DefaultAgentcarries anAgentProfile— provider, endpoint,
model, timeout, beats, answer cap — since the embedded invoker has no other
place to be told what the run is granted. The profile has noDefault; it
is injected as_AGENT_PROFILEand passed toagent.runwhole. -
The kernel's event store is eventsdb 0.6.0, and nothing in that release
breaks a caller — every entry is an addition, and the one type that grew a
field is#[non_exhaustive]— so the move is a version and the two
subcommands above. What it gives us is the two things a caller could not
build from outside: a log that is open and being written to can be copied
consistently, and the store itself can now be watched. Thetracingfeature
is on, which isdep:tracingand nothing else — the spans are atdebug
and the events attrace/warn, and this binary's subscriber defaults to
info, so it costs nothing at the default level. What it shows is what a
wrapper around the call cannot see, because it is inside the call: how long
the write lock was held, which batch a projection took, whether a
subscription woke on the commit channel or on the poll. -
AGENT_BLOCK_LOG_SPANS=1turns every span's close into a log line. Most of
what the store reports is a span with no event inside it — the fields and
the duration are the whole of it — and the default formatter prints events
only, showing the spans around them as context, so those paths were silent
at any filter level. With the switch on they read as
eventsdb.append{stream=… count=1 position=42}: close time.busy=27µs, so
the two halves together are
AGENT_BLOCK_LOG_SPANS=1 RUST_LOG=eventsdb_sqlite=debug. It is off by
default because it is every span in the process, this binary's own
included. -
mlua-pkgis 0.11 (was 0.9). TheRegistry/Resolver/FsResolver/
MemoryResolversurfacehost.rsbuilds therequirechain from is
unchanged between the two, so nothing in the chain moved; what the bump
buys is a resolver written against the current trait — the one a Teal
(.tl) resolver implements — being something the sameRegistrycan hold,
which is the first step of typingblocks/lib. -
htl0.7 is a dependency ofagent-block-core, with default features
off andmacros/pkg/dtson:include_tl!for a module written as
.tl, the resolver that puts one into therequirechain, and the
.d.tla#[host_module]declares. Nothing uses it yet — this is the
graph being proven before a module moves. What it proved: mlua stays one
copy at 0.12.1 witherror-sendjoining its features, and the batteries
compile under that; the secondmlua-batteries(0.7) the proc macro
pulls is host-side only, so onestd.*registers into a state, not two. -
A module may be written in Teal. Every filesystem tier of the
require
chain (script_dir>.agent-block/lib>lib>$AGENT_BLOCK_HOME/lib)
now has a Teal resolver ahead of its Lua one:name.tl(orname/init.tl)
is type-checked and generated at therequire,name.d.tlbeside a
name.luatypes the Lua without replacing it, and a type error in a.tl
refuses therequire— named with file and line — rather than falling
through to a copy in a lower tier. The checker is compiled into each VM at
start (Htl::from_lua; the cost is traced at debug ashtl checker attached). What a.tlcan require is what has a.tlor.d.tlthe
checker can see: the embedded modules have none yet, so a.tlthat
requiresknlorpolicyis refused withno type information for required moduleuntil their declarations land.just check-tl(in
just check) runshtl check --strictoverblocks/lib, with
crates/agent-block-core/htl.tomlnaming the require root;just test-tl
runshtl testthere, outsidecheckuntil the first*_test.tlexists. -
mcp_toolsis the first embedded module written in Teal
(blocks/lib/mcp_tools/init.tl, embedded throughinclude_tl!): the same
two functions with the same behaviour, typed —tool_declover aTool
record with both spellings of the schema key,result_textoverBlocks
— and a type error or an htl lint in it is now acargo builderror. What
the host embeds andvendorwrites is the Lua Teal generates, which
carries no comments; the module's own words are in the.tl.
blocks/lib/host_types.d.tlis where a Teal module learns the shape of
the globals the host owns (std, so far onlyjson.encode, growing with
each module that moves):global std: host.Stdis a declaration that
generates nothing, so the global stays late-bound and a spec can still
install a fake before requiring the module.host_types.luabeside it is
the run-time half of thatrequire, an empty table, embedded like any
other entry.lua-spec-runnertakes a Teal module's Lua from the binary
that embeds it (agent-block vendorintotarget/lua-spec-runner/), so
just test-luabuildsagent-blockfirst;just lintrunshtl fmtover
blocks/libbeside stylua. -
The Lua half of the four bridge tool modules is written in Teal —
sql_tools,kv_tools,ts_tools,fs_tools(blocks/lib/<name>/ init.tl), embedded throughinclude_tl!both inEMBEDDED_LIBSand in
each bridge's fallback (bridge/{sql,kv,ts,fs}.rs). The same tools with
the same behaviour, typed: anOptsrecord per module, oneInputshape
its handlers share, oneDefper op, andM.shapes.*aslshape.Schema;
fs_toolstypes its helpers (diverges_at,nearest_line,
line_edit_for,fit_lines) and whattool_specsanswers (Spec).
blocks/lib/lshape.d.tldeclares the vendored validator for the checker
— thetDSL andcheck— without touching the upstream copy beside it;
a tool module keeps its tolerantpcall(require, "lshape"), and the
bridge's bare-VM fallback answersrequire("host_types")from
package.preloadbefore running the source (bridge/mod.rs).
host_types.d.tlgrowsstd.sql/std.ts/std.fs/std.kv.list
and thetoolbridge. The 42 specs of the four modules pass against the
generated Lua. -
agent-block vendorends the copy it writes with a newline. The
hand-written sources did; the Lua Teal generates for a module does not,
and a copy that ends mid-line is one whose last line cannot be spliced
after — thefunction M.x() … enda project adds beforereturn M. -
The Teal checker is a state of its own (
Htl::new+
Htl::with_checker_lua), and the VM that runs scripts holds only the
runtime half: a script cannotrequire("tl")and reach the compiler, and
the checker's search path — what a.tl'srequireis resolved against —
is no longer the VM'spackage.path, so a plain.luaresolves exactly
as before. The declarations the binary carries (host_types.d.tl,
lshape.d.tl) are written at start to a directory under the temp dir
named by their content (agent-block-dts-<version>-<hash>/) and put on
the checker's path, last: a project'slib/foo.tlcanrequire ("host_types")andglobal std: host.Stdagainst the binary that runs
it, which before was a type error and a refusedrequire. A project's
ownhtl.tomlis applied to the checker too, ashtl checkapplies it:
[check] pathsis where a project declares the modules the host supplies
at run time. And every embedded name is inpackage.preload(answering
embedded.<name>), which is where htl looks for a module the host
provides: a.d.tlon its own in a tier —lib/knl.d.tl, put there to
type a project's.tlagainst the kernel — makes the Teal resolver step
aside instead of answering with its declaration-only stub, and the
embedded module answers.e2e_teal_lib.rspins each of these, and
e2e_host_types_drift.rsholdshost_types.d.tlto the host: every
function it declares onstd.*/tool/logis one the VM registers. -
fs_tools'readno longer raises on alimitthat is not a number.
The move to Teal had flooredtonumber(input.limit)without the nil
check, solimit = "all"from a model raisedbad argument #1 to 'floor'where the Lua module had read the whole range; it reads the whole
range again. A fractionallimitis floored (2.5 lines was never a
thing). -
The first
*_test.tl(blocks/lib/mcp_tools/spec/mcp_tools_test.tl,
htl test), andjust test-tlis injust check.lua-spec-runner
refuses a binary older than a.tlit would take the Lua from, and skips
the vendor step under--project. -
The Teal modules carry htl's markers where they apply.
---@structon
every record a module builds whole —mcp_tools.Decl, each tool
module'sDefandShapes,fs_tools.Spec, andTool.Metain
host_types.d.tl— so a literal short of a field is reported where it
is written, not found at the first call;---@nilableonstd.kv.get
andstd.ts.last, the two host functions that answer nil, so indexing
their result directly is reported. What comes from outside — a caller's
Opts, a model'sInput, MCP'sToolandBlock— stays unmarked:
every field of those may be absent, which is the fact, and the loud
refusals that name a missing one stay in the code. -
jobis written in Teal (blocks/lib/job/init.tl, embedded through
include_tl!): the same four —read/tick/runand the records
they write — with the shapes named.Declis---@structwithevery/
prompt/contextas---@optional, which is exactly whatdecl
promised in prose;Facts,Plan(Start/Skip),Configand
RunResultare built whole and say so; aSessionrecord is whatjob
asks of the kernel's session (append,query), and a spec's fake
answers the same two.host_types.d.tlgrowssh(execwith its
ExecResult/ExecOpts,kill),std.time.nowandstd.fs.read.
The 40 job specs pass against the generated Lua, andjob_test.tl
(htl test) holds the pure half —duration,decl,tick. -
llm_protois written in Teal, the two adapters with it
(blocks/lib/llm_proto/{init,openai,anthropic}.tl, embedded through
include_tl!): the same wire format, transport and parse, with the
vocabulary as records.Specnames every field an adapter reads, in one
place;ToolChoice/Thinking/Classified/Wire/Usage/
Profile/Health/Resultare---@structwith their optional
fields marked;Decodedis what a parse answers andAdapterwhat both
dialects are. The wire bodies stay{string:any}— they are JSON, and
the provider's.host_types.d.tlgrowshttp(requestwith
RequestOpts/Response),std.env(getnilable,get_or),
std.task.sleepandstd.json.decode. The 117 llm_proto specs pass
against the generated Lua, andllm_proto_test.tl(htl test) holds
the pure half — the two normalizers,classify_error,retry_delay,
health_of,server_root,estimate_tokens. -
The kernel is declared for the checker, so a module written in Teal can
require("knl"). Two files.blocks/lib/knl_types.d.tlis generated:
the syscall typesbridge/knl.rsdeclares (schema-bridge IR) rendered as
Teal — a record per object, an enum per closed set, a type alias for the
rest, a field's own object nested and named after it — by the same
source the lshapeknl_typesmodule comes from, so the two cannot
disagree. The tree holds a copy for the checker atcargo buildand in
CI, a test pins it to the renderer (AGENT_BLOCK_WRITE_DTS=1regenerates
it), and the host hands the checker its own render at start beside
host_types.d.tl, so a project's.tlis checked against the binary
that runs it.blocks/lib/knl.d.tlis hand-written whileknlis Lua:
the module's exports —open/resume/session/device/beat
/fold/error/api/views.*/export— theSessionthe
kernel's userdata is,Device,DeviceConfig,OutcomeValue, and
shapesas lshape schemas;e2e_knl_decl_drift.rsholds every declared
name to whatrequire("knl")exports. -
supervisoris written in Teal (blocks/lib/supervisor/init.tl,
embedded throughinclude_tl!), the first module checked against
knl.d.tl:child/parallel/mergewith the same contracts, typed
—ChildOpts/ChildBudget/ChildEntry/ParallelOpts/
MergeOptsas what a caller writes,Slot(---@struct) as what a
sibling's place inparallel's answer holds,ApiArg/ApiEntryas
the registry's form, and the query options a merge freezes as the
kernel's ownQueryOpts.host_types.d.tlgrowsstd.task.scope/
with_timeoutand theScopea body spawns into;lshape.d.tlgrows
t._internal. The 55 supervisor specs pass against the generated Lua,
andsupervisor_test.tl(htl test) holds the refusals a call meets
before a child is opened. Two things the move settled for every module
after it: a record a module needs only for itself is declared beside
M, not nested in it — nested, it is a key of the module table, and a
spec that holds that table to the registry sees an export — and the
tree now carriesblocks/lib/knl_types.lua, the lshape module the host
builds at start, rendered by the same generator and pinned by the same
test asknl_types.d.tl:htl testandlua-spec-runnerhave no host
to build one, and the kernel's tolerantpcall(require, "knl_types")
otherwise met htl's declaration-only stub and raised at its first index. -
policyis written in Teal, all six files (blocks/lib/policy/ {init,shared,room,tools,carry,loop}.tl, embedded throughinclude_tl!):
the eleven policies andsplitwith the same contracts, typed. Every
factory's opts is a record beside the file that owns it;shared
declares what the six share — a storedEvent, aBeatRecord, a
ToolPair, the registry'sApiArg/ApiEntry, and thePort/
Profilea room policy asks — and the door names each factory by the
type its file exports (room.WindowFactory,loop.RetryFactory, …),
aliases that generate no Lua.Split,Verdictand aCheckare
---@structwith their optional fields marked. Two readings changed
form for the checker and not the reader: the profile's whole numbers are
floored where they are formatted, andopts_ofis generic so a factory
keeps its opts' type through the prelude. The 213 policy specs pass
against the generated Lua, andpolicy_test.tl(htl test) holds
split,retryandescalate's default judgement. -
knl_adapteris written in Teal (blocks/lib/knl_adapter/init.tl,
embedded throughinclude_tl!): the two Ports are records with the
metatable the Lua gave them — the same__indexclass, so
LLMPort.new{...}andport:open(conf)read as they did — and the
checker holds a provider impl tobuild/parse/classifyand a
tool source todeclare/invoke.Verdict,Profile, the count
cache and what the transportSeenare records besideM.
host_types.d.tlgrows themcpbridge (list_tools,call), and
llm_proto'sAdapternamesDEFAULT_MAX_TOKENS. The 74 knl_adapter
specs pass against the generated Lua, andknl_adapter_test.tl(htl test) holds the Port contracts and the tool binding. -
sessionis the second module written in Teal
(blocks/lib/session/init.tl): the sameload/save/clearover
std.kv, withMessages({{string:any}}) as whatloadanswers and
savetakes. Its record is namedM, so the generated module reads as a
hand-written one does (M.NS = ...,return M) and a vendored copy is
edited the same way.host_types.d.tlgrows with it:std.kv(get/
set/delete) and thelogbridge (debug/info/warn/
error).
Removed
- The seal is gone. Every embedded module can be shadowed and vendored, the
kernel and its declaration layer included: alib/knl/init.luais the kernel
that run uses, andagent-block vendor knl(orknl_adapter, orlshape)
writes the copy with the specs that check it.AGENT_BLOCK_UNSEALno longer
exists — there is nothing left for it to downgrade — andvendor --listno
longer prints asealedcolumn. Every module here is Lua so that a project
can change any of it, which is what a runtime that is Lua on top of Rust is
for; a module being well tested and a module being replaceable are
independent properties, and the seal took the one for the other. What is
true, and what the seal stood in for, is that a replacement of the kernel has
to keep what the rest of the binary reads by name — and that is said where it
can be checked rather than asserted in prose: the module doc of
crates/agent-block-core/src/bridge/knl.rsfor the Rust half, and the specs
vendor knlwrites beside the copy for the Lua half.knl_typesis still
the one embedded module with no file to hand out, being generated at start
from the Rust types; a filesystem copy of it wins over the generated one, and
vendor knl_typesnow says that rather than calling it sealed.
Fixed
-
A
coding.runplan check that percent-encodes one of the run's target
paths is refused when the plan is filed, rather than run every iteration
until the cap. A framework's dynamic-route directory —[ns],[id],
[...slug]— reaching a check as%5Bns%5Dnames a file that does not
exist and that no edit will bring into being, so the check cannot pass in
this run or any other; the run then spends every remaining iteration
re-running it. What the model got back from running it was the shell's own
No such file or directory, which has been shown not to be enough to make
it write the path differently.So
M.plan_ofsays it at the filing, in the terms the model has to act on:
steps[1].check names '<what was written>', which is '<the path>' percent-encoded: that path does not exist, so the check can never pass. Use <the path> exactly as written.The refusal is the filing's, like a
malformed plan — the tool answersbad_plan, no plan is stored, the model
refiles, and nothing counts as an edit or as progress. Every offending check
in a plan is named in the one message, so a plan with three of them is one
round trip.declaremode files no plan and is untouched.The test is a decode-and-compare rather than a list of characters: if a
target path appears in a check once its escapes are resolved and did not
appear before, the model encoded it, whatever it encoded — an encoded slash
in a path with no brackets at all is the same mistake and is caught the same
way. A check that merely contains a%decodes to itself and cannot trip
it.M.plan_oftakes the targets and the repository to hold a check
against; called without them it checks what it always did. -
coding.runwithdone = "plan"ends the run when every check the model
filed passes, instead of running to the iteration cap.M.deciderequired a
declaration — an answer with no tool call — in every mode, and a model that
keeps calling tools never produces one: a run whose plan was filed, whose
seven checks all passed and whose verify was green burned all ten iterations
and reportedok = false, failure_reason = "max_iters"with every fact
green.The declaration is there because a green verify is not enough by itself — a
spec spanning a function and the tests it asked for goes green before the
tests exist — but plan mode already has that covered, and has it in a better
form: the checks are the model's own description of what finished looks
like, filed in advance, in shell commands, and confirmed by the harness
rather than taken on the model's word. The test a green verify cannot see is
one of the checks. So the declaration is no longer waited for in that mode;
it still ends the run when the checks agree, being the same condition. A
plan with no checks in it still never ends a run — zero of zero passing
describes nothing — anddeclaremode is untouched. The seed says the new
rule too, since a model told to announce an ending that has already happened
keeps calling tools. -
agent-block knl sessions/export/backupwith no-pread the
project they are run in, instead of failing withno kernel database at '<home>/.agent-block/projects/./knl.sqlite'.-p/--projectdefaults to.,
and the kernel database is placed under a name DERIVED from the root's text
(project_slug), so.slugged to.and the reader looked somewhere
nothing had ever written.project_slug's doc states the precondition — the
caller passes a root it resolved, because a relative path would slug two
different projects to the same name — and the host honoured it by
canonicalizing inhost::run, which left every path that does not go
through the host: all four subcommands.-pwith an absolute path always
worked, which is why this survived.The root is now resolved once, in
main.rs, right after parsing and before
.env, the sandbox and the host, so every consumer gets the same absolute
root and the host's own canonicalize has nothing left to do. A--project
that cannot be resolved is refused in those terms rather than carried into a
path built from it:--project '<path>' could not be resolved, naming the
flag the caller got wrong instead of a file they have never heard of. -
knl <verb>on a project whose log has never been written names the project
it looked for, not only the file it did not find. The path is the slug of a
root, which a reader cannot un-slug at a glance, so "nothing here yet" and
"you are in the wrong directory" used to produce the same sentence. A
--storethe caller typed is still reported back as typed — it was derived
from nothing, so there is nothing to explain.
Docs
-
The README's "Overriding a block or a module" says what a vendored copy's
history is: git.vendorwrites a plain file with the version in its
header and keeps nothing else — no hash, no--diff, no backup on
--force— because the log of the project the copy lives in answers every
question those would (what was edited, what upstream changed, how to merge
the two, what to send upstream). -
Doc comments in the bus, MCP handler and host modules said which internal
note a decision came from rather than what the decision was — a reference
no reader outside this machine can follow, and one that outlived the note
it pointed at. Each now carries the reasoning itself: why the dispatcher
awaits one handler at a time, why a secondbus.onfor the same kind
replaces rather than refuses, why notifications reach Lua on the Isle that
defined the callback, why they travel on a bounded channel. Build-order
numbering is gone from the same comments, which describe what the code is
rather than the order it arrived in. -
The README says what an embedded module is, under "Writing a module": one
lib/<name>/init.luathat returns the table of what it exports and writes
nothing onto globals, replaceable by a project's copy of the same name that
can wrap the original, with its checks beside it in
lib/<name>/spec/*_spec.lua, the opts its public functions take and the
values they answer declared asM.shapesand asserted at the boundary in
dev mode beside refusals that stay loud in prod, and a header in English
that says what it is, how it is used and what it does not do. The seven
spec files still called*_test.luaare*_spec.luanow, which is what
every other one was already called; discovery reads thespec/directory
and the file's use of the framework, never the suffix, so only the names
changed.
Install agent-block 0.40.0
Install prebuilt binaries via shell script
curl --proto '=https' --tlsv1.2 -LsSf https://github.com/ynishi/agent-block/releases/download/v0.40.0/agent-block-installer.sh | shInstall prebuilt binaries via powershell script
powershell -ExecutionPolicy Bypass -c "irm https://github.com/ynishi/agent-block/releases/download/v0.40.0/agent-block-installer.ps1 | iex"Download agent-block 0.40.0
| File | Platform | Checksum |
|---|---|---|
| agent-block-aarch64-apple-darwin.tar.xz | Apple Silicon macOS | checksum |
| agent-block-x86_64-apple-darwin.tar.xz | Intel macOS | checksum |
| agent-block-x86_64-pc-windows-msvc.zip | x64 Windows | checksum |
| agent-block-x86_64-unknown-linux-gnu.tar.xz | x64 Linux | checksum |