Markdown for Agents and Statistics
·
Serve pre-generated Markdown files to AI agents via HTTP content negotiation.
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 inside
wp-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
- AJAX bulk generation with live progress counter — no page timeouts on large sites
- 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 file versions, 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
