Nm Conserve Context Optimization
by @athola
Optimizes context window via MECW principles and memory tiering
clawhub install nm-conserve-context-optimizationπ About This Skill
name: context-optimization description: | Analyze and optimize context window usage with MECW principles, memory tiering, session routing, and subagent coordination version: 1.9.4 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. For the full experience with agents, hooks, and commands, install the Claude Code plugin.
Table of Contents
Context Optimization Hub
Quick Start
Basic Usage
# Analyze current context usage
python -m conserve.context_analyzer
When To Use
When NOT To Use
Core Hub Responsibilities
1. Assess context pressure and MECW compliance. 2. Route to appropriate specialized modules. 3. Coordinate subagent-based workflows. 4. Manage token budget allocation across modules. 5. 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
head, tail, or grep on file references.Integration Points
Resources
modules/mecw-principles.md for core concepts and the 50% rule.modules/mecw-theory.md for pressure levels, compliance checking, and monitoring patterns.modules/mecw-assessment.md for risk identification.modules/subagent-coordination.md for decomposition patterns.modules/context-waiting.md for deferred loading strategies.Troubleshooting
Common Issues
If context usage remains high after optimization, check for large files that were read entirely rather than selectively. If MECW assessments fail, ensure that your environment provides accurate token count metadata. For permission errors when writing output logs to /tmp, verify that the project's temporary directory is writable.
β‘ When to Use
π‘ Examples
Basic Usage
# Analyze current context usage
python -m conserve.context_analyzer
π Tips & Best Practices
head, tail, or grep on file references.