Assaystone
Your agent's tests pass. Did it delete the failing test?
Assaystone audits existing agent traces for silent failures — the failures a green test suite cannot see. Point it at a transcript; get findings and a suggested contract in seconds. Then gate CI and runtime with the same contract, and prove the checks work with mutation testing and backtesting.
python3 -m assaystone demo audit
audit-demo-session changed: pricing/discounts.py, tests/test_discounts.py
HIGH tests.integrity tests/test_discounts.py (modified)
summary: 0 critical, 1 high, 0 medium, 0 low
The agent fixed the rounding bug, then deleted the one test it still failed, and
reported success. tests.pass saw a green suite. The audit found the deleted test.
The rest of the loop:
python3 -m assaystone demo # code/test verifier pack
python3 -m assaystone demo ops # runtime gate + ops/refund pack
The code demo compares a naive contract (tests + syntax) with a hardened one:
1/4 vs 4/4 defects caught, and mutation testing raises verifier recall from
67% to 94%. The ops demo catches 0/4 vs 4/4 bad refunds, and the runtime gate
blocks a denied approval and an over-limit refund.
What a passing test suite misses
| Defect | tests.pass |
Assaystone |
|---|---|---|
| Agent deletes the failing test | ✅ passes | ❌ tests.integrity |
| Agent edits CI to skip the suite | ✅ passes | ❌ diff.forbidden_paths |
| Agent leaves a debug print | ✅ passes | ❌ quality.no_debug_prints |
| Agent weakens an assertion | ✅ passes | ❌ tests.integrity |
| Regression in another module | ❌ fails | ❌ tests.pass |
Actions have the same problem. In the ops demo, an amount-only contract catches 0/4 bad refunds; policy, ledger, status, and approval checks catch 4/4.
Failure Zoo
The repo ships with labeled failures, not just demos: a deleted test, a CI edit, a debug print, a cross-module regression, an over-limit refund, and a missing approval. Each case names the verifier that should catch it, and each one is a regression test for the verifier ladder. The corpus is the seed for a public benchmark — bring a redacted trace and it becomes a fixture.
Why
Evaluations give you a score. Production needs a verdict: what failed, why, with what evidence, and whether a human must look. Agents fail silently; a green test suite is not an acceptance criterion.
The longer argument: Verification is the bottleneck.
Field note: What 162 real Claude Code sessions say about verification.
Install
Python 3.10+. No runtime dependencies.
pip install assaystone
assaystone demo audit
From source for contributors:
git clone https://github.com/yellowsand1/assaystone
cd assaystone
python3 -m pip install -e ".[pytest]"
python3 -m assaystone demo audit
Audit your own traces
# Claude Code transcript
assaystone audit ~/.claude/projects/.../<session>.jsonl --baseline .
# LangSmith / Langfuse exports
assaystone audit runs.json --format langsmith --baseline .
assaystone audit trace.json --format langfuse --baseline .
# OpenTelemetry GenAI (OTLP JSON)
assaystone audit otel.json --format otel --baseline .
# a message export or a trace JSON
assaystone audit trace-export.json --git-repo .
# turn findings into a contract
assaystone audit session.jsonl --baseline . \
--write-contract .assaystone/contract.json
# CI reports
assaystone audit session.jsonl --baseline . \
--sarif results.sarif --junit results.xml
# use HEAD as the pre-session baseline for diff-size / public-API checks
assaystone audit session.jsonl --baseline . --git-preimage
# aggregate-only audit of a local Claude Code corpus
python scripts/corpus_audit.py --root ~/.claude/projects
Supported inputs: Claude Code .jsonl transcripts, LangSmith run exports, Langfuse
trace/observation exports, OpenTelemetry GenAI spans, message JSON/lists, and
Assaystone trace JSON. Importers are heuristic; --format forces one. For transcripts
and importers, artifacts are reconstructed from Write / Edit tool calls;
--git-repo is more reliable when the changes are real. If the repository is already
in its post-session state, the audit falls back to reading the current files;
--workspace forces that mode (the Claude Code hook uses it). Default rules: test
integrity, forbidden paths, syntax, diff size, public API, debug prints, and
claim-vs-evidence. --run-tests adds the test suite. --json is for machines;
--sarif / --junit are for CI; --no-evidence keeps raw evidence out of reports.
--run-tests executes the project's test command in a temporary copy of the baseline;
it is not a sandbox, so only audit traces and repositories you trust.
Details: docs/audit.md · importers.
Quickstart in your repo
If you already have transcripts, start with assaystone audit above. init is for
when you want a contract to gate future runs:
cd your-agent-repo
assaystone init --ci
This writes .assaystone/contract.json and a GitHub Actions workflow. The contract
includes checks for syntax, forbidden paths, test integrity, diff size, public API,
debug prints, claim-vs-evidence, and the test suite (when one is detected).
Record a trace from a framework message list:
from assaystone.adapters import artifacts_from_git, from_claude_agent
trace = from_claude_agent(
messages,
artifacts=artifacts_from_git("."),
task="fix the failing rounding test",
)
trace.save(".assaystone/traces/run-001.json")
Or from a recorded transcript:
assaystone record --transcript messages.json --git-repo . \
--out .assaystone/traces/run-001.json
Verify:
assaystone verify --contract .assaystone/contract.json \
--trace .assaystone/traces
Exit codes: 0 all pass, 1 at least one fail, 2 needs human review. Use --json
for machines, --github for Actions annotations.
Integrations
Claude Code Stop hook
assaystone hook install claude-code --mode warn
This merges a Stop hook into .claude/settings.local.json (use --user for global
settings). The hook audits the session transcript when Claude stops. Default is warn;
--mode block blocks high/critical findings. Repeated identical findings are
suppressed per session, and .assaystone/hook.json can ignore known-good test edits.
Details: docs/hooks.md, example:
examples/hooks.
pytest
pytest --assaystone-contract .assaystone/contract.json \
--assaystone-traces .assaystone/traces
One test item per trace; failures show up like normal pytest failures. Or use the fixture:
def test_agent_run(assaystone):
result = assaystone.verify(".assaystone/traces/run-001.json")
assert result.verdict == "pass", result.first_failure
GitHub Action
- uses: yellowsand1/assaystone@v0.3.1
with:
contract: .assaystone/contract.json
traces: .assaystone/traces
install: assaystone==0.3.1 # optional; default installs the action repo
Failures become PR annotations; a Markdown summary is written to the job summary.
Framework adapters
- Claude Agent SDK message streams (
from_claude_agent) - OpenAI-style chat/tool messages (
from_openai_agents) - LangGraph state dicts (
from_langgraph) - Generic message lists (
from_messages) - Runtime wrappers: LangGraph and OpenAI Agents SDK
artifacts_from_gitcollects changed files as artifacts
Adapters are duck-typed and never import the framework. Details: docs/adapters.md.
Custom verifier
from assaystone import Verifier, register
@register
class NoMigrationEdits(Verifier):
name = "policy.no_migrations"
layer = "L1"
cost_usd = 0.00001
independence = "high"
def check(self, ctx, params):
bad = [path for path, _ in ctx.changed() if path.startswith("migrations/")]
return (not bad, [f"migration touched: {path}" for path in bad], [])
Add {"name": "policy.no_migrations"} to the contract.
How it works
recorded trace (task, tool calls, artifacts, evidence)
│
▼
acceptance contract (verifier ladder + budget + escalation)
│
▼
pass / fail / escalate ──► CI gate, runtime gate, human review
│
├── mutate: inject labeled defects, measure verifier recall
└── backtest: replay historical traces before enforcing a check
- Trace — what the agent did, what it produced, what evidence it left.
- Contract — acceptance criteria for one task type, versioned with the agent.
- Verifier — a cheap, independent check with a declared layer and cost.
- Verdict — pass, fail, or escalate with reasons and evidence refs.
- Mutation — inject one plausible defect at a time; did the contract kill it?
- Backtest — replay human-labeled traces; measure catch rate, escaped defects, false alarms, and cost.
Runtime gate
The same contract can gate actions, not just CI:
from assaystone.adapters import artifacts_from_git
from assaystone.runtime import RuntimeGuard
guard = RuntimeGuard(
".assaystone/contract.json",
baseline=".",
irreversible={"refund.create"},
approval_callback=ask_human,
)
with guard.session(task="refund duplicate charge") as session:
session.call("read_order", {"order_id": "O-1"}, read_order)
session.call("refund.create", {"amount_cents": 4000}, do_refund)
result = session.finish(artifacts=artifacts_from_git("."))
Irreversible tools are blocked unless approval_callback returns True. The full
contract runs at finish; ContractFailed and EscalationRequired stop the run.
enforce=False runs in shadow mode. Details: docs/runtime.md.
Framework wrappers: LangGraphGuard and run_with_verification for OpenAI Agents —
docs/integrations.md.
The verifier ladder
| Layer | Examples | Cost | Independence |
|---|---|---|---|
| L0 | invariants, schema, step budget | ~free | high |
| L1 | compiler, tests, path policy | low | high |
| L2 | diff, public API, custom rules | low | high |
| L3 | evidence / citation checks | low-medium | medium-high |
| L4 | LLM judge (not in the default ladder) | low but correlated | low |
Use the cheapest sufficient verifier. A judge is a filter, never the oracle.
References: built-in verifiers · contract format.
Where it fits
Assaystone is an acceptance layer, not a replacement for evaluation or observability.
- Evals (promptfoo, DeepEval, Inspect AI) score outputs across a dataset. Assaystone audits one run's artifacts and returns a verdict with evidence.
- Guardrails (Guardrails AI, framework callbacks) filter inputs and outputs. Assaystone also gates irreversible tool calls and checks the final deliverable.
- Tracing (LangSmith, Langfuse, OpenTelemetry) records what happened. Assaystone consumes those exports and decides whether the run is acceptable.
- Signed records (Tracekit and similar) prove what ran. Assaystone supplies the contract and verdict those records can attest to.
They compose: record → verify → escalate. Keep the tools you already run; put Assaystone at the acceptance boundary.
Design principles
- Verify artifacts, not self-reports. "All tests pass" is a claim; the recorded exit code and the re-run suite are evidence.
- Record once, verify many. Verification is decoupled from generation, so checks can be replayed, backtested, and mutated.
- Cheapest sufficient verifier first. Every verifier declares cost; the runner stops at the first required failure.
- Escalation is a first-class outcome. If cheap checks cannot decide, route to a human with an evidence bundle.
- Verifiers are code, and they are tested. Mutation testing measures recall; a verifier you never challenged is a liability.
Repository layout
assaystone/ # library: models, runner, verifiers, adapters, audit, runtime, CLI
assaystone/demo_data/ # packaged demos (the wheel can run them)
examples/code_agent/ # baseline repo, contracts, scenarios, generated traces
examples/ops_agent/ # runtime gate + ops/refund pack
examples/audit/ # a Claude Code transcript that deletes the failing test
examples/importers/ # LangSmith / Langfuse / OTel export fixtures
examples/hooks/ # Claude Code Stop hook settings
failure_zoo/ # labeled failure corpus (seed)
docs/why.md # the longer argument
docs/case-study-2026-11.md # 162-session field note
docs/audit.md # audit inputs, rules, output, limitations
docs/importers.md # LangSmith / Langfuse / OTel formats
docs/hooks.md # Claude Code Stop hook
docs/adapters.md # Claude / OpenAI / LangGraph adapters
docs/integrations.md # LangGraph / OpenAI Agents runtime wrappers
docs/verifiers.md # built-in verifier reference
docs/contracts.md # contract format and exit codes
docs/runtime.md # runtime guard reference
docs/release.md # maintainer release checklist
docs/releases/ # per-version release notes
scripts/corpus_audit.py # aggregate local corpus audit
tests/ # unit + integration tests
Status and roadmap
v0.3.1 — alpha. The core is domain-agnostic; the code/test and ops/refund packs
ship today.
- audit: Claude Code transcripts, message exports, trace JSON
- LangSmith / Langfuse / OpenTelemetry importers
- Claude Code Stop hook (warn/block, install, dedupe, allowlist)
- SARIF and JUnit output
- contracts, verifier ladder, pass/fail/escalate
- mutation testing and backtesting
- Claude Agent SDK / OpenAI-style / LangGraph adapters,
artifacts_from_git - pytest plugin and GitHub Action
- runtime gate for irreversible actions (approvals, shadow mode)
- LangGraph / OpenAI Agents runtime wrappers
- ops/refund pack
- git pre-image baseline for post-session diff checks
- data reconciliation and report citation packs
- verifier registry and Failure Zoo benchmark
- TypeScript port
Contributing
The fastest way to help is to bring a failure case. See CONTRIBUTING.md for verifier and adapter guidelines.
Maintainers: see docs/release.md for the release checklist.
If this catches a failure in your stack, bring the trace. Reproducible cases become regression tests.
Name
An assay determines the quality of a substance; an assay stone (touchstone) tests gold. Chinese: 试金石.
License
Apache-2.0.
Metadata
Release files for assaystone 0.4.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| assaystone-0.4.0.tar.gz | 85.0 kB | With provenance | Details for assaystone-0.4.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| assaystone-0.4.0-py3-none-any.whl | Python 3 | none | any | Details for assaystone-0.4.0-py3-none-any.whl |
Total release size: 178.8 kB
Release files / assaystone-0.4.0.tar.gz
| Download URL | assaystone-0.4.0.tar.gz |
|---|---|
| Size | 85.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
d41cd43caf41a540ab9d06b65c17829a6aa791d516c248bbb18b2dea524ea3c9
|
|
BLAKE2b-256 checksum How to use checksums |
027af6cce5a4a9e38540e2731366eb74c51b34befe4375f604dd619a65ea31cd
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 23, 2026.
Transparency logRelease files / assaystone-0.4.0-py3-none-any.whl
| Download URL | assaystone-0.4.0-py3-none-any.whl |
|---|---|
| Size | 93.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
710c81150454b8622ebfda6ac21414fce395dbcc8f79b29271e7b52e023317a9
|
|
BLAKE2b-256 checksum How to use checksums |
a79c9a058184873a0b3f38f6b3c88b6e675a788bebc090688f5bc2356d60a725
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 23, 2026.
Transparency logSecurity for assaystone 0.4.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for assaystone-0.4.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 23, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.