1. The LLM-as-a-Judge Tax: Circular Bias, Non-Determinism, and 2× Token Cost
As engineering teams move AI coding agents into automated CI/CD pipelines, they hit a paradoxical verification bottleneck: how do you prove an agent's patch is production-safe before merging? The industry's default answer—LLM-as-a-Judge—asks a second cloud model to read the diff and emit a quality score.
From a systems engineering perspective, grading probabilistic code generation with another probabilistic API breaks four fundamental invariants:
- Circular Bias & Style Blindness: Frontier models exhibit measurable self-preference. A judge model routinely rewards verbose docstrings, familiar boilerplate, and confident explanations from its own model family while missing subtle AST defects, unclosed resources, or stubbed
NotImplementedErrorpaths. - Non-Deterministic CI Gates: Even at
temperature=0, mixture-of-experts routing, floating-point batching, and silent provider weight updates mean the exact same patch can score8.5/10on Monday and6.0/10on Tuesday. - The 2× Token Tax: You already paid for the coding agent's context window, tool calls, and test-fix retries. Streaming the diff, repository context, and test logs to a judge LLM doubles your token spend and adds 5–15 seconds of network latency per pull request.
- Zero Cryptographic Provenance: A prose evaluation stored in a dashboard log cannot be independently re-verified by a security or compliance auditor six months later. There is no mathematical link between the prompt, the rules enforced, and the resulting git tree.
2. Architecture of a Cryptographic Evaluation Receipt
Instead of asking a remote model "does this look good?", claude-code-eval separates input pinning, deterministic execution, and cryptographic sealing into an offline pipeline that runs in milliseconds on any local machine or CI runner:
Every CI run emits a portable receipt.json artifact. Because the receipt hashes both the inputs and the exact ruleset alongside the deterministic check outputs, no team member or agent can silently weaken a rule, swap a test file, or spoof a passing grade.
3. The Four Binding Layers of claude-code-eval
1. input_digest — Task & Base Tree Pinning
Before evaluation begins, claude-code-eval hashes the canonical task specification (prompt or issue contract) concatenated with the base repository tree hash (git rev-parse HEAD^{tree}). This guarantees the evaluation is bound to a specific starting state and prevents retrospective goalpost shifting.
2. ruleset_hash — Immutable Policy Versioning
A passing badge means nothing if the evaluator's ruleset was quietly relaxed. By computing a SHA-256 digest over the serialized evaluator configuration—AST rules, banned stub patterns (TODO, pass-only bodies, NotImplementedError), required exit codes, and coverage thresholds—every receipt proves which exact policy was enforced.
3. Deterministic AST & Runtime Checks ($0.00)
All checks execute locally with zero network calls:
- AST Structural Gate: Parses every modified source file into an Abstract Syntax Tree to reject syntax errors, unresolved imports, bare
except:blocks, and placeholder stubs. - Test & Exit-Code Gate: Runs the pinned test command in an isolated subprocess, capturing exact exit codes, passed/failed counts, and wall-clock duration.
- Security & Diff Hygiene: Scans for hardcoded secrets, forbidden path mutations outside task scope, and unresolved merge conflict markers.
4. outcome_digest & receipt_sha256 — Tamper-Evident Sealing
Once the patch passes or fails, the evaluator hashes the resulting git diff (or output tree) into outcome_digest. All four layers are then serialized into canonical JSON (keys sorted lexicographically, zero extra whitespace) and hashed into receipt_sha256. Any single-bit modification to a check status, timestamp, or diff invalidates the seal.
4. Canonical SHA-256 Receipt Schema
Below is a production receipt.json emitted by Benni-OS/claude-code-eval. Notice that llm_judge_cost_usd is explicitly 0.0, and every assertion is backed by reproducible digests:
{
"schema_version": "1.0.0",
"tool": "Benni-OS/claude-code-eval",
"evaluated_at": "2026-11-25T18:42:10Z",
"input_digest": "sha256:9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08",
"ruleset_hash": "sha256:4b227777d4dd1fc61c6f884f48641d02b4d121d3fd328cb08b5531fcacdabf8a",
"outcome_digest": "sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
"llm_judge_cost_usd": 0.0,
"checks": [
{
"name": "ast_syntax_and_zero_stubs",
"passed": true,
"files_scanned": 6,
"defects": 0
},
{
"name": "pytest_suite",
"passed": true,
"exit_code": 0,
"tests_passed": 42,
"tests_failed": 0
},
{
"name": "scope_and_secret_guard",
"passed": true,
"violations": 0
}
],
"verdict": "PASS",
"receipt_sha256": "sha256:7d865e959b2466918c9863afca942d0fb89d7c9ac0c99bafc3749504ded97730"
}
5. Reproducible Receipt Generation & Offline Verification
The entire sealing and verification engine requires zero external dependencies—just Python's standard ast, hashlib, hmac, and json modules. You can wire it directly into GitHub Actions or a Claude Code Stop hook:
# Install and generate a cryptographic receipt in CI ($0.00)
pip install claude-code-eval
claude-eval run --task spec.md --rules eval-rules.json --out receipt.json
# Verify offline in any downstream merge gate or compliance audit
claude-eval verify --receipt receipt.json --rules eval-rules.json
import ast
import hashlib
import hmac
import json
from pathlib import Path
from typing import Any
def canonical_sha256(payload: dict[str, Any]) -> str:
"""Serialize dict deterministically and return prefixed SHA-256 hex digest."""
encoded = json.dumps(payload, sort_keys=True, separators=(",", ":")).encode("utf-8")
return "sha256:" + hashlib.sha256(encoded).hexdigest()
def ast_check_zero_stubs(py_files: list[Path]) -> dict[str, Any]:
"""Deterministic AST check rejecting syntax errors and NotImplementedError stubs."""
defects: list[str] = []
for path in py_files:
source = path.read_text(encoding="utf-8")
try:
tree = ast.parse(source, filename=str(path))
except SyntaxError as exc:
defects.append(f"{path}:{exc.lineno}: SyntaxError: {exc.msg}")
continue
for node in ast.walk(tree):
if isinstance(node, ast.Raise) and isinstance(node.exc, ast.Call):
if getattr(node.exc.func, "id", "") == "NotImplementedError":
defects.append(f"{path}:{node.lineno}: Banned NotImplementedError stub")
return {
"name": "ast_syntax_and_zero_stubs",
"passed": len(defects) == 0,
"files_scanned": len(py_files),
"defects": len(defects),
}
def seal_receipt(
input_bytes: bytes,
ruleset: dict[str, Any],
outcome_bytes: bytes,
checks: list[dict[str, Any]],
) -> dict[str, Any]:
"""Bind inputs, ruleset, checks, and outcome into a tamper-evident SHA-256 receipt."""
body = {
"schema_version": "1.0.0",
"tool": "Benni-OS/claude-code-eval",
"input_digest": "sha256:" + hashlib.sha256(input_bytes).hexdigest(),
"ruleset_hash": canonical_sha256(ruleset),
"outcome_digest": "sha256:" + hashlib.sha256(outcome_bytes).hexdigest(),
"llm_judge_cost_usd": 0.0,
"checks": checks,
"verdict": "PASS" if all(c["passed"] for c in checks) else "FAIL",
}
body["receipt_sha256"] = canonical_sha256(body)
return body
def verify_receipt(receipt: dict[str, Any], expected_ruleset: dict[str, Any]) -> bool:
"""Offline constant-time verification of receipt integrity and ruleset binding."""
claimed_seal = receipt.get("receipt_sha256", "")
payload = {k: v for k, v in receipt.items() if k != "receipt_sha256"}
recomputed_seal = canonical_sha256(payload)
if not hmac.compare_digest(claimed_seal, recomputed_seal):
return False
expected_rules_hash = canonical_sha256(expected_ruleset)
return hmac.compare_digest(receipt.get("ruleset_hash", ""), expected_rules_hash)
6. Comparison: LLM-as-a-Judge vs. Cryptographic Evaluation Receipts
| Evaluation Dimension | Cloud LLM-as-a-Judge | Benni-OS/claude-code-eval |
|---|---|---|
| Cost per CI Run | ~$0.08–$0.60+ per PR (2× token tax) | $0.00 (100% local & offline) |
| Determinism | Probabilistic; drifts across runs & model updates | 100% bit-for-bit reproducible |
| Evaluation Bias | Circular self-preference & verbosity bias | Zero bias; AST, exit-code & policy invariants |
| CI Latency | 5–15+ seconds of remote API round-trips | Milliseconds for AST + SHA-256 sealing |
| Audit & Provenance | Unverifiable prose score in dashboard logs | Tamper-evident receipt_sha256 bound to inputs & rules |
Stop Paying Twice to Grade Your Coding Agents
Deploy Benni-OS/claude-code-eval to bind task inputs, ruleset hashes, AST checks, and outcome digests into reproducible SHA-256 evaluation receipts at $0.00 per CI run.
Frequently Asked Questions
Benni-OS/claude-code-eval binds four immutable components into a canonical JSON payload and hashes it with SHA-256: the input_digest (task spec and base commit), the ruleset_hash (exact AST and policy rules), the deterministic check results (AST syntax, stub detection, unit tests), and the outcome_digest (resulting diff or tree hash).claude-eval verify receipt.json offline. The verifier recomputes the canonical SHA-256 digest over the payload and compares it in constant time against receipt_sha256, while cross-checking the pinned ruleset_hash—detecting any tampering or policy drift immediately.