clear-context
Automatic context management with graceful handoff to a continuation subagent at 80% usage
Install via CLI (Recommended)
clawhub install openclaw/skills/skills/athola/nm-conserve-clear-contextNight Market Skill — ported from claude-night-market/conserve. For the full experience with agents, hooks, and commands, install the Claude Code plugin.
Table of Contents
- Quick Start
- When to Use
- The Auto-Clear Pattern
- Thresholds
- Auto-Clear Workflow
- Integration with Existing Hooks
- Self-Monitoring Pattern
Clear Context Skill
Quick Start
When context pressure reaches critical levels (80%+), invoke this skill to:
- Save current session state
- Delegate continuation to a fresh subagent
- 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
When NOT To Use
- Context usage is under 50% - continue working normally
- Mid-critical-operation where handoff would lose state
- Consider "Summarize from here" first (Claude Code 2.1.32+): Before full auto-clear, try partial summarization via the message selector. This compresses older context while preserving recent work — often sufficient to relieve pressure without a full handoff.
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.75for 75%)CONSERVE_SESSION_STATE_PATH: Override.claude/session-state.mddefault
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 1.5: Finalize Task List Before Handoff
Important: Before saving state or spawning a continuation agent, reconcile the task list:
Metadata
Not sure this is the right skill?
Describe what you want to build — we'll match you to the best skill from 16,000+ options.
Find the right skillPaste this into your clawhub.json to enable this plugin.
{
"plugins": {
"official-athola-nm-conserve-clear-context": {
"enabled": true,
"auto_update": true
}
}
}Related Skills
extract
Analyze a codebase and build a knowledge base of business logic, architecture, data flow, and engineering patterns. The foundation for gauntlet challenges and agent integration
discourse
>- Scan community discussion channels (HN, Lobsters, Reddit, tech blogs) for experience reports and opinions on a topic
synthesize
>- Merge, deduplicate, rank, and format research findings from multiple channels into a coherent report. Use after research agents return their results
workflow-monitor
Detect workflow failures and inefficient patterns, then create GitHub issues for improvement via /fix-workflow
architecture-paradigm-hexagonal
Hexagonal (Ports and Adapters) architecture isolating domain logic from infrastructure