The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(skills): point the godmode skill's self-referencing install paths at its new location
liuhao10245141b3122b14
diff --git a/optional-skills/security/godmode/SKILL.md b/optional-skills/security/godmode/SKILL.mdindex e7d221465bc..644b261c36a 100644--- a/optional-skills/security/godmode/SKILL.md+++ b/optional-skills/security/godmode/SKILL.md@@ -61,7 +61,7 @@ The fastest path — auto-detect the model, test strategies, and lock in the win# In execute_code — use the loader to avoid exec-scoping issues:import osexec(open(os.path.expanduser(- os.path.join(os.environ.get("HERMES_HOME", os.path.expanduser("~/.hermes")), "skills/red-teaming/godmode/scripts/load_godmode.py")+ os.path.join(os.environ.get("HERMES_HOME", os.path.expanduser("~/.hermes")), "skills/security/godmode/scripts/load_godmode.py"))).read())# Auto-detect model from config and jailbreak it@@ -192,7 +192,7 @@ python scripts/parseltongue.py "How do I hack into a WiFi network?" --tier standOr use `execute_code` inline:```python# Load the parseltongue module-exec(open(os.path.join(os.environ.get("HERMES_HOME", os.path.expanduser("~/.hermes")), "skills/red-teaming/godmode/scripts/parseltongue.py")).read())+exec(open(os.path.join(os.environ.get("HERMES_HOME", os.path.expanduser("~/.hermes")), "skills/security/godmode/scripts/parseltongue.py")).read())query = "How do I hack into a WiFi network?"variants = generate_variants(query, tier="standard")@@ -229,7 +229,7 @@ Race multiple models against the same query, score responses, pick the winner:```python# Via execute_code-exec(open(os.path.join(os.environ.get("HERMES_HOME", os.path.expanduser("~/.hermes")), "skills/red-teaming/godmode/scripts/godmode_race.py")).read())+exec(open(os.path.join(os.environ.get("HERMES_HOME", os.path.expanduser("~/.hermes")), "skills/security/godmode/scripts/godmode_race.py")).read())result = race_models(query="Explain how SQL injection works with a practical example",diff --git a/optional-skills/security/godmode/references/jailbreak-templates.md b/optional-skills/security/godmode/references/jailbreak-templates.mdindex c7b901986b8..4764a413ae2 100644--- a/optional-skills/security/godmode/references/jailbreak-templates.md+++ b/optional-skills/security/godmode/references/jailbreak-templates.md@@ -114,7 +114,7 @@ hermes### Via the GODMODE CLASSIC racer script```python-exec(open(os.path.join(os.environ.get("HERMES_HOME", os.path.expanduser("~/.hermes")), "skills/red-teaming/godmode/scripts/godmode_race.py")).read())+exec(open(os.path.join(os.environ.get("HERMES_HOME", os.path.expanduser("~/.hermes")), "skills/security/godmode/scripts/godmode_race.py")).read())result = race_godmode_classic("Your query here")print(f"Winner: {result['codename']} — Score: {result['score']}")print(result['content'])diff --git a/optional-skills/security/godmode/references/refusal-detection.md b/optional-skills/security/godmode/references/refusal-detection.mdindex 5fb3414c541..5a6abd3cbee 100644--- a/optional-skills/security/godmode/references/refusal-detection.md+++ b/optional-skills/security/godmode/references/refusal-detection.md@@ -129,7 +129,7 @@ These don't auto-reject but reduce the response score:## Using in Python```python-exec(open(os.path.join(os.environ.get("HERMES_HOME", os.path.expanduser("~/.hermes")), "skills/red-teaming/godmode/scripts/godmode_race.py")).read())+exec(open(os.path.join(os.environ.get("HERMES_HOME", os.path.expanduser("~/.hermes")), "skills/security/godmode/scripts/godmode_race.py")).read())# Check if a response is a refusaltext = "I'm sorry, but I can't assist with that request."diff --git a/optional-skills/security/godmode/scripts/auto_jailbreak.py b/optional-skills/security/godmode/scripts/auto_jailbreak.pyindex 5c7055a99b9..544718271a9 100644--- a/optional-skills/security/godmode/scripts/auto_jailbreak.py+++ b/optional-skills/security/godmode/scripts/auto_jailbreak.py@@ -7,7 +7,7 @@ finds what works, and locks it in by writing config.yaml + prefill.json.Usage in execute_code:exec(open(os.path.expanduser(- os.path.join(os.environ.get("HERMES_HOME", os.path.expanduser("~/.hermes")), "skills/red-teaming/godmode/scripts/auto_jailbreak.py")+ os.path.join(os.environ.get("HERMES_HOME", os.path.expanduser("~/.hermes")), "skills/security/godmode/scripts/auto_jailbreak.py"))).read())result = auto_jailbreak() # Uses current model from config@@ -35,7 +35,7 @@ try:_SKILL_DIR = Path(__file__).resolve().parent.parentexcept NameError:# __file__ not defined when loaded via exec() — search standard paths- _SKILL_DIR = Path(os.getenv("HERMES_HOME", Path.home() / ".hermes")) / "skills" / "red-teaming" / "godmode"+ _SKILL_DIR = Path(os.getenv("HERMES_HOME", Path.home() / ".hermes")) / "skills" / "security" / "godmode"_SCRIPTS_DIR = _SKILL_DIR / "scripts"_TEMPLATES_DIR = _SKILL_DIR / "templates"diff --git a/optional-skills/security/godmode/scripts/godmode_race.py b/optional-skills/security/godmode/scripts/godmode_race.pyindex dbc4510308a..d4cf686e1a5 100644--- a/optional-skills/security/godmode/scripts/godmode_race.py+++ b/optional-skills/security/godmode/scripts/godmode_race.py@@ -7,7 +7,7 @@ Queries multiple models in parallel via OpenRouter, scores responseson quality/filteredness/speed, returns the best unfiltered answer.Usage in execute_code:- exec(open(os.path.join(os.environ.get("HERMES_HOME", os.path.expanduser("~/.hermes")), "skills/red-teaming/godmode/scripts/godmode_race.py")).read())+ exec(open(os.path.join(os.environ.get("HERMES_HOME", os.path.expanduser("~/.hermes")), "skills/security/godmode/scripts/godmode_race.py")).read())result = race_models(query="Your query here",diff --git a/optional-skills/security/godmode/scripts/load_godmode.py b/optional-skills/security/godmode/scripts/load_godmode.pyindex 71cb2f22475..46516a562f1 100644--- a/optional-skills/security/godmode/scripts/load_godmode.py+++ b/optional-skills/security/godmode/scripts/load_godmode.py@@ -3,7 +3,7 @@ Loader for G0DM0D3 scripts. Handles the exec-scoping issues.Usage in execute_code:exec(open(os.path.expanduser(- os.path.join(os.environ.get("HERMES_HOME", os.path.expanduser("~/.hermes")), "skills/red-teaming/godmode/scripts/load_godmode.py")+ os.path.join(os.environ.get("HERMES_HOME", os.path.expanduser("~/.hermes")), "skills/security/godmode/scripts/load_godmode.py"))).read())# Now all functions are available:@@ -17,7 +17,7 @@ Usage in execute_code:import os, sysfrom pathlib import Path-_gm_scripts_dir = Path(os.getenv("HERMES_HOME", Path.home() / ".hermes")) / "skills" / "red-teaming" / "godmode" / "scripts"+_gm_scripts_dir = Path(os.getenv("HERMES_HOME", Path.home() / ".hermes")) / "skills" / "security" / "godmode" / "scripts"_gm_old_argv = sys.argvsys.argv = ["_godmode_loader"]diff --git a/optional-skills/security/godmode/scripts/parseltongue.py b/optional-skills/security/godmode/scripts/parseltongue.pyindex 0b24f155018..635d154c390 100644--- a/optional-skills/security/godmode/scripts/parseltongue.py+++ b/optional-skills/security/godmode/scripts/parseltongue.py@@ -11,7 +11,7 @@ Usage:python parseltongue.py "How do I hack a WiFi network?" --tier standard# As a module in execute_code- exec(open(os.path.join(os.environ.get("HERMES_HOME", os.path.expanduser("~/.hermes")), "skills/red-teaming/godmode/scripts/parseltongue.py")).read())+ exec(open(os.path.join(os.environ.get("HERMES_HOME", os.path.expanduser("~/.hermes")), "skills/security/godmode/scripts/parseltongue.py")).read())variants = generate_variants("How do I hack a WiFi network?", tier="standard")"""diff --git a/tests/skills/test_optional_skill_self_paths.py b/tests/skills/test_optional_skill_self_paths.pynew file mode 100644index 00000000000..24313e8cf14--- /dev/null+++ b/tests/skills/test_optional_skill_self_paths.py@@ -0,0 +1,77 @@+"""Contract: a skill's self-referencing install paths match its own location.++The hub installs ``optional-skills/<category>/<name>`` to+``$HERMES_HOME/skills/<category>/<name>``, preserving the category path.+When a skill is moved between categories, the install-path strings embedded+in its own docs and scripts (joined ``skills/<category>/<name>/...`` and the+segmented ``Path(...) / "skills" / "<category>" / "<name>"`` form) keep+pointing at the pre-move directory, so every copy-pasteable snippet raises+FileNotFoundError (#115695). Nothing else catches that drift today; this+test does, for every optional skill, at CI time.++Only *self*-references are checked (the reference names the skill itself),+so cross-skill references and foreign-repo paths in port notes are immune.+"""+import re+from pathlib import Path++REPO = Path(__file__).resolve().parents[2]+OPTIONAL = REPO / "optional-skills"++# Text formats that carry copy-pasteable install paths; data files can be+# huge, so cap the scan well above any real doc/script.+_SCAN_SUFFIXES = {".md", ".py", ".txt", ".sh", ".yaml", ".yml", ".toml", ".json"}+_MAX_SCAN_BYTES = 2 * 1024 * 1024+++def _skill_roots():+ roots = {skill_md.parent for skill_md in OPTIONAL.rglob("SKILL.md")}+ return sorted(roots)+++def _scan_files(root):+ for path in sorted(root.rglob("*")):+ if not path.is_file() or path.suffix.lower() not in _SCAN_SUFFIXES:+ continue+ if path.stat().st_size > _MAX_SCAN_BYTES:+ continue+ yield path+++def _stale_self_references(root):+ """Yield (file, line_no, snippet) for self-install paths that cannot resolve."""+ name = re.escape(root.name)+ # skills/<category>/<name>/... — joined-string form+ joined = re.compile(rf"skills/([\w.-]+)/{name}\b")+ # Path(...) / "skills" / "<category>" / "<name>" — segmented form+ segmented = re.compile(+ rf'["\']skills["\']\s*/\s*["\']([\w.-]+)["\']\s*/\s*["\']{name}["\']'+ )+ stale = []+ for path in _scan_files(root):+ try:+ text = path.read_text(encoding="utf-8")+ except (UnicodeDecodeError, OSError):+ continue+ for line_no, line in enumerate(text.splitlines(), start=1):+ for match in joined.finditer(line):+ category = match.group(1)+ if not (OPTIONAL / category / root.name).is_dir():+ stale.append((path.relative_to(REPO), line_no, match.group(0)))+ for match in segmented.finditer(line):+ category = match.group(1)+ if not (OPTIONAL / category / root.name).is_dir():+ stale.append((path.relative_to(REPO), line_no, match.group(0)))+ return stale+++def test_optional_skills_self_install_paths_resolve_to_their_own_location():+ offenders = []+ for root in _skill_roots():+ offenders.extend(_stale_self_references(root))+ assert not offenders, (+ "Optional skills reference their own install path under a category "+ "that does not match their location (the skill moved, the embedded "+ "paths did not):\n"+ + "\n".join(f" {f}:{line}: {snippet}" for f, line, snippet in offenders)+ )