# Serve agents markdown

AI assistants read your pages to answer someone's question. With your edge install, Punchline can hand them a clean markdown version of each page instead of the full HTML, so they read your pricing and docs quickly and quote them correctly. This is acting at the edge: improving what agents get, not just counting them.

## Same facts, different format

- The markdown is made from **the page's own HTML response**, the same one people get. Nothing is removed for agents only or reworded: the page's main content is converted, and site chrome (navigation, footer, scripts) is left out. Nothing is added either, unless you turn on [share links](#share-links): then one line, a link to the same page, ends the markdown.
- **Search engines always get your HTML.** Googlebot, Bingbot and the like are never served markdown, so nothing changes for search.
- **People always get your HTML,** which then carries a `Link` header pointing to the markdown version.

## Who gets markdown

| Request | Gets markdown |
|---|---|
| AI assistants fetching for someone right now, and AI search (ChatGPT-User, OAI-SearchBot, Claude-User, Claude-SearchBot, Perplexity, Mistral, DuckAssist and others) | Yes |
| AI training crawlers (GPTBot, ClaudeBot, Amazonbot, CCBot and others) | Only if you choose *Also AI training crawlers* |
| Anyone asking with `Accept: text/markdown` | Yes |
| Anyone adding `.md` to a URL (`/pricing.md`, `/index.md` for the home page) | Yes |
| Search engines and people | Never |

Paths you exclude (like `/app` or `/checkout`) are never converted. Only successful HTML pages are converted; anything else passes through unchanged, and so does any page over 2 MB.

## Share links

Turn on **End each page with a share link** and markdown for assistants fetching for someone right now (ChatGPT-User, Claude-User, Perplexity-User, MistralAI-User) ends with one line:

```
---

Share link to this page: https://example.com/pricing?pl_ho=Q7mZp2KxW9aBc4DeF6gHj8Lk
```

It's a [handoff link](https://punchlineanalytics.com/docs/handoffs) your edge install makes for you, with no code: when the person the assistant is helping opens it, their visit is connected to the agent's, and if they go on to complete a goal, the handoff counts as converted. You'll find these under **AI & agents → Handoffs** as kind *page*.

- **A link, not an instruction.** The line states that a link exists, like a share button. It never asks the agent to do anything, and the rest of the page is unchanged.
- **Only live assistants.** AI search indexes, training crawlers, people and search engines never get one, so links don't end up in an index for strangers to reuse.
- **Nothing about anyone.** Each response gets a fresh random token, no query string is carried over, and the response isn't cached. Only the token's SHA-256 is stored, and only for verified or declared agents.
- **What to expect.** In our tests, assistants usually pass on the page's plain address rather than the share link, since they already know it (Claude: 0 of 15 trials). Share links still show which agent fetched which page; for a handoff the person reliably gets, make one for the action itself, like a saved quote or a held demo ([Handoff links for B2B](https://punchlineanalytics.com/docs/handoffs#for-b2b-sites)).
- **Business plan,** like handoff links.
- **Leave action pages out.** Add paths that do something when opened (like `/checkout` or `/book/hold`) to *Never convert*, so their responses aren't converted and don't get a share link.

## Turn it on

1. Install with the [Cloudflare Worker](https://punchlineanalytics.com/docs/install-cloudflare) or the [Next.js package](https://punchlineanalytics.com/docs/install-nextjs). The browser snippet can't change responses.
2. In **Site settings → Serve AI agents markdown**, tick the box, choose which agents, and list any paths to leave alone.

Edge installs pick up the setting within five minutes.

On Next.js, the proxy answers a markdown request by fetching the page's HTML from your own deployment and converting it. That inner request carries a header derived from your `PUNCHLINE_DSN` secret, so it's neither counted again nor converted again.

## See what was served

**AI & agents → Agent content → Served as markdown** shows how many agent reads got markdown, which agents, and how many got a 200. Each one is also an ordinary page view, labelled and counted like any other.
