AGENTS.md injection: project guidance that cannot widen the grant
exarch injects AGENTS.md instruction files into the system prompt as a
Workspace section — project guidance that steers behaviour but cannot widen the
grant. The files add prompt text, never capabilities, so the
question of whether a given AGENTS.md is trusted is decoupled from the question
of what it can cause: it can cause nothing.
Discovery
read_agents(roots, reader) (exarch/src/prompt.rs) gathers the files for each
root (the cwd, or each shared folder) outermost first, so the most specific file
is read last and its recency dominates:
- The operator’s
<config>/AGENTS.mdleads — from exarch’s own trusted config dir, the same rootconfig.ralloads from; it is absent where the host names no config base. - Then every repo
AGENTS.mdfrom the git root down to the root, deepest last. The chain ispath::git::work_tree_chain, stopping at the first directory holding a.gitentry — file or directory, so worktrees and submodules count — which bounds discovery to the project the agent was launched in. - Outside a git repo, only
cwd/AGENTS.md. The bare ancestor chain is not followed up into unrelated parents (the chain is truncated to one when no.gitroot is found).
Placement and semantics
- One
Workspacesection, present whenever anyAGENTS.mdis found. It is ordered after theHostsection and before optionalSkills/Surfacingsections, and is loaded regardless of--system— orthogonal to the persona and to interactive surfacing. - Each file is a read the grant stack judges, through
Boot::read, the same reader--systemfiles use; a file that is not there is skipped, one the stack refuses is skipped and said so, and any other failure is an error. No syscall site belongs toAGENTS.md: the read is the stack’s, not a program’s own file.
The authority distinction
These files add prompt text, never authority. That makes trust orthogonal to
effect, and the contrast with config.ral is exact:
- A cwd
AGENTS.mdis untrusted. It lives in the agent’s own writable tree, so unlikeconfig.ralexarch cannot assume the operator authored it. - It does not need to be trusted, because it cannot touch the grant. The accepted tradeoff is sound: a repository you enter can steer the agent’s instructions, never its authority.
config.ralis the mirror image — it is trusted (it lives in the config dir the agent cannot reach) and it can cause effects (it redirects transport), which is exactly why it earns a no-authority evaluation (provider-config-ral-script). A workspace file needs no such defence: text is inert.
The set of builtins is still discovered at runtime via help, which reads the
live resolver and cannot drift — AGENTS.md adds project context, not a tool
reference.
See also exarch-config-dir, exarch-architecture, grant, provider-config-ral-script, xdg-resolver-consolidation.