Context Management in Coding Agents: /compact vs /clear vs /handoff
Melvin Vivas · X post · 2026-07-01 · Open on X
Topics: Prompt & Context Engineering, AI Dev Tools & Productivity · Level: intermediate
Summary
A short take on managing context in agentic coding tools. The quoted post asks when to use /compact, /clear or /handoff. Melvin's approach is simpler: use the largest context window available and let the harness compact automatically when it needs to. He admits he isn't sure this is the right approach.
Key points
- Coding agent harnesses offer context commands: /compact (summarize the history), /clear (start fresh) and /handoff (pass the work on to a new session).
- Melvin's approach: pick the biggest context window and let the harness decide when to auto-compact.
- He isn't sure this is best practice, so treat it as one option, not a rule.
- It helps to have your own mental model for when to compact, clear or hand off.
Try this
- Write down your own rules for when to compact, clear or hand off in your coding agent, then compare them with leaving everything to auto-compaction.
More in Prompt & Context Engineering
- Codex Losing Task Context After Compaction
- Codex + GPT-6 Astra: Persistent Notes to Keep Context Across Windows
- MiniMax H3 Official Video Prompt Writing Guide
- Better Frontend UI from GLM 5.2 with a Design Skill in Claude Code
- Use local Qwen 3.6 to write JSON prompts for Ideogram 4
- Anthropic's Prompting Best Practices Guide for Claude Opus 4.8