Automatic context management with graceful handoff to continuation subagent. Triggers: context pressure, 80% threshold, auto-clear, context full, continuation, session state, checkpoint Use when: Context usage approaches 80% during long-running tasks. This skill enables automatic continuation without manual /clear. The key insight: Subagents have fresh context windows. By delegating remaining work to a continuation subagent, we achieve effective "auto-clear" without stopping the workflow.
View on GitHubathola/claude-night-market
conserve
January 25, 2026
Select agents to install to:
npx add-skill https://github.com/athola/claude-night-market/blob/main/plugins/conserve/skills/clear-context/SKILL.md -a claude-code --skill clear-contextInstallation paths:
.claude/skills/clear-context/## Table of Contents
- [Quick Start](#quick-start)
- [When to Use](#when-to-use)
- [The Auto-Clear Pattern](#the-auto-clear-pattern)
- [Thresholds](#thresholds)
- [Auto-Clear Workflow](#auto-clear-workflow)
- [Integration with Existing Hooks](#integration-with-existing-hooks)
- [Self-Monitoring Pattern](#self-monitoring-pattern)
# Clear Context Skill
## Quick Start
When context pressure reaches critical levels (80%+), invoke this skill to:
1. Save current session state
2. Delegate continuation to a fresh subagent
3. Continue work without manual intervention
```
Skill(conserve:clear-context)
```
## When to Use
- **Proactively**: Before starting large multi-chained tasks
- **Reactively**: When context warning indicates 80%+ usage
- **Automatically**: Integrated into long-running workflows
## The Auto-Clear Pattern
Since `/clear` requires user action, we achieve automatic context clearing without interruption through **subagent delegation**:
```
Main Agent (high context)
↓
Saves state to .claude/session-state.md
↓
Spawns continuation subagent (fresh context)
↓
Subagent reads state, continues work
```
## Thresholds
| Level | Threshold | Action |
|-------|-----------|--------|
| WARNING | 40% | Monitor, plan optimization |
| CRITICAL | 50% | Prepare for handoff |
| EMERGENCY | 80% | **Execute auto-clear now** |
**Configuration** (environment variables):
- `CONSERVE_EMERGENCY_THRESHOLD`: Override 80% default (e.g., `0.75` for 75%)
- `CONSERVE_SESSION_STATE_PATH`: Override `.claude/session-state.md` default
## Auto-Clear Workflow
### Step 1: Assess Current State
Before triggering auto-clear, gather:
- Current task/goal description
- Progress made so far
- Key decisions and rationale
- Files being actively worked on
- Open TodoWrite items
### Step 2: Save Session State
Write to `.claude/session-state.md` (or `$CONSERVE_SESSION_STATE_PATH`):
```markdown
# Session State Checkpoint
Generated: [timestamp]
Reason: Context threshold exce