Context window management
Learn how Bob's 270,000-token context window works, how each category contributes to token usage, and best practices for keeping sessions focused and cost-efficient.
Context window overview
Each session in Bob Shell has a context window — the token budget for that conversation. The cap is 270,000 tokens. Everything Bob loads counts against it.
What fills the window
| Category | What it includes |
|---|---|
| System prompt | Bob's core instructions for the session |
| Tool definitions | Built-in tool schemas and connected MCP tool definitions |
| MCP Tools | Instructions and descriptions for tools provided by connected MCP servers |
| Rules | Custom instructions from project and mode rule files (for example, AGENTS.md or .bob/rules-*) |
| Skills | Instructions from skills Bob loaded for the conversation |
| Messages | Your prompts, Bob's replies, and tool activity in the conversation. This is the transcript counted as tokens. |
Command output and tool results count toward Messages. File contents do not get a separate line.
The token report includes two summary fields:
- Reserved for model response: Tokens held back for Bob's next reply (typically 20.0k).
- Available space: Remaining free tokens.
Baseline overhead
Fixed categories use context before you even begin working with Bob. Even a simple "Quickly say hi back." totals about 8.5k tokens. Most of that is Tool definitions (5.1k), System prompt (1.5k), Rules (830), and Skills (454). Only 590 is in Messages.
Bob re-sends the full overhead stack on every prompt. More MCP servers or loaded skills increase MCP Tools, Tool definitions, and Skills before you type.
Monitoring your token usage
Bob Shell reports token usage at the end of each exchange. The following table shows what influences each category:
| Category | What makes it grow |
|---|---|
| System prompt | Loaded when the session starts. Stays flat during normal work. |
| Tool definitions | Built-in tool schemas. Set when the session starts. Stays flat during normal work. |
| MCP Tools | Connected MCP servers and enabled tools. Grows when you add servers or tools, not when you send prompts. |
| Rules | Project and mode rule files (for example, AGENTS.md). Set when the session opens. |
| Skills | Skills Bob loads for the session. Can increase if Bob activates a skill mid-conversation. |
| Messages | Your prompts, Bob's replies, file reads, tool output, and command output. Grows with every turn and with repo exploration. |
In a short exchange, fixed categories often use most of the total. When you ask Bob to read files or run tools, Messages usually becomes the largest category. Watch for this shift.
Available space shrinks as any category grows. Reserved for model response is set aside for Bob's next reply. It is not part of the used total above it.
Token limits
The hard cap is 270,000 tokens per session. Bob starts condensing before you reach the limit. Condensation typically begins around 190,000 tokens of total usage.
Automatic context condensation
At the condensation threshold, Bob:
- Preserves the most recent and relevant context.
- Summarizes or removes older conversation segments.
- Maintains critical system instructions, tool definitions, rules, and skills.
- Continues with the condensed context.
Condensation is lossy. Details from early in Messages might not survive. Start a new session when you change topics or when Messages is large enough to hurt quality.
Impact on Bobcoins
Bobcoins track token usage. Both input and output tokens count.
- Each message sends the full active context again, including fixed overhead.
- Bob re-processes what is already loaded on every send.
- Long sessions with heavy Messages cost more per later prompt.
Best practices
The context window is not storage. It is working memory — what Bob can use at each step. Control what goes in. Reset when the session fills with stale output. Check the result with tests, not just Bob's reply.
Scope the session and the conversation
Use one session per work goal and start with a narrow prompt. State the goal, expected outcome, and constraints before asking Bob to explore the repo. Name files and functions explicitly. Avoid vague requests like "read the whole repo" or "check the backend." Start a new session when the topic changes — unrelated content in Messages adds cost and can confuse Bob.
Keep standing context lean
Fixed categories consume tokens before you type anything. To keep that overhead low:
- Keep custom rules and
AGENTS.mdshort — put only setup, test, and style commands there (for example,pnpm test,mvn verify). - Connect only the MCP servers, tools, and skills the current work needs. Disconnect what you are not using, and prefer project-scoped MCP config over global.
- Reserve Messages for situational evidence specific to this session — the bug, logs, and relevant files. Do not repeat standing rules in every prompt.
Add context when you need it
Let Bob search and read targeted files rather than pasting large blocks of content into the chat prompt. Reference specific file paths and line ranges in your prompt, and avoid broad directory references:
✓ Fix the email validation logic in src/utils/validation.ts lines 45-67
✗ Review everything in src/, tests/, and docs/ and suggest improvementsWork in stages — find likely files, inspect the relevant ones, plan, change, and validate. For broad repo reads, use subagents so the session receives condensed results rather than every read_file call landing in Messages. When sources conflict, trust running code and tests over stale comments or old README notes.
For more tactics on large repos, see Working with large projects.
Reset when Messages fills up
Over a long session, Messages accumulates repeated file contents, abandoned plans, and stale tool output. Start a new session when the work goal changes or when the conversation is large enough to hurt quality. Keep constraints, evidence, and open questions — remove the rest.
Bob can also condense older segments automatically, but condensation is lossy and details from early in Messages may not survive. Prefer small, approved changes over one large autonomous run so diffs stay reviewable and Bob stays on track.
Tools
Learn how Bob Shell uses specialized tools to read files, edit code, run commands, and interact with your development environment from the command line.
Context poisoning
Learn what context poisoning is, how to recognize it in a Bob Shell session, and how to recover by starting a fresh session or improving context hygiene.