From fa6ed5d55827b3705f928989063a16a324d6cb1e Mon Sep 17 00:00:00 2001 From: Christopher Kevin Date: Fri, 13 Nov 2026 23:11:24 +0000 Subject: [PATCH 01/11] feat(harness): measure a skill with the skills installed beside it Signed-off-by: Christopher Kevin --- CHANGELOG.md | 4 + docs/tier1-validation.mdx | 2 + src/skillevaluator/harness/__init__.py | 2 + src/skillevaluator/harness/overlay.py | 105 +++++++++++++++++- .../harness/profiles/claude-code.yaml | 5 +- .../harness/profiles/codex.yaml | 4 +- .../harness/profiles/copilot-cli.yaml | 3 + .../harness/profiles/hermes.yaml | 1 + .../harness/profiles/openclaw.yaml | 4 + .../harness/profiles/opencode.yaml | 2 + src/skillevaluator/harness/report.py | 13 +++ tests/harness/test_overlay.py | 90 ++++++++++++++- 12 files changed, 226 insertions(+), 9 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 194f35839..ee49aa083 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,10 @@ 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. +- The `harness` check measures a skill together with the skills installed beside + it: list budgets (scaled by the context window), duplicate names and which copy + each harness uses, and OpenClaw's prompt cap and compact list. A `catalog` line + in the panel names the folder measured. - `harness` rules for where `SKILL.md` lives: casing, nested manifests, symlinked manifests and resources, OpenClaw symlink escapes, Codex scan depth, and files Hermes leaves out of its file list. Tier 1 `schema` now reports a symlinked or diff --git a/docs/tier1-validation.mdx b/docs/tier1-validation.mdx index 115dff461..d860a2c7c 100644 --- a/docs/tier1-validation.mdx +++ b/docs/tier1-validation.mdx @@ -282,6 +282,8 @@ For `validate`, the default set is `schema`, `version`, `security`, `pii`, `lice Description rules: missing or empty descriptions, Claude Code and Codex listing cuts, Copilot CLI's 1,024 UTF-16 unit limit, quotes escaped in the Copilot CLI and OpenClaw lists, and Hermes's 60-character listing. `-v` also shows the description each harness puts in the model's skill list. Location rules: `SKILL.md` casing, nested manifests, symlinked manifests and resources, OpenClaw symlink escapes, Codex scan depth, and files Hermes leaves out of its file list (outside `references/`, `templates/`, `assets/` and `scripts/`). + + The check measures the skill together with the skills installed next to it. A single skill under a harness root such as `.claude/skills` is counted with everything in that folder; a folder of skills is its own catalog. That drives the list-budget rules (Claude Code and Codex ~8,000 description chars, Copilot 32 full descriptions, OpenClaw 150 skills or 18,000 chars) and a duplicate-name rule per harness that says which copy wins. A `catalog` line in the panel names the folder. diff --git a/src/skillevaluator/harness/__init__.py b/src/skillevaluator/harness/__init__.py index 07472d2c9..7ae4771d3 100644 --- a/src/skillevaluator/harness/__init__.py +++ b/src/skillevaluator/harness/__init__.py @@ -10,6 +10,7 @@ from skillevaluator.harness.overlay import ( HARNESS_STATUSES, + Catalog, HarnessResult, evaluate_harnesses, evaluate_profile, @@ -22,6 +23,7 @@ __all__ = [ "HARNESS_STATUSES", + "Catalog", "HarnessResult", "evaluate_harnesses", "evaluate_profile", diff --git a/src/skillevaluator/harness/overlay.py b/src/skillevaluator/harness/overlay.py index 515f6de27..3dd0ffae8 100644 --- a/src/skillevaluator/harness/overlay.py +++ b/src/skillevaluator/harness/overlay.py @@ -13,7 +13,12 @@ import yaml -from skillevaluator.constants import DESCRIPTION_TRIGGER_PATTERN, SKILL_MANIFEST_VARIANTS, SKILL_NOT_SHIPPED_DIRS +from skillevaluator.constants import ( + DESCRIPTION_TRIGGER_PATTERN, + SCAN_EXCLUDED_DIRS, + SKILL_MANIFEST_VARIANTS, + SKILL_NOT_SHIPPED_DIRS, +) from skillevaluator.validators.frontmatter_parser import FRONTMATTER_PATTERN from skillevaluator.validators.schema import _duplicate_frontmatter_keys @@ -70,6 +75,7 @@ class HarnessResult: verified_date: str findings: list[dict[str, str]] = field(default_factory=list) listed: dict[str, Any] = field(default_factory=dict) + catalog: dict[str, Any] = field(default_factory=dict) def to_dict(self) -> dict[str, Any]: return { @@ -80,6 +86,7 @@ def to_dict(self) -> dict[str, Any]: "verified_version": self.version, "verified_date": self.verified_date, "findings": self.findings, + "catalog": self.catalog, } @@ -205,8 +212,12 @@ def _bundle_facts(skill_path: Path, manifest: Path) -> dict[str, Any]: } -def skill_facts(skill_path: Path) -> dict[str, Any]: - """Compute the facts profile rules refer to.""" +def skill_facts(skill_path: Path, catalog: Catalog | None = None) -> dict[str, Any]: + """Compute the facts profile rules refer to (see profiles README). + + ``catalog`` describes the other skills installed alongside this one; without it the + catalog facts are zero and catalog rules are skipped. + """ manifest, raw, text, fm_yaml, data = _read_manifest(skill_path) description = data.get("description") trigger = _TRIGGER_RE.search(description) if isinstance(description, str) else None @@ -224,6 +235,7 @@ def skill_facts(skill_path: Path) -> dict[str, Any]: ) custom = {k: v for k, v in data.items() if str(k) not in _KNOWN_FIELDS} name = _skill_name(skill_path, data) + duplicates = catalog.duplicates(skill_path, name) if catalog else [] return { "skill_name": name, "description_text": description if isinstance(description, str) else "", @@ -251,12 +263,68 @@ def skill_facts(skill_path: Path) -> dict[str, Any]: "description_over": max(0, (len(description) if isinstance(description, str) else 0) - 1024), "utf16_over": max(0, (_utf16_units(description)) - 1024), **_bundle_facts(skill_path, manifest), + "catalog_size": catalog.size if catalog else 0, + "catalog_desc_chars": catalog.desc_chars if catalog else 0, + "catalog_base": str(catalog.base) if catalog and catalog.base else "", + "duplicate_name": bool(duplicates), + "duplicate_paths": ", ".join(duplicates[:3]), + } + + +@dataclass +class Catalog: + """The skills installed together in one folder: what list budgets and name clashes depend on.""" + + names: dict[Path, str] + size: int + desc_chars: int + base: Path | None = None + + @classmethod + def of(cls, skills: list[Path], base: Path | None = None) -> Catalog: + names, chars = {}, 0 + for skill in skills: + _, _, _, _, data = _read_manifest(skill) + names[skill.resolve()] = _skill_name(skill, data) + description = data.get("description") + chars += len(description) if isinstance(description, str) else 0 + return cls(names=names, size=len(skills), desc_chars=chars, base=base) + + def duplicates(self, skill: Path, name: str) -> list[str]: + own = skill.resolve() + return [self._display(other) for other, other_name in self.names.items() if other != own and other_name == name] + + def _display(self, path: Path) -> str: + base = (self.base or path.parent).resolve() + return path.relative_to(base).as_posix() if base in path.parents else str(path) + + +def _find_skills(folder: Path) -> list[Path]: + found = { + p.parent + for n in SKILL_MANIFEST_VARIANTS + for p in folder.rglob(n) + if not any(part in SCAN_EXCLUDED_DIRS for part in p.relative_to(folder).parts) } + return sorted(s for s in found if not any(parent in found for parent in s.parents)) def facts_for(skills: list[Path]) -> dict[Path, dict[str, Any]]: - """Facts per skill.""" - return {skill: skill_facts(skill) for skill in skills} + """Facts per skill, with the catalog they are installed in. + + Several skills form their own catalog. A single skill under a known skills folder + (e.g. ``.claude/skills``) is measured against everything installed in that folder. + """ + members, base = skills, None + if len(skills) == 1: + root, depth = _install_root(skills[0]) + if root is not None: + base = skills[0].absolute().parents[depth] + members = _find_skills(base) or skills + elif skills: + base = Path(os.path.commonpath([s.resolve() for s in skills])) + catalog = Catalog.of(members, base) + return {skill: skill_facts(skill, catalog) for skill in skills} def _utf16_units(value: Any) -> int: @@ -267,12 +335,19 @@ def listed_description(profile: dict[str, Any], facts: dict[str, Any]) -> dict[s """What the profile says this harness puts in the model's skill list for the description.""" listing = profile.get("listing") or {} text = facts["description_text"] + budget = listing.get("budget") or {} + over_budget = facts["catalog_size"] and ( + facts["catalog_desc_chars"] > (facts.get("list_budget_chars") or budget.get("desc_chars", float("inf"))) + or facts["catalog_size"] > budget.get("skills", float("inf")) + ) limit = listing.get("drop_over_utf16") if limit and facts["description_utf16_units"] > limit: return {"mode": "dropped", "text": ""} if not text or (listing.get("name_only_over") and len(text) > listing["name_only_over"]): return {"mode": "name_only", "text": ""} - cut = listing.get("cut") + cut = budget.get("cut") if over_budget else listing.get("cut") + if over_budget and not cut: + return {"mode": "shortened", "text": ""} if cut and len(text) > cut: return {"mode": "cut", "text": text[:cut], "limit": cut} return {"mode": "full", "text": text} @@ -378,6 +453,16 @@ def model_config(profile: dict[str, Any], config: dict[str, Any] | None = None) } +def listing_budget_chars(profile: dict[str, Any], context_tokens: int) -> int: + """Characters the harness reserves for the skill list: a share of the context window when the profile + gives ``chars_per_context_token`` and the window is known, else the fixed ``desc_chars`` (0 = no budget).""" + budget = (profile.get("listing") or {}).get("budget") or {} + per_token = budget.get("chars_per_context_token") + if per_token and context_tokens: + return int(context_tokens * per_token) + return int(budget.get("desc_chars", 0)) + + def evaluate_profile( profile: dict[str, Any], facts: dict[str, Any], config: dict[str, Any] | None = None ) -> HarnessResult: @@ -390,6 +475,7 @@ def evaluate_profile( 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)} findings: list[dict[str, str]] = [] worst = -1 @@ -397,6 +483,8 @@ def evaluate_profile( 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): continue if expression == "always" and rule["effect"] == "advisory": @@ -417,6 +505,11 @@ def evaluate_profile( verified_date=str(verified.get("date", "")), findings=findings, listed=listed_description(profile, facts), + catalog={ + "size": facts["catalog_size"], + "desc_chars": facts["catalog_desc_chars"], + "folder": facts["catalog_base"], + }, ) diff --git a/src/skillevaluator/harness/profiles/claude-code.yaml b/src/skillevaluator/harness/profiles/claude-code.yaml index 3099d755a..d061008d3 100644 --- a/src/skillevaluator/harness/profiles/claude-code.yaml +++ b/src/skillevaluator/harness/profiles/claude-code.yaml @@ -5,11 +5,14 @@ roots: project: [.claude/skills] user: [~/.claude/skills] not_scanned: [.agents/skills, ~/.agents/skills] -listing: {cut: 1536} +listing: {cut: 1536, budget: {desc_chars: 8000, chars_per_context_token: 0.04}} rules: - {id: CC-ROOT, when: "install_root not in roots", effect: not_loaded, outcome: not found, message: "Claude Code reads only .claude/skills and ~/.claude/skills; .agents/skills is not scanned.", fix: "Install it under .claude/skills or ~/.claude/skills (a symlink from .agents/skills works)."} + - {id: CC-GROUPING, when: "grouping_depth > 0", effect: not_loaded, outcome: not found, message: "Claude Code finds skills only directly under the skills folder; grouping folders are not searched.", fix: "Move the skill folder directly under .claude/skills."} - {id: CC-DESC-CUT, when: "description_codepoints > 1536", effect: degraded, outcome: listing shortened, message: "Description cut at 1,536 characters.", fix: "Keep the description at or under 1,536 characters."} - {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."} + - {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."} + - {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."} - {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."} - {id: CC-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)."} - {id: CC-FM-STRIPPED, when: "custom_field_chars > 200", effect: advisory, message: "Frontmatter is stripped when the skill is used, so the text in {custom_fields} never reaches the model.", fix: "Move instructions from frontmatter into the SKILL.md body."} diff --git a/src/skillevaluator/harness/profiles/codex.yaml b/src/skillevaluator/harness/profiles/codex.yaml index 3a13ee90c..9c9ecb277 100644 --- a/src/skillevaluator/harness/profiles/codex.yaml +++ b/src/skillevaluator/harness/profiles/codex.yaml @@ -5,7 +5,7 @@ roots: project: [.agents/skills, .codex/skills] user: [~/.agents/skills, ~/.codex/skills] limits: {scan_depth: 6, skips_hidden_dirs: true, catalog_desc_codepoints: 1024, list_budget: "2% of context, 8,000 chars if unknown, max 10,000 tokens"} -listing: {cut: 1024} +listing: {cut: 1024, budget: {desc_chars: 8000, chars_per_context_token: 0.08}} rules: - {id: CX-ROOT, when: "install_root not in roots", effect: not_loaded, outcome: not found, message: "Codex reads .agents/skills and .codex/skills (project and user).", fix: "Install it under .agents/skills or .codex/skills."} - {id: CX-DESC-CUT, when: "description_codepoints > 1024", effect: degraded, outcome: listing shortened, message: "Description cut to 1,021 chars + '...' in the skill list ({description_codepoints} chars, {description_over} over 1,024).", fix: "Cut the description by at least {description_over} characters."} @@ -15,6 +15,8 @@ rules: - {id: CX-NESTED, when: "nested_skill_md_exact", effect: degraded, message: "The nested SKILL.md is loaded as a second, separate skill.", fix: "Move the nested skill to its own folder under the skills root, or rename its SKILL.md."} - {id: CX-DEPTH, when: "grouping_depth > 5", effect: not_loaded, outcome: not found, message: "Beyond Codex's scan depth of 6.", fix: "Install the skill at most 5 folders below the skills root."} - {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)."} + - {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."} + - {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."} - {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)."} notes: - "Explicit $skill injects the whole SKILL.md (145 KB tested)." diff --git a/src/skillevaluator/harness/profiles/copilot-cli.yaml b/src/skillevaluator/harness/profiles/copilot-cli.yaml index d54dec537..ae73da7c4 100644 --- a/src/skillevaluator/harness/profiles/copilot-cli.yaml +++ b/src/skillevaluator/harness/profiles/copilot-cli.yaml @@ -11,8 +11,11 @@ rules: - {id: CP-STRICT-YAML, when: "frontmatter_tab_indent or frontmatter_duplicate_keys or description_type not in ['str', 'none']", effect: not_loaded, message: "Skill dropped: Copilot's YAML parsing is strict.", fix: "Use spaces, not tabs, remove duplicate keys, and make the description a string."} - {id: CP-NO-FRONTMATTER, when: "frontmatter_missing", effect: not_loaded, outcome: not found, message: "Skill dropped: a SKILL.md with no front matter, or an unclosed one, is not registered ('Skill not found'; canary pair 3/3, drift NOCLOSE canary in 4 releases, Trial I 2/2).", fix: "Add front matter with a name and a description."} - {id: CP-DESC-MISSING, when: "description_missing", effect: degraded, message: "No description: Copilot shows body text instead.", fix: "Add a non-empty string description."} + - {id: CP-LIST-BUDGET, when: "catalog_size > 32", effect: advisory, outcome: listing shortened, message: "{catalog_size} skills here: Copilot gives full descriptions to the first 32 only; the rest are listed by name.", fix: "Keep 32 or fewer skills in one place, or make names self-explanatory."} - {id: CP-NESTED, when: "nested_skill_md", effect: advisory, message: "Nested SKILL.md is ignored.", fix: "Move the nested skill to its own folder under the skills root, or rename its SKILL.md."} + - {id: CP-RELOAD, when: "always", effect: advisory, message: "New skills appear only after `/skills reload` or a restart; edits to existing skills apply at once."} - {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)."} + - {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."} - {id: CP-FM-STRIPPED, when: "custom_field_chars > 200", effect: advisory, message: "Frontmatter is stripped when the skill is used, so the text in {custom_fields} never reaches the model.", fix: "Move instructions from frontmatter into the SKILL.md body."} - {id: CP-DESC-ESCAPED, when: "description_has_quote", effect: advisory, outcome: text rewritten, message: "Double quotes in the description are shown to the model as " in the skill list.", fix: "Use single quotes in the description if the exact text matters."} notes: diff --git a/src/skillevaluator/harness/profiles/hermes.yaml b/src/skillevaluator/harness/profiles/hermes.yaml index 41a6c518e..fe2d5c4b4 100644 --- a/src/skillevaluator/harness/profiles/hermes.yaml +++ b/src/skillevaluator/harness/profiles/hermes.yaml @@ -16,6 +16,7 @@ rules: - {id: HM-SYMLINK-FILE, when: "skill_md_symlink", effect: not_loaded, message: "Symlinked SKILL.md files are not loaded.", fix: "Copy SKILL.md into the folder instead of symlinking the file (a symlinked folder works)."} - {id: HM-DUP-KEY, when: "frontmatter_duplicate_keys", effect: advisory, message: "Duplicate keys: last value wins.", fix: "Remove the duplicate frontmatter key."} - {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)."} + - {id: HM-DUP-NAME, when: "duplicate_name", effect: advisory, message: "Another skill is also named '{skill_name}' ({duplicate_paths}); Hermes uses one: project, then ~/.hermes/skills.", fix: "Give each skill a unique name."} - {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."} - {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/."} notes: diff --git a/src/skillevaluator/harness/profiles/openclaw.yaml b/src/skillevaluator/harness/profiles/openclaw.yaml index 0039f720b..4af804817 100644 --- a/src/skillevaluator/harness/profiles/openclaw.yaml +++ b/src/skillevaluator/harness/profiles/openclaw.yaml @@ -5,14 +5,18 @@ roots: project: [skills, .agents/skills] user: [~/.agents/skills, ~/.openclaw/skills] limits: {max_skills_in_prompt: 150, max_prompt_chars: 18000, compact_desc_chars: 220, max_skill_file_bytes: 256000, read_budget: "16,000-64,000 weighted chars of the skills_read result by model context"} +listing: {budget: {skills: 150, desc_chars: 18000, cut: 220}} rules: - {id: OW-ROOT, when: "install_root not in roots", effect: not_loaded, outcome: not found, message: "OpenClaw reads skills/, .agents/skills, ~/.agents/skills and ~/.openclaw/skills.", fix: "Install it under skills/ or .agents/skills in the workspace, or ~/.openclaw/skills."} - {id: OW-DESC-MISSING, when: "description_missing or description_empty", effect: not_loaded, outcome: rejected, message: "Skill dropped: no description.", fix: "Add a non-empty string description."} - {id: OW-STRICT-YAML, when: "frontmatter_tab_indent or frontmatter_duplicate_keys", effect: not_loaded, outcome: rejected, message: "Skill dropped: invalid YAML (tabs or duplicate keys).", fix: "Use spaces, not tabs, and remove duplicate keys."} - {id: OW-SYMLINK-ESCAPE, when: "skill_dir_symlink_target == 'outside_root'", effect: not_loaded, message: "Symlink target is outside the skills root (even inside the repo): rejected.", fix: "Copy the skill into the skills folder instead of symlinking it from elsewhere."} - {id: OW-SYMLINK-FILE, when: "skill_md_symlink", effect: not_loaded, message: "Symlinked SKILL.md files are not loaded.", fix: "Copy SKILL.md into the folder instead of symlinking the file (a symlinked folder works)."} + - {id: OW-COMPACT, when: "description_codepoints > 220 and (catalog_size > 150 or catalog_desc_chars > 18000)", effect: degraded, outcome: listing shortened, message: "{catalog_size} skills / {catalog_desc_chars} description chars here: over 150 skills or 18,000 chars, OpenClaw cuts descriptions to 220 chars.", fix: "Keep the description under 220 characters, trigger first."} - {id: OW-NESTED, when: "nested_skill_md", effect: advisory, message: "Nested SKILL.md is ignored.", fix: "Move the nested skill to its own folder under the skills root, or rename its SKILL.md."} - {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)."} + - {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."} + - {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."} - {id: OW-DESC-ESCAPED, when: "description_has_quote", effect: advisory, outcome: text rewritten, message: "Double quotes in the description are shown to the model as " in the skill list.", fix: "Use single quotes in the description if the exact text matters."} notes: - "Precedence: workspace skills/ > .agents/skills > ~/.agents/skills > managed > bundled > extra dirs (project wins, 3/3)." diff --git a/src/skillevaluator/harness/profiles/opencode.yaml b/src/skillevaluator/harness/profiles/opencode.yaml index 6bc5c0ce8..dd0e1d437 100644 --- a/src/skillevaluator/harness/profiles/opencode.yaml +++ b/src/skillevaluator/harness/profiles/opencode.yaml @@ -13,6 +13,8 @@ rules: - {id: OC-DESC-EMPTY, when: "description_empty", effect: degraded, message: "Listed by name only.", fix: "Add a non-empty string description."} - {id: OC-DUP-KEY, when: "frontmatter_duplicate_keys", effect: not_loaded, outcome: rejected, message: "Skill dropped: duplicate frontmatter keys.", fix: "Remove the duplicate frontmatter key."} - {id: OC-NESTED, when: "nested_skill_md", effect: degraded, message: "The nested SKILL.md is loaded as a second, separate skill.", fix: "Move the nested skill to its own folder under the skills root, or rename its SKILL.md."} + - {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."} + - {id: OC-RELOAD, when: "always", effect: advisory, message: "Skill list and text are cached at startup; edits need a restart."} - {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)."} - {id: OC-FM-STRIPPED, when: "custom_field_chars > 200", effect: advisory, message: "Frontmatter is stripped when the skill is used, so the text in {custom_fields} never reaches the model.", fix: "Move instructions from frontmatter into the SKILL.md body."} notes: diff --git a/src/skillevaluator/harness/report.py b/src/skillevaluator/harness/report.py index 6bd536275..53129cf85 100644 --- a/src/skillevaluator/harness/report.py +++ b/src/skillevaluator/harness/report.py @@ -110,6 +110,16 @@ def _compact_grid(rows: list[dict[str, Any]]) -> Table | None: return grid if grid.row_count else None +def _catalog_line(rows: list[dict[str, Any]]) -> Text | None: + catalog = next((row["catalog"] for row in rows if row.get("catalog")), None) + if not catalog or catalog["size"] < 2: + return None + folder = catalog["folder"].replace(str(Path.home()), "~", 1) if catalog["folder"] else "this folder" + return Text.assemble( + ("catalog ", MUTED), (f"{catalog['size']} skills in {folder} ({catalog['desc_chars']:,} desc chars)", TEXT) + ) + + def _detail_grid(rows: list[dict[str, Any]], verbose: bool) -> Table | None: """Every finding with its fix, under a line naming the harness, its status and verified version.""" grid = Table.grid(padding=(0, 2), expand=True) @@ -189,6 +199,9 @@ def harness_panel( for skill, rows in block.items(): if parts: parts.append(Text()) + catalog = _catalog_line(rows) + if catalog is not None: + parts.extend([catalog, Text()]) parts.append(_summary_line(rows, f"{Path(skill).name} " if many else "")) grid = _detail_grid(rows, verbose) if verbose else _compact_grid(rows) if grid is not None: diff --git a/tests/harness/test_overlay.py b/tests/harness/test_overlay.py index 701dba3d3..18b350d97 100644 --- a/tests/harness/test_overlay.py +++ b/tests/harness/test_overlay.py @@ -3,13 +3,14 @@ """Tests for the advisory harness check, panel and harness-check command.""" import json +import re from pathlib import Path import pytest from click.testing import CliRunner from skillevaluator.cli import cli -from skillevaluator.harness import HARNESS_STATUSES, evaluate_harnesses, load_profiles, skill_facts +from skillevaluator.harness import HARNESS_STATUSES, evaluate_harnesses, facts_for, load_profiles, 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 @@ -313,6 +314,16 @@ def test_harness_check_command_rejects_unknown_harness(tmp_path: Path): assert "Unknown harness: nope" in result.output +def _catalog(root: Path, count: int, desc_len: int = 300) -> Path: + skills = root / ".claude" / "skills" + for index in range(count): + skill = skills / f"filler-{index:03d}" + skill.mkdir(parents=True) + desc = ("Use when testing catalog budgets. " + "x" * desc_len)[:desc_len] + (skill / "SKILL.md").write_text(f"---\nname: filler-{index:03d}\ndescription: {desc}\n---\n{BODY}") + return skills + + def _rows(skill: Path) -> dict[str, dict]: return {r.harness: r.to_dict() for r in evaluate_harnesses(skill)} @@ -321,6 +332,61 @@ def _ids(rows: dict[str, dict], harness: str) -> set[str]: return {f["id"] for f in rows[harness]["findings"]} +def test_single_skill_is_measured_against_its_installed_folder(tmp_path: Path): + _catalog(tmp_path, 40) + rows = _rows(tmp_path / ".claude" / "skills" / "filler-000") + + assert rows["claude-code"]["status"] == "degraded" + assert "CC-LIST-BUDGET" in _ids(rows, "claude-code") + assert "CP-LIST-BUDGET" in _ids(rows, "copilot-cli") + message = next(f["message"] for f in rows["claude-code"]["findings"] if f["id"] == "CC-LIST-BUDGET") + assert message.startswith("The 40 skills in this folder have 12,000 description chars") + assert rows["claude-code"]["listed"] == rows["codex"]["listed"] == {"mode": "shortened", "text": ""} + assert rows["claude-code"]["catalog"]["size"] == 40 + + +def test_listing_budget_scales_with_context_window(tmp_path: Path): + skill = _catalog(tmp_path, 34) / "filler-000" + + def ids(tokens: int) -> set[str]: + rows = {r.harness: r.to_dict() for r in evaluate_harnesses(skill, config={"context_tokens": tokens})} + return _ids(rows, "claude-code") | _ids(rows, "codex") + + assert {"CC-LIST-BUDGET", "CX-LIST-BUDGET"} <= ids(0) + assert not {"CC-LIST-BUDGET", "CX-LIST-BUDGET"} & ids(272000) + assert {"CC-LIST-BUDGET", "CX-LIST-BUDGET"} & ids(200000) == {"CC-LIST-BUDGET"} + + +def test_skill_outside_a_skills_folder_has_no_catalog_rules(tmp_path: Path): + rows = _rows(_skill(tmp_path)) + + assert not any( + f["id"].endswith(("LIST-BUDGET", "DUP-NAME", "PRECEDENCE")) for r in rows.values() for f in r["findings"] + ) + + +def test_folder_of_skills_is_its_own_catalog(tmp_path: Path): + skills = _catalog(tmp_path, 3) + facts = facts_for(sorted(skills.iterdir())) + + assert {f["catalog_size"] for f in facts.values()} == {3} + assert {f["catalog_desc_chars"] for f in facts.values()} == {900} + + +def test_duplicate_names_report_each_harness_winner(tmp_path: Path): + skills = _catalog(tmp_path, 2) + copy = skills / "filler-copy" + copy.mkdir() + (copy / "SKILL.md").write_text(f"---\nname: filler-000\ndescription: Use when testing duplicates.\n---\n{BODY}") + rows = _rows(skills / "filler-000") + + assert rows["opencode"]["status"] == "degraded" + assert {"CC-PRECEDENCE", "CX-DUP-NAME", "CP-DUP-NAME", "HM-DUP-NAME", "OW-DUP-NAME", "OC-DUP-NAME"} <= { + f["id"] for r in rows.values() for f in r["findings"] + } + assert "(filler-copy)" in next(f["message"] for f in rows["opencode"]["findings"] if f["id"] == "OC-DUP-NAME") + + def test_listed_description_projection(tmp_path: Path): desc = "Use when " + "a" * 1600 rows = _rows(_skill(tmp_path, desc=desc)) @@ -346,6 +412,17 @@ def test_bundle_files_symlinks_and_large_references(tmp_path: Path): assert "HM-RESOURCE-SYMLINK" in _ids(rows, "hermes") +def test_every_rule_has_a_fix_and_placeholders_are_filled(tmp_path: Path): + for profile in load_profiles("all"): + for rule in profile["rules"]: + assert rule["when"] == "always" or rule.get("fix"), rule["id"] + skills = _catalog(tmp_path, 200, desc_len=400) + rows = _rows(skills / "filler-000") + messages = [f["message"] + f.get("fix", "") for r in rows.values() for f in r["findings"]] + assert messages and not any(re.search(r"\{[a-z0-9_]+\}", m) for m in messages) + assert {"OW-COMPACT", "OW-PROMPT-CAP"} <= _ids(rows, "openclaw") + + def test_fix_reaches_findings_and_panels(tmp_path: Path): skill = _skill(tmp_path, desc="Use when testing emoji. " + "\U0001f600" * 600) result = HarnessValidator().validate(skill) @@ -366,6 +443,17 @@ def test_description_limit_is_1024(tmp_path: Path, harness: str, rule: str): assert any(f["id"] == rule and "1 over" in f["message"] for f in over[harness]["findings"]) +def test_compact_view_shows_worst_finding_per_harness_and_catalog(tmp_path: Path): + _catalog(tmp_path, 40) + block = harness_block(run_validation(tmp_path / ".claude" / "skills" / "filler-000", checks="harness")) + compact, full = _render(harness_panel(block)), _render(harness_panel(block, verbose=True)) + + assert "catalog 40 skills in" in compact and "(12,000 desc" in compact + assert "not found" in compact and "listing shortened" in compact + assert "[CX-ROOT]" not in compact and "[CX-ROOT]" in full and "[CX-LIST-BUDGET]" in full + assert len(compact.splitlines()) < len(full.splitlines()) + + def test_tier1_summary_gives_harness_its_own_line(tmp_path: Path): results = run_validation(_rooted(tmp_path), checks="schema,harness", harness="all") _, rows = summarize_tier1(results) From 6d4ee7bbca1ca7a0e6403a8db4c06f9d4cbf47d0 Mon Sep 17 00:00:00 2001 From: Christopher Kevin Date: Fri, 13 Nov 2026 23:11:30 +0000 Subject: [PATCH 02/11] feat(harness): flag SKILL.md and files over harness delivery limits Signed-off-by: Christopher Kevin --- CHANGELOG.md | 5 + docs/tier1-validation.mdx | 3 + src/skillevaluator/constants.py | 5 + src/skillevaluator/harness/overlay.py | 90 +++++++++++++++++- .../harness/profiles/claude-code.yaml | 1 + .../harness/profiles/codex.yaml | 1 + .../harness/profiles/hermes.yaml | 1 + .../harness/profiles/openclaw.yaml | 5 + .../harness/profiles/opencode.yaml | 3 + src/skillevaluator/validators/schema.py | 18 ++++ tests/harness/test_overlay.py | 92 +++++++++++++++++++ tests/validators/test_schema.py | 22 +++++ 12 files changed, 245 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ee49aa083..8d5ccee5b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,11 @@ 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` rules for delivery limits: Claude Code's body cap, OpenCode's + 51,200-byte / 2,000-line reads and long lines, OpenClaw's whole-read and + weighted result caps, Hermes's 100,000-character `skill_view` budget and Codex's + ~10K-token shell-output cut. Tier 1 `schema` now reports `SKILL.md` size tiers + (32 KiB LOW, 50 KiB MEDIUM, 256,000 bytes HIGH). - The `harness` check measures a skill together with the skills installed beside it: list budgets (scaled by the context window), duplicate names and which copy each harness uses, and OpenClaw's prompt cap and compact list. A `catalog` line diff --git a/docs/tier1-validation.mdx b/docs/tier1-validation.mdx index d860a2c7c..0ec2034a4 100644 --- a/docs/tier1-validation.mdx +++ b/docs/tier1-validation.mdx @@ -261,6 +261,7 @@ For `validate`, the default set is `schema`, `version`, `security`, `pii`, `lice - A duplicate frontmatter key is HIGH (`duplicate_key`; several harnesses drop the skill), and a UTF-8 BOM is MEDIUM (`manifest_bom`). - A description within 1,024 characters but over 1,024 UTF-16 units is MEDIUM (`description_utf16_length`), and no "Use when ..." trigger in the first 60 characters is LOW (`description_trigger`). - A symlinked `SKILL.md` (`manifest_symlink`) or a `SKILL.md` nested inside the skill (`nested_manifest`) is MEDIUM. + - `manifest_size` is LOW above 32 KiB, MEDIUM above 50 KiB and HIGH above 256,000 bytes. - `metadata.author` is optional under the `default` profile. Use `Name ` to include a contact address, or a person, team, or organization name such as `NVIDIA cuOpt Team` or `Jane Doe (@jdoe)`. A value that is malformed or unsafe is a HIGH `author_format` finding: a bare email or an email outside `Name `, stray angle brackets, control, private-use, or bidirectional formatting characters (joiners such as ZWNJ and ZWJ, which Persian, Arabic and Devanagari names need, are accepted), no letters or digits, or more than 256 characters. A bare address counts even when its domain has no dot (`root@buildhost`), while a social handle such as `Jane Doe (@jdoe)` does not. The `registry` profile requires the `Name ` form. - `metadata.id` is an optional stable skill ID. When present it must be an exact 1–64 character lowercase ASCII slug (`^[a-z0-9]+(-[a-z0-9]+)*$`, no surrounding whitespace); it may differ from `name`. A collection run reports an ID that more than one discovered skill declares; `validate` on a catalog also lists these in `catalog-summary.json` under `metadata_id_conflicts`. Under `registry` a shared ID blocks: the run exits nonzero, and each sharing skill's entry is `"passed": false` with the conflict repeated under `catalog_findings` and counted in its `severity_counts`. A catalog validates each skill on its own, so that skill's own report was written before the catalog-wide check ran and keeps its single-skill verdict, which the entry carries alongside as `report_verdict` beside `report_scope: "single_skill"`. Uniqueness is checked only across the skills validated together, never against a registry, and a single-skill run does not claim it. The ID does not change local catalog identity, which stays keyed by content type and relative path. - `metadata.domain` accepts one category string or a list of them, such as `domain: [backend, ai-ml]`. Values are trimmed and deduplicated in order; a blank or null scalar means no domain. A list with more than 16 entries, or a non-string, blank, or over-128-character entry, is a HIGH `Field 'metadata.domain'` finding. The 128-character limit also applies to a single string. @@ -284,6 +285,8 @@ For `validate`, the default set is `schema`, `version`, `security`, `pii`, `lice Location rules: `SKILL.md` casing, nested manifests, symlinked manifests and resources, OpenClaw symlink escapes, Codex scan depth, and files Hermes leaves out of its file list (outside `references/`, `templates/`, `assets/` and `scripts/`). The check measures the skill together with the skills installed next to it. A single skill under a harness root such as `.claude/skills` is counted with everything in that folder; a folder of skills is its own catalog. That drives the list-budget rules (Claude Code and Codex ~8,000 description chars, Copilot 32 full descriptions, OpenClaw 150 skills or 18,000 chars) and a duplicate-name rule per harness that says which copy wins. A `catalog` line in the panel names the folder. + + Delivery rules: Claude Code's body cap, OpenCode's 51,200-byte / 2,000-line reads and lines over 2,000 characters, OpenClaw's whole-or-nothing read against its result caps, Hermes's 100,000-character `skill_view` budget, and Codex's ~10K-token cut when the model reads `SKILL.md` through the shell. diff --git a/src/skillevaluator/constants.py b/src/skillevaluator/constants.py index f42bbcf99..4d64333e7 100644 --- a/src/skillevaluator/constants.py +++ b/src/skillevaluator/constants.py @@ -156,6 +156,11 @@ # Skill manifest file name variants (case-insensitive search) SKILL_MANIFEST_VARIANTS = ("SKILL.md", "skill.md") +# SKILL.md size thresholds (bytes) where common agent harnesses start cutting, +# refusing, or skipping the file: 16,000-64,000 character whole-file reads, +# 50 KiB tool-output truncation, and a 256,000-byte discovery cap. +SKILL_MD_SIZE_THRESHOLDS = ((256_000, "high"), (50 * 1024, "medium"), (32 * 1024, "low")) + # Some harnesses show only the first ~60 characters of each description in # their skill list, so the "when to use" trigger should appear within it. DESCRIPTION_TRIGGER_WINDOW = 60 diff --git a/src/skillevaluator/harness/overlay.py b/src/skillevaluator/harness/overlay.py index 3dd0ffae8..9bcab0240 100644 --- a/src/skillevaluator/harness/overlay.py +++ b/src/skillevaluator/harness/overlay.py @@ -5,6 +5,7 @@ from __future__ import annotations import ast +import json import os import re from dataclasses import dataclass, field @@ -136,6 +137,64 @@ def _install_root(skill_path: Path) -> tuple[str | None, int]: return None, 0 +# OpenClaw 2026.10.9 cjk-chars.ts: CJK code points cost 4-16 chars, every other UTF-16 unit 1. +_OPENCLAW_CJK = ( + (3, ((0xB7, 0xB7), (0x3000, 0x319F), (0x4E00, 0x9FA5), (0xAC00, 0xD7AF), (0xFF01, 0xFF60))), + ( + 11, + ( + (0x1100, 0x11FF), + (0x2E80, 0x2FFF), + (0x31A0, 0x4DFF), + (0x9FA6, 0x9FFF), + (0xA000, 0xA4FF), + (0xA700, 0xA707), + (0xA960, 0xA97F), + (0xD7B0, 0xD7FF), + (0xF900, 0xFAFF), + ), + ), + ( + 7, + ( + (0x2C7, 0x2C7), + (0x2C9, 0x2CB), + (0x2D9, 0x2D9), + (0x2EA, 0x2EB), + (0x305, 0x305), + (0x323, 0x323), + (0xFE10, 0xFE4F), + (0xFF61, 0xFFDC), + (0xFFE0, 0xFFE6), + ), + ), + (10, ((0x1D360, 0x1D371),)), + ( + 14, + ( + (0x16FE0, 0x16FFF), + (0x1AFF0, 0x1AFFF), + (0x1B000, 0x1B16F), + (0x1F200, 0x1F2FF), + (0x20000, 0x2FA1F), + (0x30000, 0x3347F), + ), + ), +) +# Room OpenClaw keeps for its truncation notice; the skills_read path adds a JSON wrapper and cuts ~1% sooner. +_OPENCLAW_READ_OVERHEAD = 73 + + +def _openclaw_read_chars(text: str) -> int: + """SKILL.md size as OpenClaw's tool-result cap measures it.""" + extra = 0 + for ch in text: + cp = ord(ch) + if cp >= 0x80: + extra += next((w for w, rs in _OPENCLAW_CJK if any(a <= cp <= b for a, b in rs)), 0) + return _OPENCLAW_READ_OVERHEAD + len(text.encode("utf-16-le", "surrogatepass")) // 2 + extra + + def _read_manifest(skill_path: Path) -> tuple[Path, bytes, str, str, dict[str, Any]]: manifest = next( (skill_path / n for n in SKILL_MANIFEST_VARIANTS if (skill_path / n).exists()), skill_path / "SKILL.md" @@ -191,7 +250,7 @@ def _paths(items: list[str]) -> str: def _bundle_facts(skill_path: Path, manifest: Path) -> dict[str, Any]: base = skill_path.resolve() - links, escapes, unlisted = [], [], [] + links, escapes, sizes, long_lines, unlisted = [], [], [], [], [] for path in _bundle_files(skill_path, manifest): rel = path.relative_to(skill_path).as_posix() if path.is_symlink(): @@ -200,13 +259,28 @@ def _bundle_facts(skill_path: Path, manifest: Path) -> dict[str, Any]: if target != base and base not in target.parents: escapes.append(rel) continue + lines = path.read_bytes().decode("utf-8", "replace").splitlines() + sizes.append((rel, path.stat().st_size, len(lines))) + long_lines += [rel] * sum(len(line) > 2000 for line in lines) if rel.split("/", 1)[0] not in _HERMES_LINKED_DIRS: unlisted.append(rel) + largest = max(sizes, key=lambda item: item[1], default=("", 0, 0)) + paged = [rel for rel, size, count in sizes if size > 51200 or count > 2000] + multi_read = [rel for rel, size, _ in sizes if size > 64000] return { "resource_symlinks": len(links), "resource_symlink_paths": _paths(links), "resource_symlink_escapes": len(escapes), "resource_symlink_escape_paths": _paths(escapes), + "largest_resource": largest[0], + "largest_resource_bytes": largest[1], + "largest_resource_lines": largest[2], + "files_over_51200": len(paged), + "files_over_51200_paths": _paths(paged), + "files_over_64000": len(multi_read), + "files_over_64000_paths": _paths(multi_read), + "long_line_count": len(long_lines), + "long_line_files": _paths(list(dict.fromkeys(long_lines))), "hermes_unlisted_files": len(unlisted), "hermes_unlisted_dirs": _paths(list(dict.fromkeys(rel.split("/", 1)[0] for rel in unlisted))), } @@ -233,6 +307,8 @@ def skill_facts(skill_path: Path, catalog: Catalog | None = None) -> dict[str, A if skill_path.is_dir() else [] ) + match = FRONTMATTER_PATTERN.match(text) + body = match.group(2) if match else text custom = {k: v for k, v in data.items() if str(k) not in _KNOWN_FIELDS} name = _skill_name(skill_path, data) duplicates = catalog.duplicates(skill_path, name) if catalog else [] @@ -246,6 +322,12 @@ def skill_facts(skill_path: Path, catalog: Catalog | None = None) -> dict[str, A "nested_skill_md_exact": any(p.name == "SKILL.md" and not p.is_symlink() for p in nested), "skill_md_symlink": manifest.is_symlink(), "skill_dir_symlink_target": target, + "skill_md_bytes": len(raw), + "skill_md_lines": len(text.splitlines()), + "openclaw_read_chars": _openclaw_read_chars(text), + # OpenCode strips front matter and wraps the body before its tool-output cut. + "opencode_body_output_bytes": len(f'\n# Skill: {name}\n\n{body.strip()}'.encode()), + "opencode_body_output_lines": 3 + len(body.strip().splitlines()), "frontmatter_missing": manifest.is_file() and FRONTMATTER_PATTERN.match(text) is None, "description_missing": "description" not in data, "description_empty": isinstance(description, str) and not description.strip(), @@ -260,8 +342,14 @@ def skill_facts(skill_path: Path, catalog: Catalog | None = None) -> dict[str, A "frontmatter_tab_indent": _tab_indent_breaks_yaml(fm_yaml), "custom_fields": ", ".join(map(str, custom)), "custom_field_chars": sum(len(v) if isinstance(v, str) else len(yaml.safe_dump(v)) for v in custom.values()), + "skill_md_chars": len(text), + "skill_md_tokens": len(raw) // 4, "description_over": max(0, (len(description) if isinstance(description, str) else 0) - 1024), "utf16_over": max(0, (_utf16_units(description)) - 1024), + # Hermes skill_view returns JSON (ensure_ascii=False, budget in code points): SKILL.md + description + ~400 chars. + "hermes_view_chars": len(json.dumps(text, ensure_ascii=False)) + + len(json.dumps(description if isinstance(description, str) else "", ensure_ascii=False)) + + 400, **_bundle_facts(skill_path, manifest), "catalog_size": catalog.size if catalog else 0, "catalog_desc_chars": catalog.desc_chars if catalog else 0, diff --git a/src/skillevaluator/harness/profiles/claude-code.yaml b/src/skillevaluator/harness/profiles/claude-code.yaml index d061008d3..45915d3a2 100644 --- a/src/skillevaluator/harness/profiles/claude-code.yaml +++ b/src/skillevaluator/harness/profiles/claude-code.yaml @@ -14,6 +14,7 @@ rules: - {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."} - {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."} - {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."} + - {id: CC-BODY-CAP, when: "skill_md_bytes > 1048576", effect: not_loaded, outcome: rejected, message: "SKILL.md over 1 MB is rejected (bundle string skill_md_too_large).", fix: "Move detail into references/ files and keep SKILL.md under 1 MB."} - {id: CC-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)."} - {id: CC-FM-STRIPPED, when: "custom_field_chars > 200", effect: advisory, message: "Frontmatter is stripped when the skill is used, so the text in {custom_fields} never reaches the model.", fix: "Move instructions from frontmatter into the SKILL.md body."} notes: diff --git a/src/skillevaluator/harness/profiles/codex.yaml b/src/skillevaluator/harness/profiles/codex.yaml index 9c9ecb277..daf0c61cf 100644 --- a/src/skillevaluator/harness/profiles/codex.yaml +++ b/src/skillevaluator/harness/profiles/codex.yaml @@ -9,6 +9,7 @@ listing: {cut: 1024, budget: {desc_chars: 8000, chars_per_context_token: 0.08}} rules: - {id: CX-ROOT, when: "install_root not in roots", effect: not_loaded, outcome: not found, message: "Codex reads .agents/skills and .codex/skills (project and user).", fix: "Install it under .agents/skills or .codex/skills."} - {id: CX-DESC-CUT, when: "description_codepoints > 1024", effect: degraded, outcome: listing shortened, message: "Description cut to 1,021 chars + '...' in the skill list ({description_codepoints} chars, {description_over} over 1,024).", fix: "Cut the description by at least {description_over} characters."} + - {id: CX-SHELL-READ, when: "not explicit_invocation and (skill_md_bytes > 40000 or (custom_provider and skill_md_bytes > 10000))", effect: degraded, outcome: delivery truncated, message: "SKILL.md is {skill_md_bytes} bytes (~{skill_md_tokens} tokens); when the model opens it through the shell, Codex keeps only the start and end of output over ~10K tokens (10,000 bytes on models Codex has no bundled metadata for, e.g. custom providers). An explicit $skill mention injects the whole file (--explicit-invocation).", fix: "Keep SKILL.md under ~40,000 bytes (10,000 for custom providers); move detail into references/ files."} - {id: CX-DESC-MISSING, when: "description_missing or description_empty or description_type != 'str'", effect: not_loaded, message: "Skill dropped: Codex requires a string description.", fix: "Add a non-empty string description."} - {id: CX-STRICT-YAML, when: "frontmatter_tab_indent or frontmatter_duplicate_keys", effect: not_loaded, message: "Skill dropped: invalid YAML (tabs or duplicate keys).", fix: "Use spaces, not tabs, and remove duplicate keys."} - {id: CX-BOM, when: "frontmatter_bom", effect: not_loaded, outcome: rejected, message: "Skill dropped: SKILL.md starts with a UTF-8 BOM.", fix: "Save SKILL.md as UTF-8 without a BOM."} diff --git a/src/skillevaluator/harness/profiles/hermes.yaml b/src/skillevaluator/harness/profiles/hermes.yaml index fe2d5c4b4..acc1b2342 100644 --- a/src/skillevaluator/harness/profiles/hermes.yaml +++ b/src/skillevaluator/harness/profiles/hermes.yaml @@ -19,6 +19,7 @@ rules: - {id: HM-DUP-NAME, when: "duplicate_name", effect: advisory, message: "Another skill is also named '{skill_name}' ({duplicate_paths}); Hermes uses one: project, then ~/.hermes/skills.", fix: "Give each skill a unique name."} - {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."} - {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/."} + - {id: HM-VIEW-BUDGET, when: "hermes_view_chars > 100000", effect: degraded, outcome: instructions not delivered, message: "When the model loads the skill, skill_view returns ~{hermes_view_chars} chars, over the 100,000-char tool-result budget (lower on models under ~167K context): the model gets a 1,500-char preview, not the instructions.", fix: "Keep SKILL.md under ~95,000 characters; move detail into references/ files."} notes: - "Precedence: project > ~/.hermes/skills > skills.create_dir > external_dirs (project wins, 3/3)." - "Large bodies are spilled and paged through in small reads." diff --git a/src/skillevaluator/harness/profiles/openclaw.yaml b/src/skillevaluator/harness/profiles/openclaw.yaml index 4af804817..81a4c500c 100644 --- a/src/skillevaluator/harness/profiles/openclaw.yaml +++ b/src/skillevaluator/harness/profiles/openclaw.yaml @@ -5,6 +5,7 @@ roots: project: [skills, .agents/skills] user: [~/.agents/skills, ~/.openclaw/skills] limits: {max_skills_in_prompt: 150, max_prompt_chars: 18000, compact_desc_chars: 220, max_skill_file_bytes: 256000, read_budget: "16,000-64,000 weighted chars of the skills_read result by model context"} +config_defaults: {custom_provider_context_tokens: 128000} listing: {budget: {skills: 150, desc_chars: 18000, cut: 220}} rules: - {id: OW-ROOT, when: "install_root not in roots", effect: not_loaded, outcome: not found, message: "OpenClaw reads skills/, .agents/skills, ~/.agents/skills and ~/.openclaw/skills.", fix: "Install it under skills/ or .agents/skills in the workspace, or ~/.openclaw/skills."} @@ -12,11 +13,15 @@ rules: - {id: OW-STRICT-YAML, when: "frontmatter_tab_indent or frontmatter_duplicate_keys", effect: not_loaded, outcome: rejected, message: "Skill dropped: invalid YAML (tabs or duplicate keys).", fix: "Use spaces, not tabs, and remove duplicate keys."} - {id: OW-SYMLINK-ESCAPE, when: "skill_dir_symlink_target == 'outside_root'", effect: not_loaded, message: "Symlink target is outside the skills root (even inside the repo): rejected.", fix: "Copy the skill into the skills folder instead of symlinking it from elsewhere."} - {id: OW-SYMLINK-FILE, when: "skill_md_symlink", effect: not_loaded, message: "Symlinked SKILL.md files are not loaded.", fix: "Copy SKILL.md into the folder instead of symlinking the file (a symlinked folder works)."} + - {id: OW-FILE-CAP, when: "skill_md_bytes > 256000", effect: not_loaded, outcome: rejected, message: "SKILL.md over 256,000 bytes is skipped as invalid.", fix: "Move detail into references/ files and keep SKILL.md under 256,000 bytes."} + - {id: OW-READ-REFUSED, when: "openclaw_read_chars > 64000", effect: degraded, outcome: instructions not delivered, message: "SKILL.md reads as {openclaw_read_chars} characters (OpenClaw counts each CJK character as 4 or more), over the 64,000-character read cap at every context size: the read is refused or returns a cut prefix with a truncation notice, not the whole instructions.", fix: "Keep SKILL.md under about 15,000 characters (about 3,700 CJK characters) to load at every context size; move detail into references/ files."} + - {id: OW-READ-BUDGET, when: "openclaw_read_chars > 16000 and openclaw_read_chars <= 64000 and (context_tokens < 100000 or (context_tokens < 200000 and openclaw_read_chars > 32000))", effect: degraded, outcome: instructions not delivered, message: "SKILL.md reads as {openclaw_read_chars} characters (OpenClaw counts each CJK character as 4 or more), over the read cap for this setup: the read is refused or returns a cut prefix with a truncation notice. The cap depends on the model context (16,000 under 100K tokens, 32,000 under 200K, 64,000 above; custom providers default to 128K). Pass --context-tokens to check your setup.", fix: "Keep SKILL.md under about 15,000 characters (about 3,700 CJK characters); move detail into references/ files."} - {id: OW-COMPACT, when: "description_codepoints > 220 and (catalog_size > 150 or catalog_desc_chars > 18000)", effect: degraded, outcome: listing shortened, message: "{catalog_size} skills / {catalog_desc_chars} description chars here: over 150 skills or 18,000 chars, OpenClaw cuts descriptions to 220 chars.", fix: "Keep the description under 220 characters, trigger first."} - {id: OW-NESTED, when: "nested_skill_md", effect: advisory, message: "Nested SKILL.md is ignored.", fix: "Move the nested skill to its own folder under the skills root, or rename its SKILL.md."} - {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)."} - {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."} - {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."} + - {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."} - {id: OW-DESC-ESCAPED, when: "description_has_quote", effect: advisory, outcome: text rewritten, message: "Double quotes in the description are shown to the model as " in the skill list.", fix: "Use single quotes in the description if the exact text matters."} notes: - "Precedence: workspace skills/ > .agents/skills > ~/.agents/skills > managed > bundled > extra dirs (project wins, 3/3)." diff --git a/src/skillevaluator/harness/profiles/opencode.yaml b/src/skillevaluator/harness/profiles/opencode.yaml index dd0e1d437..bbf023aa9 100644 --- a/src/skillevaluator/harness/profiles/opencode.yaml +++ b/src/skillevaluator/harness/profiles/opencode.yaml @@ -13,9 +13,12 @@ rules: - {id: OC-DESC-EMPTY, when: "description_empty", effect: degraded, message: "Listed by name only.", fix: "Add a non-empty string description."} - {id: OC-DUP-KEY, when: "frontmatter_duplicate_keys", effect: not_loaded, outcome: rejected, message: "Skill dropped: duplicate frontmatter keys.", fix: "Remove the duplicate frontmatter key."} - {id: OC-NESTED, when: "nested_skill_md", effect: degraded, message: "The nested SKILL.md is loaded as a second, separate skill.", fix: "Move the nested skill to its own folder under the skills root, or rename its SKILL.md."} + - {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."} - {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."} - {id: OC-RELOAD, when: "always", effect: advisory, message: "Skill list and text are cached at startup; edits need a restart."} - {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)."} + - {id: OC-REF-CUT, when: "files_over_51200 > 0", effect: advisory, outcome: needs paging, message: "{files_over_51200} files are over 51,200 bytes or 2,000 lines ({files_over_51200_paths}); OpenCode's read tool returns at most that per call, so the model must page.", fix: "Split large files into pieces under 51,200 bytes and 2,000 lines."} + - {id: OC-LONG-LINES, when: "long_line_count > 0", effect: advisory, outcome: delivery truncated, message: "{long_line_count} lines over 2,000 chars ({long_line_files}) are cut when the model reads them.", fix: "Wrap long lines (tables, minified JSON) under 2,000 characters."} - {id: OC-FM-STRIPPED, when: "custom_field_chars > 200", effect: advisory, message: "Frontmatter is stripped when the skill is used, so the text in {custom_fields} never reaches the model.", fix: "Move instructions from frontmatter into the SKILL.md body."} notes: - "Docs (V1) say one level deep and a 1-1024 description; runtime matches the V2 docs: recursive, no length cap." diff --git a/src/skillevaluator/validators/schema.py b/src/skillevaluator/validators/schema.py index 90f6f1f7f..c54bf8078 100644 --- a/src/skillevaluator/validators/schema.py +++ b/src/skillevaluator/validators/schema.py @@ -29,6 +29,7 @@ SCHEMA_ALLOWED_DIRS_ENV, SKILL_MANIFEST_FILE, SKILL_MANIFEST_VARIANTS, + SKILL_MD_SIZE_THRESHOLDS, SKILL_NOT_SHIPPED_DIRS, ) from skillevaluator.logging_config import get_logger @@ -752,6 +753,23 @@ def _validate_portability( "Save SKILL.md as UTF-8 without BOM", ) ) + for limit, level in SKILL_MD_SIZE_THRESHOLDS: + if len(raw) > limit: + findings.append( + self._portability_finding( + "manifest_size", + Severity(level), + f"SKILL.md is {len(raw):,} bytes (over {limit:,}); harnesses cut, refuse or skip large " + "manifests (OpenClaw reads 16,000-64,000 chars and skips over 256,000 bytes; " + "OpenCode cuts at 50 KiB)", + file_path, + "Move detail into references/ files and keep SKILL.md short", + size_bytes=len(raw), + limit_bytes=limit, + ) + ) + break + # Same folders the harness check skips: evals/ and versions/ are scanned like any other folder. nested = sorted( path diff --git a/tests/harness/test_overlay.py b/tests/harness/test_overlay.py index 18b350d97..7c67ee842 100644 --- a/tests/harness/test_overlay.py +++ b/tests/harness/test_overlay.py @@ -409,7 +409,10 @@ def test_bundle_files_symlinks_and_large_references(tmp_path: Path): rows = _rows(skill) assert facts["resource_symlinks"] == facts["resource_symlink_escapes"] == 1 + assert facts["largest_resource"] == "references/big.md" and facts["largest_resource_lines"] == 20000 assert "HM-RESOURCE-SYMLINK" in _ids(rows, "hermes") + assert "OW-REF-BUDGET" in _ids(rows, "openclaw") + assert "OC-REF-CUT" in _ids(rows, "opencode") def test_every_rule_has_a_fix_and_placeholders_are_filled(tmp_path: Path): @@ -434,6 +437,30 @@ def test_fix_reaches_findings_and_panels(tmp_path: Path): assert "Description in the model's skill list" in out +def _sized(root: Path, fact: str, target: int) -> Path: + """A skill whose ``fact`` (a body-length measure) is exactly ``target``.""" + probe = _skill(root / "probe", body="a") + padding = target - skill_facts(probe)[fact] + 1 + skill = _skill(root / str(target), body="a" * padding) + assert skill_facts(skill)[fact] == target + return skill + + +@pytest.mark.parametrize( + ("harness", "rule", "fact", "limit"), + [ + ("hermes", "HM-VIEW-BUDGET", "hermes_view_chars", 100_000), + ("openclaw", "OW-READ-BUDGET", "openclaw_read_chars", 16_000), + ("openclaw", "OW-READ-REFUSED", "openclaw_read_chars", 64_000), + ("codex", "CX-SHELL-READ", "skill_md_bytes", 40_000), + ("opencode", "OC-BODY-CUT", "opencode_body_output_bytes", 51_200), + ], +) +def test_body_limits_fire_just_over_the_limit(tmp_path: Path, harness: str, rule: str, fact: str, limit: int): + assert rule not in _ids(_rows(_sized(tmp_path / "at", fact, limit)), harness) + assert rule in _ids(_rows(_sized(tmp_path / "over", fact, limit + 1)), harness) + + @pytest.mark.parametrize(("harness", "rule"), [("codex", "CX-DESC-CUT"), ("copilot-cli", "CP-DESC-LIMIT")]) def test_description_limit_is_1024(tmp_path: Path, harness: str, rule: str): at = _rows(_skill(tmp_path / "at", desc="Use when " + "a" * 1015)) @@ -443,6 +470,23 @@ def test_description_limit_is_1024(tmp_path: Path, harness: str, rule: str): assert any(f["id"] == rule and "1 over" in f["message"] for f in over[harness]["findings"]) +def test_every_oversized_file_long_line_and_unlisted_folder_is_counted(tmp_path: Path): + skill = _skill(tmp_path) + for rel, size in {"references/a.md": 51_201, "shared/b.md": 64_001, "shared/c.md": 51_200}.items(): + (skill / rel).parent.mkdir(parents=True, exist_ok=True) + (skill / rel).write_text("x" * size, encoding="utf-8") + (skill / "python").mkdir() + (skill / "python" / "wide.md").write_text("y" * 2001 + "\n" + "z" * 2000 + "\n", encoding="utf-8") + facts = skill_facts(skill) + rows = _rows(skill) + + assert (facts["files_over_51200"], facts["files_over_64000"]) == (2, 1) + assert (facts["long_line_count"], facts["hermes_unlisted_files"]) == (4, 3) + assert facts["hermes_unlisted_dirs"] == "python, shared" + assert {"OC-REF-CUT", "OC-LONG-LINES"} <= _ids(rows, "opencode") + assert {"HM-LINKED-LAYOUT"} <= _ids(rows, "hermes") and "OW-REF-BUDGET" in _ids(rows, "openclaw") + + def test_compact_view_shows_worst_finding_per_harness_and_catalog(tmp_path: Path): _catalog(tmp_path, 40) block = harness_block(run_validation(tmp_path / ".claude" / "skills" / "filler-000", checks="harness")) @@ -473,6 +517,54 @@ def _rule_ids(skill: Path, harness: str, config: dict | None = None) -> set[str] return {f["id"] for r in evaluate_harnesses(skill, harness, config=config) for f in r.findings} +def test_openclaw_read_budget_depends_on_model_context(tmp_path: Path): + mid = _skill(tmp_path / "mid", body="x" * 20_000) + big = _skill(tmp_path / "big", body="x" * 40_000) + + assert "OW-READ-BUDGET" in _rule_ids(mid, "openclaw") + assert "OW-READ-BUDGET" not in _rule_ids(mid, "openclaw", {"context_tokens": 150_000}) + assert "OW-READ-BUDGET" not in _rule_ids(mid, "openclaw", {"custom_provider": True}) + assert "OW-READ-BUDGET" in _rule_ids(big, "openclaw", {"custom_provider": True}) + assert "OW-READ-BUDGET" not in _rule_ids(big, "openclaw", {"context_tokens": 200_000}) + + +def test_codex_shell_cut_is_lower_for_custom_providers(tmp_path: Path): + skill = _skill(tmp_path, body="x" * 12_000) + + assert "CX-SHELL-READ" not in _rule_ids(skill, "codex") + assert "CX-SHELL-READ" in _rule_ids(skill, "codex", {"custom_provider": True}) + + +def test_codex_explicit_invocation_delivers_whole(tmp_path: Path): + skill = _skill(tmp_path, body="x" * 50_000) + + assert "CX-SHELL-READ" in _rule_ids(skill, "codex", {"custom_provider": True}) + assert "CX-SHELL-READ" not in _rule_ids(skill, "codex", {"custom_provider": True, "explicit_invocation": True}) + + +def test_openclaw_read_budget_weights_cjk_not_utf8_bytes(tmp_path: Path): + kana = _skill(tmp_path / "kana", body="\u3042" * 8_000) + cyrillic = _skill(tmp_path / "cyr", body="\u0430" * 20_000) + + assert skill_facts(kana)["skill_md_bytes"] < 32_000 < skill_facts(cyrillic)["skill_md_bytes"] + assert "OW-READ-BUDGET" in _rule_ids(kana, "openclaw", {"custom_provider": True}) + assert "OW-READ-BUDGET" not in _rule_ids(cyrillic, "openclaw", {"custom_provider": True}) + + +def test_openclaw_read_chars_counts_code_units(tmp_path: Path): + flat = skill_facts(_skill(tmp_path / "flat", body="a" * 1_000))["openclaw_read_chars"] + lines = skill_facts(_skill(tmp_path / "lines", body="a\n" * 500))["openclaw_read_chars"] + emoji = skill_facts(_skill(tmp_path / "emoji", body="\U0001f600" * 500))["openclaw_read_chars"] + + assert lines == flat == emoji + + +def test_hermes_view_budget_counts_code_points(tmp_path: Path): + skill = _skill(tmp_path, body="\u65c5" * 60_000) + + assert "HM-VIEW-BUDGET" not in _rule_ids(skill, "hermes") + + def test_native_root_skips_root_rules(tmp_path): skill = tmp_path / ".claude" / "skills" / "demo" skill.mkdir(parents=True) diff --git a/tests/validators/test_schema.py b/tests/validators/test_schema.py index a0bea2169..623e7042e 100644 --- a/tests/validators/test_schema.py +++ b/tests/validators/test_schema.py @@ -1625,6 +1625,28 @@ def test_symlinked_manifest_is_medium(self, tmp_path: Path): assert result.passed, result.errors assert len(_checks(result, "manifest_symlink")) == 1 + @pytest.mark.parametrize( + ("size", "severity"), + [(32 * 1024 + 1, "low"), (50 * 1024 + 1, "medium"), (256_001, "high")], + ) + def test_manifest_size_thresholds(self, tmp_path: Path, size: int, severity: str): + skill_dir = _write_skill(tmp_path, _BASE_FM) + manifest = skill_dir / "SKILL.md" + padding = size - len(manifest.read_bytes()) + manifest.write_text(manifest.read_text() + "x" * padding) + + findings = _checks(SchemaValidator().validate(skill_dir), "manifest_size") + + assert [f.severity for f in findings] == [severity] + assert findings[0].metadata["size_bytes"] == size + + def test_manifest_at_low_threshold_has_no_size_finding(self, tmp_path: Path): + skill_dir = _write_skill(tmp_path, _BASE_FM) + manifest = skill_dir / "SKILL.md" + manifest.write_text(manifest.read_text() + "x" * (32 * 1024 - len(manifest.read_bytes()))) + + assert not _checks(SchemaValidator().validate(skill_dir), "manifest_size") + def test_nested_manifest_is_medium(self, tmp_path: Path): skill_dir = _write_skill(tmp_path, _BASE_FM) (skill_dir / "references" / "inner").mkdir(parents=True) From 2d4f358e8e99181682f7e7380ed3e258d5b3c307 Mon Sep 17 00:00:00 2001 From: Christopher Kevin Date: Fri, 13 Nov 2026 23:11:36 +0000 Subject: [PATCH 03/11] feat(harness): flag placeholders other harnesses pass through literally Signed-off-by: Christopher Kevin --- CHANGELOG.md | 3 +++ docs/tier1-validation.mdx | 2 ++ src/skillevaluator/harness/overlay.py | 21 +++++++++++++++++++ .../harness/profiles/claude-code.yaml | 1 + .../harness/profiles/codex.yaml | 2 ++ .../harness/profiles/copilot-cli.yaml | 2 ++ .../harness/profiles/hermes.yaml | 2 ++ .../harness/profiles/openclaw.yaml | 2 ++ .../harness/profiles/opencode.yaml | 3 +++ tests/harness/test_overlay.py | 20 ++++++++++++++++++ 10 files changed, 58 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8d5ccee5b..0e1c2c054 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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` rules for placeholders: price-like `$N` text that Claude Code and + OpenCode replace with arguments (with line numbers), and `$ARGUMENTS` and + `${CLAUDE_SKILL_DIR}`, which only Claude Code substitutes. - `harness` rules for delivery limits: Claude Code's body cap, OpenCode's 51,200-byte / 2,000-line reads and long lines, OpenClaw's whole-read and weighted result caps, Hermes's 100,000-character `skill_view` budget and Codex's diff --git a/docs/tier1-validation.mdx b/docs/tier1-validation.mdx index 0ec2034a4..e1d46ed41 100644 --- a/docs/tier1-validation.mdx +++ b/docs/tier1-validation.mdx @@ -287,6 +287,8 @@ For `validate`, the default set is `schema`, `version`, `security`, `pii`, `lice The check measures the skill together with the skills installed next to it. A single skill under a harness root such as `.claude/skills` is counted with everything in that folder; a folder of skills is its own catalog. That drives the list-budget rules (Claude Code and Codex ~8,000 description chars, Copilot 32 full descriptions, OpenClaw 150 skills or 18,000 chars) and a duplicate-name rule per harness that says which copy wins. A `catalog` line in the panel names the folder. Delivery rules: Claude Code's body cap, OpenCode's 51,200-byte / 2,000-line reads and lines over 2,000 characters, OpenClaw's whole-or-nothing read against its result caps, Hermes's 100,000-character `skill_view` budget, and Codex's ~10K-token cut when the model reads `SKILL.md` through the shell. + + Placeholder rules: `$ARGUMENTS` and `${CLAUDE_SKILL_DIR}` are substituted only by Claude Code, and price-like `$N` text is replaced with arguments by Claude Code and OpenCode. diff --git a/src/skillevaluator/harness/overlay.py b/src/skillevaluator/harness/overlay.py index 9bcab0240..ac44380e5 100644 --- a/src/skillevaluator/harness/overlay.py +++ b/src/skillevaluator/harness/overlay.py @@ -53,6 +53,9 @@ ) ) _FACT_RE = re.compile(r"\{([a-z0-9_]+)\}") +_DOLLAR_N_RE = re.compile(r"(? dict[str, Any]: } +def _dollar_n(body: str, first_line: int) -> dict[str, Any]: + """Count ``$`` tokens: price-like ones ($4.00, $4 / $20 per MTok) versus bare placeholders ($1).""" + prices, placeholders, lines = 0, 0, [] + for number, line in enumerate(body.splitlines(), first_line): + for match in _DOLLAR_N_RE.finditer(line): + if _PRICE_TAIL_RE.match(line, match.end()) or _PRICE_HEAD_RE.search(line, 0, match.start()): + prices += 1 + if number not in lines: + lines.append(number) + else: + placeholders += 1 + shown = ", ".join(map(str, lines[:5])) + (f" +{len(lines) - 5} more" if len(lines) > 5 else "") + return {"dollar_literal_count": prices, "dollar_literal_lines": shown, "dollar_placeholder_count": placeholders} + + def skill_facts(skill_path: Path, catalog: Catalog | None = None) -> dict[str, Any]: """Compute the facts profile rules refer to (see profiles README). @@ -350,6 +368,9 @@ def skill_facts(skill_path: Path, catalog: Catalog | None = None) -> dict[str, A "hermes_view_chars": len(json.dumps(text, ensure_ascii=False)) + len(json.dumps(description if isinstance(description, str) else "", ensure_ascii=False)) + 400, + **_dollar_n(body, text[: match.start(2)].count("\n") + 1 if match else 1), + "uses_arguments_placeholder": "$ARGUMENTS" in body, + "uses_claude_skill_dir": "${CLAUDE_SKILL_DIR}" in body, **_bundle_facts(skill_path, manifest), "catalog_size": catalog.size if catalog else 0, "catalog_desc_chars": catalog.desc_chars if catalog else 0, diff --git a/src/skillevaluator/harness/profiles/claude-code.yaml b/src/skillevaluator/harness/profiles/claude-code.yaml index 45915d3a2..e4cfb545a 100644 --- a/src/skillevaluator/harness/profiles/claude-code.yaml +++ b/src/skillevaluator/harness/profiles/claude-code.yaml @@ -10,6 +10,7 @@ rules: - {id: CC-ROOT, when: "install_root not in roots", effect: not_loaded, outcome: not found, message: "Claude Code reads only .claude/skills and ~/.claude/skills; .agents/skills is not scanned.", fix: "Install it under .claude/skills or ~/.claude/skills (a symlink from .agents/skills works)."} - {id: CC-GROUPING, when: "grouping_depth > 0", effect: not_loaded, outcome: not found, message: "Claude Code finds skills only directly under the skills folder; grouping folders are not searched.", fix: "Move the skill folder directly under .claude/skills."} - {id: CC-DESC-CUT, when: "description_codepoints > 1536", effect: degraded, outcome: listing shortened, message: "Description cut at 1,536 characters.", fix: "Keep the description at or under 1,536 characters."} + - {id: CC-DOLLAR-N, when: "dollar_literal_count > 0", effect: degraded, outcome: text rewritten, message: "{dollar_literal_count} price-like $N tokens (lines {dollar_literal_lines}) are argument placeholders: invoked with five or more arguments, $4.00 becomes <5th argument>.00 (an unmatched $N is kept verbatim).", fix: "Reword amounts (e.g. USD 4.00); \\$4.00 escapes it here, but other harnesses then show the backslash."} - {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."} - {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."} - {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."} diff --git a/src/skillevaluator/harness/profiles/codex.yaml b/src/skillevaluator/harness/profiles/codex.yaml index daf0c61cf..5b335eb48 100644 --- a/src/skillevaluator/harness/profiles/codex.yaml +++ b/src/skillevaluator/harness/profiles/codex.yaml @@ -19,6 +19,8 @@ rules: - {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."} - {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."} - {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)."} + - {id: CX-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."} + - {id: CX-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."} notes: - "Explicit $skill injects the whole SKILL.md (145 KB tested)." - "Follows symlinked skill folders (inside or outside the root)." diff --git a/src/skillevaluator/harness/profiles/copilot-cli.yaml b/src/skillevaluator/harness/profiles/copilot-cli.yaml index ae73da7c4..4e8192234 100644 --- a/src/skillevaluator/harness/profiles/copilot-cli.yaml +++ b/src/skillevaluator/harness/profiles/copilot-cli.yaml @@ -16,6 +16,8 @@ rules: - {id: CP-RELOAD, when: "always", effect: advisory, message: "New skills appear only after `/skills reload` or a restart; edits to existing skills apply at once."} - {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)."} - {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."} + - {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."} + - {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."} - {id: CP-FM-STRIPPED, when: "custom_field_chars > 200", effect: advisory, message: "Frontmatter is stripped when the skill is used, so the text in {custom_fields} never reaches the model.", fix: "Move instructions from frontmatter into the SKILL.md body."} - {id: CP-DESC-ESCAPED, when: "description_has_quote", effect: advisory, outcome: text rewritten, message: "Double quotes in the description are shown to the model as " in the skill list.", fix: "Use single quotes in the description if the exact text matters."} notes: diff --git a/src/skillevaluator/harness/profiles/hermes.yaml b/src/skillevaluator/harness/profiles/hermes.yaml index acc1b2342..157d1c8ae 100644 --- a/src/skillevaluator/harness/profiles/hermes.yaml +++ b/src/skillevaluator/harness/profiles/hermes.yaml @@ -20,6 +20,8 @@ rules: - {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."} - {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/."} - {id: HM-VIEW-BUDGET, when: "hermes_view_chars > 100000", effect: degraded, outcome: instructions not delivered, message: "When the model loads the skill, skill_view returns ~{hermes_view_chars} chars, over the 100,000-char tool-result budget (lower on models under ~167K context): the model gets a 1,500-char preview, not the instructions.", fix: "Keep SKILL.md under ~95,000 characters; move detail into references/ files."} + - {id: HM-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."} + - {id: HM-SKILL-DIR, when: "uses_claude_skill_dir", effect: degraded, message: "${CLAUDE_SKILL_DIR} is not substituted: the model sees the literal text.", fix: "Use ${HERMES_SKILL_DIR} or paths relative to SKILL.md."} notes: - "Precedence: project > ~/.hermes/skills > skills.create_dir > external_dirs (project wins, 3/3)." - "Large bodies are spilled and paged through in small reads." diff --git a/src/skillevaluator/harness/profiles/openclaw.yaml b/src/skillevaluator/harness/profiles/openclaw.yaml index 81a4c500c..18e3adf5a 100644 --- a/src/skillevaluator/harness/profiles/openclaw.yaml +++ b/src/skillevaluator/harness/profiles/openclaw.yaml @@ -22,6 +22,8 @@ rules: - {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."} - {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."} - {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."} + - {id: OW-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."} + - {id: OW-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."} - {id: OW-DESC-ESCAPED, when: "description_has_quote", effect: advisory, outcome: text rewritten, message: "Double quotes in the description are shown to the model as " in the skill list.", fix: "Use single quotes in the description if the exact text matters."} notes: - "Precedence: workspace skills/ > .agents/skills > ~/.agents/skills > managed > bundled > extra dirs (project wins, 3/3)." diff --git a/src/skillevaluator/harness/profiles/opencode.yaml b/src/skillevaluator/harness/profiles/opencode.yaml index bbf023aa9..9c53352e5 100644 --- a/src/skillevaluator/harness/profiles/opencode.yaml +++ b/src/skillevaluator/harness/profiles/opencode.yaml @@ -14,11 +14,14 @@ rules: - {id: OC-DUP-KEY, when: "frontmatter_duplicate_keys", effect: not_loaded, outcome: rejected, message: "Skill dropped: duplicate frontmatter keys.", fix: "Remove the duplicate frontmatter key."} - {id: OC-NESTED, when: "nested_skill_md", effect: degraded, message: "The nested SKILL.md is loaded as a second, separate skill.", fix: "Move the nested skill to its own folder under the skills root, or rename its SKILL.md."} - {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."} + - {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."} - {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."} - {id: OC-RELOAD, when: "always", effect: advisory, message: "Skill list and text are cached at startup; edits need a restart."} - {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)."} - {id: OC-REF-CUT, when: "files_over_51200 > 0", effect: advisory, outcome: needs paging, message: "{files_over_51200} files are over 51,200 bytes or 2,000 lines ({files_over_51200_paths}); OpenCode's read tool returns at most that per call, so the model must page.", fix: "Split large files into pieces under 51,200 bytes and 2,000 lines."} - {id: OC-LONG-LINES, when: "long_line_count > 0", effect: advisory, outcome: delivery truncated, message: "{long_line_count} lines over 2,000 chars ({long_line_files}) are cut when the model reads them.", fix: "Wrap long lines (tables, minified JSON) under 2,000 characters."} + - {id: OC-ARGUMENTS, when: "uses_arguments_placeholder", effect: degraded, message: "Loaded through the skill tool, $ARGUMENTS is not substituted: the model sees the literal text (a /command run substitutes it).", fix: "Describe the expected input in words instead of $ARGUMENTS."} + - {id: OC-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."} - {id: OC-FM-STRIPPED, when: "custom_field_chars > 200", effect: advisory, message: "Frontmatter is stripped when the skill is used, so the text in {custom_fields} never reaches the model.", fix: "Move instructions from frontmatter into the SKILL.md body."} notes: - "Docs (V1) say one level deep and a 1-1024 description; runtime matches the V2 docs: recursive, no length cap." diff --git a/tests/harness/test_overlay.py b/tests/harness/test_overlay.py index 7c67ee842..ff5d8befb 100644 --- a/tests/harness/test_overlay.py +++ b/tests/harness/test_overlay.py @@ -415,6 +415,15 @@ def test_bundle_files_symlinks_and_large_references(tmp_path: Path): assert "OC-REF-CUT" in _ids(rows, "opencode") +def test_claude_placeholders_reach_other_harnesses_literally(tmp_path: Path): + rows = _rows(_skill(tmp_path, body=BODY + "Run ${CLAUDE_SKILL_DIR}/run.sh $ARGUMENTS\n")) + + for harness in set(HARNESSES) - {"claude-code"}: + assert any(f["id"].endswith("-ARGUMENTS") for f in rows[harness]["findings"]), harness + assert any(f["id"].endswith("-SKILL-DIR") for f in rows[harness]["findings"]), harness + assert not rows["claude-code"]["findings"] + + def test_every_rule_has_a_fix_and_placeholders_are_filled(tmp_path: Path): for profile in load_profiles("all"): for rule in profile["rules"]: @@ -470,6 +479,17 @@ def test_description_limit_is_1024(tmp_path: Path, harness: str, rule: str): assert any(f["id"] == rule and "1 over" in f["message"] for f in over[harness]["findings"]) +def test_price_like_dollar_numbers_are_flagged_with_lines(tmp_path: Path): + prices = _rows(_skill(tmp_path / "a", body="# Prices\n\nInput $4.00, cache $0.25.\nBatch $4 / $20 per MTok.\n")) + safe = _rows(_skill(tmp_path / "b", body="Input USD 4.00, \\$0.25, $10k, $ARGUMENTS.\nRun on $1.\n")) + + finding = next(f for f in prices["claude-code"]["findings"] if f["id"] == "CC-DOLLAR-N") + assert finding["message"].startswith("4 price-like $N tokens (lines 9, 10)") + assert "OC-DOLLAR-N" in _ids(prices, "opencode") + assert "CC-DOLLAR-N" not in _ids(safe, "claude-code") and "OC-DOLLAR-N" not in _ids(safe, "opencode") + assert skill_facts(tmp_path / "b" / "skills" / "demo-skill")["dollar_placeholder_count"] == 1 + + def test_every_oversized_file_long_line_and_unlisted_folder_is_counted(tmp_path: Path): skill = _skill(tmp_path) for rel, size in {"references/a.md": 51_201, "shared/b.md": 64_001, "shared/c.md": 51_200}.items(): From 0d86c594dcc58429164f9ea4984c009f995e6ea3 Mon Sep 17 00:00:00 2001 From: Christopher Kevin Date: Fri, 13 Nov 2026 23:11:42 +0000 Subject: [PATCH 04/11] feat(harness): flag invocation fields each harness ignores Signed-off-by: Christopher Kevin --- CHANGELOG.md | 4 +++ docs/tier1-validation.mdx | 3 ++ src/skillevaluator/constants.py | 3 ++ src/skillevaluator/harness/overlay.py | 21 +++++++++++++ .../harness/profiles/claude-code.yaml | 2 ++ .../harness/profiles/codex.yaml | 3 ++ .../harness/profiles/copilot-cli.yaml | 4 +++ .../harness/profiles/hermes.yaml | 5 ++++ .../harness/profiles/openclaw.yaml | 3 ++ .../harness/profiles/opencode.yaml | 4 +++ src/skillevaluator/validators/schema.py | 15 ++++++++++ tests/harness/test_overlay.py | 30 +++++++++++++++++++ tests/validators/test_schema.py | 8 +++++ 13 files changed, 105 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0e1c2c054..4ffbd4380 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,10 @@ 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` rules for invocation fields: `disable-model-invocation`, Codex's + `agents/openai.yaml` policy, `allowed-tools`, Claude Code-only fields and Hermes + project trust. Tier 1 `schema` now reports fields outside the agentskills.io + spec (LOW). - `harness` rules for placeholders: price-like `$N` text that Claude Code and OpenCode replace with arguments (with line numbers), and `$ARGUMENTS` and `${CLAUDE_SKILL_DIR}`, which only Claude Code substitutes. diff --git a/docs/tier1-validation.mdx b/docs/tier1-validation.mdx index e1d46ed41..0c3fb79a1 100644 --- a/docs/tier1-validation.mdx +++ b/docs/tier1-validation.mdx @@ -262,6 +262,7 @@ For `validate`, the default set is `schema`, `version`, `security`, `pii`, `lice - A description within 1,024 characters but over 1,024 UTF-16 units is MEDIUM (`description_utf16_length`), and no "Use when ..." trigger in the first 60 characters is LOW (`description_trigger`). - A symlinked `SKILL.md` (`manifest_symlink`) or a `SKILL.md` nested inside the skill (`nested_manifest`) is MEDIUM. - `manifest_size` is LOW above 32 KiB, MEDIUM above 50 KiB and HIGH above 256,000 bytes. + - Fields outside the spec are LOW (`unknown_field`). - `metadata.author` is optional under the `default` profile. Use `Name ` to include a contact address, or a person, team, or organization name such as `NVIDIA cuOpt Team` or `Jane Doe (@jdoe)`. A value that is malformed or unsafe is a HIGH `author_format` finding: a bare email or an email outside `Name `, stray angle brackets, control, private-use, or bidirectional formatting characters (joiners such as ZWNJ and ZWJ, which Persian, Arabic and Devanagari names need, are accepted), no letters or digits, or more than 256 characters. A bare address counts even when its domain has no dot (`root@buildhost`), while a social handle such as `Jane Doe (@jdoe)` does not. The `registry` profile requires the `Name ` form. - `metadata.id` is an optional stable skill ID. When present it must be an exact 1–64 character lowercase ASCII slug (`^[a-z0-9]+(-[a-z0-9]+)*$`, no surrounding whitespace); it may differ from `name`. A collection run reports an ID that more than one discovered skill declares; `validate` on a catalog also lists these in `catalog-summary.json` under `metadata_id_conflicts`. Under `registry` a shared ID blocks: the run exits nonzero, and each sharing skill's entry is `"passed": false` with the conflict repeated under `catalog_findings` and counted in its `severity_counts`. A catalog validates each skill on its own, so that skill's own report was written before the catalog-wide check ran and keeps its single-skill verdict, which the entry carries alongside as `report_verdict` beside `report_scope: "single_skill"`. Uniqueness is checked only across the skills validated together, never against a registry, and a single-skill run does not claim it. The ID does not change local catalog identity, which stays keyed by content type and relative path. - `metadata.domain` accepts one category string or a list of them, such as `domain: [backend, ai-ml]`. Values are trimmed and deduplicated in order; a blank or null scalar means no domain. A list with more than 16 entries, or a non-string, blank, or over-128-character entry, is a HIGH `Field 'metadata.domain'` finding. The 128-character limit also applies to a single string. @@ -289,6 +290,8 @@ For `validate`, the default set is `schema`, `version`, `security`, `pii`, `lice Delivery rules: Claude Code's body cap, OpenCode's 51,200-byte / 2,000-line reads and lines over 2,000 characters, OpenClaw's whole-or-nothing read against its result caps, Hermes's 100,000-character `skill_view` budget, and Codex's ~10K-token cut when the model reads `SKILL.md` through the shell. Placeholder rules: `$ARGUMENTS` and `${CLAUDE_SKILL_DIR}` are substituted only by Claude Code, and price-like `$N` text is replaced with arguments by Claude Code and OpenCode. + + 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. diff --git a/src/skillevaluator/constants.py b/src/skillevaluator/constants.py index 4d64333e7..82162dd31 100644 --- a/src/skillevaluator/constants.py +++ b/src/skillevaluator/constants.py @@ -156,6 +156,9 @@ # Skill manifest file name variants (case-insensitive search) SKILL_MANIFEST_VARIANTS = ("SKILL.md", "skill.md") +# Top-level SKILL.md frontmatter fields defined by the agentskills.io spec. +SPEC_SKILL_FIELDS = frozenset({"name", "description", "license", "compatibility", "metadata", "allowed-tools"}) + # SKILL.md size thresholds (bytes) where common agent harnesses start cutting, # refusing, or skipping the file: 16,000-64,000 character whole-file reads, # 50 KiB tool-output truncation, and a 256,000-byte discovery cap. diff --git a/src/skillevaluator/harness/overlay.py b/src/skillevaluator/harness/overlay.py index ac44380e5..c28a3e088 100644 --- a/src/skillevaluator/harness/overlay.py +++ b/src/skillevaluator/harness/overlay.py @@ -229,6 +229,10 @@ def _tab_indent_breaks_yaml(fm_yaml: str) -> bool: return False +def _is_true(value: Any) -> bool: + return value is True or (isinstance(value, str) and value.strip().lower() == "true") + + def _shipped_paths(skill_path: Path) -> list[Path]: """Files and symlinks a skill ships, without descending into VCS or cache folders.""" found = [] @@ -304,6 +308,16 @@ def _dollar_n(body: str, first_line: int) -> dict[str, Any]: return {"dollar_literal_count": prices, "dollar_literal_lines": shown, "dollar_placeholder_count": placeholders} +def _codex_implicit_disabled(skill_path: Path) -> bool: + policy_file = skill_path / "agents" / "openai.yaml" + try: + data = yaml.safe_load(policy_file.read_text(encoding="utf-8")) if policy_file.is_file() else None + except (OSError, UnicodeDecodeError, yaml.YAMLError): + return False + policy = data.get("policy") if isinstance(data, dict) else None + return isinstance(policy, dict) and policy.get("allow_implicit_invocation") is False + + def skill_facts(skill_path: Path, catalog: Catalog | None = None) -> dict[str, Any]: """Compute the facts profile rules refer to (see profiles README). @@ -312,6 +326,7 @@ def skill_facts(skill_path: Path, catalog: Catalog | None = None) -> dict[str, A """ manifest, raw, text, fm_yaml, data = _read_manifest(skill_path) description = data.get("description") + tools = data.get("allowed-tools") trigger = _TRIGGER_RE.search(description) if isinstance(description, str) else None root, depth = _install_root(skill_path) target = "none" @@ -358,6 +373,12 @@ def skill_facts(skill_path: Path, catalog: Catalog | None = None) -> dict[str, A "frontmatter_bom": raw.startswith(b"\xef\xbb\xbf"), "frontmatter_duplicate_keys": bool(_duplicate_frontmatter_keys(fm_yaml)), "frontmatter_tab_indent": _tab_indent_breaks_yaml(fm_yaml), + "allowed_tools_shape": "none" + if tools is None + else {str: "string", list: "list", dict: "map"}.get(type(tools), "other"), + "disable_model_invocation": _is_true(data.get("disable-model-invocation")), + "codex_implicit_disabled": _codex_implicit_disabled(skill_path), + "claude_only_fields": ", ".join(f for f in _CLAUDE_ONLY_FIELDS if f in data), "custom_fields": ", ".join(map(str, custom)), "custom_field_chars": sum(len(v) if isinstance(v, str) else len(yaml.safe_dump(v)) for v in custom.values()), "skill_md_chars": len(text), diff --git a/src/skillevaluator/harness/profiles/claude-code.yaml b/src/skillevaluator/harness/profiles/claude-code.yaml index e4cfb545a..5d996e33c 100644 --- a/src/skillevaluator/harness/profiles/claude-code.yaml +++ b/src/skillevaluator/harness/profiles/claude-code.yaml @@ -14,9 +14,11 @@ 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."} - {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."} - {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."} + - {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."} - {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."} - {id: CC-BODY-CAP, when: "skill_md_bytes > 1048576", effect: not_loaded, outcome: rejected, message: "SKILL.md over 1 MB is rejected (bundle string skill_md_too_large).", fix: "Move detail into references/ files and keep SKILL.md under 1 MB."} - {id: CC-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)."} + - {id: CC-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)."} - {id: CC-FM-STRIPPED, when: "custom_field_chars > 200", effect: advisory, message: "Frontmatter is stripped when the skill is used, so the text in {custom_fields} never reaches the model.", fix: "Move instructions from frontmatter into the SKILL.md body."} notes: - "Follows symlinked skill folders and symlinked SKILL.md files, inside or outside the root." diff --git a/src/skillevaluator/harness/profiles/codex.yaml b/src/skillevaluator/harness/profiles/codex.yaml index 5b335eb48..d1f2b8c73 100644 --- a/src/skillevaluator/harness/profiles/codex.yaml +++ b/src/skillevaluator/harness/profiles/codex.yaml @@ -18,9 +18,12 @@ 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)."} - {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."} - {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."} + - {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."} - {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)."} + - {id: CX-DMI-IGNORED, when: "disable_model_invocation", 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}."} - {id: CX-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."} - {id: CX-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."} + - {id: CX-CLAUDE-ONLY, when: "claude_only_fields != ''", effect: advisory, message: "Ignored here (Claude Code only): {claude_only_fields}.", fix: "Fine to keep for Claude Code; don't depend on them elsewhere."} notes: - "Explicit $skill injects the whole SKILL.md (145 KB tested)." - "Follows symlinked skill folders (inside or outside the root)." diff --git a/src/skillevaluator/harness/profiles/copilot-cli.yaml b/src/skillevaluator/harness/profiles/copilot-cli.yaml index 4e8192234..b6ec69e98 100644 --- a/src/skillevaluator/harness/profiles/copilot-cli.yaml +++ b/src/skillevaluator/harness/profiles/copilot-cli.yaml @@ -9,15 +9,19 @@ rules: - {id: CP-ROOT, when: "install_root not in roots", effect: not_loaded, outcome: not found, message: "Copilot reads .github/.agents/.claude skills (project) and ~/.copilot or ~/.agents skills (user).", fix: "Install it under .github/skills, .agents/skills or .claude/skills."} - {id: CP-DESC-LIMIT, when: "description_utf16_units > 1024", effect: not_loaded, outcome: rejected, message: "Skill dropped: description is {description_utf16_units} UTF-16 units, {utf16_over} over the 1,024 limit (an emoji counts as 2).", fix: "Cut the description by at least {utf16_over} UTF-16 units."} - {id: CP-STRICT-YAML, when: "frontmatter_tab_indent or frontmatter_duplicate_keys or description_type not in ['str', 'none']", effect: not_loaded, message: "Skill dropped: Copilot's YAML parsing is strict.", fix: "Use spaces, not tabs, remove duplicate keys, and make the description a string."} + - {id: CP-ALLOWED-TOOLS-MAP, when: "allowed_tools_shape == 'map'", effect: not_loaded, message: "Skill dropped: allowed-tools given as a map.", fix: "Give allowed-tools as a list or a space-separated string."} - {id: CP-NO-FRONTMATTER, when: "frontmatter_missing", effect: not_loaded, outcome: not found, message: "Skill dropped: a SKILL.md with no front matter, or an unclosed one, is not registered ('Skill not found'; canary pair 3/3, drift NOCLOSE canary in 4 releases, Trial I 2/2).", fix: "Add front matter with a name and a description."} - {id: CP-DESC-MISSING, when: "description_missing", effect: degraded, message: "No description: Copilot shows body text instead.", fix: "Add a non-empty string description."} - {id: CP-LIST-BUDGET, when: "catalog_size > 32", effect: advisory, outcome: listing shortened, message: "{catalog_size} skills here: Copilot gives full descriptions to the first 32 only; the rest are listed by name.", fix: "Keep 32 or fewer skills in one place, or make names self-explanatory."} - {id: CP-NESTED, when: "nested_skill_md", effect: advisory, message: "Nested SKILL.md is ignored.", fix: "Move the nested skill to its own folder under the skills root, or rename its SKILL.md."} - {id: CP-RELOAD, when: "always", effect: advisory, message: "New skills appear only after `/skills reload` or a restart; edits to existing skills apply at once."} + - {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."} - {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)."} - {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."} + - {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)."} - {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."} - {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."} + - {id: CP-CLAUDE-ONLY, when: "claude_only_fields != ''", effect: advisory, message: "Ignored here (Claude Code only): {claude_only_fields}.", fix: "Fine to keep for Claude Code; don't depend on them elsewhere."} - {id: CP-FM-STRIPPED, when: "custom_field_chars > 200", effect: advisory, message: "Frontmatter is stripped when the skill is used, so the text in {custom_fields} never reaches the model.", fix: "Move instructions from frontmatter into the SKILL.md body."} - {id: CP-DESC-ESCAPED, when: "description_has_quote", effect: advisory, outcome: text rewritten, message: "Double quotes in the description are shown to the model as " in the skill list.", fix: "Use single quotes in the description if the exact text matters."} notes: diff --git a/src/skillevaluator/harness/profiles/hermes.yaml b/src/skillevaluator/harness/profiles/hermes.yaml index 157d1c8ae..4b8ac6d67 100644 --- a/src/skillevaluator/harness/profiles/hermes.yaml +++ b/src/skillevaluator/harness/profiles/hermes.yaml @@ -10,18 +10,23 @@ limits: {listing_desc_chars: 60} listing: {cut: 60} rules: - {id: HM-ROOT, when: "install_root not in roots", effect: not_loaded, outcome: not found, message: "Hermes reads ~/.hermes/skills, and project .hermes/skills or .agents/skills only when trusted.", fix: "Install it under ~/.hermes/skills, or .hermes/skills or .agents/skills in a trusted repo."} + - {id: HM-TRUST, when: "install_root in roots.project", effect: advisory, message: "Project skills are invisible until the repo is trusted (`hermes skills trust`, skills.trusted_project_dirs).", fix: "Install under ~/.hermes/skills, or run `hermes skills trust` only in a repo whose skills you would run as your own (trust admits every project skill)."} - {id: HM-DESC-60, when: "trigger_end is None or trigger_end > 60", effect: advisory, outcome: listing shortened, message: "The skill list shows only the first ~60 chars of the description (57 + '...' in 0.16, a word boundary near 59 on main), and the trigger isn't in them.", fix: "Put the trigger (\"Use when …\") in the first 57 characters."} - {id: HM-DESC-MISSING, when: "description_missing or description_empty", effect: degraded, message: "Listed by name with an empty description.", fix: "Add a non-empty string description."} - {id: HM-NESTED, when: "nested_skill_md_exact", effect: degraded, message: "The nested SKILL.md is loaded as a second, separate skill (hidden folders are walked too).", fix: "Move the nested skill to its own folder under the skills root, or rename its SKILL.md."} - {id: HM-SYMLINK-FILE, when: "skill_md_symlink", effect: not_loaded, message: "Symlinked SKILL.md files are not loaded.", fix: "Copy SKILL.md into the folder instead of symlinking the file (a symlinked folder works)."} - {id: HM-DUP-KEY, when: "frontmatter_duplicate_keys", effect: advisory, message: "Duplicate keys: last value wins.", fix: "Remove the duplicate frontmatter key."} + - {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."} - {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)."} - {id: HM-DUP-NAME, when: "duplicate_name", effect: advisory, message: "Another skill is also named '{skill_name}' ({duplicate_paths}); Hermes uses one: project, then ~/.hermes/skills.", fix: "Give each skill a unique name."} - {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."} - {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/."} - {id: HM-VIEW-BUDGET, when: "hermes_view_chars > 100000", effect: degraded, outcome: instructions not delivered, message: "When the model loads the skill, skill_view returns ~{hermes_view_chars} chars, over the 100,000-char tool-result budget (lower on models under ~167K context): the model gets a 1,500-char preview, not the instructions.", fix: "Keep SKILL.md under ~95,000 characters; move detail into references/ files."} + - {id: HM-DMI-IGNORED, when: "disable_model_invocation", effect: degraded, message: "disable-model-invocation is ignored: the model still sees this skill and can use it on its own.", fix: "No equivalent setting in Hermes; don't rely on it."} + - {id: HM-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: "No equivalent setting in Hermes."} - {id: HM-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."} - {id: HM-SKILL-DIR, when: "uses_claude_skill_dir", effect: degraded, message: "${CLAUDE_SKILL_DIR} is not substituted: the model sees the literal text.", fix: "Use ${HERMES_SKILL_DIR} or paths relative to SKILL.md."} + - {id: HM-CLAUDE-ONLY, when: "claude_only_fields != ''", effect: advisory, message: "Ignored here (Claude Code only): {claude_only_fields}.", fix: "Fine to keep for Claude Code; don't depend on them elsewhere."} notes: - "Precedence: project > ~/.hermes/skills > skills.create_dir > external_dirs (project wins, 3/3)." - "Large bodies are spilled and paged through in small reads." diff --git a/src/skillevaluator/harness/profiles/openclaw.yaml b/src/skillevaluator/harness/profiles/openclaw.yaml index 18e3adf5a..dee064a3d 100644 --- a/src/skillevaluator/harness/profiles/openclaw.yaml +++ b/src/skillevaluator/harness/profiles/openclaw.yaml @@ -18,12 +18,15 @@ rules: - {id: OW-READ-BUDGET, when: "openclaw_read_chars > 16000 and openclaw_read_chars <= 64000 and (context_tokens < 100000 or (context_tokens < 200000 and openclaw_read_chars > 32000))", effect: degraded, outcome: instructions not delivered, message: "SKILL.md reads as {openclaw_read_chars} characters (OpenClaw counts each CJK character as 4 or more), over the read cap for this setup: the read is refused or returns a cut prefix with a truncation notice. The cap depends on the model context (16,000 under 100K tokens, 32,000 under 200K, 64,000 above; custom providers default to 128K). Pass --context-tokens to check your setup.", fix: "Keep SKILL.md under about 15,000 characters (about 3,700 CJK characters); move detail into references/ files."} - {id: OW-COMPACT, when: "description_codepoints > 220 and (catalog_size > 150 or catalog_desc_chars > 18000)", effect: degraded, outcome: listing shortened, message: "{catalog_size} skills / {catalog_desc_chars} description chars here: over 150 skills or 18,000 chars, OpenClaw cuts descriptions to 220 chars.", fix: "Keep the description under 220 characters, trigger first."} - {id: OW-NESTED, when: "nested_skill_md", effect: advisory, message: "Nested SKILL.md is ignored.", fix: "Move the nested skill to its own folder under the skills root, or rename its SKILL.md."} + - {id: OW-ALLOWED-TOOLS, when: "allowed_tools_shape != 'none'", effect: advisory, message: "allowed-tools is ignored by OpenClaw.", fix: "Don't rely on allowed-tools to restrict tools; use the harness's permission settings."} - {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)."} - {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."} - {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."} - {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."} + - {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)."} - {id: OW-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."} - {id: OW-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."} + - {id: OW-CLAUDE-ONLY, when: "claude_only_fields != ''", effect: advisory, message: "Ignored here (Claude Code only): {claude_only_fields}.", fix: "Fine to keep for Claude Code; don't depend on them elsewhere."} - {id: OW-DESC-ESCAPED, when: "description_has_quote", effect: advisory, outcome: text rewritten, message: "Double quotes in the description are shown to the model as " in the skill list.", fix: "Use single quotes in the description if the exact text matters."} notes: - "Precedence: workspace skills/ > .agents/skills > ~/.agents/skills > managed > bundled > extra dirs (project wins, 3/3)." diff --git a/src/skillevaluator/harness/profiles/opencode.yaml b/src/skillevaluator/harness/profiles/opencode.yaml index 9c53352e5..a02f92aa5 100644 --- a/src/skillevaluator/harness/profiles/opencode.yaml +++ b/src/skillevaluator/harness/profiles/opencode.yaml @@ -17,11 +17,15 @@ rules: - {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."} - {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."} - {id: OC-RELOAD, when: "always", effect: advisory, message: "Skill list and text are cached at startup; edits need a restart."} + - {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."} - {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)."} - {id: OC-REF-CUT, when: "files_over_51200 > 0", effect: advisory, outcome: needs paging, message: "{files_over_51200} files are over 51,200 bytes or 2,000 lines ({files_over_51200_paths}); OpenCode's read tool returns at most that per call, so the model must page.", fix: "Split large files into pieces under 51,200 bytes and 2,000 lines."} - {id: OC-LONG-LINES, when: "long_line_count > 0", effect: advisory, outcome: delivery truncated, message: "{long_line_count} lines over 2,000 chars ({long_line_files}) are cut when the model reads them.", fix: "Wrap long lines (tables, minified JSON) under 2,000 characters."} + - {id: OC-DMI-IGNORED, when: "disable_model_invocation", effect: degraded, message: "disable-model-invocation is ignored: the model still sees this skill and can use it on its own.", fix: "No equivalent setting in OpenCode; don't rely on it."} + - {id: OC-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: "No equivalent setting in OpenCode."} - {id: OC-ARGUMENTS, when: "uses_arguments_placeholder", effect: degraded, message: "Loaded through the skill tool, $ARGUMENTS is not substituted: the model sees the literal text (a /command run substitutes it).", fix: "Describe the expected input in words instead of $ARGUMENTS."} - {id: OC-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."} + - {id: OC-CLAUDE-ONLY, when: "claude_only_fields != ''", effect: advisory, message: "Ignored here (Claude Code only): {claude_only_fields}.", fix: "Fine to keep for Claude Code; don't depend on them elsewhere."} - {id: OC-FM-STRIPPED, when: "custom_field_chars > 200", effect: advisory, message: "Frontmatter is stripped when the skill is used, so the text in {custom_fields} never reaches the model.", fix: "Move instructions from frontmatter into the SKILL.md body."} notes: - "Docs (V1) say one level deep and a 1-1024 description; runtime matches the V2 docs: recursive, no length cap." diff --git a/src/skillevaluator/validators/schema.py b/src/skillevaluator/validators/schema.py index c54bf8078..bc78ef8b1 100644 --- a/src/skillevaluator/validators/schema.py +++ b/src/skillevaluator/validators/schema.py @@ -31,6 +31,7 @@ SKILL_MANIFEST_VARIANTS, SKILL_MD_SIZE_THRESHOLDS, SKILL_NOT_SHIPPED_DIRS, + SPEC_SKILL_FIELDS, ) from skillevaluator.logging_config import get_logger from skillevaluator.models.result import Finding, Severity @@ -823,6 +824,20 @@ def _validate_portability( ) ) + unknown = sorted(set(frontmatter.model_extra or {}) - SPEC_SKILL_FIELDS) + if unknown: + findings.append( + self._portability_finding( + "unknown_field", + Severity.LOW, + f"Frontmatter field(s) outside the agentskills.io spec: {', '.join(unknown)}; " + "agent harnesses do not pass them to the model", + file_path, + "Remove them or move them under 'metadata'", + fields=unknown, + ) + ) + for finding in findings: result.add_finding(finding) return result diff --git a/tests/harness/test_overlay.py b/tests/harness/test_overlay.py index ff5d8befb..45722b4c3 100644 --- a/tests/harness/test_overlay.py +++ b/tests/harness/test_overlay.py @@ -415,6 +415,23 @@ def test_bundle_files_symlinks_and_large_references(tmp_path: Path): assert "OC-REF-CUT" in _ids(rows, "opencode") +def test_disable_model_invocation_is_ignored_by_three_harnesses(tmp_path: Path): + rows = _rows(_skill(tmp_path, extra="disable-model-invocation: true\n")) + + flagged = {h for h, r in rows.items() if any(f["id"].endswith("DMI-IGNORED") for f in r["findings"])} + assert flagged == {"codex", "hermes", "opencode"} + + +def test_codex_implicit_policy_is_codex_only(tmp_path: Path): + skill = _skill(tmp_path) + (skill / "agents").mkdir() + (skill / "agents" / "openai.yaml").write_text("policy:\n allow_implicit_invocation: false\n") + rows = _rows(skill) + + flagged = {h for h, r in rows.items() if any(f["id"].endswith("CODEX-POLICY") for f in r["findings"])} + assert flagged == set(HARNESSES) - {"codex"} + + def test_claude_placeholders_reach_other_harnesses_literally(tmp_path: Path): rows = _rows(_skill(tmp_path, body=BODY + "Run ${CLAUDE_SKILL_DIR}/run.sh $ARGUMENTS\n")) @@ -424,6 +441,19 @@ def test_claude_placeholders_reach_other_harnesses_literally(tmp_path: Path): assert not rows["claude-code"]["findings"] +def test_gating_and_claude_only_fields(tmp_path: Path): + extra = 'argument-hint: ""\nplatforms: [macos]\n' + skill = _skill(tmp_path, extra=extra) + manifest = skill / "SKILL.md" + manifest.write_text( + manifest.read_text().replace(" author:", ' openclaw: {"requires": {"bins": ["pdftotext"]}}\n author:') + ) + rows = _rows(skill) + + assert "OC-CLAUDE-ONLY" in _ids(rows, "opencode") + assert not any(f["id"].endswith("CLAUDE-ONLY") for f in rows["claude-code"]["findings"]) + + def test_every_rule_has_a_fix_and_placeholders_are_filled(tmp_path: Path): for profile in load_profiles("all"): for rule in profile["rules"]: diff --git a/tests/validators/test_schema.py b/tests/validators/test_schema.py index 623e7042e..dd041fd9a 100644 --- a/tests/validators/test_schema.py +++ b/tests/validators/test_schema.py @@ -1705,6 +1705,14 @@ def test_description_trigger_window(self, tmp_path: Path, description: str, expe assert bool(findings) is expected assert all(f.severity == "low" for f in findings) + def test_unknown_top_level_fields_are_low(self, tmp_path: Path): + fm = _BASE_FM + "owner: team-x\nversion: 1.0.0\nlicense: MIT\nallowed-tools: Read\n" + result = SchemaValidator().validate(_write_skill(tmp_path, fm)) + + findings = _checks(result, "unknown_field") + assert result.passed, result.errors + assert [f.metadata["fields"] for f in findings] == [["owner", "version"]] + def test_portability_severity_can_be_overridden_by_policy(self, tmp_path: Path): from skillevaluator.validators.policy import ValidationPolicy From 03b5a4787bc6acdfa4bdff181aebbccd7511eb80 Mon Sep 17 00:00:00 2001 From: Christopher Kevin Date: Fri, 13 Nov 2026 15:22:08 -0800 Subject: [PATCH 05/11] fix(harness): don't flag disable-model-invocation as ignored when Codex's policy is set CX-DMI-IGNORED fired whenever disable-model-invocation was set, even when agents/openai.yaml already sets allow_implicit_invocation: false, which is the control Codex actually honours. A skill that carries both was reported as degraded in Codex although implicit invocation is off there. The rule now also requires "not codex_implicit_disabled". Hermes and OpenCode still flag it, since they ignore both controls. Signed-off-by: Christopher Kevin --- src/skillevaluator/harness/profiles/codex.yaml | 2 +- tests/harness/test_overlay.py | 12 ++++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/src/skillevaluator/harness/profiles/codex.yaml b/src/skillevaluator/harness/profiles/codex.yaml index d1f2b8c73..f39ae7c7b 100644 --- a/src/skillevaluator/harness/profiles/codex.yaml +++ b/src/skillevaluator/harness/profiles/codex.yaml @@ -20,7 +20,7 @@ rules: - {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."} - {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."} - {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)."} - - {id: CX-DMI-IGNORED, when: "disable_model_invocation", 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}."} + - {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}."} - {id: CX-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."} - {id: CX-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."} - {id: CX-CLAUDE-ONLY, when: "claude_only_fields != ''", effect: advisory, message: "Ignored here (Claude Code only): {claude_only_fields}.", fix: "Fine to keep for Claude Code; don't depend on them elsewhere."} diff --git a/tests/harness/test_overlay.py b/tests/harness/test_overlay.py index 45722b4c3..74b44b8c2 100644 --- a/tests/harness/test_overlay.py +++ b/tests/harness/test_overlay.py @@ -422,6 +422,18 @@ def test_disable_model_invocation_is_ignored_by_three_harnesses(tmp_path: Path): assert flagged == {"codex", "hermes", "opencode"} +def test_codex_policy_makes_disable_model_invocation_effective_in_codex(tmp_path: Path): + skill = _skill(tmp_path, extra="disable-model-invocation: true\n") + (skill / "agents").mkdir() + (skill / "agents" / "openai.yaml").write_text("policy:\n allow_implicit_invocation: false\n") + rows = _rows(skill) + + flagged = {h for h, r in rows.items() if any(f["id"].endswith("DMI-IGNORED") for f in r["findings"])} + assert flagged == {"hermes", "opencode"} + assert not any(f["id"].endswith("CODEX-POLICY") for r in rows.values() for f in r["findings"]) + assert rows["codex"]["status"] == "loads" + + def test_codex_implicit_policy_is_codex_only(tmp_path: Path): skill = _skill(tmp_path) (skill / "agents").mkdir() From fbb88ef8ec0d8b2d915b0c3b2e734adde14cdadf Mon Sep 17 00:00:00 2001 From: Christopher Kevin Date: Fri, 13 Nov 2026 15:22:15 -0800 Subject: [PATCH 06/11] fix(harness): drop the pointer to a CC-ALLOWED-TOOLS-HEADLESS rule that does not exist CC-ALLOWED-TOOLS told headless users to "see CC-ALLOWED-TOOLS-HEADLESS", but the profile never defines that rule, and no --headless flag exists yet. The profile has no probe evidence for how Claude Code treats allowed-tools in -p runs, so the sentence is removed rather than backed by a new not_loaded rule. Add a profile consistency test: every rule id named in a message or fix must be defined by a profile. Signed-off-by: Christopher Kevin --- src/skillevaluator/harness/profiles/claude-code.yaml | 2 +- tests/harness/test_overlay.py | 12 ++++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/src/skillevaluator/harness/profiles/claude-code.yaml b/src/skillevaluator/harness/profiles/claude-code.yaml index 5d996e33c..6a28e6b4a 100644 --- a/src/skillevaluator/harness/profiles/claude-code.yaml +++ b/src/skillevaluator/harness/profiles/claude-code.yaml @@ -14,7 +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."} - {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."} - {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."} - - {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."} + - {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.", fix: "Don't rely on allowed-tools to restrict tools; use the harness's permission settings."} - {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."} - {id: CC-BODY-CAP, when: "skill_md_bytes > 1048576", effect: not_loaded, outcome: rejected, message: "SKILL.md over 1 MB is rejected (bundle string skill_md_too_large).", fix: "Move detail into references/ files and keep SKILL.md under 1 MB."} - {id: CC-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)."} diff --git a/tests/harness/test_overlay.py b/tests/harness/test_overlay.py index 74b44b8c2..f4907f4de 100644 --- a/tests/harness/test_overlay.py +++ b/tests/harness/test_overlay.py @@ -477,6 +477,18 @@ def test_every_rule_has_a_fix_and_placeholders_are_filled(tmp_path: Path): assert {"OW-COMPACT", "OW-PROMPT-CAP"} <= _ids(rows, "openclaw") +def test_rule_ids_named_in_messages_exist(): + profiles = load_profiles("all") + known = {rule["id"] for profile in profiles for rule in profile["rules"]} + prefixes = "|".join(sorted({rule_id.split("-")[0] for rule_id in known})) + rule_id_pattern = rf"\b(?:{prefixes})-[A-Z0-9]+(?:-[A-Z0-9]+)*" + for profile in profiles: + for rule in profile["rules"]: + text = f"{rule['message']} {rule.get('fix', '')}" + for mentioned in re.findall(rule_id_pattern, text): + assert mentioned in known, f"{rule['id']} refers to {mentioned}, which no profile defines" + + def test_fix_reaches_findings_and_panels(tmp_path: Path): skill = _skill(tmp_path, desc="Use when testing emoji. " + "\U0001f600" * 600) result = HarnessValidator().validate(skill) From 99428bc3964c84bc65606b169d26f11c1165e7f0 Mon Sep 17 00:00:00 2001 From: Christopher Kevin Date: Fri, 13 Nov 2026 15:22:39 -0800 Subject: [PATCH 07/11] fix(harness): tell prices from positional arguments in $N detection A bare $5 or $20 was counted as an argument placeholder, so neither harness rule flagged it, while $1 /path/to/project (and cp $1/$2, cd /tmp/$3) was counted as a price because any slash after the number looked like a price separator. One rule now: cents, per/each/USD, a billing unit ($5/month) or a spaced slash before another amount ($4 / $20) is always a price. Otherwise an index above 3 is an amount unless a path or a closing quote/brace follows, and $0-$3 stay arguments. Signed-off-by: Christopher Kevin --- src/skillevaluator/harness/overlay.py | 23 +++++++++++++++++---- tests/harness/test_overlay.py | 29 +++++++++++++++++++++++++++ 2 files changed, 48 insertions(+), 4 deletions(-) diff --git a/src/skillevaluator/harness/overlay.py b/src/skillevaluator/harness/overlay.py index ac44380e5..e36470549 100644 --- a/src/skillevaluator/harness/overlay.py +++ b/src/skillevaluator/harness/overlay.py @@ -54,8 +54,16 @@ ) _FACT_RE = re.compile(r"\{([a-z0-9_]+)\}") _DOLLAR_N_RE = re.compile(r"(? dict[str, Any]: } +def _is_price(line: str, match: re.Match[str]) -> bool: + """A price ($4.00, $5 per month, $20 on its own) rather than an argument ($1, $1 /path/to/project).""" + if _PRICE_TAIL_RE.match(line, match.end()) or _PRICE_HEAD_RE.search(line, 0, match.start()): + return True + return int(match.group(1)) > _MAX_ARG_INDEX and not _ARG_TAIL_RE.match(line, match.end()) + + def _dollar_n(body: str, first_line: int) -> dict[str, Any]: - """Count ``$`` tokens: price-like ones ($4.00, $4 / $20 per MTok) versus bare placeholders ($1).""" + """Count ``$`` tokens: price-like ones ($4.00, $5, $4 / $20 per MTok) versus placeholders ($1, $1 /path).""" prices, placeholders, lines = 0, 0, [] for number, line in enumerate(body.splitlines(), first_line): for match in _DOLLAR_N_RE.finditer(line): - if _PRICE_TAIL_RE.match(line, match.end()) or _PRICE_HEAD_RE.search(line, 0, match.start()): + if _is_price(line, match): prices += 1 if number not in lines: lines.append(number) diff --git a/tests/harness/test_overlay.py b/tests/harness/test_overlay.py index ff5d8befb..c33dbe91f 100644 --- a/tests/harness/test_overlay.py +++ b/tests/harness/test_overlay.py @@ -490,6 +490,35 @@ def test_price_like_dollar_numbers_are_flagged_with_lines(tmp_path: Path): assert skill_facts(tmp_path / "b" / "skills" / "demo-skill")["dollar_placeholder_count"] == 1 +@pytest.mark.parametrize( + ("line", "prices", "placeholders"), + [ + ("Budget is $5.", 1, 0), + ("The plan costs $20", 1, 0), + ("A $20 plan for the team (about $50).", 2, 0), + ("Batch $3 / $15 per MTok, or $5/month.", 3, 0), + ("Run $1 /path/to/project", 0, 1), + ("cp $1/$2 ~/notes; cd /tmp/$3", 0, 3), + ("Copy $5 /tmp/out and $6 ~/notes", 0, 2), + ("awk '{print $5}' and \"$9\"", 0, 2), + ("Use $0, $1 and $2 as the inputs.", 0, 3), + ], +) +def test_dollar_n_is_a_price_or_an_argument_not_both(tmp_path: Path, line: str, prices: int, placeholders: int): + facts = skill_facts(_skill(tmp_path, body=f"{BODY}{line}\n")) + + assert (facts["dollar_literal_count"], facts["dollar_placeholder_count"]) == (prices, placeholders), line + + +def test_standalone_prices_are_flagged_and_path_arguments_are_not(tmp_path: Path): + prices = _rows(_skill(tmp_path / "a", body=BODY + "The plan costs $20, with a $5 credit.\n")) + args = _rows(_skill(tmp_path / "b", body=BODY + "Run $1 /path/to/project, then cp $1/$2 out.\n")) + + for harness, rule in (("claude-code", "CC-DOLLAR-N"), ("opencode", "OC-DOLLAR-N")): + assert any(f["id"] == rule and "2 price-like" in f["message"] for f in prices[harness]["findings"]), harness + assert rule not in _ids(args, harness), harness + + def test_every_oversized_file_long_line_and_unlisted_folder_is_counted(tmp_path: Path): skill = _skill(tmp_path) for rel, size in {"references/a.md": 51_201, "shared/b.md": 64_001, "shared/c.md": 51_200}.items(): From a12392ea3e120daaef6c8e4661b7127239727a4d Mon Sep 17 00:00:00 2001 From: Christopher Kevin Date: Fri, 13 Nov 2026 15:24:00 -0800 Subject: [PATCH 08/11] fix(harness): skip unreadable and binary resources, measure symlinked references The delivery-limit facts read every bundled file as text, which broke three ways: an unreadable file, a symlink loop or a pipe in the skill folder aborted the whole run (a pipe would block it), binary assets were decoded into long "lines" and flagged as needing paging, and symlinked references were dropped from the size and line counts even though OpenCode follows them. Read each file through one helper that returns nothing for binary data (a NUL byte in the first 8 KiB) and anything that cannot be read, and measure symlinks that point outside the skill like regular files for the OpenCode rules. Links into the skill are still counted once, under their real path, and the OpenClaw multi-read count stays on files inside the skill. Signed-off-by: Christopher Kevin --- src/skillevaluator/harness/overlay.py | 40 ++++++++++++++----- tests/harness/test_overlay.py | 55 +++++++++++++++++++++++++++ 2 files changed, 86 insertions(+), 9 deletions(-) diff --git a/src/skillevaluator/harness/overlay.py b/src/skillevaluator/harness/overlay.py index 9bcab0240..ed9c0c69a 100644 --- a/src/skillevaluator/harness/overlay.py +++ b/src/skillevaluator/harness/overlay.py @@ -248,6 +248,25 @@ def _paths(items: list[str]) -> str: return ", ".join(items[:3]) + (f" +{len(items) - 3} more" if len(items) > 3 else "") +def _read_text(path: Path) -> tuple[int, list[str]] | None: + """Size and lines of a text file a harness could read; None for binary data and files that can't be read. + + The check is advisory, so anything odd is skipped instead of raised: binary data (a NUL byte in the + first 8 KiB), a pipe or device that would block, a broken or looping link, a file without permission. + """ + try: + if not path.is_file(): + return None + with path.open("rb") as handle: + head = handle.read(8192) + if b"\0" in head: + return None + data = head + handle.read() + except OSError: + return None + return len(data), data.decode("utf-8", "replace").splitlines() + + def _bundle_facts(skill_path: Path, manifest: Path) -> dict[str, Any]: base = skill_path.resolve() links, escapes, sizes, long_lines, unlisted = [], [], [], [], [] @@ -255,18 +274,21 @@ def _bundle_facts(skill_path: Path, manifest: Path) -> dict[str, Any]: rel = path.relative_to(skill_path).as_posix() if path.is_symlink(): links.append(rel) - target = path.resolve() - if target != base and base not in target.parents: - escapes.append(rel) - continue - lines = path.read_bytes().decode("utf-8", "replace").splitlines() - sizes.append((rel, path.stat().st_size, len(lines))) - long_lines += [rel] * sum(len(line) > 2000 for line in lines) - if rel.split("/", 1)[0] not in _HERMES_LINKED_DIRS: + target = Path(os.path.realpath(path)) # unlike Path.resolve(), no error on a symlink loop + if target == base or base in target.parents: + continue # counted under its own path + escapes.append(rel) # OpenCode follows it, so what it points to is read (and cut) like any file + elif rel.split("/", 1)[0] not in _HERMES_LINKED_DIRS: unlisted.append(rel) + text = _read_text(path) + if text is not None: + size, lines = text + sizes.append((rel, size, len(lines))) + long_lines += [rel] * sum(len(line) > 2000 for line in lines) largest = max(sizes, key=lambda item: item[1], default=("", 0, 0)) paged = [rel for rel, size, count in sizes if size > 51200 or count > 2000] - multi_read = [rel for rel, size, _ in sizes if size > 64000] + # Only OpenCode is known to follow symlinks to files outside the skill; OpenClaw's reads are not tested there. + multi_read = [rel for rel, size, _ in sizes if size > 64000 and rel not in escapes] return { "resource_symlinks": len(links), "resource_symlink_paths": _paths(links), diff --git a/tests/harness/test_overlay.py b/tests/harness/test_overlay.py index 7c67ee842..666706c88 100644 --- a/tests/harness/test_overlay.py +++ b/tests/harness/test_overlay.py @@ -3,6 +3,7 @@ """Tests for the advisory harness check, panel and harness-check command.""" import json +import os import re from pathlib import Path @@ -487,6 +488,60 @@ def test_every_oversized_file_long_line_and_unlisted_folder_is_counted(tmp_path: assert {"HM-LINKED-LAYOUT"} <= _ids(rows, "hermes") and "OW-REF-BUDGET" in _ids(rows, "openclaw") +def test_unreadable_resources_are_skipped_not_raised(tmp_path: Path): + skill = _skill(tmp_path) + refs = skill / "references" + refs.mkdir() + (refs / "ok.md").write_text("x" * 100) + (refs / "locked.md").write_text("secret") + (refs / "locked.md").chmod(0) + (refs / "dangling.md").symlink_to(tmp_path / "missing.md") + (refs / "loop").symlink_to(refs / "loop") + os.mkfifo(refs / "pipe") # reading a pipe would block forever + + facts = skill_facts(skill) + result = HarnessValidator().validate(skill) + + assert facts["largest_resource"] == "references/ok.md" + assert facts["resource_symlinks"] == 2 + assert result.metadata["harness_compatibility"][str(skill)] + + +def test_symlinked_reference_outside_the_skill_still_needs_paging(tmp_path: Path): + skill = _skill(tmp_path) + (skill / "references").mkdir() + shared = tmp_path / "shared.md" + shared.write_text("line\n" * 20_000 + "w" * 2_001 + "\n") + (skill / "references" / "shared.md").symlink_to(shared) + (skill / "real").mkdir() + (skill / "real" / "big.md").write_text("line\n" * 20_000) + (skill / "references" / "big.md").symlink_to(skill / "real" / "big.md") + facts = skill_facts(skill) + rows = _rows(skill) + + assert facts["resource_symlinks"] == 2 and facts["resource_symlink_escapes"] == 1 + # The link into the skill is counted once, under its real path; the one leaving it is read through the link. + assert facts["files_over_51200_paths"] == "real/big.md, references/shared.md" + assert facts["long_line_files"] == "references/shared.md" + assert {"OC-REF-CUT", "OC-LONG-LINES"} <= _ids(rows, "opencode") + # OpenClaw is not known to read through links, so its multi-read count stays on files inside the skill. + assert facts["files_over_64000_paths"] == "real/big.md" and "OW-REF-BUDGET" in _ids(rows, "openclaw") + + +def test_binary_resources_are_not_read_as_text(tmp_path: Path): + skill = _skill(tmp_path) + (skill / "assets").mkdir() + (skill / "assets" / "padded.bin").write_bytes(b"\x89PNG\r\n\x1a\n" + b"\x00" * 5_000 + bytes(range(256))) + (skill / "assets" / "photo.png").write_bytes(bytes(range(256)) * 400) + facts = skill_facts(skill) + rows = _rows(skill) + + assert (facts["long_line_count"], facts["files_over_51200"], facts["files_over_64000"]) == (0, 0, 0) + assert facts["largest_resource"] == "" + assert not {"OC-REF-CUT", "OC-LONG-LINES"} & _ids(rows, "opencode") + assert "OW-REF-BUDGET" not in _ids(rows, "openclaw") + + def test_compact_view_shows_worst_finding_per_harness_and_catalog(tmp_path: Path): _catalog(tmp_path, 40) block = harness_block(run_validation(tmp_path / ".claude" / "skills" / "filler-000", checks="harness")) From 89813758268e3ed673cc8fea7b1ef288c5e776bc Mon Sep 17 00:00:00 2001 From: Christopher Kevin Date: Fri, 13 Nov 2026 15:35:00 -0800 Subject: [PATCH 09/11] fix(harness): keep each skills folder its own catalog and follow symlinked skills facts_for put every skill from one scan into a single catalog, so a repo with both .claude/skills and .codex/skills got false duplicate-name and budget findings. Skills are now grouped by the folder they are installed in, and each skill is measured against everything in that folder. A skill directly under a workspace skills/ folder (OpenClaw) now counts its siblings too; it used to be measured alone because skills/ is not a recognized install root. Install-root rules are unchanged. _find_skills used rglob, which does not descend into symlinked folders, so skills installed as links (which Claude Code and Codex load) were left out of the counts and the duplicate-name check. It now follows links and stops at a link back to one of its own parent folders. Signed-off-by: Christopher Kevin --- CHANGELOG.md | 3 +- docs/tier1-validation.mdx | 3 +- src/skillevaluator/harness/overlay.py | 55 ++++++++++++++++++--------- tests/harness/test_overlay.py | 54 ++++++++++++++++++++++++++ 4 files changed, 94 insertions(+), 21 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ee49aa083..b0dbc5eb2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,7 +15,8 @@ All notable changes to SkillEvaluator are documented in this file. - The `harness` check measures a skill together with the skills installed beside it: list budgets (scaled by the context window), duplicate names and which copy each harness uses, and OpenClaw's prompt cap and compact list. A `catalog` line - in the panel names the folder measured. + in the panel names the folder measured. Skills in separate folders are measured + separately. - `harness` rules for where `SKILL.md` lives: casing, nested manifests, symlinked manifests and resources, OpenClaw symlink escapes, Codex scan depth, and files Hermes leaves out of its file list. Tier 1 `schema` now reports a symlinked or diff --git a/docs/tier1-validation.mdx b/docs/tier1-validation.mdx index d860a2c7c..07491b299 100644 --- a/docs/tier1-validation.mdx +++ b/docs/tier1-validation.mdx @@ -283,8 +283,7 @@ For `validate`, the default set is `schema`, `version`, `security`, `pii`, `lice Location rules: `SKILL.md` casing, nested manifests, symlinked manifests and resources, OpenClaw symlink escapes, Codex scan depth, and files Hermes leaves out of its file list (outside `references/`, `templates/`, `assets/` and `scripts/`). - The check measures the skill together with the skills installed next to it. A single skill under a harness root such as `.claude/skills` is counted with everything in that folder; a folder of skills is its own catalog. That drives the list-budget rules (Claude Code and Codex ~8,000 description chars, Copilot 32 full descriptions, OpenClaw 150 skills or 18,000 chars) and a duplicate-name rule per harness that says which copy wins. A `catalog` line in the panel names the folder. - + The check measures the skill together with the skills installed next to it. A single skill under a harness root such as `.claude/skills`, or in a workspace `skills/` folder, is counted with everything in that folder (symlinked skill folders included). Skills in different folders are separate installations, and a folder of skills is its own catalog. That drives the list-budget rules (Claude Code and Codex ~8,000 description chars, Copilot 32 full descriptions, OpenClaw 150 skills or 18,000 chars) and a duplicate-name rule per harness that says which copy wins. A `catalog` line in the panel names the folder. `security-scan`, and the `security` check inside `validate`, run SkillSpector. Static scanning covers common skill attack patterns such as prompt injection and data exfiltration; each finding carries the matched pattern, severity, and location. diff --git a/src/skillevaluator/harness/overlay.py b/src/skillevaluator/harness/overlay.py index 3dd0ffae8..b3c042d2a 100644 --- a/src/skillevaluator/harness/overlay.py +++ b/src/skillevaluator/harness/overlay.py @@ -300,31 +300,50 @@ def _display(self, path: Path) -> str: def _find_skills(folder: Path) -> list[Path]: - found = { - p.parent - for n in SKILL_MANIFEST_VARIANTS - for p in folder.rglob(n) - if not any(part in SCAN_EXCLUDED_DIRS for part in p.relative_to(folder).parts) - } + """Skill folders under ``folder``, symlinked ones included (Claude Code and Codex load those).""" + found: set[Path] = set() + for here, dirs, files in os.walk(folder, followlinks=True): + path = Path(here).absolute() + if path.is_symlink() and path.resolve() in {parent.resolve() for parent in path.parents}: + dirs.clear() # a link back to one of its own parent folders + continue + dirs[:] = [d for d in dirs if d not in SCAN_EXCLUDED_DIRS] + if any(n in files for n in SKILL_MANIFEST_VARIANTS): + found.add(Path(here)) return sorted(s for s in found if not any(parent in found for parent in s.parents)) +def _catalog_base(skill: Path) -> Path | None: + """The skills folder a skill is installed in: a harness root, or a workspace ``skills/`` folder (OpenClaw).""" + root, depth = _install_root(skill) + if root is not None: + return skill.absolute().parents[depth] + parent = skill.absolute().parent + return parent if parent.name == "skills" else None + + +def _catalog_of(group: list[Path]) -> Catalog: + base = _catalog_base(group[0]) + if base is not None: + return Catalog.of(_find_skills(base) or group, base) + 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]]: """Facts per skill, with the catalog they are installed in. - Several skills form their own catalog. A single skill under a known skills folder - (e.g. ``.claude/skills``) is measured against everything installed in that folder. + 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. """ - members, base = skills, None - if len(skills) == 1: - root, depth = _install_root(skills[0]) - if root is not None: - base = skills[0].absolute().parents[depth] - members = _find_skills(base) or skills - elif skills: - base = Path(os.path.commonpath([s.resolve() for s in skills])) - catalog = Catalog.of(members, base) - return {skill: skill_facts(skill, catalog) for skill in skills} + groups: dict[Path | None, list[Path]] = {} + for skill in skills: + base = _catalog_base(skill) + groups.setdefault(base.resolve() if base else None, []).append(skill) + 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} def _utf16_units(value: Any) -> int: diff --git a/tests/harness/test_overlay.py b/tests/harness/test_overlay.py index 18b350d97..24013c1e8 100644 --- a/tests/harness/test_overlay.py +++ b/tests/harness/test_overlay.py @@ -387,6 +387,60 @@ def test_duplicate_names_report_each_harness_winner(tmp_path: Path): assert "(filler-copy)" in next(f["message"] for f in rows["opencode"]["findings"] if f["id"] == "OC-DUP-NAME") +def _install(folder: Path, dirname: str, name: str | None = None) -> Path: + skill = folder / dirname + skill.mkdir(parents=True) + (skill / "SKILL.md").write_text( + f"---\nname: {name or dirname}\ndescription: Use when testing catalogs.\n---\n{BODY}", encoding="utf-8" + ) + return skill + + +def test_separate_skills_folders_are_separate_catalogs(tmp_path: Path): + claude = [_install(tmp_path / ".claude" / "skills", n) for n in ("alpha", "beta")] + codex = [_install(tmp_path / ".codex" / "skills", n) for n in ("alpha", "gamma", "delta")] + + facts = facts_for([*claude, *codex]) + + assert [facts[s]["catalog_size"] for s in claude] == [2, 2] + assert [facts[s]["catalog_size"] for s in codex] == [3, 3, 3] + assert not any(f["duplicate_name"] for f in facts.values()) + assert facts[claude[0]]["catalog_base"].endswith(".claude/skills") + + +def test_unrooted_skills_given_together_stay_one_catalog(tmp_path: Path): + pack = [_install(tmp_path / "pack", n, name="same") for n in ("one", "two")] + + facts = facts_for(pack) + + assert {f["catalog_size"] for f in facts.values()} == {2} + assert all(f["duplicate_name"] for f in facts.values()) + + +def test_workspace_skills_folder_counts_its_siblings(tmp_path: Path): + first = _install(tmp_path / "skills", "first", name="same") + _install(tmp_path / "skills", "second", name="same") + + facts = facts_for([first])[first] + + assert facts["install_root"] is None + assert facts["catalog_size"] == 2 and facts["catalog_base"].endswith("skills") + assert "OW-DUP-NAME" in _ids(_rows(first), "openclaw") + + +def test_symlinked_skill_folders_count_toward_the_catalog(tmp_path: Path): + skills = tmp_path / ".claude" / "skills" + real = _install(skills, "real", name="same") + store = _install(tmp_path / "store", "linked", name="same") + (skills / "linked").symlink_to(store, target_is_directory=True) + (skills / "loop").symlink_to(skills, target_is_directory=True) # a link back to its own folder + + facts = facts_for([real])[real] + + assert facts["catalog_size"] == 2 + assert facts["duplicate_name"] + + def test_listed_description_projection(tmp_path: Path): desc = "Use when " + "a" * 1600 rows = _rows(_skill(tmp_path, desc=desc)) From 9009157ffb7ea1a06c3ce4942f888b66cd655cfb Mon Sep 17 00:00:00 2001 From: Christopher Kevin Date: Fri, 13 Nov 2026 15:36:13 -0800 Subject: [PATCH 10/11] fix(harness): report the Copilot CLI and OpenCode reload notes CP-RELOAD and OC-RELOAD are "always" advisory rules, but evaluate_profile skipped every always+advisory rule, so the notes never reached any report. Drop the skip; the notes now show as advisory findings and the status stays "loads". Signed-off-by: Christopher Kevin --- CHANGELOG.md | 2 +- docs/tier1-validation.mdx | 2 +- src/skillevaluator/harness/overlay.py | 2 -- tests/harness/test_overlay.py | 9 +++++++++ 4 files changed, 11 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b0dbc5eb2..2c65987c8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,7 +16,7 @@ All notable changes to SkillEvaluator are documented in this file. it: list budgets (scaled by the context window), duplicate names and which copy each harness uses, and OpenClaw's prompt cap and compact list. A `catalog` line in the panel names the folder measured. Skills in separate folders are measured - separately. + separately, and Copilot CLI and OpenCode get an advisory reload note. - `harness` rules for where `SKILL.md` lives: casing, nested manifests, symlinked manifests and resources, OpenClaw symlink escapes, Codex scan depth, and files Hermes leaves out of its file list. Tier 1 `schema` now reports a symlinked or diff --git a/docs/tier1-validation.mdx b/docs/tier1-validation.mdx index 07491b299..d6f38f3a2 100644 --- a/docs/tier1-validation.mdx +++ b/docs/tier1-validation.mdx @@ -283,7 +283,7 @@ For `validate`, the default set is `schema`, `version`, `security`, `pii`, `lice Location rules: `SKILL.md` casing, nested manifests, symlinked manifests and resources, OpenClaw symlink escapes, Codex scan depth, and files Hermes leaves out of its file list (outside `references/`, `templates/`, `assets/` and `scripts/`). - The check measures the skill together with the skills installed next to it. A single skill under a harness root such as `.claude/skills`, or in a workspace `skills/` folder, is counted with everything in that folder (symlinked skill folders included). Skills in different folders are separate installations, and a folder of skills is its own catalog. That drives the list-budget rules (Claude Code and Codex ~8,000 description chars, Copilot 32 full descriptions, OpenClaw 150 skills or 18,000 chars) and a duplicate-name rule per harness that says which copy wins. A `catalog` line in the panel names the folder. + The check measures the skill together with the skills installed next to it. A single skill under a harness root such as `.claude/skills`, or in a workspace `skills/` folder, is counted with everything in that folder (symlinked skill folders included). Skills in different folders are separate installations, and a folder of skills is its own catalog. That drives the list-budget rules (Claude Code and Codex ~8,000 description chars, Copilot 32 full descriptions, OpenClaw 150 skills or 18,000 chars) and a duplicate-name rule per harness that says which copy wins. A `catalog` line in the panel names the folder. Copilot CLI and OpenCode also get an advisory note on when new or edited skills are picked up. `security-scan`, and the `security` check inside `validate`, run SkillSpector. Static scanning covers common skill attack patterns such as prompt injection and data exfiltration; each finding carries the matched pattern, severity, and location. diff --git a/src/skillevaluator/harness/overlay.py b/src/skillevaluator/harness/overlay.py index b3c042d2a..1878bd6cf 100644 --- a/src/skillevaluator/harness/overlay.py +++ b/src/skillevaluator/harness/overlay.py @@ -506,8 +506,6 @@ def evaluate_profile( continue if expression != "always" and not _Rule.evaluate(expression, names): continue - if expression == "always" and rule["effect"] == "advisory": - continue finding = {"id": rule["id"], "effect": rule["effect"], "message": _fill(rule["message"], facts)} for key in ("fix", "outcome"): if rule.get(key): diff --git a/tests/harness/test_overlay.py b/tests/harness/test_overlay.py index 24013c1e8..d32a92cf3 100644 --- a/tests/harness/test_overlay.py +++ b/tests/harness/test_overlay.py @@ -441,6 +441,15 @@ def test_symlinked_skill_folders_count_toward_the_catalog(tmp_path: Path): assert facts["duplicate_name"] +def test_reload_guidance_reaches_findings(tmp_path: Path): + rows = _rows(_skill(tmp_path)) + + reload = {f["id"]: f for r in rows.values() for f in r["findings"] if f["id"].endswith("RELOAD")} + assert set(reload) == {"CP-RELOAD", "OC-RELOAD"} + assert {f["effect"] for f in reload.values()} == {"advisory"} + assert {r["status"] for r in rows.values()} == {"loads"} + + def test_listed_description_projection(tmp_path: Path): desc = "Use when " + "a" * 1600 rows = _rows(_skill(tmp_path, desc=desc)) From 09b1489d770a956606249bb5488c39c034d3e017 Mon Sep 17 00:00:00 2001 From: Christopher Kevin Date: Fri, 13 Nov 2026 15:36:50 -0800 Subject: [PATCH 11/11] docs(harness): keep the Accordion closing tag on its own line The skills-folder paragraph edit had left at the end of the text line, which MDX can reject inside a paragraph. Signed-off-by: Christopher Kevin --- docs/tier1-validation.mdx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/docs/tier1-validation.mdx b/docs/tier1-validation.mdx index d6f38f3a2..09a3bf383 100644 --- a/docs/tier1-validation.mdx +++ b/docs/tier1-validation.mdx @@ -283,7 +283,8 @@ For `validate`, the default set is `schema`, `version`, `security`, `pii`, `lice Location rules: `SKILL.md` casing, nested manifests, symlinked manifests and resources, OpenClaw symlink escapes, Codex scan depth, and files Hermes leaves out of its file list (outside `references/`, `templates/`, `assets/` and `scripts/`). - The check measures the skill together with the skills installed next to it. A single skill under a harness root such as `.claude/skills`, or in a workspace `skills/` folder, is counted with everything in that folder (symlinked skill folders included). Skills in different folders are separate installations, and a folder of skills is its own catalog. That drives the list-budget rules (Claude Code and Codex ~8,000 description chars, Copilot 32 full descriptions, OpenClaw 150 skills or 18,000 chars) and a duplicate-name rule per harness that says which copy wins. A `catalog` line in the panel names the folder. Copilot CLI and OpenCode also get an advisory note on when new or edited skills are picked up. + The check measures the skill together with the skills installed next to it. A single skill under a harness root such as `.claude/skills`, or in a workspace `skills/` folder, is counted with everything in that folder (symlinked skill folders included). Skills in different folders are separate installations, and a folder of skills is its own catalog. That drives the list-budget rules (Claude Code and Codex ~8,000 description chars, Copilot 32 full descriptions, OpenClaw 150 skills or 18,000 chars) and a duplicate-name rule per harness that says which copy wins. A `catalog` line in the panel names the folder. Copilot CLI and OpenCode also get an advisory note on when new or edited skills are picked up. + `security-scan`, and the `security` check inside `validate`, run SkillSpector. Static scanning covers common skill attack patterns such as prompt injection and data exfiltration; each finding carries the matched pattern, severity, and location.