Ratchet installs coding-agent hooks that measure every edit against a minimalism ruleset, report findings back mid-session, and enforce budgets through advise, guard, or strict modes.

Stars

129

7-day growth

No data

Forks

11

Open issues

0

License

MIT

Last updated

2026-07-31

AI repository intelligence
FR-AI / ANALYSIS

Why it is worth attention

It turns agent rules from prompt-only advice into an enforced feedback loop: edits are measured as they happen, findings are graded, existing debt can be baselined, and a ledger records real per-session complexity trends.

Who it is for

  • Developers using Claude Code or other coding agents
  • Teams that want to keep AI-generated code minimal and dependency-light
  • Tech leads or reviewers who need visibility into agent drift

Use cases

  • Enforce budgets for added lines, new files, and new dependencies during agent sessions
  • Catch agent-added dependencies that duplicate standard library or platform features
  • Audit the repository for wrappers, duplicated helpers, and over-engineering
  • Track complexity trends over sessions with ratchet report

Strengths

  • Runs in PostToolUse so every Edit/Write is checked while the agent is still working and findings are returned to the same session
  • Findings are graded certain/likely/heuristic, with strict mode only blocking on certain
  • Mark/ledger and baseline fingerprinting let existing debt be grandfathered while new debt is flagged
  • Includes ratchet doctor and 115 tests to prove the hooks actually fire and detect planted problems

Considerations

  • Detectors are regex and git grep, not a type checker, so false positives are possible and strict mode is opt-in
  • Test files are not scanned by default unless scanTests is enabled; issues inside tests and fixtures won't be flagged
  • No benchmark proves code becomes better, and blocking edits depends on the host honoring the decision field

README quick start

Ratchet

Your agent reads the rules. This checks whether it followed them.

A ratchet turns one way. Complexity in your codebase goes down or stays flat, unless someone deliberately turns it the other way and writes down why.


The problem

Every minimalism ruleset for coding agents is an open loop. You inject prefer the standard library, do not add dependencies, keep the diff small, the model reads it, and then nothing checks whether any of it happened.

Compliance is assumed. When the model drifts, which it does over a long session, nobody finds out until review.

What this does instead

The ruleset still goes in. But a PostToolUse hook reads every edit the agent makes, measures it, and reports what it found back into the same session, while the agent is still working.

you    add a date picker to the settings page

agent  [installs flatpickr, writes a wrapper component, adds a stylesheet]

hook   ratchet guard  ·  +71 -0 lines (net +71/150)  ·  2/3 new files  ·  1/1 new deps

       certain
         package.json:14        dep      new dependency flatpickr
                                         justify it against the stdlib and the platform, or drop it
         src/DatePicker.jsx:4   native   date picker component library
                                         
       likely
         src/DatePicker.jsx:22  wrapper  DatePicker only forwards to Flatpickr
                                         call it directly and delete the wrapper

agent  [reverts, ships ]

Nothing here depends on the model having felt persuaded by a system prompt.


Install

git clone https://github.com/0xwilliamortiz/ratchet.git
cd ratchet
npm install -g .

Then once per repository you want watched:

cd your-project
ratchet

That is the whole setup. It registers the hooks, starts measuring, accepts everything already in the code as a baseline, and opens the window:

ratchet is watching your-project

  hooks      C:\your-project\.claude\settings.json
  measuring  .ratchet\  (mark at 1284 lines)
  baseline   31 findings from before now accepted, only new ones fire
  window     opened ratchetui.exe
  plugin     C:\Users\you\ratchet

restart your agent so it picks the hooks up.

Restart your agent. Done.

Requirements. Node 20 or newer. Git on PATH for the measuring half; without

Description

Your agent reads the rules. This checks whether it followed them.

Related repositories

Similar projects matched by category, topics, and programming language.

makecindy
Featured
makecindy GitHub avatar

cindy

Cindy is an open-source AI agent that runs locally on your machine, integrates multiple AI harnesses and models, and provides memory, skills, and automation to perform real work in your projects and apps.

AI & Machine LearningLarge Language Models
958
mereyabdenbekuly-ctrl
Featured
mereyabdenbekuly-ctrl GitHub avatar

clodex-ide

Clodex is an open-source, local-first agentic IDE that combines persistent AI tasks, code, terminal, browser, Git, models, memory, and governed execution in one Electron workspace, currently in technical preview.

AI & Machine LearningAI Agents
859
0xwilliamortiz
Featured
0xwilliamortiz GitHub avatar

openclaude-improved

OpenClaude is an open-source CLI coding agent that runs on any platform and supports a wide range of LLM providers, offering the same tools and workflows as Claude Code.

AI & Machine LearningLarge Language Models
577