Ratchet: A High-Speed Local OSS Tool to Prevent AI Coding Rule Bypasses
Explore Ratchet, a Rust-based open-source tool that intercepts commands just before execution to enforce rules defined in CLAUDE.md or AGENTS.md for AI coding a
When developing software with the help of artificial intelligence coding assistants, one of the most common frustrations is how frequently AI ignores established project rules. Even when developers carefully document coding styles, forbidden commands, or language preferences in markdown files like CLAUDE.md or AGENTS.md in the project root, large language models (LLMs) often skip these guidelines during long conversations or complex tasks, modifying code or executing commands as they please.
To address this issue without relying solely on polite prompt-based instructions, an open-source software (OSS) tool named Ratchet has emerged, providing programmatic and enforced control right before execution.

Image source: MZaplotnik 쨌 CC BY-SA 3.0 쨌 https://creativecommons.org/licenses/by-sa/3.0 쨌 https://commons.wikimedia.org/wiki/File:Shod_za_javno_zdravstvo_SAM_3329.JPG
Ratchet steps in right before an AI coding agent executes system commands, hooking into the process to inspect potential rule violations and block unauthorized actions. We look into the core features and operational mechanics of this tool catching developer attention.
Intercepting Commands Before Execution to Bypass Document Limitations
In conventional AI coding workflows, writing guidelines in configuration files or prompts—such as "never use this specific library" or "always reply in a specific language"—frequently leads to failure as the AI forgets instructions mid-context. For many developers, watching AI slip past these written rules has become an accepted daily annoyance.
To solve this, Ratchet shifts away from passive prompt instructions and adopts an execution-control (hook) architecture. When an AI coding assistant attempts to run a terminal command, Ratchet intercepts it and performs a rigorous programmatic check. When a violation is caught, instead of merely stopping the process, it feeds a correction suggestion back to the AI—such as "use this command instead"—prompting the assistant to retry correctly.
Fully Local Operation and Ultra-Fast 1.8ms Performance
Ratchet is designed with practicality in mind, focusing on system performance and security.
- Completely Local and API Key-Free: It operates entirely within the user's local machine environment without requiring external cloud servers or paid APIs. Because coding data and execution commands never leave the local environment, privacy and security are strictly maintained.
- Lightweight Binary and High-Speed Checks: Built using Rust, a programming language renowned for memory efficiency and high execution speed, the binary size is roughly 5MB. Checking a single command takes approximately 1.8 milliseconds on average, ensuring it operates invisibly without slowing down the developer's workflow.
Additionally, Ratchet includes capabilities to check for internal rule contradictions or broken links, while allowing users to adjust enforcement strictness or grant one-time exceptions as needed.
Compatibility with Major AI Harnesses and Usage Caveats
Ratchet currently supports a wide array of AI coding harnesses—the execution frameworks connecting AI models with development environments. It integrates with more than nine major interfaces, including Claude Code, Cursor, Codex CLI, and Gemini CLI, allowing developers to adopt it without overhauling their existing workflows.
However, users should note that official binary distributions are targeted toward Linux and macOS environments. Developers working on Windows systems will need to build the tool directly from source using Cargo, Rust's package management tool.
For developers exhausted by AI assistants casually brushing aside project rules, Ratchet offers a reliable mechanism to enforce constraints at the execution layer rather than relying purely on passive documentation.
Sources
- X (formerly Twitter) @studio_yebisu: Ratchet OSS Introduction and Features Post