The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(skills): ${HERMES_PYTHON} is the interpreter pm selected for Hermes's environment
alt-glitchba6d0e8817c8
diff --git a/agent/skill_preprocessing.py b/agent/skill_preprocessing.pyindex 35a9e574d58..2f14f3fe40c 100644--- a/agent/skill_preprocessing.py+++ b/agent/skill_preprocessing.py@@ -4,7 +4,6 @@ inline ``!`cmd``` shell expansion."""import loggingimport reimport subprocess-import sysfrom pathlib import Pathfrom agent.compression_marker import elide@@ -33,6 +32,14 @@ def load_skills_config() -> dict:return {}+def _project_python() -> str | None:+ from pm.environments import project_python+ from pm.paths import repo_root++ python = project_python(repo_root())+ return str(python) if python.is_file() else None++def substitute_template_vars(content: str, skill_dir: Path | None, session_id: str | None) -> str:"""Replace ${HERMES_SKILL_DIR} / ${HERMES_SESSION_ID}; tokens without a value stay in place."""if not content:@@ -40,7 +47,7 @@ def substitute_template_vars(content: str, skill_dir: Path | None, session_id: svalues = {"HERMES_SKILL_DIR": str(skill_dir) if skill_dir else None,"HERMES_SESSION_ID": str(session_id) if session_id else None,- "HERMES_PYTHON": sys.executable or None,+ "HERMES_PYTHON": _project_python() if "${HERMES_PYTHON}" in content else None,}return _SKILL_TEMPLATE_RE.sub(lambda m: values[m.group(1)] or m.group(0), content)diff --git a/website/docs/developer-guide/creating-skills.md b/website/docs/developer-guide/creating-skills.mdindex 6a6dff0cdc1..3da80fb1d67 100644--- a/website/docs/developer-guide/creating-skills.md+++ b/website/docs/developer-guide/creating-skills.md@@ -289,7 +289,7 @@ When a skill is loaded, the activation message exposes the absolute skill direct|---|---|| `${HERMES_SKILL_DIR}` | Absolute path to the skill's directory || `${HERMES_SESSION_ID}` | The active session id (left in place if there is no session) |-| `${HERMES_PYTHON}` | Absolute path to the Python interpreter running Hermes |+| `${HERMES_PYTHON}` | Absolute path to the interpreter of Hermes's own dependency environment, as the package manager selected it (it has Hermes's code and dependencies importable) |So a SKILL.md can tell the agent to run a bundled script directly with:diff --git a/website/i18n/zh-Hans/docusaurus-plugin-content-docs/current/developer-guide/creating-skills.md b/website/i18n/zh-Hans/docusaurus-plugin-content-docs/current/developer-guide/creating-skills.mdindex fcc0fed2f4d..20ee3d2adef 100644--- a/website/i18n/zh-Hans/docusaurus-plugin-content-docs/current/developer-guide/creating-skills.md+++ b/website/i18n/zh-Hans/docusaurus-plugin-content-docs/current/developer-guide/creating-skills.md@@ -284,7 +284,7 @@ Skill 加载时,激活消息会将 skill 目录的绝对路径以 `[Skill dire|---|---|| `${HERMES_SKILL_DIR}` | skill 目录的绝对路径 || `${HERMES_SESSION_ID}` | 当前会话 ID(若无会话则保留原样) |-| `${HERMES_PYTHON}` | 运行 Hermes 的 Python 解释器的绝对路径 |+| `${HERMES_PYTHON}` | 包管理器为 Hermes 自身依赖环境选定的 Python 解释器的绝对路径(可导入 Hermes 的代码和依赖) |因此,SKILL.md 可以直接告知 agent 运行内置脚本: