# How context works

Understand the code graph, repository guidance and external document discovery.

Canonical page: https://ontlgy.io/docs/concepts/context/

ontlgy runs a shared index that your coding agents query over MCP. Its web app handles setup and browsing; its worker clones and indexes repositories and synchronizes selected document sources.

## Three kinds of context

| Context | What is stored or returned | What the agent verifies |
| --- | --- | --- |
| Code | Symbols, locations, signatures and relationships | Source files at the relevant revision |
| Repository guidance | Skills, rules, instruction bodies and supporting files | Applicability, precedence and referenced code |
| External documents | Bounded facts, outlines, stubs, pointers and optional discovery cards | Live source text through `doc_read` or a source connector |

Code query tools return pointers rather than complete source bodies. The self-hosted worker does retain repository clones on its own disk for indexing. “Pointers” does not mean the installation never reads or holds a clone.

## Discovery and reading are separate steps

`locate` and `search` find relevant code; `symbol` and `impact` describe structure. For external documents, `docs_find` searches the index, `doc_get` inspects a catalog entry, and `doc_read` obtains a bounded live portion of the source.

The optional document knowledge agent improves discovery by extracting grounded topics and supported tasks. Its output is generated context with provenance, not an authoritative replacement for the underlying document.

## The index has a point in time

The graph describes indexed repository revisions and synchronized source facts. It does not see your working tree edits. Read [Freshness and confidence](https://ontlgy.io/docs/concepts/freshness/) before treating a result as current.

## The agent remains responsible for the task

ontlgy provides context. Your coding agent chooses what to read, reasons about the change and runs its verification. Documented tools do not autonomously deploy software or implement every workflow illustrated on the marketing website.
