athola/claude-night-market/context-optimization
Claude Code and agent skill by athola/claude-night-market
- community
Checking that the SKILL.md file is still in the repository.
Optimizes context window via MECW principles and memory tiering. Use when context exceeds 30% or before long multi-step tasks.
Install
npx vskill@latest install athola/claude-night-market/context-optimizationSKILL.md
Context Optimization Hub
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
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. - Use 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
- Token Conservation: Receives usage strategies, returns MECW-compliant optimizations.
- CPU/GPU Performance: Aligns context optimization with resource constraints.
- MCP Code Execution: Delegates complex patterns to specialized MCP modules.
Resources
- MECW Theory: See
modules/mecw-principles.mdfor core concepts, the 50% rule, and quick-start code examples. - Context Analysis: See
modules/mecw-assessment.mdfor risk identification. - Workflow Delegation: See
modules/subagent-coordination.mdfor decomposition patterns. - Context Waiting: See
modules/context-waiting.mdfor deferred loading strategies. - Cache Alignment: See
modules/cache-aligned-prefixes.mdfor ordering context so provider KV caches hit (stable prefix first, volatile last). - Compression Choice: See
modules/compression-strategies.mdto pick one
of /clear and /catchup, a continuation agent, archive and summarize, or delegation, with savings and risk.
- Large Tool Outputs: See
modules/reversible-compression.mdfor
archiving an oversized output to a retrievable handle.
- Pasted Logs: See
modules/log-debugging-hygiene.mdfor filtering a log
before any compression. /filter-log anchors on it.
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.
Exit Criteria
- [ ] Context pressure assessed against the MECW 50% rule
- [ ] A memory tier or routing decision recorded for the current state
- [ ] Large outputs referenced by file or handle, not read in full
- [ ] When the request controls the provider payload, prefix ordering checked
against modules/cache-aligned-prefixes.md (stable first, volatile last)
- [ ] Optimization downgraded to advisory when the harness already caches
(cache writes cost more than they save on non-repeated prefixes)
Security
- Security scanPassed, 100 of 100Pattern checks on the skill's files.
- Model reviewNot runA model review is scheduled for the next rescan.
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingplugins/conserve/skills/context-optimization/SKILL.md
Popularity
- Repository stars
- 343
- Repository forks
- 37
- 7-day trend score
- 29
Stars and forks are for the whole GitHub repository, not this skill alone. Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/athola/claude-night-market/context-optimization)