技能

技能探索

尋找 SKILL.md 檔案、讀取 frontmatter,並按平台過濾的源頭流程。

技能探索

這是什麼

尋找 SKILL.md 檔案、讀取 frontmatter,並按平台過濾的源頭流程。

白話解釋

想像一份只會對符合條件的人才顯示的職缺——標示「僅限芝加哥」的職位不會出現在邁阿密求職者的搜尋結果中。技能探索就是 Hermes 對所有儲存的技能檔案執行同樣的過濾:讀取其宣告的需求,然後決定此刻在這台特定機器上,該技能是否應該出現在 agent 面前。

為什麼重要

在分散於內建、選用和插件來源的 175 個技能中的任何一個能被使用之前,agent/skill_utils.py 必須遍歷原始碼樹、讀取每個 SKILL.md 的 frontmatter,並將結果過濾到當前對話實際運行的平台上。這個過濾步驟確保 agent 不會收到針對它未連接的平台所設計的指令。格式錯誤的 frontmatter 區塊往往會讓技能在這個過程中默默消失,而不是大聲報錯。

How it works

agent/skill_utils.py walks the local skills directory first, then any external directories set in config.yaml, using iter_skill_index_files — an os.walk that skips VCS, cache, and dependency folders along with progressive-disclosure support folders like references/ and scripts/, so only genuine skill roots get scanned. For every SKILL.md found, parse_frontmatter reads its YAML header. skill_matches_platform_list then compares a declared platforms list against the current operating system (with special handling so Termux/Android still matches skills tagged linux), and skill_matches_environment checks tags like kanban or docker against what’s actually detected as running. A skill with no platforms or environments field passes both checks automatically.

A concrete example

You install Hermes on a Windows laptop, and a friend’s old iMessage-automation skill ends up copied into your skills folder too. Because that SKILL.md declares platforms: [macos] in its frontmatter, skill_matches_platform_list filters it out when the agent starts up on Windows — the skill stays in the folder but never appears in the agent’s available list, preventing a confusing ‘why can’t Hermes send iMessages’ failure on a platform that can’t run the required tools.