claude-code-plugin-ref…
Explain plugin, skill, command, agent, and hook mechanics used here. Use when authoring or debugging plugins. Do not use for ops; use night-market-operations.
Optimizes context window via MECW principles and memory tiering. Use when context exceeds 30% or before long multi-step tasks.
$ npx -y skills add athola/claude-night-market --skill context-optimization --agent claude-codeHow it fires
How this skill gets triggered: by you, by Claude, or both.
/context-optimizationContext preview
The summary Claude sees to decide when to auto-load this skill.
Optimizes context window via MECW principles and memory tiering. Use when context exceeds 30% or before long multi-step tasks.
name: context-optimization
description: Optimizes context window via MECW principles and memory tiering. Use when context exceeds 30% or before long multi-step tasks.
alwaysApply: false
category: conservation
token_budget: 150
progressive_loading: true
modules:
- modules/context-waiting.md
- modules/findings-format.md
- modules/mecw-assessment.md
- modules/mecw-principles.md
- modules/memory-tiers.md
- modules/session-routing.md
- modules/subagent-coordination.md
- modules/belief-clarity.md
- modules/cache-aligned-prefixes.md
hooks:
PreToolUse:
- matcher: Read
command: 'echo "[skill:context-optimization] 📊 Context analysis started: $(date)"
>> ${CLAUDE_CODE_TMPDIR:-/tmp}/skill-audit.log
'
once: true
PostToolUse:
- matcher: Bash
command: "# Track context analysis tools\nif jq -r '.tool_input.command // empty' | grep\
\ -qE \"(wc|tokei|cloc|context)\"; then\n echo \"[skill:context-optimization]\
\ Context measurement executed: $(date)\" >> ${CLAUDE_CODE_TMPDIR:-/tmp}/skill-audit.log\n\
fi\n"
Stop:
- command: 'echo "[skill:context-optimization] === Optimization completed at $(date)
===" >> ${CLAUDE_CODE_TMPDIR:-/tmp}/skill-audit.log
# Could export: context pressure events over time
'
model_hint: standard
role: hook-target1. 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.
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"]| Utilization | Status | Action | |-------------|--------|--------| | < 30% | LOW | Continue normally | | 30-50% | MODERATE | Monitor, apply principles | | > 50% | CRITICAL | Immediate optimization required |
**Behavior Change**: Large bash command and tool outputs are saved to disk instead of being truncated; file references are provided for access.
| 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 |
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.
against `modules/cache-aligned-prefixes.md` (stable first, volatile last)
(cache writes cost more than they save on non-repeated prefixes)
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.
Explain plugin, skill, command, agent, and hook mechanics used here. Use when authoring or debugging plugins. Do not use for ops; use night-market-operations.
States load-bearing decisions, invariants, and weak points. Use when judging a design change. Do not use for gating; use night-market-change-control.
Rebuild the dev environment: uv, Python tiers, pins, traps. Use when onboarding or toolchain breaks. Do not use for daily commands; use night-market-operations.
Classify, gate, and review changes. Use when landing a PR, releasing, or amending rules. Do not use for failure triage; use night-market-debugging-playbook.
Search and record project memory (Discussions, journal, ADRs). Use before re-investigating anything. Do not use for settled battles; see failure-archaeology.
Bind loop 'done' to unfakeable gates. Use to harden egregore/herald loops or promote completion_integrity. Not for QA gates; use night-market-validation-and-qa.