Harness is a fast, extensible, composable agent harness in Go. It ships a headless runtime library, a CLI, and an HTTP+SSE server.
Harness is pre-1.0. The runtime API, config schema, and plugin protocol may change between minor versions.
First tagged release.
- Claude Code
config_dir(config) — aclaude-code-clientry names the CLI config directory, theCLAUDE_CONFIG_DIRof every process of the CLI for the entry: each run, the login check, the ACP login gate andauthenticate, andharness login claude-codeandharness logout claude-code.session_mirrorneeds it: the backend writes the saved transcript into that directory before a run and removes it after the run, in place of a new empty directory, so a mirrored run has the login, settings, andCLAUDE.mdof the operator and a true--resumeworks on a host whose disk does not survive. harness sessions import— fills an empty session directory fromSyncBatchJSON lines on stdin, applied in order with the receiver rules of Sync.harness serveon that directory then lists and resumes the sessions.
-
Claude Code session mirror after a crash — a
session_mirrorrun now saves its transcript while it runs, at each mirror frame that holds a message, in place of only at the end of the run. When the harness process or its host dies in the middle of a turn, the next turn resumes the CLI with the messages and tool calls of the killed run, not on the older transcript. -
Claude Code session with a lost transcript — when the Claude Code CLI no longer has the conversation that a session resumes (for example on a new machine with an empty
~/.claude), the turn no longer fails withNo conversation found with session ID. The backend runs the same turn once on a new CLI session, which reads the earlier conversation throughget_conversation_history, and later turns resume the new session. -
Cross-backend model tool switch — a model API turn refuses a switch to a backend that owns its loop as a tool error. The turn continues on its current model; use session settings between turns, or spawn a task with the target model.
-
Code tool names — tools with hyphens have collision-safe callable aliases.
call(tool, **kwargs)calls an exact tool name or function and stops on errors. Undefined names suggest tool calls, andsearch_toolsacceptsquery=. The fixed description guides small results, safe bash input, and subagent session IDs without status polling. -
Tasks from code scripts — scripts can call every
taskaction, including throughattempt. A spawned child reports later to its parent session; a script timeout or interrupt does not cancel it. -
Code mode on a backend that owns the loop — a session in code mode now refuses a direct call of a tool that a script calls, with the same text and code as the harness loop, when the call arrives from a backend that owns the loop (Claude Code). The backend sends the mode text as engine context with the next input after a switch, with the first input of a session that starts in code mode, and again after a compaction. The log records what was sent, so a restart repeats nothing. The tools of the MCP endpoint are the same in both modes.
PATCHwithcode_modetrue no longer needscodein a declaration when the session runs on such a backend, and a model change between the two kinds of backend states the mode once. -
Thinking blocks after a compaction — the Anthropic wire sends no thinking block for a message that the newest compaction kept, so a model that binds a thinking block to the content before it no longer answers HTTP 400 on the first call after a compaction. The history and the log keep the reasoning.
-
Session MCP loading — the servers of
WithSessionMCPstart to connect when the session is created or opened, and a turn never waits for them: a server that has not connected yet loads in the background, its tools stay behind themcptool so the tool definitions of the request never change, a transient notice says that its tools are loading, and a call to one of them waits at most 1 s and then answers<server> tools are still loading; try again shortly.Session.AwaitMCP(ctx)waits for the first attempt of each session server for a host that wants the tools in the first request; the ACP agent calls it for themcpServersof a session. -
MCP connect bound —
connect_timeout_salso bounds a read of the tool list that atools/list_changednotification starts, so a slow read no longer takes the fixed 15 s when a smaller timeout is set. -
MCP bounds — the config keys
mcp_response_bytes(default 1 MiB),mcp_result_bytes(default 256 KiB), andmcp_turn_calls(default none) bound the body of an HTTP MCP response, the result that the model reads (cut with a marker), and the MCP tool calls of one turn (a call over the bound is an error result). -
Durable notices — every notice of a harness-loop session is a pin that the log holds: the MCP down notice, the added-tools notice, the plugin segment, the skills notice, and the process status. A model call that finds a text that differs from the newest notice of its kind appends one
pin.recordedrecord before the request is built, so a restart or a new owner with the same live state sends the same bytes and appends nothing. The MCP down notice follows the same rules and adds[mcp: every server is connected again.]once when the last server connects. The first call of a new process no longer pins a notice that the log never recorded after the banner: it follows the history of its call. A compaction still keeps the newest notice of each kind, and the call that declares the prefix afterwards retires the added-tools notice for tools that are now declared, the skills notice that the new system prompt states, and the removed-server notice for a server that the declaration records as gone (gonein the declaration blob). Apin.recordedrecord with notextretires every pin of its kind. The transient notice of a session server that still loads is unchanged. -
MCP error text — a failed MCP call tells the model
mcp: server "<name>": call failed: <why>with the HTTP status or the JSON-RPC code, and never the text of the remote error, so a credential in that text stays out of tool results, events, and spans. -
Session MCP shutdown — the end of a session waits for the
WithSessionMCPAuthFailedcalls in flight, sofnnever runs afterRelease,End, orClosereturns, andfnmust not stop the session. TheDELETEthat ends a remote HTTP MCP session runs in the background, owned by the runtime and joined byRuntime.Close, so a release, a laterOpenof the session, and a connect that times out do not wait for the remote server. -
MCP HTTP redirects — a Streamable HTTP MCP server can no longer redirect a request to another origin. The request is refused with the reason
redirect refused, so the headers, theHarness-Session-Idheader, and the body stay with the origin of the entry.config.MCPServerSpec.HTTPClientsets the client of one entry in Go; a client with its ownCheckRedirectkeeps its policy. -
Account-selected tool calls — eligible tools can start while the model response is still streaming when an account is selected.
-
Tool input errors — live tool availability frames include a bounded, masked normalization error while retaining the raw input.
-
Step finish reasons — a step that ends on an output limit or a refusal reports the normalized provider finish reason.
-
Retry after tool block start —
Options.DisableRetryAfterOutputstops recovery resends after a tool block starts, even when the stream ends before the tool input is complete. -
Tool cancellation and session cleanup — cancellation stops waiting for custom tools that ignore their context and discards late results. Synthetic cancellation uses the standard context error and leaves accepted callback results and the turn stop cause unchanged.
Runtime.Endand session deletion cancel busy work instead of returning 409, withdraw queued inputs, and continue cleanup after caller timeout, including when a graceful release has started. A pending lifecycle stop keeps its first cause across shutdown and revocation, including cancellation during an append. Durable logs stay in the store; embedders own their deletion after the session'sDonecloses. -
MCP skill integrity — skill pagination has a separate deadline from connection setup. An incomplete skill list cannot make an uncovered resource bypass skill verification, regardless of URI scheme; load the skill before reading its files. Tool-list refreshes preserve skill entries and their incomplete-list error.
-
Tool changes on the Anthropic wire (
config,internal/modelmeta,internal/provider/anthropic,internal/turn) — on a model that takes themid-conversation-tool-changes-2026-07-01beta, code mode sends the tools that it hides withdefer_loading: true, and a mode switch appends one system message withtool_removalandtool_additionblocks in place of the engine-context notice, so a switch never changes an earlier byte. A request that holdscodesends the beta header from its first call, so the header changes only at a declaration. The new keyproviders.anthropic.tool_changesturns it on or off; it defaults to on only for the direct Anthropic API. -
Code mode setting —
code_modeinCreateSession,SettingsPatch,settings.changed, and the session view switches a session between calling tools directly and calling them through thecodetool. A switch appends onecode-modenotice at the next model call and changes no byte of the earlier request; a direct call of a tool that only a script calls is refused with an error result. Eachprefix.declaredrecord holds the mode ascode_mode. -
code tool (
config,internal/tool/codetool,internal/turn,protocol) — withcode_modetrue, every session has acodetool that runs a Starlark script. The script calls the other tools as functions (attempt,parallel,search_tools,describe_tool,json), and the model reads only the printed output and the last value. Each nested call passes the allowed tools, the hooks, and the scheduler of its model call, and appends anested_call.recordedevent that no model reads.turngains the optionalNestinginterface of a tool. The WebAssembly module offers nocode. -
Durable tool declaration (
internal/session,internal/eventlog,protocol,docs/architecture.md) — a session records its tools and its MCP prompt segment in aprefix.declaredevent and a blob, so a restart and a new owner send the same tools array and prompt segment, with a tool that was not declared deferred. The session declares again at a compaction between two turns, at a change of the model with other tools, and at the first call of a process when a declared tool has a changed input schema. -
Live tools at each declaration (
internal/tool/mcpsrc,internal/tool/pluginsrc,docs/architecture.md) — a new declaration takes the tools, the definitions, the servers, the plugins, and the MCP prompt segment that the running process has, so a change of an MCP server or of the plugins reaches a running session at its next compaction between two turns, with no restart. The runtime keeps no first definition of a tool, no tool set of a first connect, and no MCP surface decision for the life of the process. A session keeps its declaration between two declarations. -
Durable system prompt (
internal/session,internal/selftool,sessionprompt.go,docs/architecture.md) — the declaration of a session holds its system prompt: the segments, the instructions files, the skills, the embedded skills, and the body of an agent profile. Every model call of a backend that does not own the loop sends the prompt of the newest declaration, in every process, andOpenreads no prompt file for a session that has one. A new declaration reads the files again, so an edit ofAGENTS.mdreaches a running session at its next compaction between two turns, with or without a restart. The embedded skills of the declaration are the baseline of Skill updates, andsession_inforeports the declared prompt and tools. A session whose declaration holds no system prompt declares again at its next model call. -
Turn context —
harness.WithTurnContext(text)is an option ofSession.Prompt,Session.PromptStream, andTurn.Steer. The model reads the text as engine context after the input on each model call of that turn, and no event, history read, or later turn holds it. It is not persisted.turn_contextin the body ofPOST /sessions/{id}/inputs(protocol.Input.TurnContext, at most 4096 bytes) sets the same text over HTTP; a repeat of the input ID with anotherturn_contextis a repeat and keeps the first text. Claude Code reads the text once, on the stdin line of the input that carries it. -
Auth failure of a session MCP server —
harness.WithSessionMCPAuthFailed(fn)callsfn(server, status)when a server ofWithSessionMCPanswers 401 or 403, so an embedder can mark the connection for reconnect.mcp.HTTPStatusErrorcarries the status and no body, and an MCP log line holds the server, a reason, and the HTTP status or JSON-RPC code, never the text of the remote error. -
Allow one MCP server — an
AllowedToolsentrymcp__<server>__*allows every tool of that runtime or session MCP server, a tool that arrives later included. An embedder no longer lists a server before it creates the session. -
GPT-6.2 on the codex route — the static
codexcatalog listsgpt-6.2-solandgpt-6.2-astra, with their models.dev window and efforts. The ChatGPT model-list request sendsclient_version0.169.0, so the backend no longer hides models that need Codex CLI 0.166.0 or later. -
Effort of an input —
protocol.Inputhas anEffortfield. A turn whose inputs all set an effort runs its model calls at the highest of them, and any other turn uses the effort of the session. The session setting does not change and the log gets nosettings.changedevent. -
Newest-first session list —
GET /sessions?order=newestlists sessions newest first, andprotocol.ListSessionshas aNewestfield. It combines withparent, so a client reads the newest children of a session in one request.afternames the last session of the previous page in the same order, and the list builds a view only for the sessions that it returns. -
Child session list —
GET /sessions?parent=<id>lists only the children of a session, and the list describes no other session, so the cost follows the number of children and not the number of sessions.protocol.ListSessionshas aParentfield. -
File attachments — an input accepts a blob of any media type with a
name. The runtime writes a file that no provider takes to.harness/attachments/<sha256>/and tells the model its path in a<harness-attachment/>tag. -
Sender attribution — the model reads who sent each input that names a
source_label: the self-closing tag<harness-sender name="<label>" source="<source>"/>leads a turn's input and follows the number of a steer item (sourceis absent when empty;nameandsourceare XML-escaped). Readers and the event log are unchanged; an input of sourcecommandnames no sender. -
Tool input normalization — tools can opt in to normalize input once in harness-owned loops. Successful normalization supplies the canonical call input to execution, events, forwarding, and later model requests. A normalization error retains the raw input, records a tool error, and prevents execution. Plugin
Beforehooks see the normalized input; their rewrites affect execution only. -
Ordered tool blocks (
protocol) — model API streams announce tool calls when their identity is known and when their full input is available, interleaved with text.PromptStreamretains these frames for lossless consumption. -
Parallel embedder tools (
harness) — aParallelToolchanges state, but its calls run beside the other read-only and parallel calls of their model call, up to 8 at once. A later call that is not read-only or parallel waits for them. Calls with the same non-emptyKeyedToolkey still run one at a time, in call order, and anAloneToolthat is also aParallelToolruns alone.Spec().ReadOnlykeeps its meaning. -
Durable step boundaries (
protocol) —step.startedandstep.endedidentify logical model steps by turn and zero-based index, with the normalized finish reason on completion. Backends that cannot expose steps omit them. -
Contextual tool stop (
harness) —Options.StopAfterContextinspects the current turn’s recorded text and tool results.Options.StopAfterErrorsoptionally includes failed results in predicate evaluation; named-tool stops and default behavior remain unchanged. -
Lossless prompt streams (
harness) —Session.PromptStreamsubscribes before admitting a new queued input. Its owned stream keeps every delta and item lifecycle frame in order, even if reading begins after the turn ends. Slow readers use unbounded queue memory without blocking the actor; close an unread stream to release it. Existing event streams keep best-effort live delivery, with completed-item reconciliation as a backstop.Options.DisableRetryAfterOutputlets append-only clients fail rather than resend a model call after its first output delta; later model calls retain their own pre-output retry budget, and the default policy stays unchanged. -
Anthropic cache controls (
config.Provider) —CacheFinalMessage(cache_final_message) can disable the automatic final-message cache marker while keeping the selected system marker. Nil or true keeps the default behavior. Embedding and config docs show the existing five-minute TTL option. -
Conditional tool stop (
harness) —Options.StopAfterlets an embedder end a turn based on a successful tool result, after result hooks and before retention. Every call in the step still finishes and is recorded. Existing named-tool stops stay independent; backends that own their loop ignore the predicate. -
Per-session system blocks and cache selection (
protocol.CreateSession) —SystemBlocksreplaces the default prompt for one session and survives reopen.SystemCacheBreakpointselects the Anthropic system block to cache; absent keeps the last-block default. The newest message marker and configured TTL stay unchanged. -
Tools start while the model streams (
harness) — a tool call starts when the model stream delivers it complete, not after the model call ends. Calls ofReadOnlytools run together; every other call runs alone, in arrival order, as in Codex. Results are still recorded in call order after the model call ends. A call that started may already have had its effect when the model call fails. Backends that own their loop are unchanged. -
Stop after tools (
harness) —Options.StopAfterToolslets an embedder end a turn after a successful named tool call, without another model request. All calls in the step finish first. Backends that own their loop do not use this option. -
Faster stopped-session reads (
harness,store) — disk stores persist disposable light checkpoints and fetch source records by sequence, so message pages need not rebuild every message body. Session listings describe sessions concurrently while keeping creation order. Checkpoints use the harness module identity; a local-path dependency replacement bypasses the cache. -
Turn continues the trace of its one input (
internal/session,protocol,docs/architecture.md) — a turn that starts from exactly one input with a validtraceparentmakes itsinvoke_agentspan a child of that span, in the same trace, with no link. A turn that starts from no such input, or from two or more, is still a root that links to each. The turn of a child session, the parent turn that reads a child report, a goal continuation turn, and the/compactturn of a backend that owns its context follow the same rule. A steer input still adds a link. -
Live provider set (
harness,internal/backend,internal/provider,internal/server,protocol,docs/architecture.md) —Runtime.SetProvidersandPUT /providersreplace the whole map of configured provider entries of a running runtime, and the set is not persisted. An entry whose config and API key are the same keeps its client, websocket pool, and catalog. A new or changed entry gets a new backend, and an entry that is left out takes no new call and closes after its calls in flight end. The body is validated as the config is, a failure isinvalid_requestand changes nothing, and the answer lists each provider withavailableand areason, never a key or a header.Runtime.ReconnectProviderandPOST /providers/{name}/reconnectmove the credential revision of one entry: each pooled websocket keeps the revision that it was dialed under, so idle older sockets close at once, a busy one closes when its call ends, and the next connection authenticates again. A new login generation of anauthinjectedentry moves the revision too. A session whose provider is gone fails its next model call withmodel_unavailable. -
jjengine for/workspace/changes(internal/workspace,protocol,docs/architecture.md) — a directory in a Jujutsu work tree now answers withenginejj, also when it is a git work tree too, and it needsjjonPATH. The head is@-as achangerevision, the label is the nearest local bookmark, and the base is the fork point of@-andtrunk(). The diff is the files on disk against the base or@-(the automatic merge for several parents), read from the git store without a snapshot or an operation, and a file that@records as a conflict has the statusconflicted. The response has a new fieldhead_commit, the git commit ID of the head, present exactly whenhead_revis. The contract table no longer allows an engine to snapshot on read. A jj repository config that setsharness.changes-commandto an array of strings makes the engine run that command in the root instead of the git store diff, withHARNESS_CHANGES_SCOPE,HARNESS_CHANGES_BASE, andHARNESS_CHANGES_PATCH_BYTESin its environment, and takefiles,patch, andtruncatedfrom its JSON stdout. A failing, slow (over 10 s), undecodable, or over-limit command fails the request withinternal(too_many_changesfor a file list over the limit), and on Unix the engine kills the whole process group of a command that runs over the limit or leaves a grandchild that holds stdout. The engine stops at a nested git repository, which thegitengine answers, and theuncommittedscope of a jj work tree with two parents diffs against the merge of the parents without rename detection (more than two fail that scope only). The git commands of the engine run in a private git directory that reads only the objects of the store, so no merge driver, filter, or attribute of the repository, the user, or the system applies (only the ignore rules of the repository and of the global git config do), and the tree of a commit that jj records as conflicted, also as a parent of a merge, holds the materialized content and mode of each conflicted file. The engine never snapshots, writes an operation, or writes a file of the work tree; jj may still write its own caches, move an old config file, or make its per-repository config files while it loads the repository. -
Embedded skill updates (
Options.Skills) — a running session callsSkillSource.Listbefore each model call. A changed list reaches the model as one pinned segment after the history, so the system prompt, the tools, and the cached prefix stay as they are.load_skillandsession_infofollow the newest list. -
Session ID in a plugin tool (
plugin) —plugin.SessionID(ctx)returns the ID of the session that called a plugin tool.Tool.Executegets the session on its context for a process plugin and for an in-process plugin. -
session_infowith noWorkDir(harness) — every session offerssession_info, on every backend, with or without aWorkDir, so a host with no file system (for example one that usesOptions.Skills) can call it. AnAllowedToolslist that leaves it out hides it.Newnow fails for an embedder tool or a plugin tool namedsession_infoalso with noWorkDir. -
Embedded skills (
harness,internal/prompt,internal/selftool,internal/backend/claudecode) —Options.Skillstakes aSkillSource, so an embedder supplies the skills of each session, for example from a database. The runtime callsListonce when a session is created or opened and adds the skills to the skill list, also with noWorkDir. An embedded skill replaces a skill ofskills_dirswith the same name. The new runtime toolload_skill {name, file}reads one file of a listed skill withRead, andsession_inforeports the skill by name with no path.Newfails whenOptions.Toolsalso has aload_skilltool. The skill list header, when the list holds an embedded skill, and the Claude Code tool-name segment, when the turn offersload_skill, say that a skill is loaded withload_skillwhen its line says so. -
Step limit of an existing session (
harness,protocol,internal/session) —Runtime.OpenwithWithMaxSteps(n)sets or clears themax_stepsof a session that exists, with onesettings.changedthat carriesmax_steps. It applies from the next turn.Createrejects the option, andPATCH /sessions/{id}cannot set it. -
Per-session limit of model requests (
protocol,internal/turn,internal/backend/claudecode) —max_stepsinPOST /sessions(CreateSession.MaxSteps) caps the model requests of each turn. A turn that made that many requests and would make another ends at once with the new stop reasonstep_limit, keeps its messages, and ACP answersmax_turn_requests. The Claude Code backend passes--max-turnsand maps theerror_max_turnsresult tostep_limit. Zero or absent is no cap. -
MCP Skills extension client (
internal/mcp,internal/tool/mcpsrc,internal/skill) — harness declaresio.modelcontextprotocol/skills, readsskills/listof each server that serves skills, and lists its skills in<mcp_skills>of the MCP segment (in theharnessserver instructions on the Claude Code backend).load_mcp_skill {server, uri}loads a skill, listed or not, and checks the size, SHA-256 digest, and frontmatter ofSKILL.mdagainst its entry.read_mcp_resourcechecks each file of a loaded skill against the held entry, lists its directories, and refuses a read of its files on another server. Skill content is tagged with its server as untrusted content;allowed-toolsof an MCP-served skill is never honored. -
GPT-6.1 Terra on the ChatGPT backend (
internal/modelmeta) — the static codex catalog listsgpt-6.1-terra, with its models.dev name, efforts, and context window. Acodex/gpt-6.1-terrasession runs on the known window instead of the default one. -
WebAssembly module in a Cloudflare Worker (
sdk/embed,cmd/harness-wasm) —wasm({module, wasmExec, worker: false})runs the module in the current JavaScript isolate on an in-memory file system, for a host that cannot start a Worker.modulemay be a compiledWebAssembly.Module, andwasmExecmay be a function that loadswasm_exec.js. The store stays in memory:store.persistandstore.dirreject.@majorcontext/harness-embed/memoryfsexportsinstallMemoryFs()for a host that loads the module itself. A host that installs no file system now getsinvalid_requestwith a reason that says so and namesinstallMemoryFs, notcwd is not a directory. A new CI job runs one ACP turn underworkerd. -
Session headers on injected ChatGPT entries (
internal/provider/openai,internal/backend) — an entry withauth: "injected"andmodels_from: "chatgpt"sends the hash of the session id assession_idandx-client-request-id, so a request that no response chain covers reads the prompt cache of the ChatGPT backend. The raw session id never leaves the process. -
Message ids on the Claude Code chat span (
internal/backend/claudecode,internal/turn) — thechatspan of a Claude Code turn has onegen_ai.responseevent for each distinct model call of the turn. The event carries the Anthropic message id asgen_ai.response.id. Theturn_metricsline does not change. -
Trace links for turns that harness starts (
internal/session,internal/tracing,harness) — a parent turn that starts from the report of a child links to theinvoke_agentspan of the child turn, and a goal continuation turn links to theinvoke_agentspan of the turn that the judge evaluated. The link is in thetraceparentandtracestateof theinput.admittedrecord. -
Trace context from request headers (
internal/server,internal/tracing,internal/session,protocol) —POST /sessions/{id}/inputstakes thetraceparentandtracestaterequest headers as the trace context of the input when the body has notraceparent.POST /sessions/{id}/compacttakes them as the trace context of the compaction: the/compactturn of a backend that owns its context links to it, and so does the summary call of a compaction that the runtime runs. A header that is not valid is ignored. -
Compact only the expected turn (
protocol,harness,internal/session) —protocol.Compactgainsexpected_turn_id. When it is set and the newest ended turn has another ID,Compactfails withturn_mismatchand appends nothing, so a client that saw an idle session does not compact one whose cache a new turn refreshed. -
OpenTelemetry traces (
harness,protocol,cmd/harness,internal/tracing,internal/turn,internal/session,internal/mcp) — each turn makes aninvoke_agentspan with achatspan for each model call and anexecute_toolspan for each tool call, in the generative AI semantic conventions.Options.TracerProvidertakes a provider;serve,run, andacpexport over OTLP/HTTP whenOTEL_EXPORTER_OTLP_ENDPOINTorOTEL_EXPORTER_OTLP_TRACES_ENDPOINTis set. Every HTTP model request carriestraceparent, and an MCP call carries it inparams._meta. An input takestraceparentandtracestate, and its turn links to them. Aturn_metricsline gainsturn_id,call_seq, andcall_id.OTEL_INSTRUMENTATION_GENAI_CAPTURE_MESSAGE_CONTENT=trueorOptions.CaptureMessageContentadds message content. No span exists without a provider, and harness emits no metric. -
Cache expiry and compaction point on the session view (
protocol,internal/session,internal/eventlog,internal/backend) —context.compact_atis the token count at which the session compacts before the next turn.cache_expires_atis when the prompt cache expires: the newest model call reading plus its cache lifetime. It is absent when the lifetime is unknown and after a compaction. The Anthropic client states itscache_ttl, the ChatGPT Codex backend states 30 minutes, and the Claude Code backend setsENABLE_PROMPT_CACHING_1H=1and reads the lifetime from the usage of each call.context.measuredgainscache_ttl_seconds. -
Goal judge account exhaustion (
protocol,internal/session) — a goal evaluation that reaches a provider usage limit addscause,model(the resolved evaluator model ref), and optionalresets_attogoal.changed. A host can move the session to another account before the next judge retry. -
Goal evaluator transcript limit (
internal/modelmeta,internal/backend/claudecode,internal/session) — Claude Code aliases use the latest matching Anthropic context window. The evaluator transcript budget does not exceed 391,808 bytes. Session views use the latest window reported by Claude Code when available. -
Input admission check (
harness) —harness.CheckInput(model, input)runs the checks thatSession.Promptruns on an input (provenance, parts, attachment type, decode, and size, and image input formodel) without a session, and stores nothing. It returns the sameinvalid_requesterror asPrompt, so an embedder can refuse a bad attachment when it queues the input. It checks a typed slash command as plain text. -
Tool allowlist replacement on open (
harness,protocol,internal/session,internal/eventlog) —harness.WithAllowedTools(names)lets an embedder replace a stored session's tool allowlist beforeRuntime.Openresumes it. The runtime records onesettings.changedwhen the sets differ. Nil allows all tools; an empty list allows none. Replay, session views, children, and model validation use the replacement. The HTTP settings surface cannot change the allowlist. -
Deferred model changes in Claude Code (
internal/selftool,internal/session,harness) — themodeltool now allowsstatusandseton a backend that owns its loop.setvalidates a ref or alias at once and returnseffect: next_turn;statusincludes anypending_model. The pending model applies through the session settings path when the turn completes, fails, or is canceled, without changing the running turn or its backend process. A later set replaces the pending model, and a set to the current model clears it. Pending changes are live turn state and do not survive a handoff or process exit. Model API sessions keep immediate changes. The tool leaves effort unchanged. -
Per-session subscription accounts (
config,protocol,internal/tree,internal/session) — sessions store vendor-to-account IDs in settings, children inherit them, and thetasktool accepts account overrides on spawn and send. Configured account routing appends the opaque ID to the proxy username; unavailable routing fails the model call. -
Derived title as a record (
protocol,internal/eventlog,internal/session) — a root session with no model title now records its derived title assession.titledwithsourcederived: withouttitle_model, after the first prompt; withtitle_model, when the title call fails and no person has titled the session. Aderivedrecord changes no state, so a reader of the log finds a title in every titled root session. -
Model-written session title (
config,protocol,internal/eventlog,internal/session,harness) — withtitle_model(a model ref or an alias), a root session sends its first prompt, cut to 2048 bytes, to that model after the first input is admitted, and the answer becomes the title in place of the first line of the prompt. The call runs beside the turn, once for each session, with effortoff, a 32-token cap, and a 15 s timeout; a failure keeps the derived title, and its usage counts in the session usage.session.titledhas asource,user,model, orderived: a title from a person always wins, and a title from a model never replaces it. Withouttitle_model, nothing changes. -
Session title (
protocol,internal/eventlog,internal/session,internal/acp,cmd/harness) — a session has atitle: the newest rename, else the first line of the first prompt cut to 8 words and 100 bytes (a prompt that starts with/or has no text gives none).PATCH /sessions/{id}andSession.Updatetaketitleand append the new durable kindsession.titled; an empty title, a title with a control character, or a title over 200 bytes fails withinvalid_request. The session view andGET /sessionscarrytitle,harness sessionshas a title column andtitlein--json, ACPsession/listanswers it instead of null, and ACP sends asession_info_updatewithtitlewhen it changes. The new control command/rename <title>renames a session, so an ACP client renames by prompting. -
Session ID header for MCP servers (
config,internal/mcp,internal/tool/mcpsrc,internal/turn,internal/backend/claudecode) — an HTTP MCP server entry can setinclude_session_id_header: trueto receiveHarness-Session-Idon tool-call requests. The value is the calling harness session ID. Native backends add it to the outgoing HTTP request; Claude Code receives it in the per-run MCP config for the corresponding bridged server. The field defaults to false and does not apply to stdio servers. -
Live plugin set (
harness,internal/tool/pluginsrc,internal/plugin,internal/turn,internal/provider,internal/server,protocol) —Runtime.SetPluginsandPUT /plugins({"plugins": [<entry of the config key plugins>]}) replace the whole set of config plugins. A bad manifest or name fails withinvalid_requestand changes nothing. A plugin with the same entry keeps its process, a changed plugin gets a new process, and a removed plugin stops. Hooks and events go to the live set from the next dispatch. Thesystem.transformsegments now go in an engine-context block at the end of each request, after the cache breakpoint, and no more in the system prompt, so a change of the set never changes the cached prefix. A tool that a call adds is deferred, named in themcp-setnotice, and loaded withmcp(action="select"). A session with a config plugin now has themcptool.plugin_cachekeeps only the newest entry of each plugin name. -
Time limit for MCP and plugin tool calls (
config,internal/tool/mcpsrc,internal/tool/pluginsrc,internal/toolresult) — each MCP tool call and each plugin tool call now ends aftertool_timeout_sseconds (default 120), a new field of anmcp_serversentry, including a session server, and of apluginsentry. A value below 1 fails the config load. A call that passes the limit has its context canceled and returns the error result<tool name> timed out after <N> s; the turn goes on. Before, a plugin tool call had no limit, and an MCP call ended after the 30 s request bound of the client, with the textcall failed: timed out. The request bound of an MCP client is now the longer of 30 s and the limit plus 1 s. -
Live MCP server set (
harness,internal/tool/mcpsrc,internal/server,protocol) —Runtime.SetMCPServersandPUT /mcp/servers({"mcp_servers": {<name>: <entry of the config key mcp_servers>}}) replace the whole set of runtime MCP servers. A new server connects at once in the background, a server that the body leaves out closes (a call in flight to it ends with an error), a server with a changed spec connects again, and a server with the same spec stays as it is. The answer is{"servers": [...]}, the same entries as thestatusaction of themcptool. A body with nomcp_servers, a spec that breaks a rule ofmcp_servers, and a name of a session server areinvalid_request. The set is not saved: a new process starts frommcp_servers. A request prefix of a session does not change: a tool that arrives after the first connect (a late or retried server, an added server, a changed server, or anotifications/tools/list_changednotification) is deferred, whatevertool_loadingsays, and a pinnedmcp-setnotice names it with the instructions of its server and says which servers went. A tool that a session already sent stays in its definitions, and a call to it readsno such tool available. Themcptool now always has the actionssearchandselect, andharnesstest.MCPServergainsSetTools,NotifyToolsChanged, andInitializes. -
Refresh MCP tools on a name miss (
internal/tool/mcpsrc,internal/turn) — whenmcp(action="select")or a tool call names a tool that a connected MCP server does not list, the runtime reads that server's tool list and waits for the read before deciding. A newly listed tool is deferred. Servers that are not connected are not refreshed. -
WebMCP tools of a page as page tools (
sdk/embed) —@majorcontext/harness-embed/webmcphaswebmcpTools({prefix, fromOrigins, log}), which readsdocument.modelContext.getTools()and returns the tools as page tools forcreateHarness. A tool is namedwebmcp__and its WebMCP name; a tool with an invalid name or schema is left out and logged. A call runsexecuteToolwith the input object and the call signal, and a rejection is an error result with the name and message of the exception.readOnlyHintandconsequentialHintadd a line to the description, and the result of a tool withuntrustedContentHintis spotlighted. Withoutdocument.modelContext, or whengetToolsrejects, it returns an empty list and never rejects. -
Claude Code asks through
ask_user_question(internal/backend/claudecode,internal/turn,internal/session,harness) — a Claude Code session asks a question with the harness toolask_user_questionover the harness MCP endpoint, as every other backend does, and the CLI no longer getsAskUserQuestion:--toolslistsToolSearch(andWebSearchwhen the search is on), and the--permission-prompt-tool, defer-hook, and plan-mode flags are gone. The call shows in the log and in the event stream under the nameask_user_question, so thetool.execute.beforeandtool.execute.afterhooks of plugins see it, andAllowedToolsnames it. The request, thewaitingstatus, the answer route, and the ACP form do not change. The backend interrupts the CLI once the request opens, and the answer starts a turn whose prompt is the text of the recorded result (User has answered your questions: ...). A session that listsAskUserQuestioninAllowedToolsnow failsCreate. -
Examples on a subscription login (
examples) —prompt,custom-tool,switch-model, andguardrailsetConfig.SubscriptionDefault: they useANTHROPIC_API_KEYwhen it is set, else the login ofharness login codex, elseclaudeonPATH. -
Reference server for the embedded module (
examples/embed-server) — a Go server in its own module (it importsgithub.com/majorcontext/gatekeeper/proxy; the harness module takes no new dependency). It serves the WebAssembly module,wasm_exec.js,sdk/embed, and a terminal-style page that chats withcodexwithauth: "injected": it keeps the conversation in OPFS and replays it withsession/loadafter a reload, and shows the elapsed time and an estimate of the tokens of each turn.-token-filekeeps the ChatGPT logins and-session-filethe app sessions across restarts, for development. It signs the user in to ChatGPT on the server with the device code flow at/settings/codex, keeps the tokens per user, and adds them to the model requests through a gatekeeper relay behind a session check. The session is a stand-in for the session of your application. -
Injected auth (
config,internal/injectedauth,internal/backend,internal/acp,internal/acp/acpauth,internal/provider) — aprovidersentry of typeopenai, and the nativeanthropicentry, can setauth: "injected": a server in front of the endpoint holds the credential and adds it, and the adapter sends noAuthorization,x-api-key,ChatGPT-Account-ID, ororiginator.extra_headersstill apply, so an entry can carry the placeholders that a substituting proxy replaces. A 401 fails the turn with the error classlogin_required; a 403 does not. ACPsession/new,session/load, andsession/resumesend a GET status probe to the wire's model-list endpoint, even withoutmodels_from; a cross-origin probe can add a CORS preflight. A 401 probe rejects the session request withlogin_required. A 401 within 2 minutes after a status probe that answered 200 ends the turnpermanent. The Responses adapter hashes the session ID forprompt_cache_keyrather than sending the raw ID. The new keyslogin_urlandmodels_fromare user-only.models_from: "chatgpt"now decides the live model list fetch, in place ofauth: "chatgpt"; the nativecodexentry sets it, and an entry withauth: "chatgpt"and nomodels_fromlists the static models.harness acpoffers the methodinjected-<provider>only when the entry setslogin_urland the client advertiseselicitation.url: it shows the URL and polls the status probe until the server accepts the sign-in. A permanent error from a transport no longer starts with the request linePost "<url>":that the HTTP client adds, for every provider. -
Action for a
codexentry that replaces the native one (config) — if yourcodexentry inprovidershasauth: "chatgpt", addmodels_from: "chatgpt"to keep the live model list. The fetch now followsmodels_fromalone; without it the entry lists the static models. -
Default model from the subscription (
config,cmd/harness) —harness login codexandharness login claude-codesavemodel(codex/gpt-6.1-solorclaude-code/sonnet) in the user config when it sets none, keep every other key, never replace a model that is set, and print one line. Arunoracpconfig that sets no model (and no flag orHARNESS_MODELdoes), and whoseanthropicentry has no non-empty selected key, configured auth, or non-empty credential header, resolves its default tocodex/gpt-6.1-solwhencodex_auth_fileexists and is not empty, else toclaude-code/sonnetwhenclaudeis onPATH, else toanthropic/claude-fable-5. The check is onestatand onePATHlookup, with no process and no network call. Onlyrunandacpdo this (Config.SubscriptionDefault, set bycmd/harness);serveand the Go API keep the built-in default, because a server must not change its default with what is onPATH. A Claude Code turn that fails while the CLI is logged out now has the error classlogin_requiredand namesharness login claude-code, on every host.config.SetModelis the writer. TheTry:line oflogin codexnames the same model. -
Skills for Claude Code sessions (
internal/backend/claudecode,internal/prompt,internal/turn,harness) — a Claude Code session lists the skills ofskills_dirs(default.agents/skills), with the same text and the same skills as a model API session, and the model opens a skill withread_file. The skill segment goes in the system prompt value after theappend_system_promptentries, behind a new segment that tells the CLI that its tools are the Harness tools and which Harness tool replaces each tool name that instructions use (Readisread_file,Taskistask,BashOutputisprocess). The CLISkilltool stays off. The value still holds neither the base prompt nor theAGENTS.mdchain, because the CLI has its own and readsAGENTS.mdandCLAUDE.mditself. The value goes to the CLI in a temporary file (--append-system-prompt-file), because Linux caps one argument at 128 KiB, andextra_argsof aclaude-code-clientry now fails the config load when it holds--append-system-promptor--append-system-prompt-file. Before, a Claude Code session loaded no skill since the CLI ran with--tools "". -
Parallel reads in Claude Code (
protocol,internal/backend/external,internal/tool) —protocol.ToolSpechas the new fieldread_only. The harness-hosted MCP endpoint lists a tool withreadOnlyHinttrue when it is set, so the Claude Code CLI runs parallel calls ofread_file,glob,grep,ls,read_tool_result,session_info, andget_conversation_historyat once instead of one after another (three parallel calls of a 3 s tool took 9.2 s without the hint and 3.2 s with it). A tool of an MCP server passes its ownreadOnlyHintthrough. A write tool, a plugin tool, and every other tool stay without the hint. -
Injected auth in the WebAssembly build (
cmd/harness-wasm,internal/acp/acpauth,internal/jshost,internal/backend,internal/codexauth,sdk/embed) — the in-browser ChatGPT login (the device code flow, the login file in the store, and the page-origin check) was removed in favor ofauth: "injected": the wasm module holds no model credential and offers nochatgptmethod, and an entry withauth: "chatgpt"is not listed and fails a request before it is sent with the error classlogin_required.proxy.providersofcreateHarnessreplacesproxy.providerBaseURLs: it maps a provider name to{baseURL, loginURL}, which setbase_urlandlogin_urlof the entry, and the nativecodexentry also getsauth: "injected". A server on the page origin holds the credential and answers401for a user who is not signed in, and the client of the page signs the user in through the ACP methodinjected-<provider>.harnessConnecttakes nopageOrigin, andharness.Optionshas noIssuerTransport.HostLimits.NoLoginnow means that the host has no file login. Every model request of the module follows no redirect (redirect: "manual"). The nativeharness login codexis unchanged. -
web_fetchtool (config,internal/tool/webfetch,harness,internal/acp) — the config keywebis an object{"fetch": bool}(searchjoins it, see Web search), andweb.fetchtrue gives each session with aWorkDirthe built-in toolweb_fetch, on every backend. Claude Code gets it through the harness-hosted MCP endpoint, so each fetch runs through thetool.execute.beforeandtool.execute.afterhooks, which can deny it by URL, and through retention;AllowedToolsnames it. The input is{url, format, max_bytes}: one GET of anhttporhttpsURL with no body, no cookie, no credential, no proxy variable, and the User-Agentharness/<version> (web_fetch). A custom dial resolves the host and refuses loopback, private, link-local, CGNAT, unique-local, multicast, and unspecified addresses, also as IPv4-mapped forms, and dials the address it checked, so DNS rebinding cannot bypass it. A call follows at most 5 redirects, each checked the same way, ends after 30 s, and reads at most 10 MiB. HTML becomes markdown (default), plain text, or the raw source; text and JSON pass through; a PNG, JPEG, GIF, or WebP image returns as an image; any other type returns its type and size. The result starts with the final URL and the status.web_fetchis off by default and the WebAssembly module offers no such tool: the host setsHostLimits.NoNetwork, a config that turnsweb.fetchon stays valid, and the build links neither the tool nor its HTML parser. ACP shows its tool kind asfetch.Options.WebTestis a test seam and not a config key. -
Web search (
config,internal/message,internal/provider,internal/backend,protocol,internal/acp) —web.search(default false) offers the native web search of the provider: the server toolweb_search_20260209on Anthropic Messages, the built-inweb_searchtool on OpenAI Responses and the Codex lane, andWebSearchin--toolsfor Claude Code. Anopenai-compatmodel sends nothing. The search runs inside the model call, so no hook can run on it. The tool nameweb_searchinAllowedToolsturns it off for a session that leaves it out. The log records a search as the new partweb_search(call_id,query,results, and the opaqueprovider_datathat the same provider needs to receive it again), and a text part may holdcitations. A search goes back to the same provider as its own blocks or item, and to any other provider as text.protocol.Usagegainsweb_search_requestsfor Anthropic, which bills each search. ACP shows a search as afetchtool call with a link for each source. -
Native
codexandclaude-codeproviders (config,internal/backend,internal/acp/acpauth,cmd/harness) —codexandclaude-codeneed noprovidersentry, asanthropicandopenaido. Afterharness login codex,harness run -model codex/gpt-5.6-solworks with an empty config, and withclaudelogged in,-model claude-code/sonnetdoes. Aprovidersentry of the same name replaces the native one as a whole.Runtime.Modelsand themodeltool list both.harness login codexprints aTry: harness run -model codex/<id>line. ACPinitializealways offers "Log in with ChatGPT", and offers "Log in with Claude Code" whenclaude(or thebinary_pathof an entry) resolves onPATH, soagentCapabilities.authis now always present onharness acp. -
Questions from a model API session (
internal/turn,internal/session,harness) — withOptions.AskUserQuestion, a session of a model API backend (ChatGPT, Anthropic, OpenAI, and OpenAI-compatible) can ask the user a question with the runtime toolask_user_question, as Claude Code does withAskUserQuestion. The input is the input ofAskUserQuestion, and the request has the kindquestionwith that input as its payload. The tool is offered to a root session with no active goal, andAllowedToolsapplies to it by name. A call ends the turnawaiting_inputand the session readswaiting. An answer starts a turn whose first step records the answers as the result of the call, and a dismissal gives the usual error result. Thetool.execute.beforeandtool.execute.afterhooks run on the call. The input matchesAskUserQuestion: an option may carry apreview, question texts and option labels must be unique, andmetadata,answers, andannotationsare accepted and ignored. In an ACP form each question with options also has an optionalquestion_N_othertext property, whose text is the answer; this holds for Claude Code too, and the option properties are no longer required. A preview shows in the description of its option. TheACP elicitationand the flagharness serve -ask-user-questioncover every backend. -
Claude Code runs on Harness tools (
internal/backend/claudecode,harness,internal/acp) — a Claude Code session gets no built-in tool of the CLI that acts on the machine or the network.--toolslistsAskUserQuestionalone, on a run that may ask a question, and--strict-mcp-configalways applies. With aWorkDir, the session getsread_file,write_file,edit_file,glob,grep,ls,bash, andsession_infothrough the harness-hosted MCP endpoint, besidetask,process,model, andget_conversation_history. Each call runs throughRequest.Call, sotool.execute.beforeandtool.execute.afterhooks see it, andAllowedToolsnames these tools. A result over the retention threshold reaches the CLI as a preview with a handle, andread_tool_resultreads the rest. The log records the calls under the harness names, and ACP shows their tool kinds. An embedder tool with the name of a built-in tool of theWorkDirnow follows the same rule for Claude Code as for the other backends:CreateandOpenfail withinvalid_requestwhenAllowedToolsis nil, so a persisted Claude Code session with such a tool failsOpenuntil it lists its allowed tools. The turn fails when the CLI lists or calls a built-in tool other than an allowedAskUserQuestion. The adapter no longer passes--forward-subagent-text, because the CLI has no subagent tool. A profiletoolslist reads the Claude Code namesRead,Write,Edit,MultiEdit,Glob,Grep,LS, andBashas the matching harness tools. Calls of one key through the tool bridge run one at a time. An image that a bridgeread_filereturns is stored with the tool result in the log. The built-in agent profiles and the ACP kind table no longer name the toolsRead,Glob,Grep,Edit,Bash,WebFetch, andTodoWriteof the CLI. -
ACP elicitation for questions (
internal/acp,internal/acp/rpc,internal/acp/cwdruntimes) — a client with the capabilityelicitation.formgetselicitation/createfor a question of a Claude Code session.harness acpsetsOptions.AskUserQuestionfor such a client only, so the session can ask. When the turn endsawaiting_input, the agent answers the prompt withend_turnand then sends a form with one property for each question.acceptresolves the request with the answers, and starts the next turn;declineandcanceldismiss it. An input that dismisses the request,session/close, and the end of the input send$/cancel_requestfor the elicitation. A client without the capability sees no change. -
Model list of a provider entry (
config,internal/backend,internal/modelmeta) — aprovidersentry can setmodels, a list of model ids as its API names them.Runtime.Models,GET /models, and the ACPmodeloption then list exactly those ids, in order, for that provider: the way to list the models of anopenai-compatgateway or a local model. A listed id that models.dev knows, also with a routing namespace such asanthropic/claude-sonnet-5-5, has its name, description, and effort levels. Any other id has no name and offers every effort level up tohigh. On an entry withauthchatgpt,modelsreplaces the fetched list. A project file can setmodelson any provider. An empty id or a duplicate id fails the config load. -
ACP
session/listin the wasm Worker (sdk/embed) — the Worker of thewasmtransport passes the work directory of its file system toharnessConnectasdefaultDir, so the module advertisessessionCapabilities.listand answerssession/listwith nocwdover a memory store, the OPFS store, and a Node store directory. Before,session/listthere answered-32601. -
Images and files in ACP prompts (
internal/acp,internal/modelmeta) —harness acpadvertisespromptCapabilitiesimageandembeddedContext, so a client such as Zed can attach an image, a selection, or a file. Animageblock or aresourceblock withblobis an attachment (png, jpeg, gif, webp, and pdf for a resource), checked by the runtime. Aresourceblock withtextis a text part wrapped in<resource uri="…">and</resource>.audio, an attachment of another type, and bad base64 are-32602. Input admission refuses an image for a model that the models.dev facts list without image input withinvalid_requestthat names the model (-32602in ACP, withdata.codekept); an unknown model passes. Animageblock takes only png, jpeg, gif, and webp. -
Plain compaction summary (
protocol,internal/eventlog,internal/backend/claudecode) — thesummaryof acompaction.appliedrecord is the plain summary text. The newindexfield holds the index of the retained tool results, and the compaction banner exists only in the text that the model reads, so the model request does not change. The Claude Code adapter drops the continuation framing of the CLI from the summary. ACP clients and the HTTP readers show the plain summary. A log written before this change shows the banner twice in the model text. -
Host tool with a built-in name (
harness,sdk/embed) — anOptions.Toolstool or page tool namedbash,read_file,write_file,edit_file,glob,grep, orlsno longer failsNew, and so no longer failssession/newwithinternal. In a session whoseAllowedToolsis a list, the host tool replaces the built-in tool, and the model sees one tool of that name with the schema of the host. In a session whoseAllowedToolsis nil, the built-in tool is allowed, andCreateandOpenfail withinvalid_requestthat names the tool. A plugin tool, an MCP tool, and the toolsread_tool_result,session_info,process,task, andmodelkeep their rules. -
Compaction cancel outcome (
protocol,internal/session,internal/acp) — a compaction that an interrupt (Interrupt,Cancel) orCancelForEndstops ends with thestatusframecompaction_canceled, notcompaction_failed. A release,End(), a shutdown, and a lost owner staycompaction_failed. ACP shows it as acompaction_updatewith the statuscancelled. -
Effort levels
xhighandmax(internal/modelref,internal/modelmeta,internal/backend,internal/provider) — an effort can now bexhighormax, abovehigh, in/thinking,PATCH /sessions/{id}, thetasktool, and the ACP effort option. A model offers the levels that models.dev lists for it, and the live Codex model list keepsxhighandmax. A request sends the level that the model lists: an unlisted level becomes the highest listed level below it. An Anthropic model with aneffortcontrol getsoutput_config.effort(with adaptive thinking when it takes no thinking budget), the Responses wire getsreasoning.effort, and the Claude Code backend gets--effort. A model with only a thinking budget, a model with no facts, and everyopenai-compatmodel take at mosthigh. The 4.6 models and Opus 4.5, which have both controls, now sendoutput_config.effortalong with their budget. Adaptive thinking raisesmax_tokensto a floor for the level (10000 to 40000 tokens), and a Bedrock-routed Claude id reads the facts of the model it names./thinkingnames a level that it clamps, for example "max is not offered by anthropic/claude-haiku-4-5; using high". -
Shell tool and file system handle for the browser host (
sdk/embed) —createHarnessreturnsh.fswith the wasm transport in a browser: asyncreadFile,writeFile,readdir,stat,mkdir,rm, andrenameon the file system of the module (/work,/tmp), through the message channel to the Worker. A page tool also gets it asrun(input, {signal, fs}). Under Node and withsubprocess,h.fsisundefined. The new export@majorcontext/harness-embed/shellhasshellTool(), a page tool{command}that runs a just-bash shell overh.fs, mounted at/workand/tmp, with no network, a time limit, a command limit, and clipped output.just-bashis an optional peer dependency (Apache-2.0), loaded at the first call; a page that does not import the export loads nothing extra. -
Live Codex model list (
internal/backend,internal/provider/openai) — a provider withauthchatgptlists the models that the ChatGPT backend serves, in place of the staticcodexlist. The first call ofRuntime.Models(the firstsession/new,session/load, orsession/resume, orGET /models) fetchesGET <base_url>/modelswith the headers of the login, waits at most 3 s, and keeps the result for the life of the process. A model that the backend does not show in its picker is not listed. A failed fetch, a timeout, or an empty list gives the static list and one log line, and the next call after 5 minutes tries again; a missing login, a 401, and a 403 give the static list with no log line until the stored login changes.Runtime.Modelsnow takes acontext.Context.initializenever fetches. -
ACP compaction updates (
internal/acp,protocol) — a client with the capabilitysession.compactiongets a compaction as the entitycompaction_update(in_progress, thencompleted,failed, orcancelled) andcompaction_summary_chunk, live and in the replay ofsession/load, where the summary is a completed entity at its place in the conversation. A client without the capability gets no compaction message, and the replay no longer sends the summary as auser_message_chunk.protocol.Message.IsCompactionSummarytells a summary message from a user message. -
Log in from ACP (
internal/acp,internal/acp/acpauth,cmd/harness) —harness acpadvertisesauthMethodswhen the user config uses a login: "Log in with ChatGPT" for a provider withauthchatgpt, and "Log in with Claude Code" for aclaude-code-cliprovider.authenticateruns the browser sign-in ofharness login codex, orclaude auth loginas a child;$/cancel_requeststops it. A client with theauth.terminalcapability also gets terminal methods that runharness acp login codexorlogin claude-code.agentCapabilities.auth.logoutis{}when the ChatGPT method is offered, andlogoutremoves the ChatGPT login only. A newauthenticatecancels the one in flight, and a sign-in ends after 10 minutes. Asession/newor asession/promptthat needs a missing login answers the ACP error-32000withdata.codelogin_required. A turn that fails with the new error classlogin_required(a rejected ChatGPT refresh token) answers the same. The WebAssembly build offers no login. -
Claude Code login commands (
cmd/harness) —harness login claude-code [--console] [--sso]runsclaude auth login,--statusrunsclaude auth status --text, andharness logout claude-coderunsclaude auth logout, with theclaudeprogram of theclaude-code-clientry. Harness never reads Claude Code credentials.
-
Native API providers require credentials (
config,internal/backend) — Anthropic and OpenAI are absent from the available registry without a non-empty selected key, configured auth, or a non-emptyAuthorizationorx-api-keyheader. A base URL,WithProxyBase, or generic model transport alone is not a credential. Embedders whose transport supplies native auth must setauth: "injected".Create, default model use, and ACPsession/newfail withmodel_unavailablebefore a turn starts; the error names the missing key variable. Model lists, settings, title calls, and goal evaluation use the same registry. An unavailable title provider logsmodel_unavailableand keeps the derived title without failing the caller's request. Harness infers no credential and substitutes no model. Codex and Claude Code discovery remains unchanged; their login checks stay at first use.Newperforms no file I/O. Explicit keyless project providers keep their behavior. -
MCP tool loading defaults to
autowith a byte budget (config,internal/tool/mcpsrc) — an unsetmcp_tool_loadingis nowauto: the tools of the servers stay in the tools array when their schemas fitmcp_schema_bytes(default 65536), and every tool is deferred otherwise.mcp_tool_loading_thresholdis removed. Witheager, the tools past the budget are deferred and the system prompt says so. The tool list in the system prompt stops at 16384 bytes, and anmcpselectresult holds at most 65536 bytes of definitions and names the tools it left out. -
More fields on
turn_metrics(internal/turn,internal/backend/modelapi,internal/provider) — each model call line addsresponse_id,stop_reason,incomplete_reason,provider_input_tokens,provider_output_tokens,provider_cached_tokens,request_bytes,instructions_bytes,tools_bytes,history_bytes,max_output_tokens, anderror_class. A Codex WebSocket call that refuses a chain because oftoolsaddschain_refusal_toolandchain_refusal_tool_part. An incomplete OpenAI response with no usage fails with a message that states the request size. -
Cache-reusing compaction summary (
internal/turn,internal/session) — the summary request of a compaction now sends the instructions, tools, settings, and whole history of the next model call, then one user message that asks for the summary, so a provider reads the cached prefix of the turns instead of the folded history at full price. The compaction still folds only the turns before the kept ones, and the summary now also covers the kept turns. -
Instructions change offset in chain refusals (
openai,internal/turn,internal/backend/modelapi) — aturn_metricsline of a call that did not chain because the instructions changed now haschain_refusal_offset, the byte offset of the first byte that differs, withchain_refusal_previous_lenandchain_refusal_current_len, so an operator can tell a change in the base prompt from a change in a later section. The line never holds the instructions text. -
Deferred MCP tools (
internal/tool/mcpsrc,internal/turn,internal/tool/pluginsrc) —mcp(action="select")now returns the description and input schema of each named deferred tool, and the newmcp(action="call", tool, arguments)runs it, so a deferred tool never joins thetoolsarray and a select no longer breaks the prompt cache of the session. -
Cache routing headers on the ChatGPT login (
openai,backend) — a request that the ChatGPT login authenticates, over HTTP and over the websocket handshake, sends the session key as thesession_idandx-client-request-idheaders, so the backend routes the prompt cache of a session to the same place. A request with no session key sends neither. -
Process status as a pinned notice (
internal/tool/proc,internal/selftool,internal/prompt) — the process status line moves from the system prompt to a notice that the model reads as a pin, so a process start or end no longer changes the system prompt or breaks the provider prompt cache from the first message. -
Compaction inside a running turn (
internal/session,internal/turn,internal/eventlog) — a turn on a backend withoutOwnsContextnow checks the compaction threshold before each model call after the first, and when no earlier turn can fold, the running turn folds its older round trips (an assistant message and its tool results) instead of failing on an overflow. The model keeps the user messages of the folded part after the summary. A summary request that overflows the context window drops its oldest message after the first, with the tool results that answer it, and runs again. -
A box replies to a question, and an answer names who gave it (
protocol,internal/session,internal/turn,internal/eventlog,harness) — an input ofsourcebox(protocol.SourceBox, the reply of the agent of another box) now dismisses an open request as the input of a person does, and starts a turn; before, it waited in the queue until a person answered. The dismissal names thesource_labelof that input, also when the input waited in the queue before the question opened, and ACP sends the same text in thetool_call_updateof the dismissed question.POST /sessions/{id}/requests/{request}andSession.Resolvetakesource,source_id, andsource_labelinprotocol.Resolution, checked as for an input, andrequest.resolvedkeeps them. With asource_label, the result that the model reads names it:<label> has answered your questions: ...and<label> dismissed this question without answering.A resolution of a question may hold aresponse, free text in place of the answers, as in Claude Code: the model readsThe user responded: <text>(or<label> responded: <text>) once, in the result of the question, and the conversation of a reader shows the response as a user message with the provenance of the resolution.GET /healthlists the new capabilityresolution_source; an older harness refuses these fields withinvalid_request. -
ask_user_questionsays to ask with the tool (internal/turn) — the description of the tool no longer says not to use it to ask whether to proceed. It now says to ask with the tool, not in the reply text, when the model needs the answer of the user before it can go on, because a question in the text does not show the user that the session waits. -
Claude Code parent reads a child report in the same turn (
internal/session) — a child report is now asteerinput on every backend. A Claude Code parent with a tool call in flight reads the report at the next tool result, in the turn that runs, as the CLI does for its own finished background task. Before, the report waited in the queue until the turn ended. A report that arrives when no tool call is in flight still waits, and the next turn takes every waiting report with its first input. -
Claude Code loads the file and shell tools upfront (
internal/backend/claudecode) — the harness-hosted MCP endpoint listsbash,read_file,edit_file,write_file,grep,glob, andlswith_meta{"anthropic/alwaysLoad": true}, as it doesask_user_question, so Claude Code does not defer them behindToolSearch. Before, with tool search on, a turn first spent aToolSearchrequest to load them. With the config of a box, the measured turns made noToolSearchcall, and the two read-only prompts sent about 31% fewer input tokens; the context of the run grows by about 0.9k tokens for the loaded schemas. When tool search is on, every other tool stays deferred. -
Go 1.27.4 is the minimum (
go.mod,examples/embed-server/go.mod,Dockerfile,.devcontainer/Dockerfile) — Go 1.27.3 makescrypto/x509reject chains through eight compromised eMudhra intermediates (CVE-2026-111943), and Go 1.27.4 fixesnet/httpGO-2026-6859. The images build withgolang:1.27.4-bookwormpinned by digest.golang.org/x/imagemoves to v0.45.0 for GO-2026-6222 (VP8L decode memory). -
Embed server compresses the module (
examples/embed-server) —GET /harness.wasmnow sends brotli or gzip when the browser accepts it, with anETagandCache-Control: no-cache, in place of the raw module. The server reads the module once at startup, so a rebuilt module needs a restart. -
One-shot model calls on a Claude Code model (
harness,internal/turn,internal/backend/claudecode,docs/architecture.md) — the plugin callclient/generateand any other one-shot model call now accept a model of a backend that owns its loop, so a call can bill a Claude subscription. The CLI runs with onlyToolSearch, no MCP server, no web search, no resumed session, and--no-session-persistence, so the call has no tool and leaves no session. The CLI gets the instructions of the call as its whole system prompt (--system-prompt-file) and runs no hook and reads noCLAUDE.mdfile (--settings), and the text of all messages is one user prompt with no roles;max_tokenshas no effect. The goal evaluator and the title call on a Claude Code model now get their transcript or prompt and their instructions. Atitle_modelon a Claude Code model no longer failsNew. Before, the call failed withmodel claude-code/... runs its own agent loop. -
Claude Code reaches MCP servers through the harness endpoint (
internal/backend/claudecode,internal/turn,docs/architecture.md) — a Claude Code turn with noAllowedToolsno longer givesConfig.MCPServersand the session servers to the CLI in--mcp-config. The CLI gets one MCP server for each harness MCP server, under its own name, and theharnessserver for the other tools, so it sees each MCP tool asmcp__<server>__<tool>.mcp_serversand session servers cannot take the nameharness. The runtime keeps one client for each server, so a tree of sessions starts one server process for each harness process, not one for each CLI. Each MCP call runs throughRequest.Call, so the hooks see it andtool_timeout_sapplies.turn.Capabilities.OwnsMCP,turn.Request.MCPServers, andturn.MCPServerare removed. -
Workspace overflow message (
internal/workspace) — a file list over 32 MiB now failstoo_many_changeswith the messagefile list exceeded its size bound. Before, the message named the time budget. -
Breaking: the workspace seam is engine-neutral (
protocol,internal/workspace,docs/architecture.md) —protocol.RevOpandprotocol.EngineGitare removed, andParseRevrefuses the kindop.head_revis the revision that the working-copy edits are relative to (gitHEAD, jj@-), and it is absent when the work tree has several parents; the diff is then against their automatic merge.patchis a git-format unified diff for every engine. -
Breaking:
parent_call_idremoved (protocol,internal/eventlog,internal/acp,internal/backend/claudecode,plugin) —parent_call_idis no longer a field ofLogMessagein the log, ofMessagein the protocol, or of the messages that ACP replays, andparent_tool_use_idis no longer a field of the plugin message. The field was always empty: a Claude Code session runs with the CLIAgenttool disallowed and starts a subagent as a harness child throughtask, so the CLI sends no frame of a subagent thread. The adapter keeps one thread of output. -
web_fetchthrough an egress proxy (internal/tool/webfetch,harness) —web_fetchtakes the proxy fromhttp.ProxyFromEnvironmentand the process environment, as the other Harness clients do, and sends a request through the proxy that applies to its URL, as the other Harness clients do, so it works behind a credential-injecting egress proxy such as gatekeeper. Before, it ignored these variables and dialed directly, which failed where only the proxy has egress and skipped the egress logging and policy of the proxy. Harness adds no credential; an egress proxy may, so a fetch of a host for which the proxy holds a credential is authenticated by the proxy. With a proxy, the tool still refuses a bad scheme, a user name or password, and a literal non-public IP, and resolves a host name and refuses it when any resolved address is not public (only a not-found answer sends the name on to the proxy; any other lookup failure refuses); an unreachable proxy fails the request with no direct dial; that check is best effort, DNS rebinding protection holds only without a proxy, and the egress policy belongs to the proxy. A proxy that intercepts TLS works when its CA is in the system root pool; there is no option to skip verification. Redirects get the same checks on each hop, and every size and time limit still applies. Without a proxy, the tool dials as before.Options.WebAllowLoopbackbecomes the test seamOptions.WebTest, which also holds a resolver, a proxy, and root CAs. -
Breaking: workspace changes drop deprecated fields (
protocol,internal/workspace,docs/architecture.md) —GET /workspace/changesno longer sendsheadorbase.sha, and the error codenot_a_git_repois gone. A client readshead_revandbase.revfor the revisions, andnot_a_repofor a directory outside a work tree.branchstays, as the optional label of the head. The not_a_repo message reads "is not a work tree of a known VCS". -
Off level for Sonnet 5.5 (
internal/modelmeta,internal/provider/anthropic) —claude-sonnet-5-5now lists theofflevel, so/thinking offand the model picker offer it. Anoffeffort sendsthinking: {"type": "between_tools"}and no effort field, because the model rejectsdisabledand takesbetween_toolsin its place. The model does not think before it answers, and the short updates that it writes between tool calls come back as thinking blocks, which stay in the history. TheoffTypefield of ananthropicThinkingCanBeDisabledentry ininternal/modelmeta/overrides.jsonnames the thinking type.
-
Provider error details (
internal/provider) — a model API error without a recognized error body includes a bounded excerpt of the response body. -
Claude Code CLI login (
internal/backend/claudecode,docs/architecture.md) — the CLI now runs with the harness environment minusANTHROPIC_API_KEYandANTHROPIC_AUTH_TOKEN, in every run, the login probe, andturn.Ask. Before, a key in the harness environment made the CLI bill that key instead of its own login. -
Cached prompt tokens of an OpenAI-compatible model (
internal/provider/openaicompat) — the usage chunk of a chat completions stream carriesprompt_tokens_details.cached_tokens. The adapter now reports it ascache_read_tokens, reportsprompt_tokensminus the cached part asinput_tokens, and fillsprovider_cached_tokensofturn_metrics. A model behind such a gateway (Fireworks, Gemini through Bifrost) reported 0 cache reads before. -
MCP call after a select in the same run (
internal/tool/mcpsrc) —mcp(action="call")of a tool that its server lists now runs it when the tools of the model call lack it. Before, a Claude Code session whosemcp(action="select")read a new tool list gotno such tool availablefrom acallof that tool later in the same run, and so did a harness-loop model call that made both calls. -
Compaction purpose of a Claude Code session (
internal/session) — a compaction of a Claude Code session now logsturn_metricswith purposecompaction, and itschatspan carries the same purpose. It logged purposeturnbefore. -
Cache expiry of an injected-auth ChatGPT entry (
internal/backend) — an entry withauthinjectedandmodels_fromchatgpttargets the ChatGPT Codex backend and now reportscache_expires_atwith the 30-minute lifetime, as an entry withauthchatgptdoes. -
Open object schemas on the Codex lane (
internal/provider/openai) — a free-form object field in a tool schema, one with nopropertiesand noadditionalProperties, now keepsadditionalProperties: true. The deferredmcptool forwards theargumentsof acall; before, the model could send only{}. -
Claude Code compaction usage (
internal/backend/claudecode) — a/compactresult carries zerousageand the call inmodelUsage. The turn now reports themodelUsagetoken counts whenusageis zero. -
Warm-up tools match the first turn (
internal/session,internal/turn) — the Codex websocket warm-up omittedask_user_questionand ignored thechat.paramshook and the native web search flag, so the first turn after a create or wake refused the chain withchain_refusal_detail=tools. The warm-up now builds its request as the first turn call does. -
Chat fixture tail deltas (
harnesstest) —NewChatstreamsReply.Tailafter the first release and honorsTailBlockuntil the tail release, asNewAnthropicdoes. -
Side requests leave the Codex websocket chain alone (
internal/provider/openai,internal/backend/modelapi) — a title, compaction summary, or goal evaluator request of a Codex session now goes over HTTP. Before, it shared the websocket entry of the session, so the next turn request could not chain withprevious_response_idand was sent in full, and a title that ran during the first turn could push that turn to HTTP. -
A model call after
tools/list_changedsees the new list (internal/tool/mcpsrc) — a tool result that carriednotifications/tools/list_changedcould reach the next model call before the actor marked the read of the list as in flight, so that call used the old list and the added-tools notice landed one call late. The wait before a model call now goes through the actor, so it waits for that read. -
Context overflow on the Responses API compacts (
internal/provider/openai) — an HTTP error body or a stream event with the codecontext_length_exceedednow returns a context-overflow error, so a turn on theopenaiorcodexprovider compacts and calls the model again. Before, the turn failed with the raw provider message and never compacted. -
harness servestops cleanly with an idle client connection (cmd/harness) — onSIGINTorSIGTERM, serve closes each HTTP connection that has no request in flight before it waits for the HTTP server. Before, net/http counted a connection that had sent no request as active until it was 5 s old, so one such client held the stop for the whole 5 s budget, and serve exited with status 1 after it wrote ahandoffreport. The exit status now follows the stop: 0 whenRuntime.Closereturned nil andserve-stop.jsonwas written; an HTTP request that does not finish in time is logged. -
MCP fixture address ownership on Linux (
harnesstest) — a closed fixture keeps its address reserved until test cleanup, so stale requests cannot reach another fixture that the OS puts on that port. The listener still closes normally, and a later connect is refused. This removes the fixed-port-range assumption on Linux; other platforms keep their listener behavior. -
Claude Code loads
ask_user_questionupfront (internal/backend/claudecode,internal/backend/external,internal/mcp) — the harness-hosted MCP endpoint listsask_user_questionwith_meta{"anthropic/alwaysLoad": true}, so Claude Code loads its schema at the start of each run and does not defer it behindToolSearch. Before, with tool search on (mcp_tool_loadinglazy, orautowith many MCP tools), the model saw only the name of the tool, never loaded it, and asked its questions in its reply text, so the session readidleand notwaiting.mcp.Toolkeeps the_metaof atools/listentry. -
Tool-call arguments keep the bytes of the model (
protocol,internal/backend/modelapi,harnesstest) — atool_callpart of the log now hasarguments_text, which holds the arguments as the model wrote them when the JSON encoding ofargumentschanges them. Before, the log kept only the encoded form, which drops whitespace and escapes<,>, and&, so a later turn sent{"dir":"."}where the Responses API wrote{"dir": "."}. The request was then no extension of the request before it, and the first Codex websocket call of each turn after a turn with a tool call sent the whole conversation again. TheharnesstestResponses double now writes arguments as the recorded server does. -
Codex chains each model call of a session with a plugin segment (
internal/tool/pluginsrc,internal/turn,internal/backend/modelapi,internal/provider) — thesystem.transformsegments of the plugins are now a pin, as the MCP notices are: a call sends a segment where it changes, and each later call sends it at the same place. Before, each request carried the segments as its last input item, and the next request did not hold that item, so a Codex websocket request never chained withprevious_response_idand sent the whole conversation again on each model call (for example, a task child with 2453 input items sent all of them on each call). A segment that does not change is now sent once, a session with a plugin chains each call, a segment that a crashed plugin sent stays at its place, and a compaction keeps only the newest pin of each kind, so a segment that changes on each call does not grow the context past a compaction.provider.Request.Tailandturn.Request.Tailare gone. -
Responses requests send the server ids of output items back (
internal/provider/openai,internal/message,internal/backend/modelapi,harnesstest) — amessageorfunction_callitem of an earlier response now goes back with theidandstatusthat the server gave it, and a message with itsphase, as the Codex CLI does. Thetextandtool_callparts keep them inprovider_data. Before, harness sent these items without them, so a full request (an HTTP request, or a websocket request that could not chain) did not match the prefix that the server had cached from its own output. TheharnesstestResponses double now gives each message and function call anidand astatus, andWireEvent.ItemsWithoutServerIDcounts the output items that a request sends back without one. -
Each MCP server keeps its instructions on Claude Code (
internal/backend/claudecode,internal/tool/mcpsrc,internal/turn) — the harness MCP endpoint now gives the instructions of each MCP server in theinitializereply of that server, and theharnessserver gives only the line about the resource tools. Before, theharnessserver gave the instructions of all servers in one text, and Claude Code cuts the instructions of one server at 4096 UTF-16 code units, so the servers after the cut lost their instructions. The MCP segment of the other backends does not change. -
A cancelled or abandoned
grepstops (internal/tool/builtin,internal/backend/external) —glob,grep, andlsnow stop when the context of the call ends,grepskips named pipes, sockets, and devices,read_file,edit_file, andwrite_filerefuse them, and the tool bridge of an external harness ends a call when the harness cancels its request withnotifications/cancelled(as the Claude Code CLI does on its tool timeout) or drops the connection, so the end of the turn and an interrupt no longer wait for a search that nobody reads. -
No hosted web search for a Responses Lite model (
internal/provider/openai,internal/backend/modelapi) — acodexsession withweb.searchon failed every turn withHosted tool 'web_search' requires authorization and metering that are not supported, because the ChatGPT backend takes no hosted tool for a model that its model list marksuse_responses_lite. Such a model now gets no hosted tool, and its turn runs without search. An entry withmodels_fromchatgptoffers search for no model until its model list is read, and then only for a model that the list names without the flag, soharness runand aserveclient that never lists models get no search on anycodexmodel. -
Claude Code usage limit ends the turn
provider_exhausted(internal/backend/claudecode,internal/provider,internal/provider/openai,protocol) — a Claude Code run that the subscription usage limit refuses (arate_limit_eventwithstatusrejectedand no overage in use, then a failedresult) ends withcauseprovider_exhausted, arecover_hint, and the newturn.endedfieldresets_at(Unix seconds), and the queue waits as after any usage limit. Before, it ended witherror_classunrecovered, and the next queued input ran into the same limit. A Codex error of typeusage_limit_reachedis a usage limit whatever its message, and it fillsresets_atfrom theresets_atof its error body, over HTTP and on the websocket. A transient rate limit keeps its retry rule. -
One model list request when a session opens on an injected catalog entry (
internal/injectedauth,internal/backend) — withauth: "injected"andmodels_from: "chatgpt", the status probe and the fetch of the catalog are the same request. The body of a probe that answers 200 stays for 30 s and the next fetch takes it, sosession/newsends one request, not two. -
A retried model call discards the item that the failed call streamed (
internal/turn) — when a model call streamed text and then failed with a retryable error, the live item never closed on the wire, and a client that removes partial text only onitem.discardedkept it until the turn ended. The loop now sendsitem.discardedwith theitem_idof that item before it calls the model again, as the Claude Code backend does for a reply that the CLI drops. A failed call that streamed no delta sends no frame.harness runprints[re-streaming the reply]at the discard. -
A late subscriber gets the item that streams (
internal/session,internal/acp) — a subscriber ofSession.Events,Turn.Events, or the SSE stream that starts while an item streams now receives theitem.startedframe and theitem.deltaframes of that item sent so far, placed after the durable records up to theirseq, and then every later frame. Before, it missed them, so the ACP client could readusage_updatebeforeagent_message_chunk, because the text came only withitem.completed. The session keeps at most 256 KiB of delta data for the item that streams. -
A retried model call keeps no stale item ID (
internal/turn,internal/session) — when a model call streamed text and then failed with a retryable error, and the retry returned a tool call with no text, the tool call item completed under the ID of the discarded streamed item. It now gets a new ID, so a client never sees anitem.completedwith the ID of an item that never completed. -
A question stays open when machine input arrives (
internal/session,internal/eventlog) — an input that is not from a person (a source other thantyped,command, or none: a child report, a goal input, aparentmessage, or a client source such asgithub,api, orbox) no longer dismisses an open request. The session admits it, keeps it inqueued, starts no turn from it, and stayswaiting. It follows its normal delivery once the request resolves: after an answer, a steer input may join the answer turn and a queue input runs as the next turn; after a dismissal (also a settings change to a model of another provider) it runs at once. An input from a person still dismisses the request first. Before, such an input closed the question, the model read "The user dismissed this question without answering", and the answer of the user failed withrequest_not_pending.input.admittedis now legal while a request is open. A compaction that a person asks for still dismisses the request. -
Claude Code unknown tool name (
internal/backend/claudecode) — a turn no longer fails with "the CLI did not apply the tool restriction: tool bash ran" when the model calls a harness tool by its bare name beforeToolSearchloads it. The CLI refuses an unknown name withNo such tool available: <name>and no.after it, and the guard accepted only the.form that the CLI gives for a disabled built-in tool. The guard accepts both forms and still fails the turn on any other result. -
Claude Code ToolSearch (
internal/backend/claudecode,internal/backend) — the CLI getsToolSearchin--toolsagain, so it defers the schemas of MCP tools and loads one when the model needs it. WithoutToolSearch, the CLI loaded every MCP tool schema on every turn: with 200 large MCP tools,--tools ""wrote 534,841 tokens to the cache and--tools "ToolSearch"wrote 7,167; a box with 861 tools wrote about 600k tokens on each turn instead of about 86k. A run withharness run -model claude-code/haikuand 200 large MCP tools now writes 7,662 tokens to the cache.mcp_tool_loadingsetsENABLE_TOOL_SEARCHof the CLI:eagerisfalse,lazyistrue, andautoor an unset value isauto. The turn does not fail on aToolSearchcall, and its result names the tools that it loaded. -
Empty tool output in Claude Code (
internal/mcp,internal/backend/external) — the hosted MCP endpoint now always writes thetextfield of a text item and thedataandmimeTypefields of an image or audio item, also when they are empty. A tool with no output (mkdir,touch,echo x >> file) made the Claude Code CLI reject the result withMCP server "harness" returned a malformed result that failed schema validation, and the model saw an error for a command that had worked. The fake CLI now checks eachtools/callresult against the MCP schema. -
Resumed Claude Code sessions that hold built-in calls (
internal/backend/claudecode) — the turn no longer fails when the CLI emits atool_usefor a built-in tool such asBashorRead. Under--tools ""the CLI cannot run it and answers with its own refusal (No such tool available: Bash: an error result with that text in atool_use_error, in a frame whosetool_use_resultis a string), so the log records a failed tool call under the CLI name and the model then calls the Harness tool. The turn fails when such a call returns any other result, an error result of a command that ran also, because the CLI then ignored--tools; a changed refusal wording fails closed. An init frame that lists a built-in tool still fails the turn. Before, the first suchtool_usefailed the turn, which broke a session that resumed a history from before--tools "". -
Durable pins (
protocol,internal/session,internal/eventlog,internal/turn) — the first model call that sends a pin (an MCP notice, a skills update, a process status, or a plugin segment) appendspin.recordedwith its text and its place, and a new process rebuilds its pins from the log. A session that a deploy reopens now sends a first request that starts with the bytes of its last request, so the prompt cache survives the restart. Before, each pin went back to the start of the history, and the first request after a restart wrote the whole history to the cache again. A changed pin keeps the old one in place and adds the new text after the history. The engine banner has no record. -
Stable engine banner across processes (
internal/turn,internal/session,internal/eventlog,harness) — the engine banner is[engine: harness <version> · session started <time>], where<time>is thesession.createdtime, and it follows the first message of the history (after a compaction, the history that the compaction left). Its text and place come from the log alone, so a new process (harness run -c, an ACP reload, a wake from hibernation, a restart of the same version, a handoff, or a wasm page load) sends the same prefix as the process before it, and the first model call of that process reads the prompt cache instead of writing the history again. Before, each process pinned the banner after the newest message with its own start time, which changed the prefix after the first message. The banner is the first pin, so an MCP notice at the same place follows it. -
Stable MCP down notice across processes (
internal/session) — a restart of the same version no longer moves the down notice of an MCP server from its place in the prompt to the end of the history, so the prompt cache holds after a restart. The first model call of a process pins the notice after the banner. -
Effort check at create (
harness) —Runtime.CreateandPOST /sessionsrefuse aneffortthat is notoff,minimal,low,medium,high,xhigh, ormaxwithinvalid_request, the same check asSession.Update, and create no session. Before, the session was created with the unknown effort stored. -
Request id reuse in ACP (
internal/acp/rpc) — a request id is free before the answer is written. A client that sends a new request with the same id on receipt of the answer was sometimes refused with-32600"a request with this id is running". -
Off level for Opus 5 (
internal/modelmeta) —claude-opus-5now lists theofflevel, so/thinking offand the model picker offer it, and anoffeffort sendsthinking: {"type": "disabled"}. Before, models.dev listed noofflevel for it, so the picker had nooff, and anoffeffort sent no thinking field, so the model kept its default adaptive thinking. Opus 5 acceptsdisabledat efforthighor below, andoffsends no effort field, so the API defaulthighapplies. The newanthropicThinkingCanBeDisabledtable ininternal/modelmeta/overrides.jsonnames such models. -
Keyless project providers (
config,internal/backend,internal/provider) — a provider that only.harness.jsondefines now reads no API key and sends no key header of its own (theopenaiandopenai-compatadapters), and works against an endpoint that needs no credential, such as a local model. Before, every request failed with the no-key error. A custom user-config provider without a key, auth, or a credential header still fails its first request with the no-key error. A native API-key provider without credentials fails admission withmodel_unavailable, before a turn starts. -
Plain
invalid_requestmessages (protocol,internal/server,internal/acp,internal/modelref) — the message of aninvalid_requesterror, in the HTTP body, the ACP error, and the text of a failed typed command, is only the reason, except that an error with no reason keeps the sentinel text. It no longer starts withharness: invalid request:or holds a package name such asmessage:.errors.Is(err, harness.ErrInvalidRequest)still matches. -
Effort off disables thinking (
internal/provider/anthropic,internal/modelmeta) — anoffeffort on a model that thinks by default and listsoff(Sonnet 5 and Haiku 5.5) sendsthinking: {"type": "disabled"}. Before, it sent no thinking field, and the model still thought. A model with noofflevel is unchanged. -
Thinking blocks of a model that thinks by default (
internal/provider/anthropic,internal/modelmeta) — a request to an Anthropic model that has aneffortcontrol and nobudget_tokenscontrol (for example Haiku 5.5, Sonnet 5, Opus 5.5, and Fable 5.1) keeps the stored thinking blocks in the history when the request omits the thinking field, because the field then runs adaptive thinking. The API binds these thinking blocks to the conversation, and a block that is left out while a later block is kept, or that returns after a request without it, fails the prefix check. Opus 4.7 and 4.8 have thinking off by default, and a request with thinking off leaves the stored blocks out. -
Process start cut by Close (
harness) — aStartProcess,StopProcess, orRestartProcessthat ends with no error afterClosecanceled the runtime fails withErrDraining. A start that waits at the ready gate whileClosekills its process no longer answers 200. -
Send to a child whose report is in flight (
internal/tree) — asendof thetasktool waits for a report of the child that is in flight, from the end of the child turn until its parent records it. Asendin that window used to find the child unsettled, spawn it no more, and lose the report of the second turn. -
Project config provider keys (
config,internal/backend,internal/acp) — a project.harness.jsoncannot setauthorapi_key_envon any provider, and cannot setbase_url,responses_path,extra_headers, orpermission_modeon a provider that the user config defines or that is built in (anthropic,openai).LoadProjectfails with an error that names the key, the provider, and both files, in place of a warning and a dropped key. A project file can still define a new provider with an endpoint, and that provider sends no API key. Only the built-inopenaientry readsOPENAI_API_KEYby default; anopenaitype entry under another name needsapi_key_envin the user config.harness acpsends the load error indata.reasonof thesession/newerror. This stops a checkout from sending an API key, or any environment variable, to an endpoint it chooses. -
Node exit deadlock note (
sdk/embed/README.md) — a Node host of the WebAssembly module sets--no-concurrent-sparkplug, because Node 24 can deadlock inprocess.exitwithout it. No behavior changes. -
Project config trust model (
docs/architecture.md,README.md) — the spec states that a project.harness.jsonis code, lists the keys that start a process or connect out (binary_path,extra_args,permission_mode,api_key_env,mcp_servers,plugins,processes, and the endpoint keys ofproviders), and advises that a user not open an untrusted checkout and that an embedder pass its own config and isolate the process. No behavior changes. -
Proxy base before validation (
config,cmd/harness-wasm,sdk/embed) —proxy.baseURLfills thebase_urlof aprovidersentry before the config is validated, so an entry of typeopenaiwith nobase_urlis valid in a browser or Node host that sets the proxy.config.MergeProjecttakes the proxy base as its last argument.sdk/embed/README.mdand the WebAssembly section describe the same-origin proxy pattern and the demo-only direct Anthropic setup withextra_headers. -
Load answer order (
internal/acp) — the event pump of a session thatsession/loadorsession/resumeopens queues its updates until the answer is sent. A record that the log gains between the read and the open no longer reaches the client before the answer. -
ACP answer order (
internal/acp) — the answer tosession/promptfollows every update of its turn and precedes every update of a later turn, such as a goal turn that starts at once. The event pump holds at the end of the turn until the answer is queued. -
Native model list (
internal/modelmeta) —Runtime.Models,GET /models, themodeltoollist, and the ACP model picker list the chat models of theanthropicandopenaiproviders, as they list thecodexandclaude-codemodels. A dated snapshot id (for exampleclaude-haiku-4-5-20251001) is not listed when its undated alias is in the table. A session can still use a dated id. -
Start after Close (
internal/process) — a start that waits at the ready gate whileRuntime.Closecancels it fails with the canceled context. It never replies with a status, even when the cancel also ended the process. -
Plugin package documentation (
plugin) — the package documentation is a guide: how to write and run a plugin, what each hook does, when each event is sent, the chain order, the failure and deadline rules, and which hooks a backend that runs its own agent loop skips. Runnable examples show a process plugin, an in-process plugin, a plugin tool, and a manifest. Corrected statements:tool.execute.afterreplaces only the result text;ChatParamsResponse.Paramsreplaces all the parameters;Client.ServeURLis empty when the host serves no HTTP API;question.askedis never sent; a process plugin must use the name of its config entry and write logs to standard error. -
Permanent transport errors (
internal/provider) — a transport error that declares itself permanent through aPermanent() boolmethod is not sent again, and the turn does not call the model again. The turn endsfailedwith error classpermanent. Any other transport error keeps both retry layers. -
Goal evaluator failure exit code (
cmd/harness) —harness run -goalexits 1 and printsgoal evaluator failed: <error>when the goal evaluator fails (for example, when its model has no API key), in place ofgoal not achieved after N turn(s)and exit 3. A paused goal after a retryable evaluator error also exits 1. Exit 3 stays for a goal that the evaluator judged not met orimpossible.harness runprintssession: <id>on every exit code when it saved the session.GoalViewgainsverdict, the last verdict of the evaluator.
-
Subprocess transport (
sdk/embed) —createHarness({transport: subprocess({command, args, env, cwd}), config, store, log})spawnsharness acpunder Node and gives the samestreamof ACP messages and the sameclose()as thewasmtransport.configgoes to the process as a temporary file named by the newHARNESS_CONFIG_FILE, which changes the file thatcmd/harnessreads and leaves the default place of the Codex login and the plugin cache at$HARNESS_CONFIGor~/.harness; the project config still merges over it; andstore.dirasHARNESS_SESSION_DIR. The process keeps its own tool set, withbashandprocess, so the default tool set ofwasmdoes not apply. Stdout carries ACP frames only: a line that is no frame ends the stream with an error and stops the process. Each line of stderr goes tolog.close()ends the input of the process and waitscloseTimeout(default 5 s), then sendsSIGTERM, thenSIGKILL; it rejects when the process exits with a status other than 0, dies from a signal, or needed a signal. A process that exits on its own ends the stream with its exit status. A command that cannot start rejectscreateHarness.tools,builtinTools,proxy, andfetchrejectcreateHarnesswith the name of the option, because the binary has no way to honor them. The client API tests run over both transports. -
Default tool set of an embedded host (
sdk/embed) — whencreateHarnessgets nobuiltinToolsof its own, it allowsread_file,write_file,edit_file,ls,glob,grep,read_tool_result,session_info, and the names of the page tools, so the model of a browser or Node host is never offeredbashorprocess, which cannot run there.defaultBuiltinToolsexports the list; a host liststask,model, orgoalinbuiltinToolsto enable it, and a list it passes is used as it is. -
Browser store (
sdk/embed) — a browser Worker has a real file system: memory for/workand the origin private file system (OPFS) for the persistent store, whichsdk/embedimplements over sync access handles with no dependency.createHarness({store: {persist: true}})keeps the sessions below/persist/sessions;fsyncisflush(), so a record thatAppendacknowledged survives the end of the Worker and a reload. One page of the origin holds the store through a Web Lock that it takes before any file opens; a second page rejects with the codestore_in_use.store.dirin a browser must lie below/persistwith no.or..segment. Under Node, two processes that find one stale.embed.lockno longer both replace it. -
ChatGPT subscription login (
cmd/harness,internal/codexauth,config,harnesstest) —harness login codexsigns in with the Codex OAuth client: the browser flow with PKCE onlocalhost:1455, or--devicefor the device code flow.--statusprints the account, the expiry, and whether a refresh token exists, andharness logout codexdeletes the login. The login isauth/codex.jsonbeside the user config (mode 0600, directory 0700, written by rename under a lock), and Harness never touches~/.codex. A provider entry withauth: "chatgpt"(valid on an entry that builds the Responses adapter, not withapi_key_env) reads the login at its first request and sendsAuthorization,ChatGPT-Account-ID, andoriginator: harnessonly to its own Responses URL, over HTTP and the websocket. A token that ends within 5 minutes, or a 401, refreshes once for all concurrent requests, keeps an unrotated refresh token, and writes the file back. A missing login or a rejected refresh fails the turn with the permanent errornot logged in to Codex; run `harness login codex`. The user config keyscodex_auth_fileandcodex_issuername the file and the issuer. A refresh runs on its own context, keeps its answer in memory when the file cannot be written, and backs off after a transient failure. The client follows no redirect and reads noOPENAI_API_KEY.auth, andbase_urlandresponses_pathof an entry that sets it, are user-only. The login file must not be readable by others.harnesstestgainsCodexIssuer, a scripted OAuth issuer, andOpenAIOptions.Credentials,AccountID, andOnReject. -
Embedded harness client (
sdk/embed) —createHarness({transport: wasm({module, wasmExec, worker: true}), config, proxy, fetch, tools, builtinTools, store, log})starts the WebAssembly module in a browser Worker or a Node worker thread and returns an ACP{readable, writable}stream. A tool call of the module runs therunfunction of the page tool, and a cancel aborts its signal. A pagefetchcarries the model requests over a bridge that streams the response and passes aborts.harnessConnect({proxy: {baseURL}})routes model traffic to a proxy but supplies no credential: native API-key entries need explicitauth: "injected"when the proxy adds auth. It setsbase_urlof the nativeanthropicandopenaiproviders and of each provider entry that sets none.proxy.headersgo only on requests to the origin ofproxy.baseURL. A cancel of the stream, an abort of the writer, or a failed Worker closes the harness and releases the store directory. Under Node,store.diris a directory that one process holds.sdk/AGENTS.mdnow bindssdk/typescriptonly, and the spec callssdk/typescriptthe plugin SDK. -
WebAssembly ACP connection (
cmd/harness-wasm,internal/jshost,config,internal/acp/cwdruntimes) — the module exportsharnessConnect({config, storeDir, env, tools, builtinTools, proxy, onFrame, onLog}), which opens one ACP connection and returns{send, close}.sendqueues one frame and never blocks the event loop;closeends the input and returns a promise that settles when the sessions are released. The module calls the globalfetchthrough aRoundTripperwhose abort stays tied to the request context until the body closes, so a cancel ends a stream that has begun. A fetch that gets no response ends the turnpermanentafter one attempt whilenavigator.onLineis true, and its error names the JavaScript error. Thetoolsoption adds JavaScript tools.cmd/harness-wasm/node/host.mjsruns the module under Node on stdio, on aDiskStorein a directory that one process holds through.embed.lock, and CI runs the ACP scenario table on it.config.Parseandconfig.MergeProjecttake a config that the caller holds, andcwdruntimes.OptionstakesModelTransportandTools. The size budget rises to 20,950,000 bytes raw and 5,200,000 bytes gzip. -
WebAssembly build (
cmd/harness-wasm,internal/wasmsize) — the runtime builds forGOOS=js GOARCH=wasm, andcmd/harness-wasmis the module entry. The Codex websocket dial is split by build tag, because a browserWebSocketcannot set request headers; on js the request goes over HTTP. CI runsgo run ./internal/wasmsize, which builds the module and fails when its raw orgzip -9size is abovetestdata/wasm-size-budget.txt. -
Session MCP servers (
harness) —CreateandOpentakeSessionOptionvalues.WithSessionMCPgives one session MCP servers besideConfig.MCPServers: the runtime connects them at the first model call, retries and parks a failed server like a runtime server, and stops every stdio server atRelease,End, andClose. Nothing persists, so anOpenwithout the option has no session server. No protocol field or HTTP route carries the option, and the secrets in the specs stay out of the log. -
ACP load, resume, list, and close (
internal/acp,cmd/harness) —harness acpanswerssession/load,session/resume,session/list, andsession/close, andinitializeadvertisesloadSessionand thelist,resume, andclosesession capabilities.session/loadreads one view of the session, sends its conversation asuser_message_chunk,agent_message_chunk,agent_thought_chunk,tool_call, andtool_call_updateupdates, and opens the session; the event pump then starts at the end of the replay, so a record that arrives between the replay and the open reaches the client once.session/resumeopens the session with no replay.session/listlists the root sessions of the store by creation order, with an optionalcwdfilter and a cursor.session/closecancels the prompts of a session assession/canceldoes and releases it; the log stays. A session whose log names another work directory than thecwdis-32602.session/deleteis not advertised, and thetitleof a listed session is null. -
ACP config options, commands, and usage (
internal/acp) —session/newanswers themodelandeffortconfig options, andsession/set_config_optionchanges them and answers the complete list. A change of the model or the effort, also one from/model,/thinking, or themodeltool, sends aconfig_option_update. After the answer tosession/new, the agent sends anavailable_commands_updatewith the commands that a typed line can run. A prompt that is one text block starting with/runs the slash command, and its status text is anagent_message_chunk. The agent sendsusage_updatewhen the context size or the cost changes, and asession_info_updateafter each turn. A client that sends the capabilitysession.noticesgets anoticewhen another owner takes a session. -
ACP tool calls (
internal/acp) —harness acpreports each tool call of the model as atool_callupdate and its result as atool_call_update. A call has akind(read,edit,search,execute,fetch,think, orother) from its tool name,locationswith the absolute path (and theoffsetofread_fileas the line) for the file tools, and adiffforedit_fileandwrite_file. The update iscompletedorfailed, carries the result text asrawOutput, and sends each image of the result as animagecontent item. A call that a cancel cut short endsfailedbefore the prompt answerscancelled. -
ACP sessions and prompts (
cmd/harness,internal/acp) —harness acpanswerssession/new,session/prompt, andsession/cancel. It builds one runtime for eachcwdthat asession/newnames, with the project config of thatcwd, over one session store and one owner, and it reads no config before the firstsession/new. ThemcpServersofsession/newbecome MCP servers of that session only, andinitializenow advertisesmcpCapabilities.http. A prompt takestextandresource_linkblocks and streams the text and the reasoning of the model asagent_message_chunkandagent_thought_chunkupdates, also for a turn that no prompt started, such as a goal turn. The stop reasons areend_turnandcancelled; a failed turn is-32603with the error class, and a session that another process took is-32603withdata.codesession_not_owned.$/cancel_requestfor a prompt interrupts its turn and answers-32800. At the end of the input the agent releases its sessions first, so a running prompt ends at once. -
ACP initialize (
cmd/harness,internal/acp) —harness acpserves Agent Client Protocol version 1 over stdin and stdout, newline-delimited JSON-RPC 2.0. It answersinitializewith the agent info, the agent capabilities, and an emptyauthMethods, and answers version 1 for any client version. It advertises no prompt capabilities yet. SIGINT and SIGTERM end it with status 0. A line that is not JSON gets-32700and the connection stays open; an unknown method gets-32601;$/cancel_requestcancels the named request. stdout holds ACP messages only and logs go to stderr. Every other ACP method answers-32601until it is built. -
Engine-neutral revisions (
protocol,internal/workspace) —protocol.Rev(Kind,ID) names a revision or a change, and its text and JSON form is<kind>:<id>with the kindsbranch,tag,commit, andchange.ParseRevparses it.GET /workspace/changesaddsengine(git),head_rev, andbase.rev;head_revandbase.revarecommitrevisions and are absent when the head has no commit or the scope has no base.headandbase.shakeep their values and are deprecated.protocol.CodeNotARepo(not_a_repo, 409) joins the error codes as the engine-neutral name ofnot_a_git_repo. -
Blocked goal (
protocol,harness) — a new goal stateblockedmarks anactivegoal that nothing drives: no run, no open turn, no queued input that starts, and no turn left to judge. One check moves such a goal toblockedwith reasonno_driveratOpen, after each run settles, afterSetGoalon a held queue, after a dismissed request, and after a cancel of an idle session. The check starts no turn and calls no model. Any input,SetGoal, orAdjustGoalmakes the goalactiveagain. A blocked goal does not make a session resumable, so a host can let the session sleep. -
Plugin failure log line (
harness) — a plugin hook that fails open writes oneplugin: hook failedWarn line through the runtime logger, with the plugin name, the hook, and the error text with secrets masked. -
Guardrail example (
examples/guardrail) — oneplugin.Pluginvalue that denies a force push,rm -rfon a broad target, and aread_filecall on a.envfile.go run ./examples/guardrailruns it in the host process, andexamples/guardrail/cmd/guardrail-pluginserves it as a plugin process. -
TypeScript plugin SDK flags (
sdk/typescript) —createPlugintakesdenyOnFailure: ['toolExecuteBefore']andhookTimeouts: { <hookKey>: ms }, and writesdeny_on_failureandhook_timeoutsto the manifest. It throws for a value the host would reject. -
Hook timeouts (
plugin,internal/plugin) — a plugin manifest can set the dispatch deadline of each synchronous hook in the new optional fieldhook_timeouts, a map from hook name to milliseconds. A hook with no entry keeps 5 s. A value must be from 1 to 600000, the hook must be inhooks, andeventhas no entry; any other value fails the firstCreateorOpen, andharness.Newfor an in-process plugin. The spawn comparison of the live and cached manifests includes the field. In Go,plugin.Plugin.HookTimeoutstakes atime.Durationfor each hook. -
In-process plugins (
harness) —Options.Pluginstakes*plugin.Pluginvalues that run in the host process, through the same host code as a process plugin, so the chain order, the deadline, anddeny_on_failureare the same. They run after the config plugins, in list order.Newfails on an invalid plugin, a repeated plugin name, and a plugin tool that takes the name of another tool, andRuntime.Closewaits for the plugin calls that are running. -
Go plugin package (
plugin) —github.com/majorcontext/harness/pluginis the public Go API for plugins. Aplugin.Pluginvalue holds the hooks and tools,Manifestderives the manifest from the fields that are set, andToolBefore.DenyOnFailuresets thedeny_on_failureflag.plugin.Serveruns the value as a plugin process on standard input and output, andplugin.ServeConnserves it over any stream. A hook or tool that panics gets an error response, and the connection stays up.plugin.Clientoffers the workspace directory, config block, HTTP headers, anhttp.Clientthat adds those headers, the harness version,SessionMessages,MCPCall, andGenerate, andPluginhas aChatMessagefield that the runtime does not dispatch. The context of a hook other thanEventends at the host deadline of that hook (itsHookTimeoutsvalue, or 5 s), so a timed-out hook, and aGeneratecall that it made, stop; the context of a tool call and ofEventends with the connection. A hook that returns no params or message leaves the params or message of the earlier plugins as they are. The public types use a model reference as a string andplugin.Partfor message content, and the wire JSON is unchanged. -
Deny on failure (
internal/plugin) — a plugin manifest can listtool.execute.beforein the new optional fielddeny_on_failure. When that hook fails (the plugin does not start, exits, passes the deadline, returns an error, or sends an undecodable response), the host denies the tool call withdenied: plugin <name> failed: <error>in place of a fail-open skip. A canceled context is an abort and records no deny. Any other hook in the field fails the firstCreateorOpen, andharness.Newfor an in-process plugin. At spawn the host now compares the full live manifest (hooks,deny_on_failure, tools) with the cached one, and a difference is a start failure that denies a hook that either manifest flags. The plugin manifest cache file now carries aversion; a file of another version is discarded and every plugin probes again. -
Plugin MCP and model calls (
internal/plugin,plugin) — the host servesclient/mcp.callandclient/generate.mcp.callcalls a tool of any server inmcp_serversand returns{content, is_error}; an unknown server fails the call, and so does a server that is retrying or parked, at once and with its reason.generatemakes one model request with no tools through the provider layer, resolves an emptymodelto the default and an alias to its model, and returns{message, usage}; the response gains the optionalusagefield.plugin.Client.MCPCallreturns a*plugin.MCPCallResult, andplugin.Client.Generatereturns a*plugin.GenerateResponsewithMessageandUsage. A negativemax_tokensingeneratefails the call before any model request. A plugin tool can returnblobparts: one with inline data reaches the model as a result blob, one with only a URL becomes a text line, and a part of another type fails the call. On success the host logs one line for eachgeneratecall. -
Merged plugins (
config) — thepluginsarrays of the user and project config files join, project plugins first and user plugins last, so the most trusted plugins run last. A project config no longer replaces the user plugins. A plugin name in both files failsLoadProjectwith an error that names the plugin and both files. -
Turn handle (
harness) —Session.Promptadmits an input and returns a*Turn, and replacesSession.Submit.Turn.Eventsyields the events from the admission through the end of the turn that took the input,Turn.Waitreturns aTurnResultwith the stop reason, cause, masked error, usage, command status, andWithdrawn,Turn.Steersends a steer input to the running turn, andTurn.Cancelwithdraws a queued input or interrupts its turn.Session.Turn(receipt)returns theTurnof an earlier receipt. ATurnis a view over the log, so it adds no event kind and no goroutine. -
Root split (
harness,harness/store,harness/httpapi,harness/httpsync) — the root package keepsRuntime,Session,Turn,View,Reader, and theStore,Owner,Sync, andToolinterfaces.DiskStore,MemStore,CheckName, andCheckRecordsmove tostore.Runtime.Handlerbecomeshttpapi.Handler(rt)andharness.ReadHandlerbecomeshttpapi.ReadHandler, withReadOptionsandQueue.NewHTTPSyncbecomeshttpsync.NewandApplySyncmoves tohttpsync. The handler uses only exported methods, soRuntimegainsHealth,WorkDir,WorkspaceChanges,Logger,Processes,ProcessLogs,StartProcess,StopProcess,RestartProcess, andErrProcessNotFound.OpenViewfails withErrInvalidRequestfor a name that aStoremust refuse. -
Progress and Advance (
harness,protocol) —protocol.Progressis the status, running turn, queued input IDs, open request IDs, goal, and last turn that a log folds to at a seq, as plain JSON that a reader stores with its cursor.harness.Advance(p, event)folds one durable event into it. It is the one incremental fold:State.Applycomputes these fields with it, soDescribeand a storedProgressagree, and a reader resumes after a stored seq in place of a replay. An event out of order fails withprotocol.ErrSeq, and an ephemeral frame or an unknown kind withprotocol.ErrUnknownKind.protocol.DurablePayloadslists the payload types. -
Event schema in protocol (
protocol) — the 23 durable event payloads (protocol.SessionCreatedtoprotocol.ToolResultRetained),protocol.Kind*,protocol.EnvelopeVersion,protocol.Payload, andprotocol.Event.Payloadreplace the schema ininternal/eventlog, so an embedder decodes a record with the types that the OpenAPI and TypeScript contract now hold. The contract lists the values of each closed enum. The JSON of every record is unchanged. -
session_sync removed (
config,protocol,harness) — the config keysession_sync,protocol.Health.SessionSync, and thesession_sync=<mode>clause of the engine banner are gone, because no store implements the claimed durability mode.Loadrejects asession_synckey as unknown, so a writer of the config drops it with this change. The banner is[engine: harness <version> · engine started <time>]. -
Tool identity (
harness) —Tool.Runtakes aharness.Callthat adds the calling session, the root of its session tree, and the turn to the call.AloneToolandKeyedToolare exported, so a compile-time check proves the method set.Runmust return when its context ends. -
Read surface (
harness) —Readeris the read interface of*Sessionand*View:Snapshot,Messages,Inputs,Blob, andEvents.Runtime.Readreturns the runningSessionof an ID or aViewof its stored log, and acquires nothing.Session.Withdrawis public.Session.ViewandView.SessionareSnapshot, andBlobis the attachment type. The HTTP handlers map exported methods only. -
Getenv, Logger, and ReadOptions (
harness) —Options.Getenvreads the provider API-key variables, and a nil value reads none, so an embedded runtime picks up no key from its process.Options.Loggerreceives every log line of the runtime, and nil isslog.Default().ReadHandler(store, opts)takesReadOptions{Queue, Logger}, and both handlers log the cause of each error that they mask asinternal.Runtime.Commandstakes a context.cmd/harnesspassesos.Getenvand its logger. -
Error contract (
harness,protocol) — each sentinel error is a*protocol.Error, andError.Ismatches an error with the same code, so an error decoded from a body matches the sentinel of its code.protocol.Codetypes the codes,protocol.CodeOfandprotocol.HTTPStatusreplace the status table ofinternal/server, andErrUnreplayablewith the codesession_unreplayable(status 500) reports a log that does not replay.harness.Newreturns a plain wrapped error for a badOptionsin place ofErrInvalidRequest. -
Owner contract (
harness) —ErrSessionHeld, which wrapsErrSessionNotOwned, is the error thatOwner.Acquirereturns for a held session, andCatchUpskips such a session.Ownership.Releasetakes a context and returns an error, whichSession.ReleaseandRuntime.Closereturn. A nilLostmeans never lost.NewLocalOwner(epoch)andNewHTTPSync(spec)are exported.harness.Newno longer reads the config keysowner_epochandsync, and no longer refuses anOwnerorSyncbeside them;cmd/harnesswires them.Options.RunTokenwithoutOptions.ServeURLfails with a plain error. -
Close (
harness) —Runtime.Closeis idempotent: a later call returns the result of the first, and each call returns by the end of its context withcontext.Cause, also when the context ends during model, plugin, or MCP teardown. When the context of the first call ends, it cancels every run and kills the processes without waiting for a tool that ignores its context; that session keeps its ownership until the tool returns. -
Session lifetime (
harness) —Session.ID,Session.Done, andSession.Errtell every holder of a shared handle when and why the session stopped here.Erris nil beforeDoneand then matchesErrSessionNotOwnedand one cause:ErrSessionReleased,ErrSessionEnded, orErrOwnershipLost; a Store failure or a Sync rejection that stops the session matchesErrSessionNotOwnedand that error instead.Openreturns the same handle until itsDonecloses.Session.Eventsends withErr. -
Sessions (
harness) — sessions are append-only logs of canonical messages. A session can change provider or model between turns with no history migration. Persisted sessions resume by ID. -
Providers (
internal/provider/...) — Anthropic Messages, OpenAI Responses, any OpenAI-compatible chat-completions endpoint (OpenRouter, Ollama, vLLM), and delegated turns through the Claude Code CLI. -
CLI (
cmd/harness) —harness runfor one-shot prompts,-goalfor evaluator-checked goals,harness servefor the HTTP+SSE session API, andharness sessionsto list saved sessions. -
Tools — built-in file and shell tools, custom Go tools through
Options.Tools, subagents through thetasktool, and managed long-running processes (process). -
Plugins (
internal/plugin,sdk/typescript) — a language-neutral process protocol with a published TypeScript SDK. -
MCP (
internal/mcp) — an MCP client with deferred tool loading, and a Streamable HTTP MCP server (mcp.Registry).mcp.CallMetagives a tool handler the_metaobject of itstools/callrequest. -
Context management — automatic and manual compaction, project
AGENTS.mdinstructions, and Agent Skills (internal/skill). -
Context-window refresh (
internal/modelmeta) —go generaterewrites the context-window tables from models.dev, and a daily workflow opens a pull request when they change. A new point release is recognized without a hand edit. Session creation still makes no network call. -
Test model server (
harnesstest) — a scripted model server for tests in other modules.NewAnthropicspeaks the Anthropic Messages wire;NewChatspeaks the OpenAI chat-completions wire, withReply.ReasoningandReply.ErrorCode, and fails the test on a request that a real gateway rejects. The Anthropic double also fails the test on atool_resultblock that does not follow itstool_useor that repeats one, andRequest.CacheBreakpointslists thecache_controlmarkers of an Anthropic request. Steps match requests in declaration order,Blocksteps wait forRelease,AwaitCanceledobserves a client that dropped a blocked request, replies can carry an error message and aRetry-Afterheader, and the server fails the test on an unmatched request or a step that never matched. -
Session runtime core (
harness,protocol) —harness.Newreturns aRuntimethat runs each session as one actor goroutine over aStore.Create,Open,List, andClosemanage sessions;SessionhasView,Submit(idempotent by client input ID),Interrupt,Events(durable events after a seq, then live ones), andRelease. AnOwnergrants each session;Openappendsowner.acquiredto fence earlier owners, ends a crashed turn and starts the next queued input on the sameOpen, and resumes a turn that a handoff suspended.OpenViewreads a session without owning it.DiskStorefences each append with aflockof the session log, so a staleDiskStoreinstance on the same root, in any process, getsErrConflict.storetest.RunInstancestakes an opener of instances over one storage and checks that fence across instances. ADiskStorereader takes a shared lock, so it never scans bytes that a failed append cuts again, and a wait for a lock ends with the context of the call. ADiskStorekeeps a sparse index of line offsets in memory and reads from the nearest indexed line, so a tailReaddoes not scan the log from its first line. -
Session replication (
harness,protocol) —Options.Syncreceives every record that aRuntimeappends, in seq order, as aprotocol.SyncBatch. A batch carries the blob of eachbackend.staterecord in it. A failed delivery resends the same batch; aSyncAckbelow the batch makes the sender resend fromHead+1out of itsStore.ErrStaleEpoch, or anErrConflictfor records that differ from the receiver's, stops the session without another append and releases its ownership;Session.Releasereturns theErrConflictrejection.Session.ReleaseandRuntime.Closereturn after the last record is acknowledged, andSession.ViewreportsSyncedSeq.ApplySyncimplements the receiver rules over anyStorefor an embedder. -
Events after a cursor (
harness) —harness.ReadEvents(ctx, store, id, after)yields the stored events after a seq, through the head it reads first, with no ownership, no append, and no replay. On a log that replays it equalsView.Events. A record whose envelope seq differs from its store seq ends the sequence withErrSeq. -
Sync from a box (
harness,config) — the config keysowner_epochandsync {url, token_file}makeharness.Newgrant each session at that epoch and post everyprotocol.SyncBatchtosync.urlwith the bearer token that it reads fromtoken_file. The receiver contract maps409 stale_epochtoErrStaleEpoch,409 sync_conflicttoErrConflict,400 invalid_requesttoErrInvalidRequest, and any413,401, and403toErrSyncRejected; each ends the session, and a5xxor transport error resends. A batch stays underprotocol.MaxSyncBatchBytes(32 MiB), andprotocol.CodeStaleEpochandprotocol.CodeSyncConflictname the two409codes.Runtime.CatchUpreplicates every stored session without opening it:Openof a session that it holds ends its catch-up,Closeends it withErrDraining, and an unreadable session is skipped and reported.Options.ServeURLandOptions.RunTokengive a pluginserve_urlandrun_token. -
Mid-turn delivery (
harness,protocol) — an input with nodeliveryissteer: a prompt sent while a turn runs joins that turn at its next item boundary, on a model API backend and on Claude Code. A child report joins a running parent the same way on a model API backend, and the model reads it in the[tasks: …]segment of the engine, and not under theOPERATOR MESSAGESheading. The segment is pinned: the model reads it at the same place in each later model call, and no history that a reader sees holds it. A compaction moves a segment that it keeps to the end of the kept history, as the engine did; it moves a segment that it folds to the end of the history, so a tool call stays with its result; and a restart keeps the segment, which the engine lost. On Claude Code a child report to a busy parent is not injected in the middle of the turn: the next turn that starts reads every waiting report. A turn that a prompt starts reads the reports in the segment after the text of the prompt, after a blank line, as the engine did; a turn that only reports start reads the trigger sentence of the engine and then the segment, so the result of a child reaches the model once. The report of a child has the text of the engine: a failed child reads the classified reason, a child that a usage limit or a rate limit stopped adds the guidance not to spawn a replacement, a crashed child readslost to restart: turn was in flight when the process last stopped, the cause is masked and cut at 500 runes and the recover hint at 120, and a result of at most 4096 bytes stays whole while a larger one shows a 4096-byte preview with aread_tool_resulthandle.turn.endedcarrieserror_class,recover_hint, anderror_detailfor that text. Thestatusandlogactions of thetasktool show the same reason for a failed child. An internal goal input and/compactstayqueue. -
Input provenance (
harness,protocol) —protocol.Inputtakessource_id(at most 128 printable ASCII bytes) andsource_label(valid UTF-8, cut at 256 bytes, with control, bidi, and zero-width characters dropped, as the engine did); a badsource_idisinvalid_requestand leaves no trace, also on a typed slash command. A prompt command keeps thesource_idand takes the typed line assource_label, withsourcecommand.input.admittedrecords both, and a repeat that differs in either isinput_conflict. A user message ofprotocol.MessagePagecarriessource,source_id, andsource_labelof the input that started its turn, also for an input that the runtime admits itself (parent,child,goal,harness). A user message that joined steer inputs carriesoperator_batch, one entry ofid,text,source,source_id, andsource_labelfor each input. -
Message time (
protocol) — a message ofprotocol.MessagePagecarriescreated_at, the envelope time of the record that completed it, as the engine stampedCreatedAt. A reader shows it as the time of a message in history and on a live message. -
Claude Code state chunks (
harness) — a Claude Code session saves its state as a chain ofbackend.staterecords, not as one blob that grows. Each record carries the head (the CLI session ID, turn, parked call, and transcript path). The transcript entries are appended as chunk blobs of whole entries, at most 4 MiB each (an entry over 4 MiB is a chunk of its own), and each chunk has its own record, so aSyncBatchnever carries the whole transcript again and a long session no longer reaches the 32 MiB bound of a batch. A chunk key holds the backend, the fence of the owner, and an index, so a fenced owner never overwrites the chunk of another owner. A save whose entries do not extend the chain, such as a new CLI session, starts a new chain and keeps none of the old entries. A record of the older form (blob_keyalone) still reads, as a chain of one blob, and the next save starts a new chain.turn.Sink.StateandSaveStatetake and return aturn.Snapshotof a head and entries. -
Read-only handler (
harness,protocol) —harness.ReadHandler(store, opts)returns anhttp.HandlerforGET /sessions,GET /sessions/{id},GET /sessions/{id}/inputs,GET /sessions/{id}/messages,GET /sessions/{id}/events(the page, and an SSE stream of the durable events that ends at the head), andGET /sessions/{id}/blobs/{key}. It needs noRuntimeand no owner, appends nothing, and starts no turn. Bodies, limits, paging, SSE ids, and error bodies are those ofRuntime.Handlerfor a session that the runtime does not run; a session lists no plugins. A write answers 405 in the error body.opts.Queueis an optionalharness.Queuewith one method,Queued(ctx, session), for inputs that wait outside the log: its inputs follow the queued inputs of the log inGET /sessions/{id}/inputsand inSession.queued, and a session with no log but with waiting inputs answersGET /sessions/{id}/inputsfrom the queue alone while the other routes answersession_not_found. A queue error fails only the session, session list, and inputs routes. A nilopts.Queuelists the log only.GET /sessions/{id}/blobs/{key}answers the bytes of an attachment with its media type and its recorded size asContent-Length, on both handlers: a blob part ofprotocol.MessagePagecarrieskey, and a key that no blob part of aninput.admittedof the session names (abackend.stateor retained tool result blob included) answers404 blob_not_found. -
Spawn and open (
harness) —Runtime.Createwaits for anOpenof the same ID that is in flight and creates the session when thatOpenfinds none, so anOpenthat races a spawn never fails it withErrSessionExists.harness runopens a task child only after the log of the child holds a record. -
Session agent (
protocol) —Session.agentis the agent profile name that a task child was spawned with.GET /sessionsandGET /sessions/{id}report it. A root session has none. -
Goal pauses (
protocol) —GoalView.pausesis the count of pauses since the last verdict. A verdict resets it to 0. -
Goal retry budget (
harness) — a goal that has paused 6 times since its last verdict (about 31 minutes of backoff) and then fails again on a retryable error or a usage limit ends asfailedwith reasonretries_exhausted, and does not pause again. This restores the retry cap of the engine, which tried 12 times and then parked. The goal stays failed; the session takes any input as usual, and a new goal starts with SetGoal. -
End a session (
harness) —Runtime.EndandDELETE /sessions/{id}stop a session that the runtime runs and release its ownership, with no append. A session with a running turn or control command fails withErrSessionBusy(409session_busy), and its descendants keep running; a running compaction or evaluation that no command started stops, asReleasestops it. A session that is free also stops the turn of each descendant that the runtime runs, and a session that the runtime does not run is not opened for the report of a stopped child. Each such turn ends with causeended; the parent settles that child with no report input. A child that a direct interrupt stops still reportscanceled, and a tree interrupt keeps its rule: it opens the parent and settles with no report input. A session that is busy whenEndstarts keeps each child report. The log stays in the store, andOpenruns the session again. An ID with no log fails withErrSessionNotFound. -
Warm-up (
harness) — a session over the Codex websocket transport opens and warms its connection when it is created or woken, so the first turn chains on the warm response. The first turn waits for a warm-up that is still in flight, and never dials the connection cold. A failed warm-up costs only that speed, and a model that cannot warm costs no tool discovery or hook. -
Codex backend (
harness) —Options.Configconfigures model providers, and theprovider/modelref ofCreateSessionselects one. An empty model isConfig.Model, orconfig.DefaultModel. Atype: openaiprovider runs turns on the OpenAI Responses API, the ChatGPT Codex lane included, over HTTP or the websocket transport.Options.ModelTransportsupplies the HTTP transport of each provider, for each HTTP request and each websocket dial. The transport may supply credentials; native API-key providers then requireauth: "injected"on their entry. A model that no configured provider serves failsCreatewithErrModelUnavailable, and a ref with no provider fails withErrInvalidRequest. A retryable model error runs the turn again with backoff, up tostream_max_retriestimes, when the turn has recorded no item.Runtime.Closecloses the pooled websocket connections, also after a timed-out close. A reasoning item replays with its provider data. The model sees the session history from the newest compaction summary on. -
Model API backends (
harness,harnesstest) — atype: openai-compatprovider, such as Bifrost, and theanthropicprovider with no type runRuntimeturns on the chat-completions and Anthropic Messages wires, through the one backend that also runstype: openai.Options.ModelTransportsupplies the HTTP transport of each, and may supply credentials. A native API-key provider then requiresauth: "injected"on its entry. Each request sends a baseline response cap of 8192 tokens, which a reasoning request can raise. A response with no tool call that the output cap did not cut off ends the turn ascompleted, as in the Codex CLI, and the turn records the items that the response had; a response with no text and no tool call is neither an error nor a retry.harnesstest.Request.MaxTokensreports the cap that a request sends, on each wire. -
Embedder tools (
harness,protocol) —Options.ToolstakesToolvalues that the model can call. After a model call that asks for tools, the turn runs each call in order, records its result, and calls the model again, until a call asks for no tool. A tool error, or a call to a tool that the session does not allow, is an error result that the model sees.CreateSession.AllowedToolsrestricts the tools that the model sees and may call; nil allows every tool. An interrupt stops a running tool, and the call gets an interrupted result. A handoff lets a running tool finish and starts no new tool.ToolCall.IDis the model's call ID. -
Claude Code backend (
harness) — atype: claude-code-cliprovider runs each turn of aRuntimesession as one--resumerun of the Claude Code CLI over stream-json. The CLI runs its own tools and compacts its own context. Its messages are recorded as items, its compaction ascompaction.appliedwithby_backend, and its usage and context window as turn usage andcontext.measured. Theresultframe of each turn gives the context gauge, which is the prompt size of the newest call of the main thread, or the usage of the frame when no call carried usage, and itstotal_cost_usd, which adds tosession_cost_usdofsubscription_usage. A turn whose CLI fails, with an errorresultframe or with no result, runs the CLI once, with nostream_max_retriesrun, and its error keeps its retryable class, so a goal pauses on it. Aresultframe sets the reading also when it carries no prompt tokens; acompact_boundarywith positivepost_tokenssets it until a later main-thread assistant frame reports usage. Asteerinput reaches the CLI on stdin while a tool runs.Session.Interruptand a handoff send SIGINT to the process group of the CLI. Every item that the CLI wrote before it exits is recorded, and a tool call with no result gets an interrupted result, or a cut-off result beforeturn.suspendedon a handoff. A stopped turn whose CLI still writes a success result completes. A stopped turn whose CLI exits with no result ends with the stop, never as a retryable failure. A turn that resumes after a handoff sends a fixed continuation message instead of its input when the resumed CLI session already holds that input. The message says that the previous turn was interrupted, and names no cause. The external session ID is saved inbackend.staterecords, and withsession_mirror: truethe state also holds the transcript that--session-mirrorreports, so a session opened on another runtime resumes it. A mirrored session with no saved transcript starts a new CLI session. Embedder tools reach the CLI through a loopback MCP server namedharnessthat each turn serves while it runs, given to the CLI with--mcp-configand allowed with--allowedTools mcp__harness. A call runsTool.Runwith the CLI tool use ID asToolCall.ID, and a call with no tool use ID is an error result. Items record the call by the embedder tool name. A call that an interrupt or a handoff stops gets no reply, so it gets an interrupted or cut-off result.CreateSession.AllowedToolsnames built-in tools of the CLI and embedder tools. The built-in names map to--toolswith--strict-mcp-config, and the MCP server offers only the allowed embedder tools and the allowed tools ofConfig.MCPServers. An unrestricted session gives each server ofConfig.MCPServersto the CLI in the same--mcp-configfile, by its config name, as the engine does: a stdio server ascommand,args, andenv, an HTTP server astype: http,url, andheaders. The CLI connects them itself, the runtime does not, and--strict-mcp-confighides every other MCP config of the CLI. Any other name failsCreatewithErrInvalidRequest, and so does an embedder tool with the name of a built-in tool of the CLI. An init frame that shows another tool fails the turn. The runtime records a tool call when its frame arrives, so a running tool shows inView.Messagesand the event stream before its result. The parallel calls of one response are separate items in wire order, where the engine grouped them in one journal message. -
Live frames (
harness,protocol) —Session.Eventsalso yields the ephemeral frames of a running turn to a live reader:item.startedanditem.delta(protocol.ItemFrame) for the text and reasoning deltas of the Codex backend, andstatus(protocol.StatusFrame) while a turn waits to retry. The Claude Code backend sends the text and reasoning deltas as the CLI streams them (--include-partial-messages), and the whole block as one delta when the CLI streams none. An item that a failed attempt started never completes, and the next attempt starts a new item. When the Claude Code CLI drops a reply and retries it, the backend sends anitem.discardedframe (protocol.ItemFrame, with theitem_idof the dropped item) before the first delta of the retried reply, and a client removes that live item. The store never holds them. Each frame hasEphemeralset and the last durable seq, and itsitem_idis theitem_idof theitem.completedrecord that ends the item. A reader that resumes after a seq gets the durable events of the gap, then live frames. A slow reader can miss any frame, never a durable event, so the deltas of an item can have holes; itsitem.completedholds the whole item.View.Eventsyields durable events only. -
Compaction status frames (
harness,protocol) — a compaction that runs between turns, automatic or fromCompact, sends an ephemeralstatusframe withcompactingwhen it starts, thenidlewhen the summary is appended orcompaction_failedwhen it is not, as the engine did. The frames carry the compaction ID inturn_id, and the session staysidlewhile the compaction runs. A Claude Code turn sendscompactingwhen the CLI reports that it compacts, thenrunningwhen the summary is appended, orcompaction_failedwhen the CLI reports a failed compact result or ends the turn with the compaction unsettled. -
Model list (
harness,internal/modelmeta,protocol) —Runtime.Modelsreturns the models that the configured providers serve, sorted by ID, each with its provider and context window (0 when the backend reports it during a turn, as Claude Code does). It does no I/O.modelmeta.Modelslists the models of a provider: the ChatGPT subscription models forcodexand the CLI aliases forclaude-code. Other providers list no models. -
Session settings (
harness,protocol) —Session.Updatetakes aprotocol.SettingsPatchthat changes the model, the effort, or the service tier, appendssettings.changedfor the values that differ, and returns the view. A running turn uses the new settings from its next model call. A model that no configured provider serves, or thatmodelmetadoes not know, fails withErrModelUnavailable, and an unknown effort withErrInvalidRequest. A session can move between Responses providers, such ascodexandopenai, and the next provider gets the whole history. A turn that a handoff resumes uses the settings at its resume. A backend that has no service tier ignores it. -
HTTP API (
harness,protocol) —Runtime.Handlerserves the session API over HTTP:POST /sessions,GET /sessions?after=&limit=,GETandPATCH /sessions/{id},POST /sessions/{id}/inputs,POST /sessions/{id}/interrupt,GET /sessions/{id}/events,GET /models, andGET /health. A route that names a session opens it throughRuntime.Open. A new input answers 201 and a repeat of its ID answers 200 with the original receipt;Session.AdmitisSubmitwith that verdict. AnAcceptheader selects SSE only when it liststext/event-streamwith a quality above 0.GET /sessions/{id}/events?after=&limit=returns aprotocol.EventPageof durable events; withAccept: text/event-streamit streams the durable events afterafter, or afterLast-Event-IDwhen it is set, then the live ones with the ephemeral frames between them. A durable frame carries its seq as the SSE id, and an ephemeral frame has no id. An error is aprotocol.ErrorBodywith a code from theprotocol.Codeconstants, mapped from the sentinel errors; an unmapped error isinternalwith a fixed message, and a path or method that no route serves answers 404 or 405 withinvalid_request. A body above 8 MiB fails withpayload_too_large.GET /sessions/{id}/inputsreturns the queued input IDs without opening the session, andDELETE /sessions/{id}/inputs/{input}opens it, withdraws the input when it is still queued, and answers 204 either way. The handler has no authentication; the embedder wraps it. -
Runtime compaction (
harness,protocol) —Session.CompactandPOST /sessions/{id}/compactfold the turns before the newestcompaction_keep_turns(default 2) into a summary that the session model writes with the compaction prompt of the engine, and appendcompaction.appliedwithby_backend: false. The next model call reads the summary first. A session with too few turns appends nothing. A Claude Code session runs/compactas a turn of the CLI, which logscompaction.appliedwithby_backend: true.Session.Compactand the route takekeep_turns, which replacescompaction_keep_turnsfor one call; below 1, or for a Claude Code session, it isinvalid_request.Compactreturns when the compaction ends, and fails withErrSessionBusy(session_busy, 409) while a turn runs or inputs wait. Before a queued input starts a turn, a session whose newestcontext.measuredreading is at or abovecompaction_threshold(default 0.8) of its window compacts first. A failed summary appends nothing, and the turn starts on the full history. A handoff stops a running compaction, and the next owner runs the input that waited for it.Openstarts the next queued input when no turn is open. The Codex backend records the prompt size of each model call that reports prompt tokens, and the model window, ascontext.measured. Acompaction_thresholdorcompaction_keep_turnsat or below 0 is the default. -
System prompt (
harness) —Options.WorkDirnames the directory of a coding agent. Each session reads its system prompt once, when it is created or opened: the base prompt,append_system_prompt, theAGENTS.mdchain from the git root down toWorkDircut atinstructions_max_bytes(default 64 KiB; a negative value keeps the whole file) with a marker, and the skill list. A file that cannot be used is skipped with a WARN log line. With noWorkDir, the prompt isappend_system_promptalone and no file is read. The log never holds the prompt. A Claude Code session getsappend_system_promptas one--append-system-promptvalue, and the CLI runs inWorkDir. -
Processes (
harness) — withOptions.WorkDir, the runtime runsConfig.Processesthrough theprocesstool:start,stop,restart,status,logs,list,declare, andundeclare. Each turn sends a status line inside<harness-engine-context>tags after the system prompt that names each started process, its state, its ports, the instant of its last change, and its log path.Runtime.Closestops every process, also when its ctx ends first. When its ctx ends first,Closecancels the turns and waits for them to end before it returns, as the engineDraindoes. With noWorkDir, no process runs and the model sees noprocesstool.declareruns any argv, so aWorkDirgrants command execution. -
Box routes (
harness,protocol) —Runtime.Handlerserves the process manager of theWorkDir:GET /processes,POST /processes/{name}/start,stop, andrestart, andGET /processes/{name}/logs?tail=. An unknown process isprocess_not_found(404). AfterRuntime.Closestarts, astart,stop, orrestartfails withdraining(503), andClosewaits for one that runs. With aWorkDir,GET /workspace/changes?scope=&dir=returns the git diff of the work tree as aprotocol.WorkspaceChanges, by the rules ofGET /git/changes, with the errorsnot_a_repo,no_base, andtoo_many_changes(409). -
Slash commands (
harness,protocol) —Session.Admitresolves a typed input (source: typed) as a slash command by the rules ofharness serve. A control command recordscommand.recordedwithaccepted, runs through the Go API afterAdmitreturns, and recordssucceeded,failed,refused, orinterrupted; a panic of the operation recordsfailed./compact [keep_turns]passeskeep_turns, and its result is thefrom_seqandto_seqof the compaction, orby_backend: true; bad arguments fail at once, and a frontend command isunsupported. A command that needs an idle session isrefusedwhile a turn runs. The receipt carries the status incommand, and a repeat of the input ID returns it.Openrecordsinterruptedfor a command that an earlier owner never finished. An unknown name is text,//xis/x, and a prompt command undercommands_dirsis its expanded text with sourcecommand.Runtime.CommandsandGET /commandsreturn the menu withserve_support. -
MCP tools (
harness) — aRuntimesession gets the tools ofConfig.MCPServersasmcp__<server>__<tool>. The first model call of a turn that the runtime serves the MCP tools for connects every server once for each runtime; an unrestricted Claude Code turn connects none, because the CLI does. A server that fails stays down until the model callsmcp(action="connect"). Withmcp_tool_loadinglazy, orautowith tool schemas overmcp_schema_bytes, or a servertool_loadingoflazy, the system prompt lists the deferred tools, and the model loads one withmcp(action="select")or finds one withmcp(action="search"). A loaded tool is callable on the next request of the turn, and a call of a deferred tool runs it. The history decides which tools are loaded, so a replay loads the same tools. The instructions of the servers that the first connect reached join the system prompt in<mcp_instructions>. A server that serves resources addslist_mcp_resourcesandread_mcp_resource. An image, audio item, or binary resource of a result is a blob for the model, and an error that is not the server's own RPC error never names the endpoint URL or a response body.Runtime.Closecloses every connection. Withmcp_servers, an embedder tool with an MCP tool name failsNew. The base prompt of aRuntimesession says that the harness appends the process status to the system prompt. -
Model call recovery (
harness) — aRuntimesession recovers from a failed model call by its class. A context overflow compacts the session while the turn runs and calls the model again; when no turn can fold, the turn fails. A provider usage limit, such as a spent quota, ends the turnfailedwith causeprovider_exhausted. A model call that reports no wire activity forstream_idle_timeout_s(default 300; a negative value turns it off) stops and runs again as a retryable error; tool arguments that still stream count as activity. A response cut off atmax_tokensis retried like a truncated stream (see Changed). Any other error fails the turn. A Claude Code session has no stall limit. -
Goals (
harness,protocol) —Session.SetGoalandSession.ClearGoal, andPUTandDELETE /sessions/{id}/goal, run aRuntimesession goal as Claude Code/goaldoes. On a session with no running turn and no queued input, the condition is the input of the first turn, withsource: goal; otherwise the next turn that ends is the first one judged.SetGoalneedsgoal_evaluator_model. After each turn that completes or is interrupted while the goal stays active, that model judges the history; a reply that starts with markdown marks still counts,. The verdict:metachieves the goal,impossiblefails it, andnot_metadmits its guidance as the next input untilmax_turns(0 is unlimited) exhausts the goal. A retryable error or a usage limit pauses the goal, which runs again after a backoff from 30 s to 30 min, or at the next input; any other error fails it. A verdict, a pause, or a failure withdraws the queued goal input.ClearGoalstops a goal turn with causegoal_cleared. An interrupt while the goal is active ends the goal, during a goal turn, a judgment, or a compaction: the goal becomesclearedwith reasoninterrupted, its queued input is withdrawn, and no goal turn starts. The engine left the goal active after an abort, and the runtime has no parked goal. A goal has one retry timer, and any change of the goal stops it.ClearGoalstarts an input that a paused goal left queued.Openjudges the last turn of an active goal and keeps the retry time of a paused goal.protocol.Session.Goalreports the condition, state, judged turns, reason, and retry time. There is no deferred goal. -
Plugins (
harness) — aRuntimesession gets the tools and hooks ofConfig.Plugins. The firstCreateorOpenof a runtime reads the manifest of each plugin with one probe, bounded at 30 s. A probe that fails, a manifest of another name, or a plugin tool with the name of another tool or of a built-in tool of the model backend fails that call, and the next call tries again; a call afterClosereturnsErrDraining. A plugin process starts on its first hook or tool call.tool.execute.beforecan rewrite or deny each tool call, andtool.execute.aftercan rewrite its result, also for a call that a backend that owns the loop makes. Thesystem.transformsegments of each model call, which get the model of the call, follow the MCP segment. Theeventhook getssession.statusandsession.errorfrom the appended turn records,tool.execute.startandtool.execute.endaround each call that runs, andfile.edited, with an absolute path, after awrite_fileoredit_filecall that succeeds.client/session.messagesreads the session from the store, with each attachment as ablobpart and its bytes. The runtime does not dispatchchat.params,chat.message, orshell.env, and failsclient/mcp.call.Runtime.Closestops every plugin process. -
Config rules (
config) —Config.Validateis the one rule set for a hand-built or loadedConfig, and never changes it.Defaultsreturns the built-in value of every defaulted key.Config.ApplyEnvsets each top-level string, number, or bool key from a non-emptyHARNESS_<KEY>variable, and a parse error names the variable but not the value.ProcessSpec.Validateis the process entry rule thatprocess.Declarealso uses. The package imports only the standard library. -
Built-in tools (
harness) — withOptions.WorkDir, eachRuntimesession of the harness loop gets the built-in tools of the engine, with their behavior, limits, and text:read_file,write_file,edit_file,glob,grep,ls,bash, andread_tool_result. An embedder or plugin tool with one of these names fails. Each session has its ownwrite_fileguard.session_infotakes no argument and reports the session, the system prompt and the tools that its newest model call sent, the instructions files and skills that the session read when it started, and the plugin inventory to the model.read_file,edit_file, and thewrite_fileguard fail on a file above 20 MiB. A tool result above 16384 bytes has its secrets masked, goes to a blob, and the history holds a preview with atrh_Nhandle thatread_tool_resultreads back; atool_result.retainedrecord names the blob, andSynccarries the blob. A result that would take the session above 4 MiB of retained results keeps only its preview. The runtime does not readtool_result_inline_bytesortool_result_retained_bytes. Retention runs after the plugin hooks. Each compaction summary ends with an index of the newest retained results.read_filereads an image as a summary line and the image. A backend that owns the loop, such as Claude Code, gets none of these tools. With noWorkDir, a session has none of them exceptsession_info. -
Documentation — package docs on pkg.go.dev and runnable programs in
examples/. -
Children (
harness,config) — with aWorkDir, eachRuntimesession has atasktool,{agent, prompt}, that starts a child session in the background and returns its ID at once. The child is a session withparent_id; its first turn runs the prompt. When a turn of the child ends, the parent recordschild.settledand gets a report input withsource: child: the outcome (done,failed, orcanceled), the error, and the last assistant text of the child. A parent that opens after a crash settles each child that ended and opens each child that did not. Agent profiles load from<workdir>/.agents/*.mdin the agent format of Claude Code (name,description,tools,model, and a prompt body) beside the built-ingeneral-purpose,explore, andplan, and set the allowed tools, model, and prompt of the child.exploreandplanallow only the read-only file tools.max_task_depth(default 3) andmax_concurrent_tasks(default 20) bound each session tree. -
Goal tool (
harness) — withgoal_evaluator_model, eachRuntimesession that is not a child has thegoaltool of the engine:statusreports whether a goal is active and its condition,setstarts a goal with no turn limit and fails while one is active; the condition runs as a turn of its own after the current turn, and the goal judges the turns after it, andadjustreplaces the condition of the active goal and keeps its turn count andmax_turns. A turn of a backend that owns its loop, such as Claude Code, gets nogoaltool. There is noclearaction.goal.setgainsturns. -
Task actions and tree interrupt (
harness,config,protocol) — thetasktool takes the engine actionscancel,status,send, andlogon asession_idthat the caller spawned, directly or transitively;actiondefaults tospawn.sendruns a settled child again, and the child reports the new turn.cancelwithdraws the queued inputs of the target and its descendants and stops their turns.protocol.Interrupt.TreeandPOST /sessions/{id}/interrupt {"tree": true}also withdraw the queued inputs and stop the turn of each descendant, which settlescanceledwith no report input.max_tree_tokens(HARNESS_MAX_TREE_TOKENS; default 0, no limit) stops a spawn once a session tree has used that many tokens. -
Steering for every backend (
harness) — asteerinput, and asendof thetasktool, joins a runningRuntimeturn of a model API backend (Codex, Anthropic, Bifrost) at the next item boundary: after the tool results of a response, before the next model call. The model reads the inputs that join together as oneOPERATOR MESSAGES (address these, then continue the task):message with a numbered list, as the engine writes its injected prompts. A response that ends the turn at itsmax_tokensstop takes no steer input, so that input runs as the next turn. Aqueueinput still waits for the next turn. -
Session telemetry (
harness,protocol) —protocol.Sessionhascontext(tokens,window),last_turn(turn_id,stop_reason,error),compaction_count, andsubscription_usage, the newest subscription limit snapshot of the Codex and Claude Code lanes (provider,plan,windows,overage,captured_at).usagesums every model call of the session, the summary calls included and the goal evaluator calls not, as in the engine. Each model call that measures anything records onecontext.measuredrecord with itsusage, and a summary call addsusageto itscompaction.appliedrecord, so a handoff, a crash, and a restart keep the usage.turn.endedhas nousage. The actor masks and bounds the error text of a failed turn and of a goal stop (turn.endederror,goal.changedreason) as the engine did: recognized credential shapes redacted (best effort: a free-form text can hold a shape that the fixed patterns miss), and a text longer than 256 runes keeps its first 256 runes and ends with...[truncated]. -
Compaction result (
harness,protocol) —Session.Compactreturns aprotocol.Compactedwithfrom_seq,to_seq,by_backend, andfolded, andPOST /sessions/{id}/compactanswers200with it.foldedis false when the session has too few turns. -
Engine banner (
harness) — withOptions.Version, each model call of a harness-loop turn sends the status line[engine: harness <version> · engine started <time>]as engine context, asharness servedoes. The first request of a session pins it after the newest message of the history, and each later request keeps it there until a compaction applies, which moves it to the end of the history that it leaves, so a kept tool call stays paired with its result. A turn of a backend that owns its loop, such as Claude Code, gets none. Empty: no banner. -
Crash marker (
harness) —Openends a crashed turn with the assistant item[harness: this turn was interrupted by a process restart and could not complete]beforeturn.ended, as the engine did, so the next user message no longer joins the crashed one on the wire. -
MCP connect reasons (
harness) —mcp(action="connect")names the class of a failed connect, as the engine did:initialize timed out,initialize cancelled,connection refused,connection failed, orinitialize failed. It never names the endpoint URL or a response body. -
MCP retry, down notice, and status (
harness) — an MCP server that fails its first connect retries in the background, as the engine did: the first wait is about 1 s, it doubles for each failure, and half of it is random. After 3 failed retries the server is parked untilmcp(action="connect")connects it. While a server is down, the model reads[mcp: unavailable — <server> (<reason>; retrying). Tools from these servers are temporarily absent and may return later in this session.], and a parked server readsuse the mcp tool action "connect" to retry. The notice is a message of the conversation, in<harness-engine-context>tags, pinned at the first model call that sees a new text and kept at that place by each later call until a compaction moves it to the end of the history, so the system prompt never changes and a kept tool call stays paired with its result. The tools of a server that connects appear at the next model call, and the last server to connect adds[mcp: every configured server is connected again.]the same way.mcp(action="status")reports{name, connected, attempts, parked, reason}for every configured server. -
MCP prompt bounds and compaction guards (
harness) — the MCP prompt segment is bounded as the engine bounded it: the instructions of one server are cut at 4000 runes with… [truncated], its tool names stop before 2048 bytes withnames truncated at byte budget, and the deferred catalog lists the first 200 tools and ends with... and N more tools; use mcp(action="search", query="...") to find them. Automatic compaction estimates the context from the history (1 token for each 4 bytes, 1600 for each image) when a turn has ended and the newest turn recorded no reading, and after an automatic compaction applies, or its summary comes back empty, it waits until the context falls below the threshold once before it runs again; a model change that moves the window ends the wait. -
Plugin inventory (
harness,protocol) —protocol.Session.Pluginslists each configured plugin of the runtime with its name, its state (not-spawned,running, orerrored), its tool names, and its hook names, as theharness servesession view did.Session.ViewandRuntime.Listread the state live; a session log does not hold it. -
Model tool (
harness) — with aWorkDir, each session has themodeltool, as the engine had it:status,list, andset, with abillingofsubscriptionorapifor each provider. The providers are the available registry: credentialed nativeanthropicandopenaientries, subscription entries within the host limits, and configured entries. Native API-key entries without credentials are absent.setcallsSession.Update. A backend that owns its loop getslistalone.model_tool: falseturns it off, andNewreads the key again. -
Model and effort of
task spawn(harness) — a spawn takesmodel(aprovider/modelref that a provider of the registry serves) andeffort, and checks both before it starts the child. A child with noefforthas the provider default, as the engine did, and no longer takes the effort of its parent. -
Subagent frames (
harness) — a Claude Code session runs the CLI with--forward-subagent-text, as the engine did, and records the text, the tool calls, and the tool results of a subagent as items.eventlog.Message.ParentCallID(parent_call_idin the log) names the tool call that started the subagent, and is empty for an item of the session itself, so a client can nest the subagent work under its call. The model never reads it, and the wire order of the main thread and a subagent thread stays. -
History bridge (
harness) — a session can move between Claude Code and a model API in either direction. A turn of a backend that owns its loop, such as Claude Code, gets the toolget_conversation_history, which reads the live history of the session page by page (offset,limit) as the engine tool did, and which no allow list hides. When the history holds a message that another provider recorded after the last turn of this one, the turn adds one line to--append-system-promptthat tells the CLI to call that tool before it answers. The next turn of the same provider adds none. A turn belongs to the provider of its model at its start, so a model change in the middle of a turn loses no history, and a turn that recorded no item, such as one whose CLI never started, shows its backend nothing.eventlog.State.Foreignderives that from the log; nothing is stored. A turn that is running moves to a model of another kind of backend at its next turn, not at its next model call. -
Questions (
harness,protocol) — withOptions.AskUserQuestion, a Claude Code turn may ask the user anAskUserQuestionquestion, asharness serve -ask-user-questiondid. The CLI runs with--permission-prompt-tool stdioand a hook that defers the call,EnterPlanModeandExitPlanModeare off, and the turn endsawaiting_inputafter arequest.openedrecord (kindquestion, the call ID as the request ID, and the tool input as the payload). The session readswaiting.Session.ResolveandPOST /sessions/{id}/requests/{request}take{answer}or{dismiss: true}; a question takes a map of each question to the chosen label or free text. An answer appendsrequest.resolvedand runs a turn with no input, which resumes the CLI and answers the call over the control channel. The call stays open until that turn records the result of the CLI for it; a turn that records none gives the call a cut-off result. A question takes only a non-empty map of text, and any other answer fails withErrInvalidRequest. A dismissal runs no turn. An input that is admitted, or queued before the question, dismisses it first: the next run of the backend then denies the parked call in a run of its own, with an interrupt, before the prompt. A request that is not open fails withErrRequestNotPending(request_not_pending, 409). A child session and a session with an active goal never ask. A request that nothing resolves keeps the sessionwaiting; a crash dismisses it. -
Tool-result images (
harness,protocol) — a tool result can carry blobs:protocol.ToolResulthasBlobs, each a media type and its bytes.read_fileof an image and an MCP result with image, audio, or resource-blob content return them, as the engine did, so the model sees the image. A turn stores each blob withStore.PutBlobundertoolblob-<sha256>before it appends theitem.completedwhosetool_resultpart holdsblobs(media_type,blob_key,bytes).Synccarries the blobs of that record, a replay orOpensends the same image, retention counts the text only, andGET /sessions/{id}/blobs/{key}still serves attachments only. When the Store lacks the bytes of a blob, the model API backend logs a WARN and sends the text of the result without the image, so one lost blob does not fail every later turn. -
Prompt attachments (
harness,protocol) — an input can hold a blob part,{type: "blob", media_type, data}, as the engine took: a png, jpeg, gif, webp, or pdf of at most 20 MiB whose bytes are the type that it claims. The runtime stores the bytes withStore.PutBlob, andinput.admittedholds a blob part withmedia_type,blob_key, andbytes.Synccarries the blob in the batch of its record.modelapisends it to the model, andclaudecodesends animageordocumentcontent block. The inputs route takes a body of 32 MiB, and every other route 8 MiB. -
Agent profile dirs (
harness) —agent_defs_dirsselects the dirs of the agent profiles of aRuntime. A relative path joinsWorkDir, and the default is<WorkDir>/.agents. -
Engine parity of the runtime (
harness,protocol) —Runtime.ListandGET /sessionslist in creation order, andafteris the ID of the last session of the page before it; anafterthat names no session fails withinvalid_request.POST /sessions/{id}/requests/{request}replies202 {seq, status}for an answer, andSession.Resolvereturns aprotocol.Resolved. The[continuation: …]message of a max_tokens turn is in<harness-engine-context>tags. A settings change to a model of another kind of backend fails the running turn at its next model call. A name that two agent definition files repeat, in one directory or acrossagent_defs_dirs, fails the spawn and names both files. -
Model call log lines (
harness,cmd/harness) — aRuntimewrites oneturn_metricsline throughslogfor each completed model call, and onestartup_prewarmline for each state of a Codex warm-up, with the keys of the engine.turn_metricshassession_id,model,purpose,ttft_ms,stream_ms,input_tokens,output_tokens,cache_read_tokens,cache_write_tokens,system_len,tools_count, andretry;purposenamesturn,compaction,judge,title, orgenerate. Generated calls have no session, sosession_idis empty. One-shotjudge,title,compaction, and plugingeneratecalls now emitturn_metricslines.request_modeand its item counts,service_tier,effort, and thechain_refusalkeys appear only when they apply.startup_prewarmhassession_id,status(started,ready,consumed,stale,failed,timed_out, orcancelled),duration_ms, andage_ms.harness runmakes its JSON logger the default logger, so these lines are JSON on stderr there as onharness serve.
- Model names, descriptions, and efforts (
internal/modelmeta,protocol,internal/acp) —protocol.Modelhas the optional fieldsprovider_name,name,description, andefforts, whichRuntime.ModelsandGET /modelsfill from models.dev. The list holds no deprecated model and no model without tool calls, though a configured model of this kind keeps its context window and runs. The list is in the order of the provider name, then newest first. The codex list holds the models that the ChatGPT backend serves now, and the context-window tables follow the current models.dev catalog. The ACPmodeloption groups its values by provider, shows the model name with the reference and the first sentence of the description, and theeffortoption offersDefaultand the levels of the current model. A model that the list does not hold offers every level. A change of the model sends the effort list again. - Breaking: no built-in
openrouterprovider (config,internal/backend) — Harness has native candidatesanthropic,openai,codex, andclaude-code; API-key entries need credentials to become available. A model refopenrouter/...fails withmodel_unavailableuntil the config has aproviders.openrouterentry withtypeopenai-compatandbase_urlhttps://openrouter.ai/api/v1. Setapi_key_env(for exampleOPENROUTER_API_KEY) unless the transport supplies credentials; a missing key fails at the first model call. An entry that names onlyapi_key_envorextra_headersunder a key other thananthropicandopenaifails config validation.config.Config.ResolvedProvidersis removed. - Not-a-repository error code (
internal/server,protocol) —GET /workspace/changesanswersnot_a_repo(409) for a directory outside a repository.not_a_git_repostays in the code enum,protocol.HTTPStatus, and the spec as a deprecated name that the server never sends. - Examples report a failed turn (
examples) —prompt,custom-tool,switch-model, andguardrailcallTurn.Waitafter the event stream and exit 1 with the turn error when the turn fails.switch-modelprinted empty replies and exited 0 when a turn failed, for example with no API key. - Session takeover error (
harness,cmd/harness) — a run that another process fenced by opening the same session now fails withharness: session not owned: another process took over session <id>in place of the append-conflict text, and still matchesErrOwnershipLost,ErrSessionNotOwned, andErrConflict.cmd/harnessprints the prefixharness:once, so an error that starts with it no longer showsharness: harness:. - CLI help (
cmd/harness) —-hand--helpon every command, andhelpat the top level and afterplugin, print the usage to stdout and exit 0, with noflag: help requestedline. A flag error, an unknown command, and a positional argument that a command does not take (for exampleharness serve help, which started the server) print the usage to stderr and exit 2. A bareplugin, an unknown plugin subcommand, and a flag error onrun,serve,sessions, andplugin probeexited 1 and now exit 2. The top-level usage namesharness <command> -h. - Breaking:
run -cscope (cmd/harness,harness,protocol) —harness run -ccontinues the newest root session that was created in the current directory, where it continued the newest session of every directory. It fails withno sessions to continue in <dir>when the directory has none. A runtime with aWorkDirrecords it as the newwork_dirfield ofsession.created, andprotocol.Sessioncarries it; a session created before this field exists has none and-cnever chooses it. - Claude Code steer (
claudecode) — asteerinput that arrives while the CLI streams a text-only reply is no longer lost, except when a tool result that the CLI wrote before it read the steer line counts as delivery; the CLI then runs the input as a next turn that the backend does not record. The backend writes a steer input to stdin only while a tool call waits for its result, as the CLI takes a queued message at the next tool result; at any other time the input stays queued, and it is delivered when a tool call starts in the same turn or else the next turn carries it. When the CLI still runs a written steer input as a second turn after its result, the backend reads on to the second result and records it in the same turn, in place of closing stdin and killing the CLI. The second result adds only the cost that the first did not report, and a CLI that exits before it answers the steer input fails the turn. - Breaking: TypeScript
ctx.generateresult (sdk/typescript) —ctx.generateresolves with{message, usage}, where it resolved with the message alone. A plugin that reads the text of the reply readsresult.messagenow. - Session tools package (
internal/selftool) — thegoal,model, andsession_infotools move out of the root package intointernal/selftool, which reaches the runtime through its ownSessionsinterface. The tool names, schemas, descriptions, and results do not change, and the public API does not change. - Missing API key error (
internal/backend,internal/provider) — a native API-key provider without credentials fails admission withmodel_unavailablebefore a turn starts; the error names its missing key variable. A custom user-config provider without credentials fails its first model call with the reason:Options.Getenv is nil, so <api_key_env> is unread,<api_key_env> is empty, orthe providers entry sets no api_key_env. - Typed enums (
protocol) —protocol.Status,Delivery,StopReason,Cause,ErrorClass,ResolutionKind,GoalState,Verdict, andOutcomereplace bare strings inSession,LastTurn,GoalView,Input,QueuedInput, andStatusFrame.protocol.StatusIdleand the other status and delivery constants are typed, so astringassignment from one of them no longer compiles. The JSON is unchanged. - Retry budgets and incomplete reasons match Codex (
config,internal/provider,internal/backend/modelapi,internal/turn,harness,harnesstest) — the config keyprompt_retriesis gone, and a config that sets it fails to load (the variableHARNESS_PROMPT_RETRIESis ignored). Two keys replace it, as in the Codex CLI.request_max_retries(default 4;HARNESS_REQUEST_MAX_RETRIES) sends a model request again after a 5xx status or a transport error, and not after a 429 or a 5xx with aRetry-Afterheader.stream_max_retries(default 5, was 2;HARNESS_STREAM_MAX_RETRIES) calls the model again after a retryable error of a call that recorded no item: a 429 with aRetry-Afterheader (a 429 without one fails the turn), a 5xx that outlasted the request retries, a transport error, a truncated stream, a content filter. Both are at most 100. A compaction summary and a goal evaluation retry the same way. A wait is theRetry-Afterof the provider, else 200 ms that doubles with each retry, with up to 10% jitter (it was 1 s that doubled up to 8 s). A transport error is now retryable witherror_classconnection_failed. A Responsesresponse.incompleteevent with the reasoncontent_filter, the Anthropic stop reasonrefusal, and the chat-completions finish reasoncontent_filterfail the call as the retryable classcontent_filter. Aresponse.incompleteevent with any other reason exceptinterrupted, or with none, fails the call asstream_truncated; it ended the turn as complete before.harnesstestaddsReply.Hangup,CodexReply.Incomplete, andHTTPStatusandHangupreplies on the Responses server. - Response cut off at max_tokens (
internal/backend/modelapi,internal/turn,config,harness) — a model response that the output cap cut off is an incomplete response, as in the Codex CLI, not a step that continues. It records no item and runs no tool call, and the call fails as a retryablestream_truncatederror: the turn waits, calls the model again on the same history, up tostream_max_retriestimes, and then fails witherror_classstream_truncated(a goal pauses on it). The model is never asked to continue. The config keymax_tokens_continuationsandconfig.Config.MaxTokensContinuationsValueare gone, and a config that sets the key fails to load (the variableHARNESS_MAX_TOKENS_CONTINUATIONSis ignored). A compaction summary and a goal evaluation still take a cut-off response as their answer. - Events stream reader and test double names (
protocol,harnesstest) —protocol.DecodeSSEreads an events stream asiter.Seq2[Event, error]; anerrorframe yields a*protocol.Error, which now implementserror.harnesstest.NewisNewAnthropic, andRateLimits.BengalfoxPrimaryisRateLimits.Extra, a map of window by limit name. - Store name and record checks (
harness,protocol) —harness.CheckNameandharness.CheckRecordsare the rules that everyStoreapplies to a session ID, a blob key, and a record;MemStoreandDiskStorecall them, and an invalid name now fails withharness: invalid name "<name>".protocol.Resolution.Validatereports a resolution that holds both an answer and a dismissal, or neither, or an answer that is not valid JSON;null,{}, and""count as no answer. - Config API (
config,harness,cmd/harness) —config.LoadProjecttakes the user config path, so the package reads no environment variable;cmd/harnessresolves$HARNESS_CONFIG.Path,LoadProjectWithInfo,LoadInfo,EnsureProviderDefaults, and the three...Valuesfunctions leave the public API;Config.ResolvedProvidersreplacesEnsureProviderDefaults.max_tokens(HARNESS_MAX_TOKENS,harness run -max-tokens) replacesOptions.MaxTokens, and a negative value failsValidate. - Serve reports the bound address (
cmd/harness) —harness servebinds-addrbefore it builds the runtime, and takesOptions.ServeURL(the pluginserve_url), theaddrfield of theserve startlog line, and the unauthenticated warning from the bound listener address.-addr 127.0.0.1:0serves on a free port, and a caller reads the port from theaddrfield of theserve startline, for example{"level":"INFO","msg":"serve start","addr":"127.0.0.1:41873","version":"..."}. - Small engine points (
internal/session,internal/prompt,internal/skill) — the transcript that the goal evaluator reads shows a reasoning part as[reasoning] <text>and a blob part as[blob <media type>], ends a part over 4096 bytes with…[truncated], and opens with the engine omission notice when it leaves out earlier messages. An agent profile with an unknown key and another error fails the load with the other error, as the engine did, and a profile with an unknown key alone is still skipped. A prompt command with an unknown key and another error still lists the unknown key as its reason. An interrupt of the first turn while it waits for the Codex warm-up cancels the warm-up, which logsstartup_prewarmwith statuscancelled. - Engine text of children, goals, and agent profiles (
harness,internal/session,internal/tree,internal/prompt,internal/backend/claudecode) — a child report to an idle parent starts its turn with the trigger sentence of the engine and the pinned[tasks: …]segment, and the history holds the sentence alone. Thetasktool answers a spawn with the engine note, refuses an unknown agent asunknown agent "x" (available: …), and refuses a spawn pastmax_concurrent_tasksormax_tree_tokenswithengine: tree concurrency limit reachedandengine: task tree token budget exceeded. A session atmax_task_depthhas notasktool. The goal evaluator reads a tool call as[tool call <name>] <arguments>and a result as[tool result] <text>, thegoaltool refuses with the engine wording, and anadjustwhile the condition of asetstill waits replaces it, so the turn of its own runs the adjusted condition. An agent profile file with nonameor nodescriptionfails the load and the error names the file; a file with an unknown key is still skipped. A Claude Coderesultwith no turns and no text ends the turn when the run already recorded an assistant item, with the usage of that result, as the engine ended it. - Cancel reports its canceled descendants (
internal/tree,internal/session) —cancelof thetasktool settles each canceled descendant of the target in its own parent with no report input, and reports it to the nearest ancestor of the target that is not terminal, as the engine did: the parent of the target when that parent works, else the session that calledcancel. The report of the target goes to that ancestor too, chosen when the report is delivered, so a target whose parent is done reports to the session that calledcancel. A parent that opens while that report is delivered leaves the target to that delivery, so the report reaches one session. Theturn.endedof a turn thatcancelstops carriestask_cancel(cause staysstopped), so after a crash the parent that opens routes the report again to the nearest live ancestor, else the root, in either opening order, relays it when that is not the parent, and settles with no report input. A relay is kept once for each child and turn, so a crash between the relay and the settle does not report twice. Agoaladjusttakes effect on the turn that calls it: the turn is judged on the new condition, with no stale verdict and no spent turn. - Engine parity of agent profiles and the evaluator budget (
internal/skill,internal/session) — an agent profile with an unknown key and a list or a block of text under it fails the load, as the engine did, where the runtime skipped the file; an unknown key with an inline value, a mapping, or block text that holds a colon still skips it. The goal evaluator reads a transcript of half the window of the evaluator model less 2048 tokens, at 4 bytes for each token, where it read a fixed 128 KiB; a model whose window the backend only estimates is sized with a 16000-token window in that formula, as in the engine. - Plugin shell.env (
internal/tool/builtin,internal/tool/pluginsrc) — a plugin that subscribes toshell.envadds environment variables to eachbashcommand, as the engine did. - Plugin chat.params (
internal/turn,internal/tool/pluginsrc) — a plugin that subscribes tochat.paramsruns before each model call and may set the model,max_tokens,temperature, andtop_pof that call, as the old engine did. An empty model keeps the session model. - Plugin manifest cache (
internal/tool/pluginsrc,config,cmd/harness) — the firstCreateorOpenreads the manifest of a plugin from the cache file when the plugin has not changed (the executable and each script argument, by size and mtime, then by content hash), as the engine did, so it no longer waits for a probe of each plugin. The cache file is the config keyplugin_cache(HARNESS_PLUGIN_CACHE), which only the user config sets.harness serve,run, andplugin probedefault it toplugin_cache.jsonbeside the user config.harness plugin probeprobes every plugin again and refreshes the file. The Go API has no default and probes at each start. - Oversize instructions (
internal/prompt,config) — anAGENTS.mdoverinstructions_max_byteskeeps the sections that fit whole and gets an outline of the rest, each line with theread_filerange that reads the section, as the engine did. A first section over the cap, or a file with fewer than two sections, gets the truncation marker.instructions_mode: "full"orHARNESS_INSTRUCTIONS_MODE=fullkeeps the head and the marker for every file. A chain over four timesinstructions_max_bytesloses its middle files, nearest the root first. - Read-only subagents (
internal/prompt) — the built-inexploreandplanprofiles allowsession_infobeside the read-only file tools, as the engine's allow-list had it. - Tool batching (
internal/prompt) — with a work directory, the system prompt of a session on a model API backend tells the model to put independent tool calls in one message, after theappend_system_promptentries and before theAGENTS.mdchain, word for word as the engine did. - Parallel tool calls (
internal/turn,internal/tool/builtin) — the tool calls of one model response run at the same time, up to 8, as the engine ran them. Results reach the log in call order.goal,model, andmcprun alone;read_file,write_file, andedit_fileon one path,processon one name, andtaskon one session run in call order. An interrupt cancels every running call. A budget of 64 MiB for each session bounds the file bytes that concurrent file calls hold, beside the 20 MiB cap of one file. - Adjacent assistant messages on the chat-completions wire (
internal/provider/openaicompat) — a run of assistant messages in the history becomes one wire message with their text joined and theirtool_callsconcatenated, as the Anthropic adapter merges a run. The tool calls of a Claude Code response, recorded as one item each, thus stay valid for a chat-completions model after a model switch. - Claude Code failure text (
harness) — a Claude Coderesultframe with subtypeerror_during_executionreports its failure inerrorsand carries noresulttext. The backend now readserrors, joined with;, whenresultis empty. The error of the turn names the failure, and a credential refusal inerrorsfails a goal instead of pausing it, as a refusal inresultalready did. - Command directory under a symlink (
internal/command) — a prompt command directory is refused only when the directory itself is a symlink. A symlinked ancestor, such as/tmpor/varon macOS, no longer hides the commands of a work dir. - Unknown model window (
harness,config,protocol) — a model that the built-in context-window table does not know no longer fails withmodel_unavailable. It runs with a window of 128000 tokens, logs one WARN per process and model, and setscontext.window_estimatedon the session gauge. A configuredcontext_window_tokensalways wins, and an overflow error does not change the window: the overflow compacts and calls the model again as before. A model that no configured provider serves still fails withmodel_unavailable. The config keycontext_window_requiredis deleted, andconfig.Loadrejects a file that sets it as an unknown key. This is a deliberate break (Andy, 2026-10-07). - Engine and server deleted (
engine,server,provider/claudecode) — the packagesengine,server, andprovider/claudecodeare gone, withharnesstest.SinkReceiver,prompt.EngineBase,message.PartVariants, thetypeidpackage,provider.Registry,skill.Discover,plugin.NewTestSpec,message.CommandRecord,message.ResolveOrphanToolCalls, themessage.Origin*constants,message.OperatorBatchEntry,message.PromptSource, and 17fakeclaudemodes that only the engine tests used.harness.Newis the one Go API andRuntime.Handlerserves the one set of routes. Thedepguardrules no longer allowcmdorharnesstestto import a provider wire. - Engine docs deleted (
docs) —docs/engine-request-cycle.md,docs/goal-loop.md,docs/session-storage-and-queue.md,docs/models-and-providers.md, anddocs/mcp-tool-loading.mddescribed the deletedengineandserverpackages, and are gone, with the Historical section ofdocs/README.md.docs/architecture.mdand the source describeharness.Runtime. - MCP server merged into
mcp(internal/mcp) — the packagemcpserveris gone.mcp.Registry,mcp.NewRegistry,mcp.ToolHandler, andmcp.CallMetareplace the same names inmcpserver. - Leaf packages moved to
internal/(internal/message,internal/modelmeta,internal/mcp,internal/plugin,internal/skill,internal/command,internal/process,internal/imageclamp,internal/provider) — the packagesmessage,modelmeta,mcp,plugin,skill,command,process,imageclamp, andprovider(withprovider/anthropic,provider/openai, andprovider/openaicompat) move underinternal/with no change to their code, so another module can no longer importgithub.com/majorcontext/harness/messageor the others. The public Go API isharness,harness/config,harness/protocol,harness/storetest, andharness/harnesstest. A caller reads model metadata throughRuntime.ModelsandGET /models.go generate ./internal/modelmeta/rewrites the context-window tables. TheharnesstestMCP stub (MCPTool,MCPResource) now takes its own types (MCPResult,MCPContent,MCPError) instead of themcppackage types. - Fresh-session cutover (
harness) — the repository has no old-format converter.harness/migrateandcmd/harness-migrateare deleted, and the runtime reads no engine journal, index, snapshot, orevents.jsonl. A box keeps its workspace and starts a new session on the runtime; its old journals stay on disk unread. - Queued inputs (
harness,protocol) —GET /sessions/{id}/inputsanswers each queued input, oldest first, asprotocol.QueuedInput(id,parts,delivery,source,source_id,source_label) in place of an ID list. A text part carries its text; an attachment is{type: blob, media_type, bytes, key}and never its data.Session.queuedstays the ID list. harness serveon the runtime (cmd/harness) —harness serveruns oneharness.Runtimeover aDiskStorein the session dir, and servesRuntime.Handlerwith no version prefix: the/sessionsroutes,/models,/commands,/processes,/workspace/changes, and/health. No old route answers. It reads the config withconfig.LoadProject, applies theHARNESS_<KEY>variables withConfig.ApplyEnvand then its flags, passes the working directory asWorkDir, the build version for the engine banner, andServeURLandRunTokenfor the plugins, and refuses the config keys that the runtime does not read (instructions_mode,event_sink,snapshot_every_records,tool_result_inline_bytes,tool_result_retained_bytes). HARNESS_MODEL now sets the default model throughApplyEnv, so boxes must check the variables that it exports before the cutover. TheHARNESS_RUN_TOKENbearer check,-unauthenticated,HARNESS_UNAUTHENTICATED,--ask-user-question,-cors-origin,-no-instructions,-skills-dir,-agent-def-dir, the config summary log line, and the GC pause watcher stay. The store of serve logs a slow store operation, a store operation that stays in flight, a created session, and a spawned task, in place of the engine hooks. After the listener is up, serve callsRuntime.CatchUpand opens each stored session that has work to resume (View.Resumable): a session with none stays closed and gets noowner.acquired, and a log that does not replay is skipped and logged.SIGINTandSIGTERMclose the runtime and the HTTP server under one 5 s deadline, then writeserve-stop.jsonin the session dir as one line,{"stop":"handoff"|"crashed","sync":"synced"|"unsynced"}, forboxinit; serve deletes the file at start, so a run that ends with no report reads as crashed and unsynced. A Sync that rejects a batch for good during the run (Runtime.SyncStopped) makes the reportunsynced, andRuntime.Closedoes not fail for that session.Runtime.Listskips a log that does not replay and logs it. Serve no longer has-pprof.harness run,sessions, andplugin probeon the runtime (cmd/harness,harness) — the three commands run onharness.Runtime, andcmd/harnessimports neitherenginenorserver.runcreates or opens a session (-r,-c,-no-saveon aMemStore), submits the prompt as a typed input, streams the text, the tool calls, and a retry of the session and of each task child, or each event of the session and of each task child as a JSON line with-jsonthat holds thesession_id, and exits 1 for a failed turn (also under-goal) or command, with or without-json, and 3 for a goal that a verdict did not achieve.runends only when its session is idle and each task child of its session has settled, so the output of a running child and the turn of its report print.run -max-tokenssetsOptions.MaxTokens, the output cap of each model call, as before.sessionslists the sessions of the store with their message counts.plugin probecalls the newRuntime.ProbePluginsand prints each plugin with its hooks; the manifest cache is gone, and the runtime probes at its firstCreateorOpen.runandsessionswrite and read the event log; they cannot read an engine journal.- Message page (
harness,protocol) —GET /sessions/{id}/messages?before=&limit=andView.Messagesanswer aprotocol.MessagePageas the engine page:messages,first_seq,last_seq,total,has_more, andcommands, numbered from 1 in the order of the conversation. A compaction keeps the messages it folded, and its summarycmpsum_<seq>stands between them and the kept messages. A limit above 1000, and abeforeorlimitthat is negative, not an integer, empty, or repeated, isinvalid_request. The engine bootstrap form has no counterpart. The route reads a session without opening it. - Typed process, logs, and health bodies (
harness,protocol) —protocol.ProcessInfo,ProcessStatus,ProcessLogs, andHealthtype the/processesand/healthbodies, and the generated contract names them.GET /healthanswersversion,vcs_revision,vcs_time,session_sync,started_at, andcapabilities(delta_row_identity), as the engine did. - Resumable sessions (
harness) —View.Resumablereports whetherOpenwould resume a turn, a queued input, a goal, an unfinished command, or an unsettled child. - README and examples — the README and the programs in
examples/useharness.New,Runtime.Create,Session.Submit, andSession.Events. - Generated HTTP contract (
protocol) —go generate ./protocolwritesprotocol/openapi.jsonandprotocol/protocol.tsfrom the Go types ofprotocoland the route table ofinternal/server, and CI fails on a diff. The hand-writtenserver/openapi.yamlis deleted. The contract holds each success status of a route (a repeated input ID answers 200, an answer to a request 202), marks each request body optional, and refuses unknown fields in a request-only type. - Error codes in the contract (
protocol,internal/server) —Error.codeinprotocol/openapi.jsonandprotocol/protocol.tsis an enum of the error codes of the API, generated from the status map ofinternal/server, which now holdsunauthorizedandinternal. A test fails when theprotocolCodeconstants, the status map, the Errors table of the spec, and the enum differ. - Provider tool deferral deleted (
internal/provider,internal/provider/anthropic,internal/modelmeta) —provider.ToolDef.DeferLoading, the server-side tool search tool of the Anthropic adapter, andmodelmeta.SupportsToolSearchare gone: nothing set the field, andinternal/tool/mcpsrcdefers MCP tools for every provider, as the spec says. A gate ininternal/gatesfails a Go file that names a deleted package path, in code or in a comment. - Model resolution (
config) —Config.ResolveModelreturns the resolved ref string and does not parse it. A caller parses it withmessage.ParseModelRef. - Runtime config check (
harness) —harness.NewreturnsErrInvalidRequestfor anOptions.Configthat failsConfig.Validate, so a bad provider, plugin, MCP server, or process entry fails atNew, not at the first model call or process start. - Credentials from the HTTP client (
internal/provider/anthropic,internal/provider/openaicompat) — aClientwith anHTTPClientand noAPIKeysends no key header, so the client can supply the credentials, asprovider/openaidoes. AClientwith neither still fails withno API key. - Failed turn and the queue (
harness) — aRuntimesession starts the next queued input after a failed turn, as after a completed turn, andOpendoes the same. Only a turn that endedprovider_exhaustedleaves its queued inputs waiting for the next input, live and after a restart. - Turn end cause (
harness,protocol) —turn.endedhas a typedcause(stopped,ended,goal_cleared,crashed,provider_exhausted), anderrorholds only the message of a failure.protocol.LastTurnhascause. A turn that a usage limit failed keeps the provider message inerror, with the recovery time of the provider when the message lacks it, where it held the textprovider_exhausted. A turn that ended by its cause alone has noerror; the report of a child and the status of a task show the cause then. Every reader branches oncauseand never on the text oferror. - Evaluator and summary calls (
harness) — the goal evaluator request pins effortoffand a response cap of 256 tokens, and a summary request caps its response at 1024 tokens, as the engine does. A retry waits 1 s, doubling to 8 s. The compaction threshold and the context gauge use the window of the session model, or the window of the reading when the model reports none, so a model switch changes the window. The evaluator transcript has no trailing newline. - Tool names across backends (
harness) — one rule decides whether a session has a tool: an embedder, runtime, plugin, or MCP tool, a file tool of theWorkDir, or a built-in tool of its model. Thetoolslist of a child profile keeps its plugin tools. A backend that owns the loop, such as Claude Code, runs no pluginsystem.transform, because it reads no system prompt of the harness. The tool hooks of every source run around each tool call, in order. - One read of a child profile (
harness) — a spawn reads the agent profile once, and the child takes its model, tools, and prompt from that read, where the child read its prompt again at its first turn. - Reads without ownership (
harness) —GET /sessions/{id}and the page form ofGET /sessions/{id}/eventsanswer from the view of a session that theRuntimeruns, and replay the log of any other session, asOpenViewdoes. They never acquire a session, appendowner.acquired, or start a turn. The SSE stream ofGET /sessions/{id}/eventsand each route that changes a session still open it. After a restart the embedder opens each session that has work to resume. - Reads of a running session (
harness) — a pluginclient/session.messagescall,taskstatus and log, the tree interrupt, and the tree budget read a running session from its actor, with no replay of its log. - Child limits from the logs (
harness) —max_concurrent_taskscounts the unsettled children in the views of the sessions of a tree that theRuntimeruns, with no separate ledger, so a parent that opens after a restart counts its unsettled children at once. A lock for each tree makes the count and thechild.spawnedappend one step. - Engine-only config keys deleted (
config) —Confighas no field forinstructions_mode,event_sink,snapshot_every_records,tool_result_inline_bytes, ortool_result_retained_bytes, andDefaultshas no entry for them.config.EventSinkSpecand the accessorsSnapshotEveryRecordsValue,ToolResultInlineBytesValue, andToolResultRetainedBytesValueare gone.Loadrejects any of these keys as an unknown field and names it.harness.Newno longer has a separate check for them.config/config.gois split intoconfig.go,specs.go,provider.go,load.go, andmerge.go. - Owner refusals (
harness) — a failure ofOwner.AcquireisErrSessionNotOwnedthat wraps the cause, so the HTTP handler answerssession_not_owned; a call that waits for ownership whenRuntime.Closestarts fails withErrDraining(draining, 503).ErrBusyis no longer exported.Runtime.Commandsreturns theopof each command and no route, andGET /commandsnames each route. - One submit (
harness,protocol) —Session.Admitis gone.Session.Submitreturnsprotocol.Admitted, andAdmitted.Repeat(not on the wire) is true when the session had admitted the input before. - Window before the first measurement (
harness,internal/modelmeta) —OpenView,ReadHandler,harness sessions, andharness runhave no backend, so they read the context window only from the log. A session that they read reports window 0 until its firstcontext.measuredevent, whatever its model. A live Claude Code session also reports window 0 before its first turn, because its backend reports the window during a turn. Separately,modelmeta.ContextWindowno longer answers for aclaude-coderef: a model API provider that is keyedclaude-codegets the default window of 128000, marked as an estimate, instead of window 0.
- Ended child goal (
internal/session) —CancelForEndends the goal of the session with stateclearedand reasonended, for an active, paused, or blocked goal, whether the session runs a turn, an evaluation, or a compaction, or is idle, so an ended child starts no further goal turn.