Files
headroom/docs/app/sitemap.ts
Tejas ChopraandClaude Opus 5 4bca514acd docs: correct the published site against the code (#3388)
Audited all 52 pages of docs.headroomlabs.ai/docs against source,
executing code rather than reading it. **36 pages changed.** Every
figure that could not be traced to a benchmark, a test, or a committed
artifact was measured or removed — none was replaced with a different
guess.

## The site was telling users things that were not true

**Telemetry.** `proxy.mdx` stated *"nothing is sent to Headroom Labs"*
and that the anonymous beacon *"has been removed from the code."*
Neither is true — `BEACON_DEFAULT_ON = True`
(`headroom/telemetry/beacon.py:56`), `is_beacon_enabled()` is fail-open,
and there is a live POST at `headroom/telemetry/session.py:75`.

`proxy.mdx` and `limitations.mdx` now describe both switches accurately,
say why the beacon exists (compression quality is the product; it shows
when a release regresses a ratio across real workloads), and list the 12
fields the collector allowlists instead of asserting "content-free". The
install id is disclosed for what it is: a random UUID, not a machine
fingerprint, resettable by deleting the file.

**Numbers.** The landing page's "Proof" table claimed 92/92/47/73%
savings from a harness that seeded nothing, so it could not reproduce a
figure even in principle.

| Scenario | Claimed | Measured |
|---|---|---|
| Code search (100 results) | 92% | **21%** |
| SRE incident debugging | 92% | **57%** |
| Codebase exploration | 47% | **42%** |
| GitHub issue triage | 73% | **30%** |

`real_world_agent_benchmark.py` now seeds, and
`benchmarks/index_proof_table.py` measures the same four scenarios
through the real tokenizer and the real `compress()` path with no
network call. Stable across five seeds; the page cites the command.

Latency was wrong in the *other* direction — 189 ms and 943 ms published
against **0.21 ms and 0.80 ms** measured. The docs made the product look
~1000× slower than it is.

**Examples.** Every `agno` example was broken at line one, including
Quick Start: `HeadroomAgnoModel`'s first dataclass field is `id`, so a
positional wrapped model bound to the wrong field and raised
`ValueError`. `api-reference.mdx` — the canonical signature reference —
had 13 broken examples, including three `AttributeError`s in the first
three lines of its `simulate()` block. Four integration pages omitted
the `[proxy]` extra and then told the reader to run `headroom proxy`,
which fails immediately. `ccr.mdx` showed SDK-level retrieval that only
exists in the proxy handlers.

Also: six Prometheus metric names that are never emitted, a Grafana
dashboard filtering on a label no metric carries, a documented deploy
workflow that does not exist, a 365-day retention default the code caps
at 30, and CCR TTL stated as 5 minutes against an actual 1800s.

## Canonical URL bug

`robots.ts`, `sitemap.ts` and `layout.tsx` fell back to a hardcoded
`headroom-docs.vercel.app` when `NEXT_PUBLIC_SITE_URL` was unset — so
the live site served a sitemap and `Host:` on the wrong domain and
pointed crawlers at the wrong canonical. Verified in the build output:
robots and all 53 sitemap URLs now carry `docs.headroomlabs.ai`.

Setting `NEXT_PUBLIC_SITE_URL=https://docs.headroomlabs.ai` in Vercel is
still worth doing so previews match, but the code no longer depends on
it.

## Verification

Four adversarial judges re-checked this work. They confirmed the
landing-page table reproduces digit-for-digit across five seeds, found
**zero cross-page contradictions**, independently regenerated all nine
surviving compression percentages, and proved `headroom_keep_turns` dead
at runtime with a mocked-transport test. They also caught two links this
audit had reversed to the deprecated org, and 18 examples it had missed
— both fixed here.

`next build` passes with all 52 pages prerendered, matching the
pre-change baseline.

## Follow-up, not in this PR

- GitHub org migration (`chopratejas` → `headroomlabs-ai`) across
source, manifests and packaging, plus stale-domain fixes in `llms.txt`,
the dashboard UI and `pyproject.toml`.
- `wiki/` disposition: it is unpublished and unbuilt, and
`wiki/benchmarks.md` carried an invented production-telemetry section
(250+ instances, 1.4 billion tokens saved) that exists nowhere in the
repo.
- `langchain.mdx` imports are dead against LangChain 1.x
(`langchain.memory`, `langchain.retrievers`,
`create_openai_tools_agent`). Needs a pin-vs-rewrite decision.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

https://claude.ai/code/session_01HRaEPjQcCSAwD2xbQMNENu

---------

Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
2026-09-02 15:15:37 +05:30

40 lines
1.4 KiB
TypeScript

// Next.js App Router sitemap convention (Next 13+). Pulls every page
// out of the Fumadocs ``source`` (same source that backs ``/llms.txt``,
// search, and the OG image generator) and emits a valid sitemap.xml.
//
// Search engines and AI crawlers use this to enumerate every doc page
// without scraping HTML. The ``robots.ts`` route advertises the
// sitemap URL so well-behaved crawlers find it on the first GET.
import type { MetadataRoute } from 'next';
import { source } from '@/lib/source';
const SITE_URL = process.env.NEXT_PUBLIC_SITE_URL ?? 'https://docs.headroomlabs.ai';
export default function sitemap(): MetadataRoute.Sitemap {
const now = new Date();
// Static top-level routes (home page; docs index is covered by the
// page enumeration below).
const staticRoutes: MetadataRoute.Sitemap = [
{
url: `${SITE_URL}/`,
lastModified: now,
changeFrequency: 'weekly',
priority: 1.0,
},
];
// Every Fumadocs page (introduction, quickstart, installation,
// integrations, …). ``page.url`` is the relative URL like
// ``/docs/quickstart``; ``page.data`` carries the front-matter.
const docPages: MetadataRoute.Sitemap = source.getPages().map((page) => ({
url: `${SITE_URL}${page.url}`,
lastModified: now,
changeFrequency: 'weekly' as const,
priority: 0.8,
}));
return [...staticRoutes, ...docPages];
}