jevmemjevmem

How do I stop an AI coding agent from breaking my project's rules?

Write each rule where the agent reads it at the start of the work, and have something check the agent's actions against the rules before they run: jevmem keeps the rules in JEVMEM.md in your repo, and in Claude Code its guard checks each command, file edit and file write against them and asks you first when one may break a rule.

Last updated: · jevmem 0.7.8 · Install · Source on GitHub

In real Claude Code sessions (0.7.7, checked by hand), a change a rule forbids was left in the code in 0 of 15 sessions with jevmem on, against 9 of 15 with no project memory (results; method). On a held-out set of 274 tool calls, the guard caught 66 of 68 rule breaks (results).

Write the rule where the agent reads it #

A rule the agent never sees can't be followed. Claude Code reads CLAUDE.md, Cursor reads its Project Rules and AGENTS.md, and Codex reads AGENTS.md. jevmem saves the rules you state in chat ("don't hand-edit db/migrations/: those files are generated") as lines in JEVMEM.md, gives the ones a prompt needs back to Claude Code on every prompt, sends rules marked always-on at the start of every session, and lets Cursor's and Codex's agents look them up over MCP.

Check the action before it runs #

A rule in the context is a request; a check before the call is a second line. jevmem's guard runs as a Claude Code PreToolUse hook: before a Bash command, an Edit or a Write runs, it finds the saved rules the call may touch and asks Jev whether the call would break one. If so, Claude Code shows you the rule and asks:

jevmem: this may break a saved rule: "Don't hand-edit db/migrations/: those files are generated." (JEVMEM.md)

In block mode, a call that breaks a rule you marked verified with jevmem trust does not run, and Claude is told to tell you about the rule instead of working around it. How the guard reads a call, its modes and its settings: the guard.

What it does not catch #

The guard is a backstop, not a sandbox. It looks at the words a rule and a call share, so a script or a make target that already exists and does the forbidden thing can be missed. It checks Claude Code's Bash, Edit and Write calls, not MCP tools or what a script changes when it runs, and it runs in Claude Code only: Cursor and Codex get the rules, not the check. Every limit: the guard's limits.

Set it up #

You need a TypeSafe API key, which jevmem's requests are billed to, and Claude Code 2.1.273 or later.

  1. In the Claude app: Plugins → Discover → jevmem → Add.
  2. Install the CLI the plugin runs:
    npm install -g jevmem
    
  3. In your project's folder, finish the setup in one go (it asks for your key without showing it, turns jevmem on in that folder, and checks the setup):
    jevmem setup
    

Start Claude Code in that project. If you start it before the setup is done, the plugin says once what is left; jevmem doctor checks the setup any time.

Other ways to install: the jevmem marketplace, npm, Cursor, Codex

From the jevmem marketplace:

npm install -g jevmem
claude plugin marketplace add Avinash-jetwani/jevmem
claude plugin install jevmem@jevmem
claude plugin install jevmem-pane@jevmem   # the side pane (0.7.5), optional
cd your-project && jevmem setup

With npm only (also sets up Cursor and Codex):

npm install -g jevmem
cd your-project
jevmem init --tool claude    # or cursor, codex, claude-desktop, all

In Cursor, the jevmem plugin (0.7.6) carries the hooks, the MCP server and the rule for every window: install it from the Cursor Marketplace once it is listed there, or copy this repository's cursor-plugin/ folder to ~/.cursor/plugins/local/jevmem and reload the window; then jevmem setup in each project (the steps). jevmem is also listed on cursor.directory; its Add to Cursor button installs the MCP server alone (recall, with the entry in docs/mcp.md), so saving still needs the plugin folder or jevmem init --tool cursor.

Already have a CLAUDE.md? jevmem import shows what it would add from it; --apply writes it.

Every step, and what to do if the plugin can't find the CLI: docs/install.md.

The limits, in short #

Every limit, with the numbers: the FAQ.