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

# Context Summarization

> How Cerebrum manages conversation context to maintain coherence across long development sessions.

## How Context Works

When conversations grow longer, they exceed the model's context window limit:

<Steps>
  <Step title="User">
    First message from user
  </Step>

  <Step title="Cerebrum">
    Response from Cerebrum
  </Step>

  <Step title="User">
    Another message
  </Step>

  <Step title="⚠️ Context window limit">
    Messages below exceed the limit
  </Step>

  <Step title="Cerebrum">
    ❌ Can't fit
  </Step>

  <Step title="User">
    ❌ Can't fit
  </Step>
</Steps>

To solve this, Cerebrum summarizes older messages to make room for new conversations:

<Steps>
  <Step title="📦 Summarized Messages">
    Older messages compressed into summary
  </Step>

  <Step title="Cerebrum">
    Recent response (with overlap from previous context)
  </Step>

  <Step title="User">
    ✅ Fits within limit
  </Step>

  <Step title="Cerebrum">
    ✅ Fits within limit
  </Step>
</Steps>

## Automatic Summarization

Cerebrum uses a **sliding window with overlap** approach. The **overlap** ensures context continuity - when summarizing, Cerebrum preserves context from the previous window so important connections aren't lost.

| Window | Messages       | Overlap                 |
| ------ | -------------- | ----------------------- |
| 1      | 1, 2, 3        | —                       |
| 2      | **3**, 4, 5, 6 | Message 3 from Window 1 |
| 3      | **6**, 7, 8, 9 | Message 6 from Window 2 |

<Note>
  Summarization happens automatically in the background. You don't need to do anything special.
</Note>

## What Gets Preserved

When Cerebrum summarizes context, it prioritizes:

| Priority | Information Type        | Example                                 |
| -------- | ----------------------- | --------------------------------------- |
| Critical | Architecture decisions  | "Using PostgreSQL for the database"     |
| Critical | Requirements from PRD   | "Must support 1000 concurrent users"    |
| High     | Service configurations  | "Backend runs on port 3000"             |
| High     | Current task context    | "Working on user authentication"        |
| Medium   | Previous solutions      | "Fixed CORS issue by adding headers"    |
| Low      | Exploratory discussions | "Considered Redis but chose PostgreSQL" |

## Best Practices

<AccordionGroup>
  <Accordion title="Reference the Canvas">
    When context seems lost, ask Cerebrum to "look at the Canvas" - it shows the current environment, all services, and their configurations.
  </Accordion>

  <Accordion title="Check Environment State">
    The Canvas displays the state of a specific environment. Make sure you're looking at the right env (dev/staging/prod) when discussing changes.
  </Accordion>

  <Accordion title="Summarize Yourself">
    For complex discussions, provide your own summary: "To recap, we decided to use X because Y."
  </Accordion>

  <Accordion title="Break Into Sessions">
    For very large projects, consider completing major milestones before moving on. This creates natural breakpoints.
  </Accordion>
</AccordionGroup>

## Context Limits by Model

Different models have different context windows:

| Model             | Context Window |
| ----------------- | -------------- |
| Gemini 3.1 Pro    | 1M tokens      |
| Gemini 3.5 Flash  | 1M tokens      |
| GPT-5.4           | 1.05M tokens   |
| Grok 4.20         | 2M tokens      |
| Claude Sonnet 4.6 | 200K tokens    |
| Claude Opus 4.6   | 200K tokens    |
| Claude Opus 4.7   | 1M tokens      |

<Note>
  Larger context windows mean less frequent summarization, but all models benefit from Cerebrum's smart context management.
</Note>
