progressive-loading
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseTable of Contents
目录
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.
渐进式加载提供了标准化模式,用于构建可根据上下文、用户意图和可用token预算动态加载模块的skill。该方案可避免加载不必要的内容,同时确保需要时可用到所需功能。
核心理念:最小启动、智能扩展、持续监控
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
当构建的skill符合以下特征时可使用渐进式加载:
- 覆盖多个不同的工作流或领域
- 需要高效管理上下文窗口
- 存在根据上下文互斥使用的模块
- 长时间运行的会话需要符合MECW规范
- 希望针对常用路径做优化,同时支持边缘场景
When NOT To Use
不适用场景
- Project doesn't use the leyline infrastructure patterns
- Simple scripts without service architecture needs
- 项目未使用leyline基础设施模式
- 没有服务架构需求的简单脚本
Quick Start
快速开始
Basic Hub Pattern
基础中心模式
markdown
undefinedmarkdown
undefinedProgressive Loading
Progressive Loading
Context A: Load for scenario A
Context B: Load for scenario B
modules/loading-patterns.mdmodules/selection-strategies.mdAlways Available: Core utilities, exit criteria, integration points
**Verification:** Run the command with `--help` flag to verify availability.Context A: Load for scenario A
Context B: Load for scenario B
modules/loading-patterns.mdmodules/selection-strategies.mdAlways Available: Core utilities, exit criteria, integration points
**验证方式:** 执行带`--help`参数的命令验证可用性。Context-Based Selection
基于上下文的选择
python
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()
)Verification: Run the command with flag to verify availability.
--helppython
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()
)验证方式: 执行带参数的命令验证可用性。
--helpHub-and-Spoke Architecture
Hub-and-Spoke架构
Hub Responsibilities
中心职责
- Context Detection: Identify user intent, artifacts, workflow type
- Module Selection: Choose which modules to load based on context
- Budget Management: Verify MECW compliance before loading
- Integration Coordination: Provide integration points with other skills
- Exit Criteria: Define completion criteria across all paths
- 上下文检测:识别用户意图、产物、工作流类型
- 模块选择:根据上下文选择要加载的模块
- 预算管理:加载前校验是否符合MECW规范
- 集成协调:提供与其他skill的集成点
- 退出标准:定义所有路径的完成标准
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
- 单一职责:每个模块仅服务一个工作流或领域
- 自包含:模块不依赖其他模块
- 上下文标记:清晰标注模块的适用场景
- token预算明确:已知模块的token消耗,用于选择决策
- 可独立测试:可单独进行评估验证
Selection Strategies
选择策略
See for detailed strategies:
modules/selection-strategies.md- 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
查看了解详细策略:
modules/selection-strategies.md- 基于意图:根据检测到的用户目标加载
- 基于产物:根据检测到的文件/系统加载
- 预算感知:在可用token预算范围内加载
- 渐进式:先加载核心模块,按需扩展
- 互斥选择:从多个选项中加载一条路径
Loading Patterns
加载模式
See for implementation patterns:
modules/loading-patterns.md- 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
查看了解实现模式:
modules/loading-patterns.md- 条件引入:动态模块引用
- Lazy loading:首次使用时加载
- 分层披露:核心→通用→边缘场景
- 上下文切换:会话中更换已加载模块
- 预卸载:资源压力下移除未使用的模块
Common Use Cases
常见用例
- Multi-Domain Skills: loads git/docs/logs modules by context
imbue:catchup - Context-Heavy Analysis: Load relevant modules only, defer deep-dives, unload completed
- Plugin Infrastructure: Mix-and-match infrastructure modules with version checks
- 多领域Skill:根据上下文加载git/docs/logs模块
imbue:catchup - 重上下文分析:仅加载相关模块,推迟深度分析,卸载已完成任务的模块
- 插件基础设施:可组合基础设施模块,附带版本校验
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: Verify all context paths have required modules
- Document Triggers: Make context detection logic transparent
- 优先设计中心层:定义所有可能的上下文和模块边界
- 清晰标记模块:使用YAML frontmatter标注上下文触发条件
- 测量token消耗:明确每个模块的成本,用于选择决策
- 监控加载情况:跟踪实际被使用的模块
- 路径校验:验证所有上下文路径都有对应的必需模块
- 文档化触发规则:上下文检测逻辑透明可查
Module References
模块参考
- Selection Strategies: See for choosing modules
modules/selection-strategies.md - Loading Patterns: See for implementation techniques
modules/loading-patterns.md - Performance Budgeting: See for token budget model and optimization workflow
modules/performance-budgeting.md
- 选择策略:查看了解模块选择方法
modules/selection-strategies.md - 加载模式:查看了解实现技术
modules/loading-patterns.md - 性能预算:查看了解token预算模型和优化工作流
modules/performance-budgeting.md
Integration with Other Skills
与其他Skill的集成
This skill provides foundational patterns referenced by:
- - Uses progressive loading for skill design
abstract:modular-skills - - Uses for MECW-compliant loading
conserve:context-optimization - - Uses for context-based module selection
imbue:catchup - Plugin authors building multi-workflow skills
Reference in your skill's frontmatter:
yaml
dependencies: [leyline:progressive-loading, leyline:mecw-patterns]
progressive_loading: trueVerification: Run the command with flag to verify availability.
--help本skill提供的基础模式被以下能力引用:
- - 采用渐进式加载做skill设计
abstract:modular-skills - - 用于符合MECW规范的加载
conserve:context-optimization - - 用于基于上下文的模块选择
imbue:catchup - 构建多工作流skill的插件开发者
在你的skill的frontmatter中引用:
yaml
dependencies: [leyline:progressive-loading, leyline:mecw-patterns]
progressive_loading: true验证方式: 执行带参数的命令验证可用性。
--helpExit 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
- 中心层明确定义所有模块加载上下文
- 每个模块都标注了激活上下文
- 模块选择符合MECW约束
- 所有模块的token成本已测量
- 上下文检测逻辑已文档化
- 加载路径完整性已验证
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 flag
--verbose命令未找到
确保所有依赖已安装且在PATH中
权限错误
检查文件权限,使用合适的权限执行
异常行为
添加参数开启详细日志排查
--verbose