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.
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.
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 bysrc/pages/checklist.astrofromgetCollection('spec')./spec/(index) and/spec/<category>/(category indexes). Same source./spec/<category>/<slug>/— the HTML page. Built bysrc/pages/spec/[category]/[slug].astro./spec/<category>/<slug>.md— the raw Markdown endpoint with YAML frontmatter. Built bysrc/pages/spec/[category]/[slug].md.ts./llms.txtand/llms-full.txt— the agent-facing indexes. Built bysrc/pages/llms.txt.tsandsrc/pages/llms-full.txt.ts./okf/— the Open Knowledge Format bundle: one Markdown concept per spec page (okf/<category>/<slug>.md), areferences/concept per distinct cited source, per-directoryindex.md, alog.mdfrom the changelog, and a rootindex.mdcarryingokf_version. Built bysrc/lib/okf.ts+ the endpoints undersrc/pages/okf/; packaged into/okf.tar.gzby theastro-okf-tarball.mjsintegration (hand-rolled ustar writer, no tar dependency) inastro: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 bysrc/pages/rss.xml.ts.- The Pagefind search index — built by
pagefind --site distin thebuildscript. 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.
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/ 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.
These mirror CONTRIBUTING.md. Enforce them in your own writing and when reviewing.
- 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. - Stay platform-agnostic. Describe outcomes, not implementations. "Set
Content-Security-Policy" is in scope. "Add this to yournext.config.mjs" is not. Link out to platform docs instead. - Be honest about status. If something is shipping as
requiredbut the platform works without it, downgrade torecommended. If the source URL is dead, replace it (Wayback Machine is acceptable) or remove the citation. - British English. "colour", "behaviour", "internationalisation", "licence" (noun).
- Section structure.
## What it is,## Why it matters,## How to implement,## Common mistakes,## Verification. Last two are optional if they would not add value. - 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.
- 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>;canonicalis a hint, not a directive;alt=""is not a missingalt). Definitional confusions belong in## What it is; mechanical errors belong in## Common mistakes; if the contrast points at another topic, wire it intorelatedSlugs. Some pages have no such misconception — those get no such paragraph. Do not manufacture one to fill space. - Inline cross-links must carry the right category. A spec page's URL is
/spec/<category>/<slug>/, and the category is the directory the.mdlives 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. (relatedSlugsis 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.) - 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.
| 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. |
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.
-
Copy an existing entry in
src/content/spec/<category>/. -
Update the front matter:
title,slug,summary,status,order,relatedSlugs,sources,updated. -
Write the body using the canonical section structure.
-
Run
npm run devand open the page on port 31337. -
Verify: it appears on
/spec/, on/spec/<category>/, on/checklist/, in/llms.txt, in/sitemap-index.xml, and is served at.mdwith frontmatter. -
Add a changelog entry. The
src/content/changelog/collection is not derived — it is hand-authored (see the Changelog paragraph above). Createsrc/content/changelog/<YYYY-MM-DD>-<slug>.mdwithtitle,date,type(addedfor a new page), optionalrelatedSlugs, 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. -
Regenerate and commit the OG images. Per-page OG images are tracked in git, not built fresh on deploy —
scripts/generate-assets.mjswrites them underpublic/og/. Runnpm run assets, then stage the newpublic/og/spec/<category>/<slug>.pngplus 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 imagepublic/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). -
Keep the Agent Skill in sync.
public/.well-known/agent-skills/specification-website/SKILL.mdis hand-maintained (not derived) — it is the canonical "how to use this spec" doc for agents. Runnpm run sign:skill: it rewrites the page count, the MCP protocol revision, and thedigestinagent-skills/index.json, then verifies the category list againstsrc/lib/site.ts.npm run check:skillis 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. -
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 tomain. Cloudflare Pages auto-deploys. -
The MCP Worker redeploys itself. Pages auto-deploy doesn't touch the Worker, but the
Deploy MCPGitHub Action (.github/workflows/deploy-mcp.yml) does: any push tomaintouchingsrc/content/spec/**,src/content/changelog/**, ormcp/**runsnpm run deploy(the predeploy hook regeneratesmcp/src/data.json— whatsearch/list_topics/get_topic/get_checklistread from — thenwrangler 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.
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,
Linkrel,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 (
.mdmirror, 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:
- 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:requiredonly if the platform contract breaks without it, otherwiserecommendedoroptional. Add a one-line "this site ships it; see [X]" callout pointing at our implementation or asset. - 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) torelatedSlugson 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.
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:
- Specced and shipped — the common case. Carry the "this site ships it; see [X]" callout.
- Specced, deliberately not shipped — the topic does not apply to us. Carry a one-line note saying that, and why.
- Not specced — see below.
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, andrevisit— 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.
- Edit the
statusfield on the spec entry. - Rebuild — the badge changes on the spec page, the category page, the checklist, and the llms.txt summary all at once.
- 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.txthistory), also delete any matching asset underpublic/, any cross-references in other spec pages'relatedSlugs, and updateCLAUDE.mdif the change is structural.
- 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/_headersand a privacy-policy update insrc/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'onscript-src. Put init logic in a file underpublic/and reference it. - Content-Type discipline on well-known files and
/spec/*.md. Maintained inpublic/_headers. - The
Vary: Acceptheader on spec pages. Set byfunctions/_middleware.ts. Removing it breaks downstream caches serving HTML when an agent asks for Markdown.
main→ Cloudflare Pages, auto-deployed via the Pages dashboard's Git integration. No GitHub Actions deploy workflow (ci.ymlverifies; 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 registersmcp.specification.websiteas a custom domain on first deploy. It is redeployed automatically by theDeploy MCPGitHub Action whenever a push tomaintouchessrc/content/spec/**,src/content/changelog/**, ormcp/**, so its bundled data stays in sync (the predeploy hook regeneratesmcp/src/data.json). The Action authenticates with theCLOUDFLARE_API_TOKENrepo secret (Workers Scripts: Edit). Manual fallback:cd mcp && npm run deploy.
- 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 tomain.
/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.tswrites a row per bot/agent request via theAGENT_LOGbinding declared in the rootwrangler.toml. SeeBOT_UA_MATCHERSfor the crawler list — when a new high-profile AI / LLM / search bot ships, add its UA pattern there.functions/reports.tswrites a row per browser policy report via theREPORT_LOGbinding (rootwrangler.toml). Browsers POST these to/reports, named by theReporting-Endpointsheader inpublic/_headers; the reporttypeis the AE index.mcp/src/index.tswrites a row per MCP / A2A call via theMCP_LOGbinding declared inmcp/wrangler.toml. The two surfaces (remote,a2a) are tagged inblob10.
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()andlogMcpCall()wrap everything in try/catch and return silently. - Bot detection runs before content negotiation in
functions/_middleware.ts; don't reorder. public/_routes.jsonexcludes 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.
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.