Skip to content

LLM ingestion: agent instructions, per-page .md pages, apex llms.txt link - #26

Open
yuvalava wants to merge 3 commits into
mainfrom
feat/llms-agent-instructions-per-page-md
Open

LLM ingestion: agent instructions, per-page .md pages, apex llms.txt link#26
yuvalava wants to merge 3 commits into
mainfrom
feat/llms-agent-instructions-per-page-md

Conversation

@yuvalava

Copy link
Copy Markdown
Contributor

Brings the docs' LLM surface up to the current patterns used by Stripe, ElevenLabs, Supabase, and Vercel.

1. "Instructions for AI agents" section in llms.txt — tells agents how to fetch a single page as Markdown, where the full corpus lives, warns that chain coverage changes frequently (cite live pages, not trained knowledge), and directs product/pricing questions to magmadevs.com/llms.txt.

2. Per-page Markdown twins — the existing llms_full.py hook now also writes each page's Markdown next to its HTML: drop the trailing slash, append .md (/deployment/cache/ -> /deployment/cache.md; section indexes collapse to /deployment.md; root -> /index.md). An agent answering one question fetches ~3 KB instead of the whole llms-full.txt. Advertised in llms.txt and robots.txt.

3. Apex URL fixhttps://www.magmadevs.com/llms.txt 302-redirects to the apex domain; crawlers that don't follow redirects get an empty body. Both references now point at https://magmadevs.com/llms.txt directly.

Bonus: the Pages workflow now also triggers on hooks/** / overrides/** — previously a hook-only change never redeployed the site.

Verified: mkdocs build --strict passes locally; 36 per-page .md files generated with correct paths and no duplicated H1s.

🤖 Generated with Claude Code

yuvalava and others added 3 commits July 27, 2026 10:29
Three upgrades to the LLM-ingestion surface, following the patterns used by
Stripe, ElevenLabs, Supabase, and Vercel:

- llms.txt: add an 'Instructions for AI agents' section (Stripe/ElevenLabs
  pattern) — how to fetch a single page as Markdown, where the full corpus
  lives, a freshness warning for chain coverage, and where product/pricing
  facts live so agents don't infer them from these docs.
- llms_full.py: emit a per-page Markdown twin next to each page's HTML
  (URL minus trailing slash + .md, e.g. /deployment/cache/ ->
  /deployment/cache.md; section indexes collapse to <section>.md; the root
  serves at /index.md). Lets an agent fetch one topic cheaply instead of
  the whole llms-full.txt corpus. Advertised in llms.txt and robots.txt.
- Point the two www.magmadevs.com/llms.txt references at the apex
  https://magmadevs.com/llms.txt — the www URL 302-redirects, and naive
  crawlers that don't follow redirects get an empty body.

Also: the Pages workflow now triggers on hooks/** and overrides/** changes
(previously a hook edit alone never redeployed the site).

Strict build passes; 36 per-page .md files verified in site/.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Mintlify-style affordance next to every page H1:

- Main button fetches the page's .md twin (same-origin) and copies it to
  the clipboard, flipping to 'Copied' for 2s. Falls back to the legacy
  execCommand copy where the async Clipboard API is denied, and to opening
  the raw .md in a new tab if copying is impossible.
- Dropdown: View as Markdown, Open in ChatGPT, Open in Claude — share
  links use the canonical public URL so the assistant can fetch the page.
- Styling follows the existing mdx-* conventions in extra.css; collapses
  to full-width above the H1 on mobile.

Verified in the built site: twin fetch (200, 4.7KB), copied payload,
success state, fallback path, and menu URLs.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
ChatGPT and Claude drop the ?q= prefill whenever they bounce the visitor
through login or a session refresh — there is nothing the link itself can
do about it. Safety net: clicking either assistant link also copies the
prompt ('Read <page>.md so I can ask questions...') to the clipboard so
the visitor can paste it when the prefill is lost.

Verified across all 36 pages of the built site: button injected, both
assistant links carry identical well-formed prompts, every referenced
.md twin resolves, and the click-to-copy fires on both links.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant