Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ All notable changes to SkillEvaluator are documented in this file.
comment helpers, and needs no Pages configuration or history branch. Future
generated bundles include the template; archived bundles and the released
onboarding CLI retain their existing hosted publisher setup.
- `harness-check` on a plugin folder shows which plugin formats each harness
accepts (`.claude-plugin`, `.codex-plugin`, Copilot, Agent Plugins v1, Hermes
`plugin.yaml`) and flags an empty plugin.
- `harness` rules for harness gates: Hermes `platforms` and OpenClaw
`metadata.openclaw.requires`.
- `harness` rules for invocation fields: `disable-model-invocation`, Codex's
Expand Down
2 changes: 2 additions & 0 deletions docs/tier1-validation.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -294,6 +294,8 @@ For `validate`, the default set is `schema`, `version`, `security`, `pii`, `lice
Invocation rules: `disable-model-invocation` (ignored by Codex, Hermes and OpenCode), Codex's `agents/openai.yaml` implicit-invocation policy (Codex only), `allowed-tools`, Claude Code-only fields, and Hermes project trust.

Gate rules: Hermes `platforms` and OpenClaw `metadata.openclaw.requires` hide the skill on hosts that don't match.

`harness-check` on a plugin folder also shows a plugin panel: which plugin formats each harness accepts (`.claude-plugin`, `.codex-plugin`, Copilot, Agent Plugins v1, Hermes `plugin.yaml`), and an empty plugin.
</Accordion>

<Accordion title="security — vulnerability scanning">
Expand Down
4 changes: 4 additions & 0 deletions src/skillevaluator/harness/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,20 @@
model_config,
skill_facts,
)
from skillevaluator.harness.plugin import evaluate_plugin, is_plugin_root, plugin_facts

__all__ = [
"HARNESS_STATUSES",
"Catalog",
"HarnessResult",
"evaluate_harnesses",
"evaluate_plugin",
"evaluate_profile",
"facts_for",
"is_plugin_root",
"listed_description",
"load_profiles",
"model_config",
"plugin_facts",
"skill_facts",
]
85 changes: 85 additions & 0 deletions src/skillevaluator/harness/plugin.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
# SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: Apache-2.0
"""Static plugin facts and per-harness plugin rules.

A profile's ``plugin`` section has ``rules`` (format acceptance, same expression
language as skill rules). Like the skill overlay, this is advisory and never
changes Tier 1 results.
"""

from __future__ import annotations

import json
from pathlib import Path
from typing import Any

from skillevaluator.harness.overlay import _EFFECT_RANK, HarnessResult, _fill, _Rule

MANIFESTS = {
"claude": ".claude-plugin/plugin.json",
"codex": ".codex-plugin/plugin.json",
"cursor": ".cursor-plugin/plugin.json",
"copilot": ".github/plugin/plugin.json",
"copilot_alt": ".plugin/plugin.json",
"root_json": "plugin.json",
"hermes_native": "plugin.yaml",
}
AGENT_PLUGINS_SCHEMA = "https://agent-plugins.org/schemas/"
# Folders a harness can pick up without any manifest (Claude Code inline plugins).
DEFAULT_DIRS = ("skills", "commands", "agents", "hooks")


def is_plugin_root(path: Path) -> bool:
return any((path / rel).is_file() for rel in MANIFESTS.values())
Comment thread
chrisknvidia marked this conversation as resolved.
Resolved


def plugin_facts(root: Path) -> dict[str, Any]:
"""Facts about a plugin folder: manifest formats, manifest validity and name."""
facts: dict[str, Any] = {"plugin_name": root.name, "manifest_invalid": False}
for fmt, rel in MANIFESTS.items():
path = root / rel
facts[f"fmt_{fmt}"] = path.is_file()
if not path.is_file() or path.suffix != ".json":
continue
try:
data = json.loads(path.read_text(encoding="utf-8"))
except (OSError, ValueError, UnicodeDecodeError):
facts["manifest_invalid"] = True
Comment thread
devin-ai-integration[bot] marked this conversation as resolved.
Resolved
facts[f"fmt_{fmt}"] = False
continue
if isinstance(data, dict) and isinstance(data.get("name"), str) and data["name"]:
facts["plugin_name"] = data["name"]
if fmt == "root_json":
facts["fmt_agent_v1"] = isinstance(data, dict) and str(data.get("$schema", "")).startswith(
AGENT_PLUGINS_SCHEMA
)
Comment thread
chrisknvidia marked this conversation as resolved.
Resolved
facts["fmt_copilot"] = facts["fmt_copilot"] or facts.pop("fmt_copilot_alt")
facts.setdefault("fmt_agent_v1", False)
facts["any_manifest"] = any(v for k, v in facts.items() if k.startswith("fmt_"))
facts["default_dirs"] = any((root / d).is_dir() for d in DEFAULT_DIRS)
return facts


def evaluate_plugin(profile: dict[str, Any], facts: dict[str, Any]) -> HarnessResult:
"""Apply a profile's plugin rules."""
section = profile.get("plugin") or {}
findings: list[dict[str, str]] = []
worst = -1
for rule in section.get("rules", []):
if not _Rule.evaluate(str(rule["when"]), {**facts, "always": True}):
continue
finding = {"id": rule["id"], "effect": rule["effect"], "message": _fill(rule["message"], facts)}
for key in ("fix", "outcome"):
if rule.get(key):
finding[key] = _fill(rule[key], facts)
findings.append(finding)
worst = max(worst, _EFFECT_RANK[rule["effect"]])
verified = profile.get("verified", {})
return HarnessResult(
harness=profile["harness"],
display_name=profile.get("display_name", profile["harness"]),
status="not_loaded" if worst == 2 else "degraded" if worst == 1 else "loads",
version=str(verified.get("version", "")),
verified_date=str(verified.get("date", "")),
findings=findings,
)
3 changes: 3 additions & 0 deletions src/skillevaluator/harness/profiles/claude-code.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,6 @@ notes:
- "Follows symlinked skill folders and symlinked SKILL.md files, inside or outside the root."
- "Nested SKILL.md, CRLF, BOM, tabs, uppercase names: no effect observed."
- "New skills and edited bodies are picked up mid-session without restart."
plugin:
rules:
- {id: CC-PLUGIN-EMPTY, when: "not fmt_claude and not default_dirs", effect: not_loaded, outcome: not found, message: "No .claude-plugin/plugin.json and no skills/, commands/, agents/ or hooks/ folder: Claude Code finds nothing to load.", fix: "Add .claude-plugin/plugin.json or put components in the default folders."}
Comment thread
chrisknvidia marked this conversation as resolved.
Resolved
3 changes: 3 additions & 0 deletions src/skillevaluator/harness/profiles/codex.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,6 @@ notes:
- "Explicit $skill injects the whole SKILL.md (145 KB tested)."
- "Follows symlinked skill folders (inside or outside the root)."
- "New skills are listed next turn; files are re-read from disk."
plugin:
rules:
- {id: CX-PLUGIN-FORMAT, when: "not (fmt_codex or fmt_claude or fmt_cursor or fmt_agent_v1)", effect: not_loaded, outcome: rejected, message: "Codex installs .codex-plugin, .claude-plugin, .cursor-plugin and Agent Plugins v1 bundles; this one has none of them.", fix: "Add .codex-plugin/plugin.json."}
3 changes: 3 additions & 0 deletions src/skillevaluator/harness/profiles/copilot-cli.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,6 @@ notes:
- "Docs say skills only in immediate subfolders; runtime finds them 3 grouping levels deep."
- "Follows symlinks inside and outside the checkout (SDK docs say inside only)."
- "Project copy wins on duplicate names (3/3); missing name falls back to the folder name."
plugin:
rules:
- {id: CP-PLUGIN-FORMAT, when: "not (fmt_claude or fmt_agent_v1 or fmt_copilot or fmt_root_json)", effect: not_loaded, outcome: rejected, message: "Copilot CLI installs .claude-plugin, .github/plugin, .plugin and plugin.json bundles; Codex- and Cursor-only bundles are refused.", fix: "Add .claude-plugin/plugin.json (Copilot reads it)."}
3 changes: 3 additions & 0 deletions src/skillevaluator/harness/profiles/hermes.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,6 @@ notes:
- "Precedence: project > ~/.hermes/skills > skills.create_dir > external_dirs (project wins, 3/3)."
- "Large bodies are spilled and paged through in small reads."
- "Pin the commit: the displayed version string did not match the installed code."
plugin:
rules:
- {id: HM-PLUGIN-FORMAT, when: "not (fmt_agent_v1 or fmt_hermes_native)", effect: not_loaded, outcome: rejected, message: "Hermes installs Agent Plugins v1 (plugin.json with the agent-plugins.org $schema) or native plugin.yaml plugins only.", fix: "Add an Agent Plugins v1 plugin.json."}
3 changes: 3 additions & 0 deletions src/skillevaluator/harness/profiles/openclaw.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,6 @@ notes:
- "Precedence: workspace skills/ > .agents/skills > ~/.agents/skills > managed > bundled > extra dirs (project wins, 3/3)."
- "Description given as a YAML list is stringified and listed. BOM, CRLF, bare colons tolerated."
- "New skills listed next turn in `openclaw chat`; files re-read from disk."
plugin:
rules:
- {id: OW-PLUGIN-FORMAT, when: "not (fmt_claude or fmt_codex or fmt_cursor or fmt_agent_v1 or fmt_root_json)", effect: not_loaded, outcome: rejected, message: "OpenClaw installs bundles with a JSON plugin manifest (.claude-plugin, .codex-plugin, .cursor-plugin or plugin.json); Hermes plugin.yaml plugins are not found.", fix: "Add .claude-plugin/plugin.json."}
3 changes: 3 additions & 0 deletions src/skillevaluator/harness/profiles/opencode.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,6 @@ rules:
notes:
- "Docs (V1) say one level deep and a 1-1024 description; runtime matches the V2 docs: recursive, no length cap."
- "Tolerant of tabs, bare colons and BOM. Follows all symlinks tested."
plugin:
rules:
- {id: OC-PLUGIN-FORMAT, when: "always", effect: not_loaded, outcome: not found, message: "OpenCode does not load manifest plugin bundles; its plugins are JS/TS modules in .opencode/plugin/ or npm packages in opencode.json.", fix: "Install the skills under .opencode/skills, or port the plugin to an OpenCode JS plugin."}
14 changes: 14 additions & 0 deletions src/skillevaluator/harness/report.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
from rich.text import Text

from skillevaluator.harness.overlay import evaluate_profile, facts_for, load_profiles
from skillevaluator.harness.plugin import evaluate_plugin, is_plugin_root, plugin_facts
from skillevaluator.reporting.console_ui import AMBER, BRIGHT, FAINT, GREEN, MUTED, RED, SPIN, TEXT, WIDTH
from skillevaluator.validators.harness import HARNESS_METADATA_KEY, HarnessValidator

Expand Down Expand Up @@ -250,6 +251,19 @@ def run_harness_check(
skills = [target] if finder._is_skill_directory(target) else finder._find_all_skills(target)
width = max(60, min(WIDTH, console.width))
block: Block = {}
if is_plugin_root(target):
facts = plugin_facts(target)
rows = [evaluate_plugin(profile, facts).to_dict() for profile in profiles]
console.print(
harness_panel(
{str(target): rows},
title=f"Plugin compatibility · {facts['plugin_name']}",
verbose=verbose,
width=width,
)
)
console.print()
block[f"{target} (plugin)"] = rows
all_facts = facts_for(skills)
for skill in skills:
rows: list[dict[str, Any]] = [{"harness": p["harness"], "status": "pending"} for p in profiles]
Expand Down
111 changes: 111 additions & 0 deletions tests/harness/test_plugin_compat.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
# SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: Apache-2.0
"""Tests for plugin facts and per-harness plugin rules."""

import json
from pathlib import Path

from click.testing import CliRunner

from skillevaluator.cli import cli
from skillevaluator.harness import evaluate_plugin, is_plugin_root, load_profiles, plugin_facts

AGENT_V1 = "https://agent-plugins.org/schemas/1.0.0/plugin.schema.json"


def _plugin(
root: Path, manifest: str | None, data: dict | None = None, components: tuple[str, ...] = ("skills",)
) -> Path:
root.mkdir(parents=True)
if manifest:
(root / manifest).parent.mkdir(parents=True, exist_ok=True)
(root / manifest).write_text(json.dumps(data or {"name": "demo", "version": "0.1.0"}))
if "skills" in components:
(root / "skills/demo").mkdir(parents=True)
(root / "skills/demo/SKILL.md").write_text("---\nname: demo\ndescription: Use when testing.\n---\nBody\n")
if "commands" in components:
(root / "commands").mkdir()
(root / "commands/run.md").write_text("---\ndescription: Run\n---\nRun $ARGUMENTS\n")
if "mcp" in components:
(root / ".mcp.json").write_text(json.dumps({"mcpServers": {"a": {"command": "x"}, "b": {"command": "y"}}}))
return root


def _status(root: Path) -> dict[str, tuple[str, list[str]]]:
facts = plugin_facts(root)
out = {}
for profile in load_profiles():
result = evaluate_plugin(profile, facts)
out[result.harness] = (result.status, [f["id"] for f in result.findings])
return out


def test_every_profile_has_plugin_section():
for profile in load_profiles():
assert "rules" in profile["plugin"]


def test_facts_detect_formats_name_and_components(tmp_path: Path):
root = _plugin(tmp_path / "p", ".claude-plugin/plugin.json", components=("skills", "commands", "mcp"))
facts = plugin_facts(root)
assert is_plugin_root(root) and facts["fmt_claude"] and not facts["fmt_codex"]
assert facts["plugin_name"] == "demo"


def test_claude_format_acceptance_matrix(tmp_path: Path):
s = _status(_plugin(tmp_path / "p", ".claude-plugin/plugin.json"))
assert {h: v[0] for h, v in s.items()} == {
"claude-code": "loads",
"codex": "loads",
"copilot-cli": "loads",
"hermes": "not_loaded",
"openclaw": "loads",
"opencode": "not_loaded",
}


def test_codex_only_bundle_is_refused_by_copilot(tmp_path: Path):
s = _status(_plugin(tmp_path / "p", ".codex-plugin/plugin.json"))
assert s["copilot-cli"][0] == "not_loaded" and s["codex"][0] == "loads"


def test_agent_v1_needs_schema_for_hermes(tmp_path: Path):
good = _status(_plugin(tmp_path / "a", "plugin.json", {"$schema": AGENT_V1, "name": "demo", "version": "1"}))
plain = _status(_plugin(tmp_path / "b", "plugin.json", {"name": "demo"}))
assert good["hermes"][0] == "loads"
assert plain["hermes"][0] == "not_loaded"


def test_claude_inline_plugin_needs_default_folders(tmp_path: Path):
inline = tmp_path / "inline"
_plugin(inline, None)
(inline / "plugin.json").write_text(json.dumps({"name": "inline"}))
empty = tmp_path / "empty"
empty.mkdir()
(empty / "plugin.json").write_text(json.dumps({"name": "empty"}))
assert plugin_facts(inline)["default_dirs"] and _status(inline)["claude-code"][0] == "loads"
assert _status(empty)["claude-code"] == ("not_loaded", ["CC-PLUGIN-EMPTY"])


def test_malformed_manifest_is_a_fact_not_a_crash(tmp_path: Path):
root = _plugin(tmp_path / "p", None)
(root / ".claude-plugin").mkdir()
(root / ".claude-plugin/plugin.json").write_text("{not json")
facts = plugin_facts(root)
assert facts["manifest_invalid"] and facts["plugin_name"] == "p"


def test_harness_check_prints_plugin_panel(tmp_path: Path):
root = _plugin(tmp_path / "p", ".claude-plugin/plugin.json")
result = CliRunner().invoke(cli, ["harness-check", str(root)])
assert result.exit_code == 0, result.output
assert "Plugin compatibility" in result.output and "opencode" in result.output


def test_unreadable_or_malformed_manifest_is_not_an_accepted_format(tmp_path: Path):
from skillevaluator.harness.plugin import plugin_facts

(tmp_path / ".claude-plugin").mkdir()
(tmp_path / ".claude-plugin" / "plugin.json").write_text("{not json", encoding="utf-8")
facts = plugin_facts(tmp_path)
assert facts["manifest_invalid"] and not facts["fmt_claude"] and not facts["any_manifest"]
Loading