# I made Jev pick the right AI agent in 0.4s: meet Gatekeeper

- URL: https://agricidaniel.com/blog/gatekeeper-jev-ai-agent
- Author: [Agrici Daniel](https://agricidaniel.com/about)
- Published: 2026-09-24
- Updated: 2026-09-24
- Category: Open Source

Gatekeeper checks every request against your rules, then Jev picks the right AI agent or skill in about 0.4 seconds, with a confidence. Free and open source.

**Gatekeeper** decides which AI agent or skill should handle a request, before your AI picks one. Your rules check every request first. Then Jev, TypeSafe's System One model, makes the one call code cannot, typed and with a confidence, in about 0.4 seconds and for a fraction of a cent. It is free and open source.

I built Gatekeeper, so this is a first-party write-up, not an independent review. The code is public under the MIT license on [GitHub](https://github.com/AgriciDaniel/gatekeeper).

## In this article

-   Watch the walkthrough
-   The short version
-   The problem: your AI guesses
-   How it works: your rules, then Jev's call
-   Not sure which skill, sure which team
-   You set the bar
-   Markdown-first skills, no install
-   Tested and cheap
-   Safety and privacy
-   What it does not do
-   Install it
-   FAQ

## Watch the walkthrough

The video shows my agent team, how a request gets routed, the three modes, and the numbers. It runs 4 minutes 18 seconds.

[Video: I made Jev pick the right AI agent in 0.4s (free)](https://www.youtube.com/watch?v=qwGJM6G_8Wg)

Chapters: 0:00 Meet Gatekeeper, 0:14 the problem, 0:34 my AI agent team, 1:40 how it works, 1:54 watching, advising, steering, 2:30 Jev's call, 3:04 tested and cheap, 3:30 same gate, new rulebook (a concept), 3:53 get it.

## The short version

-   Commands you type go straight through. Plain requests, where the AI would otherwise guess, get checked by your rules and judged by Jev.
-   Jev answers one typed question: which of these handlers owns this request? It returns a probability for every option.
-   Confidence bands turn that answer into a verdict: allow, route, suggest, confirm, escalate or block.
-   Not sure which skill but sure which team? It still sends the request to the right team.
-   It starts in shadow mode, logs every decision with its reason, and fails open: if Jev is down, nothing is blocked.
-   About 0.4 seconds and a fraction of a cent per decision. Free, MIT licensed.

## The problem: your AI guesses which agent gets the job

Skills you call by command. But when you just ask, "let's do an SEO audit" or "write a welcome email", your AI picks the agent or skill by reading their descriptions. With a handful of agents that works. With dozens, it guesses, and every wrong hop costs time and tokens before it gets back on track.

I run an agent team inside AI Marketing Hub Pro: Andre for ads, Mei for analytics, Richard as the orchestrator, each with their own skills. The more skills I added, the more often the first pick was the wrong one. So I put a gate in front of the choice.

This is the routing half of a problem I wrote about in [my AI agent approval workflow](https://agricidaniel.com/blog/ai-agent-approval-workflow): that post decides what an agent may do, Gatekeeper decides which agent does it.

## How it works: your rules, then Jev's call

A gate is a YAML rulebook. Code decides everything code can decide: slash commands, keywords, "yes, go on", field checks. Those never reach a model and cost nothing. Jev answers only the semantic question left, as a typed Choice with a probability for every option.

![The Gatekeeper router: a prompt passes your rules, then Jev makes a typed judgment and routes it to one of five destinations: design-agent, seo-agent, jev-helper (forbidden for SEO), main thread, or ask the user.](https://agricidaniel.com/images/blog/gatekeeper/gatekeeper-router.webp)

__Figure 1. The router from the repository README. Full text alternative: you send a prompt, your rules narrow the options with code checks, Jev returns a typed judgment, and the verdict routes to an agent, keeps the main thread, or asks you first. In the example, "fix slide 3 of my deck" routes to design-agent at 0.95, in the act band.__

Confidence bands then turn Jev's answer into one of six verdicts:

The six verdicts. Source: the Gatekeeper README.

| Verdict | Meaning |
| :--- | --- |
| allow | Nothing to do, let it through |
| route | This handler. Confident enough to act on |
| suggest | Probably this handler. Advice only |
| confirm | Needs a human yes first (for example: deploy, send, delete) |
| escalate | Unsure. Ask the user who should handle it |
| block | Stop it |

The idea is the same one I used in [Jev SEO](https://agricidaniel.com/blog/jev-seo-ai-seo-audit): let code decide what it can, and let the model say how sure it is, so a sure answer becomes an action and an unsure one goes to a human.

## Not sure which skill, sure which team

This is my favorite part. Ask the marketing-team example to "help me with SEO for our site" and no single skill wins: technical SEO audit 0.62, keyword research 0.36. A strict router would give up. Gatekeeper adds the probabilities up by the role that owns each skill, gets 0.98 for the SEO role, and still sends the request somewhere useful.

![Rollup for the prompt help me with seo for our site. Skill level, no single skill is sure: technical-seo-audit 0.62, keyword-research 0.36, marketing-workflow 0.02. Role level, code adds them up by owner role: seo role 0.98. Verdict: suggest the seo role.](https://agricidaniel.com/images/blog/gatekeeper/gatekeeper-rollup.webp)

__Figure 2. Rollup from the repository README. Jev picks the fine label, code sums the probabilities by group.__

Real output from the README, for a clear request:

```text
$ gatekeeper judge marketing-team "our google ads cpc doubled, find the waste"
verdict:    route -> ad-account-audit
skill:      ad-account-audit conf 0.98 [act]
  group:    ads conf 1.0 [act]
cost:       $0.000056, 351 ms
```

## You set the bar: watching, advising, steering

Jev always says how sure it is. You decide how sure is sure enough, and whether the gate only watches, gives advice, or steers. A fresh install starts in shadow mode.

Gatekeeper modes. Source: the Gatekeeper README.

| Mode | Judges prompts | Adds context | Blocks or denies |
| :--- | --- | --- | --- |
| shadow (watching) | yes | no, logs what it would add | no  |
| advise (advising) | yes | yes | never |
| enforce (steering) | yes | yes | yes |
| off | no  | no  | no  |

The starter thresholds are 0.85 to act and 0.60 to confirm for a Choice. They are the documented illustrations from TypeSafe's docs until your own bench replaces them. Every decision lands in a local log with the rules that fired, Jev's answers, the band, the cost and the rulebook version, so you tune from evidence instead of guessing.

## Markdown-first skills, no install

Many of my skills are Markdown-first: the assistant reads a SKILL.md and follows it. Gatekeeper can route to those straight from a JSON index (name, description, group, path), in advise mode, so you get the right procedure without installing each one as a Claude Code skill. If you want to build skills like that, my [guide to Claude Code skills](https://agricidaniel.com/blog/best-claude-code-skills-2026) is a good start.

## Tested and cheap

Gatekeeper numbers, verified on 24 September 2026. Sources: the README, the test suite and my own bench.

| What | Number | Where it comes from |
| :--- | --- | --- |
| Time per decision | About 0.4 s (311 to 351 ms in the README examples) | Real CLI output |
| Cost per judged prompt | About 0.00006 USD over 24 skills, 0.0004 USD over 143 | README, Jev bills input tokens only |
| A full 60-prompt test | About 0.004 USD | My bench run, shown in the video |
| My real setup | 70% to 80% to 90% routed right on 60 everyday prompts, from two small rule edits | My private bench; I labelled the prompts myself |
| Marketing-team example | 20 of 20 | A deliberately easy bench: it shows the mechanics, not real-world accuracy |
| Offline tests | 168 passing on v0.2.2 | python3 -m pytest -q on a fresh clone |

The 90% is my own setup and my own labels, so treat it as a first-party result, not a benchmark. The useful lesson is the method: label a bench, run it, change one rule, run it again.

## Safety and privacy

-   **Fail open means fully open.** If Jev is down or slow, nothing is denied. A hook never breaks a session.
-   **You outrank the gate.** A handler you name in the prompt is never denied.
-   **Gatekeeper never acts.** It decides who handles work. It never sends, publishes, deploys or spends.
-   **What leaves your machine:** each judged prompt (up to 6,000 characters), the roster descriptions and the fields the rulebook lists go to the TypeSafe API under your key. Keys and common secret shapes are masked first, best effort. The local log keeps a hash and a short excerpt, not the full prompt.
-   **Doctor:** because the gate fails open, a broken gate looks like a quiet one. `gatekeeper doctor` checks for the silent failures, like a missing key or skill links left behind by a moved folder.

## What it does not do

-   It does not run your agents or skills. It picks who should.
-   It installs only as a Claude Code hook today, even though the engine is tool-neutral.
-   The starter thresholds are not tuned to your setup. Tune them with your own bench.
-   The inbox example in the video (the same gate with a new rulebook for email) is a concept, not built yet.

## Install it

Paste the repository link into your agent and ask it to install Gatekeeper, or do it by hand. The installer runs as a dry run first and shows the change.

```bash
git clone https://github.com/AgriciDaniel/gatekeeper.git && cd gatekeeper
pip install -e ".[test]"
python3 -m pytest -q                                   # offline, no key needed
bin/gatekeeper judge marketing-team "write a welcome email sequence"
python3 scripts/install_hooks.py --global --skill      # dry run
python3 scripts/install_hooks.py --global --skill --apply
bin/gatekeeper doctor
```

You need a TypeSafe key in `TYPESAFE_API_KEY` or in `~/.config/gatekeeper/env`. Keep it out of the repo folder. Full details are in the [README](https://github.com/AgriciDaniel/gatekeeper#install).

Your rules first, then Jev's call

## Stop your AI from guessing which agent to use

Free, MIT licensed, and it starts in shadow mode, so you can watch it for a few days before it changes anything.

[Get Gatekeeper on GitHub](https://github.com/AgriciDaniel/gatekeeper)Watch the walkthrough

## Frequently asked questions

### What is Gatekeeper?

Gatekeeper is a free, open-source Claude Code hook that decides which AI agent or skill should handle a request before your AI picks one. Your rules check the request first, then Jev makes the one call code cannot, with a confidence. It is MIT licensed.

### What is Jev by TypeSafe?

Jev is TypeSafe AI's System One model. It does not write text. It answers typed questions, such as a choice between options, and returns the probability behind every answer. That makes it a good fit for routing: code can act on a sure answer and ask a human about an unsure one.

### How much does Gatekeeper cost to run?

The code is free. Each judged prompt is one Jev call: about 0.00006 USD over a 24-skill roster and about 0.0004 USD over 143 skills and workflows. My full 60-prompt test cost about 0.004 USD. Commands and plain replies like yes or thanks are decided by code and cost nothing.

### Does Gatekeeper block anything by default?

No. A fresh install runs in shadow mode: it judges prompts and logs what it would do, but changes nothing. Advise mode adds the route as context and never blocks. Only enforce mode can deny a hand-off, and if Jev is down or slow, nothing is ever denied.

### Does it only work with Claude Code?

The engine and the YAML rulebooks are tool-neutral, but today Gatekeeper installs as a Claude Code hook. It can also route to Markdown skills listed in a JSON index, without installing them as Claude Code skills.

## Related reading

-   [I made Jev do my SEO audit](https://agricidaniel.com/blog/jev-seo-ai-seo-audit)
-   [AI agent approval workflow: a practical review matrix](https://agricidaniel.com/blog/ai-agent-approval-workflow)
-   [The best Claude Code skills in 2026](https://agricidaniel.com/blog/best-claude-code-skills-2026)

## Let your rules decide, and let Jev say how sure it is

The more agents and skills you run, the more your AI guesses. Gatekeeper puts your rules first and gives the one hard call to a model that tells you how sure it is. Install it in shadow mode, read the log for a few days, and tell me where it picks wrong.

_Gatekeeper is an independent open-source project. It is not affiliated with, sponsored by, or endorsed by TypeSafe AI or Anthropic._
