ratchet
A Claude Code plugin that turns your working rules into things the agent cannot skip: a
guardrail runs before every tool call, work lives on a task board with checklists and
mandatory handoffs, and agent roles are kept separate (spec-test author, implementer,
reviewer). Everything is enforced by hooks and one small binary, not by prompt text.
What it does
- Guardrails before every tool call. Four built-in rules (Python outside the venv,
destructive git,
.env files, writes to the main tree) plus your own, per machine or per
repo. A blocked call gets a one-line reason and the alternative.
- A task board that cannot be faked. Tasks with acceptance checklists; progress is
derived from the checklist, never declared. Every change is an append-only event.
- Mandatory handoffs. A session that tries to close while holding a task with nothing
recorded is asked, once, to write what is left.
- Session registry. Every Claude Code session is registered by the hooks; when one dies,
its tasks go back to the queue on their own.
- A briefing at session start. Repo, branch, your tasks in progress with their last
handoff, orphaned tasks, and up to five ready to take. One line per prompt after that.
- Local PDF extraction (
ratchet pdf) through the liteparse CLI, with automatic OCR
retry and output kept out of the terminal.
- A context meter. In a repo that opted in, the status line shows how full the main context
window is, a toast fires at 70% and 85%, and
/ctx opens a pane with the breakdown by
category and every subagent's window, the main window's trend with a forecast of the turns
left before auto-compaction, the heaviest tool results, and the held task's tokens by role. It
is a function-hook module: it needs a Claude Code with function-hook modules and is tested
against 2.1.288.
- Agent roles, skills and commands. Seven agent profiles, the
ratchet-tasks and
ratchet-pdf skills, the /opsx:* OpenSpec commands, /ratchet:init and /ratchet:map.
Cost of the hot path: the guardrail hook does 11-13 ms of its own work per tool call (see
Latency at the end).
Quick install
claude plugin marketplace add EduardoIllanes/ratchet
claude plugin install ratchet@ratchet
That is all. The first time a hook runs it downloads the prebuilt ratchet binary for your
platform (macOS arm64/x64, Linux x64, Windows x64) from the release pinned in
.claude-plugin/binary-version, verifies its SHA-256 against the release's SHA256SUMS.txt,
and puts it in the plugin's bin/. No Rust, no PATH changes, nothing installed anywhere else.
The plugin manifest carries no version on purpose: Claude Code tracks the marketplace commit,
so claude plugin update ratchet@ratchet picks up every change to agents, skills and hooks
without waiting for a binary release. Each update lands in a fresh plugin dir, and the first
hook there downloads the pinned binary again (a few MB). A new binary ships as a tagged release
that bumps Cargo.toml and binary-version together.
Then opt a repo in. Open a Claude Code session at its root and run:
/ratchet:init
ratchet is not on your shell's PATH: the binary lives only in the plugin's bin/, and Claude
Code adds that directory to the PATH of its own sessions. So every ratchet ... command in this
README runs inside a session, either through the ! prefix (! ratchet task list) or by
letting the agent run it. To use it from a terminal, put that bin/ on your PATH or link the
binary, for example ln -s "<plugin dir>/bin/ratchet" ~/.local/bin/ratchet; the link breaks
on every plugin update, because the plugin dir is named after the marketplace commit.
If the download cannot happen (offline, unsupported platform, checksum mismatch), the hook
prints one line and exits 0; the session is not affected, and the hooks stay quiet for an hour
before retrying. To retry now: bash <plugin dir>/hooks/bootstrap.sh. To install by hand:
download the asset for your platform from https://github.com/EduardoIllanes/ratchet/releases,
verify it against SHA256SUMS.txt, and unpack the single file it contains into
<plugin dir>/bin/; or export RATCHET_BIN=<path to a binary you built>, which the hooks check
first. The plugin dir is the installPath for ratchet@ratchet in
~/.claude/plugins/installed_plugins.json.
Quick tour
Real output from a throwaway repo, run from inside a Claude Code session (! prefix). Opt it in:
$ ratchet config init
wrote /tmp/demo/ratchet.toml
Ask the guardrails what they would do with a tool call (the repo has a .venv; exit code 2
means blocked, which is what the hook returns to Claude Code):