agentleFS
NVIDIAKnown publisherNVIDIA/sphinx-llm/AGENTS.md

sphinx-llm

AGENTS.md44 starsChanged 4 months agoApache-2.0View on GitHub

sphinx-llm is a collection of Sphinx extensions for working with LLMs. It serves two purposes: 1. Enabling LLMs to consume documentation - Generates llms.txt, llms-full.txt, and per-page markdown files following the llms.txt standard 2. Leveraging LLMs to generate content - Uses LLMs to generate static content during builds (e.g., the docref directive for page summaries) Prefer using Git worktrees for development. **sphinx_llm.txt (src/sphinx_llm/txt.py)** - Hooks into Sphinx's builder-inited and build-finished events - Spawns a parallel subprocess running sphinx-build -b markdown…

  • Where files are headingNew AGENTS.md files have more rules about keeping secrets out of the code, and fewer about checking a change actually works.

    Of the AGENTS.md files we read, the 11,736 first seen in the last six months, against the older ones: the kind of rule that gained most share, and the kind that lost most. About files like this in general, not this one, and an estimate, since a kind is a pattern in the words.

  • In this repositoryOne other file it gives its agents.

The file

We split this AGENTS.md into the rules it gives an agent

2 rules. About 0 are common, 2 are distinctive, and 0 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈2

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 0

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Prefer using Git worktrees for development.

    line 19
  2. Distinctive:

    All commits by contributors who are not employed by NVIDIA must be signed off using git commit -s (Developer Certificate of Origin).

    line 115

≈ “Common” is an estimate: at least 1 in 5 of the 16,597 AGENTS.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
AGENTS.md

AGENTS.md

This file provides guidance to coding agents working with code in this repository.

Project Overview

sphinx-llm is a collection of Sphinx extensions for working with LLMs. It serves two purposes:

  1. Enabling LLMs to consume documentation - Generates llms.txt, llms-full.txt, and per-page markdown files following the llms.txt standard
  2. Leveraging LLMs to generate content - Uses LLMs to generate static content during builds (e.g., the docref directive for page summaries)

Development Commands

Prefer using Git worktrees for development.

Setup

# Install dependencies with uv (recommended)
uv sync --dev --extra gen

Testing

# Run all tests
uv run pytest src/sphinx_llm/tests/

# Run tests with coverage
uv run pytest src/sphinx_llm/tests/ --cov=sphinx_llm --cov-report=xml

# Run tests against a specific Sphinx version
uv run --with "sphinx>=7,<8" pytest src/sphinx_llm/tests/

Linting and Formatting

# Ensure pre-commit hooks are installed
uv run pre-commit install

# Run ruff linter with auto-fix
uv run pre-commit run ruff --all-files

# Run ruff formatter
uv run pre-commit run ruff-format --all-files

# Run all pre-commit hooks (includes ruff, prettier, markdownlint, codespell,
# license headers)
uv run pre-commit run --all-files

Building Documentation

# Build the example docs (recommended for development)
uv run --dev sphinx-autobuild docs/source docs/build/html

# Build docs once
uv run --dev sphinx-build docs/source docs/build/html

Architecture

Core Extensions

sphinx_llm.txt (src/sphinx_llm/txt.py)

  • Hooks into Sphinx's builder-inited and build-finished events
  • Spawns a parallel subprocess running sphinx-build -b markdown to generate markdown files
  • The MarkdownGenerator class orchestrates:
    1. Parallel markdown build (can be disabled via llms_txt_build_parallel config)
    2. Merging markdown output with HTML output (each page gets .html.md extension)
    3. Generating llms-full.txt (concatenated markdown)
    4. Generating llms.txt (sitemap with descriptions)
  • Handles both html and dirhtml builders with different path structures
  • For dirhtml builder, supports three suffix modes via llms_txt_suffix_mode:
    • "file-suffix": Only generates page/index.html.md files
    • "url-suffix": Only generates URL-style page.md files
    • "both" (default): Generates both formats for maximum compatibility

sphinx_llm.docref (src/sphinx_llm/docref.py)

  • Parses directives into pending nodes and collects unique requests in the Sphinx environment
  • Applies authored directive and html_meta overrides before consulting the generated-summary cache
  • Generates missing summaries at env-updated through the shared OpenAI-compatible client and llms_txt_summary_* configuration without modifying source files
  • Stores requests and effective state in the Sphinx environment, persists generated records in the shared versioned page-summary cache, and supports purge/merge
  • Writes sphinx-llm-summaries.json with effective summaries and provenance
  • Requires the gen dependencies and an explicitly configured model for cache misses

Test Structure

Tests live in src/sphinx_llm/tests/ (not a separate tests/ directory). Tests use pytest fixtures that build the example docs in docs/source/ into temporary directories with different builders and parallel settings.

Key test fixture: sphinx_build - parametrized fixture that tests both html and dirhtml builders with parallel and sequential markdown building.

Commit Requirements

All commits by contributors who are not employed by NVIDIA must be signed off using git commit -s (Developer Certificate of Origin).

Pre-commit hooks must be installed. They enforce:

  • Ruff formatting and linting
  • License header in all .py files (using LICENSE_HEADER file)
  • Prettier for YAML
  • Markdownlint for Markdown
  • Codespell for spelling

Version Management

Uses hatch-vcs for version management from git tags. Version is generated at build time into src/sphinx_llm/_version.py.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.