Canonical page: [Aemon Documentation](https://cloudflavor.io/aemon/docs/index/)
Source snapshot: https://github.com/cloudflavor/aemon/blob/a85ee1d024b81c6373acd86379fe12f15c26a7a5/docs/overview.md

# Aemon Documentation

Aemon builds a local documentation corpus for coding agents: versioned docs for hundreds
of libraries in one SQLite file with an FTS5 index, queried in about 10 ms, with a
decision model that picks the library and a crawler that keeps sources current without
spending tokens.

Measured on a working corpus (2026-11): 978 corpora across 369 libraries, 8.0 M chunks,
3.3 G characters of text, one 6.6 GB SQLite file.

## Three concerns, one file

| concern | commands | what it costs |
|---|---|---|
| ingest once | `devdocs`, `crate`, `repo`, `llms`, `pkg`, `add`, `apple` | network, once per corpus |
| query constantly | `search`, `outline`, `get`, `resolve`, `fresh` | ~10 ms; a model only when you ask for one |
| keep current | `crawl add`, `crawl run`, `crawl status` | HTTP + HTML-to-text on a timer, no model |

The model is spent when a question is asked, never during ingest or crawling. That is
the design constraint everything else follows from: a corpus you can afford to rebuild
and a query path that does not depend on a provider being up.

## Quick start

```sh
aemon devdocs add --all            # ~840 versioned corpora (~4 GB)
aemon crate serde@0.9              # rustdoc JSON from docs.rs
aemon search "select_related" -l django
aemon search "why is my build slow" --auto --rerank
```

`aemon doctor` reports the database path, corpus size, model provider and remote
configuration of an installation. [install](install.md) covers getting the binary;
[retrieval](retrieval.md) explains what `--auto` does.

## Interfaces

- **CLI**: the six commands above, plus `ls`, `stats`, `audit`, `sources`, `models`.
- **`outline` → `get`**: the token-frugal pair for agents; see [retrieval](retrieval.md).
- **JSON**: every reporting command takes `--json` and emits a stable envelope
  (`cmd` / `db` / `result`); see [JSON API](json-api.md).
- **HTTP**: `aemon serve` exposes the same CLI over an authenticated endpoint; bearer
  authentication is mandatory, including on `/health`.
- **SQL**: the schema is documented and stable enough to query directly; see
  [schema](schema.md).
- **MCP**: `deploy/aemon-mcp` is a stdio bridge exposing `docs_search`, `docs_outline`
  and `docs_get` to MCP clients.

## The corpus is not redistributed

Extracted documentation text is a derivative of other people's work, and a meaningful
slice of it cannot be republished: Apple's terms forbid it, MongoDB's docs are
CC BY-NC-SA, and 15 DevDocs docsets self-declare proprietary.

What *is* published is the recipe — `sources/` in this repository:

```
sources/sources.txt    one command per corpus, with the licence that applies
sources/sources.json   the same, structured (kind, url, path, command, licence, chunks)
sources/rebuild.sh     the same as a runnable script (sh -n clean)
```

```sh
aemon sources                          # print the recipe
aemon sources --format json            # structured
aemon sources --redistributable-only   # only the corpora that may be republished with notice
```

Licences are harvested, not guessed: DevDocs attribution strings, GitHub's licence API
for repository sources, crates.io metadata for crates. Across the 975 recipes: MIT 225,
BSD 175, CC-BY 99, GPL 83, Apache-2.0 82, GFDL 53, CC-BY-SA 16, proprietary 19, and 104
`unknown` plus 58 with no licence string at all. `--redistributable-only` keeps the 601
whose licence permits republication with notice and drops everything else, `unknown`
included.

So anyone can rebuild this corpus with `sh sources/rebuild.sh` — under their own legal
judgement, from the original sources — and nobody has to trust a 580 MB blob. Each
corpus row keeps its own `license` and `attribution` in the database.

## Where to go next

- [install](install.md) — binaries, checksums, source builds.
- [retrieval](retrieval.md) — how a query is scored and routed.
- [ingestion](ingestion.md) — what a corpus is, and how sources become chunks.
- [crawling](crawling.md) — keeping a site's docs current on a timer.
- [schema](schema.md), [providers](providers.md), [JSON API](json-api.md).
