You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The comparison reads Fascicle on request transparency, and the prepare_step example keeps the cache warm.comparison.md gains a sixth axis, who builds the array and whether you can see what went, with Fascicle's answer, its one gap at the external depth, and its answers to the four questions that Harness Engineering 101 asks of any framework. The prepare_step example in configuration.md was a sliding window, which misses the prompt cache on every turn once it starts dropping messages. It now cuts long tool results the same way on every turn and spreads the message that it changes, so is_error survives. The agent primer gains rules for duplicate tool names and for capture being off by default, and the words that the docs use in one sense each.
The course gains lesson 14, Give the Model Hands. The course never covered a tool loop, so it ended without teaching what every coding agent is built on. Lesson 14 gives a model tools over a folder of notes, keyless on make_loop_engine, and teaches define_tool, the tool loop, a failed call that goes back to the model with is_error, max_steps and the finish_reason that a capped call ends with, needs_approval with on_tool_approval, and a turn read back with captured_turns. The course's walk runs it with no key, lesson 13 hands it the course's close, and the course map, the set-up lesson, and the tutor's notes say that it needs 0.17.0.
Lessons 5, 6, and 8 show what a model call sends. The course never showed the request underneath a model_step, so nothing in it said why the solver's explain step gets the question again, and lesson 8 said that a trajectory never holds a model's reply. Lesson 5 now says that a model remembers nothing from one call to the next, so each model_step sends a request of its own. Lesson 6 shows the bodies that lesson 5's extract call sends to OpenRouter and to Anthropic's native transport, as this release's capture: 'wire' recorded them, and lesson 8 says what a trajectory holds under capture and points at captured_turns.
A primer on what a harness does, and a glossary. No page said that a model API keeps nothing between requests, so the program sends the whole conversation every turn, or what a tool call looks like on the wire, and "harness", "step", and "turn" each meant more than one thing across the docs. What a Harness Does walks from one request to the tool loop, what a turn costs, the context window, capture, and the guards on a tool, and ends each section with the Fascicle names that do that job. concepts.md ends with a glossary that gives each of those words one meaning, and it says plainly that the engine's step (max_steps, step_index, prepare_step, StepRecord) is a model turn, not a Step.
fascicle-viewer opens the turns that a model call captured. A trajectory recorded under capture held each turn's request and reply, and the only way to read them was to fold the deltas by hand. A node whose calls captured turns now wears a small badge under its meta line, such as 3 TURNS, and clicking it opens a drawer beside the canvas, which refits the flow into the space that's left. The drawer lists the node's turns with each one's step, its tokens, and its cache hit, and lays the selected turn's request (its system prompt, its tool names, and its messages by role) beside the reply that the provider returned, with long content folded and a tool result flagged is_error marked by the ember ✕. COPY TURN copies the turn as JSON in the CapturedTurn shape, ready for replay_turn. The canvas reads the turns with its own reader, the way captured_turns does, so a turn whose request was dropped stays out until the call's next whole array, and a scrubbed canvas shows only the turns that it has reached. viewer.md walks through it.
captured_turns rebuilds what each turn sent, and replay_turn sends one again. A captured trajectory holds each turn as a delta, which nothing could turn back into the request that the model got. captured_turns(events) folds the deltas per call_span_id into full arrays, in any order the events arrive, and returns a CapturedTurn for each turn with its call's settings and tools, the whole messages array, and the response the provider returned. A turn whose request was dropped is left out until the call's next whole array, and a call whose first turn is missing is left out whole. replay_turn(engine, turn, { edit, provider, model, trajectory }) sends a turn through engine.generate with max_steps: 1, cache: 'off', capture: 'off', and system: '', and rebuilds each tool with an execute that throws, so a tool call comes back listed and unexecuted, and nothing acts on the world twice. Captured provider options go as they were, a raw cache_control included, so edit is how you drop one. api-reference.md says what a replay does and doesn't send.
redact_capture scrubs what capture records, and OTel gets only its size. A captured request carries everything a user typed, and nothing stood between it and the trajectory. create_engine({ redact_capture }) takes a function that sees each payload first, as a CapturePayload ({ kind, step_index, data }, with data a fresh copy), and returns what to record in its place, or undefined to record nothing. It fails closed: a redactor that throws or returns a promise records nothing, and so does a payload that JSON can't hold, and the turn records capture_redaction_failed with the payload's kind and its step span. The turn after a request that went unrecorded records its whole array, marked reshaped, so the deltas pick up again at once. The fascicle/otel trajectory logger leaves request_sent.request, response_received.content, and request_wire.body off its span events and records fascicle.capture.bytes in their place, the UTF-8 length of each one's JSON, while the filesystem, HTTP, and stderr loggers write the payloads as they are. configuration.md says which events the redactor covers.
capture records what each turn sent the model and what came back. "The model ignored my instruction" couldn't be checked against the request the model got, since request_sent carried only a step index and response_received carried no reply. capture: 'off' | 'turns' | 'wire' goes on a call, on defaults, or on a model_call or model_step config, and a call's own value wins. It's off by default, because a request carries everything a user typed. Under 'turns', a call's first request_sent carries request: { settings, tools, messages }, with the call's resolved settings, each tool's input schema as JSON Schema, and every message the turn sent, the system prompt included. Each later turn carries { appended }, the messages it added, or { messages, reshaped: true } when it didn't extend the turn before it, so a captured trajectory grows with the conversation rather than its square. Each response_received carries content, the parts the provider returned. Every payload is a copy that JSON can hold, taken as the turn goes out, with an image's bytes as base64 beside its media_type, and a value that JSON can't hold drops that payload without failing the call. Every request_sent now names span_id, the turn's step span, and call_span_id, the call's engine.generate span, whether or not the call captures. 'wire' records all of that and, on a native transport, the exact body each attempt sends, as request_wire with the url, the body, and the provider and never a header, through a new TurnRequest.on_wire that every built-in native adapter calls just before it serializes its body. A custom native adapter should call it too. On the ai_sdk transport, whose SDK builds the body, 'wire' records option_ignored and captures as 'turns'. claude_cli records option_ignored for any per-call capture, and any other value throws engine_config_error. concepts.md has the shapes, and troubleshooting.md shows how to read them.
A cache option asks the provider to cache the prompt. Every turn of a tool loop sends the whole conversation again, and nothing asked a provider to keep it, so a long Anthropic loop paid the full input price for the same prefix on every turn. cache: 'off' | '5m' | '1h' goes on a call, on defaults, or on a model_call or model_step config, and a call's own value wins over the default. What it does depends on the caching that the provider's adapter declares in its new prompt_cache field: 'with_tools' caches for five minutes by default on a call with tools, 'opt_in' only when asked, and 'automatic' (OpenAI and Google, which cache on their own) never asks. An explicit '5m' or '1h' that an adapter can't honor records option_ignored with a reason, and so does any per-call cache on claude_cli, since Claude Code caches its own prompts. Any other value throws engine_config_error. Anthropic declares 'with_tools' on both transports. The native one sends a top-level cache_control, and the ai_sdk one sets @ai-sdk/anthropic's call-level cacheControl, which goes out as the same field, through a new optional translate_cache hook on AiSdkProviderAdapter. A cache_control or cacheControl of your own under provider_options.anthropic still wins, and since the package drops a call-level cache_control, the adapter sends that spelling as cacheControl. OpenRouter's native transport declares 'opt_in' and sends the same top-level field when a call asks, which is meant for its Claude models. make_loop_engine takes prompt_cache to declare one. providers.md has the table.
fascicle-viewer's header shows the run's cache hit ratio. Once any of a run's model turns read or wrote prompt-cache tokens, the header gains CACHE 87% before the cost, the share of the run's input that came back from the cache, so a run that only wrote reads 0%. When the run recorded a cache_miss, the count follows it, as in 1 MISS. The reducer sums input_tokens, cached_input_tokens, and cache_write_tokens from each response_received, which it had ignored, and a run that never cached keeps the header it had.
The trajectory says whether the prompt cache is working. A cache that went cold looked exactly like one that worked, apart from the bill. Each response_received now carries cache_hit_ratio, the share of the turn's input that came from the cache to three decimals, on any turn with cache traffic, so a turn that only wrote reads 0. A turn that reads nothing right after a turn of the same call that read or wrote some records cache_miss, with previous_cached_tokens (the previous turn's reads plus writes), this turn's input_tokens, and after_prepare_step, which says whether prepare_step replaced the turn's messages. The rule needs no model's minimum, and it holds across schema-repair turns. The fascicle/otel metrics record a new histogram, fascicle.client.cache.token.usage, with fascicle.cache.direction set to read or write, and the example Grafana dashboard gains a cache panel. troubleshooting.md lists what causes a miss.
A one-hour cache write is priced at twice the input rate. Anthropic charges 2 times the input price for a write with ttl: '1h', against 1.25 times for a five-minute one, and UsageTotals had no way to tell them apart, so a one-hour cache was priced as the cheaper write. UsageTotals gains cache_write_1h_tokens, the part of cache_write_tokens that was written for an hour. The native Anthropic transport reads it from the usage's cache_creation split, whole or streamed, and the ai_sdk transport from the raw usage in providerMetadata.anthropic.usage, which AiSdkProviderAdapter.normalize_usage now receives as a second argument, so a turn's step_finish chunk and its step record agree. Pricing gains cache_write_1h_per_million, and without it compute_cost charges one-hour writes at twice input_per_million (CACHE_WRITE_1H_MULTIPLIER), while decompose_total_cost weighs them the same way. response_received carries the field when it's reported. A provider that reports no split prices every write at the five-minute rate, as before.
mcp_client can put a prefix on a server's tool names. Two MCP servers that advertise a tool under the same name couldn't share a call, and with duplicate names now refused, one of them had to go. mcp_client(config, { name_prefix: 'gh_' }) prepends the prefix, exactly as you write it, to each tool's name, so the model sees gh_search, while the server is still called with search. include and default_description read the server's own name, and so do the fallback description and the errors. Pick a separator that every model you call accepts, since Anthropic's tool names allow no dot.
assert_prefix_stable checks that a tool loop only appends. A provider's prompt cache matches a request by its prefix, so a loop that rewrites the system prompt, the tools, or an earlier message misses the cache on every turn, and nothing failed to say so. assert_prefix_stable(requests) reads what make_loop_engine recorded and throws a plain Error at the first turn that changed what the turn before it sent, naming the call, the step, and the difference, as in call 1, step 2: message 3 differs from step 1. It compares messages as JSON text, the way the wire sends them, and tool schemas by reference first and then as JSON Schema. It splits calls wherever step_index doesn't increase, so it reads calls that ran one at a time, and a parallel flow takes one double per branch. testing.md has the check and a recipe for testing a tool loop keyless.
make_loop_engine runs a script under the engine's own tool loop. The three doubles in fascicle/testing stand in for the whole engine, so no tool loop runs under them, and a test of a flow whose model calls use tools couldn't see the tools run, the approvals asked, or the results fed back. make_loop_engine(turns) builds a real engine with one provider, 'loop', that plays a turn of the script each time the loop asks the model for one, and it returns { engine, requests }, where requests holds every request the model was sent, tool results included. A turn is a final-answer string, an array of calls, or an object that sets its text, calls, content parts, finish reason, or usage, or throws. A thrown error goes through the engine's retry as a provider's would, so a retried 503 uses up the next turn. testing.md has the details, and the ACP tests run on it now.
The run canvas works under a path of its own. The canvas was built with an absolute base and asked for /api/trajectory and /api/events by absolute path, so served at /viewer/<id>/ behind a host's proxy, its scripts, its styles, its fonts, and both API requests all missed. Its assets and its API requests resolve against the page now, so a host can frame the canvas under any path that ends in a slash by proxying that path to a loopback viewer with the prefix stripped. The proxy sends the viewer a loopback Host, and viewer.md has the details. Served at /, nothing changes.
create_viewer_handler mounts the viewer on a server of the host's own. A host that wanted the canvas under a path of its own had to run a viewer in a second process and proxy to it, even when it could import fascicle/viewer. create_viewer_handler({ broadcaster, trajectory_path, app_dir, ingest, base_path }) returns the handler that start_server puts on its socket, as (req, res) => boolean, for a host to mount on a node:http server or on any framework that hands over the raw request. It takes base_path off each request and redirects the bare path to its trailing slash. For a request that it doesn't serve, such as a path outside base_path, a route that the API doesn't claim, or a file that the canvas doesn't ship, it returns false and leaves the response alone, so the host answers. It checks no Host, which leaves who reaches it to the host's own auth, and start_server keeps the loopback check in front of it. viewer.md has an example.
Changed
An Anthropic tool loop caches by default. A call with tools now sends cache_control: { type: 'ephemeral' } on either transport, so its first turn writes the conversation to Anthropic's five-minute cache and every turn after it reads that prefix back at a fraction of the input price. A write costs 1.25 times the input price, which a loop earns back on its second turn, so a call without tools asks for no cache unless it sets one. Set cache: 'off' on the call, or in defaults, to send requests as they went before. A gateway that routes to Bedrock's legacy integration of Claude refuses the field with a 400, and troubleshooting.md lists that and the other refusals.
Anthropic blocks that the native transport doesn't read are kept, so the assistant parts gain opaque. The native Anthropic adapter dropped every block type that it didn't know, a server tool's call and result among them, so a web search turn came back without its own state. Every block type other than text, tool_use, thinking, and redacted_thinking now becomes { type: 'opaque', provider_options: { anthropic: { block } } } and goes back with the next request as it came, whole or streamed. A text block's citations ride its text part as provider_options.anthropic.citations and go back on the block, so a multi-turn web search keeps each citation's encrypted_index. Every other transport skips an opaque part. AssistantContentPart gains that fourth member, so a switch over a message's parts that's meant to be exhaustive needs an opaque case.
The ai_sdk transport calls streamText on every turn, which Bedrock authorizes separately.generateText is gone from the turn path, so ai_sdk_telemetry's spans read ai.streamText where they read ai.generateText. A schema reply that the SDK would have refused reaches the engine's own repair loop as it is, since streamText parses structured output only when it's read. An adapter's supports('streaming') now decides only whether a caller may pass on_chunk. Two things change on Bedrock. The peer calls ConverseStream, which AWS authorizes as bedrock:InvokeModelWithResponseStream, so a role that grants only bedrock:InvokeModel fails every turn with a 403 until you add that action, and AWS lists, model by model, which models support tool use while streaming. And a plain Bedrock turn's provider_reported no longer carries { stopSequence: null }, because the streamed reply reports a stop sequence only when the model hit one.
Every turn asks for a stream, whether or not you pass on_chunk. A turn streamed only when something consumed its chunks, so the rest waited for a whole body. Every ai_sdk turn now calls streamText, and a native adapter that supports streaming gets stream: true on every turn. The engine stamps each attempt's first chunk, so every such step reports first_chunk_ms and throughput() reads 'decode' on it, and it passes chunks on only to a consumer. With no consumer, nothing reached you before a failure, so a turn that fails partway through its stream retries the whole turn, a turn timeout included. A stream that ends before its closing event (message_stop, [DONE], Ollama's done frame, or an AI SDK step that finishes as 'other' with no reason from the provider) counts as a network failure, which surfaces as provider_error with cause_kind: 'network' once retries run out. With a consumer, the first-chunk boundary holds as before. A streamed request that gets a JSON reply reads it as a whole body. One thing can now fail where it didn't: the strict openai dialect requires the usage that stream_options.include_usage asks for, so against an OpenAI-compatible server that ignores that option, every turn on the openai provider's native transport fails with response is missing its usage object. Point such a server at the lmstudio provider, whose dialect zeroes missing usage. A custom native adapter that doesn't support streaming keeps whole-body turns.
Two tools under one name throw instead of one replacing the other. The tool loop and every transport keyed a call's tools by name, so a second tool under a name already taken replaced the first without a word, and the model could never call the one that disappeared. generate now throws engine_config_error before it sends anything, naming each duplicate with its count, as in duplicate tool names: search (2), read_file (3), and the check runs on claude_cli too. Give each tool a name of its own, or pass name_prefix to mcp_client for one server's tools. In an ACP session, a flow's own tool under a workspace tool's name throws when both sit in one call, so a wrapper has to replace the tool that it wraps.
The native Ollama transport streams what the model thinks. The daemon sends a thinking model's reasoning as message.thinking, frame by frame, before the answer, and the native transport read only content and tool_calls, so nothing reached on_chunk or the trajectory while the model thought, whether think was unset or true. Each frame's thinking dispatches as a reasoning chunk now, ahead of the frame's text, and it still joins no content part, since this wire takes no reasoning back. One consequence follows from the first chunk arriving sooner. When something consumes the chunks, a connection that drops while the model is thinking fails as stream interrupted instead of being retried, the way it already did once text had streamed. With no consumer, the turn retries.
Fixed
A paused Anthropic turn continues instead of ending cut short. The native transport read pause_turn, which a long server-tool turn can stop on, as an ordinary 'stop', so the response ended partway through. The turn keeps finish_reason: 'stop' and sets TurnResult.paused now. The loop sends its assistant message back with nothing after it, which is how Anthropic says to resume, asks for another turn, and records turn_paused. The continuation counts toward max_steps, a pause on the last allowed step ends with 'max_steps' and the paused turn's text, and the call's text joins the paused turns' texts with the final one's. make_loop_engine takes paused on a turn to script one. The ai_sdk transport still ends the call at a pause.
A turn longer than five minutes no longer dies at Node's header timeout. Node's fetch gives up on a response whose headers take more than 300 seconds (a probe on 2026-10-22 failed with UND_ERR_HEADERS_TIMEOUT at 301 seconds), and a turn that didn't stream sent no headers until its whole body was ready, so a long generation failed however long turn_timeout_ms allowed. Every ai_sdk and native turn streams now, and a stream sends its headers at once, so the turn runs as long as the model keeps generating. undici still allows 300 seconds of silence between two chunks, which a model that's generating doesn't come near.
A 5xx's Retry-After is honored, the way a 429's already was. The native adapters kept the header on a 5xx, but only a rate limit read it, so a 503 from a server that's shedding load was retried on the engine's own backoff, often before the server asked to be called again. The retry now waits the longer of its computed backoff and the server's value on a 5xx too, and on_retry reports the value as retry_after_ms.
An undici timeout or socket failure retries as a network failure. The classifier read a network code only off the error itself and knew none of undici's, so on the ai_sdk transport, where the AI SDK wraps a failed fetch in an error that keeps undici's as its cause, a turn that hit UND_ERR_HEADERS_TIMEOUT failed at once instead of retrying. UND_ERR_HEADERS_TIMEOUT, UND_ERR_BODY_TIMEOUT, and UND_ERR_SOCKET count as network codes now, read off the error or its cause, and a connection reset in the cause counts the same way.
A tool call that failed goes back to Claude marked as an error. The loop feeds a failed call back to the model as {"error": "…"} text, whether the tool was unknown, its input failed validation, its approval was denied, or it threw, and no transport said that the text was an error, so Claude read it as what the tool returned. The tool message carries is_error: true now. The native Anthropic transport sends it as the tool_result's is_error, and the ai_sdk transport sends an error-text output, a denial included, which @ai-sdk/anthropic turns into the same field. The content stays {"error": "…"} on every transport, so nothing that reads it breaks. The OpenAI-compatible and Ollama formats have no such field, and the Bedrock peer sends the text alone, even for Claude, so a model there reads the error from the content as it did before.
An ACP permission request leaves the kind of a card it didn't draw alone. The request sent its call's card with kind: 'other' for any tool that the session's workspace tools don't cover, such as a check that a flow runs itself and opens as an execute card from its own to_updates. Zed applies a request's fields to the card that it already drew, so the moment the check asked, its card lost the terminal look and kept the plain one from then on, since nothing sent the kind again. A request names a kind only for a workspace tool now, and for any other tool it sends none, which leaves the card as its opening drew it.
fascicle-viewer says how a run ended instead of reading LIVE. The header's chip showed the event stream's state and nothing else, so once a run's run_end arrived the clock froze but the chip kept reading LIVE for as long as the stream stayed open, and a finished trajectory read ● LIVE from the moment it opened. The chip reads LIVE only while the run is going now. Once run_end arrives it reads DONE, FAILED, ABORTED, or SUSPENDED, in the white family like REPLAY, and CONNECTING and OFFLINE still show whenever the stream isn't open.
throughput() reads Ollama's own decode rate. A step's window was duration_ms - first_chunk_ms whenever the turn streamed, and on Ollama a turn can finish generating before it dispatches anything. Ollama sends a tool call whole once it's generated, on either transport, and the native transport dispatched nothing while the model thought, so the window covered the last few milliseconds and the rate came out 100 to 1,600 times the daemon's own. Ollama reports the time it spent generating each step's output as eval_duration on both transports, and throughput() takes that as an Ollama step's window now, so the step measures 'decode' exactly, streamed or not.
throughput() counts a whole tool call's round trip when no decode time was reported. Other servers send a tool call whole too, such as Ollama's /v1 under the openai provider, which sends a call's arguments in one piece, and a step whose first chunk was that call still measured its last few milliseconds as 'decode'. The engine notes the first chunk of each attempt now, and when it belonged to a tool call whose input came in one delta or none, the step's StepTiming carries whole_tool_call: true and throughput() counts its whole round trip as 'blended'. A decode time that Ollama reports still wins, and a call whose input streams in pieces, as Anthropic's and OpenAI's do, still measures 'decode'.
Internal
acp-coder caches a Claude session, and a live test checks caching. acp-coder runs the longest tool loops in the repo, and on OpenRouter, its default provider, caching is opt-in. CoderConfig gains cache, and main.ts sets '5m' when the provider is anthropic or the model id starts with anthropic/, so every step after the first reads the session back from the cache. src/engine/__tests__/live/live_cache.test.ts, which runs only under LIVE_TESTS=1 with a key, runs a three-turn Claude tool loop on both native routes to Claude and asserts a write and then reads with no cache_miss, prints the hit ratio and the cost beside cache: 'off', and reports what OpenRouter does with cache: '5m' on another vendor's model. CONTRIBUTING.md has the command.
The test doubles for the ai module and the Bedrock peer can serve streams. The ai mock's streamText serves a response that a test queued for generateText whenever no stream of its own is queued. It streams the result as the parts it would stream as, carries its metadata and content parts across, and counts the call as the generateText call it stands in for, so a test written for a whole-body turn holds once that turn streams. A ConverseStream framer under src/engine/providers/__tests__/fixtures/ encodes Bedrock's binary event stream, CRCs included, with node:zlib, and bedrock_stream_wire.test.ts drives the real @ai-sdk/amazon-bedrock peer through on_chunk with it. The framer has a decoder that fails loud, because the peer's own decoder turns a frame it can't read into an empty turn.
The stub engines validate canned replies with the engine's own schema helpers, and three files that only other tests reached have tests of their own.validate_canned carried a copy of validate_schema and format_schema_issues, and it calls them now, so a stub's schema error matches a real engine's by construction, and a schema that fails with an empty list of issues reads unknown schema issue. An audit of the source files without a test of the same name found most of them tested from a parent directory, but nothing asserted which open span trajectory_recorder names as a parent, what a stub's schema error carries, or bench_suspend_error's name, and each now has tests that catch every mutant.