Smart Context Management
When working with Large Language Models (LLMs), there are limits to how much conversation history they can process at once. Goose provides smart context management features to help you maintain productive sessions even when reaching these limits. Here are the key concepts:
- Context Length: The amount of conversation history the LLM can consider
- Context Limit: The maximum number of tokens the model can process
- Context Management: How Goose handles conversations approaching these limits
Smart Context Management Features
When a conversation reaches the context limit, Goose offers different ways to handle it:
Feature | Description | Best For | Impact |
---|---|---|---|
Summarization | Condenses conversation while preserving key points | Long, complex conversations | Maintains most context |
Truncation | Removes oldest messages to make room | Simple, linear conversations | Loses old context |
Clear | Starts fresh while keeping session active | New direction in conversation | Loses all context |
Using Smart Context Management
- Goose Desktop
- Goose CLI
Goose Desktop exclusively uses summarization to manage context, preserving key information while reducing size.
- Automatic
- Manual
When you reach the context limit in Goose Desktop:
- Goose will automatically start summarizing the conversation to make room.
- You'll see a message that says "Preparing summary...", followed by "Session summarized."
- Once complete, you'll have the option to "View or edit summary."
- You can then continue the session with the summarized context in place.
You can proactively summarize your conversation before reaching context limits:
- Click the scroll text icon () in the chat interface
- Confirm the summarization in the modal
- View or edit the generated summary if needed
The CLI offers three context management options: summarize, truncate, or clear your session.
- Automatic
- Manual
When you hit the context limit, you'll see this prompt to choose a management option, allowing you to continue your session:
◇ The model's context length is maxed out. You will need to reduce the # msgs. Do you want to?
│ ○ Clear Session
│ ○ Truncate Message
│ ● Summarize Session
final_summary: [A summary of your conversation will appear here]
Context maxed out
--------------------------------------------------
Goose summarized messages for you.
To proactively trigger summarization before reaching context limits, use the /summarize
command:
( O)> /summarize
◇ Are you sure you want to summarize this conversation? This will condense the message history.
│ Yes
│
Summarizing conversation...
Conversation has been summarized.
Key information has been preserved while reducing context length.
Token usage
- Goose Desktop
- Goose CLI
After sending your first message to Goose, a colored circle appears next to the model name at the bottom of the session window. The color provides a visual indicator of your token usage for the session.
- Green: Normal usage - Plenty of context space available
- Orange: Warning state - Approaching limit (80% of capacity)
- Red: Error state - Context limit reached
Hover over this circle to display:
- the number of tokens used
- the percentage of available tokens used
- the total available tokens
- A progress bar showing your current token usage
This functionality is not available in the Goose CLI.