PatchProof
Deterministic Code-Patch Verification & Reliability Engine for AI-Assisted Engineering
PatchProof is an independent verification subsystem designed to evaluate, test, and validate AI-generated code patches (from Aider, Claude Code, Cursor, Copilot, Windsurf, etc.) using isolated zero-network container sandboxes, AST dependency analysis, Spectrum-Based Fault Localization, flakiness disambiguation, and cryptographic proof-of-patch attestation.
Key Features
- Anti-Cheat Test Tampering Guard: Prevents autonomous agents from evading failures by modifying the test suite. Audits AST deltas across test files to detect and reject assertion count reductions, test function deletions, and
@pytest.mark.skipsuppression injections. - Isolated Container Sandboxing: Executes tests in hardened, zero-network Docker containers (
--network none,--read-only, unprivileged UID10001:10001, dropped capabilities) with ephemeral staging workspaces and symlink traversal defense. - Predictive Test Slicing (
--slice): Analyzes patch AST import graphs to isolate and run only impacted tests in < 5ms instead of waiting for the full test suite. - Spectrum-Based Fault Localization (SBFL): Correlates failing test tracebacks directly with patch hunks, calculating an Ochiai suspicion score and pinpointing the exact lines of code that triggered regressions.
- Flakiness Disambiguation (
--disambiguate-flakes): Re-runs failing tests inside the sandbox across 3 retry attempts to disambiguate non-deterministic timing/race flakes from true deterministic regressions. - Autonomous Self-Healing Loop (
patchproof heal): Orchestrates multi-turn convergence loops using localized fault diagnostics to automatically repair regressions until the patch is clean. - Cryptographic Proof-of-Patch Attestation (
--cert): Generates tamper-proof HMAC-SHA256 signed verification certificates (patchproof.cert.json) for CI/CD and pull request merge gating. - One-Command Agent Onboarding (
patchproof init-agent): Automatically configures.aider.conf.yml,.cursor/mcp.json,.cursorrules, andCLAUDE.md. - Model Context Protocol (MCP) Server: Built-in JSON-RPC stdio MCP server exposing verification, diagnostics, and certificates directly to AI coding agents.
Quickstart
Installation
pip install patchproof-core
(Installs the patchproof CLI and import patchproof Python package.)
Or install in development mode from source:
git clone https://github.com/ArnavSingha/Patchproof.git
cd patchproof
pip install -e ".[dev]"
CLI Usage
1. Verify Patches in Isolated Sandbox
# Verify a patch file with predictive slicing and flakiness disambiguation
patchproof verify changes.patch --slice --disambiguate-flakes
# Verify uncommitted Git changes in current repository
patchproof verify --git --slice
# Verify changes introduced by the latest HEAD commit
patchproof verify --head
# Print high-density AI diagnostic prompt if regressions occur
patchproof verify --git --ai-feedback
# Generate a visual HTML report, Proof-of-Patch certificate, and SVG badge
patchproof verify changes.patch --html report.html --cert cert.json --badge badge.svg
2. Autonomous Patch Self-Healing
# Automatically verify and repair uncommitted Git regressions
patchproof heal --git --max-iterations 3
# Heal a patch file
patchproof heal changes.patch
3. Validate Cryptographic Proof Certificates
# Validate that a Proof-of-Patch certificate is authentic and untampered
patchproof verify-cert cert.json
4. Setup AI Agent Presets
# Initialize configuration for all agents (Aider, Cursor, Claude Code)
patchproof init-agent all
# Or initialize a specific agent
patchproof init-agent cursor
patchproof init-agent aider
patchproof init-agent claude
5. Diagnostics & Runner Setup
# Check host Docker daemon, Linux container mode, and environment readiness
patchproof doctor
# Automatically remediate repairable environment issues (e.g. build missing runner)
patchproof doctor --fix
# Build standard local Docker runner image
patchproof setup-runner
# Build tailored runner pre-caching repository dependencies (sub-second zero-network tests)
patchproof setup-runner --from-repo .
# Install Git pre-commit verification hook
patchproof install-hooks
GitHub Action Integration
Add PatchProof verification, predictive test slicing, and Anti-Cheat PR gating to your repository in 3 lines:
name: PatchProof Verification
on: [pull_request, push]
jobs:
verify:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: ArnavSingha/Patchproof@main
with:
slice: true
anti_cheat: true
comment_pr: true
When triggered on a pull request, PatchProof automatically posts a rich, interactive Proof Card comment, updates $GITHUB_STEP_SUMMARY, and fails-closed if any test was weakened, deleted, or regressed.
MCP Server Integration
PatchProof includes a built-in MCP server for AI coding assistants. Configure your MCP client:
{
"mcpServers": {
"patchproof": {
"command": "patchproof",
"args": ["mcp"]
}
}
}
Or run patchproof init-agent cursor to automatically configure your .cursor/mcp.json.
Development & Testing
# Run unit and integration tests (385+ tests)
pytest
# Code formatting and linting
ruff check .
# Strict static type verification
mypy --strict src/ tests/
License
This project is licensed under the Apache License 2.0. See the LICENSE file for details.
Metadata
Release files for patchproof-core 0.3.1
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 |
|---|---|---|---|---|
| patchproof_core-0.3.1.tar.gz | 100.1 kB | With provenance | Details for patchproof_core-0.3.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| patchproof_core-0.3.1-py3-none-any.whl | Python 3 | none | any | Details for patchproof_core-0.3.1-py3-none-any.whl |
Total release size: 215.5 kB
Release files / patchproof_core-0.3.1.tar.gz
| Download URL | patchproof_core-0.3.1.tar.gz |
|---|---|
| Size | 100.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
3d1885fe889fa790d8ae247ab0a44319f50c844d47b2857014f9f73ab65bbf88
|
|
BLAKE2b-256 checksum How to use checksums |
2b088a622806e05a599cc071f9121e2910ae5a6ad788abb0cfc51bc2103a6687
|
| 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 Dec 1, 2026.
Transparency logRelease files / patchproof_core-0.3.1-py3-none-any.whl
| Download URL | patchproof_core-0.3.1-py3-none-any.whl |
|---|---|
| Size | 115.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
97e4a127f7394b74e4e559897538d036043be6d6478dee08a69c5631612f32e4
|
|
BLAKE2b-256 checksum How to use checksums |
5ede7e643ae43ecdd2184deafa6a0209db57998e771e22e6de454dc522230173
|
| 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 Dec 1, 2026.
Transparency logSecurity for patchproof-core 0.3.1
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 patchproof_core-0.3.1.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 Dec 1, 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.