context-optimization
Analyze and optimize context window usage with MECW principles, memory tiering, session routing, and subagent coordination
Install via CLI (Recommended)
clawhub install openclaw/skills/skills/athola/nm-conserve-context-optimizationNight 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
- Core Hub Responsibilities
- Module Selection Strategy
- Context Classification
- Integration Points
- Resources
Context Optimization Hub
Quick Start
Basic Usage
# Analyze current context usage
python -m conserve.context_analyzer
When To Use
- Threshold Alert: When context usage approaches 50% of the window.
- Complex Tasks: For operations requiring multi-file analysis or long tool chains.
When NOT To Use
- Simple single-step tasks with low context usage
- Already using mcp-code-execution for tool chains
Core Hub Responsibilities
- Assess context pressure and MECW compliance.
- Route to appropriate specialized modules.
- Coordinate subagent-based workflows.
- Manage token budget allocation across modules.
- Synthesize results from modular execution.
Module Selection Strategy
def select_optimal_modules(context_situation, task_complexity):
if context_situation == "CRITICAL":
return ['mecw-assessment', 'subagent-coordination']
elif task_complexity == 'high':
return ['mecw-principles', 'subagent-coordination']
else:
return ['mecw-assessment']
Context Classification
| Utilization | Status | Action |
|---|---|---|
| < 30% | LOW | Continue normally |
| 30-50% | MODERATE | Monitor, apply principles |
| > 50% | CRITICAL | Immediate optimization required |
Large Output Handling (Claude Code 2.1.2+)
Behavior Change: Large bash command and tool outputs are saved to disk instead of being truncated; file references are provided for access.
Impact on Context Optimization
| Scenario | Before 2.1.2 | After 2.1.2 |
|---|---|---|
| Large test output | Truncated, partial data | Full output via file reference |
| Verbose build logs | Lost after 30K chars | Complete, accessible on-demand |
| Context pressure | Less from truncation | Same - only loaded when read |
Best Practices
- Avoid pre-emptive reads: Large outputs are referenced, not automatically loaded into context.
- Read selectively: Use
head,tail, orgrepon file references. - Leverage full data: Quality gates can access complete test results via files.
- Monitor growth: File references are small, but reading the full files adds to context.
Integration Points
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-context-optimization": {
"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