SmuganInstall

Nothing slips through the gap

AI agents write code faster than anyone can review it, and every shortcut they leave makes the next change harder. Smugan refuses those shortcuts before the file exists, runs your project's checks after it, and asks for proof before a task counts as done.

Broken windows, at agent speed

Don't live with broken windows.

Andrew Hunt and David Thomas, The Pragmatic Programmer

Leave one bad decision in a codebase and the next one comes easier. Past a point, the code stops being something you build on and becomes something you patch.

An agent writes in an hour what used to take a week, and its shortcuts pile up just as fast: a test quietly skipped, an error swallowed, a function copied instead of reused.

Without a gateWith Smugan
50.8%
of agent task chains left duplicated logic by the fifth turn, with almost no change in tests passing. RepoReuse, arXiv 2609.35357
−13.1
points in the next task solved when it built on agent-written code; drift in what functions accept and return predicted it. CodeThread, arXiv 2606.21804

Watch a write get refused

Pick a change an agent might make. Each problem is pinned to its line, straight from what smugan check printed for that file; then the agent fixes it and the same check runs again.

Agent · Write supabase/migrations/0007_create_clientes.sql
1create table clientes (
db-namingPortuguese identifier "clientes" ("clientes")
rlstable "clientes" created without RLS
rls-teststable "clientes" has no pgTAP RLS test in supabase/tests/
security-notesproject has no SECURITY_NOTES.md
2 id uuid primary key,
3 nome_completo text
db-namingPortuguese identifier "nome_completo" ("nome")
4);
Write refused · 5 violations
Full output, word for word
  1. supabase/migrations/0007_create_clientes.sql:1 [db-naming] Portuguese identifier "clientes" ("clientes") — use English snake_case
  2. supabase/migrations/0007_create_clientes.sql:1 [rls] table "clientes" created without RLS — add "alter table clientes enable row level security;" plus per-operation policies in this migration
  3. supabase/migrations/0007_create_clientes.sql:1 [rls-tests] table "clientes" has no pgTAP RLS test in supabase/tests/ — instantiate table-rls.test.sql.template (anon denied, owner sees own rows, other user sees zero) and run "supabase test db"
  4. supabase/migrations/0007_create_clientes.sql:1 [security-notes] project has no SECURITY_NOTES.md — create it and describe table "clientes" in one plain-language line: who can read, who can write (template: smugan init)
  5. supabase/migrations/0007_create_clientes.sql:3 [db-naming] Portuguese identifier "nome_completo" ("nome") — use English snake_case
  6. smugan: 5 violations in 1 file checked.
  7. False positive? Suppress with: // smugan-ignore <rule>: <reason (6+ chars)>

Four checkpoints

Before the write

the engine reads only what the change introduces and refuses known violations with the line, the rule and the expected fix. The file is left untouched.

line 1  [rls]  table "clients" created without RLS

After the write

it runs the project's own lint and type checks. Errors the edit introduced go straight back to the agent.

eslint src/cart.ts  →  1 error introduced by this edit

Before the turn ends

it re-checks every touched file, runs the related tests and compares existing tests against the start of the turn. A turn only ends clean when the proof is there.

vitest related src/cart.ts  →  12 passed

At review

separate reviewers read the diff against the original request and the acceptance criteria, never against the author's own summary. A finding that does not reproduce is dropped.

critic  →  2 findings, each with a command that reproduces it

Found in public code

We ran smugan check on popular open-source repositories and read every finding. These are real, at the commit linked; test fixtures and code its authors marked as intentional were left out.

See all 12 findings

What the gate knows

Narrow, deterministic rules, where a fixed answer is worth more than an opinion. Choose a row.

Every rule, its scope and its known false negatives

Where it runs

The engine is the same everywhere. What changes is how much each platform lets a hook block.

Small on purpose

18
checks the engine runs on a change before it is written
12
stack rules that load only when their files are touched
5
coding agents running the same engine
2
reviewers that read the diff, never the author's summary

It stays on your machine

No network
The engine reads files from disk. Its checks make no network call, and the version context never queries a server or reads .env.
No account, no key
Nothing to sign up for and no API key. The gate spends no model tokens; reviewers run inside your own agent session, and only on critical or large changes.
Your tools, not ours
After a write it runs your project's own lint, typecheck and tests. Nothing about your code leaves the commands you already use.
Open source
MIT licensed. Every rule, its known false negatives and the study behind it are in the repository.

Agents leave gaps.
The gate closes them.

Smugan is the Old Germanic verb that, by Tolkien's own account, gave the dragon of The Hobbit his name: to squeeze through a hole. His armour had one bare patch.

Questions

Does it replace my linter, tests or CI?

No. It runs your lint, typecheck and the tests related to the touched files inside the agent's turn, so problems get fixed before the work is handed back. Full builds and mutation testing stay in CI.

Which coding agents does it work with?

Claude Code (global install or plugin), Codex, OpenCode, Antigravity and Grok Build. The engine is the same; each adapter documents what that platform lets a hook block.

What happens on a false positive?

The rules favor precision, so an ambiguous pattern may pass. When a rule is wrong for a line, add // smugan-ignore <rule>: <reason> next to it; the reason must be at least six characters and stays in the code for the next reader.

My codebase already has violations. Will it block everything?

No. Only what the change introduces blocks; old problems in a file stay visible without blocking. For a codebase with a lot of debt, "mode": "warn" reports without blocking while you clean up.

Will it slow the agent down?

Before a write it only reads the change. At the end of the turn the scripts share one deadline, and if Smugan itself fails or times out, the work goes through rather than hang. Verification follows risk: a typo gets no reviewer, a migration gets the full set.

Can I turn parts off?

Yes. SMUGAN_DISABLE at install, or "disable" in smugan.config.json for one project, turns off a reviewer, a skill or a stack rule. Cost profiles choose which model reviews.

How much does it cost?

Nothing. It is MIT licensed open source.

Install it in a minute

Node 22 or newer and Claude Code. The installer can run again safely and only touches the blocks it manages.

Prefer a plugin per project?

Using Codex, OpenCode, Antigravity or Grok?

git clone https://github.com/DenisCDev/smugan.git smugan
cd smugan
./install.sh
smugan doctor