Skip to content

dman1313/agent-ready-2

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Agent Ready Worker

Open-source Cloudflare Worker that makes any website agent-readable. No code changes to your origin.

License: MIT Cloudflare Workers

What this does

When you put this Worker in front of your site, it transparently:

  • Serves /llms.txt — auto-generated from your site, or override via KV
  • Serves /ai.txt — agent permission directives
  • Returns Markdown when an agent asks for itAccept: text/markdown triggers HTML→MD conversion
  • Injects <link rel="alternate" type="text/markdown"> into your <head> so agents discover the Markdown version
  • Injects schema.org JSON-LD if your page doesn't already have any
  • Sets Vary: Accept and canonical Link headers so CDNs and agents handle the responses correctly

Your origin server is unmodified. Roll back by removing the route — that's it.

These are the same checks the Agent Ready certification scanner verifies. Deploy this Worker and your site passes all of them automatically.

Quick start

# 1. Clone and install
git clone https://github.com/dman1313/agent-ready-worker.git
cd agent-ready-worker
npm install

# 2. Authenticate with Cloudflare
npx wrangler login

# 3. Create the KV namespace for per-site config
npx wrangler kv:namespace create AGENT_READY_CONFIG
# Copy the returned id into wrangler.toml under [[kv_namespaces]]

# 4. Edit wrangler.toml to set your routes
#    routes = [{ pattern = "yourdomain.com/*", zone_name = "yourdomain.com" }]

# 5. Deploy
npx wrangler deploy

That's it. Your site is now agent-ready. Verify with the Agent Ready scanner.

Configuration

All config is optional — the Worker has sensible defaults out of the box. To customize, write keys to your AGENT_READY_CONFIG KV namespace:

KV key Purpose Default
config:llms_txt Body served at /llms.txt Auto-generated from site name + URL
config:ai_txt Body served at /ai.txt Permissive defaults (Allow-RAG: yes)
config:jsonld JSON-LD object string injected into <head> WebSite schema with site name + URL
config:site_name Display name used in defaults Hostname
config:site_description Description used in defaults Generic placeholder

Set values:

npx wrangler kv:key put --binding=AGENT_READY_CONFIG "config:site_name" "My Company"
npx wrangler kv:key put --binding=AGENT_READY_CONFIG "config:site_description" "We make widgets."
npx wrangler kv:key put --binding=AGENT_READY_CONFIG "config:llms_txt" --path=./llms.txt

How it handles existing files

The Worker is conservative — it never overrides files you already have.

  • If your origin already serves /llms.txt, the Worker passes it through unchanged.
  • If your HTML already has <link rel="alternate" type="text/markdown">, the Worker doesn't add a duplicate.
  • If your <head> already has schema.org JSON-LD, the Worker doesn't inject another one.

You only get the Worker's defaults where your site has gaps.

Architecture

   Agent / Browser
        │
        ▼
┌──────────────────────────────────────┐
│   Cloudflare Edge — Your Worker      │
│                                      │
│   if /llms.txt or /ai.txt:           │
│     try origin first; fall back to   │
│     KV-configured or generated body  │
│                                      │
│   if Accept: text/markdown:          │
│     fetch HTML, convert via          │
│     turndown, return as Markdown     │
│                                      │
│   if HTML response:                  │
│     HTMLRewriter injects alternate   │
│     link and JSON-LD as needed       │
│                                      │
│   else: pass through unchanged       │
└──────────────────────────────────────┘
        │
        ▼
   Your Origin (unmodified)

Development

npm run dev        # Local dev server (wrangler dev)
npm test           # Run vitest test suite
npm run typecheck  # Run TypeScript without emitting

Performance & cost

  • Latency: HTML rewriting via HTMLRewriter is streaming — no buffering. Markdown conversion is the slowest path (~10-50ms for typical pages); cache aggressively.
  • Cost: Cloudflare Workers free tier (100k requests/day) is sufficient for most sites. KV reads on the hot path: 1-3 per HTML request, all parallel. KV free tier (100k reads/day) is also typically enough.
  • Workers Paid plan ($5/mo): removes request limits and adds CPU time headroom for the Markdown conversion path.

What this Worker does NOT do

  • It doesn't crawl or pre-render your site — it only transforms responses on demand.
  • It doesn't change your sitemap.xml or robots.txt.
  • It doesn't paywall the badge — the Agent Ready certification is a separate product covering manual review and listing.

Related

  • Agent Ready — certification scanner and managed install dashboard
  • llms.txt spec — the standard this Worker implements

Contributing

PRs welcome. Areas where help is most valuable:

  • Markdown quality — edge cases in turndown rules for cleaner agent output
  • HTMLRewriter coverage — handling unusual <head> structures
  • Tests — adding fixtures from real-world sites that don't convert cleanly
  • Multi-platform ports — Vercel Edge, Netlify Edge, Deno Deploy

License

MIT — see LICENSE.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors