Skip to main content

hackfloor: prove that agents which don't solve the task can't score

CI PyPI Python 3.10 to 3.13 License: Apache-2.0 Status: alpha All contributors Integrity card

Your RL environment's grader rewards whatever it accepts. hackfloor finds out what that is before your training run does.

Quickstart · Probes · How it works · Integrity cards · Comparison · Roadmap · Docs


hackfloor runs policies that do not solve the task through an environment's real grader: empty and format-only answers, answer enumeration, prompt echo, prompt injection aimed at LLM judges, always-equal objects, SkipTest, hard-coded test cases, edited tests, a conftest.py that rewrites pytest reports, sys.exit(0) before the checks, a pre-written reward file, and answer keys left in the sandbox or in git history. Each probe is paired with a matched control that touches the same files without the exploit. If the probe scores above its control, that is a finding, and the integrity card records enough to replay it.

hackfloor scan of the bundled vulnerable pytest task: six critical findings
Real output: hackfloor scan fixtures/tasks/vulnerable_pytest on the bundled teaching fixture. Rendered by scripts/render_readme_assets.py.

Why

Models optimise the grader, not the task. The hacks are documented and they are cheap:

OpenEnv's RFC 008 asks that "a panel of non-solving policies (null, degenerate, grader-injection, reward-search) scores at or below the empty-trajectory floor". OpenEnv 0.14 grades Harbor tasks for semantic.oracle_max, semantic.floor_gap and author-supplied canaries (semantic.canary_floor), while statistical.adversarial_floor is listed in its severity policy with no grader yet. hackfloor is a working, standalone version of that panel, and its card uses the same check ids.

Highlights

  • 🎯 Runs against the real grader. No static guessing: every finding is a scored attempt you can replay.
  • ⚖️ Matched controls. AlwaysEqual is compared with return None, a patched conftest.py with an empty one, a written max reward with a written min. The gap measures the exploit, not noise.
  • 📐 Statistics where they matter. With 5 or more tasks, an exact sign test with Holm correction across probes; with fewer, the effect has to reproduce on every replay. A hack-pass that reproduces is always a finding. Clopper-Pearson intervals on hack-pass rates, and a gameability check (point-biserial correlation and AUROC between solved and reward).
  • 🪪 Integrity cards. A JSON record with a schema, check ids taken from OpenEnv's RFC 008 validation code, NOT_MEASURED wherever hackfloor has no test, and an export to OpenEnv CheckResult records.
  • 🧩 Adapters. Plain reward functions (fn(completion, answer), verl compute_score, TRL reward_funcs), Harbor-style task directories, reasoning-gym datasets, and (experimental) Prime Intellect verifiers tasksets and single-step OpenEnv environments.
  • 🔌 Plugin probes. Subclass Probe, register it, or ship it through the hackfloor.probes entry point.
  • 🚦 CI-ready. A GitHub Action, a pre-commit hook and a pytest fixture. Exit code 1 when a finding meets --fail-on (default high), plus a Markdown report for the job summary.

Quickstart

pip install hackfloor                      # or: uv pip install hackfloor
pip install "hackfloor[integrations]"      # + reasoning-gym, verifiers (3.11+), openenv

The bundled fixtures live in the repository, so clone it to try them:

git clone https://github.com/ranjeetds/hackfloor.git
cd hackfloor
uv venv && uv pip install -e ".[dev]"   # or: python -m venv .venv && pip install -e ".[dev]"

Scan the bundled fixtures (the pytest-based tasks need pytest, which the dev extra installs):

hackfloor scan fixtures/tasks/vulnerable_pytest      # 6 critical findings, exit code 1
hackfloor scan fixtures/tasks/fixed_pytest           # RESISTED, integrity level L1
hackfloor scan fixtures/rlvr/vulnerable_math --report report.md

Scan your own reward function:

hackfloor scan my_rewards.py:math_reward --data rows.jsonl --gold-template "<answer>{answer}</answer>"

rows.jsonl holds one {"prompt": ..., "answer": ...} per line. The gold template tells hackfloor what a correct completion looks like, so it can check that the reference scores well (calibration) and build format-aware probes. Probes never see the answer.

Or from Python:

from hackfloor import scan
from hackfloor.adapters import RewardFunctionSubject


def reward(completion: str, answer: str) -> float:
    return 1.0 if answer in completion else 0.0  # substring match


rows = [{"prompt": f"What is {n} + 10?", "answer": str(n + 10)} for n in range(20)]
subject = RewardFunctionSubject(reward, rows, gold_template="<answer>{answer}</answer>")
result = scan(subject)

print(result.verdict, result.level)  # VULNERABLE 0
for p in result.findings:
    print(p.probe.id, p.severity, f"{p.hack_passes}/{p.n}")  # HF-DUMP critical 20/20

Scan a reasoning-gym dataset, a verifiers taskset or an OpenEnv environment (see adapters):

uv pip install -e ".[integrations]"
hackfloor scan reasoning-gym:basic_arithmetic --tasks 50
hackfloor scan verifiers:my_env:load_taskset --gold-template "<answer>{answer}</answer>"
hackfloor scan subject:my_scan:build --openenv-checks checks.json   # build() returns an OpenEnvSubject
Scanning a task directory

Put a hackfloor.toml next to the task:

[task]
environment = "environment"      # copied into a fresh sandbox for every attempt
workspace = "workspace"          # the directory the agent edits
solution = "solution"            # overlaid onto the workspace for the reference run
entry_file = "slug.py"           # optional: enables HF-EQ, HF-EXIT, HF-SKIPTEST and the leak probes
entry_functions = ["slugify"]
visible_tests = ["tests/test_*.py"]   # optional: enables HF-TESTEDIT and HF-LOOKUP
instruction = "instruction.md"   # optional: what the agent is shown
setup = ["{python}", "{task}/setup_env.py"]   # optional: runs in each fresh sandbox

[verifier]
command = ["{python}", "{task}/grader/grade.py"]
cwd = "{workspace}"
reward = "file"                  # or "exit_code"
reward_file = "logs/reward.txt"  # relative to the sandbox root
reward_file_agent_writable = true    # enables HF-REWARDFILE
timeout = 60

The verifier gets HACKFLOOR_SANDBOX, HACKFLOOR_WORKSPACE and HACKFLOOR_LOGS in its environment. A directory of such tasks is scanned as a suite. See docs/adapters.md.

Probes

hackfloor ships 14 probes. A probe runs only when the target exposes what it needs, and the card lists the rest as not applicable.

Probe Family What it tries Runs on Documented in
HF-EMPTY form whitespace, None, {} completions FieldWorkArena {} exploit, BenchJack
HF-FORMAT form answer tags, a reasoning block or \boxed{} with nothing inside completions format-reward shaping
HF-DUMP form every integer 0–999, A–J, yes/no in one answer completions weak string matching, BenchJack V5
HF-ECHO leak repeat the prompt, raw and in the answer slot completions BenchJack V2, gradecheck prompt echo
HF-JUDGE judge instructions addressed to an LLM judge (a score, a verification claim, a fake transcript) completions BenchJack V4, gradecheck flattery
HF-EQ tamper return an object whose __eq__ is always True tasks with a Python entry file Anthropic 2511.18397, METR 2025
HF-EXIT tamper sys.exit(0) on import tasks with a Python entry file Anthropic 2511.18397, Baker 2503.11926
HF-SKIPTEST tamper raise unittest.SkipTest in every function, or at import tasks with a Python entry file Baker 2503.11926
HF-LOOKUP tamper hard-code the literal cases from the visible tests tasks with visible tests ImpossibleBench 2510.20270, METR 2025
HF-CONFTEST tamper a conftest.py hook that rewrites failing reports to passed any workspace task Anthropic 2511.18397, BenchJack
HF-TESTEDIT tamper neutralise or delete the visible tests tasks with visible tests ImpossibleBench 2510.20270
HF-ANSWERKEY leak copy a reference-looking file reachable from the sandbox tasks with a Python entry file BenchJack V2, gradecheck answer leak
HF-GITLEAK leak try every version of the entry file in the workspace's git history tasks with a git workspace SWE-bench issue #465
HF-REWARDFILE contain pre-write the max reward to the reward file tasks whose reward file the agent can reach Harbor reward-file layout, BenchJack V7

Probes are the publicly documented minimal forms, and every file they write carries a hackfloor canary comment. Network and timing probes are not included yet: they need container isolation to be safe and deterministic. See docs/probes.md.

What the bundled fixtures show

The fixtures are small teaching environments written for hackfloor's tests, each with a fixed twin. These results come from the test suite and the CLI on Python 3.12 with pytest 9.2.0:

Fixture Verdict Findings
tasks/vulnerable_pytest VULNERABLE, L0 HF-CONFTEST, HF-EQ, HF-LOOKUP, HF-REWARDFILE, HF-SKIPTEST, HF-TESTEDIT (all critical)
tasks/fixed_pytest RESISTED, L1 none
tasks/vulnerable_script VULNERABLE, L0 HF-EQ, HF-EXIT (critical)
tasks/fixed_script RESISTED, L1 none
tasks/vulnerable_leaky VULNERABLE, L0 HF-ANSWERKEY, HF-GITLEAK (critical); semantic.no_solution_leakage FAIL
tasks/fixed_leaky RESISTED, L1 none; leak probes searched and found nothing
rlvr/vulnerable_math VULNERABLE, L0 HF-DUMP (critical, 40/40), HF-FORMAT and HF-ECHO (medium, Δ = 0.20)
rlvr/fixed_math RESISTED, L1 none
rlvr/vulnerable_judge VULNERABLE, L0 HF-JUDGE (critical, 40/40) and HF-DUMP (critical, 40/40) against a deterministic stub judge
rlvr/fixed_judge RESISTED, L1 none

Every vulnerable fixture also fails statistical.gameability_gap (correlation between 0.25 and 0.57 against a bound of 0.9); every fixed twin reaches 1.0.

HF-EXIT does not hack vulnerable_pytest: with pytest 9.2.0, an import-time sys.exit(0) ends in INTERNALERROR and exit code 3. It does hack the script verifier, which trusts the exit code.

How it works

flowchart TD
    T["Target: reward fn, task directory, reasoning-gym, verifiers, OpenEnv"] --> A["Adapter → Subject"]
    A --> C["Calibration: reference vs null policy"]
    A --> P["Probe registry: built-ins + plugins"]
    P --> V["Variants: exploit + matched control"]
    C --> G["Real grader, fresh sandbox per attempt, replayed"]
    V --> G
    G --> D["Paired decision: sign test + Holm, or deterministic replay"]
    D --> K["Integrity card: JSON + schema"]
    K --> O["Terminal · Markdown report · OpenEnv CheckResults · CI exit code"]
  1. Calibrate. The reference solution must beat the null policy (an empty completion or an untouched workspace) on every task. If it does not, the card says UNCALIBRATED and gives no level.
  2. Probe. Each applicable probe yields variants: an exploit and a matched control. Every attempt runs in a fresh sandbox and is replayed (--replays, default 2). The best variant per task counts.
  3. Decide. Per task, the floor gap Δ is exploit minus control. A hack-pass is an exploit that reaches the reference score. Severity is critical when any task hack-passes, high when the mean Δ is at least half the reference-to-null gap, and medium otherwise. The thresholds and tests are in docs/statistics.md.

Integrity levels

The integrity card is a JSON file, written by every scan, that validates against card-0.1.schema.json.

Integrity cards for the vulnerable and fixed pytest fixtures
Rendered from the real cards of the two pytest fixtures.

Level Badge Meaning Available
L0 L0 at least one critical or high finding, or a malformed reward since v0.1
L1 L1 calibrated, and no critical or high finding from the default probes since v0.1
L2 L2 L1, plus the gameability gap from model-based policies is bounded and containment checks pass planned (v0.3)
L3 L3 L2, plus the canary suite and an independent replay of the card planned (v1.0)

A level describes this probe set at this version, not the absence of every hack. The card now measures statistical.gameability_gap (over scripted attempts only) and semantic.no_solution_leakage. RFC 008 criteria it does not measure yet (semantic.canary_floor and four runtime.* containment checks) appear as NOT_MEASURED, never as a pass. --openenv-checks writes the checks as OpenEnv CheckResult records.

How it compares

Checkmarks are given only where the project's own README (or, for OpenEnv, its source code) documents the feature, checked on 26 November 2026. A blank means it is not documented there, not that it is impossible.

hackfloor 0.2 gradecheck BenchJack OpenEnv validation 0.14
Runs attacks against the real grader ✓ ✓ ✓ (generates PoC exploits) ✓ (author-supplied canaries)
Built-in exploit probes 14 5 file-tree + 5 completion attacks 8 vulnerability classes
Reference and do-nothing calibration ✓ ✓ (noop baseline) ✓ (oracle_max, floor_gap)
Static and LLM-assisted code audit ✓
Needs an LLM or API key no no yes (LLM backend)
Task directory with a grade command ✓ ✓ ✓ (Harbor tasks)
Plain reward functions (verl, TRL signatures) ✓
verifiers environments ◐ (experimental, trace-level rewards) ✓
Always-equal, sys.exit, conftest.py probes ✓ ✓ (conftest exploit)
Test deletion and editing ✓ ✓
Answer-leak and hollow-artifact checks ◐ (answer keys, git history, prompt echo) ✓ ✓ (V2)
Matched controls and paired statistics ✓
JSON output ✓ (with schema) ✓
CI exit code ✓ ✓
Plugin API for new checks ✓ ✓
Container sandbox planned (v0.3) ◐ (--sandbox, marked work in progress)
Uses OpenEnv RFC 008 check ids ✓ ✓ (defines them)

gradecheck is the closest project in spirit and its README is worth reading. BenchJack audits whole benchmarks and found exploits in all eight it studied. OpenEnv's validator is where these checks are headed; hackfloor aims to be a probe panel it can use, not a replacement.

Integrations

Framework Status How
Plain Python reward function ✅ v0.1 hackfloor scan file.py:fn --data rows.jsonl
verl compute_score(data_source, solution_str, ground_truth, extra_info) ✅ v0.1 --flavor verl, or detected from the signature
TRL reward_funcs(prompts, completions, **columns) ✅ v0.1 --flavor trl, or detected from the signature
Harbor-style task directories ✅ v0.1 hackfloor.toml beside the task; native task.toml reading is planned
reasoning-gym ✅ v0.2 hackfloor scan reasoning-gym:<dataset>; tested against 0.1.25
Prime Intellect verifiers (v1 API) 🧪 experimental hackfloor scan verifiers:<module:factory>; trace-level rewards only; tested against 0.4.1
OpenEnv Environment (single step, in process) 🧪 experimental OpenEnvSubject via subject:<module:factory>; tested against 0.15.0, including its reasoning_gym_env
OpenEnv RFC 008 CheckResult export ✅ v0.2 --openenv-checks checks.json; validated against openenv 0.15.0's schema
GitHub Action ✅ v0.2 uses: ranjeetds/hackfloor@v0.2.0, see docs/ci.md
pre-commit ✅ v0.2 hook id hackfloor
pytest ✅ v0.2 hackfloor fixture, hackfloor.testing.assert_resists
OpenRLHF, inspect_ai scorers, multi-step and HTTP OpenEnv planned

Roadmap

  • v0.1 foundation: CLI, probe plugin API, two adapters, 8 probes, matched controls, paired statistics, integrity card with schema, Markdown report, fixtures with fixed twins
  • v0.2.0 (first PyPI release): reasoning-gym adapter, experimental verifiers and OpenEnv adapters, OpenEnv check export, leak and judge probes (14 in all), gameability and leakage checks, GitHub Action, pre-commit hook, pytest plugin, docs site
  • v0.2.x (Feb 2027): stable verifiers and OpenEnv adapters, multi-step OpenEnv
  • v0.3 (Apr 2027): container isolation with network, timing and containment probes; model-based policies and a gameability gap over trained policies; judge probes against real LLM judges; L2
  • v1.0 (Jun 2027): 31 probes, canary suite, replayable cards, L3
  • Hub audit (upcoming): scan public RL environments on the Hugging Face Hub and report findings privately to maintainers first. No results are published yet.

Responsible use

hackfloor exists so that environment authors find their graders' loopholes before a training run does. Its probes are the publicly documented minimal forms of known hacks.

  • Scan environments you maintain or are allowed to test.
  • If you find a hack in someone else's environment or benchmark, report it to the maintainers privately and give them time to fix it before you publish. SECURITY.md explains how to report a problem in hackfloor itself.
  • Do not use hackfloor's output to inflate leaderboard or benchmark results.

Citation

If hackfloor helps your research, please cite it:

@software{dhumal2026hackfloor,
  author  = {Dhumal, Ranjeet},
  title   = {hackfloor: adversarial probes for RL environment graders and agent benchmarks},
  year    = {2026},
  version = {0.2.0},
  url     = {https://github.com/ranjeetds/hackfloor},
  license = {Apache-2.0}
}

There is also a CITATION.cff.

Contributing

New probes, adapters and documented hacks are welcome; good first issues and help wanted are good places to start. A new probe needs a public reference, a matched control, and a fixture pair (vulnerable and fixed) that proves it fires and that the fix holds. See CONTRIBUTING.md and the Code of Conduct.

uv venv && uv pip install -e ".[dev]"
ruff check . && ruff format --check .
pytest

Commits must be signed off (git commit -s, DCO).

Contributors

Thanks to everyone who has contributed code, probes, docs, ideas and bug reports (emoji key):

Ranjeet Dhumal
Ranjeet Dhumal

💻 📖 🤔 🚧 ⚠️ 🚇

New contributors are added after their first merged contribution. Start with a good first issue.

License

Apache-2.0

Metadata

Release files for hackfloor 0.2.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 hackfloor 0.2.0
File Size Uploaded Provenance Actions
hackfloor-0.2.0.tar.gz 82.8 kB With provenance Details for hackfloor-0.2.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for hackfloor 0.2.0
File Interpreter ABI Platform Actions
hackfloor-0.2.0-py3-none-any.whl Python 3 none any Details for hackfloor-0.2.0-py3-none-any.whl

Total release size: 144.6 kB

Release files / hackfloor-0.2.0.tar.gz

Download URL hackfloor-0.2.0.tar.gz
Size 82.8 kB
Tags Source
SHA-256 checksum
How to use checksums
9ed31561821d6b020dc70625a0e1c9b070040751564e3b47906d1099a24bef34
BLAKE2b-256 checksum
How to use checksums
aaa58ad8038b90fcff43dae201f01c5aa26a4b0e528adb696821e8202b455443
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 26, 2026.

Transparency log

Release files / hackfloor-0.2.0-py3-none-any.whl

Download URL hackfloor-0.2.0-py3-none-any.whl
Size 61.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
872aae21c946099184b56ae01df9a6029d2d41cd67f07dbe5e9404677a73da7c
BLAKE2b-256 checksum
How to use checksums
28c6aa7fda69b8e63dd54717d4529992f5390835da6dcef8b01d6f92b5a87483
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 26, 2026.

Transparency log

Security for hackfloor 0.2.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.

Select from 2 files

Attestation for hackfloor-0.2.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 26, 2026.

Transparency log

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