Skip to main content

Ratchet

Ratchet turns an AI agent's mistakes into tested, signed safety rules, and refuses any change it cannot prove.

When an agent fails, Ratchet writes a guard: a small rule that checks each tool call before it runs. It adopts the guard only after a replay (rerunning recorded past conversations through it) and fresh tests on held-out cases (test cases the improver never sees). Each decision is a receipt, a signed record anyone can verify offline.

It is for teams running tool-using agents that touch money, accounts or tickets, and need a fix to a failing agent to be proven before it ships.

Install

git clone --branch v0.1.0 https://github.com/probityai/ratchet && cd ratchet
uv sync

Python 3.12 or later. The guard sandbox needs Linux.

Try it in 30 seconds

No database, no model key. This guard stops force pushes to main. It is a single standard-library file, exported from an admitted guard, and it is a Claude Code hook (a script run before each tool call). It denies the call:

echo '{"hook_event_name": "PreToolUse", "tool_name": "Bash", "cwd": ".", "tool_input": {"command": "git push --force origin main"}}' \
  | python3 examples/claude-code/hooks/ratchet_no_force_push_main.py; echo "exit $?"
blocked by guard no-force-push-main: force push to main rewrites shared history; push a branch and open a pull request instead
{"hookSpecificOutput": {"hookEventName": "PreToolUse", "permissionDecision": "deny", "permissionDecisionReason": "blocked by guard no-force-push-main: force push to main rewrites shared history; push a branch and open a pull request instead"}}exit 2

Before it was exported, the guard was replayed over six recorded Claude Code sessions: it fired on the three calls it was written for and on none of the other twelve (examples/claude-code/replay.json). The hook's header names the receipt (the signed decision) that admitted it; uv run python -m ratchet.export.claude_code --verify examples/claude-code/hooks/ratchet_no_force_push_main.py checks that receipt.

What it does

A support agent works in a simulated company: a billing provider, tickets, approvals and mail. Its eight case families are seven kinds of trap, each with benign twins (matching cases where the action is allowed, so a rule that blocks them fails), plus ordinary requests that must succeed. Every case is graded on the final state of every system, never on the agent's words.

When the agent fails, the improver proposes a guard or a procedure (written steps for the agent). A change is adopted only if four checks pass: replay; fresh paired tests on held-out cases against the parent harness (the code around the model: prompt, tools and rules); no growth of the agent's authority; and a signed receipt, which verifies offline against a pinned public key. The gates are in docs/ADMISSION.md. Every version, trace, evaluation and decision, rejections included, lives in MongoDB Atlas.

Status

Version 0.1.0, built on 2026-10-11 at the MongoDB harness hackathon. The suite, graders and rule are frozen before each run. Measured results, with denominators, are in docs/RESULTS.md.

Docs

Page What is in it
Running Local Atlas, environment and every command
Admission rule The gates in plain words
Architecture Packages, guard sandbox, storage
Verifying a decision Check a receipt offline
Results Every measured result and its records
Claude Code hook Prove a guard on your own sessions, then install it
Build contract Types, lane interfaces and the full admission rule

Built today and reused

The repository's first commit is from 2026-10-11, and everything under src/ratchet, tests, examples and docs was written at the event. The rest is a pinned dependency or a service.

Reused Pin
Runtime pymongo>=4.10, httpx>=0.27, cryptography>=44, rich>=15, raindrop-ai==0.0.75
Earlier work of the same authors probity-verify at commit b920366, agent-evidence-vectors==0.17.7
Benchmark extra agentdojo==0.1.35 (tool outputs carry hidden prompt-injection attacks), litellm==1.102.1, terminal-bench==0.2.18, tau-bench at 59a200c (simulated customer-service tasks graded on the final database state), tau2 at 4ce7c03, tool-sandbox at c8571d7
Instruction search extra gepa==0.1.4
Services MongoDB Atlas (mongodb-atlas-local:8.3.9-20260928T091948Z for development), Voyage embeddings, Raindrop

The integration that writes and checks Ratchet's own admission records is new. The verifier it calls is not.

License: Apache-2.0.

Metadata

Release files for probity-ratchet 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for probity-ratchet 0.1.0
File Size Uploaded Provenance Actions
probity_ratchet-0.1.0.tar.gz 1.1 MB Without provenance Details for probity_ratchet-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for probity-ratchet 0.1.0
File Interpreter ABI Platform Actions
probity_ratchet-0.1.0-py3-none-any.whl Python 3 none any Details for probity_ratchet-0.1.0-py3-none-any.whl

Total release size: 1.6 MB

Release files / probity_ratchet-0.1.0.tar.gz

Download URL probity_ratchet-0.1.0.tar.gz
Size 1.1 MB
Tags Source
SHA-256 checksum
How to use checksums
0565af35a7c92be108aa05691f259bd3d7b11bf5bdfd5fe2a0eac9d158e06f53
BLAKE2b-256 checksum
How to use checksums
ceedfeeff1ffc1fadee75f0de6cc16f6bad0ca70570869760a67343edbf4ad7a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.12.23 {"installer":{"name":"uv","version":"0.12.23","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release files / probity_ratchet-0.1.0-py3-none-any.whl

Download URL probity_ratchet-0.1.0-py3-none-any.whl
Size 491.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1558a9f79ac33de5621297c84ca7594213a60687f0ad2749d103052de0cbe7d2
BLAKE2b-256 checksum
How to use checksums
1d2d82e0fe6affe3a728a52b98a01802880881d3e506b796a1fc662c0cac69d9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.12.23 {"installer":{"name":"uv","version":"0.12.23","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Security for probity-ratchet 0.1.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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A 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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page