agentleFS
auditmosauditmos/auditmos-lp/AGENTS.md

auditmos-lp

AGENTS.md0 starsChanged 6 months agoISCView on GitHub

The auditmos.com landing page — Astro on Cloudflare Workers, static-first.

  • Reads credentials
  • Where files are headingNew AGENTS.md files have more rules about keeping secrets out of the code, and fewer about checking a change actually works.

    Of the AGENTS.md files we read, the 11,773 first seen in the last six months, against the older ones: the kind of rule that gained most share, and the kind that lost most. About files like this in general, not this one, and an estimate, since a kind is a pattern in the words.

  • In this repository2 other files it gives its agents.

The file

We split this AGENTS.md into the rules it gives an agent

6 rules. About 0 are common, 1 is distinctive, and 5 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈1

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 5

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  • could be automatic: a setting could enforce it
  1. Very specific:

    Prefer deep modules (Ousterhout): small interface hiding large implementation.

    line 90
  2. Distinctive:

    Run manually before declaring done:

    line 131
  3. Very specific:

    Never create separate md files for reviews/audits/analyses unless explicitly asked </important>

    line 153
  4. Very specific:

    Run pnpm cf-typegen immediately to keep worker-configuration.d.ts in sync

    line 157
  5. Very specific:

    Don't edit worker-configuration.d.ts by hand — it's auto-generated

    line 158
  6. Very specific:

    Prefer custom_domain: true over routes with zone_name (see .claude/rules/cloudflare-deployment.md) </important>

    line 159

≈ “Common” is an estimate: at least 1 in 5 of the 16,595 AGENTS.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
AGENTS.md

auditmos-lp

The auditmos.com landing page — Astro on Cloudflare Workers, static-first.

  • PRD: docs/prd-website-rebuild.md (GH #1)
  • Plan: plans/website-rebuild.md — 7 phases (GH #2–#8)
  • Brand accent: #04d9ff (Tailwind v4 @theme token)
  • Legal entity (footer, every page): Auditmos OÜ · Reg 17025406 · VAT EE102758111 · Narva mnt 13-27, 10151 Tallinn, Estonia

Stack

LayerTechnology
FrameworkAstro 6 (mostly prerender = true)
Adapter@astrojs/cloudflare
RuntimeCloudflare Workers (nodejs_compat)
StylingTailwind CSS v4 (@tailwindcss/vite)
ContentAstro Content Collections + Zod (projects)
APIAstro endpoints (src/pages/api/*.ts) — only /api/contact runs at request time
EmailResend (transactional)
Anti-spamCloudflare Turnstile
AnalyticsCloudflare Web Analytics (no cookies, no consent banner)
LanguageTypeScript (strict, @/* → src/*)
LinterBiome 2
TestingVitest
Dead-codeknip
Releasesemantic-release
Package managerpnpm 10

Project Structure

  • src/pages/ — file-based routes (.astro, .md, or .ts for endpoints). Most pages have export const prerender = true.
  • src/pages/api/contact.ts — the only request-time route (Zod → Turnstile verify → Resend notify + confirm).
  • src/pages/**/*.md.ts — markdown twin of every URL; src/pages/llms.txt.ts is the index for AI agents.
  • src/content/projects/ — Markdown source for the projects content collection (Zod-validated at build).
  • src/layouts/ — shared layouts wrapping page slots.
  • src/components/ — reusable Astro components (organize by feature folder when groups emerge).
  • src/assets/logos/ — brand assets vendored from github.com/auditmos/branding.
  • src/styles/globals.css — Tailwind v4 entry (@import "tailwindcss";) + @theme block with brand tokens.
  • src/env.d.ts — declares App.Locals typed against Cloudflare Env.
  • src/mail/ — mail-security policy as data: the MTA-STS policy text and MX list, shared by the Worker that serves it and the tests that pin it.
  • workers/mta-sts/ — a second Worker, deployed separately to mta-sts.auditmos.com (pnpm deploy:mta-sts, own wrangler.jsonc). It is not part of the site build and shares no bindings with it.
  • worker-configuration.d.ts — auto-generated by pnpm cf-typegen, never edit. Gitignored, not committed: pnpm install regenerates it via the prepare script, so a fresh clone gets one before the first typecheck. Its contents vary with your local .dev.vars, which is why committing it produced churn.
  • Path alias @/* → src/*.

Commands

pnpm dev                       # dev server on http://localhost:3000
pnpm build                     # production build to ./dist
pnpm preview                   # preview the production build locally
pnpm deploy                    # build + wrangler deploy (dev worker)
pnpm deploy:staging            # build with staging vars + deploy staging.auditmos.com
pnpm deploy:production         # build with production vars + deploy auditmos.com
pnpm secrets:staging           # push runtime secrets from .dev.vars.staging
pnpm secrets:production        # push runtime secrets from .dev.vars.production
pnpm cf-typegen                # regenerate Env types from wrangler.jsonc

pnpm agents:verify             # scan production for agent-readiness regressions
pnpm agents:verify <url>       # ...or any other deployed host

pnpm deploy:mta-sts            # deploy the standalone MTA-STS policy Worker
pnpm mta-sts:verify            # policy vs. live MX + the _mta-sts TXT id
pnpm security:gates            # are the deferred security changes due yet?

pnpm csp:violations            # watch production for CSP violations (Ctrl-C summarises)
pnpm csp:violations staging    # ...or any configured env

pnpm new-project "<title>"     # scaffold a new project MD with frontmatter prefilled
pnpm import-article [path]     # publish an authored article.md to /work (asks for year, client, industry)
pnpm import-article --help     # ...its flags, for a non-interactive run

pnpm test                      # vitest run
pnpm test:watch                # vitest watch
pnpm test:coverage             # vitest + v8 coverage

pnpm types                     # astro check + tsc --noEmit
pnpm lint                      # biome check .
pnpm lint:fix                  # biome check --write .
pnpm knip                      # unused files / deps / exports

pnpm deps                      # check minor + patch updates
pnpm deps:update               # apply them
pnpm deps:major                # show major updates
pnpm release                   # semantic-release (CI only)

Architecture

Prefer deep modules (Ousterhout): small interface hiding large implementation. Test at module boundaries, not internals. See .claude/rules/deep-modules.md.

Technology-specific rules live in .claude/rules/. Activate automatically when touching relevant files — frontend/astro.md, frontend/tailwind-v4.md, api/astro-endpoints.md, api/cloudflare-workers.md, cloudflare-deployment.md, error-handling.md, atomic-imports.md, general.md.

Project-specific conventions

  • Static-first: every page sets export const prerender = true except src/pages/api/contact.ts, src/pages/api/csp-report.ts (a report-only policy with nowhere to report cannot be validated before it is enforced, and a prerendered asset cannot read a POST body), src/pages/api/resend-webhook.ts (a signature must be verified against a raw POST body), src/pages/mcp.ts, and the two OAuth routes (src/pages/oauth/register.ts, src/pages/oauth/token.ts — issuing a credential is a cryptographic exchange over a POST body, which a prerendered asset cannot perform). Don't introduce new request-time routes without a reason documented in the PRD. Page routes pass through the Worker (see markdown negotiation below) but are still served from their prerendered asset — that is a routing hop, not a render, and it must stay that way.
  • Agent-readiness regressions: pnpm agents:verify [url] scans a deployed host and diffs the result against REQUIRED_CHECKS in scripts/agents-verify-lib.ts — the checks backed by something this site actually ships. Most scanner checks fail by design (OAuth discovery, A2A, WebMCP are not implemented), so a raw pass count means nothing; only the declared set is enforced. Run it after deploying. When you implement a new agent surface, add its check to REQUIRED_CHECKS — the script reports newly-passing checks as NEW PASS precisely so the list does not drift behind reality. It also runs four wire-only checks — canonical redirects, the Web Analytics beacon, security.txt, and indexability — for the same reason the scanner half exists: each fails in the layer between the build and the browser, or on a clock rather than on a change, so no build artifact can describe them. The indexability check reads X-Robots-Tag off the deployed homepage and demands the value the host's environment implies — production must not say noindex (the accident that would silently deindex the site), every other host must (see the noindex bullet below). The security.txt check reports RENEW without failing when Expires is within 30 days: the value is derived from the build, so any deploy renews it, and failing would block the fix.
  • MTA-STS lives in its own Worker, and that is not a style choice. mta-sts.auditmos.com must serve one file and 404 everything else (#34). Binding it as a second custom_domain on the site Worker cannot achieve that: Workers Assets answers static assets before the Worker runs for any path outside assets.run_worker_first, and that list matches on path, not host — so /og.png, /sitemap.xml and /_astro/* would be served there with the Worker never in the loop, giving site content a second URL. The only interception point would be run_worker_first: ["/*"], routing every asset of the main site through the Worker to tidy a subdomain. Hence workers/mta-sts/, with the policy itself in src/mail/mta-sts.ts so the file mail servers fetch has one source. Changing the policy needs two edits — the constant and a new id in the _mta-sts TXT record, since max_age is a week and the id is the only re-fetch signal. pnpm mta-sts:verify compares the served policy against live MX, which nothing in a build can do; under mode: enforce a mismatch refuses inbound mail.
  • Web Analytics is injected by the edge, not by the site. Cloudflare's RUM automatic injection adds the beacon as the response leaves for the browser, after the Worker has returned it. So the layout deliberately emits no analytics tag and CLOUDFLARE_WEB_ANALYTICS_TOKEN is read nowhere: a tag here would be a second beacon, double-counting every pageview while the numbers still looked plausible (#39). A build-output test asserts dist/ contains no beacon, and pnpm agents:verify asserts the deployed pages carry exactly one. Injection is gated on the request Accept header — a bare curl sends a wildcard Accept and gets a beacon-free page whether or not analytics works, which is the false negative that hid this for weeks. It is also zone-wide: staging reports under production's token, and the Worker cannot strip it, because it never sees it.
  • Markdown negotiation: Accept: text/markdown on a page URL returns that page's markdown twin (src/site/markdown-negotiation.ts, wrapped around the adapter handler by src/worker.ts, which is main in wrangler.jsonc). It only works because assets.run_worker_first lists the page routes — otherwise the asset server answers first and the Worker never sees the request. Adding a page means adding both its URL forms to run_worker_first — /about and /about/, because those patterns match the path literally and the bare form does not claim the slash form (src/site/run-worker-first.ts encodes exactly what a pattern claims). A wildcard entry like /work/* spans both and needs no second line. Build-output tests fail when either form is missing. Both representations send Vary: Accept, so don't strip it — a shared cache would start handing markdown to browsers. pnpm dev never runs the Worker entry or the asset router, so negotiation always returns HTML there — verify with pnpm preview, which does.
  • Slash-free canonical URLs: /about, never /about/. Three things enforce it and must move together — trailingSlash: "never" (astro.config.mjs, drives dev-server routing), assets.html_handling: "drop-trailing-slash" (wrangler.jsonc, makes the asset server serve the bare form instead of redirecting to the slash form), and canonicalRedirect() (src/site/canonical-url.ts, first thing in src/worker.ts). The third exists because the second only governs requests the asset server answers, and run_worker_first claims every page route before it: /work/<slug>/ used to answer 200 with the page body, a second reachable URL for the same document. The Worker 301s any trailing-slash URL to its canonical form for GET/HEAD, leaving other methods alone so a 301 cannot rewrite a POST to /api/contact or /mcp into a GET. Changing one alone reintroduces a redirect hop on every internal link or a duplicate URL; build-output tests assert all three. The third only fires for paths run_worker_first claims, and those patterns match literally: /about/ used to answer html_handling's 307 instead, because only /about was listed — a temporary redirect consolidates no ranking signals, which is the entire point of the 301 (#38). Both forms are listed now. A build-output test asserts that, and pnpm agents:verify re-checks it against a deployed host, because the failure lives in whether Cloudflare's asset router reaches the Worker at all — a fact no build artifact describes and pnpm dev never exercises.
  • Only production is indexable. Every build not explicitly stamped CLOUDFLARE_ENV=production carries X-Robots-Tag: noindex — in the generated _headers /* block and on everything the Worker renders (robotsTagFor in src/site/security-headers.ts, one source for both surfaces). It exists because staging serves the same pages with canonicals pointing at production, and Google crawled them all into Search Console's "Alternate page with proper canonical tag" report (Aug 2026): a canonical tag cannot keep a host out of the crawl, only noindex can. The default fails toward noindex — an unset env is a preview build — so the dangerous direction (a noindex production) is guarded where it can be seen, by the pnpm agents:verify indexability wire check. Don't add Disallow to staging's robots.txt as an "improvement": Google must be able to crawl a page to see its noindex; blocking the crawl would freeze the URLs in the report instead of draining them.
  • MD-mirror: a single page-enumerator helper is the source of truth for *.md.ts endpoints and /llms.txt. Adding a new route extends both surfaces — a CI test asserts coverage.
  • MCP rate limit: /mcp is unauthenticated, so it is rate limited by the MCP_RATE_LIMITER binding (wrangler.jsonc, period accepts only 10 or 60). MCP_RATE_LIMIT in src/mcp/server.ts is the single source for the number: the endpoint enforces it, initialize reports it to clients, and /agents.json publishes it. Change the constant and the binding together — a test asserts the advertised limit matches the constant, but nothing can catch the binding drifting from it. Note the limiter is permissive and eventually consistent by design: each isolate checks a locally cached counter, so an instantaneous concurrent burst can exceed the limit before counts propagate, and it is per Cloudflare location rather than global. It bounds sustained abuse, which is the actual threat here; it is not a hard quota. Verify it with sustained sequential requests — a parallel burst will show no 429s and look like a broken limiter. /api/csp-report and /api/resend-webhook are limited the same way (CSP_REPORT_RATE_LIMITER / CSP_REPORT_RATE_LIMIT in src/csp/report-handler.ts, RESEND_WEBHOOK_RATE_LIMITER / RESEND_WEBHOOK_RATE_LIMIT in src/resend/webhook-handler.ts) and carry the same caveat: change the constant and the binding together.
  • Resend delivery webhook: /api/resend-webhook exists because Resend answers a suppressed send with 200 OK and a message id — the identical response a delivered message gets. No amount of logging in /api/contact can tell the two apart, because the outcome does not exist yet when Resend replies; a contact notification stayed invisibly dead for four days behind that 200 (#PRD component 14). The webhook is the only channel carrying the real outcome, so email.bounced, email.failed, email.suppressed and suppression.added log at error — that severity mapping in src/resend/webhook-handler.ts is the entire point of the endpoint, not decoration. It is signature-verified (Svix: HMAC-SHA256 over id.timestamp.body, keyed on the base64 body of the whsec_ secret, constant-time compare, five-minute replay window) and fails closed — no RESEND_WEBHOOK_SECRET means every request is refused, because an unverified sink lets anyone forge delivery events into the log you make on-call decisions from. The secret is issued per webhook endpoint, so it differs per environment; register the endpoint in the Resend dashboard for each env before pnpm secrets:<env>, which now requires it.
  • Content Security Policy: src/site/content-security-policy.ts owns the whole policy and the mode. It ships report-only — flip CSP_MODE to "enforce" once the sink has been quiet through a week of production traffic (#30). One header name serves both delivery surfaces on purpose: _headers covers everything the asset server answers, withSecurityHeaders() fills the policy in on what the Worker renders itself, and it fills in rather than sets — overwriting a page's own policy would drop the script hashes and refuse every inline block. Inline-script hashes are derived from the emitted HTML by agentDiscoveryHeaders(), never written down: a stale hash fails closed, so a build-output test asserts every inline script in dist/ has a matching one. Adding an inline <script> needs no action; adding a third-party origin, or a new inline style source, means editing the directives here. JSON-LD is deliberately unhashed (a data block is never CSP-checked), and style-src keeps 'unsafe-inline' because Shiki writes colours into style attributes, which hashes cannot govern. Watch for violations with pnpm csp:violations — it filters wrangler tail down to the csp_violation warnings and summarises on exit, but it streams live, so a quiet run only proves its own window was quiet; query Workers Logs for the period as a whole. Violations post to /api/csp-report via report-uri — not report-to, which needs an absolute URL a static build cannot know per environment, and which Chrome would let silently supersede report-uri.
  • Agent-discovery headers: the agentDiscoveryHeaders() integration (src/site/discovery-headers.ts) generates the _headers file after the build, advertising /llms.txt and each page's .md twin as RFC 8288 Link relations. It appends to what @astrojs/cloudflare already wrote, so it must stay after the adapter in integrations. Don't hand-write public/_headers for these — add the link there instead.
  • Redirects: static ones are declared in astro.config.mjs. public/_redirects is the exception and is hand-written on purpose — the Cloudflare adapter appends its generated rules to that file rather than replacing it, so hand-written rules stay first and win, and a wildcard (/projects/* → /work/:splat) can only live there: a dynamic destination declared in the config gets resolved to the file backing it (/work/:slug/index.html), which is not the canonical URL and 404s for the .md twins. Unlike _headers, this file is safe to edit.
  • Rendered Markdown: src/styles/prose.css styles <Content /> output and is imported by the page that renders it, not by globals.css — the homepage renders no Markdown and has the least headroom under the transfer budget. Import it from any future Markdown-rendering page. Fenced blocks take their background from the Shiki theme (markdown.shikiConfig in astro.config.mjs), because Shiki inlines that colour and no rule here can outrank it.
  • Projects schema: provenance defaults to client-work, which requires client as either { name, url? } (public/named) or { sector } (anonymised NDA work). internal-r-and-d forbids client. Every project explicitly declares one or more capabilities from software, security, and applied-r-and-d; these drive the zero-JavaScript /work filter and the related-work section on /r-and-d.
  • Article import: pnpm import-article maps an externally authored launch article (the content-launch skill's article.md) onto that schema. Title, slug, summary and technology tags come from the article; publication metadata covers year, provenance, capabilities, client (for client work), and industry, with flags for a non-interactive run. The leading H1 is stripped because /work/<slug> renders the title and summary itself. Article generation and editorial rewriting are outside the importer.
  • Contact endpoint atomicity: /api/contact returns 200 only when both emails (notification + confirmation) dispatched successfully. Partial sends → 502 with structured log.
  • OSS aggregator: must never fail the build. On GitHub API failure, fall back to cached file, then to empty list. The cache (.cache/oss-projects.json) is gitignored: every pnpm build, and therefore every pnpm test through buildSite(), rewrote it with fresh stars and timestamps, so a committed copy was permanently dirty. src/oss/projects.ts imports it statically, so it must exist before a typecheck: prepare generates it on install, and the refresh script writes an empty list when there is neither a fetch nor a cache.
  • CLOUDFLARE_ENV is hidden during prerendering: scopeCloudflareEnvAroundPrerender() (src/site/prerender-env.ts) removes it from Node's process.env between astro:build:ssr and astro:build:generated. The adapter's prerenderer reads the already-flattened dist/server/.prerender/wrangler.json without an env argument, so wrangler fell back to the variable and printed "No environment found in configuration with name …" on every deploy (upstream @cloudflare/vite-plugin bug). Prerendered pages are unaffected, since workerd fills their process.env from the Worker's vars. The integration must stay before agentDiscoveryHeaders, which reads the restored value in astro:build:done.
  • Local Worker runtime — use pnpm preview, not wrangler dev: not a style preference. Two miniflare majors live in this tree, both transitive and neither pinnable: the build runs miniflare 4 (via @cloudflare/vite-plugin ← @astrojs/cloudflare), wrangler dev runs miniflare 5-alpha. They disagree about the SENTRY_DO schema, so sharing a persist root made pnpm build — and therefore pnpm deploy, deploy:staging and deploy:production — fail with table _cf_ALARM has 3 columns but 2 values were supplied until .wrangler/state was deleted by hand and every orphaned workerd killed. persistState in astro.config.mjs now gives the build its own root (src/site/miniflare-state.ts), so the two cannot collide; a contract test fails if that wiring is dropped. pnpm preview goes through the same miniflare the build does, which is why it was always the right tool for verifying Worker behaviour.

Cloudflare runtime

Access bindings through import { env } from "cloudflare:workers" — this is the only supported pattern in Astro v6 + @astrojs/cloudflare v13 (the old Astro.locals.runtime.env was removed). env is typed against worker-configuration.d.ts. After editing wrangler.jsonc bindings, run pnpm cf-typegen.

wrangler.jsonc ships with three env blocks (dev, staging, production) — each gets its own Worker name. Deploy a specific env with pnpm deploy:<env> (staging → staging.auditmos.com, production → auditmos.com). Full runbook incl. the one-time Turnstile/Resend setup and the cutover from the legacy auditmos-web Worker: docs/deployment.md.

Per-env contact vars live in .dev.vars / .dev.vars.staging / .dev.vars.production locally (never committed). This matches the wrangler convention — .dev.vars.<env> is loaded ahead of .dev.vars when CLOUDFLARE_ENV=<env> is set. Required for the contact form: TURNSTILE_SITE_KEY (public widget key), RESEND_API_KEY, TURNSTILE_SECRET_KEY, CONTACT_TO_EMAIL. Required for OAuth: OAUTH_SIGNING_KEY — cryptographically random and distinct per environment, since it derives every client secret and signs every access token (a shared key would let a staging credential authenticate against production). Optional: GITHUB_TOKEN for the OSS aggregator's build-time rate limit.

Verification

Max 500 lines per source file — split if exceeding.

<important if="you have finished implementing or modifying code"> Run manually before declaring done: 1. `pnpm types` — astro check + tsc --noEmit 2. `pnpm test` — vitest 3. `pnpm lint` — biome 4. `pnpm knip` — no unused files/deps/exports </important><important if="you are writing or modifying tests"> - Tests live next to source as `*.test.ts`, mirrored name (`foo.ts` ↔ `foo.test.ts`) - Vitest with globals enabled — no need to import `describe` / `it` / `expect` - Globals are typed via `"vitest/globals"` in `tsconfig.json` (`types` array) - Path alias `@` resolves to `src/` - `src/pages/**` excluded from test discovery — extract endpoint logic into a `src/lib/` or `src/<domain>/` module and test that instead - **Test only the module's public boundary** (exported functions), not internals — see `.claude/rules/deep-modules.md` - **Pure functions only** in unit tests. For code that touches fs / network / process, extract a pure helper and test it; cover the side-effecting orchestrator with a separate integration test (none ship by default) - Reference: `scripts/init-project-lib.test.ts` shows the convention — `describe` per exported function, `it.each` for parametric cases - **Asserting against build output:** call `buildSite()` from `src/site/build-output.ts` in `beforeAll`. It runs `astro build` *once per test run* behind an on-disk lock (`src/site/build-once.ts`), because vitest runs suites in parallel isolated workers and `astro build` empties `dist/` before writing it — two unsynchronised builds leave every build-output suite intermittently reading a directory the other just wiped. `vitest.global-setup.ts` clears that state at the start of each run (and on each watch re-run) and deliberately never builds, so filtering to an unrelated file still costs nothing. Every suite that reads `dist/` asserts `buildRunCount() === 1`, so a regression here fails loudly instead of going flaky. </important><important if="you are creating or reviewing design documents"> - `/docs` is the single source of truth for business requirements - Apply review notes/status updates directly in the corresponding design doc - Never create separate md files for reviews/audits/analyses unless explicitly asked </important><important if="you are editing wrangler.jsonc or adding Cloudflare bindings"> - Run `pnpm cf-typegen` immediately to keep `worker-configuration.d.ts` in sync - Don't edit `worker-configuration.d.ts` by hand — it's auto-generated - Prefer `custom_domain: true` over `routes` with `zone_name` (see `.claude/rules/cloudflare-deployment.md`) </important>

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.