Classroom / 5. The Brain

Context Management

The Context Window

Models have a limited memory span (Context Window).

What fills it up?

  1. System Prompt: Instructions (2k tokens)
  2. History: Recent chats (5k+ tokens)
  3. Files: Read files (context.read) (Infinite potential)

Compaction

When context gets full (e.g., >100k tokens), Moltbot triggers Compaction. It summarizes the oldest messages into MEMORY.md and deletes the raw logs to free up space.

Knowledge Check

What process clears space in the context window?