Skip to main content
Chock logo: a wheel held by a chock wedge

Chock

Governance-as-code for AI coding agents. Write a rule once — every agent obeys it.

Your repo's rules become deterministic guardrails — for a team's private codebase or a public open-source project — compiled to git hooks, CI gates, native pre-execution hooks in Claude Code and Cursor, and AGENTS.md — read by Copilot, Codex, Gemini, Aider and seven more. Not prose an agent can ignore. Exit codes.

CI License: Apache 2.0 Python 3.11+ PRs Welcome PyPI OpenSSF Scorecard OpenSSF Best Practices

Quick start · How it works · Policy catalog · Docs · Roadmap

Terminal demo: chock init, chock add protect-main-branch, chock sync — then a commit straight to main is blocked, and a feature-branch commit passes

A real session, replayed. Install, adopt one policy, and the next commit straight to main exits non-zero — no matter which agent, or which human, typed it.

Why

Your team runs five AI coding agents — and if your repo is open source, contributors bring agents you never chose. Each has its own config file and its own idea of "the rules." You write "don't force-push to main" into a CLAUDE.md, a .cursorrules and a copilot-instructions.md — and an agent does it anyway, because prose is a suggestion, not a control. Chock is the control: author a policy once, and a compiler emits the strongest enforcement each agent actually supports, plus a coverage report that tells you — honestly — where a guarantee holds and where it is only advice.

Chock (rhymes with "block"): the wedge set against a wheel so it cannot roll until someone deliberately removes it.

For open-source maintainers

AI broke the oldest balance in open source: contribution volume now scales with compute, while review capacity still scales with maintainer hours. A contributor with an agent can open ten large PRs in a weekend; you are still one human reading diffs. And you get no say in which agent they bring — Claude Code today, Cursor tomorrow, something new next month.

What you do control is the repo itself, and Chock policies are committed content, so your rules travel with every clone and fork — the maintainer governs the contributor's agent, not just the contributor:

  • Every contributor's agent reads your rules with zero setup. The compiled AGENTS.md and per-agent adapter files are in the tree; agents pick them up ambiently the moment the repo is cloned.
  • The repo re-arms itself. Git never clones hooks, so Chock has the agent close the gap: an ambient rule tells every agent to run chock sync --repo . before its first commit, and for Claude Code a committed SessionStart hook arms the git hooks automatically when a session opens — consented through the workspace-trust prompt. The blocked commit happens on the contributor's machine, before the pull request, instead of in your review queue. How arming works.
  • The CI gate is yours and depends on nothing the contributor does. chock sync --ci wires a commit-range gate into your pipeline, so a policy skipped or bypassed locally is still enforced on the PR.

Today the alternative is reviewing agent-written contributions with another agent, or by hand — triage after the code already exists. With Chock the rules reach the contributor's agent before the code is written, and what still arrives has already passed your gates: review the policy once, instead of every PR.

Highlights

  • ✍️ Author once, enforce everywhere — one policy → git hook + CI gate + native pre-execution hooks (Claude Code and Cursor) + AGENTS.md, across 13 agents. One chock sync wires all of it; the CI gate is opt-in (chock sync --ci) and coverage only credits any surface once it is wired up.
  • 🛡️ Real guardrails, one command awaychock add protect-main-branch pulls from the catalog: scan-secrets, block-destructive-commands, block-no-verify, an OWASP agentic-security pack, and more. Installed content is yours to edit — nothing upstream overwrites it.
  • ⚙️ Deterministic, not vibes — gates are declarative and run through a stdlib-only vendored runner; guard scripts are plain bash. No LLM calls, no network.
  • ✅ Trust, but verify — a validation engine, a hash-pinned chock.lock, and an eval suite (with adversarial cases) replayed against every policy's own mechanism on each build.
  • 📊 Coverage you can prove — a per-agent report grading every policy enforced / enforced-at-commit / advisory, so nobody believes the tooling does more than it does.
  • 📦 Speaks the open packaging standardchock plugin build emits Agent Plugins 1.0.0 packages any conformant client can read. What that badge does and does not mean.
  • 🧩 One CLI, eight verbsinit · add · remove · sync · check · status · enable · disable. If you've used uv or poetry, you already know them.

🚀 Quick start

Requires: Python 3.11+ and git; installed git hooks need bash at runtime. Pre-1.0: the CLI surface, manifest schema and compiled output can change between MINOR releases; PATCH releases never change compiled output (see compatibility).

pip install chock

cd /path/to/your/project
chock init .                     # wiring + authoring skills — no policies, no opinions

chock add protect-main-branch    # adopt a guardrail from the catalog
chock sync --repo .              # compile + install it

Now watch it enforce:

git checkout main
echo "oops" > hotfix.txt && git add hotfix.txt
git commit -m "quick fix straight to main"
# ❌ Direct commits/pushes to a protected branch (main|master) are blocked.
#    Create a feature branch and open a pull request.
#      - main

git checkout -b feature/x
git commit -m "on a feature branch"   # ✅ allowed

That branch list is resolved from the gate, not hard-coded: point chock.defaults.protected_branches at [main, master, release/*] and the message says so.

init deliberately installs no policies — the framework ships mechanism; policies are content you choose, and once installed they are yours to edit. That is what makes customisation possible at all. New here? Follow the Getting Started guide.

chock not found? Your Python scripts dir may not be on PATH. Use python -m chock … — it works regardless of PATH.

🔭 How it works

Author a policy once, compile it, and enforce it on every agent's native surface.

You author a policy once. The compiler emits the strongest control each agent supports and reports the exact coverage — enforced, enforced-at-commit, or advisory — so you always know where a guarantee holds. Read the full architecture overview.

✍️ Author your own policy

A policy is a small, reviewable manifest — the hook.gate block is what enforces, and a blocking hook with no gate fails validation:

# .agents/policies/block-console-log/manifest.yaml
id: block-console-log
name: "No console.log in committed code"
artifact: hook
enforcement: block
effects: [read_only]
description: >
  Block staged JS/TS changes that add console.log — keep debug noise out of main.
hook:
  gate:
    kind: content_regex
    "on": [commit]
    action: block
    message: "console.log added -- remove debug output before committing."
    params:
      content_pattern: "console\\.log"
chock new policy block-console-log   # scaffold (manifest + gate + evals)
chock check                          # validate every artifact against the spec
chock compile block-console-log      # emit every surface + the coverage report

Chock is a craft and enforcement framework first, and a security framework second — the framework ships mechanism, and chock compliance report scores whatever your repo actually installs against four builtin control sets — owasp_asi, mitre_atlas (every technique, from MITRE's machine-readable dataset), nist_ai_rmf (all 72 subcategories), and eu_ai_act (the technical-obligation articles) — printing every uncovered row. The catalog carries the policies — including a pack covering every control in the OWASP Top 10 for Agentic Applications — and its README carries the coverage table with its exact partial/full honesty.

📚 Documentation

Full developer documentation lives in docs/ — start with Getting Started, then: Architecture · Core Concepts · CLI Reference · Authoring Policies · Enforcement Surfaces · Validation · Registry & Lockfile · Evals · Policies · Adapters

🗺️ Roadmap

We're building in the open. Next up:

  • chock add <id> — install a policy or skill from any catalog, public or private.
  • CI backstopchock sync --ci plus a commit-range gate mode, so a hook skipped with --no-verify is still caught on a pull request.
  • Publish — PyPI package and signed standalone binaries.
  • Upgradeschock upgrade, three-way merge against a pinned chock.lock.
  • Supply-chain & MCP packs — block hallucinated ("slopsquatted") dependencies and un-approved MCP tools.
  • Cost & autonomy governance — token/spend circuit-breakers and human-in-the-loop approval tiers.
  • Compliance attestationchock attest mapping controls to NIST AI RMF, ISO 42001 & the EU AI Act.

🤝 Contributing

We'd love your help — code and non-code contributions alike. Docs fixes, bug reports and new policy ideas are all first-class. Start with the Contributing Guide and the good first issue label.

Browsing the file tree? The adapter dot-directories (.cursor/, .gemini/, …) and root stub files are the product working — this repo governs itself with the same wiring it generates for adopters.

⭐ Star history

If Chock saves you from one bad --force push, drop a star — it's the single biggest signal that helps other teams find the project.

📄 License

Apache-2.0 — see LICENSE. Built by and for teams shipping with AI agents.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

chock-0.1.1.tar.gz (348.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

chock-0.1.1-py3-none-any.whl (289.2 kB view details)

Uploaded Python 3

File details

Details for the file chock-0.1.1.tar.gz.

File metadata

  • Download URL: chock-0.1.1.tar.gz
  • Upload date:
  • Size: 348.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for chock-0.1.1.tar.gz
Algorithm Hash digest
SHA256 3d7a2dd0bcfc434be343a17fba90f3fc13e10efa0ed0c649ec9291a0495a1835
MD5 c1336b4bb77ce8b614b9e81fc1f7d69f
BLAKE2b-256 9e2828ca6a85cc92f48b4ead32b5edc1e91fc84ca6b6a43b61a3cb3e340cf946

See more details on using hashes here.

Provenance

The following attestation bundles were made for chock-0.1.1.tar.gz:

Publisher: release.yml on open-coder-ai/chock

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file chock-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: chock-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 289.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for chock-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 9656cb3f757eb1c14db4186c4858226c004a5040ef744fc0a9faf8c32cb91f6d
MD5 ad6d66755e8c664df97913de9cce6d61
BLAKE2b-256 02c5438c3f451ace18af022c4d49244e92891dc0bcf9c09361ffe953409bc94c

See more details on using hashes here.

Provenance

The following attestation bundles were made for chock-0.1.1-py3-none-any.whl:

Publisher: release.yml on open-coder-ai/chock

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 files

0.1.0

2 files

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page