DEV Community

Avinash Jetwani
Avinash Jetwani

Posted on AI-assisted

I made Claude Code check its commands against my project's rules

Some of my project's rules live in old chats.

"Never commit .env files." "Ask before pushing a tag." "Don't edit the generated client by hand."

Claude can only follow a rule that's in front of it when it acts. So in jevmem 0.6, I added the guard.

How it works

jevmem guard: how a command is checked against saved rules

  • Claude wants to run a command or edit a file (Bash, Edit or Write).
  • Plain code looks for saved rules the call might touch. Most calls match nothing and go straight through.
  • Only those candidates go to Jev, which judges whether the call may break the rule.
  • If it might, Claude Code asks you first. You decide.

Since 0.7.0 (9 Oct), you can also mark your own rules as trusted with jevmem trust. In block mode, the guard can then stop a call that breaks a trusted rule, instead of asking.

The test

I wrote a held-out set before fixing anything: 274 tool calls in 5 new projects, 68 of them breaking a saved rule.

The first build caught 50 of 68. After the fixes, 66 of 68, with 3–4 false asks in the 206 fine calls.

In my own repo, over 65 real calls, it asked 3 times. Two were right. One wasn't.

What it misses

It matches on the words a rule and a call share, so it can miss:

  • a rule that shares no words with the command
  • calls like git tag -d or npm version, which share one word with a rule
  • a slow answer: if Jev is late on a weak match, the call goes through. On a strong match, it asks.

It's a backstop, not a sandbox.

What to know

  • It needs a paid TypeSafe API key: the check runs on TypeSafe's Jev model, so the call and the matching rule go to their API. The repo's privacy notes say exactly what's sent.
  • No telemetry.
  • The numbers come from my own test sets, run once each.

Try it

  1. Claude app → Plugins → Discover → jevmem → Add
  2. npm i -g jevmem
  3. jevmem key, then jevmem enable in your project

The guard runs in "ask" mode by default.

Repo: https://github.com/Avinash-jetwani/jevmem · How the guard works: https://avinash-jetwani.github.io/jevmem/guard/

Written with help from Claude. The numbers are from my own test sets, run once each, and the results files are in the repo.

Top comments (0)