What is a context window?
A context window is the maximum amount of tokenized input and output a model can consider in one inference cycle. Coding agents fill it with system instructions, conversation history, repository excerpts, tool calls, and tool results.
A larger window can retain more evidence, but capacity alone does not guarantee better answers. Irrelevant history can dilute the current task and local models may require substantially more RAM or VRAM at larger context sizes.
Midnight Coder context commands
/context
/smartcontext
/mini-model
/resume-type
/new
/clear
/compact
/contextsets the maximum window before automatic compaction./smartcontexttoggles model-aware Ollama context sizing./mini-modelselects the model used for compaction./resume-typecontrols the compaction strategy./compacttrims a long conversation deliberately./newopens another chat;/clearstarts fresh.
Threads, turns, and items
Persistent structure lets a client resume or fork work without treating the visible chat transcript as the only source of state.
Practical context strategy
- Start a new thread for a materially different objective.
- Keep the active request specific so retrieved files stay relevant.
- Compact after a completed milestone, not in the middle of unresolved debugging.
- Use smart context when Ollama should receive the active model's native window.
- Resume a saved thread only when its prior decisions still matter.
Learn related terminology in the AI coding glossary.
Primary source: Midnight Coder README.
Keep coding context explicit
Use Midnight Coder's context, compaction, resume, and thread controls.
Explore Midnight CoderAgent workflow