# Install in Cursor

Have Cursor's Agent chat install and connect LeoPrevent, or copy the local plugin package yourself on macOS, Linux or Windows.

LeoPrevent works with Cursor's local Agent chat. It installs as a local plugin package, which your agent can copy for you or you can copy yourself. In Cursor, LeoPrevent's advice arrives as one automatic follow up message. See [How each agent handles a finding](https://help.leotrace.io/how-agents-handle-findings/).

## Before you start

- Cursor is installed, and your organisation's policy allows local plugins.
- `git` is installed.
- You have a LeoPrevent account, and you work in a git repository.

## Set it up with your agent

Your agent installs the plugin and opens your browser to connect it. The same prompt is in the dashboard under **Plugin setup**, with **Copy**.

Open Cursor's Agent chat and send this prompt:

**macOS and Linux**

```text
Install LeoPrevent for Cursor from https://github.com/leotrace-hq/leoprevent-plugin, copying cursor/leoprevent into ~/.cursor/plugins/local/leoprevent. Ask me to reload Cursor, then run ~/.cursor/plugins/local/leoprevent/bin/leoprevent-plugin login --agent=cursor. Keep login running until it prints "LeoPrevent · Connected". Browser login saves the credential locally, so no licence key needs to be copied. Do not ask for, paste, or print one; keep credentials out of this transcript. Tell me what I need to approve or restart myself. Verify with a real turn, not by running the hook by hand: LeoPrevent fails open, so a successful manual run does not prove your coding agent invokes it. Confirm that turn appears in the LeoPrevent dashboard; report verification as pending if you cannot check it.
```

**Windows**

```text
Install LeoPrevent for Cursor on Windows from https://github.com/leotrace-hq/leoprevent-plugin, copying cursor-windows/leoprevent into ~/.cursor/plugins/local/leoprevent. Ask me to reload Cursor, then run ~/.cursor/plugins/local/leoprevent/bin/leoprevent-plugin.exe login --agent=cursor. Keep login running until it prints "LeoPrevent · Connected". Browser login saves the credential locally, so no licence key needs to be copied. Do not ask for, paste, or print one; keep credentials out of this transcript. Tell me what I need to approve or restart myself. Verify with a real turn, not by running the hook by hand: LeoPrevent fails open, so a successful manual run does not prove your coding agent invokes it. Confirm that turn appears in the LeoPrevent dashboard; report verification as pending if you cannot check it.
```

On the setup screen you see when you first sign in, **Open in Cursor** opens Agent chat with the prompt filled in.

Approve what it asks for, reload Cursor when it asks, and choose **Link installation** when the browser opens.

## Manual setup

**macOS and Linux**

**Download the plugin**

```bash
git clone --depth 1 https://github.com/leotrace-hq/leoprevent-plugin ~/.cursor/leoprevent-source
```

**Install the local package**

```bash
mkdir -p ~/.cursor/plugins/local/leoprevent
cp -R ~/.cursor/leoprevent-source/cursor/leoprevent/. ~/.cursor/plugins/local/leoprevent/
```

**Reload Cursor**

Reload the window, then confirm LeoPrevent appears in **Customize**.

**Connect to LeoPrevent**

Run this in a terminal, then choose **Link installation** on the page it opens in your browser. Keep it running until it prints **LeoPrevent · Connected**.

```bash
~/.cursor/plugins/local/leoprevent/bin/leoprevent-plugin login --agent=cursor
```

**Windows**

**Download the plugin**

```powershell
git clone --depth 1 https://github.com/leotrace-hq/leoprevent-plugin "$HOME\.cursor\leoprevent-source"
```

**Install the local package**

On Windows, use the `cursor-windows` package shown here. Its hooks run the Windows binary.

```powershell
New-Item -ItemType Directory -Force "$HOME\.cursor\plugins\local\leoprevent" | Out-Null
Copy-Item -Recurse -Force "$HOME\.cursor\leoprevent-source\cursor-windows\leoprevent\*" "$HOME\.cursor\plugins\local\leoprevent\"
```

**Reload Cursor**

Reload the window, then confirm LeoPrevent appears in **Customize**.

**Connect to LeoPrevent**

Run this in a terminal, then choose **Link installation** on the page it opens in your browser. Keep it running until it prints **LeoPrevent · Connected**.

```powershell
& "$HOME\.cursor\plugins\local\leoprevent\bin\leoprevent-plugin.exe" login --agent=cursor
```

To confirm the hooks are loaded, check they appear in Cursor's **Hooks** tab.

## Check it worked

Paste this into your agent and let it reply. The finished turn is what checks in.

```text
Hello! I just installed LeoPrevent. Say hi back so this turn finishes.
```

The installation then shows as **Live** in **Plugin setup**. See [Check it's working](https://help.leotrace.io/check-its-working/).

## Already installed this before?

Copy the package again and reload Cursor. Your LeoPrevent connection survives.

## Update

Refresh the source, copy the package again, then reload Cursor.

**macOS and Linux**

```bash
git -C ~/.cursor/leoprevent-source pull --ff-only
```

```bash
cp -R ~/.cursor/leoprevent-source/cursor/leoprevent/. ~/.cursor/plugins/local/leoprevent/
```

**Windows**

```powershell
git -C "$HOME\.cursor\leoprevent-source" pull --ff-only
```

```powershell
Copy-Item -Recurse -Force "$HOME\.cursor\leoprevent-source\cursor-windows\leoprevent\*" "$HOME\.cursor\plugins\local\leoprevent\"
```

## Remove

Delete the `~/.cursor/plugins/local/leoprevent` folder (on Windows, `$HOME\.cursor\plugins\local\leoprevent`) and reload Cursor. You can also delete `~/.cursor/leoprevent-source`.

Source: https://help.leotrace.io/install-cursor/ (updated 2026-11-19)
