# agentsite <!-- ref: @agentsite/project type: project tags: [agentsite, project, overview, terminology, architecture, index] triggers: [need to make SPA content visible to LLMs, want to extract markdown and meta tags, cache rendered content for performance, what does agentsite know, where does agentsite doctrine live] trigger_prompt: When a developer wants to ensure their single-page application is indexed and understood by language models, or when they need to find where a given piece of agentsite doctrine lives. category: reference last_reviewed: 2026-08-04 complements: [@agentsite/spec-audit, @protocol/spec, @protocol/context-tuning] audience: [agent-author, claude-code-user] version: 10 updated_at: 2026-10-30T03:18:35.921Z --> Root index for agentsite: what the project is, plus the branch map for every convention and decision. ## About External service that makes SPA content visible to LLM crawlers. Service A (NestJS + Playwright) renders a customer's SPA route, extracts markdown + meta + OG, and caches by `(site, path)`. Service B (`agentsite.js` snippet, served at `GET /snippet.js` — customers `curl` it into their server, no npm dep) reads the customer's `index.html` once at startup and per-request fetches the JSON `RenderBundle` from `/render?url=...`, builds the `<head>` fragment client-side, and splices the rendered markdown into the **top of `<body>`** (moved there 2026-05-19 so `curl ... | head` reads agent content before the empty SPA mount div). The wrapper depends on `bodyMode`: the default `preboot` emits `<div id="agentsite-preboot" aria-hidden="true"><pre data-content-type="text/markdown" data-source="agentsite">`, hidden in JS-capable browsers by a head toggle; `noscript` mode emits the same `<pre>` inside a `<noscript>`. The old `<script type="text/llms.txt">` just before `</body>` is RETIRED — do not grep for it, and note that the Nginx pattern (F) goes through the same `applyBundle`, so it carries the markdown too. No UA switching — content lives in the DOM for everyone. See `SPEC.md` at project root for vision, principles, decisions, and the chunked roadmap. ## Project Details | Property | Value | |----------|-------| | Name | agentsite | | Title | agentsite | | Domain | agentsite.app (LIVE). `agentsite.com` does not serve — it fails at TLS, and the only ingress hosts are `agentsite.app`, `api.agentsite.app` and the `*.agentsite.app` demos. Checking `agentsite.com` and reading the connection failure as an outage is a confident wrong answer; verified 2026-10-30. | | Frontend URL | http://localhost:3000 — but port 3000 on the dev box is commonly another project's server. Start agentsite's own vite on a pinned port: `cd frontend && ./node_modules/.bin/vite --port 3100 --strictPort`. | | Backend URL | http://localhost:8000 | | DB | agentsite_local (Postgres) | ## Architecture Notes - **Renderer is an interface, not a library call.** `Renderer` interface with `PlaywrightRenderer`. Chunk-2 bake-off evaluated a TinyFish-backed implementation; Playwright won and TinyFish was retired. The interface stays so a future engine can plug in without a refactor. - **Output = markdown for LLMs.** Semantic structure (headings, lists, tables, link text, meta) is preserved. Visual layout is dropped. - **Per-site tokens pin to origin.** A leaked token is useless off its registered domain. - **Billing unit = snippet→API call.** Underlying crawls are infra cost. - **Paid from day one.** User signup + per-site tokens + usage counter are v0 scope. Counter is the source of truth for future Stripe metering. ## Domain Terminology - **Site** — a domain registered by a user. Owns a token + usage counters. - **Bundle** — the cached render for a `(site, path)`: markdown body + meta tags + OG fields + image refs. - **Cold hit** — cache miss. Response is the "generating" placeholder; a render job is enqueued. - **Renderer** — the interface for turning a URL into a Bundle. Implementation: Playwright (in-house). A TinyFish-backed implementation lost the Chunk-2 bake-off and was removed. - **Snippet** — the customer-installed `agentsite.js` Express handler (downloaded from `GET /snippet.js`) that calls our `/render` API and splices the Bundle into the served `index.html`. Replaced the old `@agentsite/middleware` npm package in Chunk 9. --- ## Knowledge tree Project doctrine lives in branch entries, not here. Each branch is a set of decisions; fetch a single one with `?section=<slugified-heading>` instead of pulling the whole branch. **Public — `@agentsite`** | Branch | Fetch it when | |---|---| | [`install-patterns`](@agentsite/install-patterns) | choosing or documenting an install, touching the snippet, changing install docs or `demos/after/` | | [`scoring-doctrine`](@agentsite/scoring-doctrine) | changing score math, probe behaviour, or how the score is described | | [`render-semantics`](@agentsite/render-semantics) | touching the fetch/render pipeline, `/llms.txt`, bypass responses, or the `agentsite` namespace | | [`platform-conventions`](@agentsite/platform-conventions) | adding scheduled work, metering a billable surface, wiring analytics, verifying UI locally | **Private** — commercial doctrine (pricing, outbound, positioning, ops) lives in a private repo; never mirror it here. **Also in this repo** — [`@agentsite/spec-audit`](@agentsite/spec-audit) when auditing shipped code against the recorded spec. Global working preferences are **not** here — they apply in every repo. See `@protocol/engineering-defaults`, `@protocol/verification-tactics`, and the language traps (`@protocol/zsh-tied-variable-trap`, `@protocol/postgres-timestamp-self-match`, `@protocol/vue-facing-decorator-traps`). Adding knowledge? Route it with [`@protocol/memory-routing`](@protocol/memory-routing) before it lands in a harness memory store; tune an overweight base with [`@protocol/context-tuning`](@protocol/context-tuning). --- *Related: `@content/youtube/aie/the-one-thing-every-ai-agent-framework-agrees-on-mislav-ivanda-daytona` · `@agentsite/render-outputs` · `@agentsite/platform-conventions` · `@protocol/root-cause` · `@agentsite/aeo-voice-list`* --- *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).*