Skip to content

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

Label the Tier 1 token count as an estimate (#473)

Christopher Kevin2df836532091
diff --git a/CHANGELOG.md b/CHANGELOG.md
index de691b25..66910748 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -291,6 +291,11 @@ All notable changes to SkillEvaluator are documented in this file.
agent, verifier, and artifact evidence under Harbor's new mount checks, and
retain explicit Codex gateway URLs, credential aliases, and full model identifiers.
+- Tier 1 labels the `SKILL.md` token count as an estimate (characters / 4) in
+ the Large skill finding, the HTML report and the docs, and adds
+ `metrics.estimated_tokens` and `metrics.estimate_method` to the quality JSON.
+ `metrics.total_tokens` keeps the same value and scoring is unchanged.
+
- Name Skill Lift as the headline comparison and label pass@k differences as
supporting reliability across reports and terminal output.
diff --git a/docs/tier1-validation.mdx b/docs/tier1-validation.mdx
index 1bce9b5e..3d104295 100644
--- a/docs/tier1-validation.mdx
+++ b/docs/tier1-validation.mdx
@@ -346,9 +346,9 @@ For `validate`, the default set is `schema`, `version`, `security`, `pii`, `lice
| Correctness | 35% | Frontmatter, naming, examples, paths, and skill-type-specific structure |
| Discoverability | 25% | Description quality, trigger wording, purpose, scope, and naming |
| Reliability | 25% | Error handling, prerequisites, limitations, troubleshooting, and implementation safeguards |
- | Efficiency | 15% | Token budget, body length, repetition, instruction clarity, and reference use |
+ | Efficiency | 15% | Estimated token budget, body length, repetition, instruction clarity, and reference use |
- The 5,000-token budget for `SKILL.md` is a recommendation, not a hard limit. A larger `SKILL.md` gets a MEDIUM `quality_efficiency` finding and a 15-point Efficiency deduction. The finding does not fail the check by itself, but the deduction can still take the score below `--min-score`.
+ The 5,000-token budget for `SKILL.md` is a recommendation, not a hard limit. Token counts are estimates (characters divided by 4), not tokenizer output: each model family counts differently, and dense files with tables, identifiers or code spans usually have fewer than 4 characters per token, so the estimate runs low. `metrics.estimated_tokens` holds the estimate and `metrics.estimate_method` names how it was made; `metrics.total_tokens` is kept as the same value for existing consumers. A larger `SKILL.md` gets a MEDIUM `quality_efficiency` finding and a 15-point Efficiency deduction. The finding does not fail the check by itself, but the deduction can still take the score below `--min-score`.
Grades are A for scores of at least 90, B for at least 80, C for at least 70, D for at least 60, and F below 60. The default `--min-score` is 70. Passing requires the score to reach that minimum and no HIGH or CRITICAL quality findings under the active policy.
diff --git a/src/skillevaluator/constants.py b/src/skillevaluator/constants.py
index 78313947..4826586b 100644
--- a/src/skillevaluator/constants.py
+++ b/src/skillevaluator/constants.py
@@ -386,6 +386,8 @@ QUALITY_SCORE_WEIGHTS = {
QUALITY_GRADE_THRESHOLDS = [(90, "A"), (80, "B"), (70, "C"), (60, "D"), (0, "F")]
QUALITY_DEFAULT_MIN_SCORE = 70
QUALITY_RECOMMENDED_MAX_TOKENS = 5000
+# Tier 1 estimates tokens as characters / QUALITY_CHARS_PER_TOKEN; it does not run a tokenizer.
+QUALITY_CHARS_PER_TOKEN = 4
QUALITY_MAX_BODY_LINES = 500
QUALITY_RESERVED_NAMES = ["anthropic", "claude"]
diff --git a/src/skillevaluator/models/quality.py b/src/skillevaluator/models/quality.py
index be4e098b..bcc083d2 100644
--- a/src/skillevaluator/models/quality.py
+++ b/src/skillevaluator/models/quality.py
@@ -13,6 +13,7 @@ from __future__ import annotations
from dataclasses import dataclass, field
from skillevaluator.constants import (
+ QUALITY_CHARS_PER_TOKEN,
QUALITY_GRADE_THRESHOLDS,
QUALITY_RECOMMENDED_MAX_TOKENS,
QUALITY_SCORE_WEIGHTS,
@@ -159,6 +160,8 @@ class QualityScoreResult:
},
"metrics": {
"total_tokens": self.total_tokens,
+ "estimated_tokens": self.total_tokens,
+ "estimate_method": f"characters/{QUALITY_CHARS_PER_TOKEN}",
"recommended_max_tokens": QUALITY_RECOMMENDED_MAX_TOKENS,
"frontmatter_tokens": self.frontmatter_tokens,
"instructions_tokens": self.instructions_tokens,
diff --git a/src/skillevaluator/reporting/templates/report.html.j2 b/src/skillevaluator/reporting/templates/report.html.j2
index 486dd882..11fa07b4 100644
--- a/src/skillevaluator/reporting/templates/report.html.j2
+++ b/src/skillevaluator/reporting/templates/report.html.j2
@@ -1846,7 +1846,7 @@
</table>
{% if skill_data.quality.metrics is defined %}
<div style="margin-top: 0.5rem; font-size: 0.8rem; color: var(--text-secondary);">
- Tokens: {{ skill_data.quality.metrics.total_tokens }}
+ Est. tokens{% if skill_data.quality.metrics.estimate_method is defined %} ({{ skill_data.quality.metrics.estimate_method }}){% endif %}: {{ skill_data.quality.metrics.total_tokens }}
{% if skill_data.quality.metrics.recommended_max_tokens is defined %}
(recommended max: &lt;{{ skill_data.quality.metrics.recommended_max_tokens }})
{% endif %}
diff --git a/src/skillevaluator/utils/redaction.py b/src/skillevaluator/utils/redaction.py
index cc10ff7a..5c926746 100644
--- a/src/skillevaluator/utils/redaction.py
+++ b/src/skillevaluator/utils/redaction.py
@@ -42,6 +42,7 @@ _PLURAL_SECRET_KEY_PARTS = {
_TOKEN_COUNT_KEYS = {
"cached_tokens",
"completion_tokens",
+ "estimated_tokens",
"expected_max_tokens",
"frontmatter_tokens",
"input_tokens",
diff --git a/src/skillevaluator/validators/quality_score.py b/src/skillevaluator/validators/quality_score.py
index f770e272..71ba6970 100644
--- a/src/skillevaluator/validators/quality_score.py
+++ b/src/skillevaluator/validators/quality_score.py
@@ -28,6 +28,7 @@ import yaml
from skillevaluator.constants import (
EXECUTABLE_SKILL_DIRS,
+ QUALITY_CHARS_PER_TOKEN,
QUALITY_EXCLUDED_DIRS,
QUALITY_RECOMMENDED_MAX_TOKENS,
QUALITY_RESERVED_NAMES,
@@ -836,12 +837,12 @@ class QualityScoreValidator(ValidatorBase):
) -> None:
dim = qs.efficiency
- # Token estimates
- qs.total_tokens = len(content) // 4
+ # Token estimates (characters / QUALITY_CHARS_PER_TOKEN); not a tokenizer count
+ qs.total_tokens = len(content) // QUALITY_CHARS_PER_TOKEN
fm_match = FRONTMATTER_PATTERN.match(content)
if fm_match and _frontmatter:
- qs.frontmatter_tokens = len(fm_match.group(1)) // 4
- qs.instructions_tokens = len(fm_match.group(2)) // 4
+ qs.frontmatter_tokens = len(fm_match.group(1)) // QUALITY_CHARS_PER_TOKEN
+ qs.instructions_tokens = len(fm_match.group(2)) // QUALITY_CHARS_PER_TOKEN
# The token budget is a recommendation: exceeding it is advisory (MEDIUM),
# and the deduction still counts toward the --min-score gate.
@@ -850,7 +851,8 @@ class QualityScoreValidator(ValidatorBase):
15,
"warning",
(
- f"Large skill ({qs.total_tokens} tokens, recommended max <{QUALITY_RECOMMENDED_MAX_TOKENS}). "
+ f"Large skill (~{qs.total_tokens} estimated tokens at {QUALITY_CHARS_PER_TOKEN} characters per token, "
+ f"recommended max <{QUALITY_RECOMMENDED_MAX_TOKENS}; a real tokenizer may count more). "
f"Per agentskills.io, SKILL.md should be concise (~500 lines) — "
f"large skill bodies increase token cost after invocation; long or unfocused "
f"top-level descriptions can degrade agent routing accuracy"
diff --git a/tests/validators/test_quality_score.py b/tests/validators/test_quality_score.py
index ce2fa6dd..dac657f6 100644
--- a/tests/validators/test_quality_score.py
+++ b/tests/validators/test_quality_score.py
@@ -603,6 +603,7 @@ class TestQualityScoreValidator:
assert len(large_findings) >= 1, "Expected a finding about large skill size"
assert large_findings[0].severity == Severity.MEDIUM
assert "recommended max <5000" in large_findings[0].message
+ assert "estimated tokens" in large_findings[0].message
assert "long or unfocused top-level descriptions" in large_findings[0].message
assert "Keep required sections concise" in large_findings[0].suggestion
assert "references/" in large_findings[0].suggestion
@@ -1694,6 +1695,8 @@ def test_instruction_token_estimate_uses_frontmatter_boundary(tmp_path, newline,
assert metrics["instructions_tokens"] == len(body) // 4
assert metrics["frontmatter_tokens"] == len(frontmatter.rstrip("\n")) // 4
assert metrics["total_tokens"] == len(content) // 4
+ assert metrics["estimated_tokens"] == metrics["total_tokens"]
+ assert metrics["estimate_method"] == "characters/4"
@pytest.mark.parametrize(
@@ -1718,3 +1721,34 @@ def test_instruction_tokens_do_not_infer_frontmatter_from_body_separators(tmp_pa
assert metrics["has_frontmatter"] is False
assert metrics["frontmatter_tokens"] == 0
assert metrics["instructions_tokens"] == 0
+
+
+def _estimate_skill(tmp_path):
+ skill = tmp_path / "estimate-skill"
+ skill.mkdir()
+ (skill / "SKILL.md").write_text(
+ "---\nname: estimate-skill\ndescription: Summarizes files. Use when the user asks for a summary.\n---\n\n"
+ "# Estimate skill\n\n## Instructions\n\n1. Read the file.\n2. Summarize it.\n"
+ )
+ return skill
+
+
+def test_token_estimate_labels_survive_redaction(tmp_path):
+ """No quality metric, including the estimate labels, is rewritten as a secret."""
+ from skillevaluator.utils.redaction import redact_sensitive_data
+
+ result = QualityScoreValidator().validate(_estimate_skill(tmp_path))
+ metrics = result.metadata["quality_scores"]["metrics"]
+
+ assert redact_sensitive_data(metrics) == metrics
+ assert metrics["estimate_method"] == "characters/4"
+ assert metrics["estimated_tokens"] == metrics["total_tokens"]
+
+
+def test_html_report_labels_the_token_count_as_an_estimate(tmp_path):
+ from skillevaluator.reporting import HTMLReporter
+
+ result = QualityScoreValidator().validate(_estimate_skill(tmp_path))
+ html = HTMLReporter(include_timestamp=False, explicit_skill_name="estimate-skill").render(result)
+
+ assert "Est. tokens (characters/4):" in html