# Install in Codex

Have Codex install and connect LeoPrevent, or run the commands yourself, then trust its three hooks. Untrusted hooks review nothing.

LeoPrevent installs into Codex from its public marketplace. Have Codex do it for you, or run the commands yourself. Either way, you then trust the plugin's three hooks yourself.

## Before you start

- Codex is installed on macOS or Linux.
- You have a LeoPrevent account.
- 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**.

Start Codex in your terminal and send this prompt:

```text
Install the LeoPrevent plugin for Codex from the leotrace-hq/leoprevent-plugin marketplace, using my real Codex home, then run its login command. Keep login running until it prints "LeoPrevent · Connected". I will trust the hooks myself afterwards. 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.
```

Approve what it asks for and choose **Link installation** when the browser opens. Then start a new session, run `/hooks`, trust all three and send any message.

## Manual setup

**Add the marketplace**

```bash
codex plugin marketplace add leotrace-hq/leoprevent-plugin
```

**Install the plugin**

```bash
codex plugin add leoprevent@leotrace
```

Open a new session, then confirm it shows `leoprevent@leotrace` as installed and enabled.

```bash
codex plugin list --marketplace leotrace
```

**Trust the hooks**

In the new session, run `/hooks`, review each LeoPrevent hook and trust all three: **UserPromptSubmit**, **PreToolUse** and **Stop**. In the Codex app, add a local project folder, then trust them in **Settings** > **Coding** > **Hooks** > **LeoPrevent**.

**Connect to LeoPrevent**

Ask Codex to run the plugin's login command, then choose **Link installation** on the page it opens in your browser. Keep it running until it prints **LeoPrevent · Connected**. If Codex cannot find the command, run this yourself, replacing `<version>` with the installed version:

```bash
~/.codex/plugins/cache/leotrace/leoprevent/<version>/bin/leoprevent-plugin login
```

> **Warning:** An installed, enabled plugin, even one with a green tick, reviews nothing until its hooks are trusted in `/hooks`.

## 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?

Run only the install command. At the same version, the marketplace, the hook trust and your connection all survive. A version whose hooks changed asks you to trust them again in `/hooks`.

## Update

Refresh the marketplace, then install from it. Open a new session and trust any changed hooks in `/hooks`. Your connection survives the update.

```bash
codex plugin marketplace upgrade leotrace
```

```bash
codex plugin add leoprevent@leotrace
```

## Remove

Disable or remove **leoprevent** from Codex's `/plugins` list.

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