> For the complete documentation index, see [llms.txt](https://docs.brain.fi/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.brain.fi/introduction/the-wiki-layer-vs.-rag-and-graph.md).

# The Wiki Layer vs. RAG and Graph

### What It Is

The Wiki layer is the contextual knowledge surface in Brain's stack. It sits between the Ledger (canonical state) and the Agent (execution), and gives agents the meaning they need to act intelligently on financial data.

Think of it as Wikipedia for an autonomous financial system, except every article cites a primary source in the Ledger or Raw layer.

### What It Does

The Wiki layer handles three jobs that legacy memory systems split across separate tools:

1. **Entity resolution.** "Acme Corp," "ACME Corporation," and the LEI on the wire confirmation are the same thing. Wiki knows that.
2. **Relationship modeling.** Counterparty exposures, fund flows, ownership structures, vendor hierarchies. Stored explicitly, queryable.
3. **Narrative context.** Why a transaction happened, what a counterparty does, what risk class an asset falls into. Stored as semantic content, retrievable in natural language.

Every fact in Wiki points back to verifiable evidence in Raw or Ledger. If the source moves, Wiki updates. If sources conflict, Ledger wins.

### Comparison with RAG and Graph

Most memory systems use one of two tools.

**RAG** (Retrieval Augmented Generation) stores text chunks as vector embeddings and retrieves what looks similar at query time. It is fast, easy to set up, and useful for unstructured Q\&A. It has no entity identity, no relationships, and no notion of truth. Two strings that mean the same thing are unrelated to it. RAG tells you what it has read, not what it is.

**Graph** systems (knowledge graphs, property graphs) store entities and relationships explicitly. They support multi-hop traversal and structural reasoning. Strong on relationship questions. Weak on unstructured semantic content. Brittle when reality does not fit the schema. A standalone graph floats free of any system of record.

**Wiki** does both, anchored.

<table><thead><tr><th width="350">Capability</th><th>Wiki</th><th>RAG</th><th>Graph</th></tr></thead><tbody><tr><td>Semantic retrieval</td><td><strong>Yes</strong></td><td>Yes</td><td>Limited</td></tr><tr><td>Entity resolution</td><td><strong>Native</strong></td><td>No</td><td>Manual</td></tr><tr><td>Relationship traversal</td><td><strong>Yes</strong></td><td>No</td><td>Yes</td></tr><tr><td>Anchored to system of record</td><td><strong>Yes</strong></td><td>No</td><td>No</td></tr><tr><td>Provenance per fact</td><td><strong>Yes</strong></td><td>No</td><td>No</td></tr><tr><td>Conflict arbitration</td><td><strong>Ledger wins</strong></td><td>None</td><td>None</td></tr><tr><td>Suitable for autonomous money movement</td><td><strong>Yes</strong></td><td>No</td><td>No</td></tr></tbody></table>

### Why This Matters

When an agent is reasoning about money, "probably true" is not enough. A treasury agent that thinks the company has $4.2M in operating cash needs to be right, not approximately right. A lending agent applying a credit policy needs to know exactly which counterparty it is dealing with, not a fuzzy match.

RAG and graphs are useful tools, but they are retrieval systems, not systems of record. They tell agents what was said. Wiki tells agents what is.

The shorthand:

* RAG sounds right
* Graph connects right
* Wiki *is* right

### How Wiki Fits in Brain

Wiki is one of six layers in the Brain stack:

* **Raw** ingests signals
* **Ledger** maintains canonical state
* **Wiki** provides semantic context, grounded in Ledger
* **Policy** defines what agents are allowed to do
* **Agent** executes within policy, using Wiki to understand context
* **Audit** records every action with cryptographic provenance

Wiki is what makes Brain agents knowledgeable. Ledger is what makes them correct. Policy is what makes them safe. Audit is what makes them accountable. Together, they are what makes autonomous financial action trustworthy.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.brain.fi/introduction/the-wiki-layer-vs.-rag-and-graph.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
