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.

Add opt-in Unicode character facts for Tier 3 judges (#242)

mavericksea-aiabdf3330304f
diff --git a/CHANGELOG.md b/CHANGELOG.md
index ce8967ff..b38fad5e 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -6,50 +6,14 @@ All notable changes to SkillEvaluator are documented in this file.
### Added
-- `tier3 evaluate` now leads with a case-first summary: a verdict line and one
- row per `evals.json` case. With one agent, each row shows, for with and
- without the skill, the pass count, per-attempt marks (`✓` pass, `✗` fail,
- `⊘` did not run, `·` skipped after a pass) and mean score, plus an effect
- column (`helps`, `hurts`, `both fail`, `better score`, `worse score`,
- `no change`, `inconclusive`). With several agents, each agent gets a column
- showing without-skill → with-skill marks and the pass-rate change. Success
- rate, quality score, and dimensions follow. A "How to improve" list follows,
- ranked by attempts lost and capped at three; each item names the case,
- agent, issue type (`skill`, `skill not used`, `skill hurts`, `environment`,
- `run error`, `eval case`, `missing input`, `goal not met`), one action, and an evidence
- path, and is also written to `what_to_fix.json` in the run directory. When
- nothing needs fixing it prints a one-line "nothing to fix" instead. The
- verdict is `inconclusive` when attempts did not run. The per-evaluator and
- per-dimension tables and metric findings moved behind the new `--verbose`
- flag and remain in `report.html`.
-- `goal not met` flags with-skill attempts that pass on the aggregate score
- while the judge scored goal accuracy 0.00 (for example, the agent only asked
- for details).
-- `report.html` leads with the same case-based findings: "Verdict at a glance"
- adds the per-case result, the highest-scoring agent versus the biggest skill
- lift, and the goal-not-met count; "Conclusion & Next Steps" and the Insights
- recommendations list the `what_to_fix.json` fixes (or "Nothing to fix").
- Data fixes elsewhere: Pass@K shows attempts passed, a regressed passing
- dimension reads "PASS · regressed" with its weakest signal, resource totals
- are formatted with units and percent change, Attempt Details groups each
- case's with/without rows and marks passes that missed the goal, and Error
- Recovery lists only trials with faults, retries or warnings.
-- Reusable GitHub Actions onboarding for complete Tier 1 checks, with
- pinned runtime/workflow consumer templates, affected-skill PR selection,
- optional hosted reports and updated PR feedback. The new guide separates
- basic scanning from publisher setup; public image publication and generated
- release files require a reviewed manual release before consumer use. The
- Tier 1 image is a multi-stage build with precompiled bytecode that ships only
- the locked Semgrep, SkillSpector and SkillEvaluator environments, Gitleaks,
- `ci/` and the license files. A release builds it without cached layers and
- pushes the image it smoke-tested.
-- The reusable Tier 1 workflow scans up to four skills at once. The
- `scan-workers` input (1 to 16) changes this, and `1` scans one skill at a
- time. Each worker gets its own private home and temporary directory. Logs,
- annotations and report rows keep skill order, and skills not started when the
- scan time budget runs out are still reported as not evaluated. A timeout,
- Ctrl-C or an error while saving results ends running scans together with
- the scanner tools they started.
+- Opt-in `SKILL_EVAL_JUDGE_CHARACTER_FACTS=1` adds bounded, escaped Unicode
+ character facts to Tier 3 accuracy, goal-accuracy, and behavior-check prompts
+ without normalizing the evidence. The operator setting is verifier-only;
+ enabling it selects the prompt-based goal judge instead of the optional RAGAS
+ route. Metadata uses the same text rendering as the judge prompts, including
+ numeric and nullable fields. Existing prompts remain unchanged when the
+ setting is unset.
+
- `--quality-config PATH` on `validate`, `quality-check`, and `tier1` loads the
deterministic quality check's expected Markdown headings from a YAML file
instead of the built-in list. Each `expected_headers` entry sets a `heading`
diff --git a/docs/environment-variables.mdx b/docs/environment-variables.mdx
index 6ff26c52..a0062189 100644
--- a/docs/environment-variables.mdx
+++ b/docs/environment-variables.mdx
@@ -198,6 +198,14 @@ directory with `.env` loading and Harbor telemetry disabled:
### Judge evidence budgets
+`SKILL_EVAL_JUDGE_CHARACTER_FACTS=1` optionally appends Unicode character metadata
+to standard Tier 3 judge prompts. It is off by default; `true`, `yes`, and `on`
+also enable it (case-insensitive). This operator-owned setting is forwarded only
+to standard verifier jobs, never to agent environments or `custom_only` jobs.
+When configured, its value is recorded as `judge.character_facts` in
+`run_config.json`. See [character-sensitive judging](tier3-live-evaluation.mdx#character-sensitive-judging)
+for scope, limits, and the effect on the goal-accuracy route.
+
Before the Harbor verifier calls the `accuracy`, `goal_accuracy`, and
`behavior_check` judges, it condenses the agent's trajectory into a separate
evidence excerpt for each judge. These budgets cap each excerpt in characters.
diff --git a/docs/tier3-live-evaluation.mdx b/docs/tier3-live-evaluation.mdx
index d105729d..21b7049b 100644
--- a/docs/tier3-live-evaluation.mdx
+++ b/docs/tier3-live-evaluation.mdx
@@ -610,6 +610,29 @@ neither `trajectory.json` nor a supported log yields any steps, the reward
records `No trajectory or reconstructible agent log`. Custom graders read
`trajectory.json` directly and do not get this rebuild.
+### Character-sensitive judging
+
+Set `SKILL_EVAL_JUDGE_CHARACTER_FACTS=1` in the evaluator's host environment to
+append character facts to the `accuracy`, `goal_accuracy`, and `behavior_check`
+prompts. For example, a literal U+00A0 (NO-BREAK SPACE) in code can look like an
+ordinary U+0020 space even when the task treats them differently. The metadata
+identifies non-ASCII whitespace and Unicode format (`Cf`) characters by code
+point, Unicode name, position, and ASCII-escaped context. Their presence alone
+does not indicate an error; the task determines which characters are permitted.
+
+The original prompt and evidence remain intact. Metadata is added separately,
+after evidence selection and compaction, with up to 20 occurrences per field
+and 20 code points of context on either side. Additional occurrences are counted.
+The metadata adds prompt tokens beyond the evidence budgets below.
+Line and column positions are one-based Unicode code points in that field; only
+LF advances the line number. Metadata cannot recover characters removed by
+earlier processing, and does not identify all invisible or look-alike characters.
+
+The option is disabled by default. Enabling it selects the prompt-based goal
+judge instead of the optional RAGAS route, so keep this setting consistent when
+comparing scores. Facts can help a judge interpret evidence but do not guarantee
+correct judgments. Prefer executable checks for requirements they can verify.
+
### Evidence budgets
Each LLM judge sees a bounded evidence bundle drawn from the trajectory rather
diff --git a/src/skillevaluator/tier3/eval_core/character_facts.py b/src/skillevaluator/tier3/eval_core/character_facts.py
new file mode 100644
index 00000000..dc5f1a4a
--- /dev/null
+++ b/src/skillevaluator/tier3/eval_core/character_facts.py
@@ -0,0 +1,78 @@
+# SPDX-License-Identifier: Apache-2.0
+
+"""Optional Unicode metadata shared by host and standalone verifier judges."""
+
+from __future__ import annotations
+
+import json
+import os
+import unicodedata
+
+
+def character_facts_enabled() -> bool:
+ """Read the operator's opt-in; existing prompts remain unchanged by default."""
+ return os.environ.get("SKILL_EVAL_JUDGE_CHARACTER_FACTS", "").strip().lower() in {"1", "true", "yes", "on"}
+
+
+def format_character_facts(
+ text: str,
+ *,
+ label: str,
+ max_occurrences: int = 20,
+ context_radius: int = 20,
+) -> str:
+ """Describe non-ASCII whitespace and Cf characters without changing the text.
+
+ Positions count Unicode code points, starting at one; only LF advances the
+ line. Context and labels are ASCII-escaped JSON. This is descriptive evidence,
+ not a verdict or an exhaustive detector of invisible/look-alike characters.
+ """
+ if not isinstance(text, str) or not isinstance(label, str):
+ raise TypeError("text and label must be strings")
+ if not isinstance(max_occurrences, int) or not isinstance(context_radius, int):
+ raise TypeError("max_occurrences and context_radius must be integers")
+ if max_occurrences < 1 or context_radius < 0:
+ raise ValueError("max_occurrences must be positive and context_radius nonnegative")
+
+ entries: list[str] = []
+ total = 0
+ line, column = 1, 1
+ for index, character in enumerate(text):
+ if ord(character) > 127 and (character.isspace() or unicodedata.category(character) == "Cf"):
+ total += 1
+ if len(entries) < max_occurrences:
+ context = text[max(0, index - context_radius) : index + context_radius + 1]
+ entries.append(
+ f"- line {line}, column {column}: U+{ord(character):04X} "
+ f"{unicodedata.name(character, 'UNNAMED')}; "
+ f"escaped context: {json.dumps(context, ensure_ascii=True)}"
+ )
+ if character == "\n":
+ line, column = line + 1, 1
+ else:
+ column += 1
+ if not entries:
+ return ""
+ if total > len(entries):
+ entries.append(f"Omitted {total - len(entries)} additional matching characters.")
+ return "\n".join(
+ [
+ f"Character facts for {json.dumps(label, ensure_ascii=True)} "
+ "(descriptive metadata, not a grading verdict).",
+ "Positions are one-based Unicode code points; lines are separated by LF.",
+ *entries,
+ ]
+ )
+
+
+def append_character_facts(prompt: str, **evidence: object) -> str:
+ """Append bounded facts for the evidence's prompt representation, when enabled."""
+ if not character_facts_enabled():
+ return prompt
+ # Match the empty format spec used by the judges' str.format/f-string fields.
+ panels = [
+ facts for label, value in evidence.items() if (facts := format_character_facts(format(value), label=label))
+ ]
+ if not panels:
+ return prompt
+ return prompt + "\n\n" + "\n\n".join(panels)
diff --git a/src/skillevaluator/tier3/eval_core/llm_judge.py b/src/skillevaluator/tier3/eval_core/llm_judge.py
index 2841ecd1..35c2c71b 100644
--- a/src/skillevaluator/tier3/eval_core/llm_judge.py
+++ b/src/skillevaluator/tier3/eval_core/llm_judge.py
@@ -30,6 +30,7 @@ from skillevaluator.tier3.eval_core.atif_helpers import (
_behavior_final_response_limit,
_truncate_for_behavior,
)
+from skillevaluator.tier3.eval_core.character_facts import append_character_facts
logger = logging.getLogger(__name__)
@@ -785,6 +786,7 @@ def judge_accuracy(
).replace("Compute score = count(true) / 5.", "Compute score = count(true among the other four criteria) / 4.")
# Adjust the rubric before interpolation so task/evidence text stays intact.
prompt = prompt.format(question=question, ground_truth=ground_truth, agent_text=agent_text)
+ prompt = append_character_facts(prompt, question=question, ground_truth=ground_truth, agent_text=agent_text)
def validate_payload(parsed: Any) -> str | None:
error = _accuracy_payload_error(parsed)
@@ -892,6 +894,9 @@ def judge_goal_accuracy(
tool_summary=tool_summary,
agent_text=agent_text,
)
+ prompt = append_character_facts(
+ prompt, question=question, ground_truth=ground_truth, tool_summary=tool_summary, agent_text=agent_text
+ )
kwargs.setdefault("response_schema", GOAL_ACCURACY_JSON_SCHEMA)
kwargs.setdefault("schema_name", "goal_accuracy_judgment")
@@ -1050,10 +1055,12 @@ def judge_behavior_check(
behaviors_text = "\n".join(f"{i + 1}. {b}" for i, b in enumerate(expected_behaviors))
+ conversation = _compact_behavior_conversation(conversation_text)
prompt = BEHAVIOR_CHECK_PROMPT.format(
- conversation=_compact_behavior_conversation(conversation_text),
+ conversation=conversation,
behaviors=behaviors_text,
)
+ prompt = append_character_facts(prompt, conversation=conversation, expected_behaviors=behaviors_text)
kwargs.setdefault("max_tokens", BEHAVIOR_JUDGE_MAX_TOKENS)
kwargs.setdefault("response_schema", BEHAVIOR_CHECK_JSON_SCHEMA)
kwargs.setdefault("schema_name", "behavior_check_judgment")
diff --git a/src/skillevaluator/tier3/harbor/adapter.py b/src/skillevaluator/tier3/harbor/adapter.py
index e77a3336..dc87ce43 100644
--- a/src/skillevaluator/tier3/harbor/adapter.py
+++ b/src/skillevaluator/tier3/harbor/adapter.py
@@ -220,7 +220,9 @@ _COMPOSE_ALLOWED_NETWORK_KEYS = frozenset({"attachable", "enable_ipv4", "enable_
_COMPOSE_ALLOWED_VOLUME_KEYS = frozenset({"labels"})
_VERIFIER_JUDGE_MODEL_ENV_VARS = frozenset({"LLM_JUDGE_MODEL", "SKILL_EVAL_JUDGE_MODEL"})
_VERIFIER_JUDGE_FALLBACK_ENV_VARS = frozenset({"LLM_JUDGE_FALLBACK_MODELS"})
-_VERIFIER_JUDGE_CONTROL_ENV_VARS = _VERIFIER_JUDGE_MODEL_ENV_VARS | _VERIFIER_JUDGE_FALLBACK_ENV_VARS
+_VERIFIER_JUDGE_CONTROL_ENV_VARS = (
+ _VERIFIER_JUDGE_MODEL_ENV_VARS | _VERIFIER_JUDGE_FALLBACK_ENV_VARS | {"SKILL_EVAL_JUDGE_CHARACTER_FACTS"}
+)
_VERIFIER_BUDGET_ENV_VARS = frozenset(
{
"SKILL_EVAL_ACCURACY_BUDGET",
@@ -2379,6 +2381,7 @@ def _copy_verifier(task_dir: Path) -> None:
(_EVAL_CORE_DIR / "checks.py", "Deterministic grading checks"),
(_EVAL_CORE_DIR / "secret_redaction.py", "Deterministic redaction helper"),
(_EVAL_CORE_DIR / "codex_tool_call_normalizer.py", "Codex tool-call normalizer"),
+ (_EVAL_CORE_DIR / "character_facts.py", "Judge character-facts helper"),
(_EVAL_CORE_DIR.parent.parent / "evidence.py", "Evidence-reference helper"),
)
for src, label in sources:
diff --git a/src/skillevaluator/tier3/harbor/runner.py b/src/skillevaluator/tier3/harbor/runner.py
index dae8df96..2058d297 100644
--- a/src/skillevaluator/tier3/harbor/runner.py
+++ b/src/skillevaluator/tier3/harbor/runner.py
@@ -2906,7 +2906,7 @@ def _judge_model_config(
model = provider.model
source = "SKILL_EVAL_LLM_MODEL" if os.environ.get("SKILL_EVAL_LLM_MODEL", "").strip() else "provider default"
override_applied = False
- return {
+ configuration = {
"enabled": True,
"provider": provider.provider,
"model": model,
@@ -2914,6 +2914,9 @@ def _judge_model_config(
"override_applied": override_applied,
"reasoning_effort": effective_reasoning_effort(provider.provider, model, JUDGE_REASONING_EFFORT),
}
+ if character_facts := provider_env.get("SKILL_EVAL_JUDGE_CHARACTER_FACTS"):
+ configuration["character_facts"] = character_facts
+ return configuration
def _job_judge_override(provider_env: Mapping[str, str], grading_mode: str) -> tuple[str, str] | None:
diff --git a/src/skillevaluator/tier3/harbor/templates/eval.py b/src/skillevaluator/tier3/harbor/templates/eval.py
index 1f8cbe1e..63c8e9cb 100644
--- a/src/skillevaluator/tier3/harbor/templates/eval.py
+++ b/src/skillevaluator/tier3/harbor/templates/eval.py
@@ -94,6 +94,11 @@ try:
except ImportError: # pragma: no cover -- source-tree import only
from skillevaluator.evidence import evidence_ref_identity
+try:
+ from character_facts import append_character_facts, character_facts_enabled
+except ImportError: # pragma: no cover -- source-tree import only
+ from skillevaluator.tier3.eval_core.character_facts import append_character_facts, character_facts_enabled
+
_CHECKS_PATH = _SCRIPT_TESTS_DIR / "checks.py"
if _CHECKS_PATH.is_file():
@@ -3367,6 +3372,7 @@ SELECTED EVIDENCE (final response + produced artifacts; low-relevance steps may
prompt = prompt.replace('"SKILL_IDENTIFIED": true', '"SKILL_IDENTIFIED": false')
# Adjust the rubric before interpolation so task/evidence text stays intact.
prompt = prompt.format(question=question, ground_truth=ground_truth, agent_text=agent_text)
+ prompt = append_character_facts(prompt, question=question, ground_truth=ground_truth, agent_text=agent_text)
def validate_payload(parsed):
error = _accuracy_payload_error(parsed)
@@ -3433,6 +3439,9 @@ def _ragas_goal_accuracy_enabled():
Reasoning judges reject the sampling settings RAGAS sends, so they use the prompt judge.
"""
+ # The prompt judge can append metadata outside the original evidence.
+ if character_facts_enabled():
+ return False
if _public_provider() != "openai" or _is_openai_reasoning_model(_selected_judge_model()):
return False
try:
@@ -3520,6 +3529,9 @@ END-STATE EVIDENCE:
Did the agent achieve the expected goal?
Respond with ONLY a JSON object:
{{"user_goal": "...", "end_state": "...", "achieved": true/false, "score": 1.0, "reason": "..."}}"""
+ prompt = append_character_facts(
+ prompt, question=question, ground_truth=ground_truth, tool_summary=tool_summary, agent_text=agent_text
+ )
parsed, error, provenance = _call_validated_json_judge(
prompt,
@@ -3570,12 +3582,13 @@ def judge_behavior_check(conversation_text, expected_behaviors):
return {"score": 1.0, "reason": "No expected_behavior defined", "results": []}
behaviors_text = "\n".join(f"{i + 1}. {b}" for i, b in enumerate(expected_behaviors))
+ conversation = _compact_behavior_conversation(conversation_text)
prompt = f"""You are evaluating whether an AI agent followed expected behaviors during a task. \
Analyze the full conversation and determine if each expected behavior was observed.
CONVERSATION:
-{_compact_behavior_conversation(conversation_text)}
+{conversation}
EXPECTED BEHAVIORS:
{behaviors_text}
@@ -3584,6 +3597,7 @@ For each behavior, set "passed" to true (observed) or false (not observed) with
Respond with ONLY a JSON object:
{{"results": [{{"step": 1, "passed": true, "reason": "..."}}, ...], "score": 0.67, "summary": "brief summary"}}"""
+ prompt = append_character_facts(prompt, conversation=conversation, expected_behaviors=behaviors_text)
content, error = call_public_llm(
prompt,
diff --git a/tests/test_character_facts.py b/tests/test_character_facts.py
new file mode 100644
index 00000000..4996e65e
--- /dev/null
+++ b/tests/test_character_facts.py
@@ -0,0 +1,246 @@
+# SPDX-License-Identifier: Apache-2.0
+
+"""Character metadata and host/standalone judge integration regressions."""
+
+from __future__ import annotations
+
+import json
+import subprocess
+import sys
+from unittest.mock import MagicMock
+
+import pytest
+from tests.conftest import load_harbor_eval_template
+
+from skillevaluator.tier3.eval_core import llm_judge
+from skillevaluator.tier3.eval_core.character_facts import append_character_facts, format_character_facts
+from skillevaluator.tier3.harbor import adapter, runner
+
+
[email protected]("text", ["", " 42 \t\r\n", "café 中文 Ελληνικά 😀", r"\u00a0"])
+def test_ordinary_text_has_no_character_facts(text):
+ assert format_character_facts(text, label="evidence") == ""
+
+
+ "character", ["\u00a0", "\u202f", "\u200b", "\u2060", "\ufeff", "\u00ad", "\u202e", "\U000e0001"]
+)
+def test_character_identity_and_ascii_context(character):
+ text = f"😀a{character}b"
+ facts = format_character_facts(text, label='field"\u00a0')
+ assert f"line 1, column 3: U+{ord(character):04X}" in facts
+ assert facts.isascii()
+ assert json.loads(facts.split("escaped context: ")[1]) == text
+
+
+def test_positions_count_code_points_and_only_lf_advances_lines():
+ facts = format_character_facts("😀\u00a0\r\n\u2028x\u200b", label="evidence")
+ assert "line 1, column 2: U+00A0 NO-BREAK SPACE" in facts
+ assert "line 2, column 1: U+2028 LINE SEPARATOR" in facts
+ assert "line 2, column 3: U+200B ZERO WIDTH SPACE" in facts
+
+
+def test_occurrences_and_context_are_bounded():
+ facts = format_character_facts("\u00a0" * 10_000, label="evidence", max_occurrences=2, context_radius=0)
+ assert facts.count("- line ") == 2
+ assert facts.count('escaped context: "\\u00a0"') == 2
+ assert "Omitted 9998 additional matching characters." in facts
+ assert len(facts) < 500
+ assert "Omitted 1 additional matching characters." in format_character_facts("\u00a0" * 21, label="evidence")
+
+
+def test_context_is_bounded_in_code_points():
+ facts = format_character_facts("outside😀a\u00a0b😀outside", label="evidence", context_radius=2)
+ assert json.loads(facts.split("escaped context: ")[1]) == "😀a\u00a0b😀"
+
+
[email protected](("maximum", "radius"), [(0, 20), (-1, 20), (20, -1)])
+def test_invalid_bounds_are_rejected(maximum, radius):
+ with pytest.raises(ValueError):
+ format_character_facts("", label="evidence", max_occurrences=maximum, context_radius=radius)
+
+
[email protected]("setting", ["", "0", "false", "no", "off"])
+def test_disabled_metadata_preserves_prompt(monkeypatch, setting):
+ monkeypatch.setenv("SKILL_EVAL_JUDGE_CHARACTER_FACTS", setting)
+ assert append_character_facts("original", agent_text="\u00a0") == "original"
+
+
[email protected]("setting", ["1", "true", "YES", " on "])
+def test_enabled_metadata_is_separate_and_optional(monkeypatch, setting):
+ monkeypatch.setenv("SKILL_EVAL_JUDGE_CHARACTER_FACTS", setting)
+ assert append_character_facts("original", agent_text="ordinary text") == "original"
+ assert append_character_facts("original", agent_text="\u00a0").startswith("original\n\nCharacter facts")
+
+
[email protected]("value", [None, 42, 0, 1.5, True, False, ["\u00a0"], {"answer": "\u200b"}])
+def test_non_string_evidence_preserves_its_prompt_representation(monkeypatch, value):
+ monkeypatch.setenv("SKILL_EVAL_JUDGE_CHARACTER_FACTS", "1")
+ prompt = f"Evidence: {value}"
+ # Container representations already escape these characters; the facts must
+ # describe the rendered representation, not recursively inspect its values.
+ assert append_character_facts(prompt, evidence=value) == prompt
+
+
+def test_character_facts_use_the_same_formatting_as_prompt_placeholders(monkeypatch):
+ class FormattedEvidence:
+ def __str__(self):
+ return "different text"
+
+ def __format__(self, spec):
+ assert spec == ""
+ return "42\u00a0"
+
+ monkeypatch.setenv("SKILL_EVAL_JUDGE_CHARACTER_FACTS", "1")
+ value = FormattedEvidence()
+ prompt = f"Evidence: {value}"
+ result = append_character_facts(prompt, evidence=value)
+ assert result.startswith(prompt + "\n\nCharacter facts")
+ assert "line 1, column 3: U+00A0 NO-BREAK SPACE" in result
+ assert json.loads(result.split("escaped context: ")[1]) == "42\u00a0"
+
+
[email protected]("implementation", ["host", "verifier"])
[email protected]("judge_name", ["judge_accuracy", "judge_goal_accuracy"])
[email protected]("ground_truth", [42, True, {"answer": [42, "\u00a0"]}])
+def test_judges_accept_non_string_fields_with_character_facts(monkeypatch, implementation, judge_name, ground_truth):
+ judge = llm_judge if implementation == "host" else load_harbor_eval_template()
+ payload = json.dumps(
+ {"score": 0.0, "reason": "test verdict", "achieved": False, "user_goal": "test", "end_state": "test"}
+ )
+ mock = MagicMock(return_value=(payload, None))
+ monkeypatch.setattr(judge, "call_public_llm", mock)
+ if implementation == "verifier":
+ monkeypatch.setattr(judge, "_public_provider", lambda: "anthropic")
+ if judge_name == "judge_goal_accuracy":
+ mock = MagicMock(return_value=(payload, None, {}))
+ monkeypatch.setattr(judge, "_call_public_llm_with_provenance", mock)
+ args = (None, ground_truth, "42\u00a0")
+ if judge_name == "judge_goal_accuracy":
+ args += (None,)
+ monkeypatch.delenv("SKILL_EVAL_JUDGE_CHARACTER_FACTS", raising=False)
+ original_result = getattr(judge, judge_name)(*args)
+ assert original_result["score"] == 0.0
+ original_prompt = mock.call_args.args[0]
+ assert str(ground_truth) in original_prompt
+ assert "None" in original_prompt
+ mock.reset_mock()
+ monkeypatch.setenv("SKILL_EVAL_JUDGE_CHARACTER_FACTS", "1")
+ assert getattr(judge, judge_name)(*args) == original_result
+ mock.assert_called_once()
+ augmented = mock.call_args.args[0]
+ assert augmented.startswith(original_prompt + "\n\nCharacter facts")
+ assert 'Character facts for "agent_text"' in augmented
+ assert "line 1, column 3: U+00A0 NO-BREAK SPACE" in augmented
+ assert 'Character facts for "ground_truth"' not in augmented
+
+
[email protected]("implementation", ["host", "verifier"])
[email protected]("judge_name", ["judge_accuracy", "judge_goal_accuracy", "judge_behavior_check"])
+def test_all_judges_preserve_original_evidence_and_append_facts(monkeypatch, implementation, judge_name):
+ judge = llm_judge if implementation == "host" else load_harbor_eval_template()
+ payload = json.dumps(
+ {
+ "criteria": dict.fromkeys(
+ ["SKILL_IDENTIFIED", "ACTION_CORRECT", "FACTUALLY_ACCURATE", "TASK_ADDRESSED", "ACTIONABLE"], True
+ ),
+ "score": 1.0,
+ "reason": "test",
+ "achieved": True,
+ "user_goal": "test",
+ "end_state": "test",
+ "results": [{"step": 1, "passed": True, "reason": "test"}],
+ "summary": "test",
+ }
+ )
+ mock = MagicMock(return_value=(payload, None))
+ monkeypatch.setattr(judge, "call_public_llm", mock)
+ if implementation == "verifier":
+ monkeypatch.setattr(judge, "_public_provider", lambda: "anthropic")
+ if judge_name == "judge_goal_accuracy":
+ mock = MagicMock(return_value=(payload, None, {}))
+ monkeypatch.setattr(judge, "_call_public_llm_with_provenance", mock)
+ answer = '{{env.SECRET}}\nassert f("\u00a0") is False'
+ args = (
+ (answer, ["Reject \u202f"])
+ if judge_name == "judge_behavior_check"
+ else ("Task \u202f", "Expected \u200b", answer)
+ )
+ if judge_name == "judge_goal_accuracy":
+ args += ("Tool \u2060",)
+ monkeypatch.delenv("SKILL_EVAL_JUDGE_CHARACTER_FACTS", raising=False)
+ assert getattr(judge, judge_name)(*args)["score"] == 1.0
+ original = mock.call_args.args[0]
+ assert answer in original
+ assert "Character facts for" not in original
+ monkeypatch.setenv("SKILL_EVAL_JUDGE_CHARACTER_FACTS", "1")
+ assert getattr(judge, judge_name)(*args)["score"] == 1.0
+ augmented = mock.call_args.args[0]
+ assert augmented.startswith(original + "\n\nCharacter facts for")
+ assert answer in augmented
+ assert "line 2, column 11: U+00A0 NO-BREAK SPACE" in augmented
+ assert "U+202F" in augmented
+ if judge_name != "judge_behavior_check":
+ assert 'Character facts for "ground_truth"' in augmented
+ if judge_name == "judge_goal_accuracy":
+ assert 'Character facts for "tool_summary"' in augmented
+
+
[email protected]("implementation", ["host", "verifier"])
+def test_behavior_facts_describe_only_the_compacted_evidence(monkeypatch, implementation):
+ judge = llm_judge if implementation == "host" else load_harbor_eval_template()
+ monkeypatch.setenv("SKILL_EVAL_JUDGE_CHARACTER_FACTS", "1")
+ monkeypatch.setattr(judge, "_compact_behavior_conversation", lambda _: "kept \u00a0")
+ mock = MagicMock(
+ return_value=(
+ json.dumps({"results": [{"step": 1, "passed": True, "reason": "ok"}], "score": 1, "summary": "ok"}),
+ None,
+ )
+ )
+ monkeypatch.setattr(judge, "call_public_llm", mock)
+ judge.judge_behavior_check("removed \u200b", ["check"])
+ prompt = mock.call_args.args[0]
+ assert "line 1, column 6: U+00A0" in prompt
+ assert "U+200B" not in prompt
+
+
+def test_opt_in_selects_prompt_goal_judge(monkeypatch):
+ judge = load_harbor_eval_template()
+ monkeypatch.setattr(judge, "_public_provider", lambda: "openai")
+ monkeypatch.setattr(judge, "_selected_judge_model", lambda: "gpt-4.1-mini")
+ monkeypatch.setattr(judge, "_resolve_url", lambda _: "https://api.openai.com/v1/chat/completions")
+ monkeypatch.delenv("SKILL_EVAL_JUDGE_CHARACTER_FACTS", raising=False)
+ assert judge._ragas_goal_accuracy_enabled()
+ monkeypatch.setenv("SKILL_EVAL_JUDGE_CHARACTER_FACTS", "1")
+ assert not judge._ragas_goal_accuracy_enabled()
+
+
+def test_helper_is_bundled_and_works_without_installed_package(tmp_path):
+ adapter._copy_verifier(tmp_path)
+ helper = adapter._evaluator_tests_dir(tmp_path) / "character_facts.py"
+ assert helper.is_file()
+ script = "import runpy,sys; m=runpy.run_path(sys.argv[1]); print(m['format_character_facts']('\u00a0', label='evidence'))"
+ result = subprocess.run(
+ [sys.executable, "-I", "-S", "-c", script, str(helper)], capture_output=True, text=True, check=True
+ )
+ assert "U+00A0 NO-BREAK SPACE" in result.stdout
+
+
+def test_operator_flag_is_verifier_only_and_recorded(monkeypatch):
+ from skillevaluator.provider_config import ProviderConfig
+
+ name = "SKILL_EVAL_JUDGE_CHARACTER_FACTS"
+ monkeypatch.setenv(name, "1")
+ provider = ProviderConfig(
+ provider="openai", model="gpt-4.1-mini", api_key="test-key", base_url=None, litellm_model="openai/gpt-4.1-mini"
+ )
+ environment = runner._provider_environment(provider)
+ assert environment[name] == "1"
+ assert runner._job_judge_verifier_env(environment, "default")[name] == "${" + name + "}"
+ assert runner._job_judge_subprocess_env(environment, "default")[name] == "1"
+ assert runner._job_judge_verifier_env(environment, "custom_only") == {}
+ assert runner._job_judge_subprocess_env(environment, "custom_only") == {}
+ assert runner._judge_model_config(provider, environment, "default")["character_facts"] == "1"
+ resolved, errors = runner._resolve_runtime_env({name: "0"}, env_mode="docker")
+ assert resolved == {}
+ assert errors
diff --git a/tests/test_harbor_runner_environment.py b/tests/test_harbor_runner_environment.py
index 4f05a78a..e438e5d1 100644
--- a/tests/test_harbor_runner_environment.py
+++ b/tests/test_harbor_runner_environment.py
@@ -282,7 +282,7 @@ def test_skill_config_cannot_control_evaluator_or_judge_routing(name: str) -> No
@pytest.mark.parametrize(
"name",
- ["LLM_JUDGE_MODEL", "SKILL_EVAL_JUDGE_MODEL", "LLM_JUDGE_FALLBACK_MODELS"],
+ ["LLM_JUDGE_MODEL", "SKILL_EVAL_JUDGE_MODEL", "LLM_JUDGE_FALLBACK_MODELS", "SKILL_EVAL_JUDGE_CHARACTER_FACTS"],
)
@pytest.mark.parametrize("provider_name", ["openai", "openai-compatible", "anthropic", "bedrock", "nv_build"])
@pytest.mark.parametrize(
@@ -1163,6 +1163,7 @@ def test_run_harbor_eval_stages_per_agent_credential_trees(
monkeypatch.setenv("LLM_JUDGE_MODEL", "legacy-judge-model")
monkeypatch.setenv("SKILL_EVAL_JUDGE_MODEL", "judge-model")
monkeypatch.setenv("LLM_JUDGE_FALLBACK_MODELS", "fallback-one,fallback-two")
+ monkeypatch.setenv("SKILL_EVAL_JUDGE_CHARACTER_FACTS", "1")
monkeypatch.setattr(runner, "resolve_llm_provider", lambda: provider)
monkeypatch.setattr(
@@ -1271,9 +1272,11 @@ def test_run_harbor_eval_stages_per_agent_credential_trees(
assert "LLM_JUDGE_MODEL" not in runtime_env
assert "SKILL_EVAL_JUDGE_MODEL" not in runtime_env
assert "LLM_JUDGE_FALLBACK_MODELS" not in runtime_env
+ assert "SKILL_EVAL_JUDGE_CHARACTER_FACTS" not in runtime_env
assert "LLM_JUDGE_MODEL" not in verifier_env
assert "SKILL_EVAL_JUDGE_MODEL" not in verifier_env
assert verifier_env["LLM_JUDGE_FALLBACK_MODELS"] == "${LLM_JUDGE_FALLBACK_MODELS}"
+ assert verifier_env["SKILL_EVAL_JUDGE_CHARACTER_FACTS"] == "${SKILL_EVAL_JUDGE_CHARACTER_FACTS}"
assert launched["opencode"][0].endswith("_harbor-tasks/opencode/with")
assert launched["claude-code"][1].endswith("_harbor-tasks/claude-code/without")
assert launched_task_selectors == {"opencode": ["case-001"], "claude-code": ["case-001"]}
@@ -1282,11 +1285,13 @@ def test_run_harbor_eval_stages_per_agent_credential_trees(
assert launched["opencode"][2]["LLM_JUDGE_MODEL"] == "legacy-judge-model"
assert launched["opencode"][2]["SKILL_EVAL_JUDGE_MODEL"] == "legacy-judge-model"
assert launched["opencode"][2]["LLM_JUDGE_FALLBACK_MODELS"] == "fallback-one,fallback-two"
+ assert launched["opencode"][2]["SKILL_EVAL_JUDGE_CHARACTER_FACTS"] == "1"
assert "ANTHROPIC_API_KEY" not in launched["opencode"][2]
assert "OPENAI_API_KEY" not in launched["opencode"][2]
assert launched["claude-code"][2]["NVIDIA_API_KEY"] == "provider-key"
assert launched["opencode"][3] == {
"LLM_JUDGE_FALLBACK_MODELS": "${LLM_JUDGE_FALLBACK_MODELS}",
+ "SKILL_EVAL_JUDGE_CHARACTER_FACTS": "${SKILL_EVAL_JUDGE_CHARACTER_FACTS}",
"LLM_JUDGE_MODEL": "${LLM_JUDGE_MODEL}",
"SKILL_EVAL_JUDGE_MODEL": "${LLM_JUDGE_MODEL}",
}
@@ -1298,6 +1303,7 @@ def test_run_harbor_eval_stages_per_agent_credential_trees(
"source": "LLM_JUDGE_MODEL",
"override_applied": True,
"reasoning_effort": None,
+ "character_facts": "1",
"catalog_verification": "degraded",
}
@@ -1305,7 +1311,7 @@ def test_run_harbor_eval_stages_per_agent_credential_trees(
@pytest.mark.parametrize("grading_mode", ["default", "default_plus_custom"])
@pytest.mark.parametrize(
"judge_alias",
- ["LLM_JUDGE_MODEL", "SKILL_EVAL_JUDGE_MODEL", "LLM_JUDGE_FALLBACK_MODELS"],
+ ["LLM_JUDGE_MODEL", "SKILL_EVAL_JUDGE_MODEL", "LLM_JUDGE_FALLBACK_MODELS", "SKILL_EVAL_JUDGE_CHARACTER_FACTS"],
)
@pytest.mark.parametrize("judge_scope", ["task", "step"])
def test_native_runtime_rejects_task_owned_judge_selection_through_real_staging(
diff --git a/tests/test_harbor_runtime_skill_isolation.py b/tests/test_harbor_runtime_skill_isolation.py
index 47f2a963..c4a59347 100644
--- a/tests/test_harbor_runtime_skill_isolation.py
+++ b/tests/test_harbor_runtime_skill_isolation.py
@@ -379,7 +379,7 @@ def test_native_tasks_project_runtime_skills_without_root_evals(tmp_path: Path)
@pytest.mark.parametrize(
"name",
- ["LLM_JUDGE_MODEL", "SKILL_EVAL_JUDGE_MODEL", "LLM_JUDGE_FALLBACK_MODELS"],
+ ["LLM_JUDGE_MODEL", "SKILL_EVAL_JUDGE_MODEL", "LLM_JUDGE_FALLBACK_MODELS", "SKILL_EVAL_JUDGE_CHARACTER_FACTS"],
)
def test_native_custom_only_preserves_authored_judge_controls_in_verifier_env(
tmp_path: Path,
@@ -409,7 +409,7 @@ def test_native_custom_only_preserves_authored_judge_controls_in_verifier_env(
@pytest.mark.parametrize("scope", ["task", "step"])
@pytest.mark.parametrize(
"name",
- ["LLM_JUDGE_MODEL", "SKILL_EVAL_JUDGE_MODEL", "LLM_JUDGE_FALLBACK_MODELS"],
+ ["LLM_JUDGE_MODEL", "SKILL_EVAL_JUDGE_MODEL", "LLM_JUDGE_FALLBACK_MODELS", "SKILL_EVAL_JUDGE_CHARACTER_FACTS"],
)
def test_native_standard_grading_rejects_task_owned_judge_controls(
tmp_path: Path,
diff --git a/tests/tier3/test_judge_failure_artifacts.py b/tests/tier3/test_judge_failure_artifacts.py
index 93cc585b..12ae86bf 100644
--- a/tests/tier3/test_judge_failure_artifacts.py
+++ b/tests/tier3/test_judge_failure_artifacts.py
@@ -21,8 +21,9 @@ from types import ModuleType, SimpleNamespace
import pytest
+from skillevaluator.tier3.dataset_utils import load_dataset_entries
from skillevaluator.tier3.harbor import collector, report
-from skillevaluator.tier3.harbor.adapter import _EVALUATOR_TESTS_SUBDIR, _write_test_sh
+from skillevaluator.tier3.harbor.adapter import _EVALUATOR_TESTS_SUBDIR, _write_entry_json, _write_test_sh
from skillevaluator.tier3.harbor.metrics import (
DEFAULT_METRIC_SET,
DEFAULT_SCORE_POLICY,
@@ -98,6 +99,68 @@ def _load_verifier(tmp_path: Path) -> ModuleType:
return module
+ ("filename", "contents"),
+ [
+ ("evals.json", '[{"question": "What is 6*7?", "ground_truth": 42}]'),
+ ("evals.yaml", '- prompt: "What is 6*7?"\n expected_output: 42\n'),
+ ],
+)
+def test_character_facts_keep_numeric_dataset_answers_scoreable(tmp_path, monkeypatch, filename, contents):
+ verifier = _load_verifier(tmp_path)
+ dataset_path = tmp_path / filename
+ dataset_path.write_text(contents, encoding="utf-8")
+ entry = load_dataset_entries(dataset_path)[0]
+ assert type(entry["ground_truth"]) is int
+ _write_entry_json(tmp_path, entry, has_skill=False, evaluated_skill="demo")
+ assert json.loads(verifier.ENTRY_PATH.read_text())["ground_truth"] == 42
+ verifier.ATIF_PATH.write_text(json.dumps({"steps": [{"source": "agent", "message": "4\u00a02"}]}), encoding="utf-8")
+ payload = json.dumps(
+ {
+ "criteria": dict.fromkeys(
+ ["SKILL_IDENTIFIED", "ACTION_CORRECT", "FACTUALLY_ACCURATE", "TASK_ADDRESSED", "ACTIONABLE"], False
+ ),
+ "score": 0.0,
+ "reason": "test verdict",
+ "achieved": False,
+ "user_goal": "test",
+ "end_state": "test",
+ }
+ )
+ prompts = {}
+
+ def accuracy_call(prompt, **_kwargs):
+ prompts["accuracy"] = prompt
+ return payload, None
+
+ def goal_call(prompt, **_kwargs):
+ prompts["goal_accuracy"] = prompt
+ return payload, None, {}
+
+ monkeypatch.setattr(verifier, "call_public_llm", accuracy_call)
+ monkeypatch.setattr(verifier, "_call_public_llm_with_provenance", goal_call)
+ monkeypatch.setattr(verifier, "_public_provider", lambda: "anthropic")
+ monkeypatch.delenv("SKILL_EVAL_JUDGE_CHARACTER_FACTS", raising=False)
+ verifier.main()
+ original_prompts = prompts.copy()
+ original_reward = json.loads(verifier.REWARD_JSON.read_text())
+ assert set(prompts) == {"accuracy", "goal_accuracy"}
+ prompts.clear()
+ monkeypatch.setenv("SKILL_EVAL_JUDGE_CHARACTER_FACTS", "1")
+ verifier.main()
+ assert set(prompts) == {"accuracy", "goal_accuracy"}
+ for name, prompt in prompts.items():
+ assert prompt.startswith(original_prompts[name] + "\n\nCharacter facts")
+ assert "U+00A0 NO-BREAK SPACE" in prompt
+ rich = json.loads(verifier.SKILL_EVALUATOR_REWARD_JSON.read_text())
+ numeric = json.loads(verifier.REWARD_JSON.read_text())
+ assert "evaluation_status" not in rich
+ assert "evaluation_errors" not in rich
+ assert numeric == original_reward
+ assert numeric["accuracy"] == numeric["goal_accuracy"] == 0.0
+ assert overall_score(numeric) is not None
+
+
def test_verifier_main_fails_closed_after_collecting_every_required_judge(
tmp_path: Path,
monkeypatch: pytest.MonkeyPatch,