# How OKF retrieval works (/docs/okf/how-okf-retrieval-works)
A question like "How does the orders table feed revenue reporting?" isn't answered by any single passage. The answer is a path from one concept to another. Vector RAG looks for the one passage closest to the question. Docklee OKF retrieval finds where to start, then follows the links, so it can answer questions that need several steps.

Read this page to understand why OKF answers relationship questions well, and why it returns so little text.

<Illustration
  src="/illustrations/okf/okf-graph-walk.webp"
  alt="A graph of concepts: a table, a metric, a chart, a report, a set of documents, and a team. A highlighted path starts at the table and follows links through the metric and the report to the team."
  width={1774}
  height={887}
/>

## How it works [#how-it-works]

1. **Read the question.** Docklee works out the intent, such as a relationship, a definition, or a change over time, and picks out the things the question names.
2. **Find entry concepts.** It matches the question against concept titles, types, tags, and descriptions, with titles weighted most. It also matches by meaning against the questions each concept answers. See [Question facets](#question-facets).
3. **Keep the right types.** Concepts whose type doesn't fit the intent are set aside. A question about how tables join keeps tables and drops playbooks.
4. **Follow the links.** From the entry concepts, it walks the graph up to three links away, weighting each step by the link's confidence and how far it is from the start. This is how it finds concepts the question never named.
5. **Add context from the folder.** A concept's place in the bundle, and the concepts next to it, add context.
6. **Rank by freshness and authority.** Newer concepts, and concepts many others link to, rank higher.
7. **Handle disagreement.** A superseded concept is dropped. Contradicting concepts are both kept and marked.
8. **Score confidence.** Each result gets one confidence score built from every step above.
9. **Keep only what's relevant.** From the top concepts, only the paragraphs that match the question are kept, along with the links between them.
10. **Fit the budget.** The context is trimmed to a token budget, keeping links and high-confidence paragraphs first.

Most of these steps are plain computation, with no model calls.

## Question facets [#question-facets]

A concept about remote work might never use the words "can I do my job from home". When a concept is indexed, Docklee writes the different ways people might ask for it and indexes those questions too. A question then matches the questions a concept answers, not only its own wording.

Facets only add matches. If they can't be written for a concept, the concept is still indexed and found the usual way.

## An example [#an-example]

| Concept | Links |
| --- | --- |
| Orders table | `joins-with` Customers table, `feeds-into` Revenue metric |
| Revenue metric | `documents` Monthly revenue report |
| Monthly revenue report | `owned-by` Finance team |

"Who owns the report that orders feed into?" starts at the orders table, follows `feeds-into` to the revenue metric, then `documents` to the report, and `owned-by` to the finance team. A similarity search would need one passage that says all of that at once.

## What comes back [#what-comes-back]

OKF results are merged with any vector results and returned through the same calls:

- `lynk.query` writes its answer from them, with citations.
- `lynk.retrieve` returns them as chunks, alongside vector chunks.

See [Query OKF](/docs/okf/query-okf).

## Next steps [#next-steps]

You know how OKF retrieval works. Decide where it beats vector search next.

<Cards>
  <Card title="OKF retrieval vs vector RAG" href="/docs/okf/okf-vs-vector" description="Which container suits your content." />
  <Card title="Semantic vocabulary" href="/docs/okf/semantic-vocabulary" description="The types and links retrieval uses." />
  <Card title="Query OKF" href="/docs/okf/query-okf" description="Read OKF through an engine." />
</Cards>
