openclaw - 💡(How to fix) Fix [Feature] Path-specific skill loading (like Claude Code `paths:` frontmatter) [1 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#61436Fetched 2026-04-08 02:58:37
View on GitHub
Comments
0
Participants
1
Timeline
0
Reactions
0
Author
Participants

Code Example

---
name: python
description: Python coding standards and best practices
paths:
  - "**/*.py"
  - "**/requirements*.txt"
  - "**/pyproject.toml"
---

# Python coding guidelines...
RAW_BUFFERClick to expand / collapse

Problem

Currently, OpenClaw loads ALL skills on every request, consuming context tokens regardless of whether the skill is relevant to the current task. This wastes tokens and increases response times.

Proposed Solution

Add a paths: field to SKILL.md frontmatter (like Claude Code's implementation) that allows skills to specify file patterns. Skills with paths: are only loaded when the agent is working with matching files.

Example

---
name: python
description: Python coding standards and best practices
paths:
  - "**/*.py"
  - "**/requirements*.txt"
  - "**/pyproject.toml"
---

# Python coding guidelines...

Behavior

  • Skills WITHOUT paths:: Always loaded (backward compatible)
  • Skills WITH paths:: Only loaded when agent reads/modifies matching files
  • Glob patterns: Standard glob syntax (**/*.py, src/**/*.ts, etc.)

Benefits

BenefitImpact
Token savings50-80% reduction when working on specific file types
Faster context loadingFewer skills to parse on startup
Better organizationSkills can be domain-specific without overhead
Backward compatibleExisting skills without paths: work unchanged

Implementation Notes

  1. Glob matching: Use micromatch or similar (already used elsewhere in OpenClaw)
  2. File access tracking: Track which files agent reads/writes during session
  3. Skill eligibility check: At session start AND when new files accessed
  4. Hot reload: When skills watcher detects changes, recalculate eligible skills

Prior Art

Claude Code implements this feature:

Alternative Considered

Using skill description for heuristic matching (less precise, no file context).

Would you like to submit a PR?

Yes, I'm interested in contributing if the feature is approved. I can provide:

  1. Implementation for the path matching logic
  2. Tests for glob patterns and edge cases
  3. Migration guide for existing skills
  4. Documentation updates

Community Discussion: This would significantly reduce token usage for users with many skills installed. For example, a user with 20+ skills would only load Python-related skills when editing Python files.

extent analysis

TL;DR

Implement a paths: field in SKILL.md frontmatter to enable selective skill loading based on file patterns, reducing token consumption and response times.

Guidance

  • To implement this feature, use a glob matching library like micromatch to match file patterns specified in the paths: field.
  • Track file access during sessions to determine which skills are eligible for loading.
  • Perform skill eligibility checks at session start and when new files are accessed to ensure correct skill loading.
  • Consider implementing hot reload functionality to recalculate eligible skills when skill configurations change.

Example

---
name: python
description: Python coding standards and best practices
paths:
  - "**/*.py"
  - "**/requirements*.txt"
  - "**/pyproject.toml"
---

This example demonstrates how to specify file patterns for a Python skill using the paths: field.

Notes

The proposed solution is backward compatible, allowing skills without the paths: field to continue working unchanged. However, the implementation may require additional testing and validation to ensure correct behavior.

Recommendation

Apply the proposed workaround by implementing the paths: field and associated logic to enable selective skill loading, as it offers significant token savings and performance improvements.

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