Skip to content

The agent that grows with you

test(skills): guard paste-safe shell snippets and OS-bound platform gates

teknium1f52bf846cd27
diff --git a/tests/skills/test_authoring_standards.py b/tests/skills/test_authoring_standards.py
index d92652d7c85..40bd10cbc79 100644
--- a/tests/skills/test_authoring_standards.py
+++ b/tests/skills/test_authoring_standards.py
@@ -21,6 +21,11 @@ MARKETING = re.compile(
re.I,
)
MACHINE_LOCAL = re.compile(r"/home/(?!runner\b)[a-z0-9_-]+/|[A-Z]:\\+Users\\+(?!<)")
+SHELL_FENCE_OPEN = re.compile(r"^\s*(`{3,}|~{3,})\s*(bash|sh|shell|zsh|console)\b", re.I)
+# A line-continuation backslash must be the last character on its line: a
+# comment after it voids the continuation and the flags below run as a
+# separate command when the snippet is pasted (#113448).
+CONTINUATION_THEN_COMMENT = re.compile(r"\\\s+#")
# ---------------------------------------------------------------------------
# Grandfathered pre-existing debt. Shrink this list; never grow it.
@@ -143,6 +148,35 @@ def test_size_limit(p):
)
+def _shell_fence_lines(content: str):
+ """Yield (lineno, line) for every line inside a fenced bash/sh block."""
+ fence = None
+ for i, line in enumerate(content.splitlines(), 1):
+ if fence is None:
+ m = SHELL_FENCE_OPEN.match(line)
+ if m:
+ fence = m.group(1)
+ continue
+ if line.strip().startswith(fence):
+ fence = None
+ continue
+ yield i, line
+
+
[email protected]("p", _params())
+def test_shell_snippets_paste_safe(p):
+ _, content = _frontmatter(p)
+ bad = [
+ f"{_rel(p)}/SKILL.md:{i}: {line.strip()}"
+ for i, line in _shell_fence_lines(content)
+ if CONTINUATION_THEN_COMMENT.search(line)
+ ]
+ assert not bad, (
+ "comment after a line-continuation backslash breaks the pasted command; "
+ "move the note above the whole command:\n" + "\n".join(bad)
+ )
+
+
def test_grandfather_entries_still_needed():
"""A grandfather entry whose violation is fixed must be removed."""
for rel in GRANDFATHER:
diff --git a/tests/skills/test_skill_platform_gates.py b/tests/skills/test_skill_platform_gates.py
new file mode 100644
index 00000000000..dbe2c3b2a65
--- /dev/null
+++ b/tests/skills/test_skill_platform_gates.py
@@ -0,0 +1,28 @@
+"""Platform gates of optional skills whose bodies are bound to one OS family.
+
+Front-matter ``platforms`` feeds skill selection, so a declared platform the
+body cannot run on gets the skill offered and failing at step one. Driven
+through the real loader (``agent.skill_utils``), not a frontmatter re-parse.
+"""
+from pathlib import Path
+
+import pytest
+
+from agent.skill_utils import parse_frontmatter, skill_matches_platform
+
+REPO = Path(__file__).resolve().parents[2]
+
+
+ ("skill", "platform", "why"),
+ [
+ ("optional-skills/creative/heartmula", "win32", ". .venv/bin/activate"),
+ ("optional-skills/mlops/tensorrt-llm", "darwin", "Requires CUDA"),
+ ],
+)
+def test_os_bound_skill_is_not_offered_on_the_wrong_platform(monkeypatch, skill, platform, why):
+ fm, body = parse_frontmatter((REPO / skill / "SKILL.md").read_text(encoding="utf-8"))
+ assert why in body, f"{skill}: body no longer carries the OS-binding step; re-evaluate its platforms"
+ monkeypatch.setattr("agent.skill_utils.sys.platform", platform)
+ monkeypatch.setattr("agent.skill_utils.is_termux", lambda: False)
+ assert not skill_matches_platform(fm), f"{skill} declares a platform its body cannot run on: {platform}"
diff --git a/website/docs/user-guide/skills/bundled/productivity/productivity-notion.md b/website/docs/user-guide/skills/bundled/productivity/productivity-notion.md
index 1bfcdec7001..b198d73f60c 100644
--- a/website/docs/user-guide/skills/bundled/productivity/productivity-notion.md
+++ b/website/docs/user-guide/skills/bundled/productivity/productivity-notion.md
@@ -15,7 +15,7 @@ Notion API + ntn CLI: pages, databases, markdown, Workers.
| | |
|---|---|
| Source | Bundled (installed by default) |
-| Path | `skills/productivity\notion` |
+| Path | `skills/productivity/notion` |
| Version | `2.0.0` |
| Author | community |
| License | MIT |
@@ -88,7 +88,8 @@ Windows users: skip step 2 entirely until native `ntn` ships — Path B works fi
### Raw API calls (shorthand for curl)
```bash
ntn api v1/users # GET
-ntn api v1/pages parent[page_id]=abc123 \ # POST with inline body
+# POST with inline body
+ntn api v1/pages parent[page_id]=abc123 \
properties[title][0][text][content]="Notes"
ntn api v1/pages/abc123 -X PATCH archived:=true # PATCH; := is non-string (bool/num/null)
```
diff --git a/website/docs/user-guide/skills/optional/creative/creative-heartmula.md b/website/docs/user-guide/skills/optional/creative/creative-heartmula.md
index ed218227704..53ab90502d9 100644
--- a/website/docs/user-guide/skills/optional/creative/creative-heartmula.md
+++ b/website/docs/user-guide/skills/optional/creative/creative-heartmula.md
@@ -15,11 +15,11 @@ HeartMuLa: Suno-like song generation from lyrics + tags.
| | |
|---|---|
| Source | Optional — install with `hermes skills install official/creative/heartmula` |
-| Path | `optional-skills/creative\heartmula` |
+| Path | `optional-skills/creative/heartmula` |
| Version | `1.0.0` |
| Author | Teknium (teknium1), Hermes Agent |
| License | MIT |
-| Platforms | linux, macos, windows |
+| Platforms | linux, macos |
| Tags | `music`, `audio`, `generation`, `ai`, `heartmula`, `heartcodec`, `lyrics`, `songs` |
| Related skills | [`audiocraft-audio-generation`](/docs/user-guide/skills/optional/creative/creative-audiocraft-audio-generation), [`songwriting-and-ai-music`](/docs/user-guide/skills/bundled/creative/creative-songwriting-and-ai-music) |
diff --git a/website/docs/user-guide/skills/optional/mlops/mlops-evaluation-evaluating-llms-harness.md b/website/docs/user-guide/skills/optional/mlops/mlops-evaluation-evaluating-llms-harness.md
index 8d449ee126a..e16931a1edf 100644
--- a/website/docs/user-guide/skills/optional/mlops/mlops-evaluation-evaluating-llms-harness.md
+++ b/website/docs/user-guide/skills/optional/mlops/mlops-evaluation-evaluating-llms-harness.md
@@ -15,7 +15,7 @@ lm-eval-harness: benchmark LLMs (MMLU, GSM8K, etc.).
| | |
|---|---|
| Source | Optional — install with `hermes skills install official/mlops/evaluating-llms-harness` |
-| Path | `optional-skills/mlops\evaluation\evaluating-llms-harness` |
+| Path | `optional-skills/mlops/evaluation/evaluating-llms-harness` |
| Version | `1.0.1` |
| Author | Orchestra Research |
| License | MIT |
@@ -122,11 +122,11 @@ lm_eval --model hf \
**Step 3: Run evaluation**
```bash
-# Full MMLU evaluation (57 subjects)
+# Full MMLU evaluation (57 subjects), standard 5-shot evaluation
lm_eval --model hf \
--model_args pretrained=meta-llama/Llama-2-7b-hf \
--tasks mmlu \
- --num_fewshot 5 \ # 5-shot evaluation (standard)
+ --num_fewshot 5 \
--batch_size 8 \
--output_path results/ \
--log_samples # Save individual predictions
@@ -191,10 +191,11 @@ Evaluate every N training steps:
CHECKPOINT_DIR=$1
STEP=$2
+# 0-shot for speed
lm_eval --model hf \
--model_args pretrained=$CHECKPOINT_DIR/checkpoint-$STEP \
--tasks gsm8k,hellaswag \
- --num_fewshot 0 \ # 0-shot for speed
+ --num_fewshot 0 \
--batch_size 16 \
--output_path results/step-$STEP.json
```
@@ -483,13 +484,13 @@ code execution.
## Advanced topics
-**Benchmark descriptions**: See [references/benchmark-guide.md](https://github.com/NousResearch/hermes-agent/blob/main/optional-skills/mlops\evaluation\evaluating-llms-harness/references/benchmark-guide.md) for detailed description of all 60+ tasks, what they measure, and interpretation.
+**Benchmark descriptions**: See [references/benchmark-guide.md](https://github.com/NousResearch/hermes-agent/blob/main/optional-skills/mlops/evaluation/evaluating-llms-harness/references/benchmark-guide.md) for detailed description of all 60+ tasks, what they measure, and interpretation.
-**Custom tasks**: See [references/custom-tasks.md](https://github.com/NousResearch/hermes-agent/blob/main/optional-skills/mlops\evaluation\evaluating-llms-harness/references/custom-tasks.md) for creating domain-specific evaluation tasks.
+**Custom tasks**: See [references/custom-tasks.md](https://github.com/NousResearch/hermes-agent/blob/main/optional-skills/mlops/evaluation/evaluating-llms-harness/references/custom-tasks.md) for creating domain-specific evaluation tasks.
-**API evaluation**: See [references/api-evaluation.md](https://github.com/NousResearch/hermes-agent/blob/main/optional-skills/mlops\evaluation\evaluating-llms-harness/references/api-evaluation.md) for evaluating OpenAI, Anthropic, and other API models.
+**API evaluation**: See [references/api-evaluation.md](https://github.com/NousResearch/hermes-agent/blob/main/optional-skills/mlops/evaluation/evaluating-llms-harness/references/api-evaluation.md) for evaluating OpenAI, Anthropic, and other API models.
-**Multi-GPU strategies**: See [references/distributed-eval.md](https://github.com/NousResearch/hermes-agent/blob/main/optional-skills/mlops\evaluation\evaluating-llms-harness/references/distributed-eval.md) for data parallel and tensor parallel evaluation.
+**Multi-GPU strategies**: See [references/distributed-eval.md](https://github.com/NousResearch/hermes-agent/blob/main/optional-skills/mlops/evaluation/evaluating-llms-harness/references/distributed-eval.md) for data parallel and tensor parallel evaluation.
## Hardware requirements
diff --git a/website/docs/user-guide/skills/optional/mlops/mlops-tensorrt-llm.md b/website/docs/user-guide/skills/optional/mlops/mlops-tensorrt-llm.md
index 727812c1c8d..3db2e3fa1a9 100644
--- a/website/docs/user-guide/skills/optional/mlops/mlops-tensorrt-llm.md
+++ b/website/docs/user-guide/skills/optional/mlops/mlops-tensorrt-llm.md
@@ -15,12 +15,12 @@ High-throughput LLM inference on NVIDIA GPUs.
| | |
|---|---|
| Source | Optional — install with `hermes skills install official/mlops/tensorrt-llm` |
-| Path | `optional-skills/mlops\tensorrt-llm` |
+| Path | `optional-skills/mlops/tensorrt-llm` |
| Version | `1.0.1` |
| Author | Orchestra Research |
| License | MIT |
| Dependencies | `tensorrt-llm`, `torch` |
-| Platforms | linux, macos |
+| Platforms | linux |
| Tags | `Inference Serving`, `TensorRT-LLM`, `NVIDIA`, `Inference Optimization`, `High Throughput`, `Low Latency`, `Production`, `FP8`, `INT4`, `In-Flight Batching`, `Multi-GPU` |
## Reference: full SKILL.md
@@ -95,8 +95,9 @@ for output in outputs:
```bash
# Start server (automatic model download and compilation)
+# Tensor parallelism across 4 GPUs
trtllm-serve meta-llama/Meta-Llama-3-8B \
- --tp_size 4 \ # Tensor parallelism (4 GPUs)
+ --tp_size 4 \
--max_batch_size 256 \
--max_num_tokens 4096
@@ -197,9 +198,9 @@ outputs = llm.generate(
## References
-- **[Optimization Guide](https://github.com/NousResearch/hermes-agent/blob/main/optional-skills/mlops\tensorrt-llm/references/optimization.md)** - Quantization, batching, KV cache tuning
-- **[Multi-GPU Setup](https://github.com/NousResearch/hermes-agent/blob/main/optional-skills/mlops\tensorrt-llm/references/multi-gpu.md)** - Tensor/pipeline parallelism, multi-node
-- **[Serving Guide](https://github.com/NousResearch/hermes-agent/blob/main/optional-skills/mlops\tensorrt-llm/references/serving.md)** - Production deployment, monitoring, autoscaling
+- **[Optimization Guide](https://github.com/NousResearch/hermes-agent/blob/main/optional-skills/mlops/tensorrt-llm/references/optimization.md)** - Quantization, batching, KV cache tuning
+- **[Multi-GPU Setup](https://github.com/NousResearch/hermes-agent/blob/main/optional-skills/mlops/tensorrt-llm/references/multi-gpu.md)** - Tensor/pipeline parallelism, multi-node
+- **[Serving Guide](https://github.com/NousResearch/hermes-agent/blob/main/optional-skills/mlops/tensorrt-llm/references/serving.md)** - Production deployment, monitoring, autoscaling
## Resources