Cryptographic Evaluation Receipts: Proving AI Coding Agent Quality Without Paying an LLM-as-a-Judge Tax

Why grading AI coding agents with expensive cloud LLMs introduces circular bias, non-determinism, and a 2× token bill—and how Benni-OS/claude-code-eval binds input digests, ruleset hashes, AST checks, and outcome digests into reproducible SHA-256 receipts at $0.00 per CI run.

Cryptographic Evaluation Receipts: Proving AI Coding Agent Quality Without Paying an LLM-as-a-Judge Tax

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:

Core Architectural Principle: Code quality is not a literary critique—it is a set of verifiable structural and behavioral invariants. Benni-OS/claude-code-eval replaces expensive LLM judges with deterministic AST, lint, and test evaluators sealed into reproducible SHA-256 cryptographic receipts at $0.00 per CI run.

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:

flowchart TD I["Task Spec + Base Git Tree"] -->|"SHA-256"| ID["input_digest"] R["Pinned Policy (rules.json)"] -->|"SHA-256"| RH["ruleset_hash"] P["Agent Patch / Worktree"] -->|"Local Execution ($0.00)"| EV["Deterministic Evaluators<br/>AST Parse + Zero-Stub Scan + Pytest"] P -->|"Diff / Tree SHA-256"| OD["outcome_digest"] ID --> C["Canonical JSON Payload<br/>(sort_keys=True, compact)"] RH --> C EV --> C OD --> C C -->|"SHA-256 Seal"| S["receipt.json + receipt_sha256"] S -->|"Offline Verifier (< 5ms)"| V{"claude-eval verify"} V -->|"Digest Match"| PASS["Exit 0: Auditable Proof"] V -->|"Tamper / Policy Drift"| FAIL["Exit 2: Rejected"]

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:

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.

Explore Benni-OS/claude-code-eval on GitHub →

Frequently Asked Questions

Why is LLM-as-a-Judge flawed for grading AI coding agents?
Using a cloud LLM to grade another coding agent introduces circular self-preference bias, non-deterministic pass/fail verdicts across identical inputs, 5–15 seconds of extra latency, and a 2× token tax. Worse, an LLM prose score offers zero cryptographic proof that tests actually ran or that rules were enforced.
What does a SHA-256 cryptographic evaluation receipt bind together?
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).
How can evaluation cost $0.00 per CI run?
Because all verification—AST parsing, forbidden stub scanning, test execution, and SHA-256 canonical sealing—runs locally and deterministically on your CI runner with zero outbound LLM API calls.
How do enterprise teams verify a receipt months after a merge?
An auditor or CI gate runs 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.