技能設定變數
這是什麼
技能可以宣告的具名設定值,用於安全設定和重複使用。
白話解釋
一張寫著「鹽適量」的食譜卡片並非毫無緣由地含糊其辭:它命名了變數,並將確切用量留給做菜的人,這樣同一份食譜無論在小公寓廚房還是餐廳廚房都能使用。技能的設定變數也是如此:SKILL.md 中命名但從不寫死的值,讓同一份技能檔案無論在你的筆記型電腦還是租用伺服器上都能正確運作。
為什麼重要
與其將 API 端點、預設頻道或開關直接寫死在 SKILL.md 中,技能可以將其宣告為具名設定變數,因部署環境而異。agent/skill_utils.py 在探索過程中提取這些變數,這正是讓一個技能不需修改檔案本身就能在 VPS 安裝和本機桌面安裝之間移植的原因。它們也是漸進式揭露所依賴的實際基礎,因為設定變數可以決定某個技能的整個可選章節是否適用。
How it works
A skill declares config variables under metadata.hermes.config in its YAML header, each with a key, description, optional default, and optional setup prompt. agent/skill_utils.py’s extract_skill_config_vars reads these declarations during discovery, and resolve_skill_config_values looks up the current value for each key under skills.config.
A concrete example
A skill for archiving old photos declares a config variable named photos.archive_path in its frontmatter, with a default of ~/Pictures/archive. On your desktop, running the config setup notices the variable and prompts for a value; on a VPS where a different path is appropriate, the same skill reads the different config value without the skill file itself changing at all.