Documentation — Instruction document reference
Reference · Configuration

Instruction document reference

agentd reads instruction documents in the instruction.md specification's first edition, instruction/1 (spec: "1"), with the official instruction.md Rust SDK (instruction-md), pinned to specification commit bf4f9a0. The syntax, the checks and the agent text are the specification's and the SDK's; this page is what agentd, as a host, does with a document: which blocks become configuration, under which grants, and what it says about the rest. For the task-by-task guide see Write and ship instruction documents.

The document

A document is Markdown with optional front matter (a YAML mapping between --- lines at the top) and optional backmatter (a --- separator after a blank line, then a YAML mapping whose first key is one of authors, owners, review, history, sources, approvals, notes, test_results, to the end of the file). Neither reaches the model.

Blocks are directives: a container :::kind{attrs} … :::, a leaf ::kind{attrs} on its own line, or a keyword line (MUST:, SHOULD NOT:, MUST (if …):, BECAUSE:). Every block that declares something has an id. The specification's registry defines the kinds, their attributes and their families; an unknown kind, an unclosed block, an invalid attribute and a duplicate id are errors and refuse the whole document.

The older :::!kind form is not instruction/1 syntax: a document with such a line is refused, naming it (instruction.md/legacy-syntax).

An instruction/workflow body is checked by the SDK against the language's node registry (invalid-workflow, limit-exceeded, extension-unavailable). What a valid workflow asks of this host — a start on an event agentd raises, a server it declares — is agentd's own check, at load.

Blocks agentd maps

Configuration is taken from the document's top level and from inside its layout blocks (section, tabs, columns, grid, card, details, steps, …), never from inside an example, a policy or any other block whose body is guidance.

BlockBecomesGrant
:::mcp{id src tools allow deny} (or ::mcp)an mcp.servers entry: id → name, src → endpoint, tools and allow → allow, deny → excludenone
::agent{id protocol=a2a endpoint binding src}an a2a.peers entry named id: endpoint, or the origin of an Agent Card src at /.well-known/agent-card.jsonidentity
::::agent{id title} with a body and no protocol, src or endpointa subagents.templates entry named id: the body is its instruction, read under the document's declared parameters; singleton: true when its body carries machinery (an instance child). Its own :::mcp, :::skill, :::workflow and :::config are the child's, never the document'sagents
:::workflow{id dialect="instruction/workflow"}a workflows[] entry; the body is the definition, its name required by the language. agentd/workflow is the same dialect.none; interface for a route
:::config{id dialect="agentd/config"}the document's configuration fragment, merged under the operator'snone
:::skill{id title trigger} with a body, no srcan inline skill named id: description (or title) and triggernone
::person{id}, ::role{id}a person a human step may be addressed to: to: <id> or to: "#<id>" is answered by the operatorsnone
::wallet{id account rails}the operator's security.payments.wallets entry named account; rails empty is any rail, otherwise it must name x402 version 2 (x402, x402/2)spending
:::allowance{id wallet currency max budget per times payees categories from until approve-above approver}a security.payments.allowances entry doc:<id>, its amounts as parameters resolve: wallet → the operator wallets its ::wallets pick, max absent → budget, a date-only from/until → whole UTC days, payees → origin hosts (a domain; an &service's src host), approver → the principal security.payments.approvers binds to it. Its body is delivered as textspending

Every other block is guidance, delivered as agent text and configuring nothing: rules, policies, context, examples, layout, resources, data, ::include (agentd does not load what a document composes).

Host-policy diagnostics

A connected object agentd will not activate stays in the agent text, unresolved, and is reported as a host-policy diagnostic (§17): a config.warning naming the line, the kind and id, the reason, and the code host-policy. The load continues.

Not activatedWhy
::agent{protocol=a2a} without the identity grant, or from a document that arrived over the wirethe grant, or the §7.8 floor
::agent with protocol other than a2a, a binding other than JSONRPC, or a tenantagentd speaks A2A's JSON-RPC binding and takes the tenant from the card
::agent whose src is not an Agent Card at /.well-known/agent-card.json, or an A2A agent with neither endpoint nor srcagentd finds an agent by its endpoint or that card
An agent agentd runs itself (no protocol, src or endpoint) without the agents grant; from a document that arrived over the wire, one that is not verified against a pinned publisher or whose signature does not attest agents; or one with no bodythe grant; a wire document's agents run only from a publisher the operator pinned; the body is the agent's instruction
An agent agentd runs itself whose id names a template in the operator's subagents.templates, a peer in its a2a.peers, or its agent.namethe operator's entry stands; the rest of the document applies
An A2A agent whose id names a template in the operator's subagents.templates or its agent.name; a :::config agent.name that names an operator template or peerthe operator's name stands; the rest of the document applies
An agent inside an agent's bodya child defines no agents of its own
:::mcp with neither a src nor both registry and serveragentd dials a server by its URL, or by a registry the operator trusts and the server's name there
:::workflow or :::config in another dialectagentd runs instruction/workflow and reads agentd/config
:::skill with a src that is not a SKILL.md on GitHubpackaged skills come from the configuration's skills:
::wallet and :::allowance without the spending grant; from a document that arrived over the wire, one not verified against a pinned publisher or whose signature does not attest spending; an allowance in a document that extends anotherthe grant; a wire document's allowances are paid under only from a publisher the operator pinned; agentd composes no base to hold an inherited allowance to. Said once for the document, and delivered as the SDK's sentence
::wallet whose account names no operator wallet, or whose rails leave out x402 (host-policy) or name only x402/1 (protocol-unsupported)agentd pays from the operator's wallets, with x402 version 2
:::allowance that draws on no wallet agentd pays from, or under an operator with no walleta document picks among the operator's wallets and adds none

::tool, ::service, ::source, and every object above, are listed by kind under document.declarations in agentd --capabilities.

What the model reads

The model reads the agent text (instruction-text/1) the SDK produces from the document, byte for byte:

ConstructThe model reads
Front matter, backmatter, commentsnothing
A ruleits canonical prefix (MUST:, SHOULD NOT:, NEVER:, MAY:, GUARDRAIL:), its condition as (if …), then BECAUSE: …
${name}the supplied or declared default value, where the specification permits substitution
An inline reference :mcp[label]{ref=#id}label (mcp; #id)
A policy, an instruction, a context### Policy: Title, then its body
An example### Example: Title, then its body quoted as Markdown
Any other block### kind: Title, an Attributes: JSON line, then its body; a structured body (a workflow, a config) as a fenced block

Plain prose with nothing the agent text would change is delivered as written.

Grants

agent.document_capabilities names what a document may use beyond the default. instruction/1 grants nothing by itself; these are agentd's.

GrantAdmits
identity::agent → a2a.peers
interfacea workflow with a webhook start or a wait {on: webhook}, however the document writes it
agents::::agent with a body and no protocol → subagents.templates
spending::wallet → an operator wallet, :::allowance → doc:<id> in security.payments.allowances, which only the document's own workflows pay under (payment: {allowance: <id>})

A document that arrived over the wire (url:, oci:, mcp:) never uses identity, whatever the operator granted or the author signed. Nor may it write a2a.peers through a :::config, or name a secret ({{secret:…}}, {{secret-file:…}}) in its configuration or workflows, or in the machinery of an agent it defines: the load is refused, since the secret would go wherever the document points it. It uses agents only when it verified against a pinned publisher (agent.instruction.trust) and the author's signature attests agents, and spending only when it attests spending.

An agent written inside another agent's body, with a longer outer fence, is a report: its own template, labelled reports_to with the agent it is nested in. The label grants nothing. The operator can write a template's line itself (subagents.templates.<name>.reports_to and .title): an operator template of an agent's name carries the operator's line, and a document agent the operator does not name keeps the one its nesting gives it (Reporting lines, Draw the org chart).

An agent's body is compiled as its template's instruction with no grant at all: an A2A agent or an agent in it stays text, and a webhook route in it refuses the document, as it refuses any template (an instance child has no listener).

A verified author signature caps the grant to the capabilities it attests; it never widens it. For a registry read with reader pinned, the delivery signature is checked too, and the grant is capped to author ∩ delivery ∩ max_capabilities; without reader, to author ∩ max_capabilities, and the delivery signature is not checked.

Configuration a document may write

A :::config fragment, and every block that maps onto configuration, may write only these paths. A path is checked with everything under it.

A document may writeWhy
workflows, streams, mcp, varsWhat the agent does.
a2a.peersAnother agent this one dials: an outbound connection, like an MCP server. Not its reports_to or title.
context, goal, knowledge, search, memory, limitsHow it thinks, remembers and bounds itself.
intelligence.model, .models, .roles.turn, .roles.think, .roles.decide, .roles.preflight, .roles.compaction, .roles.goal, .dialect, .budget, .timeout, .structured_output, .swap_policyWhich model, and how much of it.
agent.name, .approval, .ask_human_fallback, .ask_human_unowned, .conversation_budget, .max_parallel_turns, .on_workflow_finished, .preflight, .wake_onThe agent loop's own shape.
tools.narrow, tools.disablednarrow only adds trifecta tags and annotations; disabled only takes tools away.
skills.max_bytes, .max_loaded, .reference_prefixCaps on the skill loader.
store.kind, .durability, .checkpoint, .on_error, .timeout, .max_value_bytes, .prefixThe durability class and the caps around it, never the place.
lifecycle.run_until, .idle_grace, .until_signalWhen the agent is finished.
observability.log_level, .runtime_eventsHow loud the log is, and routing runtime events into a stream the document declared.

Everything else is the operator's. A path on neither list is refused too.

Operator onlyWhy
agent.document_capabilitiesThe grants that decide which blocks this document may use.
agent.instruction, agent.promptThe source, trust pins and decryption keys. A document that rewrote them would point the next read at itself.
agent.descriptionWhat the public Agent Card tells strangers this agent is.
agent.gate_channelsWhere gates are announced. A document never puts a channel on a gate.
agent.tools, tools.overridesThe tool grant, and re-routing a built-in onto a server. Lists concatenate when merged, so a document could only widen the grant.
securityThe gates: trifecta, egress, exec, policies, TLS trust, AAuth.
http, companiesEndpoints security.egress: closed is checked against, and the Companies agentd acts at.
identityWho work is done on behalf of.
a2a.listen, .url, .tls, .bearer, .principals, .device_grant, .cors, .push, .events, .introspectionWho may talk to this agent, as what, over which socket, and what the listener shows its clients.
a2a.peers[].reports_to, a2a.peers[].titleWhere a peer stands in the operator's org chart: a document declares a peer, not its place in the company.
webhooksInbound sockets and the auth on them.
intelligence.endpoints, .token, .token_file, .headers, .auth, .providersWhere model calls go, and the credential they go with.
intelligence.roles.approveThe model that answers asks on the operator's behalf.
intelligence.routesThe models preflight may move a turn onto.
subagentsA whole child agent. A document references a template; it does not define one.
store.file, .http, .mcp, .retentionWhere state lives, and how long finished work is kept.
lifecycle.drain_timeout, .exit_code_map, .run_id, .watch_configThe orchestration contract.
observability.log_content, .audit, .otel, .metrics_addr, .health_file, .events_ring, .traceparent, .status_valuesConversation text in the log, telemetry sinks, sockets and files on the host, and which memory status readers see.
skills.dir, skills.sourcesWhere skills are read from.

A refusal names every path the document wrote that it may not:

the instruction's :::config writes intelligence.endpoints — operator configuration is not a document's to set (§6 rule 4). …

Further rules for documents

RuleRefusal or effect
A model a document declares names no provider.writes intelligence.models.<name>.provider is refused.
A document cannot bind or grant MCP Events.the instruction declares mcp.servers[<name>].events — MCP Events bindings and grants are the operator's to declare
A workflow with a webhook start or a wait {on: webhook} needs the interface grant, however the document writes it, including workflows it references by file:, url:, uri: or dir:.… opens an inbound route on the operator's webhook listener — a served document may open one only under the interface grant
The fragment merges under the operator's configuration.At every key, a config file, environment variable or flag wins.
A turn model the operator names wins, in either spelling (intelligence.model, intelligence.roles.turn).The document's is dropped. A warning names a spelling the operator did not write.
A document's MCP server or A2A peer whose endpoint matches an operator's is that server or peer; one that matches none is added (under security.egress: open).One under a name the operator already uses, at another endpoint, is held as text: the operator's stands, a host-policy warning names it, and the document's steps naming it reach the operator's.
A document's workflow under a name the operator's inline workflows already uses is held as text.The operator's definition stands, a host-policy warning names it, and the rest of the document's machinery applies. Two definitions of one name from any other two sources are refused, naming the workflow and both.
A subagent template's blocks face the same boundary.It also may not write a2a, intelligence, store or lifecycle, which the parent composes for the child.

Instruction source settings

agent.instruction is the agent's standing instruction. It takes the short form, a single value, or the long form, an object naming one source plus its settings. It is reloadable, except trust, which is restart-only.

Sources

The long form names exactly one source. Naming two is refused; naming none, when the object has settings, is refused too. To run without an instruction, omit agent.instruction.

KeyFlagValueRead
text--instruction.textThe instruction itself, never read as a path or URI.—
file--instruction.fileA path. ~/ expands to $HOME.At load and on each reload.
dir--instruction.dirA folder path, or {path, glob, order}.At load and on each reload.
dir.glob--instruction.globComma-separated globs relative to path. ** recurses. Default *.md,*.markdown,*.txt,*.instruction.—
dir.order--instruction.ordername (default, path order) or date (modification time, oldest first).—
url--instruction.urlAn https:// URL (plain http:// to a loopback host only), fetched with a plain GET and no credential. Up to 3 redirects are followed, each held to the same rule and to security.egress; a redirect from https:// to http:// is refused, and so is a body over 8 MiB.At load and on each reload.
oci--instruction.ocighcr.io/acme/agent:v3 or …@sha256:… (oci:// implied), or {ref, cosign_key}.At load; a tag is polled.
mcp--instruction.mcpA resource URI any connected server serves, or {server, resource, events}. events lists MCP Events types, as a name or {name, arguments}, whose occurrences re-read the instruction.At runtime; followed by notification, poll and events.

Short form

A short-form value is classified, first match wins:

The valueRead as
contains a newlinetext
file://…a file
a single-token oci://…an OCI artifact
any other single-token scheme://…, https:// includeda resource an MCP server serves
no whitespace, ending in .md, .markdown, .txt or .instructiona file
no whitespace, starting /, ./, ../ or ~/, and ending in / or naming an existing foldera folder
no whitespace, starting /, ./, ../ or ~/a file
anything elsetext

A value read as a file that does not exist is refused, naming both readings.

agent.prompt and a subagent template's instruction take the same classification and the load-time sources text, file, dir, url and oci. For them, a short-form https:// value is fetched as url, and an mcp source is refused. agent.prompt drops backmatter from every source, with a warning; nothing else in a prompt is processed.

Behaviour

KeyFlagValuesDefault
refresh--instruction.refreshauto, off, or a duration.auto
unavailable--instruction.unavailableauto, keep, freeze, drain, exit.auto
unenforceable--agent-instruction-unenforceablewarn, refuse, ignore.warn
decrypt.keys--agent-instruction-decrypt-keysKey files, each an AGE-SECRET-KEY-1… identity, 64 hex characters, or base64.—
decrypt.passphrase--agent-instruction-decrypt-passphraseA {{secret:NAME}} reference, for age scrypt envelopes.—
trust--agent-instruction-trustA list of trust pins. Restart-only.—

refresh: auto does this per source:

Sourceauto
textNothing to re-read.
file, dirNo poll. Watched when lifecycle.watch_config is on; a change reloads.
urlNo poll. Fetched again on each reload.
oci with a tagPolls every 5 minutes.
oci with a digestNever re-read.
mcpnotifications/resources/updated, any events, and a poll every 5 minutes.

A duration or off changes the poll for oci and mcp sources. A trust pin's freshness still re-checks the source when refresh is off. A re-read updates the delivered text; configuration applies on a reload or restart.

unavailable applies after startup, once the source has gone unconfirmed past its deadline:

ValueBehaviour
keepCarry on with the last good instruction.
freezeFinish live work, refuse new work until a re-read succeeds.
drainFinish live work, then exit (0 for a daemon).
exitExit 6 at once.
autofreeze when a trust pin names a publisher for this source, keep otherwise.

At startup an unreadable source stops the start: exit 2 for a load-time source, exit 6 for an mcp source. See CLI, environment and exit codes for every exit code.

unenforceable says what a trust pin means when it names no key file this load can use: its author keys are registry instruction://…keys.json URIs, or none at all. warn logs one warning and loads the document unverified; refuse exits 2; ignore says nothing. A key file that cannot be read is not this case: the document is refused, exit 2, whatever unenforceable says.

Trust pins

Each entry of agent.instruction.trust:

FieldMeaning
uriThe document the pin applies to, such as instruction://acme/support. A signature's doc claim must name it.
publisherThe publisher the author signature must claim. A pin without one enforces nothing.
author_keysAuthor verification keys: files holding a raw 32-byte, hex or base64url Ed25519 public key, or instruction://…keys.json URIs a registry serves. Empty on a registry source: discovered from the read's publisherKeys pointer.
delivery_keysDelivery verification keys, in the same forms.
readerThis agent's reader id, such as agent://support-desk. Setting it turns on the delivery check on registry reads.
max_capabilitiesThis source's ceiling on the grant.
freshnessThe revocation deadline, a duration. When refresh is shorter, the shorter wins.

Signatures are JWS compact serializations, Ed25519 (alg: EdDSA), with spec: "instruction/1" claims, over digests written sha256:<hex>. The author digest is the document's stored bytes as they are; the signature travels beside the document: a registry read's metadata, a file's <path>.jws, an OCI layer's md.instruction/signature annotation. A delivery signature names its instruction-resolved/1 manifest (format, status, document, dependencies, resolved digest) and embeds the author signature, whose digest must be the manifest document's. Under a pin, a registry read of a version the registry marks revoked is refused, and the running instruction is kept.

The checks are the instruction.md SDK's. A refused verification carries a code agentd gives the SDK's reason: signature-typ-mismatch, audience-mismatch, digest-mismatch, unpinned-publisher, delivery-ceiling-exceeded, and attestation for any other, such as a signature that does not parse or has expired. agentd logs the message.

A binary built without the sign feature refuses any pin with a publisher. The release binaries include it.

Log events

These log lines follow an instruction through its life. See Events and metrics reference for the full catalogue.

EventWhenFields
instruction.readA document is read at load.reader, spec, digest, diagnostics, agent_text_bytes, mcp_servers, a2a_peers, workflows, skills, people, not_activated
instruction.loadedAn OCI, folder or MCP instruction is read.uri and manifest_digest (OCI); dir, files, glob, order (folder); server, uri, version_id, resolution (MCP); bytes, version
instruction.verifiedA registry read's signatures verify.uri, publisher, kid, capabilities, delivery_checked
instruction.appliedA registry read moves to a new version.uri, old_version_id, new_version_id, delivered_digest
instruction.updatedA re-read of an MCP instruction changed its text.version
instruction.eventAn MCP Events occurrence triggers a re-read.server, event_type
instruction.reread.failA re-read failed.server, uri, reason, err
instruction.subscribe.unsupportedThe serving MCP server offers no subscriptions.server, uri
instruction.unavailableThe source went unconfirmed past its deadline.uri, server, err, policy, trust_pinned
freshness.armedThe re-read timer is set.every_ms
freshness.recoveredA re-read succeeded after a freeze.uri
skills.discoveredInline skills joined the catalogue.origin: "instruction", skills

With agent.wake_on including instruction_updated, a changed instruction also leaves a note for the root conversation.

Next steps