Skip to main content

Covenant: rules for coding agents that actually hold

PyPI version Python versions Tests MIT license

Quick start  ·  How it works  ·  Rules  ·  Docs  ·  Changelog


You tell an agent "don't change public APIs, don't delete user data, run tests before committing." It usually listens. Covenant makes sure it does.

It checks outcomes, not tool calls: the API surface after the edits, what happened to protected files however they were touched, and the order of events (tests passed after the last edit, before the commit).

Animated illustration: an agent tries a force push, destructive SQL and an untested commit; Covenant refuses each, then allows the commit once the tests pass

Quick start

pipx install covenant-agents        # or: pip install covenant-agents
cd your-repo
covenant compile "Don't change public APIs, don't delete user data, run tests before committing."
covenant init        # installs git + Claude Code hooks and starts enforcing

That's it. Works on Windows, macOS and Linux with Python 3.11+. The getting started guide walks through what happens next.

💡 Tip: start from a ready-made rule set with covenant compile --pack hotfix "fix the login crash" (covenant packs lists them), or let covenant suggest propose rules from what went wrong in your repo's own history.

How it works

You write rules in plain English; covenant compile grounds them in the repo and binds each to a checker in covenant.yaml; they are enforced while the agent works, at commit and push, and on every pull request

When something breaks a rule, the agent gets the rule, the evidence and a fix, and you can ask for the story any time:

$ covenant explain
At 01:23 on 01 Nov, the agent tried to use a tool. Covenant blocked it.

Rule C3: "never run destructive SQL"
  Why: The command counts as SQL that drops a table, database or schema: psql -c "DROP TABLE users".
  What the agent can do: Don't drop, truncate or wipe tables; change rows with a WHERE, or ask the human

Checks outcomes, not tool calls. Refuses risky commands before they run. Undo with restore points. Explains every block. Works with every agent. CI rules a pull request can't weaken.

What it can enforce

Say it in plain English; Covenant picks the checker.

You say Covenant checks
"don't change public APIs" Exported names and signatures in Python, TypeScript, Go, Rust and Java
"don't delete user data", "don't touch config/" Protected files and SQLite rows, put back from a snapshot if lost
"no destructive migrations" No dropped tables or columns, truncation or type changes
"only update requests", "no new dependencies" Only allowed packages change, majors stay put
"only change files in src/" The change stays inside the folders you name
"don't commit secrets", "don't skip tests" Keys, tokens and .env files; deleted, skipped or .only tests
"keep the change under 200 lines" Files and lines changed
"no debug prints", "don't silence type errors" Leftover breakpoints and logs; new noqa, @ts-ignore and friends
"run tests before committing", "push at most once" The order and count of the agent's steps
"never force push", "don't deploy", "never run destructive SQL" Refused before they run (16 categories)
"only reach pypi.org and github.com" A network allowlist for commands, git remotes, installs and fetches
"only the payments agent may edit billing/" Folder ownership between agents
"stop after 20 minutes", "spend at most $2" Time, action and cost budgets

Every checker, phrase and rule pack →

Works with

🤖 Claude Code

Hooks on every tool call. Refuses bad actions, records test runs, and won't let Claude finish while a rule is broken.

🧩 Cursor, Codex, any MCP client

An MCP server with the rules, a preflight check and a test runner. Git hooks enforce commits and pushes.

🌿 Git

Pre-commit and pre-push hooks that check every commit and push, from any agent or a human.

✅ GitHub

An Action that judges each PR by its base commit's rules and comments on the exact lines.

🧑‍💻 VS Code

A rules panel, violations in Problems, and a 🔒 badge on every protected file.

🐳 Docker

covenant sandbox runs the agent behind an allowlist proxy, with Covenant's state out of reach.

Set up each agent →   CI and the GitHub Action →

Tried on real repos

Violations per task fell from 1.17 to 0 on CovenantBench; task success stayed at 100%; 1,446 real commits from 50 repos checked, 72 of 75 flags were real rule breaks; about 0.2 seconds per agent action

Claude Code ran live under Covenant on TinyDB, itsdangerous, humanize and prettytable, each with an honest task and a trap task. Every honest task committed; every trap was refused or blocked.

Covenant also replayed 1,446 real commits from 50 popular repositories (Python, TypeScript, Go, Rust and Java) through its CI check. It flagged 75; on review, 72 were real breaks of the rules (removed APIs, new dependencies, deleted tests) and 2 were false alarms.

Benchmark and trial notes →

Also included

Feature What it does
↩️ Undo Restore points before risky steps; covenant undo puts the working tree back
💬 Explain covenant explain says what was blocked, why, and what you and the agent can do
🔔 Alerts Slack, a webhook or email when an agent needs a human
📊 Dashboard Every repo's rules, a timeline of blocks, a rule editor, and a step-by-step replay of any task
👥 Team policies Shared rules from a file or an https address, optionally pinned by sha256

Dashboard, undo, alerts and policies →

Documentation

Page What's in it
🚀 Getting started Install, first rules, what happens when one breaks, changing rules, removing Covenant
📏 Rules All 19 checkers, what the compiler understands, refused commands, rule packs, step rules
📄 The rules file covenant.yaml field by field, with every checker's settings
🤖 Agents Claude Code, Cursor, Codex, any agent, git hooks, the hook server, the sandbox, VS Code
✅ CI The GitHub Action, covenant ci on any CI, how a pull request is judged
🧰 Tools Dashboard and replay, undo, explain, alerts, suggest, team policies
⌨️ Commands Every command and flag, exit codes, environment variables, files
🛡️ Safety model What Covenant protects against, its limits, what isn't built yet
❓ FAQ Common questions and fixes for common problems

Contributing

Bug reports, new checkers and benchmark tasks are welcome. See CONTRIBUTING.md, and SECURITY.md to report a way around Covenant privately.


Covenant logo
Made for agents that mean well. Released under the MIT License.

Metadata

Release files for covenant-agents 0.1.2

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

Source distribution (sdist)

Source distribution for covenant-agents 0.1.2
File Size Uploaded Provenance Actions
covenant_agents-0.1.2.tar.gz 215.7 kB With provenance Details for covenant_agents-0.1.2.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for covenant-agents 0.1.2
File Interpreter ABI Platform Actions
covenant_agents-0.1.2-py3-none-any.whl Python 3 none any Details for covenant_agents-0.1.2-py3-none-any.whl

Total release size: 408.3 kB

Release files / covenant_agents-0.1.2.tar.gz

Download URL covenant_agents-0.1.2.tar.gz
Size 215.7 kB
Tags Source
SHA-256 checksum
How to use checksums
0b30d4b5d3fed6ec78ec5d3112b700567f403ac8a30734b3c9a35995ba99ad91
BLAKE2b-256 checksum
How to use checksums
ba4b5e6838b867dbf59953515d44459e85986ee2a936695b1c92f096ea491da5
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 2, 2026.

Transparency log

Release files / covenant_agents-0.1.2-py3-none-any.whl

Download URL covenant_agents-0.1.2-py3-none-any.whl
Size 192.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ce11c61ab8be9b8a50c6f67792ee233a03b96a03b75d1674a13e96f7501d67d7
BLAKE2b-256 checksum
How to use checksums
d37385fb049f2c8c2ea317658b9c8621ae28c6496fd65db272e58cb8af032242
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 2, 2026.

Transparency log

Security for covenant-agents 0.1.2

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 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for covenant_agents-0.1.2.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 2, 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.

Release history Release notifications | RSS feed

This release

0.1.2 This release

2 release files Full provenance

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