Tutorials

Create a new context window

Manage Bob's context window to preserve memory, control cost, and maintain output quality during complex or long-running conversations.

Every task (conversation) in the chat panel has a context window. The context window is the token limit for what Bob can hold in memory for the current session. Context includes system instructions, tool schemas, your rules and skills, and the full transcript.

In this tutorial, you open the context window, learn what Bob loads before you do real work, and learn when to create a new context window.

By the end of this tutorial, you will learn the following:

  1. Identify each context window category and what Bob loads into it.
  2. Measure baseline context overhead on Galaxium Travels.
  3. Watch Messages grow after a repository prompt while fixed categories stay flat.
  4. Start a new task to reset the context window while keeping the previous task in history.

How this tutorial is organized

StepSectionWhat you do
1Set up the labOpen Galaxium Travels and the chat panel
2Read the context window breakdownSend a minimal prompt, then inspect a fresh breakdown (~8.5k)
3Grow messages with a promptList files, then verify Messages jumps to ~4.2k (12.1k total)
4Create a new context windowClick + (New task), then verify the indicator resets

Familiarize yourself with the following terms:

  • Task: One conversation thread with its own context window. You start a new context window with + (New task). Your prompts, Bob's replies, and approval buttons live here.
  • Context window breakdown: Click the token usage indicator in the top right of the chat panel to see where tokens go.

Totals vary with MCP servers, rules, skills, and how much Bob reads. The following figures are from Galaxium Travels on a 270.0k window. Fixed categories should be close to these numbers. Messages depends on what you ask Bob to do.

Prerequisites

To complete this tutorial, you need the following:

Why context management matters

Token cost

Tokens are the unit of consumption for Bob, measured in Bob coins. Longer conversations and larger file reads consume more tokens. Keeping conversations focused reduces cost.

Every prompt re-sends the full active context. That includes fixed overhead you never typed. A one-line question still carries Tool definitions, Rules, and whatever else Bob loads by default.

Summarization is lossy

When Bob reaches its token limit, Bob condenses older content to keep working which drops detail. You can lose edge cases, intermediate reasoning, and constraints you stated many prompts ago.

If you still need content details, start a new task before Bob summarizes it away.

Quality degrades before the limit

Bob currently uses a 270.0k token window. Check your own token usage indicator for the exact cap. Quality often drops before you reach it. As Messages grows, replies get less reliable.

Set up the lab

  1. Clone the Galaxium Travels repository.

    git clone -b bob-learning-path-branch https://github.com/IBM/galaxium-travels
  2. Click File then Open Folder.

  3. Navigate to the galaxium-travels directory you cloned and open it.

  4. Open the Bob chat interface by clicking the Bob icon beside the navigation bar, or use the shortcut Option + Command + B (macOS) or Ctrl + Alt + B (Windows).

  5. In the chat input field, run /init. Bob scans the repository and creates an AGENTS.md file with project rules. Click Approve todo tools for task if prompted.

    Wait for Bob to report that it finished. This AGENTS.md is what later appears as the Rules line in the context window breakdown, so the repository needs it before you measure a baseline.

Read the context window breakdown

Get a fresh baseline, then read the breakdown.

  1. Click + at the top of the chat panel to start a new task.

  2. Send a minimal prompt to use a small amount of tokens:

    Quickly say hi back.

    Wait for Bob's reply.

  3. Click the token usage indicator in the top right of the chat panel to see the usage breakdown.

Context Window Breakdown

After this exchange on Galaxium Travels, you numbers will vary, but you will see numbers close to:

Tokens
Total used8.5k (~3% full)
System prompt1.5k
Tool definitions5.1k
Rules830
Skills454
Messages590
Reserved for model response20.0k
Available space241.5k

If Total used is far from 8.5k, check that you started a fresh task and sent only the one prompt.

Tool definitions is usually the largest fixed category. MCP servers and built-in tool schemas load whether you call them or not. Rules comes from project files like AGENTS.md. Skills can increase later if Bob loads a skill during the task.

  1. Read each category. The breakdown shows where tokens go:

    CategoryWhat it is
    System promptBob's core instructions for this session
    Tool definitionsSchemas for Bob's built-in tools and connected MCP tools
    RulesCustom instructions from your project and mode (custom rules, for example AGENTS.md)
    SkillsInstructions from any skills Bob loaded (the UI may show a count, for example Skills (1 loaded))
    MessagesYour prompts, Bob's replies, and tool activity in the task. This is the transcript counted as tokens.

    Under Estimated breakdown:

    • Reserved for model response: Reserved tokens so Bob can reply without immediately hitting the limit.
    • Available space: Estimated tokens still free before Bob needs to condense.

    On Galaxium, fixed categories (System prompt, Tool definitions, Rules, Skills) total roughly 8k before meaningful work. You pay that on every turn, whether you typed it or not.

Grow messages with a prompt

Stay in the same task. Send a prompt that fills the transcript.

  1. Request a list of files.

    List all of the files in this directory.

    Approve read actions if prompted. Bob lists files in the repository.

  2. Compare what changed. Open the breakdown again. On Galaxium Travels, you should see numbers close to:

    CategoryFresh taskAfter list-filesSustained work (reference)
    System prompt1.5k1.5k1.5k
    Tool definitions5.1k5.1k5.1k
    Rules830830830
    Skills4544541.2k (1 loaded)
    Messages5904.2k19.4k
    Total used8.5k (~3%)12.1k (~4%)28.0k (~10%)
    Available space241.5k237.9k222.0k

    Messages should now read about 4.2k. If it is much higher, Bob read more files than this example, which is fine. The point is that Messages grew while the fixed categories did not.

    List output and tool activity sit in the transcript. System prompt, Tool definitions, Rules, and Skills stay flat after one list-files prompt.

    The rightmost column is from a longer Galaxium session with more reads and follow-up prompts. Skills can increase if Bob loads a skill (454 to 1.2k in that example). Over time, Messages is usually what grows fastest.

    One list-files prompt adds about 3.6k to Messages on Galaxium. Fixed overhead stays near 8k. Repository exploration uses context quickly even when overhead does not change.

Create a new context window

Start a new task in the same project. The old task (conversation) stays in history.

  1. Click + (New task) at the top of the chat panel.

    The indicator resets. Messages drops back to a small number. System prompt, Tool definitions, Rules, and Skills reload to roughly the baseline.

  2. The task you left stays in the task list, and you can switch back at any time. It keeps its own transcript and token count. Bob does not use it while you work in the new task.

    Start a new task when:

    • You switch topics or work goals.
    • Messages is large enough to hurt quality or cost. On Galaxium, 19.4k in Messages is a reasonable signal to reset.
    • You finished planning and want a clean task for implementation. See Plan and implement complex features.

    Reflection: Open the breakdown on the new task. Which categories returned to baseline? Which would have kept growing if you had stayed in the old task?

Next steps

In this tutorial, you learned how to manage the context window effectively. You read the breakdown, measured the amount of fixed token overhead, watched Messages increase after one list-files prompt, and reset with + (New task).

How is this topic?