AgentContextKit
Updated 2026-12-02 · 6 min read

The llms.txt Specification Guide: Format, Sitemap Mapping, and Common Mistakes

Everything required by llmstxt.org—H1 title, summary blockquote, H2 link lists, and Optional fallback sections—plus how to turn an XML sitemap into llms.txt.

Traditional websites were designed for human navigation bars and search engine crawlers. When an AI coding assistant or web agent fetches your documentation URL, it often gets bogged down in navigation menus, cookie banners, footer links, and JavaScript hydration shells. The llms.txt proposal (documented at llmstxt.org) solves this with a single curated Markdown index placed at https://yoursite.com/llms.txt.

Required Structure of a Valid llms.txt File

A compliant llms.txt file uses strict, predictable Markdown sections so parsers can split it cleanly without fragile heuristics:

  1. 1. Single H1 Heading (Required): The very first non-empty line must be # Project or Site Name.
  2. 2. Blockquote Summary (Recommended): Immediately follow the H1 with a concise > summary explaining what the site or library does.
  3. 3. Optional Intro Paragraph: Plain text notes explaining version conventions or .md mirror URLs (avoid extra headings here).
  4. 4. H2 Sections with Bulleted Links: Group core pages under ## Documentation, ## API Reference, or ## Guides using - [Title](https://full-url): short summary.
  5. 5. Optional Fallback Section: Put secondary resources (changelogs, pricing, legal) under ## Optional so agents know what to skip under tight context limits.

Example of a Clean llms.txt

# Acme Webhook SDK

> Lightweight TypeScript and Go SDKs for verifying and replaying signed webhooks.

All documentation pages are also available in raw Markdown by appending `.md`.

## Documentation

- [Quickstart](https://docs.acme.dev/quickstart.md): Install the package and verify signatures in 5 lines.
- [Retry Policy](https://docs.acme.dev/retries.md): Exponential backoff schedule and dead-letter queue behavior.

## API Reference

- [Verify Endpoint](https://docs.acme.dev/api/verify.md): Request headers, timestamp tolerance, and error codes.

## Optional

- [Changelog](https://docs.acme.dev/changelog.md): Release notes across v1 and v2.

llms.txt vs. llms-full.txt vs. sitemap.xml

File Primary Purpose Typical Size
sitemap.xml Exhaustive URL discovery for Google & Bing crawlers Hundreds to thousands of XML URLs
llms.txt Curated human/LLM map with short descriptions 500–3,000 tokens
llms-full.txt Concatenated full-text Markdown of all core docs 20,000–200,000+ tokens

5 Common Mistakes to Avoid

  • Dumping every tag and pagination URL: Never paste a raw 500-URL sitemap untouched into llms.txt. Strip /tag/, /page/, and legal clutter first.
  • Using relative links: Agents fetching llms.txt frequently pass links across tools. Always use full https:// URLs.
  • Omitting link descriptions: Without the : description suffix, an agent cannot tell which doc page answers its question without fetching every link.
  • Nested H3/H4 trees: Stick to flat ## Section headings so simple regex and Markdown parsers stay reliable.
  • Serving HTML instead of plain text: Configure your CDN or _headers so /llms.txt returns Content-Type: text/plain; charset=utf-8.