> ## Documentation Index
> Fetch the complete documentation index at: https://docs.hr-easy.nlead.ch/llms.txt
> Use this file to discover all available pages before exploring further.

# Document intelligence

> Vectorless, reasoning-based retrieval over long Swiss legal and contractual documents.

Some documents do not chunk well. A GAV, a pension reglement, a cantonal ordinance —
these are long, deeply hierarchical, and full of cross-references, and the answer to
"what notice period applies to a part-time employee in their fourth year?" lives in the
*structure*, not in a paragraph that happens to be lexically similar to the question.

Document intelligence takes a different approach: it builds a **table-of-contents tree**
of the document and reasons down it to a cited section.

This is [ADR-008](/development/adr) — a TypeScript port of PageIndex (VectifyAI, MIT).

## Why not chunk-and-embed

| Chunk + embed                                           | Tree + reason                                          |
| ------------------------------------------------------- | ------------------------------------------------------ |
| Splits the document into fixed windows.                 | Preserves the document's own hierarchy.                |
| Retrieves by embedding similarity.                      | Navigates by reasoning about what each section covers. |
| Cross-references break across chunk boundaries.         | A reference resolves to a node in the same tree.       |
| Cites a chunk.                                          | Cites a **section** — the thing a lawyer would cite.   |
| Struggles when the answer depends on document position. | Position is the primary signal.                        |

For a 200-page reglement where "Art. 14 applies subject to Art. 9 para. 2", the second
column is the one that gives a defensible answer.

## How it works

<Steps>
  <Step title="Build the tree">
    The document is parsed into a hierarchical outline — parts, chapters, articles, paragraphs —
    with each node summarised by what it covers.
  </Step>

  <Step title="Assemble">
    Nodes are assembled into a navigable tree that can be rendered as an outline.
  </Step>

  <Step title="Search by reasoning">
    A query walks the tree: at each level the model decides which branch could contain the answer,
    and descends. The result is a node path, not a similarity score.
  </Step>

  <Step title="Answer with a citation">
    The answer names the section it came from, so it can be checked.
  </Step>
</Steps>

## Current scope

<Warning>
  Document intelligence shipped as an **evaluation spike**. Tree construction and reasoning-based
  search are implemented and tested; persistence, access control and i18n are MVP follow-ups, and
  there is no API route or UI surface yet. Treat it as a building block, not as an end-user feature.
</Warning>

## Suitable documents

* Collective labour agreements (GAV / CCT)
* Pension fund reglements
* Cantonal and federal ordinances
* Long employment contracts and their annexes
* Internal policy handbooks

For short documents — a single contract, a certificate — ordinary
[semantic search](/guides/ai/semantic-search) is the better tool.

## Provider

Claude, through the platform's central model configuration
(`document-intelligence.tree`), which is Opus-class by default because the quality of
the structural reasoning is the whole feature.
