The Agent Api, the Agent / Session / Prompt components, prompt journaling and
replay, and the provider-factory seam are implemented in @executablemd/agent,
over the execution @executablemd/core owns; the Config timeouts are
@executablemd/runtime's (§Config). The Agent package has two entries.
@executablemd/agent/api carries the Agent Api, AgentConversationProvider,
AgentProviders, the Session accessors and the contracts a Plugin or a provider
is written in. @executablemd/agent/host carries what a host installs and
reads back: the components, permission and failure policies, provider
installation, held conversations, Prompt publication and the retained Prompt
reader. Core by itself registers no Agent component;
a host that installs this package's components supplies them. A provider is
supplied through the rootProvider factory seam (§The provider-factory seam).
This specification owns the public operations, configuration and retained
record shapes.
Agent permissions and generated work
own workflow isolation and mapping publication;
native Agent sessions own the shared
session lifetime and enforcement rules. Exact native handoff interfaces and
compatibility exceptions remain in the
native launch specification.
Each term is defined once, in its owning section; this list is a map, not a second statement of the rules.
- Agent — a resolvable agent name (a string, an ACP agent command). Resolution and defaults: §The Agent Api.
- Session — the value naming one conversation:
{ sessionKey; cwd; agentSessionId?; readonly identity? }. Issued by the installed provider; a configured use is Agent-issued. §Sessions: ownership, routes and attachment. - Configured use —
AgentSessionUse, an Agent-issued opaque carrier of one configured use of a conversation. §Session configuration. - Turn — one journaled prompt: one subscription of the cold stream
prompt()returns. §The Agent Api, §Journaling and replay. - Construction route — the durable record of how a session was constructed
(
acp-firstorclient-native; bound to an executable build, or unbound). §Sessions: ownership, routes and attachment. - Ownership — exclusive acquisition of an advertised session through the host's coordinator before any operation acts on it. §Sessions.
- Advertised agent — an agent advertised for native launch or
client-native attachment through the host-owned dependency lists (built-in
defaults:
claude,codex). §Sessions. - Held conversation — a conversation a trusted host holds open outside any document. §A conversation a trusted host holds open.
installAgentComponents() from @executablemd/agent/host registers six
components for the installing scope (executable-mdx-spec §5.3): AgentProvider, Agent, Session.Launch, Prompt,
ApproveAll and AskPermission. Session is the seventh agent word and is supplied
separately, because its implementation names durable work after its own
invocation: a host declares it to the execution through the identity-bearing
installation described in executable-mdx-spec §5.6, and the execution builds it
from the claimant it minted. agentIdentityComponents() is what a host
declares; a host that declares none has no Session component at all, which is
why installAgentComponents() alone leaves the name unresolved.
All seven are ordinary function components and non-reserved defaults: a
repository component with one of these names is chosen ahead of them, and the
engine owns their expression props, schema validation, as capture, content
projection and invocation lifetime exactly as for any other .ts component.
Props take string and boolean values, from a literal or from an expression that
resolves to one.
All seven, and the documentation that describes them, name the component
origin @executablemd/core. They kept it when they moved from Core into the
Agent package, because an origin is part of how canonical resolution, a
retained journal and a documentation lookup identify a component.
A canonical Markdown test may configure one nested host="run" execution with
a direct TestAgent declaration (testing-spec.md). That declaration carries only
detached scenario data. The trusted child host installs the controlled root
provider and launcher in the isolated child, registers these six defaults and
declares Session before root import. The provider and every logical session
belong to that exact child; a sibling nested execution receives fresh state.
Ordinary component resolution remains in force, so configuring the provider does not force any of these defaults to win over a repository component.
What is not ordinary is which of their failures end the document. An unknown
provider, a missing default agent, an unusable duration, an unavailable agent,
a session that cannot be established, and a Prompt replaying a recorded
raised marker all stop the execution rather than rendering a diagnostic and
letting later siblings run as though the agent had answered. AgentProvider
extends that to the resources its factory installs, whose cleanup the
invocation boundary runs after the component has returned.
-
AgentProvider resolves a registered provider by its
nameprop and installs it for its body. OptionaldefaultAgentoverrides the inherited default agent for that body; optionaltimeoutdeclares how long each prompt in that body may take. A prompt nobody bounded has no timeout: the run deadline bounds the run, not each prompt inside it. The permission mode is inherited and has no prop — it always reaches the factory unchanged.<AgentProvider name="acpx" defaultAgent="codex" timeout="30s"> <Prompt text="Review this change" /> </AgentProvider>
An unknown provider name, or no default agent configured, fails the execution before the body expands: neither the body nor any later content renders.
-
Agent (optional
name) resolves its explicit name, or the current/default agent whennameis omitted, and for its body pins that resolved agent onto nested prompts and launches. Self-closing performs the same resolution and availability validation, then renders nothing; it does not create a session or run a turn. -
Session (required
name) resolves a session and pins it onto nested prompts and launches; optionalmodelandeffortprops are owned by §Session configuration. Self-closing validates only. -
Session.Launch prepares one durable session from its rendered body and hands the provider's native UI the terminal for it, rendering nothing itself and returning only after that UI exits (native-agent-session-launch-spec.md). Its props are exactly
agentandsession, mirroring Prompt; no executable name, native session id, argv or instruction-channel selection appears on the document surface. The dotted name addresses a subdirectory, so a repository override for it iscomponents/Session/Launch.md. -
Prompt sends one prompt and renders the reply.
- Content is the rendered children; a self-closing form uses the
textprop instead. agent,session, andtimeoutprops override the enclosing scope for that prompt;timeoutaccepts a duration string.as="name"captures the reply into the eval environment instead of emitting it.throwOnErroraborts the document on failure; without it, a failed prompt renders its partial text, the document continues, and the failure is aggregated into the execution completion as anAggregateErrorofAgentPromptErrors ("N agent prompt(s) failed"), ordered by execution sequence.
- Content is the rendered children; a self-closing form uses the
-
ApproveAll answers each request in its body by selecting an allow option, and denies when none is offered.
-
AskPermission asks for every request in its body, and denies without an interactive TTY or a valid choice.
Both apply to their body only; the enclosing policy applies again after the closing tag. They change which policy answers requests — not the provider's
permissionMode, which a provider factory still receives as inherited.
Agent is an Effection Api (@executablemd/agent/api) for stateful coding-agent
sessions, distinct from the stateless Sample Api. It has exactly six contextual
operations:
interface AgentApi {
agent(name?: string): Operation<Agent>;
session(name?: string | AgentSessionRequest): Operation<Session>;
options(agent?: string, request?: AgentOptionsRequest): Operation<AgentOptions>;
prompt(content: string, options?: PromptOptions): Operation<Stream<AgentPromptEvent, string>>;
launch(request: AgentLaunchRequest): Operation<void>;
requestPermission(request: PermissionRequest): Operation<PermissionOutcome>;
}Agentis a resolvable agent name (a string).Sessionis{ sessionKey; cwd; agentSessionId?; readonly identity? }.PromptOptionsis{ agent?; session?: string | Session; timeout? }.AgentPromptEventisstarted→ zero or more live events → oneterminal({ status: "completed" | "failed" | "cancelled"; stopReason?; error? }).
Base behavior: with no provider installed, agent(), session(),
prompt(), and launch() report a missing provider; prompt() reports it
coldly — the returned stream is handed back without starting a turn, and
the failure surfaces only when it is subscribed. requestPermission has a
working base that denies: it selects reject_once, then reject_always,
and otherwise returns { outcome: "cancelled" }.
prompt() has one signature and two dispatches. An ordinary document call
composes routing through the installed provider chain, unchanged. A canonical
held-conversation call routes as §A conversation a trusted host holds open
specifies — that section owns the held-turn routing contract.
The caller-facing native-launch operation is separate from the request-only route:
function launchAgentSession(
instructions: string,
options?: LaunchOptions,
): Operation<SessionLaunchResult>;
interface LaunchOptions {
agent?: Agent;
session?: string | Session;
}
interface SessionLaunchResult {
agent: Agent;
session: Session;
nativeSessionId: string;
launcher: string;
}launchAgentSession() and prompt() resolve through the same Agent and
Session operations. The extra shape exists only at the coordination boundary:
callers supply instructions and receive a result, while public Agent middleware
routes an opaque request and cannot manufacture that result.
launch() routes one frozen, one-use AgentLaunchRequest and answers nothing.
launchAgentSession(instructions, options) is the canonical operation that
issues that request, retains the launch's phases, and derives its
SessionLaunchResult; the route is where public middleware sees the ask, and
the right to perform it reaches the installed provider directly rather than
travelling on this chain (native-agent-session-launch-spec.md). A launch
performs no model turn except the one materialization turn an adapter may
require to make a freshly created conversation resumable at all, and a provider
that answers prompt() does not thereby answer it: native session launch is
its own capability, installed on its own.
Agent's name prop is optional. Omitting it asks Agent.agent(undefined) to
resolve the current agent: an enclosing Agent element when one is active,
otherwise the installed provider's defaultAgent. An explicit name overrides
that selection for the element's body.
defaultAgent names an ACP agent command, not a model. Which model and effort
level a conversation runs under is said by the Session that owns it, and by
nothing else — Agent, Prompt and Session.Launch have no such prop, and model
routing on the stateless Sample Api is a different contract.
The current ordinary-run Agent surface grants the resolved contextual cwd and
defines no directory-registration component. In particular, Agent.AddDir is
not registered or specified, and native launch's additionalDirectories value
is the explicit empty ordered list. A future directory-registration feature
must first define path resolution, ordering and access modes here; until then
native launch cannot claim or widen any additional root. Filesystem
accessibility and rendered agent instructions remain separate: the cwd is not
injected as text, and rendered instructions grant no directory.
Built-in claude and codex are advertised for native launch, and
claude additionally for attaching ACP to a session a native process
constructed. Claude's sessions are named by XMD and created by the native
process; Codex names its own and reports it back
(native-agent-session-launch-spec.md). The ownership and construction-route requirements
below therefore apply to them on every host, and only the hosts that assemble
both — Deno and the compiled binary — can serve them. An agent that is not advertised keeps ordinary ACP
behavior on every host.
Every operation that can act on an advertised session — session(), a
subscribed prompt() stream, a launch, and an incomplete launch replay — takes
exclusive ownership of it first, through the session coordinator its host
passed into the provider. Coverage follows the agent's capability, not the
operation. Resolving an agent and placing a session own nothing. Acquisition
never waits: contention refuses, and a host that installs no coordinator
refuses every one of them before contacting an agent. Node and Bun install
none, so default Claude session work refuses there before any provider
effect — no availability probe, no runtime, no route read, no identity, no
child.
Exact-target session ownership inspection and explicit operator force are separate CLI capabilities. They never enter provider dependencies. Default acquisition remains conservative; force compares exact record bytes under the same lock and records backend quiescence unproved and interrupted outcome unknown. A live owner stays busy. The one current ownership shape retains the latest forced-release marker across ordinary ownership. Obsolete shapes refuse; there is no ownership format selection or compatibility reader. Recovery sends no provider request and repairs no identity, route or journal.
The host also passes in a construction-route store, directly and from the same trusted root as the coordinator. It is required for an advertised agent whose adapter carries an executable binding, and a host missing it refuses that agent before any provider effect, on the same terms as a missing coordinator. It is not a contextual Api, for the same reason the coordinator is not.
A conversation continues quietly on the executable the current environment selects. The provider must positively confirm the retained native identity before work that requires it. A missing or different assertion refuses without creating a replacement conversation. Executable version and digest do not decide admission. Existing routes and journal history remain unchanged; normal continuation creates no new version-history record.
While ownership is held and before any provider construction effect, the
provider reconciles the route. A fresh session() places the session and
publishes no route. The first subscribed consuming prompt() publishes or
adopts acp-first before runtime creation, ensureSession() or a turn; an
established session() reconciles its retained route eagerly. An ensure that
fails afterwards leaves that route standing. A launch by an adapter that names
its own sessions publishes client-native under an identity that adapter
allocated, unless existing durable ACPX state or an existing route says the
session was constructed through ACP — in which case it publishes or adopts
acp-first and retains identity-unavailable. A fresh acp-first
route is published in the released unbound form before ACP creates anything.
An existing route is never rewritten: a bound record keeps its original
binding, an unbound record stays unbound, and both continue. Publication is create-once, so the loser of
either order adopts the winner, and no route converts.
A session() or subscribed prompt() meeting a client-native route,
bound or legacy unbound, attaches to it. Under the same ownership it
selects the current executable, requires any retained ACP arrangement to
assert that route's identity, selects the runtime for (resolved agent command,
selected environment) and calls ensureSession() with resumeSessionId equal
to that identity. An existing ACP record is reopened strictly with
expectedAgentSessionId equal to the route's identity. With no record, the
exact load carries no expectation that presupposes one; the returned canonical
assertion must equal the route's identity, and a refused first arrangement is
left asserting nothing so a later exact retry is not blocked by it. Either way
the assertion is confirmed before settings or a turn. The selected executable
path reaches only that runtime's transient child environment. An agent this
host has not advertised for attachment, a disagreeing arrangement and a
missing or differing returned identity each refuse before a turn and create no
substitute conversation.
A held conversation is owned and routed where it began. Its coordinator key and its construction route use the provider and resolved command of the history's initial configuration record with the recorded placement, before a Prompt records one with the placement the provider resolves, and the first setup with no initial record uses today's coordinates. Today's command still drives everything that executes: runtime selection, executable selection and observation, and usage reporting. So a conversation whose adapter command changed between releases keeps one owner, one route and its original construction provenance, and an earlier owner still holding that original tuple refuses the changed-command contender before any ensure, prompt or route publication. The coordinator, its locks, tombstones, quiescence and the route store are unchanged; nothing is copied, migrated or published under the new command.
withSessionRoute remains routing only: it selects which partition serves a
call and carries no permission to construct, own or answer.
Read Session.identity to record which conversation performed work without
opening provider-private storage. The Agent package exports SessionIdentity
beside Session from @executablemd/agent/api:
interface SessionIdentity {
readonly kind: string;
readonly value: string;
}The optional readonly property is absent until the provider confirms an
association. ACPX reports acpx.agentSessionId for an asserted native
identity, otherwise acpx.acpSessionId for the confirmed ACP loading target.
Values keep the provider's exact opaque spelling. Native assertion takes
precedence when both exist; agentSessionId remains native-only. Other
providers may omit the property and the Agent package defines no closed kind catalog.
Each read observes the latest confirmation for that exact Session. Its returned
pair is frozen: const saved = session.identity keeps that reading even if the
Session later confirms another association. Compare both kind and value within
the relevant Session/provider association; the strings promise no global
uniqueness. A configured Session forwards both public observations live through
own enumerable accessors. JSON omits undefined observations and serializes a
present pair as {kind,value}; a spread or saved JSON is data, with no
right to execute the Session. Private configuration and provider ownership stay
private.
For example, install installAgentComponents with the ACP provider factory,
declare agentIdentityComponents(), and execute an Agent element named
scribe holding a Session named review with model and effort set, holding a
Prompt. Ordinary Agent.around middleware can retain the resolved Session
before the first Prompt. At that Prompt's actual started event, the same
configured use exposes confirmation and verified settings, including when the
installing Agent package is a separate loaded copy:
const saved = session.identity;
// After an explicit supported continuation:
const current = continuedSession.identity;
if (saved !== undefined &&
(current === undefined || current.kind !== saved.kind || current.value !== saved.value)) {
throw new Error("conversation identity changed");
}These are synchronous data reads. They create no conversation and perform no ensure, load, storage read, configuration, journal append, prompt or model call. Existing eager Session resolution retains its documented effects. Transport close preserves the last confirmed pair without retaining executable resources; reading it does not revive the provider. Exact-object admission, continuation validation and host mapping remain with their current owners.
Session accepts optional model and effort props:
<Agent name="codex">
<Session name="architect" model="gpt-5.4" effort="high">
<Prompt>Review the design.</Prompt>
</Session>
</Agent>Values are exact provider ids — whatever the agent advertises, spelled the way it spells them. XMD translates no alias and substitutes no near value.
Omission is not a value. With neither prop the conversation keeps whatever it
is already using and nothing is read or written about either setting; with only
model the effort level is left alone; with only effort it applies to the
model the conversation is already on.
Configuration is not an Agent.session() argument. Session middleware receives
only a name or opaque request and returns the Session selected by its final
route. The request's Agent-private issuance carries its frozen configuration;
only the coordinator delivered directly to the provider factory can read that
issuance and complete it with the provider's exact Session. The Agent package issues a
configured use only from that completion.
request.with({ name }) keeps the same issuance and configuration.
Replacing it with another live request selects that request's configuration and
optional durable identity. Replacing it with a raw string, or returning an
already-issued raw Session without finishing a setup, selects the unconfigured
path. Returning another authentic configured use selects that use. The
configuration therefore moves only with its whole opaque route; middleware
never receives a separate setting it can combine with another route.
useConfiguredSession(name, configuration) accepts a string, omission or live
session request and returns Operation<Session>. A live request receives the
frozen configuration before routing. A string or omission opens one fresh
operation-local request issuance with no durable component identity, routes
that request, and closes it in finally. The result is an AgentSessionUse
only when the final route finished a configured request; middleware may instead
select an unconfigured route.
AgentSessionUse is an opaque nominal subtype of Session: one Agent-issued
configured use of a conversation, carrying the exact provider Session that
finished the final opaque request and its configuration in Agent-owned identity
state. One configured Session element issues one use and selects that same
object for its nested operations. The Agent package freezes the carrier and its copied
configuration; it does not copy or freeze the provider Session. sessionOf(),
configurationOf() and isSessionUse() inspect an authentic value. No public
operation wraps an existing Session with arbitrary settings, so a structural
copy, a foreign loaded-copy carrier or the real Session paired with substituted
settings authorizes no configured operation. The provider retains no
desired-configuration association; the final authentic use routed to an
operation supplies its own settings.
Public identity and the native-only projection stay live on an already issued
use. A first started event keeps that final routed configured use rather than
substituting its raw provider Session to expose confirmation.
The settings travel inside that frozen use when a prompt or launch names the
conversation. Only the Agent package and the installed provider can read them — a spread, a
descriptor copy, the real Session presented as configured, or a use from
another installation or loaded copy refuses rather than being treated as
configured. Middleware may inspect, delegate or replace the whole Session. The
final routed value decides the work: an authentic configured use applies its
configuration; another authentic use applies that other use's configuration;
and a raw Session, name or absence follows the unconfigured path with no
configuration read or write. A copied or foreign value that claims to be
configured refuses before provider work.
AgentLaunchRequest.with({ session }) follows the same rule and does not
consult prompt state.
What a durable record says the operation ran under is read from the final authentic use the provider consumed. If middleware selected an unconfigured route, the record carries no configuration. The journal therefore describes the turn or launch that actually ran rather than the enclosing element's earlier selection.
The settings are applied in a live operation, under that session's existing serialization and ownership, and verified before the operation continues:
- read what the agent advertises;
- validate and apply
model; - refresh, because effort choices belong to a model;
- validate and apply
effort; - verify that both are exactly what was asked for.
Only then does a prompt turn begin or a native UI open. A value the agent does not advertise, a rejected write, a readback naming something else, or an agent that cannot report or change its configuration all fail the operation before the turn — and never by substituting another setting or another conversation.
A write that may have landed and then failed is put back, model first, and the original rejection is what the caller is told. A restoration that cannot be verified leaves a conversation whose configuration nobody can state: that exact session is refused for the rest of the run, before any later status read, write, prompt, detach or native process.
Reconfiguring an existing session preserves its exact provider identity and its history. A provider that cannot reconfigure that conversation in place refuses.
A provider that releases its handle after each owned operation reconnects for
the next one, and a reconnect initializes the resumed conversation before the
steps above run. A reconnect whose use names a model resumes exactly as an
unconfigured one does: the provider hands the in-process runtime no requested
model, so no Claude session/load or session/resume carries
_meta["executablemd.has-explicit-model/v1"], and the prepared adapter keeps
its existing resume initialization, including the environment or settings
model it reasserts. The runtime's requestedModel input and the marker it
derives remain in ACPX and the prepared adapter; XMD supplies neither.
After the resume, ACPX's reconnect replay writes the conversation's saved model selection when the resumed session reports another current value. The steps above then write the requested model when the selector still reports another value, and verify the readback. An unchanged reconnect can therefore carry a model write, and a genuine change is written and verified before the next prompt. A requested model the resumed selector does not offer refuses through the same membership check as any configured use.
The configured-session carrier is issued by the Agent package after session() resolves an
exact value registered by the installed provider. An Agent-owned
resolve-and-issue operation supplies the programmatic path; middleware can
inspect, delegate or reroute the resulting use but cannot mint or rebuild one.
The private context used by Session only selects the enclosing lexical use for
nested components. It is not admission and carries no second configuration
value.
Configuration refusals may carry the optional namespaced observational data
error["executablemd.acp.configuration-failure"]: exactly
{ reason, setting }, where reason is selector-unavailable or
configuration-mismatch, and setting is model or effort. The
configuration owner supplies initial selector absence separately from readback
mismatch. This data grants no configuration completion, permission or identity.
Restoration failure retains its existing unusable wrapper and takes failure
precedence. Consumers parse the closed payload at the eager Session or cold
Prompt subscription boundary, without matching diagnostic text or serializing
the error.
Agent.options() reports what one agent advertises, in provider order:
interface AgentOption {
readonly id: string;
readonly name: string;
readonly description: string | null;
readonly group: { readonly id: string; readonly name: string } | null;
}
interface AgentOptionSet {
readonly selected: string;
readonly options: readonly AgentOption[];
}
interface AgentOptions {
readonly agent: string;
readonly model: AgentOptionSet | null;
readonly effort: AgentOptionSet | null;
}A setting the agent does not offer is null rather than an empty set. Groups
are flattened, with the group repeated on each of its members and null on a
choice the provider offered directly. AgentOptionsRequest is
{ model? }, which asks about a model other than the current one —
because effort choices belong to a model.
Reading is strict about the selector it recognized and incurious about the rest. A selector with the wrong type, two equally preferred candidates, a duplicate value id, a missing id or name, or a current value the agent does not offer fails the operation rather than reading as "this agent offers you nothing".
A provider is a factory that installs Agent middleware for its scope, and —
if it serves saved conversations — one provider object for them. The Agent package
delivers its coordinator directly to the factory, beside the component invocation
identity Core issues each element,; it never travels through Agent
middleware:
type AgentProviderFactory = (
options: AgentProviderOptions,
coordinator: AgentProviderCoordinator,
) => Operation<void>;
interface AgentProviderOptions { defaultAgent: string; permissionMode: PermissionMode; }
type ConfigureAgentSession = (
configuration: SessionConfiguration,
) => Operation<SessionConfiguration>;
type AgentSessionSetupState =
| { readonly kind: "new" }
| {
readonly kind: "existing";
readonly configure: ConfigureAgentSession;
};
interface ProviderSessionConfiguration {
readonly providerTools: readonly string[];
readonly mcpServers: readonly JsonObject[];
readonly permissions: JsonObject;
readonly systemPrompt: string | { readonly append: string } | null;
}
interface AgentSessionSetup {
readonly sessionIdentity?: string;
readonly requestedModel: string | undefined;
readonly agentSessionId: string | undefined;
readonly session: {
readonly provider: string;
readonly agentCommand: string;
readonly sessionKey?: string;
} | undefined;
activate(
provider: string,
agentCommand: string,
configuration?: ProviderSessionConfiguration,
): Operation<Result<void>>;
finish(
session: Session,
state: AgentSessionSetupState,
): Operation<Session>;
}
interface AgentProviderCoordinator extends AgentLaunchCoordinator {
sessionSetup(request: AgentSessionRequest): AgentSessionSetup;
}
interface AgentConversationProvider {
agent(name: string): Operation<string>;
session(request: AgentSessionRequest, agent: string): Operation<Session>;
options(agent: string, request?: AgentOptionsRequest): Operation<AgentOptions>;
prompt(
content: string,
options: PromptOptions & { agent: string; session: Session },
): Operation<Stream<AgentPromptEvent, string>>;
}A provider that serves saved conversations installs an
AgentConversationProvider in its own provider scope, through the Context of
that same name on @executablemd/agent/api, alongside whatever Agent
middleware it provides. The factory signature is unchanged. The object carries
no coordinator, permission flag, configuration approval, history mapping or
completion receipt: it is trusted behavior a conversation selects, and
everything it is held to stays with the Agent package. How a held turn routes through it is
owned by §A conversation a trusted host holds open.
Each of the four operations takes explicitly what the public chain supplied
implicitly. agent resolves through this provider rather than through
Agent.agent. session accepts the genuine opaque request — a name, a
Session or a structural look-alike names no conversation here — and an
explicit agent, so the setup the coordinator delivers is reached and the agent
cannot be answered for by anything else. options inspects through the same
object. prompt returns a cold stream for the exact Session the conversation
supplies; its liveness check and its native work belong to the subscription, so
obtaining a stream starts nothing.
The object has its installing provider's lifetime. Its methods resolve that provider's concrete state at the moment of use, so a reference kept past the provider's teardown refuses rather than reaching state that is gone. A provider that selects its state per dispatch does not by itself supply one: a host serving a saved conversation installs an object for one concrete state in that conversation's scope.
sessionSetup() accepts one exact live opaque session request. Its handle
exposes the optional durable component identity, authorizes provider work once,
and settles that request once. requestedModel is the exact model string named
by that final
request's configuration, or undefined for omission and effort-only requests.
It describes the request only: it authorizes nothing and does not claim that
configuration has been applied. finish() still hands the requested settings
to configure for application and verification. Exposing the requested model
lets an eager reattachment choose continuation behavior before finish()
(§Session configuration). The structural adapter requires the member, forwards
a string or undefined, and refuses a missing member or another value type;
public request middleware receives no such member.
Two more members say what a held conversation's history already holds about
the provider state it stands on (§A conversation a trusted host holds open).
agentSessionId is the native conversation the history's own Prompt
records assert: the identity a provider must reconcile before it sends a new
prompt, never an ACP loading target. session locates that state: the
provider and resolved command of the history's initial configuration record —
historical coordinates, never a command to execute — and the latest nonempty
sessionKey its Prompt records name. Both are undefined for an ordinary
setup and for a history that does not yet hold them; sessionKey alone is
optional, absent until a Prompt records a placement. Its presence locates state
and asserts neither native creation nor acceptance. The Agent package takes both as
detached, immutable snapshots when the request opens and delivers them only
through this setup; they are not request members, Session properties or Context
state, and possessing them authorizes no provider work. The structural adapter
requires both members to be present, copies and freezes the locator, and
refuses a missing member, a non-string assertion or a locator it cannot read.
For a new Session, finish() issues the
configured use without reading or writing provider configuration. For an
existing Session, it invokes the provider's stable configure operation,
requires the returned canonical value to equal the requested members exactly,
and issues the use with that returned value. An unconfigured request returns
the provider's exact raw Session.
activate() is asked before anything is reattached, created or prompted, and
finish() refuses until it has answered Ok. The provider names itself, names
the command it resolved, and states the active provider configuration it is
about to construct under — the agent's own tool list, the validated MCP
connection configurations, the permission configuration, and the system-prompt
replacement, addition or explicit null. Every member is required: an input
this host left to the agent's own default is not an empty one, so a provider
that cannot state all four states none, and a conversation that requires one
refuses rather than continuing under a configuration nobody stated. Those values are
built from the same inputs construction uses — detached once from the host's
own containers — so a configuration this provider declared and a session it
then created cannot differ.
A retained conversation requires the configuration; an ordinary Session element
may omit it, saves none and keeps its existing behavior. One setup authorizes
one attempt: a refusal, a cancellation or a closure leaves that handle unable
to retry or to settle, and a later explicit action asks for a setup of its own.
An Ok authorizes work and asserts nothing about native creation. A delivered
setup with no activate is refused by the structural adapter rather than read
as authorized.
One private registration owner is created inside the provider installation's
operation. Its closure owns liveness, exact Session-to-configure
registration, duplicate detection, one authorization attempt per setup,
settling and configured-use lookup. The same Session and operation may be
registered again; a different operation for that Session, a second settling,
registration after teardown or lookup after teardown refuses. Provider teardown
runs while the owner is live, then closes it and drops its registrations
deterministically. Sibling installations and runs have distinct owners.
The public request carries only an unreadable private reference to its own issuance. Middleware may transfer that whole route but cannot read, edit, copy or reattach its configuration. The owner and configuration operation are reachable through no Context, module registry, public Agent operation, middleware-readable member, return value or Session property. Another loaded provider copy composes through the coordinator it received; another loaded Agent copy cannot manufacture a request or use this owner admits.
A provider partition is one complete, independently owned agent-provider state — runtime, store, managed sessions, queues, coordinator, teardown — selected by the one installed factory at each dispatch. Production is the single-partition case of the same path; holding a partition grants work, never permission.
installAgentComponents({ rootProvider: { factory, options } })
owns the root provider's lifetime through Execution.document: the handler
delegates the request it was given and returns nothing, and the factory runs
inside a scoped provider lifetime that surrounds the document's expansion and
ends while the journal is still live, so the completion resolves only after
the provider's finalizers have run. Rendered output closes independently of
teardown, and every finalizer runs even if one throws.
Teardown and prompt failures are additive completion policies, and completion precedence is first-failure:
- a document that already failed keeps its own failure — provider teardown neither replaces it nor aggregates onto it, and the policy is not consulted;
- an otherwise-successful document becomes an
Errwhen its prompts failed, when teardown failed, or both — prompt failures first, then teardown, flat rather than nested; and - once a policy has failed the completion, no later policy replaces it.
Cleanup still runs in every case. "The document failed" and "cleanup also failed" are both true; what the caller receives is the document's own failure, because that is the one it earned.
AgentProviders resolves a factory by name. registerAgentProvider(name, factory) installs a resolver for that one name in the current scope and
delegates every other name outward, so a nested registration overrides an outer
one for its own name without affecting siblings or process-global state.
Resolving an unregistered name throws Unknown agent provider "<name>".
Registering a provider only makes a factory resolvable; it does not install
that provider into the Agent Api. Operations still report a missing provider
until one is installed as a root provider or by AgentProvider.
The CLI registers claude-workflow-role alongside ordinary acpx. The
adversarial workflow selects this provider only around Claude role calls,
including foundation, document preparation, independent review and its completion
and response-only correction turns. It uses the same carried adapter, session
store and host identity coordination as ordinary calls. Interactive Sidekick
configuration is unchanged.
The profile sets CLAUDE_CODE_DISABLE_BACKGROUND_TASKS=1 in the child session
environment and supplies disallowedTools: ["ScheduleWakeup", "Monitor"]
through ACPX to Claude's supported SDK option. ACPX retains the deny list with
the session's creation options, restores it on reconnect and carries it through
IPC. These settings remove the native shell/subagent background parameter,
disable automatic shell backgrounding and deny both tools. Other background
services and MCP tasks can still be available. The role still owns every process
it starts and must join it before returning its result. A foreground timeout
fails the command and leaves the role result unaccepted.
Session creation options do not retrofit an existing conversation. Before ensure or prompt, a provider with an explicit deny list compares that list and every selected environment value with the retained session options. A missing or different value refuses rather than silently reconfiguring, replacing or resetting the session. Fresh sessions record these settings on creation.
The CLI registers diagnostic-acpx for the standalone problem-solver phase.
The provider resolves the working tree root, Git directory and common Git
directory in the scoped directory when it is installed. It starts the carried
Claude or Codex adapter inside a process sandbox that denies writes to those
resolved directories. The restriction also applies to tools the agent starts.
On macOS the provider uses sandbox-exec. On Linux it uses Bubblewrap with a
private PID namespace, a private /dev for terminal allocation, and read-only
mounts for those directories. The provider checks that the sandbox starts before
inspecting model options. Unsupported hosts and failed sandbox setup stop
dispatch before any agent is started.
The Codex adapter runs tools under the outer process sandbox. The provider
selects the adapter mode that avoids applying a second sandbox to those tools.
The profile denies ACP permission requests, supplies no ACP MCP servers and uses its sandboxed adapter command for session resolution. A diagnostic continuation requires its recorded identity. Native launch and client-native attachment are unavailable in this profile. The source protection applies to the diagnostic processes. The workflow itself owns evidence and result publication outside the checkout.
installAgentComponents({ defaultAgent, permissionMode }) seeds the
values that AgentProvider inherits. The configuration surfaces are those
options, the defaultAgent and timeout props on AgentProvider, and the
permission components; the contextual state holding them is private to the
components.
The CLI REPL entry assembly uses this delivered coordinator for its XMD-only headless child integration. The canonical document Session remains the issuer. Its requestSession callback prepares and journals an opaque address before native acquisition. A setup decorator calls genuine activate with the original provider, command and construction configuration, returns its original Err immediately, and acquires only after genuine Ok. It forwards finish with the actual Session and new/existing configuration operation, retaining the original result and failures. No public Context or authored name supplies this authority.
The ordinary document journal owns the xmd_session allocation. Only its live body permits acquisition; replay looks up the exact original child and refuses absence. Parent registration occurs synchronously after the root, selected Sidekick association and private endpoint are ready. Creator cancellation joins startup before registration; afterwards the parent owns the child independently of the entry provider's finalizers.
Session and Prompt are written inside an expansion, with an element to name the
session and a journal already around them. A host that discusses something with
an agent has neither: a person is typing into a chat, the history outlives the
process, and there is no document. useAgentConversation() on
@executablemd/agent/host is that conversation, and it is the genuine one — a
canonical agent session, journaled turns, verified configuration, and an
identity the provider reattaches to.
The parent and child Sidekicks retain this ordinary constrained provider assembly and mailbox. Headless child placement belongs to the separate entry document's canonical Session; the child-enabled entry factory is not installed as the root provider of a held XMD chat. The held history retains its own construction and Prompt ordering. A saved child reference neither replaces that history nor starts a fresh conversation after uncertain acceptance. Reconnection first establishes the exact original live child; missing identity or outcome remains uncertain and never authorizes resend.
A held conversation's work executes through its captured provider in the conversation's own task, and continuation follows the same quiet confirmation and refusal policy as an ordinary Session.
const opened = yield* useAgentConversation({
history, // the DurableStream holding this conversation's canonical history
id, // the stable host-owned identity that history belongs to
agent, // the resolved agent name, already selected by the host
installations, // the trusted assembly that selects the provider and its policy
});The agent a host names is the conversation's own for the life of it. Each
turn resolves it through the conversation's own provider before allocating its
session, and then states it to both of that turn's operations — so the session
the request is resolved into and the prompt that is sent are the same agent's,
and a conversation runs under an agent that is not the host's default. The
request still names no agent: an agent on it would be an agent anything holding
it could read or replace.
The handle is provided by a resource owned by the caller's scope and offers
three members: prompt(input, configuration?, images?), which sends one journaled turn
and answers with its completed reply; options(request?), which inspects the
selected agent's advertised choices; and evaluateGeneratedXmdRoot(request),
which evaluates one complete generated root under this conversation's own
execution. Stop is scope cancellation rather than a fourth member.
A turn's configuration is what that turn asks for, and a model the
conversation already runs is no change. When model equals the model in the
retained configuration of the conversation's latest started turn that names
one, the turn is sent without it: the provider names no model, reads and
writes no model selection, and the turn retains no model. A different model,
or a conversation with no started turn naming one, is named and applied and
verified like any configured turn. An unchanged turn therefore does not write
back a model changed natively while the conversation was released. effort is
named as asked.
A held prompt can carry a host-supplied ordered list of PNG images. The ACPX provider sends them as image content blocks with the prompt text. The backend's advertised image capability determines whether that turn can start. The Agent package journals the text, and the caller supplies any durable references to the images.
prompt returns source and runs none of it. A host that means to run what came
back decides that itself and asks here, because a generated root is evaluated
by the execution whose captured package documentation and canonical protected
dispatch it reads — and that execution is this conversation's. Evaluating sends
no provider prompt and changes no configuration. The element obtains the actual
method on its own execution's handle through an Agent-private readiness bridge
before the conversation is announced ready, so a handle that reports itself
open is open for all three things it offers; the bridge carries that bound
operation and nothing behind it, and AgentConversationHost stays an ordinary
declaration local to the synthetic root.
It does its work through one installed provider, directly. The conversation
reads the AgentConversationProvider its host installed once, in its own
scope, after installation and before it reports itself ready, and every agent,
session, options and prompt operation of that chat goes to that object. Reading
selects; it probes no agent, creates no runtime, ensures no session, sends no
turn and saves nothing, so a cold opening and a replay reach none of its four
methods. A later selection cannot reach a conversation that is already open.
Held-turn routing. A held turn's content and its cold stream are composed
by outer max Agent.prompt middleware, and the turn then ends at a private
turn-local min terminal bound to the captured provider, the selected agent
and the exact checked Session. Ancestor min routing and default handlers are
not dispatched in held mode, and there is no fallback to an ordinary provider
terminal. The terminal visibly refuses a changed or missing selected agent,
exact Session or timeout before native prompt work, rather than silently
repairing routing — the timeout checked against the primitive copied before any
handler saw the options, because a value middleware can change in place cannot
be compared against itself; an originally absent timeout remains absent. A held
handler forwards checked options unchanged, selects per-turn content inside the
returned stream's subscription, and delegates once. A wrapper may observe
events and own cleanup while forwarding events, order and returned text
unchanged; its return value and stream.done establish no canonical
completion. One subscription is one turn: entering that stream a second time is
refused before a second input is retained, a second turn announced or the
provider asked again. The native stream's own terminal outcome, settlement and
returned text are read on that same forwarding path, so a composition that
catches a native failure or ends early does not make a turn complete. Later
provider selection cannot replace the captured behavior; composition belongs to
that conversation and preserves subscription-owned work and cleanup. Ordinary
document routing is unchanged.
Content is the only thing composition decides, and that is deliberate: a
handler that forwarded a request's descriptive name instead of the request
would open an ordinary route, so the provider would never reach the request's
setup and the required configuration would never be asked for; a prompt handler
that replaced options.session would send the turn to a conversation nothing
checked. Neither is reachable — agent, session and options are not routed
for a held conversation at all, and the prompt terminal validates what arrives.
A provider that installs no object refuses the opening with an explicit
unsupported-conversation error, before the conversation is bound, so no
configuration record, prompt record or root terminal follows from the refusal.
Ordinary Session and Prompt elements keep composing through Agent exactly as
before.
The Agent package keeps what it already owned. The one-use request is opened and closed by
the conversation, the configuration requirement travels inside its issuance,
and the conversation retains private evidence of the exact Session settling
that request produced: a provider that answers with a session it never settled,
or with another after settling, is refused before the conversation asks for a prompt
stream. That check is not the configuration check — activate() still happens
inside the provider before any native effect — and neither is evidence of
native identity, which only a turn's own canonical record establishes.
It is an element inside its own execution. A provider and its launch
coordinator are installed inside Execution.document, and a durable
preparation precedes both, so a conversation opened there could reach neither.
The conversation is a host-declared identity component in a synthetic root Core
executes: canonical resolution selects it, hands its implementation the execution's
claimant, and the session is placed under the engine's own identity for that
invocation. The root's source is <AgentConversationHost /> at the synthetic
path agent/conversation.md, and the component registers under the origin
@executablemd/core; a retained history is admitted against that source,
so it is unchanged from when Core shipped the conversation. The id names the history and nothing else — it carries no
claimant, establishes no native identity and overrides none.
Its root is never completed. A durable root that records its terminal replays instead of reopening, and reopening a conversation is the ordinary case. The element therefore serves turns and does not return; the halt that releases the resource appends nothing, because a root records a terminal only on its own success or failure. What the history keeps is a partial continuation.
Each turn is its own canonical sequence. A turn is one journaled Prompt
under its own durable name, offered in the conversation's sequence exactly as
Prompt offers one in a document's, through the same runPrompt the component
uses rather than a copy of it. It runs in a task of its own, so cancelling the
call halts the turn: its append never lands, the position stays free, and the
next turn is a new turn rather than that one resumed. Reopening re-offers the
retained turns in their own order, which replays each from its record and
reaches no provider.
A turn whose outcome the history does not hold refuses the conversation before anything opens. Resuming it would re-send a prompt the provider may already have accepted, and writing a terminal for it would make an unfinished turn look complete; reconciling it belongs to the host, with the provider's own account of that turn. Because the refusal happens before the execution exists, it appends nothing to the history it refused. A canonical Prompt value that fails validation also refuses opening at this boundary, before provider work.
The history is bound to its conversation by a durable record written on the
first opening and replayed afterwards. A history established for another id
refuses rather than reconnecting the wrong chat, and one established with
another agent refuses rather than changing agent in place — an explicit agent
change is a new conversation with a new id.
A conversation keeps the configuration it began under, and continues through today's adapter. The first turn's activation commits one canonical record holding the provider, the resolved command and the complete active provider configuration, and it commits before any native work may begin — so a conversation interrupted after the provider asserted an identity but before its turn was acknowledged already holds how it began rather than having that reconstructed from whatever this process's defaults are now. Later activations write nothing. Each states what the provider builds under now, and that statement must still be readable; differing from the initial record in provider, command or configuration refuses nothing. A release may change the adapter a host runs — the bundled Codex adapter became the host-installed one — while the conversation it continues is the same native history, so the current adapter is attempted on that history. What the provider actually applies is verified where it applies it (§Session configuration), and a genuine resume, assertion or configuration failure still fails the turn without a replacement conversation or a new prompt. A changed executable is neither reported nor a failure. A reopening on its own performs no activation and no provider work at all; the configuration record is re-offered in its own position so the turns written after it replay in order, and it is never rewritten. The record is configuration, not identity: an absent Prompt outcome is never permission to replace it, and the native identity remains the canonical assertion a turn records.
Where its provider state is. Each turn's setup carries two snapshots the
Agent package takes from the history when that turn opens its request (§The provider-factory
seam): the native conversation the history's Prompt records assert, and the
initial record's provider and command with the latest nonempty sessionKey a
Prompt record names — a failed turn's placement included, since the provider
may already hold state there that no completed turn asserted. A configuration
held without any Prompt record locates provider and command and no placement.
A later turn in the same opening receives fresh snapshots that include what
earlier turns recorded, and a failed or keyless outcome erases neither a prior
placement nor a prior assertion; a setup already issued never changes. The
provider reconciles these facts against its own records before it sends a new
prompt (§ACPX provider). They locate state and own nothing: the conversation is
owned and routed where it began, while today's command executes it
(§Sessions: ownership, routes and attachment).
What a turn ran under is the provider's own account. A request is made per
turn, because a request settles what it asks before it is routed and is good
for one use: the first names a new session and the provider creates the
conversation, and a later one names an existing session, so what the turn asks
is applied and read back through §Session configuration's own machinery. A
provider that reports it put the conversation under something else refuses that
turn rather than having those settings recorded. options() sends no model
prompt and journals nothing, and is called on explicit interaction rather than
to restore a pane.
A used history requires an existing provider record on its next explicit turn.
Use means a retained turn has nonempty agent output, non-failed status, a stop
reason, or an asserted native identity. If setup would create, it refuses
before session/new, names a new conversation as the remedy, preserves
turns and output, and leaves the conversation usable. A recorded
placement whose provider record is gone is such a case: no record found by
today's command elsewhere stands in for it.
Failed-before-answer history may still create. A turn naming no native identity
establishes none; it does not permit replacing a conversation the history
already used.
The native conversation an established history names. A completed turn retains the exact conversation the provider said it ran in, so the retained records are what establish a chat's native identity; there is no mapping record beside them. A provider that resolves a different conversation refuses the next turn before it is sent, a provider that names a different one only after the turn ran has that turn's outcome refused with the established identity standing, and a history whose own turns name two conversations cannot be opened at all. The window before any turn has retained one belongs to the provider: ACPX's own record asserts an identity before the host's mapping is acknowledged, and the next attachment — found through the failed turn's recorded placement, whichever command runs it — reconciles and commits that same assertion rather than creating a replacement (§ACPX provider).
One job runs at a time; an overlapping call refuses rather than queuing, and a handle kept past the scope that opened it refuses because the conversation it addressed has been cancelled. All three members share that one admission guard, so an evaluation while a turn is in flight is refused exactly as a second turn is, and refusing it performs no component work. Cancelling a call joins the work it started: the call finishes once that work and the cleanup inside it have finished unwinding, and the conversation stays unavailable to another job until then, so a completed cancellation is proof that the work has stopped. A wait that can no longer be answered ends on the conversation's own ending rather than on nothing — an execution that has ended takes the element serving a job with it, and the caller is told so. A refusal before a turn starts — an unavailable agent, an identity the provider will not reattach, settings it would not honour — is that call's answer and leaves the conversation usable. Only a durability failure ends it.
An evaluation gets an execution-owned durable sequence distinct from the
conversation's turns, allocated past every evaluation the history already
holds, so one history carries its Prompts and its evaluations side by side
without either replaying the other, and the Prompt records that establish
native identity are exactly what they were. An ordinary failure of the
generated source answers Err carrying what the reply had rendered; a failure
of the run keeps its own classification and reaches the caller as itself. It is
also this conversation's own outcome, and because the conversation's root is
never completed there is no terminal and no completion for it to travel
through: the release that ends the conversation raises the same object instead.
So catching it on the call cannot leave the conversation's own run looking
successful.
Each prompt is one durable operation (agent_prompt). The record carries the
prompt's identity and input, the agent and session identity, terminal status,
stop reason, text (including partial text on failure), any structured failure,
one optional canonical configuration, one optional list of permissions,
one optional usage (see Prompt usage), and the optional
withheld marker of a held conversation's withheld reply.
The configuration is retained only after the provider emits started: a turn
that started is one the provider put under exactly those settings, while a
configuration refusal started no turn and retains none. A prompt that starts
and later fails or is cancelled retains the configuration it ran under. An
unconfigured prompt omits it. A sequence records execution order explicitly,
and per-location ordinals keep durable identities stable across Each loops.
For a held conversation the retained input is the final composed text the
turn actually delegated: the turn's own terminal fixes it in the pending
description and acknowledges matching feedback intent before native prompt
subscription, so canonical publication and that acknowledgement hold one text.
A turn that failed before reaching that boundary retains the input it
attempted, which is not evidence that anything was sent. Completed replay
restores the retained composed input and result without running composition,
reaching a provider, calling begin() or reconstructing current state.
A held conversation's completed turn whose reply the journal would refuse is
retained without that reply. Before the record is appended, the execution's own
scanner reads the reply as the record serializes it; a finding keeps the
completed record — the delivered input, session and native identity,
configuration, permissions and usage — with empty text and withheld: true.
The call answers a fixed AgentReplyWithheldError, exported from the host
surface and naming no rule, position or fingerprint; it is the only answer that
identifies a withheld completion, so a host acts on it rather than on finding a
withheld record. The conversation stays usable: the next turn continues the same
native conversation, and a reopening replays this one from its record.
Everything else still reaches the journal's own guard, which refuses the append
as before: a scanner that cannot answer, a policy that is not the execution's, a
failed or cancelled turn's partial text, a credential anywhere else in the
record, and a turn whose record names a native conversation other than the one
the history established. A
document's <Prompt> never withholds. A withheld that is not true, or that
accompanies a status other than completed or nonempty text, does not read
back.
ACP maps normalized tool_call and tool_call_update events to
{ type: "tool_activity", toolCallId, label }. The call ID is the exact ACP wire
string, including surrounding whitespace. It must contain non-whitespace text, fit
within 512 UTF-16 code units, and contain no control characters, lone
surrogates, Unicode line or paragraph separators, or bidirectional controls.
An invalid ID yields no activity.
The label comes from the tool title alone. A missing, blank, default
tool call, or unusable title yields Working. A title is usable when
it fits within 160 UTF-16 code units, passes the same character checks as
the ID, and clears the execution's live-output secret policy. The emitted
label is trimmed. The event contains no arguments, tool content, paths
from locations, raw output, or receipt time.
A tool event carrying the XMD response marker or a reserved XMD question or permission title produces no activity. The title match is case-insensitive and accepts whitespace, colon, underscore, or hyphen between XMD and the kind. Other tool updates with an ID already identified as an XMD presentation are also excluded for the rest of that turn. XMD input responses and retirements continue through their own event handling.
Activity is transient. Prompt reply concatenation, durable publication and replay use the same text and results as a turn without activity.
A failed owning stream release is terminal before ordinary failure serialization and publication. The Agent package preserves initiating work and teardown failures separately and activates the existing live publication failure path without a recoverable failed-turn record. Authored Catch therefore starts neither replacement work nor an unentered finalizer after failed release. Ordinary cleanly released failed turns keep the saved record and raised replay marker below, and may be handled by explicit authored Catch. Optional diagnostic screening is unchanged.
A failed Prompt keeps its readable message, optional name and cause
message. Its optional error.diagnostic retains selected ACP facts in the same
record:
| Field | Meaning |
|---|---|
provider, operation, stage |
A saved Prompt diagnostic has the fixed provider and operation acp and session/prompt. The stage is runtime-turn, prompt-ensure or held-session-ensure. The operation identifies the attempted Prompt and grants no wire receipt. |
requestId |
The actual turn's request ID, when supplied on runtime-turn. The ensure stages forbid this field. |
code, detailCode |
Supplied nonempty runtime classifications. RUNTIME is the normalizer's fallback, not a backend diagnosis. |
retryable |
A supplied boolean hint, including false; it grants no resend. |
origin |
The supplied normalization layer: cli, runtime, queue or acp, not a proven root cause. |
acp |
Optional selected protocol facts: finite numeric code, optional nonempty message, and optional string details extracted only from data.details. An explicit empty details string remains empty. |
Conversation correlation stays in the existing agent, sessionKey and
agentSessionId fields. No raw protocol payload, prompt, environment or
unrelated history is added. A plain Error has no diagnostic; stream exceptions,
cancellation and host permission refusal keep their existing paths. A
message-only upstream failure remains undiagnosed. An ordinary Session's
same-session load or resume refusal is reported as described in
Ordinary Session resume failure details.
ACP selects the same bounded facts when the subscribed Prompt's ensure fails
before a runtime turn (prompt-ensure) or the runtime turn refuses before
writing the prompt (runtime-turn). Identity confirmation, ownership, configuration, permission
and cancellation keep their existing outcomes.
When a held conversation's eager ensure refuses with that classification,
Agent waits for successful unwind and publishes one canonical failed Prompt
using the job's attempted input, resolved agent and next ordinal. This
held-session-ensure stage has empty text and an empty session key and carries
no native assertion, configuration, stop reason, permissions, checkpoint,
usage, raised marker or withheld reply. The attempt never begins the canonical
Prompt terminal, composes the input or emits started. The caller receives the
failure reconstructed from the saved value. Failure to publish retains its
existing durability precedence. Diagnostics establish
neither backend acceptance nor a successful retry and never enter the agent's
reply text.
The Agent package selects these optional facts before constructing the saved failure. With
secret detection enabled, it screens each optional textual field in its
retained JSON representation, omits offending fields, then screens the complete
selected diagnostic. Unsafe secondary text does not discard a safe protocol
code. If policy authentication or screening fails, the whole optional
diagnostic is absent; the original message, name, cause, status and partial
reply stay unchanged. An eager held refusal instead keeps the three fixed
provider, operation and stage values and drops every optional fact.
Cancellation remains cancellation. Explicit host-disabled
detection is respected. The complete event still crosses the unchanged
rejection gate: upstream selection never repairs an event rejected by that
gate.
The current reader validates a present diagnostic completely and refuses
malformed or unknown members, including a held ensure failure with
inconsistent surrounding Prompt fields. The same error carrier also serves
ordinary Session reporting, but the saved Prompt failure and record readers
refuse its session-ensure stage: an ordinary Session refusal is never a
saved Prompt. Deploy the readers and writers together.
Older readers refuse the new stages. This internal format has no downgrade
reader. An absent diagnostic preserves
message/name/cause-only records without a migration or rewrite. Reconstructed
thrown and aggregated Prompt failures keep the selected diagnostic under
executablemd.agent.prompt-diagnostic. The existing REPL Journal query exposes
the saved error as promptError after cold reopen; select a returned numeric Prompt locator within its entry to read it. Reading sends no prompt and
reads no runtime log or native history.
An ordinary <Session> that resolves an existing conversation reattaches it
before consuming its body. When the provider refuses that same-session load or
resume, the element fails with the name SessionResumeRequiredError and no raw
upstream cause, its body and later content do not run, and no Prompt record,
attempted input, ordinal, usage or started event is created.
An unknown failure of an established same-session load or resume is a failed
pre-send attempt. The provider preserves the saved identity, creates no session,
and sends no prompt. It reports SessionResumeRequiredError with the ordinary
Session remedy: repeat the operation with the same <Session> when its caller
permits it; a different <Session> starts another conversation. Neither an ACP
code, provider name, message nor retryable hint decides eligibility. An identity
mismatch refuses; an attempt whose prompt delivery is uncertain cannot use this
pre-send rule. Classification never resends automatically. A workflow reports
the failure under its retained run contract and offers no per-Prompt Retry.
ACP attaches the selected bounded facts to the
refusal under executablemd.agent.prompt-diagnostic with provider acp, stage
session-ensure and operation session/ensure. The operation names the
logical ensure: it proves neither which wire method the runtime chose nor that
anything reached the backend. The ensure stage forbids requestId.
Agent selects and screens that diagnostic exactly as it does a saved Prompt's, then states it in the error message, the one field the root failure, its retained journal and a log carry. The message keeps the readable opening and appends one line per present fact, in this order and with these labels; string values use JSON string rendering so an embedded line break stays unambiguous:
Session "<key>" could not be resumed. Retry this operation with the same <Session> if its caller permits; a different <Session> starts a new conversation.
Resume diagnostic (provider=acp, operation=session/ensure, stage=session-ensure)
Normalization origin: acp
Runtime code: "RUNTIME" (normalizer fallback)
Runtime detail code: "SESSION_RESUME_REQUIRED"
ACP code: -32041
ACP message: "Internal error"
ACP details: "Release the active writer before reconnecting."
(normalizer fallback) marks only the RUNTIME code. Absent facts have no
line, and a diagnostic with no protocol facts states only its header and
normalization fields. With detection enabled, an unsafe optional string is
omitted and the remaining safe facts, including a numeric ACP code, stay. When
no valid ordinary diagnostic is selected, or policy authentication or screening
fails, the message is the opening sentence alone, with neither the raw error
nor the scanning failure. The retryable hint grants no resend and is not
displayed. These facts describe the selected protocol error, not a proven
backend cause.
permissions is the account of what the agent was allowed to do while this
turn ran. Each member describes one request that was decided:
| Member | Meaning |
|---|---|
toolCallId |
the tool call the agent asked about |
title, kind |
the provider's own words for it, where it supplied them |
options |
the choices offered, each optionId, name and permission-option kind, in the order the provider offered them |
outcome |
{ outcome: "selected", optionId } or { outcome: "cancelled" } |
Members appear in the order the requests arrived, not the order they were answered: two overlapping requests settle whenever their policies finish, and an order taken from that would report an order the agent did not ask in.
Nothing else crosses the durable boundary. The request's rawInput, its
Session, the provider's callbacks and waiters, and any error are absent by
construction — the record is assembled field by named field from the request as
it arrives, and the decision is added when it is made. A request that raised
instead of returning was decided by nothing and has no member.
The list is closed: a member this specification does not define, an option
kind outside the four, or an outcome that is neither of the two refuses the
whole prompt record rather than being read past. A turn that answered no
request omits the member entirely, which is also how every record written
before this member existed reads. Parsing an older record is unchanged, and
nothing rewrites one.
The audit observes decisions without granting permission. Each turn has its own ledger, and overlapping turns cannot take one another's entries. A request that raises or is cancelled before a decision returns contributes no member.
The Agent middleware installed with the Agent sits outside every policy
installed after it. Each Agent.prompt() call's returned cold stream is wrapped
so every event is read under that call's private ledger, and a permission
request raised while reading inherits that ledger alone. A component installs
nothing to be audited.
The observer reserves a place in request-arrival order, delegates once, then copies the decided outcome returned by that delegation into the reserved place. The retained audit publishes completed places in arrival order, not completion order. An unfinished place publishes nothing rather than an invented denial; the ledger supplies no authority to answer a request.
On a full replay (the journal already holds the root Close), completed
records are restored from the journal without contacting any provider —
producing identical output and identical aggregated failures. A prompt failure
that was thrown through throwOnError is marked raised; a partial replay
re-throws it, while a full replay omits it from aggregate restoration because
it was already handled where it occurred.
An acknowledged Prompt keeps the usage its provider reported for that turn in
its own record. Selecting retained history — --journal, a workflow run, a REPL
entry, a Sidekick conversation — selects it; there is no accounting flag and no
second usage journal. A transient history stays transient.
{
"usage": {
"requestId": "…",
"providerRecordId": "…",
"providerMessageId": "…",
"providerSessionId": "…",
"provenance": {
"host": "deno-source",
"xmd": { "version": "0.14.1" },
"runtime": { "version": "0.22.0" },
"adapter": { "version": "1.6.2", "digest": "sha256:…" }
},
"readings": [
{
"source": "response",
"scope": "last-request",
"kind": "tokens",
"counter": "snapshot",
"tokens": { "inputTokens": 900, "cachedReadTokens": 3000, "outputTokens": 40 }
},
{ "source": "update", "scope": "session", "kind": "context", "used": 12000, "size": 258000 }
],
"coverage": {
"finalReport": "received",
"outerPrompt": "partial",
"limitations": ["codex-last-request-only", "codex-reasoning-inclusion-unverified"]
}
}
}requestId is the runtime request this turn was started with;
providerMessageId is the user message the runtime generated and saved for it,
under the record providerRecordId; providerSessionId is the ACP session it
was prompted in. They are observations: none routes a turn, authorizes work or
names a native Session, which stays agentSessionId. Each is absent when it was
not observed. provenance names the host and the builds that produced the turn;
an unmeasured build stays absent rather than borrowed from elsewhere.
Each reading is one source's own view, under the source's own counter names:
source |
kind |
Allowed values |
|---|---|---|
response |
tokens |
inputTokens, outputTokens, cachedReadTokens, cachedWriteTokens, thoughtTokens, totalTokens |
quota-total |
tokens |
totalTokens, inputTokens, cachedInputTokens, cachedWriteTokens, outputTokens, reasoningOutputTokens |
quota-model |
tokens |
the same counters, with the reported model |
update |
tokens, context, cost |
live breakdown counters; occupancy used and size; reported amount and currency |
Views of the same work are not additional spend: nothing adds a response total,
a quota total and per-model rows together. An omitted counter is unknown,
tokens: null is a source that reported null, and an empty list of readings is
not zero. Live updates replace one another, and an occupancy-only update leaves
an earlier cost or breakdown in place. scope and counter state what the
traced adapter release's view covers:
| Adapter | response and quota-total |
quota-model |
Outer Prompt |
|---|---|---|---|
| Claude 0.70.0 | main-loop, turn-total |
broader-model-work, turn-total |
partial: subagent inclusion is unverified, absent counters are reported as zero, and reasoning is billed inside output |
| Codex 1.8.0 | last-request, snapshot |
last-request, snapshot |
partial: only the final internal request is reported |
Any other release reports unknown scope and counter with
source-semantics-unknown. finalReport is unavailable when the turn ended
without a response view, and an unknown remainder stays unknown.
examples/agent-usage/README.md measures these meanings on a selected build.
A failed or cancelled Prompt whose record is acknowledged keeps what was reported
before it ended, and never gains a checkpoint. Work stopped before its record was
acknowledged — a scope cancellation, a refused publication or append, a lost
process — leaves only the earlier history; nothing appends a substitute ending,
an invented zero or a second paid turn. A direct Agent.prompt() call, which no
canonical Prompt authors, may be observed but is retained nowhere and lends its
usage to no neighbouring Prompt. Native-launch materialization keeps its own
MaterializationUsage on its own record.
The Agent package selects the retained value under the producing execution's protection
before the record is serialized. Each optional string — identities, build
versions and digests, model names, currency — is withheld on its own when it
fails the secret scanner or matches a protected input, which a scanner opt-out
does not waive; field-withheld then joins the limitations. The complete event
still crosses the unchanged journal gate.
The current reader validates a present usage completely and refuses the record
when it is malformed or carries an unknown member. A record without usage —
including every record written before it existed — reads as unknown and is never
backfilled. Completed replay returns the retained value and limitations without
reaching a provider, refreshing a measurement or recording more spend.
The coordinator the Agent package delivers to an installed provider carries one optional member:
export type PromptUsageReporter = (usage: PromptUsage) => void;
promptUsage?(): Operation<PromptUsageReporter | undefined>;A provider calls it once when its stream is actually subscribed, before any
native work, and keeps the receiver for that turn. The receiver belongs to that
one subscription: the Agent package opens it when the subscription starts, keeps it open
through the subscription's joined teardown and seals it afterwards, so a
retained receiver records nothing later and two subscriptions of one cold stream
never share one. A canonical turn whose stream was subscribed more than once
retains only an association-ambiguous receipt. Reporting is synchronous
observation: it appends nothing and establishes no identity, checkpoint or
outcome. An absent member, an undefined receiver and a report that never came
all leave usage unknown and refuse nothing.
The same delivered coordinator carries an optional promptUsage() receiver, the one
route by which a provider's turn readings reach the Prompt that consumed them. The Agent package
creates one usage destination per actual stream subscription inside the audited
stream that already carries the permission ledger, opens it before the provider's own
subscription and seals it after that subscription's teardown joins; the canonical
runner reads it afterwards, under the producing execution's disclosure, and the
existing agent_prompt append retains it. A receiver is observation only: it appends
nothing, authorizes nothing, and its absence or failure leaves execution unchanged.
The ACPX provider reports from its one reader of the turn, outside its failure
handling: an acquisition, normalization or receiver failure leaves the turn's
events, text, outcome and cleanup exactly as they were. A provider installed
without a host's usage facts (promptUsageHost) reports nothing.
A native session launch is not a prompt and does not reuse agent_prompt. It
retains its own agent_session_launch records, one per completed phase, so an
interrupted launch resumes the provider session it already prepared rather than
creating a replacement; the shape is specified in
native-agent-session-launch-spec.md.
Prompt records keep the existing native-only agentSessionId from the Session
that actually started, including its first configured turn. Passive tagged
information adds no PromptRecord member, persistence format or interpretation
of historical records.
A completed replay contacts no provider, so it neither reads nor applies any configuration. A successful prepared launch reapplies its one canonical configuration to the exact retained Session before it continues; an unconfigured record performs no configuration read. Live prompt and launch records always derive their configuration from the final routed authentic use, never from a requested/effective pair.
Config (@executablemd/runtime, re-exported from @executablemd/core) is the
shared execution config. It carries three optional timeouts in milliseconds,
and there is no timeout by default: each is undefined until something
configures it, and undefined means the operation is not bounded. It carries
one boolean besides, which bounds nothing.
| Field | Default | Bounds or states | Consumed by |
|---|---|---|---|
timeout |
undefined |
the entire run, preparation and execution together | the outer run boundary |
timeoutExec |
undefined |
each exec block | exec blocks and the built-in timeout modifier |
timeoutFetch |
undefined |
each Fetch | Fetch |
verbose |
false |
whether the reading scope renders verbose-only content | Verbose |
Override a field for a scope with
yield* Config.around({ timeoutExec: () => 30_000 }, { at: "min" }).
Installing at min is what lets a nested override win. Omitting a field
inherits the enclosing value; it does not clear it. The validated timeout,
timeoutExec and timeoutFetch operations each return a positive, finite
number of milliseconds or undefined, and throw on any other value (zero,
negative, NaN, Infinity, or a non-number) before the operation they would bound
starts.
verbose is not a timeout and is owned by nothing the three timeouts are owned
by. It is false rather than absent — a scope either renders verbose-only
content or it does not — and it is installed and overridden exactly the way a
timeout is, so an at: "min" override decides what the installing scope's
descendants render and leaves every enclosing scope and every following sibling
reading the value they already had. The validated verbose operation returns
that boolean and throws on any other value, including one an untyped JavaScript
consumer installs, at the point a reader asks rather than as truthiness.
Configuring it moves no timeout, and configuring a timeout does not move it.
Ownership is strict, and nothing falls back to a field it does not own. A
per-call timeout always wins where one is supported; otherwise Fetch resolves
timeoutFetch, and an exec block resolves timeoutExec at the block and hands
it to the Process operation explicitly. The Process operation itself consults
no configuration: what bounds a command is what its caller asked for. Agent
prompts and service startup are bounded by what a document or caller declared
for them, never by the run deadline.
The run deadline encloses everything above, so a longer exec or Fetch timeout cannot outlive it. Its expiry is Effection cancellation rather than a result, so structured teardown still completes before the process exits.
PermissionMode selects the policy that answers Agent.requestPermission. It
is approve-all, approve-reads, or deny-all:
- approve-all selects
allow_once, thenallow_always. - approve-reads approves the
readandsearchtool kinds and asks for everything else. Asking prompts only on an interactive TTY. - deny-all uses the base deny behavior, so it installs no policy of its own.
A policy decides every request inside its scope. When it cannot approve — no allow option is offered, there is no TTY, or no valid option is selected — it denies with the base semantics rather than deferring outward, so a policy nested inside a more permissive one can never be overruled by it. Every permission request therefore receives a concrete decision.
The retained Claude and Codex adapters use their host-installed CLIs through the transient child-environment seam. The profile supplies no machine-session executable observer, coordinator or route store.
Each adapter names the backend conversation in its own way. Claude's adapter confirms it through SessionStart; Codex's adapter reports the App Server thread on its session response. Either way, the profile publishes no mapping until the provider saves the accepted first turn.
xmd workflow installs a stricter profile than xmd run, and installs it only
while a live or partial run is attached. A completed replay restores its Prompt
records without contacting a provider at all, so it starts nothing.
Under that profile an Agent receives no Workspace, checkout, materialized root,
caller path or ACP additionalDirectories. Its process runs in a directory the
host owns: created empty before the session is established, never written to by
this host, never read back, and removed when the attachment ends. The runtime
is created with mcpServers: [], each session with allowedTools: [], and the
permission mode is deny-all with non-interactive denial.
A fixed session instruction layer states that boundary to the Agent in the same terms, and states all of it: that no native tool is authorized; that retained work can be asked for only when the prompt being answered asks for it and only in the exact closed shape that prompt supplies; and that nothing the Agent returns carries permission — source it writes is data this run may admit under ceilings decided before the prompt was sent. Those instructions are part of the policy fingerprint below, so changing them refuses a session created under the previous wording rather than continuing it under new terms the session never received.
allowedTools and mcpServers are stated as empty arrays rather than omitted:
omission is ACPX's own default, and this host is making a different statement.
The profile states both native capability sets empty for the same reason. A
workflow session belongs to a run — named by a row in the run's own database,
arranged in the run's own sidecar, continued by reattaching that row — and the
machine-wide account of ownership, construction routes and executable builds
describes a different thing entirely. Inheriting the package's advertised sets
by omission would make an ordinary workflow Claude prompt demand machine
ownership and a route this profile has no way to give it. Workflow sessions use the current selected executable and the provider's
positive confirmation of their retained native identity. They follow the same
quiet-continuation policy as ordinary and held sessions. The workflow profile
supplies no diagnostic observer, machine coordinator or construction-route
store, and both native capability sets remain empty. The run mapping and
provider assertion retain their existing authority. No diagnostic baseline or
journal field is added.
A native permission request under this profile does not reach
Agent.requestPermission. The provider answers it: a reject option when ACP
offered one, otherwise cancellation — and the turn the request belonged to
fails with a fixed diagnostic, whatever the adapter reports afterwards. An
authored ApproveAll, or any other public permission handler, composes around
nothing here, because there is no native tool permission to widen. The
diagnostic names nothing the request carried: no tool title, raw input, path or
command.
This is what the host asks for and what it refuses. It is not a proof that every ACP adapter exposes no tool when asked for none; that portable proof is tracked separately and does not widen this ceiling.
Nothing else changes. Prompt is still exactly one turn, the Agent Api gains no
workflow-only operation, and xmd run keeps its caller-selected cwd, its
omitted MCP and session options, and its public permission routing.
A provider session outlives one execution, so a continued run reattaches the conversation it was having rather than replaying its transcript into a new one.
Each Session site owns one conversation. The engine-derived Agent/Session
expansion identity names it within the run. Authored names remain descriptive:
two sibling Session elements named review stay distinct even if middleware
changes their names. Provider and resolved agent command are compatibility
attributes; changing either refuses reattachment. ACPX's arrangement key does
not replace this logical identity.
Placement is inert. A strong-declared adapter supplies explicit first-turn
acceptance and an asserting provider save before the mapping commits. A
standard adapter supplies the ACP creation/loading target after ordinary
ensure. Both commit exactly one tagged assertion before first-turn disclosure.
Prefer acpx.agentSessionId when native identity is asserted, otherwise retain
acpx.acpSessionId solely as an ACP loading target. A pending strong record
asserts nothing. Public identity is published only after the existing provider
save and required host retention succeed, before started. A retention refusal
publishes no new association, preserves previous confirmation and leaves the
provider assertion available to existing reconciliation. Failure or
interruption after confirmation preserves it; an unconfirmed strong attempt
stays absent. Standard ensure can confirm loading identity even when its
subsequent Prompt fails. Neither outcome causes automatic resend. An ACP id
grants no native handoff or backend-acceptance claim. The
invocation identity contract
owns the opaque invocation claim; workflow Agent session continuity
owns the mapping transaction and interruption ordering.
Continuation is decided before a turn starts:
- no mapping and no assertion means nothing was ever established here, and a session may be created;
- no mapping and exactly one canonical assertion is the pre-commit window, and reconciles to that identity;
- a mapping whose identity, compatibility attributes and policy fingerprint agree, and whose assertion the provider still makes with the same kind and value, reattaches;
- a missing assertion, an assertion of a different kind or value, a changed provider, agent or policy, and more than one assertion are each one explicit refusal.
No refusal starts a replacement session. ACPX fixes a session's creation-time options when the ACP session is created and ignores them when it reuses a persistent record, so continuing without comparing the retained policy would be continuing a session created under a wider one.
The mapping is a row in the run's own database, committed in the run's own transaction: a mapping that could commit while the run did not would describe a session the run never had. What stays beside the run on disk is the provider's own session store and one empty working directory per session, both disposable.
xmd run configures the agent stack, and xmd plan settles the part of it
authorship needs — the provider and the default agent. xmd repl resolves the
same five fields from its own command line and installs the provider and
component half of the stack with its own interactive policy: it presents
permission requests and elicitations in its own surface, so it installs neither
readline permission handling nor a foreground launcher, and Session.Launch is
unavailable there (repl-spec.md). xmd test rejects those options, driving
agents through the deterministic test-agent stack instead.
That division also applies to a nested run profile. The outer xmd test
invocation supplies no live Agent configuration to a child and no contextual
provider crosses the child's isolation boundary. A direct TestAgent declaration
on one host="run" Execution explicitly selects the controlled test-agent
assembly for that child alone; without one, the child receives no Agent
provider from the outer test.
| Option | Meaning |
|---|---|
--agent-provider <name> |
the registered provider to install (default acpx) |
--default-agent <name> |
the default agent |
--approve-all |
approve every permission request |
--approve-reads |
approve reads and searches, ask for the rest (default) |
--deny-all |
deny every permission request |
The permission options are mutually exclusive. Invalid options and an unknown
--agent-provider fail before the document executes, with a non-zero exit
status.
The default agent resolves in order, each entry overriding the ones above it:
- the ACPX default agent,
- the
DEFAULT_AGENT_NAMEenvironment variable, --default-agent,- an enclosing AgentProvider
defaultAgent, - an explicit Agent
name, Promptagent, or Session.Launchagent.
The installed provider belongs to the run's DocumentExecution scope and
closes during its teardown.
Both commands also take the three timeout options:
| Option | Establishes |
|---|---|
--timeout <duration> |
the deadline for the whole run |
--timeout-exec <duration> |
the default timeout for each exec block |
--timeout-fetch <duration> |
the default timeout for each Fetch |
An option nobody writes leaves its field absent, which is no timeout. Each
value is a duration: a whole number with an optional unit — 500ms, 30s,
5min, 20min — where bare digits are milliseconds. The value is greater than
zero. Empty, zero, negative, signed, hexadecimal, scientific-notation,
Infinity, NaN, fractional and trailing-text forms are rejected, and the
whole argument has to match: 30 seconds is not a duration. The raw argument
text is what gets validated, because an argument parser may coerce or drop
these forms before they reach the check. A rejected value fails the invocation
before it prepares a document.
Both commands resolve codex and claude to the ACP adapter this build
carries, the way the workflow attachment does, and every other agent to the
command ACPX resolves for it. The snapshot is installed under
~/.xmd/adapters/<sha256> at the provider's availability probe — the first
point either command would run an agent — so an invocation that asks for no
agent installs nothing, and a second one runs what the first put there. An
embedded agent never falls through to the published adapter ACPX's own table
pins: a snapshot that cannot be verified or materialized refuses that agent.
Claude's snapshot is generated during deno task deps from exact public
adapter source, pinned SDK input and readable source patches. deno task setup
includes that preparation. A source build consumes the complete prepared module
and refuses missing or stale preparation; it does not fetch source, apply
patches or compile the adapter at runtime. JSR, npm and compiled distributions
carry that same generated snapshot. The installed Claude payload contains one
patched SDK runtime and no original SDK dependency or platform executable. Its
host executable selection, identity confirmation, first-turn acceptance and
cleanup behavior retain their existing contracts.
Codex retains its maintained archive and generated snapshot route, with
readable source changes and reproducible source/build correspondence under
release-process-spec.md §11. Its runtime package has no @openai/codex
dependency; fresh materialization contains no Codex CLI or platform executable
packages. The adapter launches the selected host executable under Availability
and Host-owned dependencies. Provider identity, first-turn acceptance,
completed-turn checkpoints and cleanup retain their existing contracts. Every
other provider retains ordinary registry resolution. The trade-offs are recorded
in decision 004.
One command asks an agent what it advertises, so a document can be written with the exact ids in front of you:
xmd agent options
xmd agent options codex
xmd agent options codex --model gpt-5.4
xmd agent options codex --model gpt-5.4 --jsonoptions is the one action. The grammar is fixed: one optional agent name,
--model <id>, --json, and nothing else. Another action, a second agent
name, an unknown option, an empty option value or a value on --json is
refused before an agent is resolved — because asking costs a conversation in
that agent's own history, and a wrong command line must not.
Omitting the agent resolves the one an xmd run that supplied no
--default-agent would use. An explicit name is this invocation's agent and
becomes no document-level default. --model selects a model for this
inspection alone, so the command can report that model's effort choices.
Some providers reveal their configuration only through a session, so the
command may create one: it connects, creates the provider session, reads it,
and closes without sending a prompt. The command creates no document run, model
turn, XMD journal or durable XMD session, and the provider may keep that empty
conversation in its own history — which xmd agent options --help states
before the command is run.
Human output preserves provider order and grouping, puts exact ids before display names and descriptions, and marks the selected value:
Agent: codex
Selected model: gpt-5.4
Models
gpt-5.4 GPT-5.4 (selected)
gpt-5.4-mini GPT-5.4 Mini
Effort levels for gpt-5.4
low Low
medium Medium (selected)
high High
Absence says so rather than printing an empty list:
Model choices are unavailable for codex.
Effort choices are unavailable for model "gpt-5.4".
--json writes version-1 JSON with members in the order version, agent,
model, effort; each choice as id, name, description, group; and
null — not an empty list — for a setting the agent does not offer.
The whole rendering is built before a byte is written. An unknown agent, a failed inspection, a malformed response or a rejected value exits unsuccessfully and writes no partial output. Neither rendering carries a path, a provider session identity, provider history or a credential. Selection diagnostics are:
Unknown model "gpt-x" for agent "codex".
Available options are: gpt-5.4, gpt-5.4-mini
Invalid effort level "extreme" for model "gpt-5.4".
Available options are: low, medium, high
Host Claude selection and adapter preparation run in the command's owning scope before the Plan writer's restricted work. Run and REPL assemblies use the same host selection; native attachment keeps the host's retained adapter registry.
xmd plan resolves that configuration once, for the one document it executes:
the plan command document that writes the Plan. It starts no program, so there
is no second consumer and no permission mode to settle — --approve-all,
--approve-reads and --deny-all are xmd run's and are refused by name
here. What is settled is the provider name, the default agent with its
DEFAULT_AGENT_NAME precedence, the adapters this build carries and the host's
own machine-session assembly, all before any catalog is built or any document
executes, so an unknown provider fails first. DEFAULT_AGENT_NAME is read once
per invocation.
The Plan writer profile takes exactly that answer. Its ceiling is the host's, assembled for that one document and not readable from the command line:
| The profile's provider gets | Stated as |
|---|---|
| one host-owned directory per logical session | agentCwd, ~/.xmd/plan/sessions/<sha256(name)>, required empty |
| no MCP servers | mcpServers: [], an empty set rather than an omission |
| no native tools on a fresh session | newSessionOptions.allowedTools: [] |
| a private refusal of every native permission request | permissions: "strict" |
| this build's own ACP adapters | agentRegistry, ACPX's table with the embedded snapshots over it, and the prepareAgent that installs one |
"strict" answers the request inside the provider: the request is denied, the
turn it belongs to fails, and no public Agent handler is consulted or can
intervene. So --approve-all, --approve-reads and --deny-all cannot widen
a ceiling that has nothing in it; they configure the approved document later. A
provider that cannot establish this ceiling refuses before session
materialization or a turn.
The Plan writer profile
refuses document mutations, commands, services and XMD-mediated network access.
Reads retain the ordinary host provider, middleware and effective
Permissions; the frame grants no read permission of its own. A failing Prompt
ends the whole authorship execution, so a turn that streamed text and then
failed presents nothing.
Those refusals are installed on a scope holding the document execution and nothing else, so what the ceiling covers is what it says it covers. It cannot tell the host's own acts from the document's on its own: a call carries no mark saying who made it, and a provider's work happens inside the execution that reached it — the Agent package constructs a root provider from within the document — so a refusal over that scope covers both parties. Two things the command does are the host's, and both run a command: installing this build's adapter, and opening the review form in a browser. The command therefore takes its own scope before it installs the ceiling and states those two acts as its own; they run there, and everything else stays refused. An ended command takes an unfinished install with it, and a failed open stays a warning beside the printed URL.
The Plan session-directory contract owns establishment, named versus invocation-unique lifetime and cleanup. The provider gets the same digest-derived directory on named continuation. A non-empty directory refuses before provider construction; an invocation-unique leaf that gains content or disappears at cleanup is preserved as found and fails authorship terminally. No caller or document selects its host dependency.
Only the profile's provider receives newSessionOptions.systemPrompt. It
carries one fixed statement — that an answer belongs to the message that asked
for it — and nothing else. Which shape any particular message wants, a Plan or
an explanation of why there is not one, is that message's own business, and
every message is the command document's to send in its own turns
(xmd plan). ACPX applies those options when it
creates a session and ignores them when it reuses a record. Without --session
the command places a name unique to the invocation, so each invocation is a
fresh conversation created under those instructions; --session <name> selects
an existing one under ordinary continuation semantics.
That document's scope closes before the structural admission and before
whichever sink the caller asked for: the source on stdout, or the --output
file. A teardown failure fails the command and no later phase happens. A later
xmd run of the approved Plan is an ordinary invocation with its own root
provider and its own lifetime: it inherits neither the assistant session nor
its instruction layer, because nothing passes between the two commands but the
source.
Installing a provider starts nothing. The first Agent API use validates the selected agent, and Agent, Prompt and Session.Launch resolve the agent through the Agent API before a turn or launch begins. A document that never uses an agent therefore never probes one, and a confirmed full replay restores its completed work without re-checking availability.
A failed availability check aborts expansion where it occurs: the content after the failed operation does not render, no prompt failure is aggregated, and the run exits non-zero. A turn that fails for any other reason remains an ordinary prompt failure.
For the retained embedded Claude adapter, live availability selects the host
CLAUDE_CODE_EXECUTABLE when nonempty, otherwise claude on the host PATH.
Relative selections resolve against the host execution directory. Missing or
unlaunchable selections refuse with host-install/selection recovery before a
model prompt; the SDK executable is never a fallback. Version output is
observation rather than an admission condition. Custom agent commands retain
their own selection, and completed replay performs no selection or launch.
The provider carries the selected executable into the matching ACP child environment and native argv. It does not use a second PATH resolution to replace that choice. Host selectors retain their joined, output-suppressed launchability check; the child's version text and exit status impose no version admission policy. Missing or unlaunchable selections remain availability failures. Supported custom commands keep their arguments and environment, and XMD does not guess the backend of an opaque wrapper.
Continuation produces no compatibility or undetermined-version notice and retains no new version baseline. Completed replay performs no selection, observation or launch.
For the retained embedded Codex adapter, live availability selects nonempty
CODEX_PATH, otherwise codex on the host PATH. Relative path selections
resolve against the host execution directory. Selection resolves to a canonical
executable regular file and verifies that it can start. Missing or unlaunchable
selection refuses before inference with guidance to install codex on the host
PATH or correct CODEX_PATH. A bad explicit selection does not retry the
default command. Version output and exit status impose no ordinary version
admission policy. No bundled CLI or download supplies a fallback. Custom
commands retain their selection; completed replay performs no host selection or
launch. Native work uses the same selected executable. Decision 004
records why Codex runs the host CLI.
@executablemd/acp implements the rootProvider seam over the ACPX 0.22.0 runtime source closure (the explicit first-turn materialization
barrier remains a local patch, recorded with what removes it in
packages/acp/vendor/acpx/PROVENANCE.md). The released promptStarted
transport acknowledgement is not backend acceptance. createAcpxProvider()
returns an AgentProviderFactory supplied directly to
installAgentComponents; useAcpxProvider exposes the same operations without
the Agent install, so several independent providers can run in sibling scopes.
The provider owns every resource it starts and creates the shared runtime
lazily on first use with the contextual cwd — nothing spawns at install, and no
timeout is invented for a prompt nobody bounded. A prompt carries the duration
its caller supplied, from Prompt timeout or the enclosing AgentProvider
timeout, and otherwise none.
-
Availability. The first use of an agent validates it through a disposable probe runtime's
doctor(); a non-ok report throws with the agent's code and details. Results are cached per agent. -
Sessions.
session()places a session by (agent, logical session, contextual cwd): resolution walks from the cwd up to the Git root and reuses the nearest existing record for the same agent command and cwd, otherwise names the exact cwd. The resolvedsessionKey— not the caller cwd — keys the session queue.A held conversation whose setup records a placement is not walked for: the key derived from today's command would name a place the conversation has never been. Its recorded
sessionKeyselects that exact record and the directory the record was created in, existing when it is not pending; with no record there it is new, and nothing elsewhere is substituted, so a used history refuses (§A conversation a trusted host holds open). A host'ssessionspolicy is still asked first, and its refusal still refuses before ACPX is contacted; when it answers the recorded key its details stand, and a different key it answers — one derived from today's command, say — does not move the conversation there. Before a Prompt records a placement, and for every ordinary Session, the walk and the policy decide placement unchanged.A session is new or existing. New says where a session will live and nothing more, and
session()returns it having contacted no backend, published no construction route, built no runtime, written no record and started no turn — so a Session.Launch nested inside that Session still gets to choose how the session is constructed. Existing says the route and the durable identity already exist, andsession()keeps its eager behavior for one: it takes ownership where the agent needs it, reconciles the retained route, ensures through the bound runtime, validates the exact identity and host mapping, releases the handle, and starts no turn.Directory resolution classifies a record still carrying ACPX's own pending marker as new, and a record without one — including every record written before deferred creation existed — as existing. A retained client-native route is existing even before ACPX has attached to it. A published
acp-firstroute is not: it is what a first turn writes down before it runs, and a first turn nobody accepted leaves exactly that behind.A
Sessionvalue must come from this provider'ssession(), and the test is the exact object it issued rather than the key inside it: a structural copy, a value another provider copy produced, and one whose provider scope has been torn down are all refused before any provider work, as is a value used with a different resolved agent. The provider keeps that object for the session's life, so a second Session element naming the same session is answered with it and a Prompt given it is acting on the thing that was pinned. -
Creation. The first subscribed Prompt constructs a new ACP session. An adapter declaring
acceptance: "first-turn-acceptance"uses the stronger barrier below; Codex and Claude declare it through the existing native adapter table. Literal commands and undeclared adapters use ordinary ensure instead. Strong construction ensures withmaterialization: "first-turn-acceptance", which makes ACPX persist a provisional record: the key is occupied and the serializedagentSessionIdis absent, so the record is occupancy rather than an assertion.AcpRuntimeTurn.materializedsettles when the session no longer awaits its first accepted turn — at once for a record that already asserts, and on the adapter's explicit signal for one that does not.The retained Claude adapter confirms its Query's backend
session_idfrom a successful earlysystem/hook_responsefor SessionStart, enabled by a fixed internal no-op command hook installed in settings before startup. It preserves user settings and hooks, selects the startup/resume matcher, and keeps one owned stream reader with unrelated messages buffered for normal handling. Its new/load/resume response carries_meta.agentSessionId; absent, failed, conflicting or mismatched confirmation refuses. Exact resume loads the retained history before another user prompt. Confirmation alone never promotes the provisional record or changes native allocation provenance.The signal is one exact versioned key,
executablemd.session-materialization/v1, carried as{"state": "accepted"}in the update metadata of a standard ACPsession_info_update. It is control data: ACPX consumes it, and it is never appended to the conversation, published as an event, exposed as prompt text or retained as a checkpoint token. Nothing else promotes a record — not a returningensureSession(), astartTurn()that returned, a synthesizedstartedevent, a first text delta, a terminal result, checkpoint metadata, an error code or a diagnostic.On acceptance ACPX promotes a copy of the live record by installing the identity the handle privately carries and removing the pending marker, saves that asserting record through the store's own atomic operation, updates the in-memory record only after that save returns, and then resolves
materialized. Promotion is serialized against live-checkpoint writes, so a promotion that failed is not later overwritten by finalization as though it had succeeded.materializedrejects when the turn fails, is cancelled, or ends without the marker, and the runtime observes that rejection itself so a consumer using onlyrunTurn()creates no unhandled rejection.The durable order is therefore: route, provisional non-asserting record, backend acceptance, asserting record, host mapping, and only then the events the turn produced. If materialization fails the provider removes no route, publishes no identity, calls no host mapping, gives up the handle so the next attempt creates rather than resumes, and leaves the exact
Sessionvalue pending for a retry. If it succeeds and the turn then fails, the session stays established: acceptance, not successful terminal text, is the boundary. Standard construction saves the ordinary ACP record, then calls the host identity callback with optionalacpSessionIdand assertedagentSessionId. The ACP id is a loading target, neverSession.agentSessionId. Configuration and permission routing precede execution, and started/deltas/terminal reflect the actual turn without private acceptance. A standard peer may independently assert native identity. A strong adapter that omits its marker never downgrades.Reopening loads/resumes the exact stored ACP id. ACPX reuses a persistent record in place only for the same command string and argv that created it, and would otherwise create a fresh conversation under the same key, so an established non-pending record — a held conversation's, or any ordinary or workflow session of a built-in adapter — is always ensured with
resumeSessionIdequal to that record's ACP loading target, through today's command and in the record's own directory, under the conversation's queue and ownership: a record ACPX can reuse in place is reused, and any other is loaded, whether the adapter changed or the same command changed from an argv array to its string. The loading target is not the native identity. The retained native assertion is the one the history's Prompt records assert, or — before the host acknowledged one — the one the provider's promoted record asserts, and the ensure carries it asexpectedAgentSessionId, whether or not the executable changed. A pending first-turn record is occupancy rather than an established conversation and keeps its acceptance and promotion order. An established session of an adapter that owes a native identity, with no retained assertion, refuses before loading. The live response must assert the retained native identity before settings are applied or a prompt is sent; an omitted assertion does not inherit the saved identity. The same check applies to a cold reconnect during the operation, and it costs no model turn. The ACP record retains its history and saved preferences, and the original construction route is unchanged. Native launch and attachment follow the same policy. A failed load uses the ordinary resume error. A different native identity, or an omitted identity when live confirmation is required, refuses withidentity-unavailable. A refusal at ensure sends nosession/newor prompt and leaves the record, history and route as they were. If a client disconnects after ensure, a refused cold reconnect preserves the original identities and prior history. ACPX can record the attempted submission before that load, even when it sends no prompt to the provider. ACPX saves the arrangement a load answers with before returning it, so after giving up a handle whose assertion it refused the provider saves back the record it read before the load: the refused assertion never stands as the record's own. The conversation stays usable for a later explicit action. Once reopened, the record names today's command and later turns reuse it in place. No load/resume capability refuses even an unused record. Failed loading never replaces a used or uncertain record; the released-32603fallback remains only for a provably never-prompted record. Supported resume-required errors becomeSessionResumeRequiredError, naming a later attempt with the same Session as the available remedy when the caller permits it, beforestarted. An ordinary Session's failure carries the bounded facts of Ordinary Session resume failure details under thesession-ensurestage; Agent screens them and owns the message. Prior messages, identity and configuration stand. A subscribed Prompt's refused user attempt and lifecycle changes may be retained locally; ordinary Session resolution has no attempted input and leaves the original record and history unchanged. A later successful reopen sends only the new request. -
Prompts.
prompt()returns a cold stream; each subscription is one turn owned by the subscriber. Onestartedprecedes output-streamtext_deltaevents, tool activity and XMD input outcomes. Oneterminalends the events, then the stream closes with the full concatenated reply text (including partial text on failure). A completed turn with an absent stop reason is treated asend_turn; any other stop reason is a failure. The completing response carries its own opaque_meta, including a real response arriving during timeout drain. A deadline that receives no response fails and supplies no checkpoint. Released cancelled results can carry raw response metadata; XMD associates a checkpoint only with a successful completed terminal incheckpoint.tsandevents.ts. Cancellation and failure never acquire one, and no local runtime metadata patch remains. The pinned in-process runtime preserves normalized origin and selected protocol code/message/details atfailRuntimeTurn. XMD selects the same fields from pre-prompt resume errors and their causes. Arbitraryacp.dataremains excluded. The shared/queue result projection is unchanged. The generated correction and its matching declaration are recorded in vendor provenance and offline Tier AV. -
Serialization. Prompts for one session run FIFO on that session's queue; different sessions run concurrently. A subscription enters that queue before any route, ensure or runtime creation for its session, and re-reads the session's state once the queue grants — so two concurrent first prompts on one session perform exactly one backend creation and the waiter continues the conversation its predecessor established.
withSessionRoute— the hook an embedder supplies throughAcpxProviderDependencies— wraps registry-dependent work (preparation, ensure/start) and is not held across turn consumption or across the wait on a session's own queue. The queues that serialize this are internal to the package. -
Inspection acquisition. An embedder can supply
withInspectionAcquisitionthroughAcpxProviderDependencies. It receives the selected agent and a caller-owned operation that it may run once or refuse before running. The operation covers availability and temporary session acquisition. The hook joins acquisition on halt before releasing any route pin. ACPX owns the handle and its release, and reads configuration after the hook returns. Without the hook, ACPX acquires directly. -
Permissions. ACPX permission requests are routed — keyed by the record's live ACP session id, refreshed on demand — to the in-flight prompt's scope and answered through
Agent.requestPermission; an ambiguous or unknown request fails closed. The permission callback always returns a concrete outcome and therefore never delegates to ACPX's fallback resolver. ACPX's own Promise-returning leaves are consumed withuntil; the provider's only Promise-producing adapter is theonPermissionRequestcallback, and the bridge itself is operation-based. -
Runtime partitions. ACP-first work with a host child-environment selector uses one runtime per selected agent and resolved command. Its selected environment stays fixed until its handles and in-flight reservations are released. ACP-first work without that selector uses one unbound runtime. A bound attachment uses one runtime per (resolved agent command, executable build binding), created with the observed path in
agentProcessEnvand torn down when its last handle closes. Acquiring a runtime to ensure through claims the partition, and anensureSession()that rejects gives that claim up — so the next attempt observes again rather than inheriting a live path nothing is holding, while a sibling ensure still in flight keeps the partition alive. Eviction requires no handles and no work in flight. A handle that came back is owned from that moment, on a provider-returned launch as much as on an attachment, and survives every later refusal — identity mismatch, a host that cannot retain the session, and a status read that fails all close it through its creator. A cancellation with an ensure still in flight waits for its answer rather than walking away from it — the call runs whether or not anybody is waiting — releasing the claim on a rejection and closing a returned handle through its creator before quiescence. A close that failed decrements nothing, evicts nothing, forgets nothing and withholds quiescence, which an operation answers from that ownership account rather than from the sessions a caller can reach. A managed session retains the partition that created its handle, and every turn, close, detach and teardown goes through that one — reaching for "the" runtime afterwards would open a second child for a session the first already owns. The released runtime snapshots the child-onlyagentProcessEnv. The child environment applies the session environment and then the transient overlay, so a transientCLAUDE_CODE_EXECUTABLEorCODEX_PATHoutranks a session value of the same name. Protected authentication values outrank both overlays. No local environment patch remains. -
Host-owned dependencies.
AcpxProviderDependenciescarries what a host, rather than a document, decides:advertiseNativeLaunchandadvertiseClientNativeAttachmentare two separate lists, and a profile whose session capabilities differ from ordinaryxmd runstates both explicitly rather than inheriting the package's defaults by omission;agentProcessEnvlazily selects transient child inputs for the resolved agent command on the availability probe and live runtime. Each embedded Claude or Codex default applies only to its matching retained command; another provider or deliberate custom command receives no default overlay for either agent. A native-capable operation selects through this same seam once, and carries that selection into its runtime and native argv. The inputs never enter durable session records or global process environment.agentCwdanswers with the directory an Agent runs in when the contextual one is not a directory an agent process could stand in;mcpServersandnewSessionOptionsare passed to runtime creation and toensureSession()exactly as given;permissions: "strict"selects the workflow profile's permission path; andsessionsreplaces directory-walk resolution with a host's own, answering with the session'sstateas well as its key and directory, and is where a retained session this host cannot continue is refused.sessions.recordSessionIdentity()is called where an assertion exists and not before: after the ensure that validated a reattachment, after ordinary ensure for standard construction, and after explicit acceptance for strong construction. Every one of them defaults to thexmd runbehavior above. -
A session host is both of its methods.
sessionsstays optional and its absence stays the ordinary walk, with no host database and nothing to record. Supplied, it answers both: a host that decides where every session lives is the host that holds what the provider confirmed stands there. So the provider callsrecordSessionIdentity()whenever a host is present rather than whenever the method is, and a supplied host missing it is refused as it is supplied — before a session is requested, before one is reattached and before a turn could create one — rather than being read as no host at all. A host refusal at any of the three sites is unchanged: the provider handle is given up through the runtime that made it, further use through that association refuses, and the provider's own assertion stands for the next attachment to reconcile. -
Teardown. Provider-scope teardown cancels active turns and closes each distinct runtime handle with an all-settled strategy, throwing a single error or an
AggregateErrorfrom the provider scope. Handle release joins accepted promotion and turn cleanup before giving up ownership. The join precedes the manager lock needed by finalization; accepted identity and history remain saved.
The headless XMD child backend uses the same live dispatch and original input
owners through its separately admitted child connection. xmd repl --attach <sessionId> attaches a UI to the same root and selected conversation. Its
opaque child ID is distinct from every outer ACP attachment mapping. ACP
cancel/close joins its exact exchange, while UI detachment and ACP connection
loss leave the parent-owned child alive. Shutdown and parent termination join
actual cleanup; reply text, accepted input, saved acknowledgement and joined
round are distinct.
Questions use standard elicitation/create, mode form, with the actual
message and standard requestedSchema. Optional metadata is exactly
_meta["executablemd.xmd-question/v1"] = {requestId, presentationId, schema}: the owner-held request ID, this
callback presentation ID, and the complete normalized schema. For a decision
approve/reject where approve requires a reason of at least eight characters,
standard required contains only decision; readable text describes the condition
and the complete schema retains if/then. The entire question and rules appear
as standard tool content before callback or capability refusal. A generic
client can read them without interpreting metadata.
Permissions keep standard session/request_permission, actual offered options
and existing policy. Optional _meta["executablemd.xmd-permission/v1"]
contains exactly requestId and presentationId. Each callback submits to the
captured exact original owner with no suspension between current-owner check
and settlement. Invalid responses keep it pending; corrections receive a fresh
presentation. No answer or permission is supplied automatically.
A presentation starts as standard tool_call, kind other, readable XMD title,
in_progress status and actual request content. Its response or retirement is a
standard tool_call_update with the same toolCallId, kind/title, readable
content and sole rawOutput member executablemd.xmd-response/v1. That closed
payload contains kind, requestId and presentationId plus:
| event | Outcome/detail | Final presentation status |
|---|---|---|
| response | accepted | completed |
| response | stale or not-submitted | failed |
| response | invalid, reason schema, original nonempty normalized issues; question only | failed |
| response | invalid, reason option-not-offered; permission only | failed |
| response | invalid, reason response-format | failed |
| retired | reason request-ended | completed |
No answer values, retained history or receipt sequence are added. Each presentation classifies at most one response and receives at most one retirement while open. Retirement and a later in-flight stale response are separate facts. Final status ends the presentation only. Acceptance proves original-owner acceptance, not publication, successful Prompt, completed round or cleanup. Missing matching response after submission stays unknown even if retirement or terminal arrives. Connection loss promises no delivery and authorizes no resend or receipt replay.
The trusted embedded XMD runtime advertises only form elicitation before initialize. Its private callback re-enters the exact subscriber scope already registered by the permission bridge and calls Core prepareElicitation/runPreparedElicitation with the actual message and complete schema. Core validates the parent input; the original child validator decides final acceptance. Abort, Prompt teardown or exact presentation retirement halts and joins that callback, removing parent input through existing signals without inventing a child denial or dismissal. Callback/parse/publication failure retains its cause and cancels/joins the local runtime before terminal and stream completion; it does not shut down the child.
The single native event reader maps responses into only two transient Prompt variants: question_answer_result carries questionId/inputId/result, and permission_decision_result carries permissionId/inputId/result. Request and presentation IDs map respectively to those IDs; result keeps status and invalid reason/issues. Retirement removes its exact input and produces neither variant. The existing live-turn/root view shows these separately from reply text. Core reply and durable Prompt records retain their text and terminal facts only; ordinary providers need not emit these notices.
Stock ACPX 0.22.0 provides no form input. It receives complete readable question content followed by a precise capability refusal, with the child still pending. A capable client or attached UI can answer that same original. Standard text/JSON notices remain useful without metadata; quiet output supplies no complete interaction receipt. Stock permission handling retains actual policy and gains no auto-approval flags. The older prepared Sidekick backend still cannot answer questions and retains its existing configuration and permission limits.
xmd sidekick acp --attach FILE serves the existing live REPL Sidekick over
ACP protocol 1. Its session ID and agentSessionId metadata name the issued
outer attachment mapping, not the underlying provider's native identity. The
REPL's --sidekick-acp startup sends and joins one real initialization message
only when no conversation is selected; it reports initialization failure before
publishing an endpoint. Existing selected history is reused without a duplicate
message. This uses the captured provider configuration and ordinary admission,
uncertain-effect and scoped-cleanup rules. Once the endpoint exists, outer ACP
session creation and exact load perform no provider turn. The mapping remains
bound to one live owner, execution, conversation and cwd; a failed exact load
fences fallback session creation on that bridge.
The executablemd.session-materialization/v1 accepted update is sent only
after the root acknowledges the actual saved message. It establishes outer
XMD-owner acceptance, independently of uncertain acceptance by the Sidekick's
provider. A successful completing RPC carries
executablemd.sidekick-exchange/v1 metadata with owner, execution,
conversation, message reference and joined completion. Cancellation returns
only after that exact exchange joins. Failed endings retain safe partial facts
and fail the RPC. Text, previews and the embedded runtime's timeout fallback
end_turn without completing-RPC metadata establish no joined exchange result.
A consumer can read/follow the known owner reference without another prompt; it
cannot infer or resend missing acceptance.
examples/agent-certification/
uses the ordinary literal-command ACPX path for local configurations and
ordinary orchestration. Its thirteen separate capability outcomes require
measured evidence; expectations and availability establish no passing
capability. The ordinary production availability probe remains in force.
Successfully joined stages permit independent later stages while exact native
cleanup remains unverified. Pending joins, actual teardown failure and
production ownership refusal stop admission. Existing owners still join
teardown. Cancellation attribution alone establishes no cleanup pass, and the
report grants neither durable identity nor a broader permission.
Qualification reports basic authentication, streaming and completion
independently of acceptance and identity. A started seed from a
strong-declared adapter proves gated acceptance; a standard seed reports
unsupported/acceptance-unavailable. Identity requires the started Session's
actual native assertion, independently of strength. Durable certification
additionally requires both stronger rows. Missing evidence does not erase an
independently measured basic pass. Local join and cancellation alone still
prove no remote backend termination.