Skip to content

Multi-tier framework for evaluating AI agent skills and plugins with quality gates, security scanning, harness compatibility checks, semantic overlap detection, synthetic evaluation dataset generation, and live agent evaluation that measures how skills affect agent behavior. Ships reusable CI templates that bring every check to any repository.

Flag a project skill with a same-named copy in a user-level skills folder (#622)

Christopher Kevin53ced5d8e485
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 547abf66..e62af359 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -6,6 +6,9 @@ All notable changes to SkillEvaluator are documented in this file.
### Added
+- `harness` results flag a project skill that has a same-named copy in a user-level
+ skills folder the harness also reads (`*-USER-COPY`). Claude Code uses the user
+ copy, Codex lists both, and the other harnesses use the project copy.
- Canonical `comment-skill-checks.yml` reusable workflow and source template for
the standard scored Tier 1 PR comment without hosted reports. It verifies the
existing signed receipts and native evidence, reuses the shared report and
diff --git a/src/skillevaluator/harness/overlay.py b/src/skillevaluator/harness/overlay.py
index 8c96bdfa..3150705d 100644
--- a/src/skillevaluator/harness/overlay.py
+++ b/src/skillevaluator/harness/overlay.py
@@ -461,6 +461,7 @@ def skill_facts(skill_path: Path, catalog: Catalog | None = None) -> dict[str, A
"skill_name": name,
"description_text": description if isinstance(description, str) else "",
"install_root": root,
+ "workspace_skills": root is None and skill_path.absolute().parent.name == "skills",
"grouping_depth": depth,
"manifest_name_exact": "SKILL.md" in names,
"nested_skill_md": bool(nested),
@@ -577,12 +578,15 @@ def _catalog_of(group: list[Path]) -> Catalog:
return Catalog.of(group, Path(os.path.commonpath([s.resolve() for s in group])) if len(group) > 1 else None)
-def facts_for(skills: list[Path]) -> dict[Path, dict[str, Any]]:
+def facts_for(skills: list[Path], profiles: list[dict[str, Any]] | None = None) -> dict[Path, dict[str, Any]]:
"""Facts per skill, with the catalog they are installed in.
A skill installed in a skills folder (e.g. ``.claude/skills``, or an OpenClaw workspace ``skills/``) is
measured against everything installed in that folder, and skills in different folders are separate
installations. Skills outside any skills folder that are given together form their own catalog.
+
+ ``profiles`` are the harnesses being checked: only the user-level skills folders they read are searched for
+ same-named copies (every known folder when omitted).
"""
groups: dict[Path | None, list[Path]] = {}
for skill in skills:
@@ -591,7 +595,60 @@ def facts_for(skills: list[Path]) -> dict[Path, dict[str, Any]]:
catalogs: dict[Path, Catalog] = {}
for group in groups.values():
catalogs.update(dict.fromkeys(group, _catalog_of(group)))
- return {skill: skill_facts(skill, catalogs[skill]) for skill in skills}
+ user_roots = None if profiles is None else {r for p in profiles for r in p.get("roots", {}).get("user", [])}
+ user_skills: dict[Path, dict[Path, str]] = {}
+ facts = {skill: skill_facts(skill, catalogs[skill]) for skill in skills}
+ for skill_facts_ in facts.values():
+ skill_facts_["user_copies"] = _user_copies(skill_facts_, user_skills, user_roots)
+ return facts
+
+
+def _project_root(facts: dict[str, Any]) -> str | None:
+ """The root a project skill is installed in: a harness root, or an OpenClaw workspace ``skills/`` folder."""
+ return "skills" if facts["workspace_skills"] else facts["install_root"]
+
+
+def _named_skills(folder: Path) -> dict[Path, str]:
+ """Skills under a folder and their names; one that cannot be read is left out."""
+ try:
+ found = _find_skills(folder) if folder.is_dir() else []
+ except OSError:
+ return {}
+ names = {}
+ for skill in found:
+ try:
+ names[skill] = _skill_name(skill, _read_manifest(skill)[4])
+ except OSError:
+ continue
+ return names
+
+
+def _user_copies(
+ facts: dict[str, Any], cache: dict[Path, dict[Path, str]], user_roots: set[str] | None = None
+) -> list[tuple[str, str, int]]:
+ """``(root, path, depth)`` of same-named skills in the user-level roots, for a skill installed in a project root.
+
+ ``depth`` counts the grouping folders between the root and the copy. ``user_roots`` limits which roots are searched.
+ """
+ project_root = _project_root(facts)
+ if project_root is None or project_root.startswith("~/"):
+ return []
+ try:
+ home = Path.home()
+ except (KeyError, RuntimeError):
+ return []
+ copies = []
+ for root in _KNOWN_ROOTS:
+ if user_roots is not None and f"~/{root}" not in user_roots:
+ continue
+ folder = home / root
+ if folder not in cache:
+ cache[folder] = _named_skills(folder)
+ for skill, name in cache[folder].items():
+ if name == facts["skill_name"]:
+ parts = skill.relative_to(folder).parts
+ copies.append((f"~/{root}", f"~/{root}/{'/'.join(parts)}", len(parts) - 1))
+ return copies
def _utf16_units(value: Any) -> int:
@@ -746,6 +803,41 @@ def version_finding(profile: dict[str, Any], declared: str) -> dict[str, str] |
}
+def _rule_names(profile: dict[str, Any], facts: dict[str, Any], setup: dict[str, Any]) -> dict[str, Any]:
+ """Everything a profile rule can name: skill facts, the model setup, ``always`` and ``roots`` (every root, with
+ ``roots.project`` and ``roots.user`` for the groups)."""
+ roots = profile.get("roots", {})
+ all_roots = [*roots.get("project", []), *roots.get("user", [])]
+ return {**facts, **setup, "always": True, "roots": _RootList(all_roots, roots)}
+
+
+def _rule_fires(rule: dict[str, Any], names: dict[str, Any]) -> bool:
+ expression = str(rule["when"])
+ if "install_root" in expression and (names["install_root"] is None or names["native_root"]):
+ return False
+ if "catalog_" in expression and not names["catalog_size"]:
+ return False
+ return expression == "always" or _Rule.evaluate(expression, names)
+
+
+def _finds_at_depth(profile: dict[str, Any], names: dict[str, Any], root: str, depth: int) -> bool:
+ """Whether the profile's grouping rules still let it find a skill ``depth`` folders below the user root ``root``.
+
+ The rules read the same names as in :func:`evaluate_profile`, with the install root and depth of that copy.
+ A rule that cannot be evaluated is ignored here so it cannot stop a user-copy lookup.
+ """
+ copy = {**names, "install_root": root, "workspace_skills": False, "grouping_depth": depth}
+ for rule in profile.get("rules", []):
+ if rule["effect"] != "not_loaded" or "grouping_depth" not in str(rule["when"]):
+ continue
+ try:
+ if _rule_fires(rule, copy):
+ return False
+ except (KeyError, SyntaxError, TypeError, ValueError):
+ continue
+ return True
+
+
def evaluate_profile(
profile: dict[str, Any], facts: dict[str, Any], config: dict[str, Any] | None = None
) -> HarnessResult:
@@ -756,19 +848,29 @@ def evaluate_profile(
unknown context, a native provider, model-initiated activation and an interactive session.
"""
roots = profile.get("roots", {})
- all_roots = [*roots.get("project", []), *roots.get("user", [])]
setup = model_config(profile, config)
- facts = {**facts, "list_budget_chars": listing_budget_chars(profile, setup["context_tokens"])}
- names = {**facts, **setup, "always": True, "roots": _RootList(all_roots, roots)}
+ facts = {
+ **facts,
+ "list_budget_chars": listing_budget_chars(profile, setup["context_tokens"]),
+ "user_copy": False,
+ "user_copy_paths": "",
+ }
+ names = _rule_names(profile, facts, setup)
+ user_copies = (
+ [
+ path
+ for root, path, depth in facts.get("user_copies", [])
+ if root in roots.get("user", []) and _finds_at_depth(profile, names, root, depth)
+ ]
+ if _project_root(facts) in roots.get("project", [])
+ else []
+ )
+ facts = {**facts, "user_copy": bool(user_copies), "user_copy_paths": ", ".join(user_copies[:3])}
+ names = _rule_names(profile, facts, setup)
findings: list[dict[str, str]] = []
worst = -1
for rule in profile.get("rules", []):
- expression = str(rule["when"])
- if "install_root" in expression and (facts["install_root"] is None or names["native_root"]):
- continue
- if "catalog_" in expression and not facts["catalog_size"]:
- continue
- if expression != "always" and not _Rule.evaluate(expression, names):
+ if not _rule_fires(rule, names):
continue
finding = {"id": rule["id"], "effect": rule["effect"], "message": _fill(rule["message"], facts)}
for key in ("fix", "versions", "outcome", "confidence"):
@@ -822,5 +924,6 @@ def evaluate_harnesses(
config: dict[str, Any] | None = None,
) -> list[HarnessResult]:
"""Evaluate one skill (and the catalog it is installed in) against the selected profiles."""
- facts = facts_for([skill_path])[skill_path]
- return [evaluate_profile(profile, facts, config) for profile in load_profiles(harnesses, profiles_dir)]
+ profiles = load_profiles(harnesses, profiles_dir)
+ facts = facts_for([skill_path], profiles)[skill_path]
+ return [evaluate_profile(profile, facts, config) for profile in profiles]
diff --git a/src/skillevaluator/harness/profiles/claude-code.yaml b/src/skillevaluator/harness/profiles/claude-code.yaml
index a42fdfbd..b9514b37 100644
--- a/src/skillevaluator/harness/profiles/claude-code.yaml
+++ b/src/skillevaluator/harness/profiles/claude-code.yaml
@@ -14,6 +14,7 @@ rules:
- {id: CC-DESC-MISSING, when: "description_missing or description_empty or description_type != 'str'", effect: degraded, message: "No usable description: Claude Code shows body text instead.", fix: "Add a non-empty string description.", confidence: high}
- {id: CC-LIST-BUDGET, when: "catalog_desc_chars > list_budget_chars", effect: degraded, outcome: listing shortened, message: "The {catalog_size} skills in this folder have {catalog_desc_chars} description chars; Claude Code's skill list fits {list_budget_chars} (1% of the context window at 4 chars per token; 8,000 if the window is unknown), so descriptions get shortened.", fix: "Shorten descriptions (trigger first) or install fewer skills here.", confidence: medium}
- {id: CC-PRECEDENCE, when: "duplicate_name", effect: advisory, message: "Another skill is also named '{skill_name}' ({duplicate_paths}); only one is used, and a user-level copy beats a project copy.", fix: "Give each skill a unique name.", confidence: high}
+ - {id: CC-USER-COPY, when: "user_copy", effect: advisory, message: "A skill also named '{skill_name}' is installed at {user_copy_paths}; Claude Code uses that user-level copy, not this one.", fix: "Remove one copy, or give each a unique name.", confidence: high}
- {id: CC-ALLOWED-TOOLS, when: "allowed_tools_shape != 'none'", effect: advisory, message: "allowed-tools only pre-approves tools, never restricts, and applies only when the skill is invoked through the Skill tool (e.g. /name), not when the model reads the file. With --headless, see CC-ALLOWED-TOOLS-HEADLESS.", fix: "Don't rely on allowed-tools to restrict tools; use the harness's permission settings.", confidence: high}
- {id: CC-ALLOWED-TOOLS-HEADLESS, when: "headless and allowed_tools_shape != 'none'", effect: not_loaded, outcome: instructions not delivered, message: "In headless -p runs with default permissions the Skill call for a skill declaring allowed-tools is refused, so the body is not delivered.", fix: "For headless use, drop allowed-tools or allow the Skill tool (e.g. --allowedTools Skill); the declared tools are then pre-approved without a prompt, so allow Skill only in repos whose skills you trust.", confidence: medium}
- {id: CC-DUP-KEY, when: "frontmatter_duplicate_keys", effect: advisory, message: "Duplicate keys: Claude Code keeps the last value (four other harnesses drop the skill).", fix: "Remove the duplicate frontmatter key.", confidence: high}
diff --git a/src/skillevaluator/harness/profiles/codex.yaml b/src/skillevaluator/harness/profiles/codex.yaml
index 2b8547f2..4adcd3c6 100644
--- a/src/skillevaluator/harness/profiles/codex.yaml
+++ b/src/skillevaluator/harness/profiles/codex.yaml
@@ -18,6 +18,7 @@ rules:
- {id: CX-SYMLINK-FILE, when: "skill_md_symlink", effect: not_loaded, message: "Symlinked SKILL.md files are skipped (codex#15756).", fix: "Copy SKILL.md into the folder instead of symlinking the file (a symlinked folder works).", confidence: high}
- {id: CX-LIST-BUDGET, when: "catalog_desc_chars > list_budget_chars", effect: degraded, outcome: listing shortened, message: "The {catalog_size} skills in this folder have {catalog_desc_chars} description chars; Codex's skill list fits about {list_budget_chars} (2% of the context window at 4 bytes per token; 8,000 chars if unknown), so descriptions get shortened, then removed, then skills left out.", fix: "Shorten descriptions (trigger first) or install fewer skills here.", confidence: high}
- {id: CX-DUP-NAME, when: "duplicate_name", effect: advisory, message: "Another skill is also named '{skill_name}' ({duplicate_paths}); Codex lists both, so the model sees two.", fix: "Give each skill a unique name.", confidence: high}
+ - {id: CX-USER-COPY, when: "user_copy", effect: advisory, message: "A skill also named '{skill_name}' is installed at {user_copy_paths}; Codex lists both, so the model sees two.", fix: "Remove one copy, or give each a unique name.", confidence: high}
- {id: CX-ALLOWED-TOOLS, when: "allowed_tools_shape != 'none'", effect: advisory, message: "allowed-tools is ignored by Codex.", fix: "Don't rely on allowed-tools to restrict tools; use the harness's permission settings.", confidence: high}
- {id: CX-CASING, when: "not manifest_name_exact", effect: not_loaded, message: "Non-canonical name (skill.md/Skill.md): never loaded, on Linux or macOS (3/3 each).", fix: "Rename the file to SKILL.md (exact casing).", confidence: high}
- {id: CX-DMI-IGNORED, when: "disable_model_invocation and not codex_implicit_disabled", effect: degraded, message: "disable-model-invocation is ignored: the model still sees this skill and can use it on its own.", fix: "For Codex, add agents/openai.yaml with policy: {allow_implicit_invocation: false}.", confidence: high}
diff --git a/src/skillevaluator/harness/profiles/copilot-cli.yaml b/src/skillevaluator/harness/profiles/copilot-cli.yaml
index 0ff3b68a..e1c410f5 100644
--- a/src/skillevaluator/harness/profiles/copilot-cli.yaml
+++ b/src/skillevaluator/harness/profiles/copilot-cli.yaml
@@ -19,6 +19,7 @@ rules:
- {id: CP-ALLOWED-TOOLS, when: "allowed_tools_shape in ['string','list']", effect: advisory, message: "allowed-tools is ignored in -p (headless) mode; interactive behaviour unverified.", fix: "Don't rely on allowed-tools to restrict tools; use the harness's permission settings.", confidence: medium}
- {id: CP-CASING, when: "not manifest_name_exact", effect: degraded, message: "Non-canonical name (skill.md/Skill.md): loaded on case-insensitive filesystems (macOS default APFS, 3/3), ignored on case-sensitive Linux (3/3). Works or breaks depending on the OS.", fix: "Rename the file to SKILL.md (exact casing).", confidence: high}
- {id: CP-DUP-NAME, when: "duplicate_name", effect: advisory, message: "Another skill is also named '{skill_name}' ({duplicate_paths}); Copilot uses one, and the project copy wins.", fix: "Give each skill a unique name.", confidence: high}
+ - {id: CP-USER-COPY, when: "user_copy", effect: advisory, message: "A skill also named '{skill_name}' is installed at {user_copy_paths}; Copilot CLI uses this project copy, not that one.", fix: "Remove one copy, or give each a unique name.", confidence: high}
- {id: CP-CODEX-POLICY, when: "codex_implicit_disabled and not disable_model_invocation", effect: degraded, message: "agents/openai.yaml implicit-invocation policy is Codex-only: here the model can still use this skill on its own.", fix: "Also set disable-model-invocation: true (Claude Code, Copilot and OpenClaw honour it).", confidence: high}
- {id: CP-ARGUMENTS, when: "uses_arguments_placeholder", effect: degraded, message: "$ARGUMENTS is not substituted: the model sees the literal text.", fix: "Describe the expected input in words instead of $ARGUMENTS.", confidence: high}
- {id: CP-SKILL-DIR, when: "uses_claude_skill_dir", effect: degraded, message: "${CLAUDE_SKILL_DIR} is not substituted: the model sees the literal text.", fix: "Use paths relative to SKILL.md.", confidence: high}
diff --git a/src/skillevaluator/harness/profiles/hermes.yaml b/src/skillevaluator/harness/profiles/hermes.yaml
index e7a0ad3c..e94c035e 100644
--- a/src/skillevaluator/harness/profiles/hermes.yaml
+++ b/src/skillevaluator/harness/profiles/hermes.yaml
@@ -19,6 +19,7 @@ rules:
- {id: HM-ALLOWED-TOOLS, when: "allowed_tools_shape != 'none'", effect: advisory, message: "allowed-tools is ignored by Hermes.", fix: "Don't rely on allowed-tools to restrict tools; use the harness's permission settings.", confidence: high}
- {id: HM-CASING, when: "not manifest_name_exact", effect: not_loaded, message: "Non-canonical name (skill.md/Skill.md): never loaded, on Linux or macOS (3/3 each).", fix: "Rename the file to SKILL.md (exact casing).", confidence: high}
- {id: HM-DUP-NAME, when: "duplicate_name", effect: advisory, message: "Another skill is also named '{skill_name}' ({duplicate_paths}); Hermes lists both, so the model sees two.", fix: "Give each skill a unique name.", confidence: high}
+ - {id: HM-USER-COPY, when: "user_copy", effect: advisory, message: "A skill also named '{skill_name}' is installed at {user_copy_paths}; Hermes uses this project copy, not that one.", fix: "Remove one copy, or give each a unique name.", confidence: high}
- {id: HM-PLATFORMS, when: "platforms_excluded != ''", effect: advisory, message: "Hidden from the skill list on {platforms_excluded} (platforms: {platforms}).", fix: "Add those systems to platforms, or remove platforms if the skill works everywhere.", confidence: high}
- {id: HM-RESOURCE-SYMLINK, when: "resource_symlinks > 0", effect: degraded, message: "Symlinked files ({resource_symlink_paths}) are left out of the skill's file list.", fix: "Copy those files into the skill instead of symlinking them.", confidence: medium}
- {id: HM-LINKED-LAYOUT, when: "hermes_unlisted_files > 0", effect: advisory, message: "{hermes_unlisted_files} files outside references/, templates/, assets/ and scripts/ ({hermes_unlisted_dirs}) are left out of the skill's file list; the model finds them only if SKILL.md names their paths.", fix: "Move supporting files under references/, templates/, assets/ or scripts/.", confidence: high}
diff --git a/src/skillevaluator/harness/profiles/openclaw.yaml b/src/skillevaluator/harness/profiles/openclaw.yaml
index 2b012ce0..1dbed856 100644
--- a/src/skillevaluator/harness/profiles/openclaw.yaml
+++ b/src/skillevaluator/harness/profiles/openclaw.yaml
@@ -22,6 +22,7 @@ rules:
- {id: OW-CASING, when: "not manifest_name_exact", effect: degraded, message: "Non-canonical name (skill.md/Skill.md): loaded on case-insensitive filesystems (macOS default APFS, 3/3), ignored on case-sensitive Linux (3/3). Works or breaks depending on the OS.", fix: "Rename the file to SKILL.md (exact casing).", confidence: high}
- {id: OW-PROMPT-CAP, when: "catalog_size > 150 or catalog_desc_chars > 18000", effect: advisory, outcome: listing shortened, message: "{catalog_size} skills / {catalog_desc_chars} description chars here: past 150 skills or 18,000 chars OpenClaw also leaves skills out of the list (121 of 225 listed in our test).", fix: "Shorten descriptions (trigger first) or install fewer skills in one folder.", confidence: high}
- {id: OW-DUP-NAME, when: "duplicate_name", effect: advisory, message: "Another skill is also named '{skill_name}' ({duplicate_paths}); OpenClaw uses one: workspace skills/, then .agents/skills, then user folders.", fix: "Give each skill a unique name.", confidence: high}
+ - {id: OW-USER-COPY, when: "user_copy", effect: advisory, message: "A skill also named '{skill_name}' is installed at {user_copy_paths}; OpenClaw uses this project copy, not that one.", fix: "Remove one copy, or give each a unique name.", confidence: high}
- {id: OW-REQUIRES, when: "openclaw_gates != ''", effect: advisory, message: "Left out of the skill list unless the host has: {openclaw_gates}.", fix: "Make sure target hosts provide these, or drop requirements the skill doesn't need.", confidence: high}
- {id: OW-REF-BUDGET, when: "files_over_64000 > 0", effect: advisory, outcome: needs paging, message: "{files_over_64000} files over 64,000 bytes ({files_over_64000_paths}): OpenClaw's read cap is 16,000-64,000 UTF-8 bytes by model context, so each takes several reads.", fix: "Split large reference files into pieces under 16,000 UTF-8 bytes.", versions: "2026.9+", confidence: medium}
- {id: OW-CODEX-POLICY, when: "codex_implicit_disabled and not disable_model_invocation", effect: degraded, message: "agents/openai.yaml implicit-invocation policy is Codex-only: here the model can still use this skill on its own.", fix: "Also set disable-model-invocation: true (Claude Code, Copilot and OpenClaw honour it).", confidence: high}
diff --git a/src/skillevaluator/harness/profiles/opencode.yaml b/src/skillevaluator/harness/profiles/opencode.yaml
index 0cf5b397..ab7e872c 100644
--- a/src/skillevaluator/harness/profiles/opencode.yaml
+++ b/src/skillevaluator/harness/profiles/opencode.yaml
@@ -16,6 +16,7 @@ rules:
- {id: OC-BODY-CUT, when: "opencode_body_output_bytes > 51200 or opencode_body_output_lines > 2000", effect: degraded, outcome: needs paging, message: "OpenCode strips front matter and delivers the body as {opencode_body_output_bytes} bytes / {opencode_body_output_lines} lines; it cuts tool output at 51,200 bytes / 2,000 lines, so the model must page through the rest from a spill file.", fix: "Keep the SKILL.md body under 51,100 bytes and 1,990 lines; move detail into references/ files.", versions: "v2 lets users raise tool_output.max_bytes / max_lines", confidence: high}
- {id: OC-DOLLAR-N, when: "dollar_literal_count > 0", effect: degraded, outcome: text rewritten, message: "Run as a /command, every $N is replaced and left blank without that argument: {dollar_literal_count} price-like tokens (lines {dollar_literal_lines}) lose their numbers. The skill tool path is unaffected.", fix: "Reword amounts (e.g. USD 4.00) instead of $4.00.", versions: "1.x; v2 no longer registers skills as commands", confidence: high}
- {id: OC-DUP-NAME, when: "duplicate_name", effect: degraded, message: "Another skill is also named '{skill_name}' ({duplicate_paths}); OpenCode picks a random one each run (concurrent loading, last write wins).", fix: "Give each skill a unique name.", confidence: high}
+ - {id: OC-USER-COPY, when: "user_copy", effect: advisory, message: "A skill also named '{skill_name}' is installed at {user_copy_paths}; OpenCode uses this project copy, not that one.", fix: "Remove one copy, or give each a unique name.", confidence: high}
- {id: OC-RELOAD, when: "always", effect: advisory, message: "Skill list and text are cached at startup; edits need a restart.", confidence: medium}
- {id: OC-ALLOWED-TOOLS, when: "allowed_tools_shape != 'none'", effect: advisory, message: "allowed-tools is ignored by OpenCode.", fix: "Don't rely on allowed-tools to restrict tools; use the harness's permission settings.", confidence: high}
- {id: OC-CASING, when: "not manifest_name_exact", effect: degraded, message: "Non-canonical name (skill.md/Skill.md): loaded on case-insensitive filesystems (macOS default APFS, 3/3), ignored on case-sensitive Linux (3/3). Works or breaks depending on the OS.", fix: "Rename the file to SKILL.md (exact casing).", confidence: high}
diff --git a/src/skillevaluator/harness/report.py b/src/skillevaluator/harness/report.py
index fe5ee4ce..d31e9dc3 100644
--- a/src/skillevaluator/harness/report.py
+++ b/src/skillevaluator/harness/report.py
@@ -270,7 +270,7 @@ def run_harness_check(
)
console.print()
block[f"{target} (plugin)"] = rows
- all_facts = facts_for(skills)
+ all_facts = facts_for(skills, profiles)
for skill in skills:
rows: list[dict[str, Any]] = [{"harness": p["harness"], "status": "pending"} for p in profiles]
diff --git a/src/skillevaluator/validators/harness.py b/src/skillevaluator/validators/harness.py
index 2c433ae2..713a94b2 100644
--- a/src/skillevaluator/validators/harness.py
+++ b/src/skillevaluator/validators/harness.py
@@ -39,7 +39,7 @@ class HarnessValidator(ValidatorBase):
skills = [skill_path] if self._is_skill_directory(skill_path) else self._find_all_skills(skill_path)
result = ValidationResult(validator_name=self.name, validator_description=self.description)
block: dict[str, list[dict]] = {}
- for skill, facts in facts_for(skills).items():
+ for skill, facts in facts_for(skills, profiles).items():
rows = [evaluate_profile(profile, facts, self.config) for profile in profiles]
block[str(skill)] = [row.to_dict() for row in rows]
for row in rows:
diff --git a/tests/harness/test_overlay.py b/tests/harness/test_overlay.py
index 530cb910..7e279bc3 100644
--- a/tests/harness/test_overlay.py
+++ b/tests/harness/test_overlay.py
@@ -11,7 +11,7 @@ import pytest
from click.testing import CliRunner
from skillevaluator.cli import cli
-from skillevaluator.harness import HARNESS_STATUSES, evaluate_harnesses, facts_for, load_profiles, skill_facts
+from skillevaluator.harness import HARNESS_STATUSES, evaluate_harnesses, facts_for, load_profiles, overlay, skill_facts
from skillevaluator.harness.overlay import PROFILES_DIR
from skillevaluator.harness.report import harness_block, harness_note, harness_panel
from skillevaluator.models.result import Severity
@@ -459,6 +459,158 @@ def test_reload_guidance_reaches_findings(tmp_path: Path):
assert {r["status"] for r in rows.values()} == {"loads"}
+def test_user_level_copy_of_a_project_skill_is_flagged(tmp_path: Path, monkeypatch: pytest.MonkeyPatch):
+ home, project = tmp_path / "home", tmp_path / "project"
+ monkeypatch.setattr(Path, "home", lambda: home)
+ for folder in (project / ".claude/skills", home / ".claude/skills", home / ".agents/skills"):
+ (folder / "report").mkdir(parents=True)
+ (folder / "report" / "SKILL.md").write_text(
+ f"---\nname: report\ndescription: Use when testing copies.\n---\n{BODY}"
+ )
+ rows = _rows(project / ".claude/skills/report")
+
+ copies = {
+ h: next((f["message"] for f in r["findings"] if f["id"].endswith("-USER-COPY")), "") for h, r in rows.items()
+ }
+ assert "~/.claude/skills/report; Claude Code uses that user-level copy" in copies["claude-code"]
+ assert "~/.agents/skills/report; Copilot CLI uses this project copy" in copies["copilot-cli"]
+ assert "~/.agents/skills/report, ~/.claude/skills/report" in copies["opencode"]
+ assert copies["codex"] == copies["hermes"] == copies["openclaw"] == ""
+ assert not _rows(home / ".claude/skills/report")["claude-code"]["findings"]
+
+
+def test_only_the_user_roots_a_harness_reads_are_searched(tmp_path: Path, monkeypatch: pytest.MonkeyPatch):
+ home = tmp_path / "home"
+ monkeypatch.setattr(Path, "home", lambda: home)
+ searched = []
+ find_skills = overlay._find_skills
+ monkeypatch.setattr(overlay, "_find_skills", lambda folder: searched.append(folder) or find_skills(folder))
+ for folder in (home / ".claude" / "skills", home / ".codex" / "skills", home / ".agents" / "skills"):
+ _install(folder, "report")
+ skill = _install(tmp_path / "project" / ".claude" / "skills", "report")
+
+ evaluate_harnesses(skill, "claude-code")
+
+ assert [f for f in searched if home in f.parents] == [home / ".claude" / "skills"]
+
+
+def test_unreadable_user_skill_does_not_abort_the_check(tmp_path: Path, monkeypatch: pytest.MonkeyPatch):
+ home = tmp_path / "home"
+ monkeypatch.setattr(Path, "home", lambda: home)
+ _install(home / ".claude" / "skills", "broken")
+ _install(home / ".claude" / "skills", "report")
+ read_manifest = overlay._read_manifest
+
+ def read(path: Path):
+ if path.name == "broken":
+ raise PermissionError(13, "Permission denied")
+ return read_manifest(path)
+
+ monkeypatch.setattr(overlay, "_read_manifest", read)
+ skill = _install(tmp_path / "project" / ".claude" / "skills", "report")
+
+ rows = _rows(skill)
+
+ assert "CC-USER-COPY" in _ids(rows, "claude-code")
+
+
+def test_user_copy_in_a_folder_the_harness_does_not_scan_is_not_flagged(
+ tmp_path: Path, monkeypatch: pytest.MonkeyPatch
+):
+ home, project = tmp_path / "home", tmp_path / "project"
+ monkeypatch.setattr(Path, "home", lambda: home)
+ _install(home / ".claude" / "skills" / "group", "report")
+ _install(home / ".codex" / "skills" / "a" / "b" / "c" / "d" / "e" / "f", "report") # six folders down: past Codex
+ claude = _install(project / ".claude" / "skills", "report")
+ codex = _install(project / ".codex" / "skills", "report")
+
+ claude_rows, codex_rows = _rows(claude), _rows(codex)
+
+ assert "CC-USER-COPY" not in _ids(claude_rows, "claude-code")
+ opencode = next(f["message"] for f in claude_rows["opencode"]["findings"] if f["id"] == "OC-USER-COPY")
+ assert "~/.claude/skills/group/report" in opencode
+ assert "CX-USER-COPY" not in _ids(codex_rows, "codex")
+
+
+def _custom_grouping_profile(tmp_path: Path, grouping: str) -> Path:
+ profiles = tmp_path / "profiles"
+ profiles.mkdir()
+ (profiles / "acme.yaml").write_text(
+ "harness: acme\n"
+ "roots: {project: [.claude/skills], user: [~/.claude/skills]}\n"
+ "rules:\n"
+ f' - {{id: AC-GROUPING, when: "{grouping}", effect: not_loaded, message: "Grouping is not searched."}}\n'
+ ' - {id: AC-USER-COPY, when: "user_copy", effect: advisory, message: "Also at {user_copy_paths}."}\n',
+ encoding="utf-8",
+ )
+ return profiles
+
+
+def _custom_user_copies(
+ tmp_path: Path, monkeypatch: pytest.MonkeyPatch, grouping: str, config: dict | None = None
+) -> set[str]:
+ home = tmp_path / "home"
+ monkeypatch.setattr(Path, "home", lambda: home)
+ _install(home / ".claude" / "skills", "report")
+ _install(home / ".claude" / "skills" / "group", "report")
+ skill = _install(tmp_path / "project" / ".claude" / "skills", "report")
+ profiles = _custom_grouping_profile(tmp_path, grouping)
+
+ (result,) = evaluate_harnesses(skill, "acme", profiles, config)
+
+ message = next((f["message"] for f in result.findings if f["id"] == "AC-USER-COPY"), "")
+ return set(message.removeprefix("Also at ").removesuffix(".").split(", ")) - {""}
+
+
+def test_custom_grouping_rule_can_name_roots_when_looking_for_a_user_copy(
+ tmp_path: Path, monkeypatch: pytest.MonkeyPatch
+):
+ both = {"~/.claude/skills/report", "~/.claude/skills/group/report"}
+
+ # The rule is read for the user copy's root: it hides the grouped copy and keeps the direct one.
+ user_rule = "install_root in roots.user and grouping_depth > 0"
+ assert _custom_user_copies(tmp_path / "user", monkeypatch, user_rule) == {"~/.claude/skills/report"}
+ # A project-only rule says nothing about a copy in a user root, even though the project skill sits in a project root.
+ project_rule = "install_root in roots.project and grouping_depth > 0"
+ assert _custom_user_copies(tmp_path / "project", monkeypatch, project_rule) == both
+
+
+def test_custom_grouping_rule_can_name_the_configuration_when_looking_for_a_user_copy(
+ tmp_path: Path, monkeypatch: pytest.MonkeyPatch
+):
+ rule = "custom_provider and grouping_depth > 0"
+
+ hidden = _custom_user_copies(tmp_path / "hidden", monkeypatch, rule, {"custom_provider": True})
+ shown = _custom_user_copies(tmp_path / "shown", monkeypatch, rule)
+
+ assert hidden == {"~/.claude/skills/report"}
+ assert shown == {"~/.claude/skills/report", "~/.claude/skills/group/report"}
+
+
+def test_unevaluable_grouping_rule_does_not_stop_the_user_copy_lookup():
+ rule = {"id": "X", "when": "grouping_depth > 0 and nope", "effect": "not_loaded"}
+ profile = {"harness": "acme", "roots": {}, "rules": [rule]}
+ names = overlay._rule_names(profile, {"install_root": None, "catalog_size": 0}, {"native_root": False})
+
+ assert overlay._finds_at_depth(profile, names, "~/.claude/skills", 1)
+
+
+def test_openclaw_workspace_skill_is_checked_against_both_user_roots(tmp_path: Path, monkeypatch: pytest.MonkeyPatch):
+ home, project = tmp_path / "home", tmp_path / "project"
+ monkeypatch.setattr(Path, "home", lambda: home)
+ for folder in (home / ".agents" / "skills", home / ".openclaw" / "skills", home / ".claude" / "skills"):
+ _install(folder, "report")
+ workspace = _install(project / "skills", "report")
+ loose = _install(project / "loose", "report")
+
+ rows = _rows(workspace)
+
+ message = next(f["message"] for f in rows["openclaw"]["findings"] if f["id"] == "OW-USER-COPY")
+ assert "~/.agents/skills/report, ~/.openclaw/skills/report;" in message
+ assert not any(f["id"].endswith("-USER-COPY") for h, r in rows.items() if h != "openclaw" for f in r["findings"])
+ assert facts_for([loose])[loose]["user_copies"] == []
+
+
def test_claude_listing_cut_counts_when_to_use(tmp_path: Path):
desc = "Use when building reports."
over = _rows(_skill(tmp_path / "over", extra=f"when_to_use: {'w' * 1520}\n", desc=desc))["claude-code"]