Skip to content
Tinbox

tutorials

Writing an llms.txt so agents understand your product

September 25, 2026

#llms-txt#geo#ai-agents#docs#seo
Interlocking email tool modules illustrate a composable developer interface.

An AI agent asked about your product reads whatever it can scrape: your nav, your hero copy, a cookie banner. If there is no clean, self-authored summary, it guesses, and the guess is what gets cited.

An llms.txt is a small Markdown file at /llms.txt that hands AI agents a curated, link-rich map of your product so they read it accurately instead of reverse-engineering your marketing site. The format is fixed and short: an H1 with your product name, a one-line blockquote summary, then H2 sections of - [title](url): description links. This guide writes one by hand, adds the llms-full.txt companion, gets the hosting right, and then shows how to generate both so they never drift.

What is an llms.txt file?

An llms.txt is a Markdown file served at your web root that gives LLMs and AI agents a concise, human-curated index of your site. It was proposed by Jeremy Howard (Answer.AI) in 2024 as a counterpart to robots.txt and sitemap.xml: where those tell crawlers what they may visit, llms.txt tells a reasoning agent what is worth reading and what each thing is.

The distinction that matters: sitemap.xml is a machine-crawlable list of every URL, optimized for breadth. llms.txt is a curated, prose-friendly subset optimized for comprehension inside a limited context window. You are not dumping every page. You are choosing the dozen-or-so links an agent needs to answer real questions, and labeling each one in a sentence.

The file has a deliberately rigid shape so parsers can rely on it:

# Product Name

> One-line summary of what this is and who it's for.

## Docs
- [Quickstart](https://example.com/docs/quickstart): Install and send your first request in five minutes.
- [Authentication](https://example.com/docs/auth): API keys, token scopes, and rotation.

## Guides
- [Webhooks](https://example.com/guides/webhooks): Receive and verify event callbacks.

## Optional
- [Changelog](https://example.com/changelog): Release notes, newest first.

The rules are: exactly one H1 (the name), one blockquote immediately after it (the summary), then any number of H2 sections, each containing a bulleted list of Markdown links with an optional : description after the link. An ## Optional section is a recognized convention for links an agent can skip if it is short on context. That is the whole spec.

Where do I put the llms.txt file?

Serve it at the web root, https://yoursite.com/llms.txt, as plaintext with a text/markdown or text/plain content type. It lives next to robots.txt and sitemap.xml, and like them it is found by convention at a fixed path, not by being listed somewhere else.

On a static host this is one file in your public directory. On Cloudflare Pages or a Worker with static assets, drop llms.txt in public/ and it resolves automatically. If you serve it from a route handler instead, set the header explicitly:

// Cloudflare Worker route, if you generate it dynamically
if (url.pathname === "/llms.txt") {
  return new Response(llmsTxtBody, {
    headers: { "content-type": "text/markdown; charset=utf-8" },
  });
}

One failure mode to check for: a single-page-app catch-all that rewrites every unknown path to index.html. If /llms.txt returns your app shell as text/html, no agent will parse it.

curl -sI https://yoursite.com/llms.txt | grep -i content-type
# Wrong (your SPA fallback is intercepting the request):
content-type: text/html; charset=utf-8

# Right:
content-type: text/markdown; charset=utf-8

If you see text/html, add an explicit static-asset rule for /llms.txt ahead of the catch-all, or serve it from a route that sets the content type itself.

How do I write an llms.txt by hand?

For a small, stable site, write it by hand in four passes: the header, the curated sections, the optional tail, and a sanity check on the links. Here is the complete process with a real example.

Step 1: Write the header block

The header is the part an agent reads first and trusts most, so make the blockquote a clean, accurate one-liner. No tagline fluff. State what the product is and who it serves.

# Acme Invoices

> API and dashboard for issuing, sending, and reconciling invoices. For developers adding billing to a SaaS product.

Group your highest-value pages under H2 headings. Aim for the pages that answer the questions people actually ask an assistant about you: how to start, how to authenticate, how to do the core jobs. Each link gets a one-sentence description written for comprehension, not SEO.

## Getting started
- [Quickstart](https://acme.com/docs/quickstart): Create an account, get an API key, and issue your first invoice in under ten minutes.
- [Concepts](https://acme.com/docs/concepts): How invoices, customers, and line items relate.

## API reference
- [Create an invoice](https://acme.com/docs/api/invoices/create): POST /v1/invoices with currency, line items, and a customer.
- [Send an invoice](https://acme.com/docs/api/invoices/send): Email a finalized invoice to the customer.
- [Webhooks](https://acme.com/docs/api/webhooks): invoice.paid, invoice.overdue, and signature verification.

Two rules keep this useful. Use absolute URLs, because the file is fetched out of context and relative links break. And write the description as a sentence a model can lift verbatim into an answer, because that is exactly what it will do.

Step 3: Add an optional section for the long tail

Put links an agent can skip under the recognized ## Optional heading. This is where changelogs, blog indexes, and legal pages go: useful, but not what a model needs to answer a how-do-I question.

## Optional
- [Changelog](https://acme.com/changelog): Release notes, newest first.
- [Status](https://status.acme.com): Live uptime and incident history.

A dead link in your agent-facing index is worse than no link, because the agent may report it as broken or fabricate the destination. Check them in one pass:

# Extract every URL from llms.txt and report its status code
grep -oE 'https?://[^)]+' llms.txt | sort -u | while read -r u; do
  printf '%s %s\n' "$(curl -s -o /dev/null -w '%{http_code}' "$u")" "$u"
done
200 https://acme.com/docs/quickstart
200 https://acme.com/docs/api/invoices/create
404 https://acme.com/docs/api/webhooks   <-- fix this before shipping

That 404 is the whole reason hand-maintained files get risky over time. You rename a page, the doc redirect works for humans, but your llms.txt still points at the old path. Which is the cue for the next section.

Should I write llms.txt by hand or generate it?

Generate it once you have more than a handful of pages, because a hand-maintained index drifts the moment you add, rename, or remove a page. The file's value depends entirely on it staying accurate, and the cheapest way to keep it accurate is to build it from the same source that builds your docs.

The mechanical part is straightforward: walk your docs source, and for each page emit one link line. The judgment part is what to include and how to describe it, which you encode once in the page frontmatter (a title and a description) and then reuse everywhere.

// Build /llms.txt from the same page metadata that builds your docs.
interface DocPage {
  slug: string;
  title: string;
  description: string;
  section: string; // "Guides" | "API" | "CLI" ...
}

function buildLlmsTxt(site: string, name: string, summary: string, pages: DocPage[]) {
  const bySection = new Map<string, DocPage[]>();
  for (const p of pages) {
    (bySection.get(p.section) ?? bySection.set(p.section, []).get(p.section)!).push(p);
  }

  const lines = [`# ${name}`, "", `> ${summary}`, ""];
  for (const [section, items] of bySection) {
    lines.push(`## ${section}`);
    for (const p of items) {
      lines.push(`- [${p.title}](${site}/docs/${p.slug}): ${p.description}`);
    }
    lines.push("");
  }
  return lines.join("\n") + "\n";
}

Now the index is a build artifact. Rename a page and the link updates; remove a page and the line disappears. No separate file to remember.

What is llms-full.txt and do I need it?

llms-full.txt is the entire documentation corpus inlined as plaintext, so an agent that wants deep detail fetches everything in one request instead of crawling dozens of pages. Where llms.txt is the index (links plus one-liners, small enough to skim), llms-full.txt is the book.

You generate it from the same page set, but instead of emitting a link per page you emit the page's plaintext body, with a clear delimiter and the source URL so the agent can still cite the canonical page:

function buildLlmsFullTxt(site: string, name: string, pages: { slug: string; title: string; plain: string }[]) {
  const parts = [`# ${name}: full documentation corpus`, ""];
  for (const p of pages) {
    parts.push("=".repeat(72));
    parts.push(`# ${p.title}`, `URL: ${site}/docs/${p.slug}`, "", p.plain.trim(), "");
  }
  return parts.join("\n") + "\n";
}

Then link to it from llms.txt so an agent knows the full text exists:

## Full corpus
- [llms-full.txt](https://acme.com/llms-full.txt): The entire docs corpus as plaintext, in one file.

Do you need it? If your docs are small, the index alone is plenty. If you have substantial reference material (API params, CLI flags, SDK signatures), llms-full.txt is worth it, because flattening that reference to prose lets a model answer detailed questions without you hoping it scraped the right table. Keep llms.txt lean and let llms-full.txt carry the weight.

How does Tinbox generate its llms.txt?

Tinbox generates both files from its docs catalog at build time, so they never drift from the actual product. This is the "or skip the hand-maintenance" path: the same catalog that renders the HTML docs also emits /llms.txt and /llms-full.txt.

The compact index follows the spec exactly: the H1, the blockquote, then sections for Guides, Tools, CLI, and SDK, each a list of - [title](url): summary lines. The header reads:

# Tinbox

> Self-contained email stack (inbox, transactional sending, and newsletters) that you deploy to your own Cloudflare account. Agent-first: every capability is a tool the AI assistant, an MCP client, and the `tinbox` CLI all share.

## Guides
- [Quickstart](https://tinbox.dev/docs/guides/quickstart): Deploy the full stack with one command.
...

## Tools
- [search_messages](https://tinbox.dev/docs/tools/search_messages): Full-text search the mailbox.
...

## Full corpus
- [llms-full.txt](https://tinbox.dev/llms-full.txt): the entire docs corpus as plaintext.

The full-text companion goes further: it serializes every agent tool, CLI command, and SDK method to plaintext, flattening each input schema into a readable parameter outline (name, type, required-or-optional, description). That matters because the same tool manifest drives the AI chat agent, the MCP server, and the CLI, so the docs an agent reads describe the exact tools it can call. (We cover that single-manifest pattern in one Zod tool manifest for MCP, chat, and CLI.)

Both files are emitted into the static assets and served by the Worker at /llms.txt and /llms-full.txt with no runtime work. Because they are generated from the catalog, adding a tool or renaming a guide updates the agent-facing corpus on the next build automatically.

Does llms.txt actually help, or is it cargo-culting?

It is a curation and accuracy tool, not a ranking trick, and it is honest to say no major model is contractually obligated to read it. What llms.txt reliably does is give the agents that do fetch it a correct, self-authored summary, which lowers the odds they answer questions about you from stale hero copy or a misread pricing table.

Treat it as one layer in a broader practice of writing for agents, the same way you would write clean semantic HTML and add structured data. It does not replace those. A site with garbage HTML and a perfect llms.txt is still hard for an agent that ignores the file. The win is cumulative: good HTML, FAQ and HowTo structured data on your pages, and a curated llms.txt together mean that however an agent reaches your product, it finds a version you wrote on purpose. For the rest of that playbook, see answer engine optimization tactics for developer tools.

If you are thinking about this because you want AI assistants to interact with your product and not just describe it, the next step past documentation is exposing real capabilities. For email specifically, that means turning your inbox into an MCP server so an assistant can search and send, and connecting Claude to your inbox in a few minutes. For the bigger picture of where the agent-first design fits, start at the Tinbox launch post.

A minimal checklist

[ ] /llms.txt resolves at the web root with a text/markdown content type
[ ] Exactly one H1 (your product name)
[ ] One blockquote line summarizing the product, right after the H1
[ ] H2 sections with absolute-URL links and one-line descriptions
[ ] An ## Optional section for the skippable long tail
[ ] /llms-full.txt for the full plaintext corpus, linked from llms.txt
[ ] All links return 200
[ ] Both files regenerate from your docs source on every build

Get those right and an agent asking about your product reads the version you intended, with working links and an accurate summary, instead of whatever it managed to scrape off the homepage.

Deploy this yourself: npx tinbox init yourdomain.com. The generated llms.txt and llms-full.txt ship with the docs build, and the format is documented under Docs in the console.

Frequently asked questions

What is an llms.txt file?

An llms.txt is a Markdown file served at the root of your domain (https://yoursite.com/llms.txt) that gives AI agents and LLMs a concise, curated map of your site. It has a fixed shape: an H1 product name, a blockquote one-line summary, then H2 sections containing Markdown links with short descriptions. It is the agent-facing equivalent of a sitemap, but written for reading comprehension rather than crawling.

Where do I put the llms.txt file?

Serve it at the web root as a plaintext file with Content-Type text/markdown or text/plain, reachable at https://yoursite.com/llms.txt. On Cloudflare Pages or a Worker with static assets, drop it in your public directory. It is a sibling of robots.txt and sitemap.xml, not something you list inside them.

What is the difference between llms.txt and llms-full.txt?

llms.txt is a compact index: links plus one-line descriptions, meant to fit easily in a context window so an agent can decide what to read. llms-full.txt is the entire corpus inlined as plaintext (guide bodies and full reference material), so an agent that wants everything can fetch it in a single request instead of crawling dozens of pages.

Does llms.txt actually help my site get cited by AI?

It is a curation and accuracy tool, not a ranking trick. No major model is guaranteed to read it, and it does not replace clean HTML or structured data. What it reliably does is give agents that do fetch it a correct, self-authored summary, which reduces the chance they hallucinate or cite stale marketing copy when they answer questions about your product.

Should I write llms.txt by hand or generate it?

Write it by hand if your site is small and stable; the file is short and the format is easy. Generate it from your docs source if you have more than a handful of pages, because a hand-maintained index drifts the moment you add or rename a page. Generating it from the same catalog that builds your docs keeps the two in sync.