openclaw - 💡(How to fix) Fix [Feature Request] Skill Graph - 按需加载依赖链,减少 Token 消耗 [1 comments, 2 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
openclaw/openclaw#74100Fetched 2026-04-30 06:28:27
View on GitHub
Comments
1
Participants
2
Timeline
5
Reactions
0
Timeline (top)
cross-referenced ×3commented ×1subscribed ×1
RAW_BUFFERClick to expand / collapse

[Feature Request] Skill Graph - 按需加载依赖链,减少 Token 消耗

背景

当前 OpenClaw 启动时加载所有技能定义,导致大量 token 消耗。许多任务只需要 1-2 层 skill 调用,但系统会预加载全部。

需求:Skill Graph 依赖按需加载

方案

构建 skill 之间的依赖图谱,执行时按需展开:

``` 用户请求 ↓ 加载 L1 Skill(如 supply-kitting-analysis) ↓ 发现依赖 L2 Skills(如 inventory-query, po-check) ↓ 按需加载 L2 → 发现依赖 L3 → 加载 L3 ```

期望功能

  1. 自动解析依赖 - 解析 skill 中的 sessions_spawn / 子 skill 引用,生成依赖图
  2. 动态展开 - 执行时只加载需要的依赖层(默认 L1+L2,可配置)
  3. 可视化 - openclaw skills graph --dot 输出依赖关系图
  4. 配置项 - openclaw config set skills.maxDepth=2

价值

  • 减少 50-70% token 消耗
  • 支持更复杂的技能编排
  • 按实际使用加载,避免无关 skill 污染上下文

相关

  • Obsidian skill-graph 插件展示了可视化 skill 结构的想法
  • 类似 Claude Code 的 tool 懒加载机制

extent analysis

TL;DR

Implement a lazy loading mechanism for skill dependencies to reduce token consumption by only loading necessary skills on demand.

Guidance

  • Construct a dependency graph between skills to determine the required skills for a given task
  • Implement a dynamic loading mechanism that loads skills only when their dependencies are needed
  • Introduce a configuration option (e.g., skills.maxDepth) to control the maximum depth of skill loading
  • Consider visualizing the skill dependency graph to better understand the relationships between skills

Example

# Simplified example of a skill dependency graph
skill_graph = {
    'L1': ['L2-1', 'L2-2'],
    'L2-1': ['L3-1'],
    'L2-2': ['L3-2']
}

def load_skills(skill_name, max_depth):
    # Load the skill and its dependencies up to the specified depth
    loaded_skills = []
    to_load = [skill_name]
    for _ in range(max_depth):
        next_to_load = []
        for skill in to_load:
            loaded_skills.append(skill)
            if skill in skill_graph:
                next_to_load.extend(skill_graph[skill])
        to_load = next_to_load
    return loaded_skills

# Load skills up to a maximum depth of 2
loaded_skills = load_skills('L1', 2)
print(loaded_skills)  # Output: ['L1', 'L2-1', 'L2-2']

Notes

The proposed solution assumes that the skill dependencies can be represented as a graph and that the dependencies are deterministic. The actual implementation may require additional considerations, such as handling cyclic dependencies or skills with multiple dependencies.

Recommendation

Apply a workaround by implementing a lazy loading mechanism for skill dependencies, as this approach is likely to reduce token consumption and improve system performance.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

openclaw - 💡(How to fix) Fix [Feature Request] Skill Graph - 按需加载依赖链,减少 Token 消耗 [1 comments, 2 participants]