Skip to content
Back to skills

Context Optimization Athola

ASecurity

Optimizes context window via MECW principles and memory tiering. Use when context exceeds 30% or before long multi-step tasks.

  • 3 stars
  • 0 votes
  • 0 copies
  • 2 views
  • Added September 12, 2026
ai-agentspythongobashgitperformance

Works with

  • claude code
  • mcp

Security analysis

A100/100

Pro scans all 10 files and shows the line behind each finding

Scanned September 12, 2026

npx -y skills add thedixitjain/the-mega-skill-library --skill context-optimization--athola --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Context Optimization Athola?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Context Optimization  Athola
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/thedixitjain-context-optimization-athola/badge)](https://www.skillsdirectory.com/skills/thedixitjain-context-optimization-athola)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: context-optimization
description: "Optimizes context window via MECW principles and memory tiering. Use when context exceeds 30% or before long multi-step tasks."
category: engineering-core
source_repo: athola/claude-night-market
source_path: "plugins/conserve/skills/context-optimization/SKILL.md"
source_url: https://github.com/athola/claude-night-market/blob/HEAD/plugins/conserve/skills/context-optimization/SKILL.md
---

## Table of Contents

- [When to Use](#when-to-use)
- [Core Hub Responsibilities](#core-hub-responsibilities)
- [Module Selection Strategy](#module-selection-strategy)
- [Context Classification](#context-classification)
- [Integration Points](#integration-points)
- [Resources](#resources)


# 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

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

```python
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`, or `grep` on 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.md` for core concepts, the 50% rule, and quick-start code examples.
- **Context Analysis**: See `modules/mecw-assessment.md` for risk identification.
- **Workflow Delegation**: See `modules/subagent-coordination.md` for decomposition patterns.
- **Context Waiting**: See `modules/context-waiting.md` for deferred loading strategies.
- **Cache Alignment**: See `modules/cache-aligned-prefixes.md` for ordering context so provider KV caches hit (stable prefix first, volatile last).
## 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)

---

**Source:** [`athola/claude-night-market`](https://github.com/athola/claude-night-market) → `plugins/conserve/skills/context-optimization/SKILL.md`

Files in this skill

  • SKILL.md4.6 KB
  • modules/belief-clarity.md3.8 KB
  • modules/cache-aligned-prefixes.md3.1 KB
  • modules/context-waiting.md9.7 KB
  • modules/findings-format.md1.7 KB
  • modules/mecw-assessment.md4.8 KB
  • modules/mecw-principles.md16.6 KB
  • modules/memory-tiers.md2.1 KB
  • modules/session-routing.md2.4 KB
  • modules/subagent-coordination.md23.8 KB

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.