docs-rag  · 

Local docs RAG on the same engine that powers your agent memory

Index library docs, GitHub repos, and internal Markdown into the same local hybrid retrieval engine Docmancer uses for agent memory, then query compact token-budgeted results with no API key.

Docmancer is primarily a memory harness for coding agents, but the retrieval engine underneath it was never memory-specific. The same local SQLite index, sqlite-vec dense vectors, and FTS5 lexical search that recall your agents' past decisions will also index documentation, so you can keep library references and internal wikis in the exact system your agents already query. This post shows the docs path end to end and explains why running it on the shared engine is the point rather than a coincidence.

One engine, two corpora

When you index memory, Docmancer harvests your agents' notes into source-attributed atoms and retrieves them with hybrid search. Docs ingestion writes into the same kind of local hybrid index: FTS5 for exact terms plus dense vectors from the vendored static model in sqlite-vec. There is no separate service to run and no second retrieval stack to reason about. If you trust how memory recall behaves, docs recall behaves the same way, because it is the same code path over different content.

That also means the offline guarantee carries over. Indexing and querying docs needs no API key and no hosted vector database, exactly like memory.

Add docs from a URL, a repo, or local files

A single command handles documentation URLs, GitHub repositories, and local paths:

docmancer docs add https://docs.pytest.org
docmancer docs add https://github.com/pydantic/pydantic
docmancer docs add ./internal-runbooks

For a URL, Docmancer auto-detects the platform and picks a fetch strategy: it downloads the full-text file GitBook and Mintlify sites expose, crawls a sitemap when one is available, or walks the navigation for a generic site. For a GitHub URL it extracts the README and the docs/ directory. For a local path it ingests Markdown and text directly, with PDF, DOCX, RTF, and HTML supported when you install the optional parsers. If auto-detection guesses wrong, force a provider:

docmancer docs add https://docs.example.com --provider mintlify

When upstream docs change, refresh them without re-embedding unchanged sections:

docmancer docs sync
docmancer docs list

docs sync reuses the content-hash-keyed embeddings cache, so only changed sections are re-embedded, and docs list shows every indexed source.

Query compact, token-budgeted results

The reason to run docs through a retrieval layer at all is that pasting a full documentation page into a coding agent is one of the most common context mistakes. A full page can cost tens of thousands of tokens when the answer lives in a few hundred. Docmancer returns only the relevant sections within a budget:

docmancer docs query "how do I parametrize a fixture scope?"

Section-level results often land in the low hundreds of tokens instead of forcing an agent to absorb a page-scale paste. You can widen the context around a match when you need it, and you can inspect why each result ranked where it did:

docmancer docs query "async database sessions" --expand
docmancer docs query "retry idempotent requests" --explain

--expand includes the sections adjacent to each match, and --explain shows the per-source rank contributions so you can see how the lexical and dense signals combined. When you are debugging retrieval quality rather than reading an answer, that breakdown tells you whether the right sections were even in the index.

Keep memory and docs distinct at query time

Memory and docs share an engine, but they answer different questions, so they stay separate commands. docmancer query searches the decisions your agents recorded. docmancer docs query searches the reference material you ingested. Keeping them distinct means a question about your own architecture never gets answered from a third-party SDK page, and a question about an API never gets answered from a stale internal note. You choose which corpus you are asking.

Reach it from your agents over MCP

The same docs index is available to your coding agents through the packaged MCP server, so an agent can search your local docs through its native tool layer instead of pasting pages into context:

docmancer mcp serve

An agent connected over MCP gets the compact, token-budgeted docs results directly, which is the behavior you want during a long tool-heavy session where every wasted token degrades later answers.

Try it

pipx install docmancer --python python3.13
docmancer docs add https://docs.pytest.org
docmancer docs list
docmancer docs query "parametrize fixture scope"

The adding documentation guide covers the ingest options in full, and the querying guide explains retrieval modes and budgets. Because it is the same engine, everything you learn tuning docs retrieval applies to memory recall, and the reverse.