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

# The Mainframe

> The reasoning engine behind every Chat and every App: what it can reach, how it decides, and how it shows its work

Every answer in VirtualBrain comes from the Mainframe. You ask a question in [Chat](/features/chats/overview) or run an [App](/features/apps/overview), and the Mainframe works out what the request needs, gathers it, and hands the material to the step that writes your answer.

You never configure it. It is worth understanding, though, because knowing what it can reach tells you what to ask for.

## What it can reach

The Mainframe has four capabilities and picks whichever the request calls for.

| Capability                  | What it does                                                                                                                                                                                                 |
| --------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| **Your documents**          | Searches the Brains you selected and any file you attached, then pulls the passages that bear on your question. It ranks documents against the question before reading them, so a large Brain stays precise. |
| **The web**                 | Searches the open web when your documents don't hold the answer. Web sources are cited with their original URLs, the same as document sources.                                                               |
| **Spreadsheets and tables** | Writes and runs real code over Excel files, CSVs, and tables inside PDFs. Totals, cross-sheet joins, growth rates, and outliers are computed rather than read off the page.                                  |
| **Document comparison**     | Reads two versions of a document and reports what changed: additions, removals, and rewordings, grouped by section and ranked by how much each one matters. Formatting and reordering are ignored.           |

## How it decides what to do

The Mainframe reads your request and works out what it needs before touching anything.

<Steps>
  <Step title="It plans the retrieval">
    Independent lookups run at the same time. Dependent ones run in order, so it can pull the evaluation criteria out of your document first, then search the web against those criteria.
  </Step>

  <Step title="It keeps going until it has enough">
    A first pass that comes back thin triggers another, more targeted one. It does not stop at the first result it finds.
  </Step>

  <Step title="It skips retrieval when nothing is needed">
    A greeting, a conversational follow-up, or an instruction to restructure an answer it has already produced is handled directly, with no search.
  </Step>
</Steps>

Faced with an ambiguous request, it errs toward gathering more context rather than less. Retrieving a document that turns out to be irrelevant costs you nothing; missing one costs you an incomplete answer.

## It shows its work

Each capability the Mainframe uses appears as its own card in the conversation while the answer is still being written, listing the documents or pages it consulted. Open any of them mid-run to see what it found.

That is what makes the final answer checkable: every claim carries a [citation](/features/chats/sourced-answers) you can open, and the cards above it show how the material was gathered in the first place.

## It works from your context

Every run carries the context you have already set, so you don't restate it:

* Your firm's Company Context on every run, plus your personal [My Instructions](/features/personalization/custom-instructions) in Chat. An App run carries only the Company Context
* What VirtualBrain remembers about how you work ([Memory Insights](/features/personalization/overview)), and in Chat [the conversation so far](/features/chats/asking-questions#what-carries-across-turns)
* The Brains, files, and web setting you chose for this question

## Where it runs

The Mainframe powers both halves of the platform, and the capabilities are identical in each.

<CardGroup cols={2}>
  <Card title="In Chat" icon="message" href="/features/chats/overview">
    One run per question, with follow-ups reusing what the previous run gathered
  </Card>

  <Card title="In Apps" icon="grid-2" href="/features/apps/app-blocks">
    One run per block, so a single App can move from your documents, to the web, to a calculation
  </Card>
</CardGroup>

Anything that works in a Chat works inside an App block. When you build an App, you are choosing which capability each block leans on and what material it starts from. See [App Blocks](/features/apps/app-blocks) for how that is configured, and the [Academy](/apps-academy/knowledge-sources) for how to design it well.

## Related

<CardGroup cols={2}>
  <Card title="Sourced Answers" icon="quote" href="/features/chats/sourced-answers">
    How citations work and how to verify a claim against its source
  </Card>

  <Card title="Asking Questions" icon="comments" href="/features/chats/asking-questions">
    Choose what grounds an answer before you ask
  </Card>
</CardGroup>
