# Ratchet: turn CLAUDE.md and AGENTS.md rules into hooks

> Ratchet is a free tool, released November 28, 2026, that turns the rules in CLAUDE.md and AGENTS.md into hooks that block a coding agent's command before it runs. Nine agents supported.

- Published: 2026-11-30
- Publisher: Rig Labs (https://riglabs.ai/)
- Canonical: https://riglabs.ai/blog/ratchet-agents-md-rules-hooks/
- Answers: Ratchet AGENTS.md hooks
- Agent file (a short card for your agent): https://riglabs.ai/blog/ratchet-agents-md-rules-hooks/AGENT.md

---

Ratchet is a free, open-source tool, published on November 28, 2026 by a developer who goes by thecsguy on GitHub (itsthecsguy), that turns the rules you wrote in `CLAUDE.md` and `AGENTS.md` into hooks: small checks that stop a coding agent's command before it runs. What you can do with it: a rule such as "always use pnpm" stops being a request the agent may forget, and becomes a block that tells the agent what to run instead.

## What does Ratchet do?

Ratchet does two jobs on the rule files a coding agent reads (`CLAUDE.md`, `AGENTS.md` and `SKILL.md`), according to [its README](https://github.com/itsthecsguy/ratchet):

- **Check.** `ratchet lint` lists the sentences that nothing enforces, the paths and scripts that no longer exist, broken links, and rules that contradict each other or your lockfile.
- **Enforce.** `ratchet setup` writes the rules it can enforce to `.ratchet/checks.yaml` and installs a hook in your agent. The hook reads each shell command and file write before the agent makes it. A blocked call comes back with the rule, a quote from your file and a `fix:` command, so the agent corrects itself.

The hook uses no AI model when it checks a call. The README says the hook takes about 1.8 ms to check one call, and that Ratchet needs no API key. Ratchet is one Rust program of about 5 MB, under the MIT licence, at version 0.1.1 since November 29.

## Which coding agents does Ratchet work with?

Ratchet works with nine coding agents, per the README: Claude Code, Antigravity, Codex CLI, Cursor, Gemini CLI, Amp, GitHub Copilot CLI, OpenCode and Windsurf. It writes each agent's own hook file, for example `.claude/settings.local.json` for Claude Code. `ratchet uninstall` removes the files it created.

## How strict is a Ratchet rule?

A Ratchet rule has one of four levels, and the README says `ratchet setup` picks the strictest unless you choose another:

| Level | What happens |
|---|---|
| `shadow` | Logs the hit and blocks nothing |
| `warn` | Shows a warning and blocks nothing |
| `ask` | Opens the agent's own allow or deny prompt (Claude Code and Cursor) |
| `enforce` | Blocks the call and returns the fix. The default |

`ratchet try "npm install lodash"` shows what a rule would do without running the command. `ratchet approve` lets one blocked command through once.

## Does Ratchet stop every mistake?

Ratchet does not stop every mistake, by one independent test. JP Caparas, writing for [Sulat on November 30](https://news.sulat.com/2026/11/30/ratchet-agent-rules/), ran five models through OpenCode with the rule file removed from their view. Without the hook, all five wrote an npm lockfile and a `.env` file. With the hook, none wrote the lockfile and four of five were stopped from writing `.env`.

Among the gaps he reports, the hook did not check writes made through OpenCode's `apply_patch` tool, and a rule on writing a file did not see a shell redirect to that file. It also blocked too much: an npm rule stopped read-only npm commands. He also notes that with the rule file still in view, the model followed the rule and the hook never fired. He ran each case once and calls it a smoke test.

Ratchet is two days old, mostly from one developer, with 166 stars on GitHub when we read it. Read what it writes before you let it block anything.

## What to do today

Run the read-only check on one project and see which of your rules nothing enforces. The README's install from source needs Rust 1.82 or later:

```bash
cargo install --git https://github.com/itsthecsguy/ratchet --locked ratchet-cli
ratchet lint
```

`ratchet lint` changes no file. If the list is useful, start with `ratchet setup --level shadow`, which logs hits without blocking, and read the log before you raise the level.

Last checked 2026-11-30.

Sources:
- [GitHub: itsthecsguy/ratchet, README and releases (v0.1.1, 2026-11-29)](https://github.com/itsthecsguy/ratchet)
- [Sulat: "Ratchet turns AGENTS.md rules into enforced hooks", JP Caparas, 2026-11-30](https://news.sulat.com/2026/11/30/ratchet-agent-rules/)
