# AgentSite — Rendered Outputs and Bypass <!-- ref: @agentsite/render-outputs tags: [agentsite, llms-txt, bypass, markdown, attribution] triggers: [what goes in llms.txt, bypass response shape, 502 or 200 on bypass, markdown frontmatter fields, can we claim we rendered this] trigger_prompt: When changing what AgentSite emits — /llms.txt, bypass responses, or rendered artifact metadata. category: reference complements: [@agentsite/render-semantics] version: 3 updated_at: 2026-11-05T18:54:35.870Z --> What the service returns and what it may say about itself. /llms.txt is a pointer; bypass returns 200 with an inline shell; rendered artifacts carry no source byline. Fetch this when: what goes in llms.txt; bypass response shape; 502 or 200 on bypass; markdown frontmatter fields; can we claim we rendered this. Part of [`@agentsite/render-semantics`](@agentsite/render-semantics) — see it for sibling topics. --- ## /llms.txt is a pointer, not a reference **AGENTSITE_LLMS_TXT should be a curated overview + links — not a self-contained guide. Defer implementation detail to /docs.md and /install.md so the reader has a small context budget at first touch.** `/llms.txt` is the **primary first-touch surface for LLM crawlers**. Its job is to give an agent enough to know what the project is and where to look next — not to teach them everything in one page. Per llmstxt.org, llms.txt is a curated pointer file with H1 + brief description + section headings with links to deeper resources. **Why:** agents have small context budgets. A comprehensive `/llms.txt` competes with whatever else the agent is loading — install templates, endpoint specs, customer code. The more the agent has to read in `/llms.txt` before it can act, the worse the install / integration experience. **How to apply:** 1. **Top of `/llms.txt`** — what agentsite is + what problem it solves, in 2-3 sentences. Not "here's how the snippet rewrites the head" — that detail belongs in `/docs.md`. 2. **Install section** — name the patterns; do NOT inline their templates, env-var rules, or verification commands. One line per pattern + "see /install.md for templates." 3. **Endpoints, auth, cache** — short tables / lists are fine since agents calling the API benefit from them being inline. Detailed semantics (error codes, response header taxonomy, cache TTLs) go in `/docs.md`. 4. **Anything narrative or essay-shaped** — JSON-LD detection rules, `tldr` extraction algorithm, robots.txt policy rationale, body-injection modes, schema carry-through rules — defer to `/docs.md`. 5. **When tempted to add to `/llms.txt`** — ask "does the agent need this to act, or to understand?" If it's understanding, link to `/docs.md`. If it's act-ability (an endpoint, an auth header shape, a token format), keep it. Two reference docs `/llms.txt` defers to: - `/install.md` — install templates, decision rule, per-platform deltas. - `/docs.md` — detailed API reference (auth modes, cache semantics, JSON-LD detection, examples). ## Bypass returns 200 + inline shell **Cooperating-server fallback pattern. The deliberate-bypass path on /render returns 200 with the customer's actual index.html bytes inline — generic across nginx/Caddy/Express/any caller. Locked 2026-05-19.** When agentsite's `/render` decides not to serve a response (`X-Agentsite: none` probe, or a paused site), the bypass branch: **`Cache-Control` is not a bypass (changed 2026-11-05).** From 2026-05-17 a caller's `no-cache` / `no-store` also bypassed, read as a browser hard-reload. Agents and scanners send `no-cache` by default, so they got the bare shell, with HTML for `/sitemap.xml`, `/llms.txt` and `/.well-known/*`, and isitagentready scored agentsite.app 0/100. `/render` and `/bundle` now ignore caller `Cache-Control` entirely: the cached bundle is served, and no client can force a synchronous render, so the DoS protection holds. Regression spec: `backend/test/render/cacheControlIgnored.spec.ts`. 1. Calls `siteService.resolveIndexPath(host)` to get the per-site SPA shell path. 2. Calls `customerSourceFetcher.fetch(host, shellPath, ...)` to get the actual shell bytes (already LRU-cached, sub-ms on hits). 3. Returns **`200` + `Content-Type: text/html` + the shell body**. 4. If any step fails, throws 502 so nginx's `error_page 502 504 = @raw_shell;` (with `proxy_intercept_errors on;`) still catches genuine failures for graceful degradation. `/bundle`'s bypass returns `404` (snippet/SDK consumers branch on `!res.ok`; JSON-shaped endpoint, can't return inline shell sensibly). **Why:** - Status codes are public — visible to logs, alerting, browser devtools, intermediaries. A 502 for an intentional decline is misleading on all those surfaces. The truthful response for an SPA route is the shell itself (every unmatched route in an SPA returns `index.html` anyway — that's what `try_files $uri /index.html =404` does). - Earlier 502+error_page design silently required `proxy_intercept_errors on;` in every customer's nginx — most installs missed it, surfacing as Cloudflare Bad Gateway on hard-reload. - Intermediate `X-Accel-Redirect: /__raw/index.html` design fixed the visible bug but stayed nginx-specific. A future Caddy/Envoy/raw-browser caller of /render would have gotten `200 + empty body` and served nothing. - Inline shell is generic across all current and future callers of /render. Cost is one cached fetch per bypass (DoS surface is equivalent to a cache-warm normal render, which is already the rate-limit baseline). **How to apply:** - For `/render`-shaped HTML endpoints, the bypass response IS the shell. Fetch via the existing `CustomerSourceFetcher` + `SiteService.resolveIndexPath` machinery (same as `dispatchHtml` uses on the happy path). - For server-to-server JSON endpoints (`/bundle`), use 404 + `X-Agentsite-Status: bypass` header. Snippet code already does the right thing with `!res.ok`. - The nginx `proxy_intercept_errors on; error_page 502 504 = @raw_shell;` pair stays — but it's reserved for **real** failures (DNS, connect/read timeout, genuine upstream 5xx). The bypass case no longer needs it. **Generalizes:** for any cooperating-server "step out" branch, prefer to return the truthful response body the caller can serve verbatim, rather than abusing status codes as private signals between servers. If the fronting server is nginx, X-Accel-Redirect is also valid as an optimization — but only if it's strictly additive (e.g., body matches the redirect target). Don't make it the *only* path. **Prior shapes:** - 502 + `error_page 502 = @raw_shell` (shipped 2026-05-17, broke hard-reloads on the nginx-fronted dogfood site). - 200 + `X-Accel-Redirect: /__raw/index.html` (shipped 2026-05-19 cf9db4e, fixed the visible bug but kept it nginx-only). - 200 + inline shell HTML (shipped 2026-05-19, the generic answer). ## No source attribution on rendered artifacts **Markdown frontmatter + similar metadata names agentsite as renderer (`rendered: "<iso>" agentsite`), never as content source (`source: agentsite`). Avoids future credibility / authorship issue.** Frontmatter on agentsite-rendered `.md` files reads as a **render log**, not a byline. Use a single `rendered: "<iso>" agentsite` line. Don't emit `source: agentsite` (or any field that implies we authored the content) on rendered artifacts. **Why:** "If we try and brand the output as if we sourced the content, that would be an issue at some point." We render customer content; we are not its source. A two-line `rendered_at: <iso>` + `source: agentsite` reads like a byline; a single `rendered: "<iso>" agentsite` reads like a render-log entry. **How to apply:** - Anywhere we emit per-page metadata for customer-content artifacts (markdown frontmatter, well-known JSON, anything an agent might quote), name the renderer if useful but never claim source. - Locked 2026-05-31. Applies across `backend/src/controller/RenderController.ts` (bundleToMarkdown), `packages/core/`, `packages/express/`, `packages/edge/` — keep the four emitters in sync. - Pre-existing `data-source="agentsite"` HTML attributes on injected `<pre>` blocks are scanner markers, not content-source claims — leave those alone. --- *Related: `@content/youtube/aie/finops-for-ai-agents-who-spent-all-the-tokens-tisha-chawla-susheem-koul-microsoft` · `@content/youtube/aie/tethered-our-agents-are-us-shu-fang-two-sigma` · `@content/youtube/nate-herk/karpathy-llm-wiki-obsidian-claude-code-setup` · `@content/youtube/patrick-ellis/2025-06-21-ai-startup-playbook-2025-a-founderctos-insights-from-ai-engi` · `@agentsite/platform-conventions`* --- *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).*