mecw-patterns

- Core Principle: The 50% Rule

Safety Notice

This listing is imported from skills.sh public index metadata. Review upstream SKILL.md and repository scripts before running.

Copy this and send it to your AI assistant to learn

Install skill "mecw-patterns" with this command: npx skills add athola/claude-night-market/athola-claude-night-market-mecw-patterns

Table of Contents

  • Overview

  • When to Use

  • Core Principle: The 50% Rule

  • Pressure Levels

  • Quick Start

  • Basic Pressure Check

  • Full Compliance Check

  • Continuous Monitoring

  • Detailed Topics

  • Best Practices

  • Integration with Other Skills

  • Exit Criteria

MECW Patterns

Overview

Maximum 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.

When To Use

  • Need to prevent hallucinations in long-running sessions

  • Managing context-heavy workflows

  • Building systems that process large amounts of data

  • Want proactive context pressure monitoring

  • Require safe token budget calculation

When NOT To Use

  • Project doesn't use the leyline infrastructure patterns

  • Simple scripts without service architecture needs

Core Principle: The 50% Rule

Context pressure increases non-linearly as usage approaches limits. Exceeding 50% of context window significantly increases hallucination risk.

Pressure Levels

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

Quick Start

Basic Pressure Check

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.

Full Compliance Check

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.

Continuous Monitoring

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.

Detailed Topics

For detailed implementation patterns:

  • MECW Theory - Theoretical foundations, research basis, thresholds

  • Monitoring Patterns - Integration patterns, quota management, token estimation

  • Prevention Strategies - Early detection, compression, delegation, progressive disclosure

Best Practices

  • Plan for 40%: Design workflows to use ~40% of context, leaving buffer

  • Buffer for Response: Leave 50% for model reasoning + response generation

  • Monitor Continuously: Check context at each major step

  • Fail Fast: Abort and restructure when approaching limits

  • Document Aggressively: Keep summaries for context recovery after reset

Integration with Other Skills

This skill provides foundational utilities referenced by:

  • conserve:context-optimization

  • Uses MECW for optimization decisions

  • conjure:delegation-core

  • Uses MECW for delegation triggers

  • Plugin authors building context-aware systems

Reference in your skill's frontmatter:

dependencies: [leyline:mecw-patterns]

Verification: Run the command with --help flag to verify availability.

Exit Criteria

  • Context pressure monitored before major operations

  • MECW compliance checked when loading large content

  • Safe budget calculated before batch operations

  • Recommendations followed when warnings issued

  • Context reset triggered before CRITICAL threshold

Troubleshooting

Common Issues

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

Source Transparency

This detail page is rendered from real SKILL.md content. Trust labels are metadata-based hints, not a safety guarantee.

Related Skills

Related by shared tags or category signals.

General

project-planning

No summary provided by upstream source.

Repository SourceNeeds Review
General

project-brainstorming

No summary provided by upstream source.

Repository SourceNeeds Review
General

doc-generator

No summary provided by upstream source.

Repository SourceNeeds Review
General

project-specification

No summary provided by upstream source.

Repository SourceNeeds Review