ADR 0109 — A person picks an agent's mode, for a thread or a message ​
- Status: proposed 2026-11-27 (card ANR-979). adam's side is built (adam-rs
2c2b551d(2026-11-27, "feat(a2a): agent-mode/v1 — folder modes, the extension, activation (#465)")); the orchestrator's side is not: no card read, activation, check,422, log member or web control. Contract:docs/api/agent-mode-v1.md(it holds the sequence and state diagrams). Pattern: ADR 0086 (the model pick), which this copies on purpose; the tier (ADR 0061) for the hold rule; ADR 0008 for the pattern. The scenario that will prove it (ANR-913) is unbuilt.
Context ​
An agent may work in more than one way: OpenCode's build and plan are the model. adam-rs decided that an agent can declare primary modes (a folder's modes/<name>.md: a prompt, tools: and permission: of its own, over the agent's), one of them the default, and that a person picks one per message. Its decision, verified 2026-11-27 (adam-rs docs/decisions/0039-the-agent-loop-takes-opencodes-structure-and-agents-get-plugins.md, section "The owner's answers (2026-10-11)", answer 3, read at origin/main e8809b4d; the file's last commit is 2c2b551d):
the choice travels as an optional extension of its own,
https://agents.vymalo.com/a2a/extensions/agent-mode/v1: the card declaresparams {modes: [{name, title, description}], default}, a message carriesmetadata[URI] = {"mode": "<name>"}, an unknown mode isInvalidParams, and an agent that does not declare it ignores nothing and works as before. The tier still caps every mode: a mode's rules only narrow.
The same answer leaves "the orchestration layer's side (the contract page docs/api/agent-mode-v1.md, an ADR, the composer's switch, carrying the mode on its own reworks like the tier)" to this repository. That is this record.
adam's side is built (verified 2026-11-27, e8809b4d): crates/adam-a2a/src/modes.rs, crates/adam-a2a-runtime/src/mode.rs, and the coder's card lists build (default) and plan. Its amendment of 2026-11-27 adds: InvalidParams already uses the code mode_not_offered; the mode is not echoed in task metadata (unlike the tier); a mode file's permission: is refused at load and only tools: narrows a mode.
Decision ​
- The wire is adam's, unchanged. URI
https://agents.vymalo.com/a2a/extensions/agent-mode/v1; cardparams{modes: [{name, title, description}], default}; a message carriesmetadata[URI] = {"mode": "<name>"}, with the URI inA2A-Extensionsandmessage.extensions. A message that picks nothing activates nothing and has no member. Effort and model are other extensions (ADR 0086) and are independent of this one. - The orchestrator reads the live card, every send (ADR 0008). A mode is offered only when the card lists the exact URI with well-formed
params: a non-emptymodesof distinctnames, adefaultthat is one of them. Anything else reads as "not listed". - A mode the card does not list is refused, typed, before anything is written.
422 mode_not_offeredwithoffered: [names](empty when the card lists noagent-mode/v1); nothing is written and nothing is sent. It fails closed, like the model pick: a person's choice is never dropped, never replaced by the agent's default. A card that cannot be read to check it is503withRetry-After; nothing is written. An agent that lists the extension and answersInvalidParamsleaves the message undelivered, with its reason, and the orchestrator never resends it without the mode. - A thread has a default and a message overrides it.
PATCH /api/threads/{id}takesmode(additive;nullclears). The client key on an AG-UI run isforwardedProps["vymalo.mode"]. The message wins, then the thread, then the agent's owndefault(which the orchestrator never sends: an unpicked mode is no member) when a new task starts. A thread default that the card has since dropped is a422for the message that resolves to it, naming the mode; never a silent fallback. The422codemode_not_offeredis aligned with adam's own name for itsInvalidParams;modeandvymalo.modeare this record's, matching the model pick (andvymalo.modeis also adam's run-context keyCONTEXT_MODE, asvymalo.modelis: no collision). The hold rule is the tier's (access-tier-v1.md): the mode holds until another is picked; the newest message that names one wins from the next step and one that names none leaves it. The ladder applies when a task starts; within a task an unpicked message keeps the task's mode, and clearing the thread default cannot bring a running task back to the agent's default. Reworks and answers mirror the tier: the job's last mode is carried on the gate's reworks, an A2UI action's delegation, an answer to a blocked job and an MCPansweror post while the job is unfinished; an MCPstart_joband a message to a finished job resolve it as a first message (message, thread default, nothing), and a mode is never carried from one job to the next. Nothing goes to a child's task: a child run starts in its parent's mode, adam's behaviour. The name onPATCHandforwardedPropsis any non-blank string of at most 64 bytes with no control characters (adam requires only non-blank, and folder file names vary); the card decides what is offered, with the422. - What is stored. The
user_messageholds the resolved mode as its own membermode: "<name>"(omitted when none); the thread row holds its default (its own column in each store, no event). A redelivery, a fork's first message and an edit that names none carry it; a thread's default is not copied into a fork or an export. Only the name is stored: never the mode's prompt, which is the agent's. There is no echo to log: adam does not put the mode in task metadata, so there is noagent_status.mode. - The capabilities document says it. The agent's entry in
GET /api/agentsand the AG-UI capabilities carry the modes the live card lists (name,title,description, and which is thedefault), and nothing when it lists none, so a client draws a switch only for an agent that offers one. - The access tier caps every mode (adam's rule). The orchestrator does not combine them: it sends the tier and the mode as two independent members, and the agent keeps to the narrower. A mode narrows by
tools:only; apermission:in a mode file is refused by adam at load, which constrains thechatfolder of the proof. - The web shows the control only when the live card lists a mode (a switch beside the tier's), nothing otherwise. Built later.
Consequences ​
- Nothing runs differently until an agent lists the extension. A plain A2A agent gets the same request as before.
chat-api.yamlchanges are additive only (modeonThreadPatch,ForkRequestand theuser_messagedata, theforwardedPropskeyvymalo.mode, one error code, one capabilities member onAgent), when the build lands.- Prerequisites of the proof: the coder pin (
compose.yamlabout line 196,dev/coder/UPSTREAM9f90f1e) predates adam-rs2c2b551d, so abump-adamcomes first; anddev/agents/chat/agent/needs amodes/folder with two modes that narrow bytools:only. - The proof is a scenario, unbuilt (ANR-913) in
dev/e2e-all.sh: see the page's "Conformance".
Alternatives rejected ​
- A member inside
pick(ADR 0086): the mode is a separate extension with its own URI, its own refusal and its own hold rule, so it gets its ownmodemember on theuser_messageand its own column.pickis the model and the effort: other URIs, other refusal codes (model_not_offered,reasoning_not_offered) and, for the model, a coupling to an endpoint and the run's lease that a mode does not have. (They hold like the mode in adam; that is not the reason.) - Folding the mode into the access tier: a tier is a limit the person sets on what the agent may do; a mode is a way of working the agent defines. A mode may be
planunder theautotier, and the tier caps every mode. - A silent fallback to the default for an unlisted mode: the person's choice would be ignored without a word.
- Sending the default mode on every message: it would activate the extension for nothing and pin the agent's choice in the log.
- Caching the card's modes: forbidden by ADR 0008; a mode removed in a new release would still be offered.
Proof (to build) ​
dev/mode-real-e2e.sh (ANR-913, unbuilt): see agent-mode-v1.md. Each test red before its fix.