# How do I use jevmem in Cursor?

Install the jevmem plugin for Cursor (since jevmem 0.7.6), or run `jevmem init --tool cursor` in your project (since 0.7.4). Either way, when an agent turn finishes, Cursor's `stop` hook reads the turn from the transcript Cursor keeps and runs the same decide and write path as in Claude Code, so the decisions, rules and failed approaches you state in a Cursor chat land in `JEVMEM.md` on their own; jevmem's MCP server and a rule tell the agent to call `search_memory` before a non-trivial task, since Cursor's prompt hook takes no context and reading memory is the agent's call, over MCP.

Last updated: 2026-12-04 · jevmem 0.7.11 · [Install](https://jevmem.dev/install/) · [Source on GitHub](https://github.com/Avinash-jetwani/jevmem)

**The plugin** carries the hooks, the MCP server and the rule for every Cursor window, so a project needs no `.cursor/` files from jevmem: you turn each project on with `jevmem setup`, and elsewhere the plugin stays silent (its hooks exit at once, its server answers that jevmem is off there, and its rule tells the agent to leave jevmem alone). Like the Claude Code plugin it ships no code: one shell launcher runs the `jevmem` command from npm. Until jevmem is listed on the Cursor Marketplace, the plugin installs from the repository's `cursor-plugin/` folder (below). jevmem has been listed on [cursor.directory](https://cursor.directory/plugins/jevmem) since 2026-10-23; that listing is the MCP server alone: its **Add to Cursor** button installs the server with the entry in [docs/mcp.md](https://github.com/Avinash-jetwani/jevmem/blob/main/docs/mcp.md#cursor), so the agent can read memory, and saving still needs the plugin or `jevmem init --tool cursor`.

**`jevmem init --tool cursor`** writes the same hooks into the project instead, `.cursor/hooks.json` with a small launcher at `.cursor/hooks/jevmem-hook.sh`, both free of any path of your computer so they can be committed, plus jevmem's MCP server in `.cursor/mcp.json` and the rule `.cursor/rules/jevmem.mdc`. With the plugin installed on your computer, `init` only turns the project on and writes none of them. A project set up this way keeps working beside the plugin, which stands down there so nothing is saved twice; `jevmem init --remove-hooks` moves it to the plugin alone.

Before 0.7.4, saving in Cursor happened only when the agent called `add_memory`. If you set jevmem up for Cursor earlier and use no plugin, run `jevmem init --tool cursor` once more: it adds the two files, updates the rule's text when you have not changed it, and keeps your MCP entry; then reload the window.

**The guard** (since 0.7.9): the plugin, and `jevmem init --tool cursor`, also register two hooks that check each shell command, edit and delete against the project's rules (`JEVMEM.md` and, in a new project, the rules in `CLAUDE.md`, `AGENTS.md` and your Cursor rules) before it runs. In the Cursor app a shell command that may break a rule shows Cursor's approval card with the rule; an edit or a delete, and any call in the `agent` CLI, is stopped instead, since Cursor's hook can't ask there, and `jevmem guard allow <code>` in your own terminal lets that one call through ([the guard in Cursor](https://jevmem.dev/guard/#cursor-and-codex-079)).

![What the guard does in each tool: Claude Code asks you about a command or edit; the Cursor app asks about a shell command and stops an edit; Cursor's agent CLI and Codex stop the call, and jevmem guard allow with the code, run in your own terminal, lets that one call through. Live check on 0.7.9: a forbidden edit stopped in 3 of 3 runs in each, an everyday edit ran in 3 of 3.](https://jevmem.dev/img/guard-tools-light.svg)

## What was measured

Twenty real Cursor sessions were captured through Cursor's `agent` CLI in scratch copies of small projects, before any of the Cursor code was written, and each turn was labelled with what jevmem should save. On the ten held-out sessions (24 turns), the first run on the build paired 21 of 24 turns whole, the prompt with the whole reply and no tool output: the three misses were one session where Cursor's CLI had written a line of its own after a background task, which the reader took as a new turn ([the first run](https://github.com/Avinash-jetwani/jevmem/blob/main/results/cursor-heldout-2026-10-16-v074.json)). That fix came from reading the held-out session, so the second run, after it, is no longer a first look: it paired 24 of 24, and the decider, unchanged from Claude Code, was right on save or skip for 21 of 24 turns and on save and kind for 20 of 24, each saved line carried its labelled words, and the one reversal replaced the line it reversed ([results](https://github.com/Avinash-jetwani/jevmem/blob/main/results/cursor-heldout-2026-10-16-v074-run2.json)). The three decide misses are a fact stated in a reply saved as an architecture line, twice, and a failing test runner found by "Run the tests" saved as a bug. The sessions were served by Grok 4.7 Extra High; what Cursor's hooks send, and what each of jevmem's does with it, is on the repository's [hooks page](https://github.com/Avinash-jetwani/jevmem/blob/main/docs/hooks.md#cursor-hooks-074).

## Set it up with the plugin

1. Install the CLI:
   ```bash
   npm install -g jevmem
   ```
2. Save your [TypeSafe API key](https://console.typesafe.ai/keys) (paste it when asked; it isn't shown):
   ```bash
   jevmem key
   ```
3. Install the plugin: from the Cursor Marketplace once jevmem is listed there (Customize → find jevmem → Install), or now from the repository: copy its `cursor-plugin/` folder to `~/.cursor/plugins/local/jevmem`, then **Developer: Reload Window**. Customize shows the plugin's hooks, MCP server and rule. (The cursor.directory listing's **Add to Cursor** installs the MCP server only, not the plugin.)
4. In each project's folder:
   ```bash
   jevmem setup
   ```
   It turns jevmem on there (`JEVMEM.md`, `jevmem.config.json`, a gitignored `.jevmem/` folder) and checks the setup. The plugin's MCP server already runs in every window, with no toggle. `jevmem doctor` shows a `cursor` line that names the plugin.

## Set it up without the plugin

1. Install the CLI and save your key, as above.
2. In your project's folder:
   ```bash
   jevmem init --tool cursor
   ```
3. Reload the Cursor window, so that it picks up the hooks. Cursor runs project hooks in a trusted workspace.
4. Turn the project's MCP server on once, in the Cursor app: Customize → MCPs → jevmem → Configure → the source toggle for `.cursor/mcp.json`, then Reload. Cursor starts a project's MCP server only after this; the hooks need no server ([what you see, and what was measured](https://jevmem.dev/cursor/#the-mcp-config-if-you-write-it-yourself)).

`init` also creates `JEVMEM.md`, `jevmem.config.json` and a gitignored `.jevmem/` folder in the project. `jevmem doctor` shows a `cursor` line with what it found. Every install path: [install](https://jevmem.dev/install/).

## What is saved, and what is not

A turn that ends with `status: completed` is saved; a turn you stopped, or that ended in an error, is not. In Cursor's `agent` CLI, which fires `sessionEnd` and not the app's `stop`, each `agent -p` run is one turn, saved when the run ends. A turn's `previous` context is the turn before it, as in Claude Code. Cursor's own follow-up line after a background task ("Briefly inform the user about the task result…") belongs to the turn before it, since 0.7.6 also when that turn had ended. What goes to TypeSafe is the same as from a Claude Code turn, from the plugin as from the project's hooks ([privacy](https://jevmem.dev/privacy/)). Known limits in Cursor: [limits](https://jevmem.dev/faq/).

## The MCP config, if you write it yourself

**With the Cursor plugin (0.7.6)** nothing is written here: the plugin's `mcp.json` runs `jevmem mcp` through its launcher with the window's folder as the project (`--root "${workspaceFolder}"`, which the Cursor app expands per window; its `agent` CLI starts the server in the project instead), and Cursor starts it in every window on load, with no toggle ([docs/hooks.md](https://github.com/Avinash-jetwani/jevmem/blob/main/docs/hooks.md#the-jevmem-plugin-for-cursor-076)). In a project that is not turned on it answers every call with one line saying so, and sends nothing. The entry below is the project's own, which `jevmem init --tool cursor` writes when the plugin is not on this computer.

`jevmem init --tool cursor` writes this entry, the rule `.cursor/rules/jevmem.mdc` and, since 0.7.4, the hooks that save each finished agent turn ([docs/hooks.md](https://github.com/Avinash-jetwani/jevmem/blob/main/docs/hooks.md#cursor-hooks-074)); the MCP server is how the agent reads memory (`search_memory`). jevmem's listing on [cursor.directory](https://cursor.directory/plugins/jevmem) carries this same entry: its **Add to Cursor** button installs the MCP server alone, so the agent can read memory, and nothing is saved until the plugin or `jevmem init --tool cursor` adds the hooks. `.cursor/mcp.json` (project) or `~/.cursor/mcp.json` (global):

```json
{
  "mcpServers": {
    "jevmem": {
      "command": "npx",
      "args": ["-y", "jevmem", "mcp"],
      "env": { "TYPESAFE_API_KEY": "${env:TYPESAFE_API_KEY}" }
    }
  }
}
```

**In the Cursor app, turn the project's server on once.** Cursor reads a project's `.cursor/mcp.json` but starts its server only after you enable it: open Customize → MCPs, search `jevmem` (it shows "jevmem · your project · Disabled"), open Configure, turn on the source toggle "your project .cursor/mcp.json", then Reload. Until then Environments says "Local: Disconnected" and the agent cannot call `search_memory`: it reads `JEVMEM.md` as a file instead and may say the memory server is not connected. Measured on 2026-10-17 with Cursor 3.25.9: before the toggle, Cursor's logs showed the server registered and `disconnected` at every window load, never started; after it, "Successfully connected to stdio server" in under a second, and the agent's next question was answered through `search_memory`. Cursor's `agent` CLI asks the same approval, or takes `--approve-mcps`, which the `cursor` e2e scenario passes. Saving by the hooks needs no server.

## What the agent can call

`jevmem mcp` starts a stdio MCP server with four tools:

| Tool | Args | Jev calls | Annotations (readOnly / destructive / idempotent / openWorld) |
|---|---|---|---|
| `search_memory` | `query`, `limit?` | 1 (choice over ids + noul per candidate, + a poisoning-gate noul per unverified, unchecked candidate) | true / false / true / true |
| `add_memory` | `text`, `kind` | 1, or 2 on a borderline line (the hook's decide: scrub, then refuse injection / small talk; since 0.7.0 a line a live memory already says is not added and the answer names that line, `duplicate_of`, with no error; Jev may correct the kind; a contradiction supersedes the old line) | false / true / false / true |
| `list_memory` | `include_superseded?` | 0, or 1 when unverified lines have no cached gate verdict (the poisoning gate alone) | true / false / true / true |
| `audit_memory` | `apply?` | ⌈memories / 60⌉ | false / true / true / true |

In a project without `jevmem.config.json` (not opted in with `jevmem enable` or `jevmem init`) every tool returns only "jevmem isn't enabled in this project: run `jevmem enable`" and does nothing else: no Jev call, no file.

`search_memory` and `list_memory` never return a line the [poisoning gate](https://github.com/Avinash-jetwani/jevmem/blob/main/SECURITY.md#memory-poisoning) withholds (they list it under `withheld` with the reason instead), and `list_memory` without a key withholds unverified lines it cannot check. Both are marked open-world because they may ask Jev.

`add_memory` takes `kind` ∈ `decision | constraint | preference | bug | architecture | todo`, and, since 0.6.0, `dead-end`: an approach that was tried and failed or was dropped. A dead-end line must say what was tried and why, and Jev decides whether it does (the dead-end noul, in the request `add_memory` already makes, at `thresholds.deadEndMin`), or it is refused ("a dead end must say why it failed or was dropped, and Jev found no reason in this line"); a line Jev reads as a dead end with no reason keeps the kind you gave. A retry of a saved dead end that failed again for the reason that line gives is refused ("a retry that failed again adds nothing"); for a new reason, the saved line is the old line's reason followed by "retried:" and yours, and it replaces the old line ([Dead ends](https://github.com/Avinash-jetwani/jevmem/blob/main/docs/dead-ends.md#when-it-is-tried-again)). `search_memory` and `list_memory` return dead ends with `"kind": "dead-end"`; the Claude Code hook injects them as `Already tried: <line>` ([Dead ends](https://github.com/Avinash-jetwani/jevmem/blob/main/docs/dead-ends.md)).

Both writing tools are marked destructive because they can change existing lines, not only add new ones: `add_memory` re-tags a contradicted memory `[superseded]`, which takes it out of what is served (the line stays in the file), and `audit_memory` with `apply: true` sets or clears `[stale?]` flags on existing lines (flagged lines keep their text and stay live).

The `Dockerfile` at the repository root is for MCP directories that inspect a server in a sandbox (Glama builds it, starts the server and calls `tools/list`): it installs the jevmem CLI from npm and starts `jevmem mcp` on an empty folder, where the server lists its four tools and a call to one replies that jevmem isn't enabled there. It needs no key. It is not a way to run jevmem: the server works on the project it is started in.

## What is automatic in each tool

What is automatic and what depends on the agent:

| Tool | Setup | Capture | Recall |
|---|---|---|---|
| **Claude Code** | the plugin, or `jevmem init --tool claude` | **Automatic**, every turn, via the `Stop` hook | **Automatic**, every prompt, via `UserPromptSubmit` |
| **Codex** | `jevmem init --tool codex` | **Automatic while `jevmem watch` runs** (it tails Codex's session log for this project and runs the same decide → write path); otherwise agent-initiated via MCP `add_memory`, prompted by an `AGENTS.md` section | Agent-initiated: `search_memory` via MCP, prompted by `AGENTS.md` |
| **Cursor** | [the Cursor plugin](https://jevmem.dev/install/#the-cursor-plugin-076) (0.7.6), or `jevmem init --tool cursor` | **Automatic since 0.7.4**, every finished agent turn, via Cursor's hooks (the plugin's, or the project's in `.cursor/hooks.json`; the app's `stop` hook, the `agent` CLI's `sessionEnd`), through the same decide and write path as Claude Code ([what was measured](https://github.com/Avinash-jetwani/jevmem/blob/main/docs/hooks.md#cursor-hooks-074)). Before 0.7.4: only when the agent called MCP `add_memory` | Agent-initiated: the rule (the plugin's, or `.cursor/rules/jevmem.mdc`) tells it to call `search_memory` before non-trivial tasks (Cursor's prompt hook takes no context, so recall is not automatic there). The plugin's MCP server runs in every window from the start; a project's `.cursor/mcp.json` server starts only after you turn it on once in the Cursor app, Customize → MCPs → jevmem → Configure → the source toggle for `.cursor/mcp.json`, then Reload ([the step](https://github.com/Avinash-jetwani/jevmem/blob/main/docs/mcp.md#cursor)) |
| **Claude Desktop** | `jevmem init --tool claude-desktop` prints a config snippet to paste (one project per config, named with `--root`) | Manual: ask it to call `add_memory` (no hook, no rule file) | On request: `search_memory` |

**The guard** (0.7.9) runs in all three: in Claude Code through the `PreToolUse` hook; in Cursor through the plugin's or the project's `beforeShellExecution` and `preToolUse` hooks (the app asks about shell commands; edits, deletes and the `agent` CLI's calls are stopped until you run `jevmem guard allow <code>`); in Codex through the project's `.codex/hooks.json`, which `jevmem init --tool codex` writes and each person trusts once in `/hooks` (Codex 0.171 or newer). See [Guardrails](https://jevmem.dev/guard/#cursor-and-codex-079).

MCP `add_memory` goes through the same gate as the hook. Client configs: [docs/mcp.md](https://github.com/Avinash-jetwani/jevmem/blob/main/docs/mcp.md).

## The limits, in short

- jevmem needs a TypeSafe API key ([where to get one, and the install steps](https://jevmem.dev/install/)).
- Message text is sent to TypeSafe to be scored, with common secrets scrubbed first ([what leaves your machine](https://jevmem.dev/privacy/)).
- It is automatic in Claude Code and, since 0.7.4, in Cursor (as a Cursor plugin since 0.7.6, whose rule sits in every chat), automatic in Codex while `jevmem watch` runs, and in Claude Desktop only when the agent calls it; in Cursor, bringing lines back is still the agent's call ([what each tool does](https://jevmem.dev/install/#works-with)).
- Rules every task must follow reach every session only when they are marked always-on (0.7.1), by Jev's reading or yours ([jevmem next to CLAUDE.md](https://jevmem.dev/compare/)).
- The guard is a backstop, not a sandbox ([what it misses](https://jevmem.dev/guard/#limits)). In Cursor and Codex it is a hook, and a hook that times out or fails lets the call run.
- The side pane is Claude Code only, 2.1.299 or newer: Cursor has no pane, and Claude Code for VS Code draws none yet ([the pane](https://jevmem.dev/pane/)).

Every limit, with the numbers: [the FAQ](https://jevmem.dev/faq/#what-are-jevmems-limits).
