Skip to content

Latest commit

 

History

History
248 lines (170 loc) · 59.2 KB

CLAUDE.md

File metadata and controls

248 lines (170 loc) · 59.2 KB

CLAUDE.md — repo guidance for AI agents (and humans skimming)

This file is read by Claude Code (and any other agent that respects the convention) before it works on this repo. Keep it short, accurate, and updated alongside the code it describes.

What this project is

specification.website — a platform-agnostic specification of what a good website does. Static Astro site, deployed to Cloudflare Pages from this repository's main branch. MIT licensed (code) / CC BY 4.0 (content).

Live: https://specification.website and https://specification-website.pages.dev.

Top-level rule: everything is derived from the content collection

The whole site is generated from one source of truth: Markdown files under src/content/spec/<category>/<slug>.md, with the schema in src/content.config.ts and the category list in src/lib/site.ts.

When you add, remove, or change a spec page, the following surfaces update automatically on the next build. Do not hand-edit any of them:

  • /checklist/ — every spec entry, grouped by category, tickable. Built by src/pages/checklist.astro from getCollection('spec').
  • /spec/ (index) and /spec/<category>/ (category indexes). Same source.
  • /spec/<category>/<slug>/ — the HTML page. Built by src/pages/spec/[category]/[slug].astro.
  • /spec/<category>/<slug>.md — the raw Markdown endpoint with YAML frontmatter. Built by src/pages/spec/[category]/[slug].md.ts.
  • /llms.txt and /llms-full.txt — the agent-facing indexes. Built by src/pages/llms.txt.ts and src/pages/llms-full.txt.ts.
  • /okf/ — the Open Knowledge Format bundle: one Markdown concept per spec page (okf/<category>/<slug>.md), a references/ concept per distinct cited source, per-directory index.md, a log.md from the changelog, and a root index.md carrying okf_version. Built by src/lib/okf.ts + the endpoints under src/pages/okf/; packaged into /okf.tar.gz by the astro-okf-tarball.mjs integration (hand-rolled ustar writer, no tar dependency) in astro:build:done. Advertised in /llms.txt, the api-catalog Linkset, and the AI Catalog. Do not hand-edit the bundle.
  • /sitemap-index.xml — built by @astrojs/sitemap.
  • /rss.xml — built by src/pages/rss.xml.ts.
  • The Pagefind search index — built by pagefind --site dist in the build script. Powers the /search/ page and the global ⌘K overlay.

If you find yourself editing the checklist by hand, you are doing it wrong. Edit the spec entry's front matter (status, summary, title) and rebuild.

Status discipline

The status field is the user-facing contract. Use it precisely.

  • required — the web platform contract breaks, or a clear class of users is harmed, without it. Examples: <title>, <meta charset>, HTTPS, image alt text, custom 404 returning 404.
  • recommended — a modern site should do it. Examples: CSP, HSTS, structured data, Open Graph, security.txt, /llms.txt.
  • optional — depends on context. Examples: image sitemaps, OpenID Configuration, IDN support.
  • avoid — outdated, harmful, or superseded by a working alternative. Examples: soft-404, empty links/buttons.

When in doubt, default to recommended, not required. The bar for required is "the platform breaks without it", not "we strongly suggest it".

Changelog

/changelog/ is the human-readable history of the spec. Unlike the checklist or llms.txt, it is not derived — it is a hand-curated content collection (src/content/changelog/<date>-<slug>.md, schema in src/content.config.ts). The page (src/pages/changelog.astro) renders entries newest-first, grouped by month. Each entry has title, date (ISO YYYY-MM-DD), a type (added | changed | status | removed), optional relatedSlugs, and a one-to-three-sentence body. A dedicated RSS feed is derived from the collection at /changelog/rss.xml (src/pages/changelog/rss.xml.ts, advertised in _headers, the api-catalog, and the page's <head>); the <li> anchor ids match the feed's #-links, so don't change one without the other.

The changelog is about the spec's content — pages, not plumbing. Whenever you make a larger change to what the spec says, propose a changelog entry in the same PR:

  • added — one or more new spec pages, or a new category.
  • removed — a spec page (or matching /.well-known/ asset) that was actually live and has now been deleted, e.g. because the convention turned out defunct.
  • status — a promotion or downgrade of a topic's status.
  • changed — a substantive rewrite of an existing page worth surfacing.

Always link to the page(s) inline. An "added a page on X" entry must link X to its /spec/<category>/<slug>/ URL in the sentence — never trail off with a link to the /spec/ index. List every page added, each linked.

Do not log: typo fixes, refactors, CI/tooling, dependency bumps, OG tweaks, new analytics events, header changes, or any site behaviour invisible on a spec page. British English in the body, and keep each entry to one-to-three sentences.

date is the day the entry lands on main, not the day it was written or the day the underlying standard moved. This is our site's changelog: it records when this spec changed, not when the world did. A PR authored on the 23rd and merged on the 31st is dated the 31st — so if a PR sits for a few days, re-date the entry (and rename the file to match) before merging. Mention the standard's own date in the body if it matters. The filename is <date>-<slug>.md and its stem becomes entry.id, which is both the <li> anchor on /changelog/ and the #-link in the RSS feed — so renaming an entry that is already live re-delivers it to subscribers as a new item. Re-date before merging, not after.

When you are unsure whether a change warrants an entry, ask the user — do not silently skip it. The clear-cut cases decide themselves (a new page always gets one; a typo fix never does). For anything in between — a partial rewrite, a citation overhaul, a reworded summary, a status nuance that isn't a full promotion/downgrade — surface it: "This change to X is borderline for the changelog — log it as a changed entry, or leave it out?" and let them call it.

Cardinal rules for content

These mirror CONTRIBUTING.md. Enforce them in your own writing and when reviewing.

  1. Cite primary sources. Every spec page needs 2–4 sources in front matter, weighted toward standards bodies: WHATWG, W3C, IETF RFCs, IANA, WCAG, schema.org, sitemaps.org, llmstxt.org. Then MDN / web.dev / Google Search Central for practical context. Avoid blog posts and vendor marketing. For any MDN link or browser-support claim, resolve it through the MDN MCP server (https://mcp.mdn.mozilla.net/, free, no auth) — it returns the current canonical URL (MDN reorganises its reference tree, so hard-coded deep links rot) and Baseline / BCD support data. MDN stays a context source; lead the citation with the standard.
  2. Stay platform-agnostic. Describe outcomes, not implementations. "Set Content-Security-Policy" is in scope. "Add this to your next.config.mjs" is not. Link out to platform docs instead.
  3. Be honest about status. If something is shipping as required but the platform works without it, downgrade to recommended. If the source URL is dead, replace it (Wayback Machine is acceptable) or remove the citation.
  4. British English. "colour", "behaviour", "internationalisation", "licence" (noun).
  5. Section structure. ## What it is, ## Why it matters, ## How to implement, ## Common mistakes, ## Verification. Last two are optional if they would not add value.
  6. Length. Up to ~1000 words of body content, and up to ~2000 for a topic that is genuinely hard to understand and earns the space. There is no minimum — if a page needs 400 words, it needs 400 words. Length must be earned by explanation, never by restating the assertion in different words. A good test: a real explanation makes some existing sentence redundant, so you delete it; an addition that deletes nothing is usually padding wearing an explanation's clothes.
  7. Name the wrong belief the reader arrives with. Accuracy is table stakes; it is not sufficient. A page can be true top to bottom and still leave a competent-but-not-expert reader with the wrong mental model. So for each page, ask: what does such a reader believe about this that is false or incomplete? Then name it and contrast against it — a definition is only useful once you know what it is being distinguished from (<title> is not <h1>; canonical is a hint, not a directive; alt="" is not a missing alt). Definitional confusions belong in ## What it is; mechanical errors belong in ## Common mistakes; if the contrast points at another topic, wire it into relatedSlugs. Some pages have no such misconception — those get no such paragraph. Do not manufacture one to fill space.
  8. Inline cross-links must carry the right category. A spec page's URL is /spec/<category>/<slug>/, and the category is the directory the .md lives in — not always the category of the page you're linking from. When you hand-write an inline link to another spec page, confirm its directory (ls src/content/spec/*/<slug>.md) before writing the path; do not assume the target shares the current page's category. (relatedSlugs is safe — the route resolver looks up each slug's real category — but raw Markdown links are not checked at authoring time, only by the Internal links CI job, which 404s on a wrong-category path.)
  9. Be aggressively current. Browser support moves monthly, and an undated support claim rots silently. When a page states what browsers support, name the Baseline status and the date it changed (e.g. 'Baseline newly available since October 2026'), resolved through webstatus.dev or the MDN MCP server — never from memory. When you edit a page for any other reason, refresh its support claims in the same change.

Architecture quick reference

Path Purpose
src/content/spec/<cat>/<slug>.md Spec content. Edit here.
src/content.config.ts Content collection schema. Edit if adding a field.
src/content/considered/<slug>.md Hand-curated register of standards deliberately not specced, with the reason and what would reverse it. Rendered at /considered/. Not derived.
src/lib/site.ts Site metadata + the canonical category list.
src/layouts/BaseLayout.astro HTML shell, head, dialog for ⌘K search, Plausible (PROD only).
src/layouts/SpecLayout.astro Spec page wrapper; emits TechArticle + BreadcrumbList JSON-LD; advertises Markdown alt via markdownUrl.
src/components/HeadMeta.astro <head> metadata, canonical, OG, Twitter, JSON-LD, RSS / sitemap / markdown alternates.
src/components/SiteHeader.astro Header nav. Contains the ⌘K trigger.
src/components/SiteFooter.astro Footer. Privacy / search links live here.
src/pages/spec/[category]/[slug].astro The dynamic HTML route.
src/pages/spec/[category]/[slug].md.ts The dynamic Markdown route.
src/pages/llms.txt.ts, src/pages/llms-full.txt.ts, src/pages/rss.xml.ts Derived endpoints.
src/lib/okf.ts, src/pages/okf/ OKF bundle generator + the .md endpoints that emit the /okf/ tree (concepts, per-directory index.md, references/, log.md, root index.md). Derived from the spec + changelog collections.
astro-okf-tarball.mjs (root) Astro integration; in astro:build:done it walks dist/okf/, writes a reproducible POSIX ustar archive by hand (no tar dependency), gzips it to dist/okf.tar.gz.
functions/_middleware.ts Cloudflare Pages middleware. Does Accept: text/markdown content negotiation on canonical spec URLs, on / (→ /llms.txt), and on /checklist/ (→ /checklist.md), and calls logBot() so crawler hits land in the AGENT_LOG Analytics Engine dataset.
functions/_shared/bot-detect.ts UA / signature-agent / cf-verified / Accept: text/markdown detection plus writeDataPoint() to the AGENT_LOG Analytics Engine binding. Never throws.
functions/reports.ts /reports collector for the W3C Reporting API. Browsers POST CSP/COOP/COEP violation, deprecation, intervention, and crash reports here (named by the Reporting-Endpoints header in _headers); writes one aggregate row per report to the REPORT_LOG Analytics Engine dataset (sw_report_log). Deprecation/intervention reports triggered by third-party (browser-extension) scripts are dropped — only same-origin sourceFiles are recorded. POST-only, never throws, returns 204; stores no IP, no cookies, no URL query strings.
functions/api/diagnostics.ts /api/diagnostics same-origin Sentry tunnel to the self-hosted GlitchTip project (org Joost, project specification-website). The browser SDK (public/vendor/diagnostics.js, bundled from src/diagnostics/client.ts by generate-assets.mjs, committed, SRI-pinned, PROD only) posts here. Fixed DSN/upstream, exact-Origin POST only, 64 KB cap, one event or transaction per envelope, 20/min per IP (HMAC-hashed with the DIAGNOSTICS_HASH_SECRET Pages secret, never raw) and 2,000/day site-wide in D1 (WEBSUB_DB, migration 0002), fails closed (503) without storage, 3 s upstream timeout, no redirects, relays Retry-After / X-Sentry-Rate-Limits. Scrubbing lives in functions/_shared/telemetry-scrub.ts and runs in browser and proxy. Kill switches: DIAGNOSTICS_ENABLED Pages secret (must be true; redeploy to apply) and site.diagnostics.enabled. Not itself instrumented. Tests: npm run test:diagnostics (set DIAGNOSTICS_BASE_URL for the HTTP suite against wrangler pages dev dist).
functions/admin/stats.ts /admin/stats dashboard. Queries sw_agent_log (crawlers), sw_mcp_log (MCP/A2A), and sw_report_log (browser policy reports) via the Cloudflare Analytics Engine SQL API using CF_ACCOUNT_ID + CF_ANALYTICS_TOKEN Pages secrets. Behind Cloudflare Access — the function assumes the caller is already authenticated.
public/admin-stats.js Tab + filter JS for /admin/stats. Extracted to a file because the CSP forbids inline scripts.
public/_routes.json Cloudflare Pages routing manifest — excludes static assets from the Functions worker so bot logging only runs on HTML and well-known paths.
wrangler.toml (root) Pages bindings — the AGENT_LOG (sw_agent_log) and REPORT_LOG (sw_report_log) Analytics Engine datasets. Pages itself is deployed via the Pages dashboard's Git integration.
public/_headers Cloudflare response headers — strict CSP, HSTS, Permissions-Policy, Vary on .md, content types for well-known files, the discovery Link header.
public/.well-known/ Static well-known URIs (security.txt, change-password, api-catalog, mcp/server-card.json, agent-card.json for A2A discovery, agent-skills/index.json + agent-skills//SKILL.md per the Agent Skills Discovery RFC v0.2.0 — if you edit a SKILL.md, recompute its sha256 and update the digest in index.json; ai-catalog.json is the ARD AI Catalog, published unsigned — see agentic-resource-discovery for why a same-origin trust-manifest signature proves nothing).
mcp/ Cloudflare Worker exposing the spec at mcp.specification.website. Serves the MCP transport at /mcp, an A2A (Agent-to-Agent) JSON-RPC endpoint at /a2a/v1, and mirrors both discovery cards under /.well-known/. Has its own package.json, wrangler.toml, build script, and assertions (npm test — plain node:assert, no dependencies, Node >= 22.15). Reads from the same src/content/spec/ source of truth at build time. Logs each call to the MCP_LOG Analytics Engine dataset (sw_mcp_log).
public/search-overlay.js ⌘K overlay logic. CSP-safe (no inline JS).
public/search-init.js /search/ page Pagefind initialiser. CSP-safe.
scripts/generate-assets.mjs Generates icons + OG image from inline SVGs via sharp. Wired through prebuild/predev.
scripts/check-skill.mjs Guards the hand-maintained Agent Skill against drift: page count, category count + list, MCP protocol revision, and the sha256 digest in agent-skills/index.json. npm run check:skill verifies (CI + pre-commit); npm run sign:skill rewrites what it can. Must run after Prettier, never before — it asserts public/.well-known/ stays in .prettierignore so a reformat can't invalidate the digest.

Commands

npm run dev      # http://localhost:31337
npm run build    # astro build && pagefind --site dist
npm run preview  # serve dist on 31337
npm run check    # astro check
npm run lint     # eslint .
npm run format:check  # prettier --check .
npm run assets   # regenerate icons + OG image

predev and prebuild run scripts/generate-assets.mjs automatically.

The Worker in mcp/ has its own scripts, run from there: npm test, npm run typecheck, npm run dev (wrangler on 31338). On a fresh clone run npm run build:data first — src/data.json is generated, so typecheck fails with TS2307 without it; pretest covers npm test. CI's mcp job audits dependencies, builds the manifest, type-checks, and runs the protocol assertions.

Pre-commit gate. A tracked git hook at .githooks/pre-commit runs npm run lint and npm run format:check on every git commit; core.hooksPath is pointed at .githooks/ by the prepare script on npm install (no husky). The same two checks run in CI (ci.yml). Run them before committing so the hook passes; prettier --write . fixes formatting. Bypass only in a genuine emergency with git commit --no-verify. The Worker's assertions are deliberately not in the hook: mcp/ has its own dependency tree that most contributors never install, and running them would rewrite the generated mcp/src/data.json on every unrelated commit. CI is the gate for that.

Workflow when adding or changing a spec page

  1. Copy an existing entry in src/content/spec/<category>/.

  2. Update the front matter: title, slug, summary, status, order, relatedSlugs, sources, updated.

  3. Write the body using the canonical section structure.

  4. Run npm run dev and open the page on port 31337.

  5. Verify: it appears on /spec/, on /spec/<category>/, on /checklist/, in /llms.txt, in /sitemap-index.xml, and is served at .md with frontmatter.

  6. Add a changelog entry. The src/content/changelog/ collection is not derived — it is hand-authored (see the Changelog paragraph above). Create src/content/changelog/<YYYY-MM-DD>-<slug>.md with title, date, type (added for a new page), optional relatedSlugs, and a one-to-three-sentence body linking the new page. Skipping this is the easiest step to forget — the page ships but never shows up in /changelog/ or its RSS feed.

  7. Regenerate and commit the OG images. Per-page OG images are tracked in git, not built fresh on deploy — scripts/generate-assets.mjs writes them under public/og/. Run npm run assets, then stage the new public/og/spec/<category>/<slug>.png plus the handful of count-driven images the new page bumps (public/og-default.png, public/og/checklist.png, public/og/spec.png, and the category image public/og/spec/<category>.png). The generator is deterministic, so unrelated images stay byte-identical and won't show as changed. A spec page committed without its OG image is a bug — every page must have one (public/og/spec/<category>/<slug>.png).

  8. Keep the Agent Skill in sync. public/.well-known/agent-skills/specification-website/SKILL.md is hand-maintained (not derived) — it is the canonical "how to use this spec" doc for agents. Run npm run sign:skill: it rewrites the page count, the MCP protocol revision, and the digest in agent-skills/index.json, then verifies the category list against src/lib/site.ts. npm run check:skill is the read-only form — it runs in CI and in the pre-commit hook, so drift fails the build rather than shipping silently.

    The script only guards the four mechanically-derivable claims (page count, category count + list, MCP protocol revision, digest). Everything else in SKILL.md is still on you: the tool table when MCP tools change, the status descriptions when the bar moves, the workflow prose. Nothing checks those. If you change the category list, the script tells you it diverged but will not invent the bullet prose — edit by hand, then re-run sign:skill.

  9. Commit — stage the spec .md, the changelog entry, and the OG images together (PRs that commit only the Markdown leave the page without an OG image and without a changelog entry). Push to main. Cloudflare Pages auto-deploys.

  10. The MCP Worker redeploys itself. Pages auto-deploy doesn't touch the Worker, but the Deploy MCP GitHub Action (.github/workflows/deploy-mcp.yml) does: any push to main touching src/content/spec/**, src/content/changelog/**, or mcp/** runs npm run deploy (the predeploy hook regenerates mcp/src/data.json — what search / list_topics / get_topic / get_checklist read from — then wrangler deploy). So a normal spec-page commit redeploys the Worker on its own; you don't need to run anything. Manual fallback if the Action is broken or you're deploying out-of-band: cd mcp && npm run deploy.

Do not also edit /checklist/, /llms.txt, or any other derived surface. They will rebuild.

When the site itself gains a capability, ship the spec page too

The site is a worked example of the spec, not just documentation that lives next to it. Divergence between what we ship and what we recommend is a bug. Whenever you implement a new capability on the site that fits a spec topic, the same PR has to make the spec match.

Trigger this rule when you ship any of:

  • a new HTTP response header (CSP directive, Link rel, Vary, custom security header);
  • a new /.well-known/ file (security.txt, api-catalog, mcp/server-card.json, agent-skills/...);
  • a new agent-discovery surface (MCP server, agent skills, DNS-AID records, server card, Linkset entry);
  • a new content endpoint (.md mirror, JSON API, RSS, JSON Feed, alternate format);
  • a new accessibility, performance, privacy, SEO, or i18n behaviour worth recommending elsewhere.

The same PR must do one of:

  1. Add a new spec page under src/content/spec/<category>/ documenting the underlying standard or convention. Cite primary sources (IETF, W3C, WHATWG, MDN — see Cardinal rules). Pick a status honestly: required only if the platform contract breaks without it, otherwise recommended or optional. Add a one-line "this site ships it; see [X]" callout pointing at our implementation or asset.
  2. Update an existing spec page to incorporate the new convention, add the new sources, or add the worked-example callout. Bump updated. Add the new page (or new section) to relatedSlugs on adjacent topics so the cross-graph stays correct.

Also update the api-catalog Linkset if the capability adds a discoverable resource, and the global Link header in public/_headers if it has a registered IANA rel. Both should match what the new spec page describes.

If the underlying convention turns out non-existent or defunct (see the /.well-known/ai.txt deletion history), remove the asset and the spec page in the same PR — don't leave the page documenting something we no longer ship.

Speccing and shipping are separate decisions

We do not have to ship something to spec it. The site is a worked example wherever that is useful, not a gate. Plenty of good advice does not apply to a static, cookieless, six-page-of-plumbing site: a page can be right for the sites reading it and irrelevant here. When that is the case, write the page and skip the implementation — but say so on the page, in one line, with the reason. "This site does not ship it: we are static, so no response ever means this changed" is useful content. Silence is not.

So there are three honest shapes for a page, and all three are fine:

  1. Specced and shipped — the common case. Carry the "this site ships it; see [X]" callout.
  2. Specced, deliberately not shipped — the topic does not apply to us. Carry a one-line note saying that, and why.
  3. Not specced — see below.

What we don't spec, and where that gets recorded

Do not add a page for a convention nothing is using yet. A standard being final is not sufficient; something has to implement it, or the page recommends a header no cache reads and an element no browser honours. Being final also is not necessary — a widely-deployed convention can earn a page before its RFC lands.

This particular call belongs to the maintainer, not to an agent. If a topic is real and well-sourced but adoption looks thin, do not add the page and do not silently drop it either — surface it (Slack, for the daily scan; the PR description otherwise) and let Joost decide.

Record only omissions that need explaining. src/content/considered/, rendered at /considered/, is a selective register of credible candidates a reader could reasonably expect this specification to cover. An entry must explain that expectation by connecting the topic to existing guidance or a direct website outcome, and explain why the omission matters to readers. Being found by the scan, registered at IANA, or newly Baseline is not enough.

Routine exclusions stay in internal scan notes or the existing PR/issue discussion. Do not create public entries for every vendor integration, specialised infrastructure protocol, or CSS/JavaScript implementation choice. A familiar source of confusion, such as AGENTS.md versus website-facing agent discovery, can still merit a short scope explanation. Thin adoption remains the maintainer's decision; a scan finding is not a decision already taken.

For an omission that meets this bar, use one file per topic:

  • title, date (the decision), reason (too-early | out-of-scope | too-narrow), sources, and revisit — the last being what would change our mind, which is what keeps the register from becoming a graveyard.
  • A short body: what the thing is, why a reader might expect it here, and why it did not land. Do not add an entry merely to illustrate a general scope rule.

Being in /considered/ is not a rejection forever. When the reason expires (something ships it; adoption broadens), delete the entry in the same PR that adds the spec page.

Like the changelog, this collection is not derived — nothing generates it. It is also not a to-do list: entries are decisions already taken, not a queue.

When changing a status

  1. Edit the status field on the spec entry.
  2. Rebuild — the badge changes on the spec page, the category page, the checklist, and the llms.txt summary all at once.
  3. If you are downgrading or removing something because the underlying convention turned out non-existent or defunct (the spec's job is to be honest about this — see the deleted /.well-known/ai.txt history), also delete any matching asset under public/, any cross-references in other spec pages' relatedSlugs, and update CLAUDE.md if the change is structural.

Things this site does that you should not break

  • No cookies. Plausible is the only analytics. It is cookieless and only loaded in import.meta.env.PROD. Don't add anything that sets cookies.
  • No third-party scripts other than Plausible. Anything new requires a CSP update in public/_headers and a privacy-policy update in src/pages/privacy.astro. The GlitchTip SDK is self-hosted (/vendor/diagnostics.js) and only talks to /api/diagnostics; keep it that way.
  • No inline <script> content without a corresponding CSP allowance. The site relies on a strict CSP with no 'unsafe-inline' on script-src. Put init logic in a file under public/ and reference it.
  • Content-Type discipline on well-known files and /spec/*.md. Maintained in public/_headers.
  • The Vary: Accept header on spec pages. Set by functions/_middleware.ts. Removing it breaks downstream caches serving HTML when an agent asks for Markdown.

Deployment

  • main → Cloudflare Pages, auto-deployed via the Pages dashboard's Git integration. No GitHub Actions deploy workflow (ci.yml verifies; it does not deploy).
  • Custom domain for the site: specification.website (configure in the Cloudflare Pages dashboard).
  • Functions live in /functions/ and ship alongside static assets. The Cloudflare build picks them up automatically.
  • The MCP server in /mcp/ is a separate Cloudflare Worker. It registers mcp.specification.website as a custom domain on first deploy. It is redeployed automatically by the Deploy MCP GitHub Action whenever a push to main touches src/content/spec/**, src/content/changelog/**, or mcp/**, so its bundled data stays in sync (the predeploy hook regenerates mcp/src/data.json). The Action authenticates with the CLOUDFLARE_API_TOKEN repo secret (Workers Scripts: Edit). Manual fallback: cd mcp && npm run deploy.

Automation

  • A scheduled agent runs a daily standards scan — it sweeps the standards bodies this spec cites for new topics, status changes, and dead/stale citations, then opens draft PRs and DMs a Slack summary. Its full, binding instructions live in ops/routines/daily-standards-scan.md, which is the single source of truth: the routine reads that file each run, so edit the file (not the routine prompt) to change what the scan does, then commit to main.

Admin stats dashboard

/admin/stats is a server-rendered dashboard for crawler traffic (sw_agent_log) and MCP / A2A usage (sw_mcp_log). It is gated by Cloudflare Access; the function itself does no auth and trusts the edge.

Three writers, all Cloudflare Analytics Engine:

  • functions/_shared/bot-detect.ts writes a row per bot/agent request via the AGENT_LOG binding declared in the root wrangler.toml. See BOT_UA_MATCHERS for the crawler list — when a new high-profile AI / LLM / search bot ships, add its UA pattern there.
  • functions/reports.ts writes a row per browser policy report via the REPORT_LOG binding (root wrangler.toml). Browsers POST these to /reports, named by the Reporting-Endpoints header in public/_headers; the report type is the AE index.
  • mcp/src/index.ts writes a row per MCP / A2A call via the MCP_LOG binding declared in mcp/wrangler.toml. The two surfaces (remote, a2a) are tagged in blob10.

The dashboard reads all three datasets via the Analytics Engine SQL API using two Pages secrets:

  • CF_ACCOUNT_ID — the account that owns the project (c53e64d218c83cb220b523a637ffd079).
  • CF_ANALYTICS_TOKEN — an API token with Account → Account Analytics → Read scoped to that account. Create at dash.cloudflare.com/profile/api-tokens and add both as Pages → Settings → Variables and Secrets (Production + Preview).

A "table not found" error from a query is expected until the matching dataset has received its first write. Datasets are account-scoped, so the same SQL token reads from both the Pages-written sw_agent_log and the Worker-written sw_mcp_log.

The Crawlers tab supports ?format=markdown (Accept-header flags, including legacy rows, or direct .md paths) across all crawler queries. Its daily graph defaults to 30 UTC calendar days, with ?days=7, 30, or 90; today is partial. These GET controls retain both selections in the URL.

The MCP / A2A tab has the same daily history periods alongside its 24-hour graph. ?section=mcp opens that tab and keeps it selected when applying a graph period; the crawler Markdown filter does not affect MCP / A2A counts.

Conventions when extending it:

  • Keep the dashboard CSP-safe — interaction JS lives in public/admin-stats.js, not inline.
  • Never break a request because logging failed — both logBot() and logMcpCall() wrap everything in try/catch and return silently.
  • Bot detection runs before content negotiation in functions/_middleware.ts; don't reorder.
  • public/_routes.json excludes static assets so the Functions worker (and the logger) only runs on HTML and well-known paths. When you add a new top-level static asset path, add it there too.

Privacy stance

The site collects aggregate Plausible analytics (no cookies, no IP storage, EU-hosted) for visitors, and aggregate Cloudflare Analytics Engine logs for crawlers, MCP/A2A clients, and browser policy reports via the Reporting API (UA, country, path, tool name, report type/directive; no cookies, no IP storage). Documented in src/pages/privacy.astro. If you add anything that collects data, update that page truthfully in the same PR.