# How memory maintains itself

Storing memories is only half of what Brain does. The other half is what it does to them afterwards: reading back over what it holds, connecting statements that belong together, and writing down the patterns and intentions that follow from them.

That work is called cognition, and it has two mechanisms — the **digest** and the **sweep**. Cognition works on the product's shared pool; private memories are not consolidated.

## When it runs

Every write leaves consolidation work behind, and Brain picks that work up on its own in the background. Nobody has to ask for it, and a product that is simply being used accumulates consolidated knowledge over time without anyone doing anything.

Both mechanisms can also be run on demand. Running one by hand is useful after a large ingest, when you want the consequences visible now rather than at some point over the next while.

> Cognition costs the same metered work as any other processing Brain does. When a product is over its plan limits a scheduled run is skipped rather than queued up. See [what Brain meters and which limits apply](/brain/limits-and-usage).

## The digest

The digest works through the consolidation left behind by writes. For the material waiting to be consolidated it groups statements that are about the same thing, reads them together, and then writes back:

- **Patterns.** Where several statements describe the same recurring shape of how the product's world behaves, Brain records that shape as its own memory, marked `Schema`.
- **Intentions.** Where the material implies something standing that should be done or watched, Brain records it, marked `Intention`.
- **Supporting evidence.** Where a new statement backs up something already recorded, Brain attaches it to that memory as evidence instead of writing a near-duplicate.
- **Connections.** Where two memories are related, Brain links them, which is what fills the [knowledge graph](/brain/knowledge-graph).

A digest reports how many pieces of work it got through and how long it took.

## The sweep

The sweep looks across the patterns the digest has already produced, for resemblances that only show up from a distance. It takes each recorded pattern, restates it in terms of the *behaviour* it describes rather than the subject it is about, and then looks for pairs that behave alike while talking about unrelated things — the same dynamic showing up in two different corners of the product. Groups of such pairs are collapsed into a single higher-order pattern covering all of them.

That is why the sweep is a separate mechanism: the digest connects statements that are about the same thing, and the sweep connects statements that are about entirely different things but work the same way.

> A sweep needs a certain amount of material before there is anything to compare. On a product with few recorded patterns it finds nothing, which is a correct outcome and not a failure. It reports how many patterns it restated, how many resemblances it found and how many higher-order patterns it wrote.

## What you notice

Cognition is not something you interact with — it changes what the rest of Brain gives you.

- **Memories nobody wrote appear.** `Schema` and `Intention` memories sit alongside what was actually submitted, in browsing and in search results.
- **Search gains its other two groups.** The Profile and Proactive groups described in [add, search and correct memories](/brain/memories) are filled by cognition. A product whose memory has never been consolidated gets direct results only.
- **The knowledge graph grows.** Entities and relations accumulate as memories are connected. See [search the knowledge graph](/brain/knowledge-graph).
- **Repetition stops compounding.** Statements that restate something already known are attached to it as evidence rather than piling up as separate memories.

## Running a digest or a sweep, and watching it

1. **Request the mechanism you want.** The request does not block: it is accepted, the work runs in the background, and you read the outcome afterwards rather than waiting for it. Runs are processed one at a time, so requesting a digest while one is already running does not run two at once.
2. **Read the current state.** Brain reports, per product, the last digest and the last sweep: whether it is running, finished or failed, what it counted, when it started and finished, and the error if it failed.
3. **Treat the capacity figure as a hint.** Alongside that, Brain reports how busy the shared processing capacity is overall. That figure is not specific to your product — read it as a hint about how soon a run will start, not as a measure of your own memory.

The tools your agents call to request a run and read its outcome are published by the platform. See [look up a Brain tool](/reference/mcp-tools).

## Next steps

- [Search the knowledge graph](/brain/knowledge-graph): the entities and relations cognition builds out of connected memories.
- [Add, search and correct memories](/brain/memories): read the groups cognition fills, and fix what is wrong.
- [What a memory is](/brain/memory-model): scopes, source authority, and where memories come from.
- [What Brain meters and which limits apply](/brain/limits-and-usage): what cognition consumes, and what happens when the allowance runs out.
- [Ingest a source on a schedule](/brain/daemons): the large writes that leave the most consolidation work behind.
