# returnmd

> Middleware SDK that serves auto-generated markdown versions of web pages to AI agents and tracks agent versus human traffic.

returnmd is a service and npm SDK that detects requests from AI agents and returns a markdown version of the requested page, while human visitors keep receiving the normal HTML. It also provides analytics that separate people from agents and show which agents visit a site.

## What It Is

returnmd adds middleware or an edge function in front of a website. When a request's Accept header ranks text/markdown above text/html, or a request is made for a /path.md URL, the site returns an auto-generated markdown version of the page. People and bots such as search crawlers, link previews and plain HTTP clients get the regular HTML, along with a Link header pointing to the markdown alternate.

## Setup Path

A site is added in the dashboard, where returnmd detects the framework and host, creates a site key, and supplies a setup prompt for a coding agent. The SDK is installed with npm and configured with a RETURNMD_SITE_KEY environment variable. The docs give integration snippets for Next.js, Astro, SvelteKit, Vercel, Netlify, Cloudflare Workers, and any fetch-based server such as Hono, Bun or Deno. After deployment, the first real request verifies the site and starts a sitemap sync, which then runs daily or on demand with npx returnmd sync.

## Agent Analytics and Rules

The dashboard shows which coding agents and AI assistants visit, by page and by day, and attributes traffic coming from AI answers. Per-agent rules can block (403), redirect (307, regex supported) or keep the original HTML for chosen agents, operators, products or transports. If a site lacks robots.txt, sitemap.xml or llms.txt, returnmd can generate and serve them. The homepage states that it classifies 329 agents and bots and reports a median 97% smaller page size for agents; these are vendor-published figures.

## Privacy and Limits

returnmd uses no cookies; unique visitors are derived from a daily-salted hash and full IP addresses are not stored. Only public pages can be converted, only full page loads are counted rather than client-side SPA navigations, and each sync handles up to 250 changed pages.

## Features
- Automatic markdown versions of pages for AI agents
- Human visitors receive unchanged HTML
- Agent traffic analytics by page and day
- Attribution of traffic from AI answers
- Block, redirect or keep-original rules per agent
- Generated llms.txt, sitemap.xml and robots.txt
- Daily sitemap sync and CLI sync command
- Account API for listing and adding sites
- Cookie-free privacy-preserving visitor hashing

## Integrations
Next.js, Astro, SvelteKit, Vercel, Netlify, Cloudflare, Hono, Bun, Deno, Nuxt, Remix, WordPress, Webflow, Framer, Shopify

## Platforms
WEB, API, DEVELOPER_SDK, CLI

## Pricing
Subscription-based

## Links
- Website: https://returnmd.dev
- Documentation: https://returnmd.dev/docs
- EveryDev.ai: https://www.everydev.ai/tools/returnmd
