# Overview

You don't need to read this section to build with Brain. It's here for the moments when you do: compliance review, custom policy design, on-chain audit, agent autonomy work, or just because you want to understand what's happening underneath.

### The six-layer stack

```
Raw → Ledger → Wiki → Policy → Agent → Audit
```

Information flows up. Control flows down. Each tenant has its own logical instance of every layer, with hard isolation at the database, key, and policy boundaries.

| Layer         | Owns                                        | Concept page             |
| ------------- | ------------------------------------------- | ------------------------ |
| **1. Raw**    | Source evidence, immutable                  | Raw and Ledger           |
| **2. Ledger** | Machine-readable financial truth            | Raw and Ledger           |
| **3. Wiki**   | Human-readable financial memory             | The Wiki                 |
| **4. Policy** | Deterministic permission and approval logic | Policy and Permissioning |
| **5. Agent**  | Proposal and orchestration                  | Agents                   |
| **6. Audit**  | Immutable proof of what happened and why    | Audit and Proof          |

[**→ Six-layer overview**](/protocol/the-six-layer-stack.md)

### What's in this section

<table data-view="cards"><thead><tr><th></th><th></th><th data-type="content-ref"></th><th data-hidden data-card-target data-type="content-ref"></th></tr></thead><tbody><tr><td><strong>The Six-Layer Stack</strong></td><td>The whole protocol on one page.</td><td><a href="/pages/P1sKkvfj7oBfLCRzdXv4">/pages/P1sKkvfj7oBfLCRzdXv4</a></td><td></td></tr><tr><td><strong>Raw and Ledger</strong></td><td>How evidence becomes deterministic structure.</td><td><a href="/pages/pPTXzUZ6cZ8LCgvMmMRO">/pages/pPTXzUZ6cZ8LCgvMmMRO</a></td><td></td></tr><tr><td><strong>The Wiki</strong></td><td>The continuously regenerated memory layer.</td><td><a href="/pages/IDbmiD3RRs6QlgR8UT8z">/pages/IDbmiD3RRs6QlgR8UT8z</a></td><td></td></tr><tr><td><strong>Policy and Permissioning</strong></td><td>Plain-English rules to deterministic guards.</td><td><a href="/pages/GSe2ntE9CLqxoQAiQuzG">/pages/GSe2ntE9CLqxoQAiQuzG</a></td><td></td></tr><tr><td><strong>Agents</strong></td><td>Internal and external agents in the protocol.</td><td><a href="/pages/t9xBO8sSjFElp8ecB6i5">/pages/t9xBO8sSjFElp8ecB6i5</a></td><td></td></tr><tr><td><strong>Payment Intents</strong></td><td>The Ledger entity that represents a proposed action.</td><td><a href="/pages/frJ0ygywHJq5WCmjwuXH">/pages/frJ0ygywHJq5WCmjwuXH</a></td><td></td></tr><tr><td><strong>The Pre-Execution Gate</strong></td><td>The 13-step deterministic check before any payment.</td><td><a href="/pages/GcCCOqv3BXHFtEpuypqD">/pages/GcCCOqv3BXHFtEpuypqD</a></td><td></td></tr><tr><td><strong>Audit and Proof</strong></td><td>Tamper-evident history anchored on Base L2.</td><td><a href="/pages/PIgNXssgtEUZDLnC4b4d">/pages/PIgNXssgtEUZDLnC4b4d</a></td><td></td></tr><tr><td><strong>Agent Contributions</strong></td><td>How external agents contribute evidence safely.</td><td><a href="/pages/rXMm84kpjeJ8SEHuOWBP">/pages/rXMm84kpjeJ8SEHuOWBP</a></td><td></td></tr></tbody></table>

### Architecture deep dives

<table data-view="cards"><thead><tr><th></th><th></th><th data-type="content-ref"></th><th data-hidden data-card-target data-type="content-ref"></th></tr></thead><tbody><tr><td><strong>System Overview</strong></td><td>The architecture top-down.</td><td><a href="/pages/0faef97530c1f0291979e9bc4239668ed769f3a9">/pages/0faef97530c1f0291979e9bc4239668ed769f3a9</a></td><td></td></tr><tr><td><strong>Data Flow</strong></td><td>How a single source-of-truth event ripples up the stack.</td><td><a href="/pages/f13dc46dcb9951f17a7148e3db84880b35c5a671">/pages/f13dc46dcb9951f17a7148e3db84880b35c5a671</a></td><td></td></tr><tr><td><strong>Write Paths</strong></td><td>The two controlled exceptions to bottom-up flow.</td><td><a href="/pages/ahIJrDMqEknY2O7lB9az">/pages/ahIJrDMqEknY2O7lB9az</a></td><td></td></tr><tr><td><strong>Tenant Isolation</strong></td><td>Per-tenant boundaries, end to end.</td><td><a href="/pages/6653bed462d23f79b20417161f16b62ffd97ed9c">/pages/6653bed462d23f79b20417161f16b62ffd97ed9c</a></td><td></td></tr><tr><td><strong>Security and Compliance</strong></td><td>Crypto, keys, sanctions, SOC 2 trajectory.</td><td><a href="/pages/02a6fa38c72a26d3f8a40cbaad4ac854d7353a1e">/pages/02a6fa38c72a26d3f8a40cbaad4ac854d7353a1e</a></td><td></td></tr><tr><td><strong>Risks and Mitigations</strong></td><td>Where things can go wrong, and what catches them.</td><td><a href="/pages/BBebQzrRNDafNKFzHG4I">/pages/BBebQzrRNDafNKFzHG4I</a></td><td></td></tr></tbody></table>

### Where the protocol meets the chain

The on-chain surface is intentionally small. Most logic stays off-chain. Four smart contracts on Base L2 anchor the parts that have to be public and tamper-evident.

| Contract                | Anchors                                                      | Page                  |
| ----------------------- | ------------------------------------------------------------ | --------------------- |
| `BrainAuditAnchor`      | Audit Merkle roots per tenant                                | BrainAuditAnchor      |
| `BrainPolicyRegistry`   | Policy version hashes per tenant                             | BrainPolicyRegistry   |
| `BrainSmartAccount`     | ERC-4337 account validating UserOps against scope and policy | BrainSmartAccount     |
| `BrainMCPAgentRegistry` | Agent identity, capabilities, scope grants                   | BrainMCPAgentRegistry |

### Where to start

| If you want to understand...              | Start here                  |
| ----------------------------------------- | --------------------------- |
| The whole stack                           | Six-Layer Stack             |
| Why memory and policy are separate layers | Raw and Ledger              |
| How decisions stay safe                   | Pre-Execution Gate          |
| Why this is verifiable                    | Audit and Proof             |
| What external agents can and can't do     | Agents, Agent Contributions |


---

# Agent Instructions: 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:

```
GET https://docs.brain.fi/protocol/overview.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
