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.

fix(tier3): accept declarative checks in grader validation (#582)

Christopher Kevin0ae966c46c1b
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 10247e24..788a4260 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -326,6 +326,10 @@ All notable changes to SkillEvaluator are documented in this file.
output or references. Scoring and thresholds are unchanged; an Accuracy format
failure alone can still score 0.8 and pass the default threshold.
+- Allow grader-validation suites to use validated dataset `checks`, including
+ anchored `output_matches` rules, instead of rejecting the entry field before
+ running the verifier. Document exact-format declarations and the measured
+ limitations of natural-language format judging.
- An author value is no longer rejected for containing a Unicode joiner. The
character guard matched all of category `C`, so ZWNJ (U+200C) and ZWJ
(U+200D), which Persian, Arabic and Devanagari names need to render, plus a
diff --git a/docs/eval-datasets.mdx b/docs/eval-datasets.mdx
index 07bab1ab..61eae6a3 100644
--- a/docs/eval-datasets.mdx
+++ b/docs/eval-datasets.mdx
@@ -170,6 +170,37 @@ Unknown check types and invalid fields are dataset-validation errors. On a
without-skill baseline, checks for scripts inside the evaluated skill are not
checked because that skill is not installed.
+For an exact final-response format, use an anchored `output_matches` check
+and keep semantic requirements in `expected_behavior` (or `assertions`). For
+example, this legacy entry checks numeric-only output without judging it:
+
+```json
+{
+ "id": "numeric-only",
+ "question": "Calculate 6 * 7. Return only the numeric answer.",
+ "ground_truth": "42",
+ "expected_behavior": [],
+ "checks": [
+ {"type": "output_matches", "pattern": "\\A[+-]?\\d+(?:\\.\\d+)?\\Z"}
+ ]
+}
+```
+
+`output_matches` uses Python `re.search`: without anchors, a matching substring
+is sufficient. Use `\A` and `\Z` to require the whole literal response;
+`$` also permits a match before a final newline. Leading/trailing whitespace,
+labels and Markdown fences fail the example above. To require a literal prefix,
+use a pattern such as `\ATOTAL=[+-]?\d+(?:\.\d+)?\Z`, escaping any regular-expression
+metacharacters in the prefix. Double backslashes in JSON strings, as shown.
+Choose the numeric syntax your dataset actually requires (for example, add an
+exponent explicitly if allowed). A wrong value such as `43` still passes this
+format check; factual correctness remains separate. Avoid duplicating the
+same rule in both checks and judged assertions.
+
+Natural-language format judgments can accept malformed output or reject a
+well-formatted wrong value. See the [measured diagnostic and its limitations](/skills/skillevaluator/grader-validation#reading-the-report),
+including sample sizes and the lack of independent human labels.
+
<AccordionGroup>
<Accordion title="Legacy flat format">
Older datasets are a flat array of entries with `question` instead of
diff --git a/docs/grader-validation.mdx b/docs/grader-validation.mdx
index 2528a053..d88e05d1 100644
--- a/docs/grader-validation.mdx
+++ b/docs/grader-validation.mdx
@@ -87,15 +87,28 @@ Splits are `assessment` (held out) and `tuning` (used for development).
Entry fields accepted by this mode are `id`, `question`, `ground_truth`,
`expected_behavior`, `expected_skill`, `expected_script`, `evaluated_skill`,
`should_trigger`, `has_skill`, `acceptable_skills`, `acceptable_alternates`,
-`skill_workspace_mode` and `workspace_skill_names`. Question is required;
+`skill_workspace_mode`, `workspace_skill_names` and `checks`. Question is required;
behavior, accepted skills and workspace skill names are lists of strings;
trigger and installed-skill flags are booleans. The verifier receives these
unchanged. Baseline skill metrics are N/A; a trusted evaluated skill identity
lets a non-use case receive credit for correctly avoiding that skill.
+`entry.checks` accepts the dataset's [declarative checks](/skills/skillevaluator/eval-datasets#deterministic-checks),
+including anchored `output_matches` patterns for exact final-response formats.
+These run in the shipped verifier and contribute to Behavior alongside any
+remaining `expected_behavior` judgments. `file_exists` is rejected: qualification
+records only the trajectory, not the agent's workspace files, so the check would
+inspect the machine running qualification instead of the agent's output.
+When a case declares checks, label the
+combined Behavior result with a scalar `pass`/`fail`. A boolean-list Behavior
+label is rejected there, because it describes only the numbered model-judged
+behaviors and cannot say whether the direct checks pass. `label.checks` below has a
+different purpose: it verifies recorded evidence supporting the author's label.
+
Expected overall is `pass`, `fail` or `insufficient_evidence`. Metric labels
also allow `not_applicable`; omit metrics without independent labels.
-Behavior can instead be a boolean list exactly matching expected behavior length.
+Behavior can instead be a boolean list exactly matching expected behavior length
+(only for a case without `checks`).
A null trajectory is allowed only for unavailable-evidence cases labelled
insufficient evidence. Missing referenced files are errors, not abstentions.
@@ -128,6 +141,27 @@ does not add a critical-failure gate or establish improved semantic accuracy.
Accuracy still averages five criteria: if only `FORMAT_FOLLOWED` is false, its
score is 0.8 and passes the default accuracy threshold.
+For exact output formats, declare an anchored `output_matches` check instead of
+asking the judge to enforce a natural-language format rule. For example,
+`{"type": "output_matches", "pattern": "\\A[+-]?\\d+(?:\\.\\d+)?\\Z"}`
+requires the entire response to be a signed or unsigned integer/decimal.
+Use `\A` and `\Z`; `$` can match before a trailing newline. See the
+[dataset examples](/skills/skillevaluator/eval-datasets#deterministic-checks).
+Keep semantic requirements in `expected_behavior`, and avoid counting the same
+format rule in both lists. This configures an existing deterministic route;
+it does not improve the language-model judge.
+
+A live format diagnostic at commit `0d5e356583fee63c3d12e4930581c7dfb3352911`
+(0.9.0), using `nv_build` / `nvidia/nemotron-3.5-bolt-e4b`, measured Behavior
+false passes of 9/12 and false fails of 3/18 over 10 distinct synthetic cases
+with three dependent repeats (30 attempts). A separately frozen 20-case
+author-labelled set, also repeated three times (60 attempts), measured 15/33
+false passes and 3/27 false fails; it contains 18 format cases and two semantic
+controls. Both had zero unjudgeable Behavior attempts. These labels are **not
+independent human labels**. The wording and narrow synthetic coverage limit
+these findings; they establish a known natural-language format limitation,
+not representative judge reliability or an agreed acceptance threshold.
+
`overall` is the score policy's dimension mean, compared with the default 0.5
threshold. The shipped policy averages security, accuracy, skill execution,
goal achievement (the mean of goal_accuracy and behavior_check), and skill
diff --git a/src/skillevaluator/tier3/grader_validation.py b/src/skillevaluator/tier3/grader_validation.py
index 16da6774..f1480e0b 100644
--- a/src/skillevaluator/tier3/grader_validation.py
+++ b/src/skillevaluator/tier3/grader_validation.py
@@ -28,11 +28,14 @@ from skillevaluator.tier3.eval_core.atif_helpers import (
get_final_response,
)
from skillevaluator.tier3.eval_core.codex_tool_call_normalizer import atif_content_text
+from skillevaluator.tier3.eval_core.declarative_checks import validate_declarative_checks
SCHEMA = "skillevaluator.grader-qualification/v1"
CATEGORIES = {"positive", "negative", "edge", "failure_recovery", "unavailable_evidence", "non_use", "baseline"}
METRICS = ("security", "skill_execution", "skill_efficiency", "accuracy", "goal_accuracy", "behavior_check")
VERDICTS = ("pass", "fail", "not_applicable", "error", "insufficient_evidence")
+# Qualification copies only the trajectory, so checks on workspace files have nothing recorded to inspect.
+WORKSPACE_CHECKS = {"file_exists"}
DEFAULT_THRESHOLDS = dict.fromkeys(METRICS, 1.0) | {"accuracy": 0.8, "overall": 0.5}
TEMPLATE = Path(__file__).parent / "harbor" / "templates" / "eval.py"
REFERENCE_SUITE = Path(__file__).parent / "grader_reference"
@@ -46,6 +49,7 @@ ENTRY_FIELDS = {
"question",
"ground_truth",
"expected_behavior",
+ "checks",
"expected_skill",
"expected_script",
"should_trigger",
@@ -139,6 +143,16 @@ def load_suite(directory):
for key in ("expected_behavior", "acceptable_skills", "acceptable_alternates", "workspace_skill_names"):
if key in entry and (not isinstance(entry[key], list) or any(not isinstance(v, str) for v in entry[key])):
raise ValueError(f"entry.{key}: expected list of strings")
+ if "checks" in entry:
+ errors = validate_declarative_checks(entry["checks"])
+ if errors:
+ raise ValueError(f"entry.checks: {'; '.join(errors)}")
+ workspace = sorted({check["type"] for check in entry["checks"]} & WORKSPACE_CHECKS)
+ if workspace:
+ raise ValueError(
+ f"entry.checks: {', '.join(workspace)} inspects the agent's workspace files, which "
+ "qualification does not record; remove it"
+ )
expected = case["expected"]
_object(expected, {"overall", "metrics"}, {"overall", "metrics"}, "expected")
if not isinstance(expected["overall"], str) or expected["overall"] not in {
@@ -150,6 +164,11 @@ def load_suite(directory):
_object(expected["metrics"], set(METRICS), set(), "expected.metrics")
for metric, label in expected["metrics"].items():
if metric == "behavior_check" and isinstance(label, list):
+ if entry.get("checks"):
+ raise ValueError(
+ "behavior label list cannot be combined with entry.checks; the verifier scores "
+ "checks together with judged behaviors, so use a scalar pass or fail label"
+ )
if len(label) != len(entry.get("expected_behavior", [])) or any(type(v) is not bool for v in label):
raise ValueError("behavior label length must match expected_behavior and contain booleans")
elif not isinstance(label, str) or label not in set(VERDICTS) - {"error"}:
diff --git a/tests/tier3/test_grader_validation.py b/tests/tier3/test_grader_validation.py
index fb3541c1..cd2ca591 100644
--- a/tests/tier3/test_grader_validation.py
+++ b/tests/tier3/test_grader_validation.py
@@ -76,6 +76,105 @@ def test_invalid_suite(suite_dir, mutation, message):
gv.load_suite(suite_dir)
+def test_suite_accepts_declarative_entry_checks(suite_dir):
+ suite = json.loads((suite_dir / "suite.json").read_text())
+ case = suite["cases"][0]
+ case["entry"]["checks"] = [{"type": "output_matches", "pattern": r"\A[0-9]+\Z"}]
+ case["expected"]["metrics"]["behavior_check"] = "pass"
+ write_suite(suite_dir, suite)
+
+ loaded = gv.load_suite(suite_dir)
+
+ assert loaded["cases"][0]["entry"]["checks"] == case["entry"]["checks"]
+
+
+ "checks",
+ [
+ None,
+ {},
+ [{"type": "output_matches", "pattern": "["}],
+ [{"type": "output_matches", "pattern": r"\A1\Z", "extra": True}],
+ [{"type": "unknown", "pattern": "1"}],
+ ],
+)
+def test_suite_validates_declarative_entry_checks(suite_dir, checks):
+ suite = json.loads((suite_dir / "suite.json").read_text())
+ suite["cases"][0]["entry"]["checks"] = checks
+ suite["cases"][0]["expected"]["metrics"]["behavior_check"] = "pass"
+ write_suite(suite_dir, suite)
+
+ with pytest.raises(ValueError, match=r"entry.checks"):
+ gv.load_suite(suite_dir)
+
+
+def test_suite_rejects_behavior_label_list_with_declarative_checks(suite_dir):
+ # The verifier folds direct checks into one Behavior score, so a list label that covers only the
+ # judged behaviors would compare different things: a passing judged step plus a correctly
+ # failing direct check scores 0.5, an expected list pass against an observed aggregate fail.
+ suite = json.loads((suite_dir / "suite.json").read_text())
+ case = suite["cases"][0]
+ case["entry"]["checks"] = [{"type": "output_matches", "pattern": r"\AX\Z"}]
+ assert len(case["entry"]["expected_behavior"]) == len(case["expected"]["metrics"]["behavior_check"])
+ write_suite(suite_dir, suite)
+
+ with pytest.raises(ValueError, match=r"behavior label list cannot be combined with entry\.checks"):
+ gv.load_suite(suite_dir)
+
+ case["entry"]["checks"] = []
+ write_suite(suite_dir, suite)
+ assert gv.load_suite(suite_dir)["cases"][0]["expected"]["metrics"]["behavior_check"] == [True, True]
+
+
[email protected]("path", ["README.md", "out/report.md"])
+def test_suite_rejects_workspace_file_checks(suite_dir, path):
+ # Qualification records only the trajectory. A file_exists check would otherwise inspect the
+ # caller's directory, passing for an unrelated host file and failing for a missing artifact.
+ suite = json.loads((suite_dir / "suite.json").read_text())
+ suite["cases"][0]["entry"]["checks"] = [{"type": "file_exists", "path": path}]
+ suite["cases"][0]["expected"]["metrics"]["behavior_check"] = "pass"
+ write_suite(suite_dir, suite)
+
+ with pytest.raises(ValueError, match=r"entry\.checks: file_exists inspects the agent's workspace files"):
+ gv.load_suite(suite_dir)
+
+
[email protected](("response", "passed"), [("999", True), ("14\n", False), ("Result: 14", False)])
+def test_qualification_runs_anchored_output_check(judge_server, suite_dir, tmp_path, response, passed):
+ suite = json.loads((suite_dir / "suite.json").read_text())
+ case = next(case for case in suite["cases"] if case["id"] == "arithmetic")
+ case["entry"]["checks"] = [{"type": "output_matches", "pattern": r"\A[+-]?\d+(?:\.\d+)?\Z"}]
+ case["entry"]["expected_behavior"] = []
+ case["expected"]["metrics"] = {"behavior_check": "pass" if passed else "fail"}
+ case["label"].update(method="reviewed", checks=[])
+ (suite_dir / case["trajectory"]).write_text(json.dumps({"steps": [{"source": "agent", "message": response}]}))
+ write_suite(suite_dir, suite)
+
+ result = CliRunner().invoke(
+ cli,
+ [
+ "tier3",
+ "validate-grader",
+ str(suite_dir),
+ "--case",
+ "arithmetic",
+ "--repeats",
+ "1",
+ "-o",
+ str(tmp_path / "qualification"),
+ "--json",
+ ],
+ )
+
+ assert result.exit_code == 0, result.output
+ attempt = json.loads(result.output)["attempts"][0]
+ assert attempt["returncode"] == 0
+ behavior = attempt["reward"]["details"]["behavior_check"]
+ assert behavior["declarative_checks"]["results"][0]["passed"] is passed
+ assert behavior["declarative_checks"]["judged_count"] == 0
+ assert behavior["score"] == float(passed)
+
+
def test_symlink_escape(suite_dir, tmp_path):
outside = tmp_path / "outside.json"
outside.write_text('{"steps":[]}')