Agent directives
Every page served to AI agents is automatically prepended with a default directive that tells agents how to navigate your documentation programmatically:
The URLs in the directive are generated from your site’s domain and basepath. The directive is injected after the frontmatter metadata section but before the page body, so agents see it first even if they truncate the rest of the page. It applies to individual page Markdown (.md/.mdx URLs), and human-facing documentation is unaffected.
Customize agent directives
To override the default, set a custom directive using the agents key in docs.yml:
To disable the directive entirely, set page-directive to an empty string:
Product and version context
On versioned or multi-product sites, Fern also adds a product and version context block to each page’s agent Markdown (.md/.mdx URLs and the Markdown API). The block names the product and version the page belongs to and, for versioned pages, links to the llms.txt index of each version so agents can switch to the right version instead of mixing content across versions:
The version ID is shown only when it differs from the version’s display name, and (default) marks the default version. The index list includes the versions in the page’s version group, excluding hidden and authenticated versions. Pages with no product or version context don’t get the block.
The context block is inserted directly before the page directive, separated by a blank line. It’s added alongside a custom page-directive rather than replacing it, and it’s still included when page-directive is set to an empty string. Content copied with the page’s copy button doesn’t include it.
The same text is also rendered in the page HTML inside a hidden element with the data-fern-agent-context attribute, so agents reading the HTML get the same context without it being visible to readers.