Install as docsgraph

The DocsGraph for AI agents.

CodeGraph helps agents navigate code. Cairn helps them navigate docs: README files, specs, ADRs, PDFs, and repo knowledge exposed through MCP.

pip install docsgraph
docsgraph init -y
docsgraph sync --fake
docsgraph install --client codex --yes --fake

Docs become navigable infrastructure.

Cairn replaces anonymous chunks with document structure, stable section anchors, cross-references, entity mentions, summaries, and vector search.

01 / REPO MAP

Find the right document first.

Use list_documents and search_documents before drilling into a section. Agents stop guessing from README fragments.

02 / STRUCTURE

Retrieve at section granularity.

Headings, hierarchy, summaries, and stable cairn:// anchors make answers easier to verify and cheaper to quote.

03 / LOCAL FIRST

Keep model and storage choices yours.

Cairn runs locally, exposes MCP over stdio, and can use deterministic fake providers for offline smoke tests.

One repository workflow.

Initialize, sync, inspect freshness, then serve a docs-aware MCP layer to Codex, Claude, Cursor, Goose, or any compliant client.

BOOTSTRAP

docsgraph init -y

Writes a conservative .cairn/config.toml documentation policy.

INDEX

docsgraph sync --fake

Builds one structured index per source document with isolated failures.

WIRE AGENTS

docsgraph install --client codex --fake

Writes a workspace-aware MCP config; pass --repo only to pin a server to one repo.

repo smoke15 docs indexed
$ docsgraph sync --fake
synced: 15/15 documents, 0 failed

$ docsgraph query repo "MCP trace outputSchema" --fake
docs/specs/mcp-tools.md
section: Trace

$ docsgraph doctor
Cairn doctor: ok

MCP tools built for drilldown.

The public surface gives agents both broad repo discovery and precise section-level retrieval.

repo_context

Returns a ready-to-read context pack with ranked hits, explanations, and related sections.

search_documents

Searches every indexed document and returns globally ranked section hits with doc ids.

get_section

Fetches a chosen section at gist, synopsis, digest, or full granularity.

repo_graph

Exposes document, section, entity, contains, xref, and mention edges for repo docs.

15/15Current Cairn repo docs indexed in dogfood.
0Failed documents in the published-package smoke test.
3.11-3.13CI runs ruff, mypy, pytest, and package builds across supported Python versions.
PyPIPublished as docsgraph, with cairn as a CLI alias.

Open source, agent ready.

Start with the README, inspect the architecture canvas, or install from PyPI and point your agent at the repository.

Support maintenance.

Cairn is Apache-2.0. Sponsorship is optional, but it helps keep the docs graph, release automation, and agent integrations moving.

If Cairn saves you time, use the GitHub Sponsor button or scan the WeChat reward code. For bugs, security reports, and usage help, start with the support policy in the repository.

WeChat reward code for supporting Cairn maintenance
WeChat reward code