| name | progressive-loading |
| description | Standardized patterns for context-aware, progressive module loading that optimizes token usage and prevents context pressure. Implements hub-and-spoke architecture with dynamic module selection. |
| category | infrastructure |
| tags | progressive-disclosure, context-management, modularity, token-optimization, lazy-loading |
| dependencies | leyline:mecw-patterns |
| tools | mecw-monitor, context-tracker, module-selector |
| provides | [object Object] |
| usage_patterns | skill-optimization, context-aware-loading, dynamic-module-selection, token-budget-management |
| complexity | intermediate |
| estimated_tokens | 800 |
| progressive_loading | true |
| modules | modules/selection-strategies.md, modules/loading-patterns.md |
Progressive Loading Patterns
Overview
Progressive loading provides standardized patterns for building skills that load modules dynamically based on context, user intent, and available token budget. This prevents loading unnecessary content while ensuring required functionality is available when needed.
The core principle: Start minimal, expand intelligently, monitor continuously.
When to Use
Use progressive loading when building skills that:
- Cover multiple distinct workflows or domains
- Need to manage context window efficiently
- Have modules that are mutually exclusive based on context
- Require MECW compliance for long-running sessions
- Want to optimize for common paths while supporting edge cases
Quick Start
Basic Hub Pattern
## Progressive Loading
**Context A**: Load `modules/context-a-workflow.md` for scenario A
**Context B**: Load `modules/context-b-workflow.md` for scenario B
**Always Available**: Core utilities, exit criteria, integration points
Context-Based Selection
from leyline import ModuleSelector, MECWMonitor
selector = ModuleSelector(skill_path="my-skill/")
modules = selector.select_modules(
context={"intent": "git-catchup", "artifacts": ["git", "python"]},
max_tokens=MECWMonitor().get_safe_budget()
)
Hub-and-Spoke Architecture
Hub Responsibilities
- Context Detection: Identify user intent, artifacts, workflow type
- Module Selection: Choose which modules to load based on context
- Budget Management: Ensure MECW compliance before loading
- Integration Coordination: Provide integration points with other skills
- Exit Criteria: Define completion criteria across all paths
Spoke Characteristics
- Single Responsibility: Each module serves one workflow or domain
- Self-Contained: Modules don't depend on other modules
- Context-Tagged: Clear indicators of when module applies
- Token-Budgeted: Known token cost for selection decisions
- Independently Testable: Can be evaluated in isolation
Selection Strategies
See modules/selection-strategies.md for detailed strategies:
- Intent-based: Load based on detected user goals
- Artifact-based: Load based on detected files/systems
- Budget-aware: Load within available token budget
- Progressive: Load core first, expand as needed
- Mutually-exclusive: Load one path from multiple options
Loading Patterns
See modules/loading-patterns.md for implementation patterns:
- Conditional includes: Dynamic module references
- Lazy loading: Load on first use
- Tiered disclosure: Core → common → edge cases
- Context switching: Change loaded modules mid-session
- Preemptive unloading: Remove unused modules under pressure
Common Use Cases
- Multi-Domain Skills:
imbue:catchuploads git/docs/logs modules by context - Context-Heavy Analysis: Load relevant modules only, defer deep-dives, unload completed
- Plugin Infrastructure: Mix-and-match infrastructure modules with version checks
Best Practices
- Design Hub First: Define all possible contexts and module boundaries
- Tag Modules Clearly: Use YAML frontmatter to indicate context triggers
- Measure Token Cost: Know the cost of each module for selection
- Monitor Loading: Track which modules are actually used
- Validate Paths: Ensure all context paths have required modules
- Document Triggers: Make context detection logic transparent
Module References
- Selection Strategies: See
modules/selection-strategies.mdfor choosing modules - Loading Patterns: See
modules/loading-patterns.mdfor implementation techniques
Integration with Other Skills
This skill provides foundational patterns referenced by:
abstract:modular-skills- Uses progressive loading for skill designconservation:context-optimization- Uses for MECW-compliant loadingimbue:catchup- Uses for context-based module selection- Plugin authors building multi-workflow skills
Reference in your skill's frontmatter:
dependencies: [leyline:progressive-loading, leyline:mecw-patterns]
progressive_loading: true
Exit Criteria
- Hub clearly defines all module loading contexts
- Each module is tagged with activation context
- Module selection respects MECW constraints
- Token costs measured for all modules
- Context detection logic documented
- Loading paths validated for completeness