Xpersona
C

clear-context

CLAWHUB · Unverified

Manages context overflow by handing off to a fresh subagent at 80% usage Skill: clear-context Owner: athola Summary: Manages context overflow by handing off to a fresh subagent at 80% usage Tags: latest:1.9.19 Version history: v1.9.19 | 2026-08-26T13:09:33.389Z | user Release v1.9.19 v1.9.17 | 2026-07-30T05:32:02.750Z | user Release v1.9.17 v1.9.16 | 2026-07-14T19:48:51.787Z | user Release v1.9.16 v1.9.15 | 2026-07-04T21:22:25.082Z | user Release v1.9.15 v1.9.14 | 2026-06-30T17:53:05.301Z

62
Rank
84
Safety
1.6k
Downloads

About

What it does, and when to use it.

Capability contract not published. No trust telemetry is available yet. 1.6K downloads reported by the source. Last updated 10/10/2026.

Avoid when

  • Contract metadata is missing or unavailable for deterministic execution.

Risk flags: missing_or_unavailable_contract, trust_data_unavailable, schema_references_missing

Install and run

Setup complexity: low.

clawhub skill install s17emme0e2m3cpf7k2jvp3a84984b8z9:nm-conserve-clear-context
  1. Setup complexity is classified as HIGH. You must provision dedicated cloud infrastructure or an isolated VM. Do not run this directly on your local workstation.
  2. Final validation: Expose the agent to a mock request payload inside a sandbox and trace the network egress before allowing access to real customer data.

Contract: missing

curl -s "https://www.xpersona.co/api/v1/agents/clawhub-athola-nm-conserve-clear-context/snapshot"

Run-check

$0.02 USD

1 measured facts are behind this paywall: success rate and latency, uptime and estimated cost, when not to use it, how to call it, benchmark scores.

Agents pay $0.02 in USDC. A card payment is $0.50, the smallest a card allows.

Documentation

CLAWHUB

144,036 characters of source documentation, loaded on request.

Extracted files

5 files captured from the source.

SKILL.md

---
name: clear-context
description: Manages context overflow by handing off to a fresh subagent at 80% usage
version: 1.9.8
triggers:
  - context pressure is critical and work must continue uninterrupted
metadata: {"openclaw": {"homepage": "https://github.com/athola/claude-night-market/tree/master/plugins/conserve", "emoji": "\ud83e\udd9e"}}
source: claude-night-market
source_plugin: conserve
---

> **Night Market Skill** — ported from [claude-night-market/conserve](https://github.com/athola/claude-night-market/tree/master/plugins/conserve). For the full experience with agents, hooks, and commands, install the Claude Code plugin.


## 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

## 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.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 1.5: Finalize Task List Before Handoff

**Important**: Before saving state or spawning a continuation agent, reconcile the task list:

1. **Review

_meta.json

{
  "ownerId": "kn7d107jg9jv602h9ytsegydq184a42s",
  "slug": "nm-conserve-clear-context",
  "version": "1.9.19",
  "publishedAt": 1787749773389
}

modules/session-state-schema.md

---
name: session-state-schema
description: |
  Versioned schema definition for session state files.
  Enables backward compatibility as the format evolves.
category: conservation
---

# Session State Schema

## Current Version: 1

All session state files MUST include a `state_version` field on the first content line after the heading. This enables continuation agents to detect the format and apply migration logic when needed.

## Version 1 Schema

### Required Header

```markdown
# Session State Checkpoint
state_version: 1
Generated: YYYY-MM-DD HH:MM:SS
Reason: [Context threshold | Manual checkpoint | Task boundary]
```

### Required Sections

| Section | Purpose |
|---------|---------|
| `## Execution Mode` | Mode, auto-continue flag, source command |
| `## Current Task` | What we are trying to accomplish |
| `## Progress Summary` | What has been done so far |
| `## Continuation Instructions` | Next steps for the continuation agent |

### Optional Sections

| Section | Purpose |
|---------|---------|
| `## Key Decisions` | Decisions and rationale |
| `## Active Files` | Files being modified or referenced |
| `## Pending TodoWrite Items` | Outstanding todo items |
| `## Existing Task IDs` | Task IDs for deduplication |
| `## Metadata` | JSON block with handoff count, priority, etc. |

## Version 0 (Unversioned Legacy)

Any session state file that lacks the `state_version` field is v0. These files were written before versioning was introduced.

### Identifying v0 Files

A v0 file typically starts with:

```markdown
# Session State Checkpoint
Generated: YYYY-MM-DD HH:MM:SS
```

No `state_version` line is present.

### V0 Field Mapping

V0 files use the same section names as v1. The only difference is the missing version header. All sections are compatible.

## Migration: V0 to V1

When a continuation agent encounters a v0 file, apply this migration:

1. **Treat it as v1.** The content is structurally identical.
2. **Do not rewrite the file** just to add the version header. Only add `state_version: 1` if you are already updating the file for other reasons (e.g., progress checkpoint).
3. **Log the migration.** Note in your handoff summary: "Migrated session state from v0 (unversioned) to v1."

No field renaming or restructuring is needed. V0 and v1 are content-compatible.

## Version Check Logic

Continuation agents MUST follow this sequence when reading a session state file:

```
1. Read the file
2. Look for "state_version: N" in the first 5 lines
3. If found:
   a. version == 1  -> proceed normally
   b. version > 1   -> warn "Unknown state version N, attempting to read"
                        then proceed (best-effort forward compatibility)
4. If not found:
   -> treat as v0, proceed normally (v0 is compatible with v1)
```

### Forward Compatibility

Future versions should maintain backward-compatible section names where possible. If a breaking change is needed, the version number increments and this document gets a new migration section.

A con

modules/session-state.md

---
name: session-state
description: |
  Session state persistence format and management for context handoffs.
  Defines the checkpoint structure that enables seamless continuation.
category: conservation
---

# Session State Module

## Overview

This module defines the session state format used for context handoffs. A well-structured state file enables continuation agents to seamlessly pick up where the previous agent left off.

## State File Location

**Default**: `.claude/session-state.md`

**Override**: Set `CONSERVE_SESSION_STATE_PATH` environment variable

```bash
export CONSERVE_SESSION_STATE_PATH="/tmp/my-session-state.md"
```

## State File Format

### Full Template

```markdown
# Session State Checkpoint
state_version: 1

**Generated**: YYYY-MM-DD HH:MM:SS
**Reason**: [Context threshold | Manual checkpoint | Task boundary]
**Context Level**: [Estimated percentage if known]

---

## Current Objective

[One clear sentence describing what we're trying to accomplish]

### Success Criteria
- [ ] Criterion 1
- [ ] Criterion 2
- [ ] Criterion 3

---

## Progress Summary

### Completed
- [x] Step 1: [Brief description]
- [x] Step 2: [Brief description]

### In Progress
- [ ] Step 3: [What's currently being worked on]

### Remaining
- [ ] Step 4: [Next step]
- [ ] Step 5: [Future step]

---

## Key Decisions Made

| Decision | Rationale | Alternatives Considered |
|----------|-----------|------------------------|
| Decision 1 | Why we chose this | Option A, Option B |
| Decision 2 | Why we chose this | Option C, Option D |

---

## Active Context

### Files Being Modified
| File | Status | Notes |
|------|--------|-------|
| path/to/file1.py | In progress | Adding function X |
| path/to/file2.md | Pending review | Needs formatting |

### Files Read (Reference)
- `path/to/reference1.py` - Used for pattern reference
- `path/to/reference2.md` - Contains requirements

### Open TodoWrite Items
```json
[
  {"id": "todo-1", "status": "pending", "description": "Item 1"},
  {"id": "todo-2", "status": "in_progress", "description": "Item 2"}
]
```

### Existing Task IDs

**IMPORTANT**: List all task IDs from TaskList so the continuation agent
references them via TaskUpdate instead of creating duplicates.

| Task ID | Subject | Status |
|---------|---------|--------|
| #1 | Task subject | in_progress |
| #2 | Task subject | pending |

> The continuation agent MUST use TaskUpdate on these IDs.
> It MUST NOT create new tasks via TaskCreate unless genuinely new work is discovered.

---

## Continuation Instructions

### Immediate Next Step
[Specific action to take first]

### Context to Re-read
1. [File path 1] - [Why it's needed]
2. [File path 2] - [Why it's needed]

### Warnings/Gotchas
- [Any pitfalls the continuation agent should avoid]
- [Known issues encountered]

### If Blocked
[What to do if the immediate next step fails]

---

## Execution Mode

**CRITICAL**: Capture and propagate execution mode for unattended workflows.

```markdown
## Execution Mode

skill-card.md

## Description:

Manages context overflow by saving session state and handing work off to a fresh continuation subagent at high context usage.

This skill is ready for commercial/non-commercial use.

## Publisher:

[athola](https://clawhub.ai/user/athola)

### License/Terms of Use:

MIT-0

## Use Case:

Developers and agent operators use this skill during long-running workflows to preserve task state, write a checkpoint, and delegate continuation when context usage becomes critical.

### Deployment Geography for Use:

Global

## Known Risks and Mitigations:

Risk: Continuation agents may inherit unattended or dangerous execution modes and skip confirmation across handoffs.

Mitigation: Use only in environments with approval gates for destructive actions, permission changes, external posting, secret handling, and spending money.

Risk: The session-state checkpoint may contain sensitive project context.

Mitigation: Periodically inspect or delete .claude/session-state.md, and avoid writing secrets or unnecessary sensitive details into checkpoints.

## Reference(s):

- [ClawHub Skill Page](https://clawhub.ai/athola/skills/nm-conserve-clear-context)
- [ClawHub Publisher Profile](https://clawhub.ai/user/athola)
- [OpenClaw Homepage](https://github.com/athola/claude-night-market/tree/master/plugins/conserve)

## Skill Output:

**Output Type(s):** [Markdown, Shell commands, Configuration, Guidance]

**Output Format:** [Markdown instructions with checkpoint templates, shell snippets, and continuation prompts]

**Output Parameters:** [1D]

**Other Properties Related to Output:** [May create or update a session-state Markdown checkpoint and delegate continuation to a fresh subagent.]

## Skill Version(s):

1.9.19 (source: server release metadata)

## Ethical Considerations:

Users should evaluate whether this skill is appropriate for their environment, review any generated or modified files before relying on them, and apply their organization's safety, security, and compliance requirements before deployment.

Sponsored

Ads related to clear-context and adjacent AI workflows.