AI Context Management β
Every AI model can only "see" a limited amount of conversation at once β its context window. As a chat grows, older messages, code snippets, and tool results pile up until the model runs out of room. DojoCode tracks this for you and automatically compacts long conversations, so you can keep chatting without ever hitting the limit.
Context management works the same way everywhere the AI chat appears: the challenge editor, projects, and the Career Coach.
The context usage ring β
After the AI's first response, a small ring appears next to the chat input. It fills up as the conversation grows and changes color as you approach the limit:
| Ring color | Meaning |
|---|---|
| π£ Purple | Plenty of room left |
| π‘ Amber | Over 60% of the context window used |
| π΄ Red | Over 80% β compaction is about to kick in |
Hover over the ring to see the exact numbers, e.g. Context: 45.2k / 200.0k (23%). The usage is reported by the AI provider after each response, so it reflects the real size of the conversation β including your code files and tool results, not just the visible messages. When you reopen a saved conversation (or right after a compaction), the ring starts from an estimate and syncs with the real number after the next response.
Different models, different windows
Each model has its own context window size. Larger-window models fill up more slowly and compact less often β switching models does not lose any conversation history.
Automatic compaction β
When the conversation crosses 80% of the model's context window, DojoCode compacts it automatically after the current response finishes:
- The older part of the conversation is sent to the AI to be compressed into a dense summary β your goals and requirements, what was implemented (including file names and key decisions), the current state of the work, and any open tasks or next steps.
- The recent messages are kept word-for-word β at least the last few turns, and the cut point is always one of your own messages, so an exchange between the AI and its tools is never split in half.
- The summary replaces the older messages, and the conversation continues from there as if nothing happened.
While this runs, the ring spins and a "Compacting conversationβ¦" note appears next to it. It usually takes just a few seconds.
In the chat you'll see a divider where the compaction happened:
β Conversation compacted β show summary β
Click it to expand and read exactly what the AI remembers from the earlier part of the conversation.
Compaction is free
Compacting a conversation does not consume AI tokens and does not affect your challenge score β it's automatic maintenance, not a prompt.
When compaction waits β
Compaction is careful about timing. It never runs:
- while the AI is still responding,
- while file changes from the AI are awaiting your approval β it waits until you accept or reject them,
- if the conversation is still too short to be worth summarizing.
If summarizing fails for any reason, nothing is changed β the conversation stays intact and DojoCode simply tries again after the next turn.
Manual compaction β /compact β
You don't have to wait for the automatic threshold. Type /compact in the chat input (a command autocomplete appears as soon as you type /) and press Enter. The conversation is compacted immediately, no matter how full the ring is. If the conversation is still too short, you'll get a friendly note and nothing changes.
Slash commands are local actions β they are never sent to the AI and don't consume tokens.
What the AI remembers after compaction β
The summary is written specifically so the AI can continue seamlessly. It keeps:
- your goals, requirements and constraints,
- what was attempted or implemented, with concrete file names and key decisions,
- the current state of the work,
- unresolved tasks and next steps.
Your recent messages are untouched, so the immediate back-and-forth always stays exact. If a small detail from much earlier becomes important again, just mention it β the AI will pick it up from there.
Checkpoints and compaction
File checkpoints (the revert points created when the AI edits your files) that belong to summarized messages are cleaned up together with those messages. You can still revert to any checkpoint from the kept recent part of the conversation.
What's Next? β
- π€ AI Assistance
- π₯ Solving challenges
- β¨οΈ Keyboard shortcuts