Skip to content
V-SongbirdPublic

About

YAGNI checks for Claude Code and Codex: reconsider dependencies, file growth and unnecessary code before adding more.

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

8 stars

Watchers

0 watching

Forks

Repository files navigation

razor

razor

Before adding code, ask whether the project already has what it needs.

Available on


Codex

Claude Code

Antigravity

Get started · What is this? · How it works · What you can do · Evidence

What is this?

You ask for a small query parser. The assistant reaches for a package, adds helper files, and leaves you more code to maintain. Razor asks whether the language or your project already has what the task needs.

It puts a short checklist before new code and uses targeted checks to prompt reconsideration of unnecessary additions. The aim is to finish the requested work with less to maintain. This example illustrates the workflow; the measurements below describe specific recorded runs.

Ember considers additions, learns the Razor checklist and gets to work.

Why you'd want it

  • Reuse what the project already has.
  • Reconsider unnecessary dependencies before installing them.
  • Notice file growth before a small task becomes a larger project.
  • Find declared dependencies that no source file appears to use.

How it works

A checklist asks whether the work is needed, already implemented or covered by the language. Targeted checks can request one reconsideration. A retry follows the host’s normal permissions. The unused-dependency audit reports findings without uninstalling anything.

What you can do

You want to Outcome
Keep a small task small Check reuse, dependencies and file growth
Pause or resume the checks Change the session toggle
Find unused dependencies Receive a report with confirmed, likely and unknown findings

Send razor off or razor on to pause or resume the checks for the session; /razor off and /razor on also work in Claude Code. Antigravity has no prompt event, so the toggle does not exist there; start it with RAZOR_DISABLE=1 set to keep razor out of a session. For a dependency report, use /razor:unused in Claude Code, $unused in Codex, or /unused in Antigravity.

Install

razor is one package for Claude Code, Codex and Antigravity. Install it in the one you use.

Codex

Requirements: Node.js 22 or later, Git and a Codex host with plugin support.

codex plugin marketplace add V-Songbird/foundry
codex plugin add razor@foundry

Review and enable its hooks, then start a new Codex session.

Claude Code

Requirements: Node.js 22 or later, Git and Claude Code 2.1.139 or later.

Inside Claude Code:

/plugin marketplace add V-Songbird/foundry
/plugin install razor@foundry

Start a new session to load the plugin.

Antigravity

Requirements: Node.js 22 or later, Git and the Antigravity CLI. Antigravity has no marketplace for third-party plugins, so install razor from a clone of Foundry, which checks razor out at the commit the Claude Code and Codex catalogs pin. Replace <path-to-clone> with the directory to clone into:

git clone --recurse-submodules https://github.com/V-Songbird/foundry.git <path-to-clone>
agy plugin install <path-to-clone>/razor
agy plugin list

The list should name razor. Start a new conversation to load it. The checklist and the drift note ride every model call, because a message injected there reaches only the call it rides, and the build check speaks through the stop hook; the calls that answer it carry no drift note. Antigravity has no subagent event, so subagents there receive no checklist.

The install is a copy, so it stays at that commit. To take a new release, update the clone, install again and start a new conversation:

git -C <path-to-clone> pull
git -C <path-to-clone> submodule update --init
agy plugin install <path-to-clone>/razor

Good to know

Input validation, security and error handling that protects your work remain necessary. Explicitly requested scope stays yours to choose. These checks are advisory, not a security boundary.

File checks see the edits made through the assistant's own editing tool: apply_patch in Codex, Write and Edit in Claude Code, write_to_file and replace_file_content in Antigravity. Files written by a shell command skip them, and so do unsupported or ambiguous patches in Codex. See setup and coverage and how razor works.

The numbers

Each result belongs to the named model and recorded run. Missing measurements remain marked as unmeasured. Every recorded run used the checklist's earlier "One check is enough, anywhere in this task" wording; its current one-lookup-per-rung sentence has not been measured.

Codex results

Model Setup Correct and safe Mean coding lines
GPT-5.6 Sol No plugin 19/26 19.2
GPT-5.6 Sol razor 26/26 9.6

Controlled Codex run at high reasoning on Windows: the table covers the full task group. Across all groups, razor passed 38/38 cases versus 29/38 without it. On jointly passing pairs, elapsed time was 1.8% higher and input tokens 0.8% higher; those measures did not improve. This exploratory result does not compare Sol against Claude.

Claude Code results

Model Setup Correct and safe Mean coding lines
Claude Opus 5 No plugin 35/39 18.3
Claude Opus 5 ponytail 39/39 12.2
Claude Opus 5 razor 39/39 9.6

A clean session completed the job without adding a package. Lines are averaged across the coding jobs. Mean session cost was $0.121 with razor, $0.155 without a plugin and $0.151 with ponytail. Blind comparisons did not establish better readability, and Sonnet cost savings did not reproduce reliably. These are recorded Claude results.

Antigravity results

Model Setup Correct and safe Mean coding lines
Not measured Not measured Not measured Not measured

No Antigravity session has been measured yet.

Results can vary between runs.

The razor's edge across 27 columns, one per session without a plugin on the Claude Opus 5 run's nine dependency jobs. Each column is the lines that session added, and the edge sits where razor's middle session landed on the same job: 193 lines above the edge never shipped with razor.

The Claude Opus 5 run in the Claude Code table above (razor revision not recorded; published 2026-09-01 in cbc92f3; run date not recorded): its 27 no-plugin sessions on the nine dependency jobs. These measurements describe the recorded Claude sessions, not Codex performance.

Watch the recorded Claude Code demo: one real session each on Claude Opus 5, replayed on the recorded clock, published September 4, 2026

The same ask side by side: implement parseQuery in query.js. Without razor, Claude wrote it in 18 lines; with razor, in 4 lines built on Object.fromEntries and URLSearchParams. Across the run, 3 sessions each way averaged 18 and 4 lines.

Going deeper

How it works · Settings · Codex setup · Claude Code benchmark details · Codex benchmark details · Changelog

Foundry lists this plugin. The research records and both benchmark harnesses are kept outside this repository and are not distributed with the plugin.

License

MIT — see LICENSE.

About

YAGNI checks for Claude Code and Codex: reconsider dependencies, file growth and unnecessary code before adding more.

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

8 stars

Watchers

0 watching

Forks

Used by

Contributors

Languages