# AgentSite — Bundle Endpoint Crawl Audit
<!--
ref: @agentsite/agent-site-bundle-endpoint-crawl-audit
version: 1
updated_at: 2026-10-31T01:43:49.970Z
-->

Once a site sets `bundleEndpoint`, every page its manifest covers should reach AgentSite from the endpoint and never from a Chromium render. This audit checks that, and it can be rerun after any manifest or endpoint change. It exits non-zero when a covered page was rendered after a cutover you name.

## Run it

1. **Pick a cutover.** Use the moment the endpoint or manifest change went live, which means the deploy time, not the commit time. Rows rendered before it are history.
2. **Read the manifest AgentSite applies.** A `bundleManifest` declared in the site config (`GET /site/{id}/config`) replaces the one the endpoint serves. With neither, every path is `adaptive`. Classify paths against this manifest, not the one you meant to ship. They differ exactly when the config change has not landed yet.
3. **Read `render_bundle` in one READ ONLY transaction**, with a statement timeout and a 5 s lock timeout, so the audit can never queue behind a migration:

   ```sql
   SELECT path, coalesce(body_source, 'null') AS source, rendered_at >= :cutover AS since
     FROM render_bundle WHERE site = :domain;
   ```

   Classify each row's pathname with the manifest. A `render` row after the cutover on any intent other than `exclude` is a failure. Report a family × intent × source × before/after table, and fold `exclude` paths into one row, because on a public site most of them are scanner probes such as `/wp-admin` or `/.git`.
4. **Probe one sample per covered rule.** `volatile` and `always` paths store no rows, so the table cannot show them. Fetch the public page with an agent user-agent and read `x-agentsite-body-source`: anything except `endpoint` is a failure. For a query-form endpoint, also call `GET <endpoint>?path=<sample>` with `X-Agentsite: none`. It must answer `200` with a `markdown` field inside the 2 s budget, which proves the backend renders the page and not only that a cached copy exists.

## Traps

- **Never probe with `GET /site/{id}/bundle?path=`.** It goes through the render cache, so on an excluded path it triggers the very render the audit counts.
- **Match globs exactly as AgentSite does.** `*` stays inside one segment, `**` crosses segments, and a trailing `/**` also matches the stem. A mid-pattern `/**/` matches zero or more segments, so `/@*/**/edit` matches `/@acme/edit` too. An approximate matcher misclassifies the paths it gets wrong, either as covered or as excluded.
- **A 404 from the endpoint is a render.** By contract, AgentSite renders a path the endpoint declines. Malformed links that real crawlers request (a trailing `.` on an id, an unknown key) show up as post-cutover renders of a covered family. Fix them with a rule or a redirect. The audit is right to count them.
- **`GET /site/{id}/rendered-pages` cannot replace the table.** It returns no body source and stops at 500 rows.
- **The endpoint renders as an anonymous caller.** A private resource has to answer 404, never 403. AgentSite caches what it is given and serves it to everyone, and a 403 tells an outsider that the private thing exists.

---

*You're reading a protocol on [protocol.supply](https://protocol.supply) — hosted, searchable knowledge for AI agents. Think Agent Skills, as an API: bootstrap once (`curl -sL https://api.protocol.supply/bootstrap`), search (`/search?q=…`), fetch (`/@repo/slug`).*

*Any skill can become a protocol, and any protocol installs as a local skill — tell your agent "install this as a skill" or see [`@protocol/protocol-to-skill`](https://api.protocol.supply/@protocol/protocol-to-skill).*