Multi-tier framework for evaluating AI agent skills and plugins with quality gates, security scanning, harness compatibility checks, semantic overlap detection, synthetic evaluation dataset generation, and live agent evaluation that measures how skills affect agent behavior. Ships reusable CI templates that bring every check to any repository.
Python agent-evaluationagent-pluginsagent-securityagent-skillsagentic-aibenchmarkci-templatesclaude-codecodexevaluateevaluationharnesspluginplugin-evaluationsecurity-scannerskill-evalskill-evaluationskill-evaluatorskill-gap-analysisskills
fix(quality): derive instruction tokens from parsed frontmatter (#356)
YMuskrat1af2693d7dbe
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex a32cf9c7..49b08522 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -165,6 +165,10 @@ All notable changes to SkillEvaluator are documented in this file.- Read JSON, JSONL and YAML evaluation datasets as UTF-8 so Unicode prompts andanswers load correctly on hosts with a non-UTF-8 default text encoding.+- Estimate Tier 1 instruction tokens from the parsed Markdown body, so `---`+ inside YAML values or comments does not count frontmatter as instructions.+ Body separators without valid frontmatter no longer produce a spurious estimate.+- A PII finding no longer keeps its `evidence_sha256` after CI redaction masksa credential inside the value the finding reports. In 0.8.0 the finding keptthe digest of the unmasked value, so anyone holding the redacted report coulddiff --git a/src/skillevaluator/validators/quality_score.py b/src/skillevaluator/validators/quality_score.pyindex c8c12e93..211986c5 100644--- a/src/skillevaluator/validators/quality_score.py+++ b/src/skillevaluator/validators/quality_score.py@@ -877,11 +877,9 @@ class QualityScoreValidator(ValidatorBase):# Token estimatesqs.total_tokens = len(content) // 4fm_match = FRONTMATTER_PATTERN.match(content)- if fm_match:+ if fm_match and _frontmatter:qs.frontmatter_tokens = len(fm_match.group(1)) // 4- inst_start = content.find("---", 3) + 3- if inst_start > 3:- qs.instructions_tokens = len(content[inst_start:]) // 4+ qs.instructions_tokens = len(fm_match.group(2)) // 4# The token budget is a recommendation: exceeding it is advisory (MEDIUM),# and the deduction still counts toward the --min-score gate.diff --git a/tests/validators/test_quality_score.py b/tests/validators/test_quality_score.pyindex 4866318f..5ec6c61a 100644--- a/tests/validators/test_quality_score.py+++ b/tests/validators/test_quality_score.py@@ -1482,3 +1482,52 @@ class TestQualityScoreDeterministicContracts:)assert "Instructions lack clear action verbs" not in messages++[email protected]("newline", ["\n", "\r\n"])+ "extra_yaml",+ [+ 'description: "Use --- when separating sections in Markdown."\n',+ 'description: Use for testing instruction token estimates.\nmetadata:\n notes: "first---second"\n',+ "description: Use for testing instruction token estimates.\n# --- is not a frontmatter delimiter here\n",+ ],+)+def test_instruction_token_estimate_uses_frontmatter_boundary(tmp_path, newline, extra_yaml):+ skill_dir = tmp_path / "token-boundary"+ skill_dir.mkdir()+ body = "## Instructions\n\n- Run the documented task.\n"+ frontmatter = "name: token-boundary\n" + extra_yaml+ content = "---\n" + frontmatter + "---\n" + body+ (skill_dir / "SKILL.md").write_bytes(content.replace("\n", newline).encode())++ result = QualityScoreValidator(min_score=0).validate(skill_dir)+ metrics = result.metadata["quality_scores"]["metrics"]++ assert metrics["instructions_tokens"] == len(body) // 4+ assert metrics["frontmatter_tokens"] == len(frontmatter.rstrip("\n")) // 4+ assert metrics["total_tokens"] == len(content) // 4+++ "content",+ [+ "## Instructions\n\n- Run the task.\n\n---\nSupporting prose.\n",+ "---\nname: unclosed-frontmatter\n",+ "---\nname: unclosed-frontmatter\n\n## Instructions\n\n- Run the task.\n\n---\nSupporting prose.\n",+ "---\n---\n## Instructions\n\n- Run the task.\n\n---\nSupporting prose.\n",+ "---\nname: [invalid-yaml\n---\n## Instructions\n\n- Run the task.\n",+ ],+ ids=["body-separator", "unclosed", "unclosed-with-body-separator", "empty-with-body-separator", "invalid-yaml"],+)+def test_instruction_tokens_do_not_infer_frontmatter_from_body_separators(tmp_path, content):+ skill_dir = tmp_path / "no-frontmatter"+ skill_dir.mkdir()+ (skill_dir / "SKILL.md").write_text(content, encoding="utf-8")++ result = QualityScoreValidator(min_score=0).validate(skill_dir)+ metrics = result.metadata["quality_scores"]["metrics"]++ assert metrics["has_frontmatter"] is False+ assert metrics["frontmatter_tokens"] == 0+ assert metrics["instructions_tokens"] == 0