llms.txt for AI agents
When an AI agent visits a site, one of the first things it reads is /llms.txt: a short
Markdown file saying what the site is and where to go. Your PocketOne app has one already. Open
https://<your app>/llms.txt:
# Acme Notes
## MCP
This app has an MCP server. Connect an MCP client to:
https://notes.example.com/mcp
- Sign in: OAuth 2.1 with dynamic client registration. ...
It's built for each visit from three things: your app's name, a preamble you write, and sections that extensions
and your own code add. The MCP section is why it exists: an agent browsing your site has no other way to
learn it can connect to /mcp.
Anyone can read it. Put nothing there you wouldn't put on your home page.
Where the settings are
Open your app's dashboard at https://<your app>/_/, click Settings, then Extensions in the sidebar. The
llms.txt section on that page holds the settings below. Change what you need and click Save.
Say what your app is
In the llms.txt settings, write the preamble: Markdown that goes right under the app's name. A one-line summary as a quote, then a few sentences an agent needs before it does anything:
> Acme Notes: shared notes for small teams.
Notes belong to workspaces. Every note has an owner and a list of editors; only they can change it.
Start the preamble with your own # heading to use something other than the app name.
Add sections from your code
In any pb_hooks file, $llmsTxt.add(heading, content) adds a section:
// pb_hooks/llms.pb.js
$llmsTxt.add("Docs", `
- [API guide](https://notes.example.com/docs/api): every endpoint, with examples
- [Changelog](https://notes.example.com/changelog)
`)
Same heading, one section. Everything added under Docs, by you or by an extension, ends up in one ## Docs
section, in the order it was added. Headings appear in the order they were first added.
Build it on each visit. Pass a function instead of text and it runs for every request, so it can read your data.
It gets { origin, path }, where origin is the address the visitor used (https://notes.example.com), for links:
$llmsTxt.add("Public workspaces", (req) => {
const rows = $app.findRecordsByFilter("workspaces", "public = true", "name", 20, 0)
return rows.map((w) => `- [${w.get("name")}](${req.origin}/w/${w.id})`).join("\n")
})
The function may be async. Return "" to leave the section out this time. If it throws, its section is left out,
the error goes to your logs, and the rest of the file still answers.
The function runs with your app's full access, so it can read anything, and its result goes to whoever asks. Filter for public data yourself, as above.
The heading Optional means what the llms.txt convention says it means: agents short on room may skip it. Put
nice-to-know links there.
Write the whole file yourself
Put an llms.txt in pb_public (or pb_pages, or serve /llms.txt from a route) and it answers instead of the
generated file: the preamble and every section are left out. Delete it to go back.
Turn it off
In pocketone.yaml:
llms-txt:
enabled: false
/llms.txt then answers 404, unless you have a file of your own. On a hosted instance, ask your host to set
extensions.llms-txt.enabled: false.
Reference
- llms.txt extension: every detail, and adding a section from a Go extension.
- llmstxt/v1: the contract extensions add sections through.
- MCP for AI agents: what the MCP section points at.
Questions and comments
Comments are a GitHub Discussions thread; sign in with GitHub to post.