llmstxt/v1

The app's /llms.txt: a Markdown file that tells an agent landing on the site what the app is and where to go. MCP clients don't need it (they find sign-in through /mcp and /.well-known), but an agent that only browses the site has no other way to learn the app has an MCP server, a docs site or anything else worth knowing.

The contract owns the sections. Any extension or pb_hooks file adds one, whoever provides the contract; the provider builds the file from them and serves it when the app has no llms.txt of its own.

A service (llmstxt.go).

Use

Add a section, in Register or later:

llmstxtv1.Add(app, llmstxtv1.Section{
	Heading: "Docs",
	Content: "- [API guide](https://example.com/docs/api): every endpoint, with examples",
	Source:  "myext",
})

A section built per request sets Render instead of Content (return "" to leave it out):

llmstxtv1.Add(app, llmstxtv1.Section{Heading: "Status", Render: func(e *core.RequestEvent) (string, error) {
	return "- Open since " + openedAt(e.App), nil
}})

Sections with the same heading merge under one ## Heading, in the order added; headings appear in the order first added. Optional keeps its llms.txt meaning: agents may skip it. Anyone can read the file, so add nothing private.

Declare WorksWith: extkit.IDs("llmstxt/v1"). pb_hooks add sections with $llmsTxt.add(heading, content) (see llms.txt).

Provide

Implement llmstxtv1.Builder (Build returns the whole file for a request) over llmstxtv1.Sections(app) and provide it. Serve it at /llms.txt only when the app has none of its own: a pb_pages or pb_public file, or a route, always wins. A section whose Render fails is left out and logged; the rest of the file still answers.

Extensions

Extension
llms-txt provides (default)
mcp works with
pages works with

License

MIT