- [Overview](#overview)
/plugin marketplace add athola/claude-night-market/plugin install leyline@claude-night-marketThis skill inherits all available tools. When active, it can use any tool Claude has access to.
README.mdmodules/mecw-theory.mdmodules/monitoring-patterns.mdmodules/prevention-strategies.mdMaximum Effective Context Window (MECW) patterns provide the theoretical foundations and practical utilities for managing context window usage to prevent hallucinations. The core principle: Never use more than 50% of total context window for input content.
Context pressure increases non-linearly as usage approaches limits. Exceeding 50% of context window significantly increases hallucination risk.
| Level | Usage | Effect | Action |
|---|---|---|---|
| LOW | <30% | Optimal performance, high accuracy | Continue normally |
| MODERATE | 30-50% | Good performance, within MECW | Monitor closely |
| HIGH | 50-70% | Degraded performance, risk zone | Optimize immediately |
| CRITICAL | >70% | Severe degradation, high hallucination | Reset context |
from leyline import calculate_context_pressure
pressure = calculate_context_pressure(
current_tokens=80000,
max_tokens=200000
)
print(pressure) # "MODERATE"
Verification: Run the command with --help flag to verify availability.
from leyline import check_mecw_compliance
result = check_mecw_compliance(
current_tokens=120000,
max_tokens=200000
)
if not result['compliant']:
print(f"Overage: {result['overage']:,} tokens")
print(f"Action: {result['action']}")
Verification: Run the command with --help flag to verify availability.
from leyline import MECWMonitor
monitor = MECWMonitor(max_context=200000)
# Track usage throughout session
monitor.track_usage(80000)
status = monitor.get_status()
if status.warnings:
for warning in status.warnings:
print(f"[WARN] {warning}")
if status.recommendations:
print("\nRecommended actions:")
for rec in status.recommendations:
print(f" • {rec}")
Verification: Run the command with --help flag to verify availability.
For detailed implementation patterns:
This skill provides foundational utilities referenced by:
conserve:context-optimization - Uses MECW for optimization decisionsconjure:delegation-core - Uses MECW for delegation triggersReference in your skill's frontmatter:
dependencies: [leyline:mecw-patterns]
Verification: Run the command with --help flag to verify availability.
Command not found Ensure all dependencies are installed and in PATH
Permission errors Check file permissions and run with appropriate privileges
Unexpected behavior
Enable verbose logging with --verbose flag