Markdown for Agents and Statistics
Serve pre-generated Markdown files to AI agents via HTTP content negotiation.
Install in
Markdown for Agents and Statistics converts your WordPress content to Markdown and serves it
to AI agents and language model tools that request it via HTTP content negotiation
(Accept: text/markdown).
The Chancery Lane Project is a charity that helps organisations reduce emissions using the power of legal documents and processes. We’ve published this plugin as we believe that making content more legible for AI Agents makes a meaningful difference to their energy usage – not only by reducing the amount of tokens required (by up to 90% over HTML) to consume the content, but also minimising the server resources required to render, process and display pages at source.
How it works:
- Posts and taxonomy archive pages are converted to Markdown and saved as static
files on disk insidewp-content/uploads/. - When a visitor (or AI agent) requests a page with
Accept: text/markdownin
the HTTP headers, WordPress serves the pre-generated.mdfile directly —
no page render required. - A
<link rel="alternate" type="text/markdown">tag is added to each page’s
so agents can discover Markdown versions automatically.
Features:
- Content negotiation (
Accept: text/markdown,?output_format=md, or known AI User-Agents) - Taxonomy archive support — category, tag, and custom taxonomy term pages served as Markdown post listings
- Automatic Markdown generation on post save; taxonomy archives auto-update when any post in the term changes
- Background bulk generation — runs as a WP-Cron job with live progress, so it survives closing the tab and never times out a page request
- Per-post-type field configuration — choose which meta/ACF fields go in frontmatter or body
- ACF support with dot notation for nested group fields (e.g.
group.subfield) - Content fields option — use ACF fields as the body content instead of post_content
- Manifest generation with content hashes and change tracking per post type
- Incremental export — only re-export changed documents (
--incremental) - Delta file (
changes.json) for RAG system sync - Access statistics — logs AI agent requests with a dedicated stats admin page
- Access grouping by class of agent
- Optional frontmatter fields — hierarchy (parent/ancestors/children IDs), author display name, root-relative featured image paths
- Topics section — appends a
## Topicssection with linked taxonomy terms to the Markdown body - Export preview — preview generated Markdown inline in the post editor without writing to disk
- OKF directory indexes —
index.mdlistings at the export root and in every post-type and taxonomy directory (Open Knowledge Format), kept current automatically - OKF-compliant frontmatter and links —
timestampand flat cross-taxonomytagsfrontmatter keys, and internal links rewritten to point at the Markdown versions of pages (?output_format=md), always on - Downloadable OKF bundle — optional
.ziparchive of the export tree with relative internal links,manifest.json, and an ARD discovery catalog panel, kept fresh via bulk-generation rebuilds and a debounced WP-Cron schedule - ARD catalog generation —
ai-catalog.jsondocument for manual deployment to/.well-known/, discoverable by AI agent directories, shown automatically whenever the bundle toggle is on - WP-CLI commands:
generate,generate-taxonomies,generate-indexes,prune-stats,status,delete,bundle - Fully unit-tested
Written by Joobi from the project's own listing. See the source page
1.8.0
- Experimental: optional early serving, off unless you switch it on. Copy
mu-plugins/markdown-for-agents-early.phpintowp-content/mu-plugins/and Markdown requests are answered before other plugins, the theme and the main query load, using the same triggers, response headers and statistics as before. On one Pressable site that took a Markdown request from 250 ms of CPU and 28 MB to 13 ms and 6 MB. It finds the export from the URL path and serves it only if the file’s own permalink matches. It stands aside while anything hooks a serving filter it can’t apply, while a regular plugin or the theme hooks one of the two response filters it does apply or moves the uploads directory, and after a plugin or theme change until a full page load has checked again. It leaves any URL it can’t match, including the posts page, and any URL with a query string other thanoutput_format, to WordPress. Responses carryX-Markdown-Source: markdown-for-agents-early. It skips regular plugins and the theme, has been measured on one site only, and may change or be removed; read docs/early-serving.md first. - Developer: Markdown responses and their statistics are sent by a new
MarkdownResponderclass shared by both serving routes. No change to hooks or output. - Feature: Markdown served through WordPress (
?output_format=md,Accept: text/markdownor a known AI User-Agent) now names the page as canonical withLink: <…>; rel="canonical": the post’s own canonical URL fromwp_get_canonical_url(), or the term’s archive URL for taxonomy archives. Search engines and AI search indexes then cite the page rather than the Markdown. Direct/wp-content/uploads/…file URLs are served by the web server and don’t get the header. Newmarkdown_for_agents_canonical_urlfilter to change or omit it. - Feature: access statistics are now cleaned up automatically. Daily totals older than the period set under Settings Agent Detection Statistics are deleted once a day by WP-Cron. The default is 365 days, so no existing site loses data on update (statistics started in March 2026). Choose 30, 90 or 180 days, or keep everything.
wp markdown-agents prune-statsstill works for one-off clean-ups. - Feature: RiverBot and ibou-search are now recognised as AI search indexers. Both name themselves but were not on the list, so one site’s statistics missed about 1,650 of their page requests in a week (plus 3,300 Markdown requests from ibou-search, which were counted but not categorised).
- Feature: YouBot (You.com) and KeenableBot are recognised as AI search indexers, and ClueWeb-Crawler (Carnegie Mellon’s research corpus crawler) as a training crawler. KeenableBot and ClueWeb-Crawler are served Markdown on their User-Agent, because they asked for it or followed Markdown links; YouBot is counted but served HTML. The same three join the shared agent-signals list (revision 2) used by MfA Signals and MfA Homepage.
- Feature: AzureAI-SearchBot is recognised as an AI search indexer. It names itself but was not on the list, so one site’s statistics missed its 164 page reads in a week. It is counted but served HTML, because it never asked for Markdown, and it has no operator, because Microsoft doesn’t document it. It also joins the agent-signals list (revision 3).
- Feature: meta-webindexer, Meta’s crawler for Meta AI search, is now served Markdown on its User-Agent. It was recognised but served HTML, and on one site about 1,000 of its page reads a week got HTML while it followed Markdown links 58 times. Sites with saved settings are offered it once under Settings Agent Detection. The agent-signals list (revision 3) serves it too.
- Fix: a site whose saved agent list was empty when it updated to 1.7.3 now gets back the 13 agents that have been on the list since 1.1.0, including GPTBot, ChatGPT-User, ClaudeBot and PerplexityBot. The update treated them as deliberately removed, so they were never served Markdown on their User-Agent. A list that still holds any of the 13 keeps its removals. Sites already updated to 1.7.3 or later are not changed: check Settings Agent Detection and add any of the 13 that are missing.
- Fix: images in exported Markdown are no longer split from what follows them. A blank line was forced after any image followed directly by a character, which broke linked images (
[](https://example.com)lost its link), moved a full stop after an image into a paragraph of its own, and changed image syntax shown inside inline code and code blocks. Runwp markdown-agents generate --force(or regenerate from the settings screen) to fix files already exported. - Fix: a link that wraps a whole card (image, tags, heading, summary) now exports as one valid Markdown link. Headings, list items and blank lines were put inside the link text, so Markdown readers ended the link early, the card’s title and summary lost their link, and a stray
](url)was left behind. Link text that runs over more than one line is now joined into one line with single spaces. Heading, bullet and quote markers are dropped; all text, numbers and images are kept. Links whose text is already on one line are unchanged. Regenerate to fix files already exported. - Fix: shortcodes and blocks that read the current post now render against the post being exported. Generation ran with no global post under WP-CLI and cron, and with whichever post was already set during an admin save, so anything calling
get_the_ID()orget_post()with no argument got the wrong post or none. On one site, a report page’s key data exported as “No parent post found.” while the page itself showed the figures. The global post and the loop globalssetup_postdata()sets are restored after each post. Regenerate to fix files already exported. - Fix: the statistics screen shows the
Mozillalabel as “Unidentified (browser-like)”. It is what gets recorded when a client posing as an ordinary browser asks for Markdown, and it read like the name of an agent. Stored labels are unchanged. - Developer: new
markdown_for_agents_stats_sectionsaction on the Agent Stats screen, passed the date range shown. A companion plugin such as MfA Signals can add its own sections there, for example the pages agents read as HTML, which this plugin does not count. - Change: the admin menu is now “Agents”, with “Stats” as its first item. It read “Agent Stats” twice, and MfA Signals and MfA Homepage add “Signals” and “Homepage” under it. The page address is unchanged, so bookmarks and links still work.
- Fix: a post that moves to any non-public status now loses its Markdown file. Only private, draft, pending and trash were handled, so a published post that was scheduled again or moved to a custom status (for example by an editorial workflow plugin) kept its file. Serving was already blocked; the file stayed on disk and in the bundle.
- Fix: taxonomy archives no longer list password-protected or excluded posts. They showed the post’s title and its manual excerpt, which WordPress itself hides for protected posts. Regenerate taxonomy archives to fix files already exported.
- Fix: with automatic generation turned off, existing taxonomy archives are now refreshed when a post becomes private, draft, scheduled, trashed, password-protected or excluded. Before, they kept listing the post until the next manual run. Archives that do not exist yet are not created.
- Fix: the export directory’s
.htaccessnow usesRequire all deniedon Apache 2.4, keepingDeny from allfor Apache 2.2. Apache 2.4 ignoresDeny from allunless mod_access_compat is loaded, so direct requests for the.mdfiles could succeed. An unmodified.htaccessfrom an earlier version is replaced on the next write; a customised one is left alone. nginx does not read.htaccess: see the CDN and cache guide. - Performance: on HTML pages, the Markdown alternate for the
Linkheader and the<link rel="alternate">tag is now worked out once per request instead of twice.
1.7.4
- Fix: bulk generation is lighter on large sites. The
index.mdlistings were rebuilt from every published post at the end of every background tick, so each tick got slower as the site grew. They are now rebuilt once, after the last batch. - Fix: generation no longer fetches embeds. WordPress turned every embed URL (YouTube, Vimeo, block-editor embeds and so on) into the provider’s HTML. Because generation runs outside a page view, it missed the embed cache the site already had, so each embed meant a fresh HTTP request, including requests from the site to itself. The
<iframe>that came back was then converted to nothing. The embed URL is now kept as a plain link in the Markdown. Sites with many embeds generate much faster and put less load on the server while a job runs. Themarkdown_for_agents_autoembedfilter turns the old behaviour back on. - Feature: new
markdown_for_agents_tick_intervalfilter to set the pause between background ticks (default 1 second), so a small server can be given time to serve other requests while a job runs.
1.7.3
- Fix: child pages with the same slug under different parents (for example
/about/team/and/services/team/) no longer overwrite each other’s Markdown file. Child pages of hierarchical post types are now exported under their ancestors’ slugs (page/about/team.md); top-level pages and non-hierarchical types keep their paths. After updating, regenerate (Settings Generate everything, orwp markdown-agents generate) so child pages get their new files. Regenerating also removes the old flat files. - Fix: renaming or moving a post deletes its Markdown file at the old path, and renaming or moving a parent page regenerates its child pages at their new paths (when auto-generate is on).
- Fix: the
markdown_for_agents_export_pathfilter can now point at a directory that does not exist yet. Such paths were previously ignored without warning. - Fix:
wp markdown-agents delete --post-typenow removes files in subdirectories too. - Fix: Markdown responses no longer start with stray whitespace printed by a theme or another plugin (for example a tab after a closing
?>), which stopped strict parsers from finding the front matter. - Fix: sites with saved settings now pick up AI User-Agent strings added to the defaults in later releases. Each new default is added once, so strings an admin removed stay removed. Mozilla-style bot User-Agents (e.g. bingbot, Applebot) are now labelled by their own name in the statistics instead of ‘Mozilla’.
- Fix: Markdown requests for category and tag archives are now counted in the statistics. The statistics page lists term archives alongside posts (for example “Category: News”). The database table gains an
object_typecolumn; the migration runs automatically on update. Term history starts from the update. - Fix: HTML in frontmatter values (for example ACF WYSIWYG fields, titles and excerpts) is converted to plain text, and HTML entities are decoded. Regenerate after updating to clean existing files.
- Fix: internal links in exports now point at the target page’s canonical URL with
?output_format=mdinstead of the static.mdfile in uploads. Some web servers send those files asapplication/octet-streamor block them (403), so agents could not follow the links. Pagination links stay as HTML links. Regenerate after updating. - Fix: pagination links in exports generated from the block editor no longer point at
wp-admin/post.phpwith a nonce. Content is now rendered as if requested at the post’s permalink. - Feature: Generate everything, per-post-type generation and
wp markdown-agents generatenow delete Markdown files that the run did not rewrite, so files left at old paths (after a slug or parent change, or for posts deleted while auto-generate was off) are removed. Nothing is deleted if any post fails to generate.wp markdown-agents generate --incrementaldoes not delete files. - Feature: after updating, sites with existing Markdown files see an admin notice asking them to regenerate, with a link to the Generate everything button. The notice goes away when regeneration finishes.
- Feature: new
markdown_for_agents_post_relative_pathfilter to change a post’s export path. Unlikemarkdown_for_agents_export_path, it is honoured by manifests, index listings and link rewriting as well as generation and serving. The README has snippets for WPML and Polylang sites where translations share a slug. - Feature: new
markdown_for_agents_is_eligiblefilter to stop otherwise eligible posts being exported. - Feature: a Reset button beside Filter on the statistics page, shown whenever a filter or non-default date range is applied. It returns to the default view: all pages, operators, agents and methods over the last 7 days.
1.7.2
- Feature: the statistics page opens on the last 7 days by default. Last 30 days, This month, All time and custom dates are unchanged.
- Feature: statistics dashboard summary showing recorded Markdown requests, most requested page, leading agent and leading operator for the selected filters and date range. Ties are shown as ties, and deleted posts are labelled by ID.
- Feature: operator cards (OpenAI, Anthropic, Google, …) with per-agent totals. Selecting a card filters the summary, chart and tables while keeping other filters. Agents without reviewed operator details are counted under Unattributed, so the cards always add up to the total. New
markdown_for_agents_agent_operatorsfilter. - Feature: Top pages table listing the 10 most requested pages, with request counts and share of the total, for the selected filters and date range. Tied pages share a rank. Selecting a page filters the whole report.
- Feature: the statistics page filter is now a type-to-search box with suggestions, replacing a dropdown that listed every page ever requested. Page titles load in a single query.
- Fix: the statistics chart now includes Unknown requests (as a grey top layer), so each bar adds up to the day’s total and the chart matches the summary and cards.
- Fix: statistics cards no longer overflow the screen on narrow (phone-width) admin screens.
- Fix: count only singular Markdown GET selections. HEAD probes and other HTTP methods no longer inflate page-access statistics; negotiated response headers remain available.
- Docs: add Cloudflare rule ordering and free-plan limitations, a bypass-expression generator from saved agent options, complete LiteSpeed UA exclusions, both-order GET verification and CDN/static statistics caveats. Correct unconditional cache guarantees.
1.7.1
- Fix: frontmatter keys for nested (dot notation) fields are no longer dropped or renamed when two configured fields share the same leaf name, or when a leaf name clashes with an automatic key such as
authorortags. Colliding fields now keep their full dotted path as the key. Non-colliding fields keep their existing short key, so output for existing sites is unchanged. - Fix: taxonomy terms and posts used as frontmatter values are now serialised as their term name or post title instead of a class name, in list items as well as single values.
- Docs: new Caching section covering the cache headers the plugin sends, why a full-page cache can answer
Accept-negotiated requests before WordPress runs, and the LiteSpeed Cache exclusions and.htaccessrules to configure.
1.7.0
- Bulk generation now runs as a background WP-Cron job: starting a run returns immediately, and it continues in the background provided WP-Cron is working on the site. If WP-Cron is not working, progress only advances while a wp-admin page is open (see the FAQ for what to check).
- Fixed a bug where a run containing posts skipped for good reason (password-protected, draft, excluded from export) could run forever instead of finishing.
- Bulk generation no longer slows down the further it progresses through a large site.
- Generating taxonomy archives no longer loads every term of every public taxonomy into memory before starting, and the export bundle (
.zip) is rebuilt in its own step rather than tacked onto whichever request happens to finish last. - A run that is interrupted (e.g. by a server restart) now resumes automatically, without needing to be started again by hand.
- Progress now shows skipped counts separately from errors, and starting a second run while one is already in progress shows that run’s live progress instead of an error.
- Added the
markdown_for_agents_tick_budgetfilter, for site owners who want to tune how many seconds each background tick may spend.
1.6.2
- Refresh the default AI User-Agent list from 13 strings to 70, sourced from the Cloudflare Radar bot directory. Radar verifies bot operators rather than accepting community reports, and its
AI_ASSISTANT,AI_SEARCHandAI_CRAWLERcategories map directly onto the plugin’s existing On-demand, Search and Training intent categories. New entries includeMistralAI-User,Google-Agent,DuckAssistBot,meta-externalfetcher,Claude-SearchBot,Bravebot,Amzn-SearchBot,Cloudflare-AI-Search,KimiBot,PetalBot,GoogleOther,CloudVertexBotandICC-Crawler. Each entry inOptions::get_defaults()is annotated with its source. - Fix a mismatch between detection and stats categorising:
OAI-SearchBot,Claude-UserandPerplexity-Userwere classified by the stats “intent” categories but were absent from the detection list, so the On-demand category could never be populated from User-Agent matches. - Extend the intent-category map to cover every shipped User-Agent string. The change is strictly append-only: all thirteen original User-Agent strings are retained and each still matches to the same stored label and resolves to the same category as in 1.6.1, so existing statistics are unaffected. New entries use specific rather than broad substrings, so no agent’s history splits across two labels —
Applebotis deliberately excluded for this reason, since it would shadow the existingAppleb
Follow this listing's changes (Atom feed)