kolibri icon indicating copy to clipboard operation
kolibri copied to clipboard

Make developer docs LLM-consumable via sphinx-llm

Open rtibbles opened this issue 6 months ago • 1 comments

❌ This issue is not open for contribution. Visit Contributing guidelines to learn about the contributing process and how to find suitable issues.

Overview

Add LLM-readable output to the Kolibri developer docs build so the published kolibri-dev.readthedocs.io site exposes llms.txt, llms-full.txt, and per-page Markdown alongside the existing HTML. This makes the docs directly consumable by LLM tools (Cursor, Claude.ai web fetches, MCP doc servers) and by in-repo coding agents that benefit from Markdown over HTML.

Complexity: Low Target branch: develop

Context

The llms.txt standard is the prevailing convention for surfacing docs to LLMs: a Markdown sitemap at /llms.txt, optionally a single combined /llms-full.txt, and per-page .md versions alongside HTML. ReadTheDocs serves these files when they appear in the build output but does not generate them (RTD reference). Sphinx core has no built-in support (sphinx-doc/sphinx#13268).

NVIDIA's sphinx-llm extension (released Feb 2026) emits all three artefacts during a normal HTML build. It resolves autodoc directives to real content, which matters because docs/backend_architecture/content/api_methods.rst, docs/backend_architecture/logger/models.rst, docs/backend_architecture/uap/models.rst, and four other files rely on autodoc to render model fields and API methods.

Kolibri's docs already use sphinx_rtd_theme with sphinx.ext.autodoc, m2r, and notfound.extension (see docs/conf.py); requirements are pinned in requirements/docs.txt; the RTD build is configured in .readthedocs.yaml.

The Change

Wire NVIDIA's sphinx-llm extension into the Sphinx build:

  • Add sphinx-llm[gen] (pinned) to requirements/docs.txt
  • Register "sphinx_llm.txt" in the extensions list in docs/conf.py
  • Confirm no conflicts with the existing autodoc, m2r, and notfound.extension extensions, and that the process_docstring hook for Django model fields still applies to the Markdown output

Default configuration is fine; no per-page tuning required for the first pass.

How to Get There

Build the docs from the repo root:

make docs

Inspect the output:

ls docs/_build/html/llms.txt docs/_build/html/llms-full.txt
ls docs/_build/html/backend_architecture/content/api_methods.html.md

Open api_methods.html.md and confirm that autodoc-generated content (model fields, method signatures) is rendered as Markdown rather than appearing as raw .. autoclass:: directives.

Out of Scope

The following are intentionally excluded from this task — file follow-up issues if needed:

  • Content rewrites of existing .rst / .md files for LLM clarity
  • Per-section or per-product llms.txt files (Cloudflare-style tiered structure)
  • "Copy as Markdown" buttons or Accept: text/markdown server-side handling
  • MCP doc server setup or documentation referencing one (e.g. langchain-ai/mcpdoc)
  • Updates to AGENTS.md or CLAUDE.md
  • Any evaluation of how well agents/LLMs actually answer questions from the generated llms.txt

Acceptance Criteria

  • [ ] sphinx-llm[gen] is added to requirements/docs.txt with a version pin
  • [ ] docs/conf.py registers "sphinx_llm.txt" in the extensions list
  • [ ] make docs completes with no new warnings or errors compared to the current build
  • [ ] docs/_build/html/llms.txt exists and contains a Markdown sitemap of the docs
  • [ ] docs/_build/html/llms-full.txt exists and contains the combined documentation content
  • [ ] Every .html page under docs/_build/html/ has a corresponding .html.md companion (e.g. getting_started.html → getting_started.html.md)
  • [ ] The .html.md files for backend_architecture/content/api_methods, backend_architecture/logger/models, and backend_architecture/uap/models render autodoc content as Markdown — model fields and method signatures appear as readable text, not as raw .. autoclass:: directives
  • [ ] After merge and RTD rebuild, https://kolibri-dev.readthedocs.io/llms.txt returns the sitemap and https://kolibri-dev.readthedocs.io/llms-full.txt returns the combined content (verified in the PR follow-up, not in the PR itself)

References

AI usage

Used Claude Code to brainstorm this task and draft the issue. The scope (single PR, minimal change), the chosen extension (NVIDIA sphinx-llm over the jdillard/sphinx-llms-txt alternative based on its handling of autodoc), and the out-of-scope list were all my decisions after Claude presented options with tradeoffs. Claude ran the web research on Sphinx and ReadTheDocs llms.txt support and summarised it; I checked the linked sources before deciding. The acceptance criteria and references are Claude's drafts, edited section by section.

rtibbles avatar May 28 '26 18:05 rtibbles

Plan: Wire NVIDIA's sphinx-llm extension into the Sphinx build so the published docs site exposes llms.txt, llms-full.txt, and per-page .html.md companion files.

  • [ ] Verify the baseline build passes
  • [ ] Pin the sphinx-llm dependency
  • [ ] Register the extension in Sphinx config
  • [ ] Build the docs and verify output
  • [ ] Commit

status


@rtibblesbot's comments are generated by an LLM, and should be evaluated accordingly

How was this generated?
  • Implemented code following the pre-approved plan using test-driven development (red-green-refactor)
  • Ran the project's full test suite and linter before committing
  • For UI changes: captured live screenshots to verify rendering
  • For backend changes: verified with example API/CLI output

rtibblesbot avatar May 28 '26 18:05 rtibblesbot