ProtectedescapeKeeps ~{...} in inlined content literal. Function references are matched on the resolved
prompt text, so a ~{someTool} in a file anyone in the repository can edit would otherwise
attach that tool to every agent using the fragment. A zero-width space between ~ and {
breaks the match without changing what the model reads. {{...}} needs no such treatment, as
variables are not resolved recursively.
ProtectedescapeProtectedgenerateAdvertises the files by their <rootName>/AGENTS.md path, the path format the workspace tools
accept and return, so the model can pass it to getFileContent verbatim.
ProtectedgenerateInlines the single root's file. The content is raw Markdown and not XML-escaped; only the path, which is an attribute, is.
ProtectedisWhether the workspace root's AGENTS.md is put into context rather than advertised. Keyed on
the number of workspace roots, not the number of discovered files: a workspace with several
roots has no single project root whose file could stand for the whole session, even when only
one of those roots happens to carry an AGENTS.md.
ProtectedmergeInlines the content. A single root contributes its file verbatim; only a multi-root workspace gets provenance headings, mirroring how equal-priority prompt fragment sources are merged.
Protectedto
Resolves the three ways of consuming
AGENTS.md.A single-root workspace has an unambiguous project root, so its
AGENTS.mdis always in context, mirroring how other tools implementing the standard treat the root file. A workspace with several roots has no such file, so nothing is loaded and every discovered file is advertised instead, to be read on demand. AGENTS_MD_AUTO_LOADED_VARIABLE and AGENTS_MD_VARIABLE are therefore mutually exclusive by construction: at most one of them is ever non-empty.getFileContent, or nothing.All three resolve to the empty string when the workspace has no
AGENTS.md.