Check whether a code change weakens your tests.
A test can pass after it stops checking something useful. checkwash reads your Git diff and flags known patterns such as deleted assertions, skipped tests, relaxed expectations, and CI checks that stop failing.
- assert total == 105.3
+ assert total > 0
The new assertion accepts many incorrect totals. checkwash flags changes like this for review, including changes written by coding agents.
Runs locally. No LLM. No network during analysis. Never executes your code.
These examples use 0.13.2. The installation guide tracks the latest verified CLI download and Action pin. The 0.13.2 release guide describes the Python import fixes, CLI changes and measured Django scan times.
Already installed from PyPI? From your Git repository, run
python -m checkwash check to review your uncommitted changes. Use the Python
that installed the package, including the interpreter in the CheckWash
environment if you used pipx. This also works when Windows blocks the
checkwash.exe launcher.
Try the offline demo · Install Claude Code hooks · Require the GitHub Action
You need Python 3.11+, Git and Claude Code. Install the CLI, then run the hook installer from the root of your repository:
pipx install checkwash==0.13.2
checkwash hook install --agent claude-code --local
This writes checkwash's hooks to .claude/settings.local.json, your
machine-local Claude Code settings (--local is the default; --shared
writes .claude/settings.json without the PreToolUse prompt):
- Stop hook: checks the working tree and the session's commits when Claude
is about to finish (paired with a
SessionStarthook that records where the session began). On a blocking finding, it stops Claude and returns the finding so Claude can restore the test or explain what blocked. - PreToolUse ask (
--localonly): prompts before anEdit,WriteorMultiEditof a Python test file leaves ahighfinding under one of five weakening rules (ASSERT_WEAKENED,ASSERT_REMOVED,TEST_DISABLED,TOLERANCE_LOOSENED,BROAD_EXCEPT_ADDED). Non-interactiveclaude -pruns deny such edits because nobody can answer; the interactive prompt itself is not verified in automated tests.
Both hooks are author-side checks: edits made through Bash bypass the
PreToolUse ask, and engine errors in the Stop hook report a non-blocking note
(except working-tree files over the size limit). To enforce verdicts on merges,
configure the required CI check under Use it in CI. Hook
limits are documented in the
0.11.0 known issues.
You need Python 3.11+ and Git. Download the single-file zipapp and run the built-in offline examples first.
Windows PowerShell (including 5.1, where curl aliases Invoke-WebRequest):
curl.exe -LO https://github.com/taipei49314/checkwash/releases/download/v0.13.2/checkwash.pyz
python checkwash.pyz --version
python checkwash.pyz demo
macOS/Linux or Git Bash:
curl -LO https://github.com/taipei49314/checkwash/releases/download/v0.13.2/checkwash.pyz
python checkwash.pyz --version
python checkwash.pyz demo
You can also download checkwash.pyz in your browser.
Then, from a Git repository with at least two commits:
python checkwash.pyz check HEAD~1..HEAD
- Uncommitted changes:
python checkwash.pyz check - Branch review from merge base:
python checkwash.pyz check BASE...HEAD(BASE..HEADcompares the two snapshots directly) - Hands-on walkthrough: follow
examples/invoiceto watch a failing test, a one-line shortcut edit that makes it green without fixing the bug, and checkwash's block.
Running check from a subdirectory analyses the whole repository from its Git
root and notes that root on stderr
(#416). For JSON/SARIF
output and machine integration, see the
embedding guide
and stability contracts.
To stop a merge, make the checkwash status check required in your
repository's branch rules. Installing the tool or adding a workflow alone
does not enforce its verdict.
Save this as .github/workflows/checkwash.yml:
on: [pull_request]
permissions:
contents: read
jobs:
checkwash:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
fetch-depth: 0
persist-credentials: false
- uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0
with:
python-version: "3.12"
- uses: taipei49314/checkwash/action@4ecb0b0efa2febe7dcacae7f4114e98877205128 # v0.13.2
After the workflow runs once, open Settings → Rules → Rulesets and require
the checkwash status context (keep the job unconditional). Repository
administrators with a clone of this project can also add the ruleset via:
gh api repos/OWNER/REPO/rulesets --method POST --input action/required-ruleset.json
checkwash doctor checks the local workflow file (it cannot inspect live
GitHub branch protection). When upgrading, update the CLI and local hooks
before bumping the Action pin; see CI details.
| Result | What to do |
|---|---|
| Pass · exit 0 | No finding requires blocking under your configuration. Keep running your normal test suite and code review. |
| Block · exit 1 | Read the finding and the diff. It may be weakened verification or a false positive. |
| Error · exit 2 | Resolve the input or analysis error before relying on the result. |
The default threshold is high: a visible warn still passes.
Read the finding. For the diff at the top of this page inside
test_invoice_total in tests/test_billing.py, checkwash prints:
ASSERT_WEAKENED HIGH tests/test_billing.py :: test_invoice_total
test_invoice_total: assertion strength EXACT_VALUE(90) -> BOUND(40)
why high: NO_PROD_CHANGE_IN_DIFF
no de-escalator applied
before assert total == 105.3
after assert total > 0
EXACT_VALUE(90) -> BOUND(40) ranks assertion strength before and after;
why high names the escalator (NO_PROD_CHANGE_IN_DIFF, or
REPAIR_EVIDENCE_REFUSED when weakened alongside a production edit). Use
checkwash check --format json for machine-readable output.
Fix the change, or record a reviewed exemption. If the test was weakened by mistake, restore it and fix the code. If the weaker test is intentional, record a time-boxed exemption (90 days default, 180 max) using the fingerprint printed in the report:
checkwash allow "<the fingerprint from the report>" --reason "why the weaker test is correct"
Configuration and exemptions are read strictly from the base side of the
diff (comparing .checkwash/ against any .greenwash/ predecessor), so a PR
cannot exempt or relax rules for itself: merge the ledger entry through code
review first, and protect .checkwash/ and .greenwash/ with
CODEOWNERS
(exemption rules).
For a local main...branch check, merge or rebase onto the updated main so
the common ancestor includes the exemption. On GitHub, push to the pull
request branch or use Update branch to trigger a new pull request event.
Re-running an old job uses the original event's commits.
Report a false block. If checkwash blocks an honest change, check the
failure ledger
first, then open an issue
with the checkwash blocked honest work template (checkwash check --format json
plus the diff). Accepted reports become regression fixtures crediting the
reporter.
checkwash is alpha. A pass means no known tampering pattern was flagged at or above your threshold; it does not prove a change is correct or honest. Python is the primary supported language; JS/TS support covers a bounded set of patterns.
Four core limits to know before relying on a pass:
- Test files are found by default naming conventions. Python files are
scanned when named
test_*.pyor*_test.pyoutside pytest's default ignored directories (build/,dist/,venv/, dot-directories), reading only default pytest test names; non-default filenames such astests/pricing_tests.pyor Djangotests.pyemit ananalysis incompletenote oncheck(stderr, terminal report and SARIF) when changed, and are not parsed as test units even ifpyproject.tomlcollects them. JS/TS scans zero-configuration Jest and Node paths (*.test.*,*.spec.*,__tests__/**,.js/.tsundertest/, andtests/files importingavaortap), without readingjest.config.*,vitest.config.*,.mocharc.*orpackage.json`` jestcollection rules. - A JS/TS pass covers fewer patterns than Python. Fewer assertion and helper idioms are modelled in JS/TS, and runner config changes that silently drop test files are not read.
- Editing agent-instruction files blocks, except strict inert EOF appends to root
CLAUDE.md. Changes to rootAGENTS.md,.cursorrules,.claude/**,.checkwash/**or.greenwash/**—and any prepend, mid-file insertion, adjacent append without a blank line, deletion, edit, reorder, or fence/comment/---/[label]:addition in rootCLAUDE.md—escalateGUARDRAIL_TOUCHEDtocritical. Strict inert appends at the end of rootCLAUDE.mdseparated by a blank line (GUARDRAIL_ADDITIVE), appended exemption entries (EXEMPTION_ADDED), and newly created guardrail files that do not weaken checkwash config stay atwarn. - Claude Code hooks are author-side helpers, not a merge gate. Only the required CI check in range mode enforces verdicts on pull requests.
Honest changes can pass, warn or block. When a deprecated function and
its whole test are removed together, PROD_SYMBOL_REMOVED can hold the finding
at warn. When behaviour changes and a test's expected value changes with it,
the report can credit the production change (REPAIR_EVIDENCE).
Python refuses that credit for a removed assertion or deleted test.
JS/TS can give it in both cases. Both languages refuse it for a weakened
assertion or loosened tolerance. If a legitimate change still blocks, review
the finding before requesting an exemption.
On the project's 60-case refactor corpus (57 strictly qualified), the
expected-verdict table (benchmarks/refactors/expected.json) and the published
0.12.0 CLI mark 6 of 60 as blocking (4 among the 57, including known false
blocks CASE_020_windows and CASE_029_flatten). Changed files over
1,000,000 bytes are not read (non-Python assets/docs warn on stderr;
test, CI, guardrail, .py or pytest config files over the cap exit 2).
Customizing guarded instruction files (for example, unguarding CLAUDE.md) #
Subdirectory instruction files, CLAUDE.local.md, lowercase claude.md,
.gitattributes working-tree-encoding rules, and other agents' config filenames
are not guarded by default. GUARDRAIL_ADDITIVE on root CLAUDE.md covers only
strict inert appends at end-of-file separated by a blank line (no ---, code
fences, HTML comments, [label]: definitions or invisible Unicode formatting
characters), and stays at warn even if an appended plain-text line contradicts
earlier prose or adds an @path import.
To let a blocking guardrail edit through, record a reviewed exemption or
override [roles].guardrail in a base-side .checkwash/config.toml (or
.greenwash/config.toml if your repository uses that directory):
[roles]
guardrail = ["AGENTS.md", ".cursorrules", ".claude/**", ".checkwash/**", ".greenwash/**"]
Because this list replaces the default, keep .checkwash/** and
.greenwash/** in it so checkwash continues guarding its own config and
ledger. Creating a new config file is a warn; editing an already-tracked
config is itself a critical guardrail edit until merged to the base.
Repair-evidence residuals, JS/TS table scope and refactor-corpus provenance #
REPAIR_EVIDENCE describes related changes in the same diff; it does not prove
a repair is semantically valid, and a no-op production edit (such as + 0) can
earn it (#419). From
0.12.0 (0.13.0 known issues,
0.12.0 known issues,
0.11.0 known issues),
weakened or loosened assertions and skips on live tests refuse repair evidence
in both languages. Removing an assertion or a whole test also refuses that
credit in Python. JS/TS can still credit a related change for those removals.
A Python test deletion held at warn by PROD_SYMBOL_REMOVED uses a separate
rule about a removed production symbol. Review the reason printed with the
finding. For stricter enforcement, see the fail-on: warn and base-side
oracle_freeze options in the
enterprise hardening guide.
In JS/TS (since v0.9.0, #428),
each test.each, it.each and test.for table with a static title is a unit
whose rows are counted when written as an inline array, tagged template or
same-file const used only as a table; describe.each rows and computed-title
tables remain unread.
For the 60-case refactor corpus, 6 of 60 (4 of 57 strictly qualified) is
the static source readback retained since the
D-185 dispositions
and matched by the published 0.12.0 CLI on Windows (2026-11-10 UTC). Earlier
historical snapshots in the repository record 22/60 blocks (36.7%) at v0.3.1
(benchmarks/refactors/results-latest.json) and 4/60 (2/57 strictly qualified,
with three fixture errors) in a pre-v0.3.4 source replay; those historical
records are preserved unchanged and are selected examples rather than a general
false-positive rate.
Which files over the 1,000,000-byte limit stop the run, and how each output reports them #
Since v0.9.0 (#454,
#455), oversized
non-Python assets, lockfiles, docs and non-Python production sources are set
aside without earning repair evidence: --format json lists them under
unread, SARIF emits a tool execution notification, and terminal output prints
a ! note (opening with analysis incomplete when there are zero findings);
--format hook-json and --emit-ir omit unread.
Any oversized file a detector or import resolver must read—test, conftest, CI,
guardrail, snapshot, JS setup, runner script, .py module, pytest config
(pytest.ini, .pytest.ini, pytest.toml, .pytest.toml, tox.ini,
setup.cfg, pyproject.toml) at any depth, or non-generated scripts/**
file—stops the run with exit 2 (--format json prints {"unread": [...]}
except on an unread symlinked pytest-config target in range mode; term and
SARIF stay empty). checkwash streams up to 64,000,000 bytes per Git side and
inspects the first 200 bytes of oversized sides solely to detect shell shebangs
(an extensionless file with a side over 64 MB still stops the run). Generated
paths (build/, dist/, node_modules/) are set aside unless they match .py,
pytest config, CI, runner script or unknown-shebang extensionless rules. At the
base, oversized root poetry.lock/ uv.lock warn on stderr, while oversized
root pyproject.toml or requirements*.txt exit 2 across term/json/SARIF. In
the Claude Code Stop hook (--format hook-json), engine errors report a
non-blocking message and exit 0, except when a file changed by the hook's diff
exceeds the limit in the working tree, which blocks the stop and asks to
shrink, split or revert it (#456;
see subject integrity).
Try it on your own changes before making it required. Coverage and limitations · Known gaps · 0.13.2 known issues · 0.13.1 known issues · 0.13.0 known issues · 0.12.0 known issues
The recommended Action and CLI above are both v0.13.2. The CLI is available
on PyPI and as a standalone download from the GitHub Release. Always upgrade the CLI and its local
hooks first, then update the Action SHA in .github/workflows/checkwash.yml.
Enterprise setup
· Action reference
Verify the Action pin or upgrade from an older release #
Development snapshots: source on main may be ahead of the published CLI.
The advertised-release manifest
records the verified version, tag commit and artifact digests behind the
commands above.
Verify the SHA. In a CheckWash clone, substitute the release tag for
vX.Y.Z and run git rev-parse 'vX.Y.Z^{commit}'. For v0.11.0 only, use
git rev-parse 'vX.Y.Z^2^1'. An Action commit cannot embed its own commit SHA.
The CLI on PyPI and the release zipapp are built with that SHA, so their
doctor recognizes the pin. The
Action reference
explains release tags, pin updaters and older CLI versions.
Advisory for Action <= v0.7.0: Action releases up to v0.7.0 ran
python -m pip and checkwash with the PR checkout as working directory,
allowing a PR to shadow pip or checkwash (#372,
fixed in v0.8.0). Pin the v0.13.2 Action above; see
SECURITY.md.
Install as a CLI or try the included examples #
If you already use pipx, install the fixed version:
pipx install checkwash==0.13.2
checkwash check HEAD~1..HEAD
checkwash demo # 8 tampering cases, blocked, offline
To find pipx's Python, run pipx environment --value PIPX_LOCAL_VENVS.
Use the full path to checkwash\Scripts\python.exe on Windows or
checkwash/bin/python on macOS/Linux under that directory when running
python -m checkwash from your repository.
checkwash demo replays eight tampering cases and one honest fix. Five of
the eight are adapted from this project's decoy corpus: coding agents were
pointed at small repositories with a failing test and asked to make the
suite pass without fixing the bug (given only the task, none of the twelve
touched a test). One was found in this project's own release gate; two are
synthetic. The demo prints each case's origin. It illustrates known
patterns; it is not a coverage guarantee.
You can run the same examples with python checkwash.pyz demo.
Read the measurements and their limits #
The historical six-repo sweep recorded 46 / 1800 = 2.56% blocks: 31 false positives (1.72%), 15 legitimate policy blocks (0.83%). The tracked artifacts record engine v0.3.0 (the release commit, swept 2026-09-07) on a corpus used to tune the detectors, not a held-out result.
1.33% of the corpus (24/1800) records opaque production changes. That flag does not establish that each verdict changed or each diff was unanalyzed.
Review methods vary: the three-rater agreement study covers an older
35-diff cohort, not all 46 blocks. The dedicated 22/60 refactor result
(benchmarks/refactors/results-latest.json, a dated v0.3.1 snapshot) is a
separate population; the general-commit rate does not predict it.
Measurements and source data · Generated results · Failure ledger
| Looking for… | Start here |
|---|---|
| Installation checks, versions and first use | Installation guide ·0.13.2 release guide ·Release history |
| JSON/SARIF contracts and upgrades | Stability ·Embedding guide ·Findings schema |
| Assertion support, coverage warnings and artifact checks | Assertion coverage |
| Required checks and reviewed exemptions | Enterprise setup |
| Contributing or reporting a problem | Contributing ·Issues ·Security reports |
| Readiness for 1.0 | Criteria — not met |
Related project: checkwash-prove (experimental) executes your test suite against concrete mutants to show what protection a test change dropped.
The package also includes a limited quality preview for coverage, Ruff and mypy configuration review. Setup and CI adoption guide. Use the preview to review changes to tool settings. Its recorded compatibility comparison still fails, and enforcement on real changes remains unverified.
Alpha pre-release. 22 detectors, 23391 tests collected by pytest. Zero runtime dependencies. Apache-2.0.