evgeniy-mikhailove/rlm-claude-code-os/session-context-mastery
Claude Code and agent skill by evgeniy-mikhailove/rlm-claude-code-os
- community
Checking that the SKILL.md file is still in the repository.
Master context window management for long Claude Code sessions. Use when starting complex multi-hour tasks, when sessions approach context limits, or when output quality degrades mid-session. Covers context budgeting, rewind strategy, compaction, subagent handoffs, and CLAUDE.md progressive disclosure. From Boris Cherny (Claude Code creator) and Thariq (Anthropic).
Install
npx vskill@latest install evgeniy-mikhailove/rlm-claude-code-os/session-context-masterySKILL.md
The same SKILL.md was published earlier as evgeniy-mikhailove/rlm-claude-code-os/session-context-mastery.
Session Context Mastery
Prevent context rot. Manage the 200k window deliberately.
Context Budget Zones
| Zone | Fill % | State | Action | |
|---|---|---|---|---|
| Green | 0–30% | Full capability | None | |
| Yellow | 30–50% | Slight degradation begins | Monitor | |
| Orange / Dumb Zone | 50–70% | Noticeable quality loss | Compact or delegate | |
| Red | 70%+ | High context rot risk | Rewind or clear |
Rule: Compact or rewind before hitting 50% on complex tasks.
Three Strategies
1. Rewind (Precision Tool)
When: A tool call went wrong or context got polluted with bad output.
- Rewind to the point before the failed attempt
- Never try to fix a bad outcome on top of polluted context
- Before rewinding: ask subagent to "summarize findings from this section" first
2. Compact (Mid-Task Compression)
When: Context is filling but task isn't done yet.
- Lossy — appropriate for mid-task, non-critical context
- Claude summarizes what's happened, preserves goal state
- Best for: long research sessions, iterative debugging
3. Clear (Fresh Start)
When: Task is complete, or you need a fully clean slate.
- Complete reset — use only between major tasks
- Write key findings to files BEFORE clearing
Subagent Handoff Protocol
Delegate intermediate work instead of filling main context:
- Give subagent only the specific task + only relevant files
- Subagent works in isolation (fresh 200k context)
- Subagent returns ONLY the conclusion — not the reasoning trail
- You integrate the conclusion (small) not the process (large)
Keeps main context at 30-40% even for complex multi-step tasks.
CLAUDE.md Progressive Disclosure
Split large CLAUDE.md into modular rule files:
Reference with glob: @.claude/rules/security.md loads only when needed.
Target: <2,000 lines of focused context per task.
compact vs clear — Decision
| Situation | Use | |
|---|---|---|
| Mid-task, continuing the same goal | /compact | |
| Task complete, switching topics | /clear | |
| Last output was wrong/polluted | /rewind | |
| About to start fresh project | /clear |
Warning Signs of Context Rot
- AI starts repeating itself or looping
- Suggestions contradict earlier decisions in the same session
- Code quality noticeably drops without explanation
- AI "forgets" conventions established earlier in the session
Act immediately: compact, rewind, or delegate to subagent.
Session Start Checklist
- [ ] Clear context from previous session (unless explicitly continuing)
- [ ] Load ONLY files relevant to this specific task
- [ ] Set explicit goal for this session in first message
- [ ] For multi-session projects: load STATE artifacts (see gsd-workflow skill)
Security
- Security scanPassed, 100 of 100Pattern checks on the skill's files.
- Model reviewNot runA model review is scheduled for the next rescan.
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingskills/session-context-mastery/SKILL.md
Popularity
- 7-day trend score
- 0
Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/evgeniy-mikhailove/rlm-claude-code-os/session-context-mastery)