AI Focus

hyper content negotiation lab

Returning full styled HTML pages to automated readers wastes tokens on navigation chrome and forces brittle scraping instead of structured data. This lab tests real HTTP Accept content negotiation (Vary: Accept) returning HTML, Markdown, JSON-LD, or JSON cleanly from one canonical URL.

Hypothesis

Standard RFC 9110 Accept negotiation (Vary: Accept) on a single canonical URL shrinks automated retrieval payloads significantly without breaking human HTML browsing or duplicating URL trees.

What confirms it: text/markdown and JSON-LD representations measure 50–85% fewer bytes and estimated tokens than the full text/html representation while preserving Vary: Accept and alternate Link discovery headers.

What falsifies or bounds it: Fine-grained custom modality headers (such as Accept-Prompt) fragment CDN caches (Vary cache collapse) or reveal too much fingerprinting surface.

Edge Worker serving /docs/:slug and an SSRF-guarded /negotiate HTTPS proxy across text/html, text/markdown, application/ld+json, and application/json with live byte/token savings diffs. Open hyper content negotiation lab full screen ↗

What this lab tests

Serving monolithic rendered HTML to both visual browsers and automated retrieval pipelines bloats token budgets and mixes chrome with primary content. Does standard RFC 9110 Accept content negotiation solve this from one canonical URL?

Hyper Content Negotiation Lab (GitHub) serves canonical /docs/hyper-content-negotiation resources plus an SSRF-hardened /negotiate?url=https://... proxy, responding with text/html, compact text/markdown, application/ld+json (Schema.org), or application/json while setting Vary: Accept, Link alternates, byte counts, and estimated token reductions.

Open questions

  • Where should negotiation draw the line between coarse standard media types (text/markdown, application/ld+json) and parameter-heavy headers?
  • How well do SSRF-guarded negotiation proxies interact with sites that return different content to bots than browsers?

Iteration log

  • — Shipped /docs/* canonical endpoint, SSRF-hardened /negotiate HTTPS inspector, byte/token savings breakdown, and code blueprint.
  • — Reordered workbench around hypothesis/confirm/falsify signals with live Accept-Prompt cache-collapse testing, CSP-safe syntax highlighting across all wire/code views, 700px responsive layout fixes, and no-cache static asset headers.

Primitives tested: HTTP Accept Header, Vary: Accept, Link Headers, text/markdown, application/ld+json.

This is an active lab under /labs/ and stays off the main RSS feed until graduated into a full essay.

More in content negotiation, signed citations & attribution

Connected labs

← content negotiation, signed citations & attribution · All labs