Docs As Code
Docs for AILong read

Cross-Linking Documentation to Improve Agent Navigation

Connecting documentation pages reveals relationships that flat search indexes can't find.

Contributing Editor · · 12 min read
Cover illustration for “Cross-Linking Documentation to Improve Agent Navigation”
Docs for AI · September 20, 2026 · 12 min read · 2,808 words

Cross-linking documentation turns a pile of retrievable text into something an agent can actually walk through: a structure where one page points to another for a reason, and the agent can follow that reason instead of guessing. The central claim of this piece is straightforward. A corpus is only as useful to an agent as its traversability, and a flat retrieval index gives an agent none. What follows is an attempt to work through why that's true, what the evidence says about fixing it, and where the fix still falls short.

How LLMs read documentation and where structure helps or hurts

Start with a basic fact that's easy to forget because it's so unglamorous: language models read text sequentially. They don't scan a page the way a person does, glancing at a sidebar, registering that a heading is bolded, noticing that one section is nested under another. Visual hierarchy, the kind that tells a human reader "this is the important part" or "this is a subsection of that," is mostly invisible to a model unless it's been converted into something explicit, like markdown heading levels or a structured markup tag.

Modern documentation sites are loaded with token overhead that has nothing to do with the content itself, navigation bars, JavaScript, promotional banners, cookie notices, and stripping that down affects how much of the content budget is actually usable. Modern documentation sites are loaded with token overhead that has nothing to do with the content itself, navigation bars, JavaScript, promotional banners, cookie notices. Stripping all of that down to clean text is not a precise operation. Get it wrong and either useful context gets deleted along with the clutter, or the clutter survives and eats into a context budget that's already tight. Neither failure is cosmetic. Every token spent rendering a "Sign up for our newsletter" banner is a token not spent on the API parameter the agent actually needs.

Heading hierarchy earns its importance from a specific downstream fact: retrieval-augmented generation systems break documents into chunks, and structural boundaries often determine where those cuts land. If a concept sprawls across three headings, or gets buried three paragraphs deep in a section titled something unrelated, the chunker will slice it in ways that leave each fragment incomplete on its own. A section under a clear heading should contain one complete, coherent thought, because retrieval systems will eventually treat that section as an atomic unit whether the author intended it that way or not.

Fern's approach with <llms-only> and <llms-ignore> tags is a useful illustration of teams taking this seriously as an engineering problem rather than a style question. Content authors can wrap verbose technical detail and cross-references so they're visible only to agents, while marketing calls-to-action and navigation hints get hidden from the same audience. The documentation a human sees and the documentation an agent retrieves don't have to be identical, and increasingly, they shouldn't be.

Why chunking quality is the dominant variable in retrieval accuracy

The embedding model matters less than how the text got chopped up before it reached the embedding model. Roughly 80% of RAG failures trace back to ingestion and chunking, not to the language model doing the generating, according to analysis published by Firecrawl. That's a striking allocation of blame, because most public discourse about RAG obsesses over model choice and prompt engineering while treating chunking as a solved, boring preprocessing step.

The numbers back this up more sharply than intuition would suggest. A 2025 clinical decision support study by Gomez-Cabello and colleagues found adaptive chunking hit 87% accuracy on a medical corpus, against 50% for standard fixed-token recursive chunking on the same material, a difference wide enough to separate a trustworthy system from a coin flip. That's not a rounding error. A system that hits 87% accuracy is one a clinician might trust, while one at 50% fails on every other query.

The production answer that's emerged is hierarchical chunking: small chunks for precision when searching, larger parent chunks for completeness when generating the actual answer. This resolves a trade-off that's dogged retrieval systems from the start, small chunks find things accurately but lack context, large chunks carry context but dilute the signal a similarity search is trying to match against.

There's a ceiling here too. Research into retrieval window sizing consistently finds a degradation point beyond which response quality starts to drop off. Chroma's "context rot" research, testing across 18 models, found that performance degrades as context length grows even on tasks that should be straightforward. Stuffing more into the window is not a free lever to pull.

Metadata is the multiplier that makes well-formed chunks actually useful at retrieval time. Recording a page's title, a short summary, keywords, and its breadcrumb trail alongside each chunk, per analysis published by Atlan, can improve accuracy by up to 5x over content-only retrieval. But even with clean chunks and rich metadata, something is still missing. The agent knows what each chunk says. It still doesn't know how the chunks relate to each other, which is exactly the gap cross-linking is built to close.

Diagram: Adaptive vs. Fixed Chunking: The Accuracy Gap. Visualizes: Show a stark magnitude contrast between two chunking approaches on the same medical corpus (Gomez-Cabello et al., 2025 clinical decision support study): adaptive chunking hit 87%…

What it means to give an agent structural visibility into a corpus

Flat retrieval hands an agent a ranked list. Flat retrieval hands an agent a ranked list, and that ranked list is the whole of what it gets. The agent gets five or ten chunks sorted by similarity score, with no sense of what topic domains exist in the broader corpus, how those domains connect, or what it hasn't seen. It's a bit like being handed a stack of loose pages pulled from a filing cabinet: the information might be exactly right, but there's no way to know if a more relevant page is sitting three drawers over.

Structural visibility changes what's possible in two specific ways. The first is targeted backtracking: an agent that can see it's landed in the wrong branch of a knowledge tree can navigate elsewhere, rather than either giving up or, worse, confidently hallucinating an answer from insufficient material. The second is cross-branch synthesis, the ability to pull together evidence that lives in genuinely different sections, say, an authentication concept documented under "Getting Started" and a rate-limiting rule documented under "API Reference," and combine them into one coherent answer.

Neither of these is possible with a similarity-ranked list alone, because similarity scores don't encode relationship, only resemblance.

Knowledge graphs make the distinction explicit as infrastructure rather than metaphor. Graph retrieval-augmented generation has emerged as a recognized paradigm precisely because typed relationships between entities carry information that embedding similarity does not. Two API endpoints might be nowhere near each other in embedding space yet be tightly coupled in practice, one requires the other's auth token, say. A graph edge can encode that. A cosine similarity score can't.

Design guidance for these schemas tends to converge on a fairly narrow range of node and relationship types. Go too high and accuracy tends to drop, because the agent has too many categories to reason across. Going too low collapses distinctions that actually mattered in the schema.

Corpus2Skill: what a compiled navigation tree looks like at production scale

Corpus2Skill (Sun, Wei, and Hsieh, 2026) is one of the few systems that builds this navigation layer as an explicit, separate compilation step rather than bolting it onto retrieval after the fact. The pipeline clusters documents iteratively, generates LLM-written summaries at each level of the resulting hierarchy, and materializes the whole thing as a tree of navigable files, SKILL.md and INDEX.md, that the agent browses at serve time. No embeddings. No vector store. No BM25 lookup. Just a tree the agent walks.

The scale test is instructive. Applied to WixQA, a corpus of 6,221 support articles evaluated against 200 expert-written questions with gold-standard answers, the compiled tree produced 6 top-level skills and 665 navigation files, backed by a 13 MB document store. Compilation took 6.5 minutes on a 32-CPU server. That's a meaningful number for anyone thinking about operational cost: this isn't a multi-day indexing job, it's something that could plausibly run on a nightly or per-release schedule.

The brief draws a distinction between a "skill" and a "tool" that is easy to blur. A tool is a single-shot lookup, call it, get an answer, move on. A skill shapes reasoning across multiple steps, persisting through a task rather than answering one query in isolation. The SKILL.md and INDEX.md files in Corpus2Skill aren't metadata tags sitting alongside the real content, they are the navigational substrate. The cross-linking, in this system, is the product, not an annotation layered on top of it.

For a documentation team, the practical takeaway splits into two pieces. The one-time compilation is the easy part, a few minutes of compute. Keeping that tree current as the underlying corpus changes is the harder, ongoing part, and it connects directly to the currency issue discussed further down.

What the performance data on navigation-structured corpora shows

Numbers first, then the honest caveats, because both matter here.

Against dense retrieval, RAPTOR, and agentic RAG baselines on WixQA and a 10-dataset macro-average, Corpus2Skill extends RAPTOR's gains by a further 9% on Factuality and 15% on Context Recall. Cluster summaries surface thematic connections that flat embedding similarity simply doesn't capture, because two documents can be thematically related without being lexically or semantically close enough for cosine similarity to catch it.

The hallucination numbers are the more striking finding. Agentic RAG in this evaluation scored 0.528 on a Faithfulness metric, which works out to something close to a 50% hallucination rate, essentially a coin flip on whether a given claim in the output is actually supported by retrieved content. Corpus2Skill closes most of that gap, landing at 0.859 Faithfulness with a 4.5% hallucination rate, within 0.05 of the best single-shot baseline tested. That's a meaningful jump for anyone building a system where a wrong answer has real cost.

But the honest part of this section has to include where the approach doesn't win. Under paired significance testing across datasets, Corpus2Skill won on 5 and tied on 3. The losses aren't random, they track corpus type. Flat retrieval holds its ground on open-domain or homogeneous-tabular corpora, datasets like HAGRID, TatQA, and CUAD, where the content doesn't naturally cluster into the kind of hierarchical topic structure that a skill tree is built to exploit.

JEF-Hinter's findings, run separately on WorkArena-L1, tell a complementary story. With GPT-5-nano, documentation hints scored 0.44 against 0.41 for a vanilla ReAct agent and 0.43 for human-written hints. With GPT-5-mini, documentation hints scored 0.64 against 0.61 for ReAct, 0.66 for human hints, and 0.68 for JEF-Hinter's full system. The pattern that emerges: structured, cross-linked documentation reliably beats an agent operating without it, though trajectory-distilled, task-specific hints still edge it out at the ceiling. Documentation retrieval, though, scales more easily across tasks than hand-built hints do, which matters more in practice than winning every individual benchmark.

Navigation-structured corpora clearly win on single-domain, atomic-document material, which happens to be the exact shape most product documentation takes. The gains concentrate in factuality and hallucination suppression. Open-domain retrieval is not the place this paradigm shows its strength.

Diagram: Hallucination Rate: Agentic RAG vs. Corpus2Skill. Visualizes: Show a before/after or two-value contrast on Faithfulness scores from the WixQA evaluation: Agentic RAG scored 0.528 Faithfulness (roughly 50% hallucination rate) versus…

Not every hyperlink is a cross-link in the sense that matters here. A link that says "see also: authentication" without any surrounding context is barely more useful to an agent than no link at all, because the agent has no way to judge whether following it is worth the tokens before it commits to reading the target page.

Three properties separate a navigable cross-link from a decorative one. The first is a typed relationship: the link should encode what kind of connection exists, not just that one exists. "This endpoint requires that authentication flow" is navigable. A bare "related" is not. The second is semantic anchoring: the text around the link gives the agent enough to judge relevance before it spends the tokens to follow through. The third is bidirectionality: a well-linked page points back to where it came from, so an agent arriving via a cross-link can discover the reverse path and anything else connected to the same concept.

Getting this right raises accuracy directly in code generation tasks. When an endpoint's documentation packages parameter definitions, authentication requirements, and response schema together as one retrievable unit, rather than scattering them across three separately-chunked pages, an agent is far more likely to produce correct implementation code on the first attempt. Fewer retrieval round-trips, less risk of the agent quietly dropping a required field it never actually saw.

Metadata and cross-links aren't competing approaches, they reinforce each other. Metadata such as breadcrumbs, keywords, and section summaries recorded per page let an agent triage relevance before committing to a full page read, while the cross-links themselves define what to triage in the first place. And the knowledge-graph schema guidance from earlier applies directly: each distinct relationship type in a graph corresponds to a class of cross-link a documentation team needs to maintain consistently. Stay within the bounded node-and-relationship-type range, and the link types remain something a team can actually keep straight across hundreds of pages.

Why documentation currency is a prerequisite for navigation to work at all

A navigation tree built on documentation that's gone stale is arguably worse than no structure at all, because the structure itself signals confidence. A navigation tree built on documentation that's gone stale is arguably worse than no structure at all, because the structure itself signals confidence. An agent following a cross-link isn't hedging, it's trusting that the link means what it says. If it arrives at information describing a deprecated endpoint or an old parameter schema, it will report that stale information with the same confidence it would report something accurate, because nothing in the retrieval path told it otherwise.

Software documentation doesn't hold still. New features ship, APIs change shape, old capabilities get deprecated, best practices shift. The Agentverse audit (Dey and Viradecha, Q1 2026) catalogued 204 API endpoints across a production agent platform and found 62 distinct missing infrastructure capabilities, a concrete illustration of how far even well-resourced, actively maintained platforms can drift from their own documentation in practice.

That drift matters more, not less, once cross-linking is in place. An agent making a flat retrieval guess might stumble onto stale content and treat it with appropriate uncertainty, one hit among several, none obviously authoritative. An agent that's navigating a structured tree follows the link with conviction, precisely because the structure is doing its job of signaling "this is the relevant next step." The better the navigation, the more expensive a stale destination becomes.

That raises an obvious operational question: who owns keeping the tree current? The compilation step, whether it's a skill tree, a knowledge graph, or a structured index, has to be treated as a recurring process tied to the release cycle, not a one-time setup task that gets forgotten once it ships. Documentation that updates in lockstep with the product is a requirement for a system like this. It's the condition under which the whole navigation layer stays trustworthy at all.

Putting it together: what a cross-linked documentation system looks like in practice

Stacking the pieces from the sections above makes a working system start to take shape, built in layers rather than as a single feature.

The base layer is structural: consistent heading hierarchies, self-contained sections, clean markdown with the JavaScript and navigation cruft stripped out. Nothing above this layer works if the foundation is inconsistent, because chunking and indexing both depend on structure being predictable.

On top of that sits chunking strategy: hierarchical chunks, small ones for precise matching, larger parent chunks for full context, each one enriched with metadata, title, summary, keywords, breadcrumb trail. This is where most of the retrieval accuracy gets won or lost, and roughly 80% of RAG failures start right here.

Above the chunks sits the cross-link layer itself: typed relationships between concepts, endpoints, and procedures, encoded directly in the document text and surfaced to the agent as something it can evaluate before committing tokens to a full read. This layer turns a search index into something closer to a map, setting Corpus2Skill's compiled tree apart from a plain vector database, which is what the benchmark numbers above are actually measuring.

Currency causes all of it, remaining invisible until it fails. A documentation system can have flawless structure, well-tuned chunks, and a richly typed cross-link graph, and still mislead an agent the moment the underlying product changes and nobody updates the tree. None of the architecture above substitutes for the discipline of keeping documentation, and the navigation layer built on top of it, in sync with what's actually shipped. The corpus is only as navigable as it is current, and an agent has no way of knowing which parts of the map it's trusting have quietly gone out of date.

Sources

  1. Infrastructure for the Agentic Web: Gap Analysis and Architecture from the Agentverse Platform
  2. firecrawl.dev
  3. atlan.com
  4. arxiv.org
  5. Write LLM-friendly docs in March 2026
  6. arxiv.org
  7. openreview.net
Filed underDocs for AI

More in Docs for AI