R349 · Knowledge for agents › Docs-as-code and project memory

Serving docs to agents: Gradle's llms.txt, Markdown by content negotiation, and one DSL

Read the original

docs-as-codeagent-readinessretrievalconventionscoding-agentsvendor

Source: docs.gradle.org/llms.txt and one of the Markdown User Manual pages it indexes, both fetched 26 Nov 2026, plus the announcement that pointed at them. The index itself is the primary source for everything below.

The problem being solved

A coding agent asked about a build tool has two ways to get an answer: read the documentation, or rely on what it absorbed during training. The documentation is usually the better source and the harder one to consume — it is HTML assembled for a browser, wrapped in navigation, and in Gradle's case every build-script sample appears twice, once in the Groovy DSL and once in Kotlin. An agent that parses that badly, or gives up on it, answers from training data instead, and training data pins it to whatever version was current when the model was trained. For a tool that ships frequently, that is a silent correctness problem rather than a style one: the API the agent recommends may have moved.

Gradle's answer is to serve the same documentation in a second shape, aimed at machines.

What is actually published

Three mechanisms, which are worth separating because they are independently useful:

1. An index at /llms.txt. It follows the emerging llms.txt convention — an H1 title, a blockquote summary, then ## sections of Markdown link lists with a one-line description per link, including the convention's "Optional" section. It is about 47 KB and lists roughly 270 links across sixteen sections (getting started, releases, fundamentals, tutorials, best practices, DSLs and APIs, reference, CI, structuring builds, optimizing, securing, IDE integration, how-tos, API reference, and so on), with the reference section alone carrying well over a hundred entries. A companion llms-full.txt is linked from the top for agents that want the whole corpus rather than a map of it.

2. Markdown by two routes. Every User Manual page exists at the same URL with .md instead of .html, and any page returns Markdown when requested with Accept: text/markdown. The first is discoverable by URL guessing; the second is correct HTTP content negotiation. Publishing both is the right call, because an agent that only knows how to rewrite a path still works, and a well-behaved client gets the same result without inventing URLs.

3. A "notes for agents" preamble. Before the first section, the index tells the reader in prose that current in a URL means the latest release, that versioned docs live under /<version>/, how to get Markdown by either route, that examples use the Kotlin DSL, that the Markdown pages keep only the Kotlin variant of dual-DSL samples, and that builds should be run through the Wrapper (./gradlew build) rather than a locally installed gradle.

That last item is the interesting one. It is not documentation of the docs — it is a behavioural instruction aimed at whatever is reading, placed where that reader will see it first. The llms.txt convention does not specify such a block; Gradle added it.

Dropping one DSL is the decision worth arguing about

The Markdown pages carry only the Kotlin DSL sample where the HTML shows both. Checking one page confirms it: the Wrapper page's single build-script sample is labelled build.gradle.kts with no Groovy counterpart.

For the agent this is a clear win. Two samples of the same thing in two languages is the shape most likely to produce a confident wrong answer — a model that pattern-matches across both can emit Groovy syntax inside a .kts file, which is a class of error any Gradle user will recognise. Halving the sample surface and declaring the dialect removes the ambiguity rather than asking the model to resolve it.

The cost is that the machine-readable corpus is now a subset of the published documentation, not a rendering of it. Anyone maintaining a large Groovy build and pointing their agent at this index is being served examples in a language their build does not use. That is defensible — Kotlin is the recommended DSL — but it means "the Markdown docs" and "the docs" are not the same document, and a reader who does not notice the preamble will not know which one they have.

What this costs to build, and what it does not solve

The cheap version of this is a rendering pipeline that already has the source in a markup language, a route that serves it, a content-negotiation header, and a generated index. None of that requires a model, an embedding, or a vector store — which is the strongest practical argument for the approach: it is static files and one HTTP header, and it degrades to normal documentation when nobody uses it.

What it does not address:

Why this matters beyond Gradle

The general pattern is a second representation of an existing corpus, chosen for a non-human reader, published as static files: an index with descriptions so a retrieval step can pick pages without fetching them all, content negotiation so a well-behaved client gets the right format, canonical-dialect samples so the model has one answer rather than two, and a plain-language preamble stating the invariants (version meaning, URL patterns, how to run things) that a human infers from page furniture and a model does not.

Any project with versioned documentation and an API that moves has the same problem Gradle has, and most of them are still serving only browser HTML.

Review checklist, if you are publishing docs for agents

Part of the Research notes on nowucca.com. Figures and claims are the source's own unless the summary says otherwise.