fix(docs): scope the llms.txt .mdx rule to the URLs it lists - #214
Merged
Conversation
`/llms.txt` stated two rules over the same 79 bullets and nothing scoped the first one: "appending `.mdx` to its URL" gives you the Markdown, and every page "is also published under a locale prefix". Composing them — what a machine reader is meant to do with an `llms.txt` — licensed `/zh-Hans/docs/quickstart.mdx`, `/ja/docs/architecture.mdx` and `/de/docs/quickstart.mdx`, all of which 404. The `.mdx` surface is English-only by construction, not by convention: `next.config.mjs` rewrites `/docs/:path*.mdx` and no locale-prefixed form of it, and `llms.mdx/docs/[[...slug]]` calls `source.getPage(slug)` with no language argument. So this makes the rule state its own scope rather than changing what is served. Nothing served moves: `/llms-full.txt` is byte-identical, and the only delta in `/llms.txt` is the header sentence. The "Other Languages" section is kept as-is — those page URLs resolve and are the only place the file says translations exist at all. Also corrects the comment above `LANG` in `llms-full.txt/route.ts`, which asserted that "the locale text stays reachable per page through the `.mdx` rewrite". Measured false, and it reads like the belief that produced the `llms.txt` wording; fixing the output while leaving the belief invites the wording back. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01G5zjYc2BoFV2NjKBBapC7C
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #210
/llms.txtstated two rules over the same 79 bullets, and nothing scoped the first one:.mdxto its URL"Composing them — exactly what a machine reader is meant to do with an
llms.txt— licensed/zh-Hans/docs/quickstart.mdx,/ja/docs/architecture.mdxand/de/docs/quickstart.mdx. All three 404.What changed
Rule 1 now states its own scope. The served header goes from:
to:
Two sentences of prose, +115 bytes on a file read by machines with a token budget.
Nothing served moves. The
.mdxsurface is English-only by construction, not by convention —next.config.mjsrewrites/docs/:path*.mdxand no locale-prefixed form of it, andapp/llms.mdx/docs/[[...slug]]/route.tscallssource.getPage(slug)with no language argument, so the default language is the only thing that route can serve. The repair makes the file say so; it does not change routing.The Other Languages section is kept as written. Those page URLs resolve (verified below), and it is the only place the file advertises that translations exist at all.
The second trace, same belief
llms-full.txt/route.tscarried a comment asserting "The locale text stays reachable per page through the.mdxrewrite" — measured false, and it reads like the belief that produced thellms.txtwording. Corrected in the same change, with the mechanism spelled out, so fixing the output does not leave the belief behind to invite the wording back. (Third false comment about this machinery; #203 corrected two others.)A source comment above the
llms.txtheader block records why the scope clause is load-bearing: no gate reads prose, so a future rewording that drops it silently restores the defect.Verification
Against
next starton a production build, reading the served/llms.txt, not the source. Gate union re-run on the final commitb776758.Composition, as a machine reader performs it
A script reads the served
/llms.txt, extracts the 79 bullet URLs and rule 2's locale list from the body itself, and probes every composed URL:.mdx/zh-Hans+ listed page URL/ja+ listed page URL/de+ listed page URL.mdx(zh-Hans/ja/de)The cross composition 404s in both builds — that is the routing, and it is unchanged. What changed is whether the file licenses it. Reverse-verified: the same script, run against the captured pre-change body over the same URL space, exits 1 (
LICENSED-404 CHECK: FAIL); against the post-change body it exits 0.Nothing served moved
/llms.txt/llms-full.txtdiffon the served/llms.txtbodies: one line — the header paragraph./docs/quickstart.mdxstill 200text/markdown;/zh-Hans/docs/quickstart,/ja/docs/architecture,/de/docs/quickstartstill 200.Gates
Run on
b776758with a clean tree,--forcethroughout (the turbo cache is shared across worktrees), exit codes captured before any pipe:pnpm turbo run type-check --continue --forceTasks: 1 successful, 1 totalpnpm turbo run build --forceTasks: 1 successful, 1 totalpnpm turbo run test --forceTasks: 1 successful, 1 total,✓ 3 self-test(s) passednode .github/scripts/check-locale-surface.mjs✓ every advertised URL has a source file and every source file is advertised; both llms bodies carry every en-only page title and none from the other localesThe locale-surface gate passes on both sides, as expected — it compares page titles across artifacts and has no notion of URL composition. It is run to confirm page composition has not moved, not as evidence about the wording.
Generated by Claude Code
Generated by Claude Code