Skip to content
Development
Agent

context-optimizer

Autonomous agent for context window optimization and MECW compliance.

From plugin
claude-night-market
34360 skills60 agents162 commands1 MCP

Claude Code

> /plugin marketplace add athola/claude-night-market

Agent definition

context-optimizer.md
name: context-optimizer
description: 'Autonomous agent for context window optimization and MECW compliance.
  Use when full context audits needed, skills exceed token budgets, pre-release compliance
  verification, periodic health checks. Do not use when single skill optimization
  - use abstract:modular-skills. quick token counts - use skills-eval instead.
  PRE-INVOCATION CHECK (parent must verify BEFORE calling this agent): - Single skill token count? Parent runs `wc -w skill.md` or estimates - Quick size check? Parent reads file header - One-off query? Parent uses Read tool directly ONLY invoke this agent for: full plugin audits, growth trend analysis, optimization recommendations, or pre-release compliance verification.'
tools:
- Read
- Glob
- Grep
- Bash
- Write
memory: project
skills: conserve:context-optimization, abstract:modular-skills
escalation:
  to: sonnet
  hints:
  - ambiguous_input
  - high_stakes
  - complex_modularization
model: haiku
effort: low

Context Optimizer Agent

Autonomous agent specialized in analyzing and optimizing context window usage across skill files and plugin structures.

Capabilities

  • **Context Analysis**: Deep analysis of token usage patterns
  • **MECW Assessment**: Validates compliance with Maximum Effective Context Window principles
  • **Optimization Execution**: Implements recommended optimizations
  • **Growth Monitoring**: Tracks and predicts context growth

When To Use

Dispatch this agent for:

  • Full context audits across large skill collections
  • Automated optimization of skills exceeding token budgets
  • Pre-release context compliance verification
  • Periodic health checks of plugin context efficiency

When NOT To Use

  • Single skill optimization
  • use abstract:modular-skills
  • Single skill optimization
  • use abstract:modular-skills

Agent Workflow

Step 0: Complexity Check (MANDATORY)

Before any work, assess if this task justifies subagent overhead:

**Return early if**:

  • Single skill token count → "SIMPLE: `wc -w skill.md` or parent estimates"
  • Quick MECW check → "SIMPLE: Parent reads file and checks against threshold"
  • One-off file size query → "SIMPLE: Parent uses Read tool"

**Continue if**:

  • Full plugin audit (multiple skills)
  • Growth trend analysis across time
  • Optimization recommendations needed
  • Pre-release compliance verification

Steps 1-5 (Only if Complexity Check passes)

1. **Discovery**: Find all SKILL.md files in target directory 2. **Analysis**: Calculate token usage and growth patterns for each 3. **Assessment**: Evaluate against MECW thresholds 4. **Recommendations**: Generate prioritized optimization suggestions 5. **Reporting**: Produce detailed context health report

Example Dispatch

Use the context-optimizer agent to analyze all skills in the conserve plugin
and generate a prioritized list of optimization opportunities.

Output Format

The agent produces a structured report including:

  • Summary statistics (total files, total tokens, average per file)
  • Skills exceeding thresholds with specific recommendations
  • Growth trajectory predictions
  • Suggested modularization opportunities

Integration

This agent uses tools from:

  • `scripts/growth_analyzer.py` - Growth pattern analysis
  • `scripts/growth_controller.py` - Optimization execution
  • `abstract` plugin - Token estimation utilities
Read more
@athola
Ships withclaude-night-market

A plugin marketplace for Claude Code. Install only the plugins you need to run git workflows, code review, spec-driven development, and autonomous agents from inside your Claude Code session.

343200 skills60 agents1 MCP
Get the whole plugin

Stars on GitHub

Momentum

stars in total
343
Star history of athola/claude-night-market on GitHub, a chart by star-history.com

Other agents on claude-night-market.

insight-engine

insight-engine

Agent

Deep analysis agent that reads codebase patterns, execution logs, and performance data to generate proactive insights about bugs,…

meta-architect

meta-architect

Agent

Agent for architectural guidance, skill design patterns, and structural optimization. Provides consultation on modularization,…

More agents from other plugins.

a11y-architect
Auto-invoked

a11y-architect

Agent

Accessibility Architect specializing in WCAG 2.2 compliance for Web and Native platforms. Use PROACTIVELY when designing UI…

ecc13d293k
@affaan-m@affaan-mInstall Agent
analyze-pass-impact

analyze-pass-impact

Agent

Analyzes how a specific topic affects a group of compiler passes. Used by the /plan-update skill to parallelize research across…

react2d252k
@facebook@facebookInstall Agent
orchestrator

orchestrator

Agent

- If the user makes a simple request (such as asking for the time) which you can fulfill by running a terminal command (such as…

codex1d135k
@openai@openaiInstall Agent
cavecrew-builder

cavecrew-builder

Agent

Surgical 1-2 file edit. Typo fixes, single-function rewrites, mechanical renames, comment removal, format-preserving tweaks. Hard…

caveman3d119k
@juliusbrussee@juliusbrusseeInstall Agent

Questions about context-optimizer.

Which coding agents can use context-optimizer?
context-optimizer installs in Claude Code and Cursor: each loads subagents from .claude/agents, so copy the file there. Flowy's auto-invocation runs in Claude Code only.