skills/progressive-loading/SKILL.md
Load skills only when needed to keep context window lean. Adapted from DeerFlow's progressive loading philosophy.
npx skillsauth add 0x-wzw/OpenClaw_deployer_for_dummies progressive-loadingInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Load skills only when needed, not all at startup
Adapted from DeerFlow's context optimization philosophy
Instead of loading all skills at session start, progressively load them:
Session Start
↓
Load Skill Index Only (compact)
↓
User Request: "use security-scanner"
↓
Lazy Load: Fetch full skill → Execute → Keep in cache
↓
[Optional] Unload after TTL expires
{
"skills": {
"loadingMode": "progressive",
"indexOnlyAtStartup": true,
"cacheTTL": 3600,
"maxCachedSkills": 10
}
}
class ProgressiveSkillLoader:
"""Load skills on-demand to optimize context window."""
def __init__(self, skills_dir: str):
self.skills_dir = Path(skills_dir)
self.index = self._load_index_only()
self.cache = {} # Loaded skills
self.last_used = {} # LRU tracking
def _load_index_only(self) -> Dict[str, SkillIndex]:
"""Load only skill metadata, not full content."""
index = {}
for skill_dir in self.skills_dir.iterdir():
if skill_dir.is_dir():
# Load only metadata from SKILL.md header
metadata = self._parse_metadata(skill_dir / "SKILL.md")
index[metadata.name] = SkillIndex(
name=metadata.name,
description=metadata.description,
keywords=metadata.keywords,
triggers=metadata.triggers,
size=metadata.size,
path=skill_dir
)
return index
def get_skill(self, name: str) -> Optional[Skill]:
"""Lazy load skill on demand."""
# Check cache first
if name in self.cache:
self.last_used[name] = time.time()
return self.cache[name]
# Load from index
if name not in self.index:
return None
# Enforce max cache size (LRU eviction)
if len(self.cache) >= self.max_cached:
self._evict_lru()
# Load full skill
skill = self._load_full_skill(self.index[name])
self.cache[name] = skill
self.last_used[name] = time.time()
return skill
def _evict_lru(self):
"""Remove least recently used skill from cache."""
if not self.last_used:
return
lru_name = min(self.last_used, key=self.last_used.get)
del self.cache[lru_name]
del self.last_used[lru_name]
log(f"Evicted skill from cache: {lru_name}")
| Metric | Before (Load All) | After (Progressive) | Improvement | |--------|-------------------|---------------------|-------------| | Startup Time | 5-10s | 0.5-1s | 5-10x faster | | Context Window | 50-80% full | 10-20% full | 70% reduction | | Memory Usage | High | Low | Significant | | Skill Access | Immediate | ~50ms first load | Negligible |
# Before: Load all skills
skills = load_all_skills()
# After: Progressive loading
skill_loader = ProgressiveSkillLoader("~/.openclaw/skills")
index = skill_loader.get_index() # Only metadata
# When skill needed
skill = skill_loader.get_skill("security-scanner")
Skills can define triggers:
# In SKILL.md
metadata:
triggers:
- keywords: ["security", "scan", "vulnerability"]
- file_patterns: ["*.env", "*.key"]
- commands: ["/security"]
Auto-load when triggered:
if any(trigger.matches(input) for trigger in skill.triggers):
skill = loader.get_skill(skill.name)
return skill.execute(input)
| Aspect | DeerFlow | Swarm Progressive Loading | |--------|----------|---------------------------| | Index at startup | Yes | Yes | | Full skill on demand | Yes | Yes | | LRU eviction | Yes | Yes | | Max cache size | Configurable | Configurable | | Integration | LangGraph | Swarm Protocol | | Economic | N/A | Token economy aware |
Progressive skill loading for context window optimization Adapted from DeerFlow's lazy loading philosophy
tools
Complete data isolation per deployment/tenant. Multiple swarms can coexist without data leakage. Adapted from Paperclip's isolation principle.
tools
Model Context Protocol (MCP) server integration for standardized tool extensibility. Adapted from DeerFlow's MCP ecosystem.
tools
Refined heartbeat scheduling with cleaner intervals, atomic task checkout, and goal ancestry tracking. Adapted from Paperclip's heartbeat principle.
tools
Approval gates with versioned configuration changes and safe rollback. Adapted from Paperclip's governance principle.