Skip to main content

oncebitten

PyPI npm

oncebitten turns repeated agent mistakes into rules that git enforces. When the same mistake shows up in two sessions, or you state a rule once, it proposes a check. You approve it, and the check then runs at pre-push and in CI.

Caught: a Claude correction, a Codex revert and a failing Cursor test each count as evidence. Rule: oncebitten proposes the strongest rule that fits (a check, then an instruction, then nothing) and you approve it. Enforced: git push, CI and pull requests stop on py-utcnow: use datetime.now(UTC).

Docs: https://bcmyguest.github.io/oncebitten/

Status: pre-alpha. Capture, evidence clustering, check, replay, the gate, steer rules, exceptions, retire, rollback and doctor work; triage is implemented for claude, codex and opencode (docs/triage.md): the claude path runs end to end against real Claude Code sessions (scripts/e2e-live.sh), codex 0.167.2 fails the hooks-off proof and is refused, and opencode has fake-host tests only; triage drafts proposed rules that wait for review in oncebitten proposals (docs/proposals.md) and proposals deliver sends an accepted rule to a pull request.

Install

Pick the host you use; each section is copy-pasteable. The plugins download the release binary on first use and check its SHA-256. For the command line (gate, evidence, check) see Command line.

Claude Code

/plugin marketplace add bcmyguest/oncebitten
/plugin install oncebitten@oncebitten

Codex

codex plugin marketplace add bcmyguest/oncebitten

Then install oncebitten from /plugins.

Copilot CLI

copilot plugin marketplace add bcmyguest/oncebitten
copilot plugin install oncebitten@oncebitten

Cursor

Import https://github.com/bcmyguest/oncebitten as a team marketplace (Dashboard, Settings, Plugins).

pi

pi install git:github.com/bcmyguest/oncebitten

opencode

opencode loads plugins from npm or local files only, so install the command line below, then:

oncebitten hooks install --host opencode --scope user

Do not run hooks install for a host whose plugin is installed: each event would be captured twice.

Command line

Any one of these puts oncebitten and oncebitten-checker on your PATH. None needs a Rust toolchain except the last.

uvx oncebitten --version               # run once, no install (PyPI)
uv tool install oncebitten             # install (PyPI)
npx oncebitten --version               # run once (npm)
npm install -g oncebitten              # install (npm)
curl -fsSL https://raw.githubusercontent.com/bcmyguest/oncebitten/main/install.sh | sh   # macOS, Linux
irm https://raw.githubusercontent.com/bcmyguest/oncebitten/main/install.ps1 | iex        # Windows PowerShell
cargo install --locked --git https://github.com/bcmyguest/oncebitten oncebitten          # from source; needs a C compiler

install.sh and install.ps1 verify the release's SHA-256 before installing. Pinning, mirrors and variables: docs/install.md.

Teams

Pin one version for everyone so the gate behaves the same on every machine and in CI.

# pyproject.toml
[dependency-groups]
dev = ["oncebitten==0.4.0"]
{ "devDependencies": { "oncebitten": "0.4.0" } }
# .pre-commit-config.yaml: prebuilt binary from PyPI, no Rust toolchain
repos:
  - repo: https://github.com/bcmyguest/oncebitten
    rev: v0.4.0
    hooks:
      - id: oncebitten-gate-python

Usage

oncebitten config show            # merged configuration as TOML
oncebitten config show --origin   # annotate each value with its layer
oncebitten config path            # configuration files it reads
oncebitten check                  # run active rules against changes since HEAD
oncebitten replay <rule-id>       # prove a rule in an OpenShell sandbox; writes proof.json
oncebitten gate pr --base origin/main   # CI gate: new violations of active block rules
oncebitten baseline update        # accept today's violations in .oncebitten/baseline.json
oncebitten hooks install --host claude --scope user   # capture and steer hooks; also codex, cursor, copilot, opencode, pi
oncebitten hooks uninstall --host claude --scope user
oncebitten evidence list          # mistake clusters seen in 2+ sessions, or stated once
oncebitten evidence reject <id> --reason "one-off"
oncebitten stats [--since <days>] [--json]   # read-only funnel: signals to clusters to drafts to decisions

Rules: docs/rules.md. Example rules: examples/. Gate, proofs and baseline: docs/gate.md. Agent-facing summary: llms.txt.

Funnel counts per mistake class: docs/stats.md.

Hooks record prompts and tool outcomes locally: docs/capture.md lists what each host reports and how each was verified. docs/evidence.md covers clustering and rejections.

Steer rules cover lessons git cannot see, such as running sudo: they inform or deny the agent at the tool call. docs/steer.md lists what each host supports.

Settings and their precedence: docs/configuration.md.

Gate

# .pre-commit-config.yaml
repos:
  - repo: https://github.com/bcmyguest/oncebitten
    rev: <commit or tag>
    hooks:
      - id: oncebitten-gate-python   # prebuilt wheel; or oncebitten-gate (builds from source), oncebitten-gate-system (installed binary)
pre-commit install --hook-type pre-push
oncebitten rules sync             # writes .oncebitten/rules.lock; commit it

The gate needs pre-commit 3.2.0 or later, prek 0.1.5 or later, or uv's uvx to run either. CI templates for GitHub Actions, GitLab CI and Azure Pipelines: templates/. In CI, run oncebitten rules sync --frozen before the gate.

Development

Build and test with cargo test; CI also runs cargo fmt --check and cargo clippy --all-targets -- -D warnings on Linux, macOS and Windows. The build order and open steps live in PLAN.md.

This repository gates itself with the shipped rust-no-unwrap example, enabled in .oncebitten/config.toml. It has no baseline: the gate fails on any non-test .unwrap() in the crate, and test code is exempt.

License

Apache-2.0. See LICENSE.

Metadata

Release files for oncebitten 0.4.0

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

Built distributions (wheels)

Table of built distributions (wheels) for oncebitten 0.4.0
File Actions
oncebitten-0.4.0-py3-none-win_amd64.whl Python 3 none Windows x86-64 Details for oncebitten-0.4.0-py3-none-win_amd64.whl
oncebitten-0.4.0-py3-none-manylinux2014_x86_64.manylinux_2_17_x86_64.musllinux_1_2_x86_64.whl Python 3 none Linux musl 1.2+ x86-64, Linux glibc 2.17+ x86-64 Details for oncebitten-0.4.0-py3-none-manylinux2014_x86_64.manylinux_2_17_x86_64.musllinux_1_2_x86_64.whl
oncebitten-0.4.0-py3-none-manylinux2014_aarch64.manylinux_2_17_aarch64.musllinux_1_2_aarch64.whl Python 3 none Linux glibc 2.17+ ARM64, Linux musl 1.2+ ARM64 Details for oncebitten-0.4.0-py3-none-manylinux2014_aarch64.manylinux_2_17_aarch64.musllinux_1_2_aarch64.whl
oncebitten-0.4.0-py3-none-macosx_11_0_arm64.whl Python 3 none macOS 11.0+ ARM64 Details for oncebitten-0.4.0-py3-none-macosx_11_0_arm64.whl
oncebitten-0.4.0-py3-none-macosx_10_12_x86_64.whl Python 3 none macOS 10.12+ x86-64 Details for oncebitten-0.4.0-py3-none-macosx_10_12_x86_64.whl

Total release size: 39.8 MB

Release files / oncebitten-0.4.0-py3-none-win_amd64.whl

Download URL oncebitten-0.4.0-py3-none-win_amd64.whl
Size 8.2 MB
Tags Python 3 Windows x86-64
SHA-256 checksum
How to use checksums
5661dfbb5ed583fbe4359c100ae56211b8bd67467ed26a5f1aec1852729f846c
BLAKE2b-256 checksum
How to use checksums
bbec7c5a2427c1ce4a63fe5d4abd7d49fb986925de30d71edfb7770102dcd912
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 18, 2026.

Transparency log

Release files / oncebitten-0.4.0-py3-none-manylinux2014_x86_64.manylinux_2_17_x86_64.musllinux_1_2_x86_64.whl

Download URL oncebitten-0.4.0-py3-none-manylinux2014_x86_64.manylinux_2_17_x86_64.musllinux_1_2_x86_64.whl
Size 8.5 MB
Tags Linux glibc 2.17+ x86-64 Linux musl 1.2+ x86-64 Python 3
SHA-256 checksum
How to use checksums
6ec569429d707af5286946ffebcefec0c941e9587736dd8b27e1ce3205d62328
BLAKE2b-256 checksum
How to use checksums
500f4156acca1de12d15ae77521d7212e371531a99a1afb7cb41476ea9fa151e
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 18, 2026.

Transparency log

Release files / oncebitten-0.4.0-py3-none-manylinux2014_aarch64.manylinux_2_17_aarch64.musllinux_1_2_aarch64.whl

Download URL oncebitten-0.4.0-py3-none-manylinux2014_aarch64.manylinux_2_17_aarch64.musllinux_1_2_aarch64.whl
Size 8.0 MB
Tags Linux glibc 2.17+ ARM64 Linux musl 1.2+ ARM64 Python 3
SHA-256 checksum
How to use checksums
086aa86d6d52e31ee2aa0c31ad47d14a44a4ff46ccc646cf15fade178d1128fd
BLAKE2b-256 checksum
How to use checksums
fb8c50a5e83cfe2453800bb982b2a21a8a59b2838e65462ef833afc4315aee13
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 18, 2026.

Transparency log

Release files / oncebitten-0.4.0-py3-none-macosx_11_0_arm64.whl

Download URL oncebitten-0.4.0-py3-none-macosx_11_0_arm64.whl
Size 7.4 MB
Tags Python 3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
1837eb99a49385d5e8581118de424a1ebe0e45fa2f3260cff2370c40c1196b37
BLAKE2b-256 checksum
How to use checksums
d9d2611cca6c8d3b8a331f5ba0056cf34b763a2e43fb859205f5049de8a0780d
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 18, 2026.

Transparency log

Release files / oncebitten-0.4.0-py3-none-macosx_10_12_x86_64.whl

Download URL oncebitten-0.4.0-py3-none-macosx_10_12_x86_64.whl
Size 7.7 MB
Tags Python 3 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
41d9a6509bb969bef680fc38a8a9191688cedbab68e7c7910d5849cc9443d0c7
BLAKE2b-256 checksum
How to use checksums
e40ef2d700f1fbe6b840fcc762239b0b641057895462cd2944e959dd4b77c0f7
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 18, 2026.

Transparency log

Security for oncebitten 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

All 5 files in this release have been uploaded with provenance metadata.

Select from 5 files

Attestation for oncebitten-0.4.0-py3-none-win_amd64.whl

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 18, 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