# Generate OKF (/docs/okf/generate-okf)
Writing a knowledge graph by hand takes months, and it's out of date as soon as it's done. Docklee generates OKF from the content you already have. Add a source to an OKF container, or write to one with `Dock`, and concepts and links are built for you.

## Send content to an OKF container [#send-content-to-an-okf-container]

Choose **OKF** when you add a source in **Sources**, or declare the container on a write:

<CodeTabs>
  <Tab value="Python">
    ```python
    from docklee import Dock

    dock = Dock(container="okf")
    dock.capture(
        "The orders table joins the customers table on customer_id and feeds the monthly revenue metric.",
        type="knowledge",
    )
    dock.flush_sync()
    ```
  </Tab>
  <Tab value="TypeScript">
    ```ts
    import { Dock } from 'docklee';

    const dock = new Dock({ container: 'okf' });
    dock.capture(
      'The orders table joins the customers table on customer_id and feeds the monthly revenue metric.',
      { type: 'knowledge' },
    );
    await dock.close();
    ```
  </Tab>
  <Tab value="cURL">
    ```bash
    curl https://api.docklee.com/v1/dock/ingest \
      -H "Authorization: Bearer $DOCKLEE_API_KEY" \
      -H "Content-Type: application/json" \
      -d '{
        "container": "okf",
        "events": [
          {
            "content": "The orders table joins the customers table on customer_id and feeds the monthly revenue metric.",
            "type": "knowledge"
          }
        ]
      }'
    ```
  </Tab>
</CodeTabs>

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

1. **Extract concepts.** Docklee reads the content and pulls out the distinct ideas in it, with a title, a description, key facts, and the entities each one mentions.
2. **Match existing concepts.** Each new concept is compared with the concepts you already have. A match enriches the existing concept instead of creating a copy. See [Merging and conflicts](/docs/okf/merging-and-conflicts).
3. **Classify.** Each concept is placed in a domain, such as engineering, product, or finance, and given a type from the [semantic vocabulary](/docs/okf/semantic-vocabulary), such as `database-table`, `policy`, or `metric`.
4. **Discover links.** Concepts that mention the same entities are compared, and Docklee records how they relate, in which direction, and how confident it is. Only links with a confidence of at least 0.60 are kept.
5. **Write the bundle.** Each concept becomes a Markdown file with structured frontmatter, filed under its domain, and the bundle's index is updated. See [Concept files](/docs/okf/concept-files).
6. **Index.** The concepts and links are indexed for retrieval, and question facets are written for each concept. See [How OKF retrieval works](/docs/okf/how-okf-retrieval-works).

## Domains [#domains]

Concepts are filed into folders by domain:

| Domains |
| --- |
| `engineering`, `product`, `sales`, `marketing`, `finance`, `operations`, `hr`, `legal`, `customer-success`, `research` |

A large domain is split into sub-domains, so no folder grows too big to browse.

## Guarantees [#guarantees]

| Guarantee | What it means |
| --- | --- |
| Repeatable | The same content produces the same concepts, types, domains, and links. |
| Nothing lost | A merge keeps the sources of both sides. A conflict keeps both versions. |
| Recoverable | If a later step fails, the concepts from earlier steps are kept. |
| Always classified | If a model call fails, rule-based classification still files and types every concept. |
| Traceable | Every concept records the source and chunk it came from. |

<Callout type="warn">
Generating OKF costs more at ingest than vector processing, because building concepts and links takes model calls. It's paid once per piece of content, and structural questions are then answered at almost no cost.
</Callout>

## Next steps [#next-steps]

Your content is now concepts. See what a concept file holds next.

<Cards>
  <Card title="Concept files" href="/docs/okf/concept-files" description="Every field Docklee writes." />
  <Card title="Semantic vocabulary" href="/docs/okf/semantic-vocabulary" description="Every concept type and link type." />
  <Card title="Merging and conflicts" href="/docs/okf/merging-and-conflicts" description="How duplicates and disagreements are handled." />
</Cards>
