CodeGate
Open source · MIT · v0.1

Let AI write code. Make your checks approve shipping.

CodeGate is a local quality gate for Claude Code, Codex and plain Git. Before an agent commits, pushes or opens a PR, it runs your tests, lint and type checks. If anything fails, the command is blocked and the agent is told what to fix.

● Claude wants to run git commit -m "add totals"
  PreToolUse · CodeGate

OK   merge conflicts
OK   python syntax
OK   secret patterns
FAIL unit tests
      AssertionError: -1 != 5

BLOCKED Fix the failures, then rerun
        the same action.

● Claude fixes add() and retries
PASS 4 checks · commit allowed

How it works

There is no AI reviewer and no API key. CodeGate only runs the checks your repository declares in codegate.toml, and it enforces them in three places.

Agent proposes

Claude or Codex wants to run git commit, git push, gh pr create or a deploy command you listed.

Hook intercepts

The plugin's PreToolUse hook runs conflict, syntax and secret scans plus your configured commands.

Pass or block

On pass, the normal permission flow continues. On fail, the command is denied with the failing output.

Git and CI recheck

pre-commit and pre-push hooks gate ordinary Git, and the same runner can be a required CI check.

Install

The plugins load in every project, but they only act in repositories you opted in on your machine: a codegate.toml plus a one-time init. Everywhere else, commands pass through untouched. Requires Python 3.11+ on macOS or Linux.

# inside Claude Code
/plugin marketplace add Relay-harness/codegate
/plugin install codegate@codegate

# then, in the repo you want to protect
/codegate:setup
  1. Add the marketplace and install. This adds a Bash hook, an MCP tool (codegate_check) and two skills.
  2. Run /codegate:setup in your repo. It detects your test and lint scripts, writes codegate.toml and installs Git hooks.
  3. Review and commit codegate.toml and .codegate/runner.py. Use /codegate:check any time.

One file of policy

Commands are argv arrays with no implicit shell. They run in order, stop at the first failure, and each has a time limit. With no checks configured, shipping stays blocked. An empty policy never counts as a pass.

# codegate.toml
version = 1
timeout = 300
secret_scan = true
ship_commands = ["npm publish", "vercel --prod"]

[[checks]]
name = "tests"
command = ["npm", "run", "test"]
timeout = 120

Honest about limits

A pass means your declared checks passed on the code that was checked. It does not mean the code is bug-free.

What it does

  • Blocks commit, push and PR commands from agents when checks fail
  • Gates ordinary git commit and git push through hooks
  • Detects tests that modify source files during a run
  • Never caches a pass as permission to ship later
  • Runs locally with zero runtime dependencies

What it doesn't

  • Act as a sandbox: checks run with your user permissions
  • Parse every possible shell trick: aliases and wrapper scripts can get past the hook
  • Stop someone who deliberately bypasses local hooks: use required CI
  • Control the ChatGPT web app or code copied from it
  • Replace code review or a real security scanner