> ## Documentation Index
> Fetch the complete documentation index at: https://docs.semgrep.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Set up Semgrep Guardian with Codex

> Install Semgrep Guardian in Codex using the Guardian plugin.

Integrate Semgrep Guardian with Codex for scans of AI-generated code through [hooks](https://developers.openai.com/codex/hooks) and [plugins](https://developers.openai.com/codex/plugins).

**Codex is a recommended Guardian setup.** The plugin uses Semgrep's hosted server and OAuth, so you don't need to install the Semgrep CLI locally.

## Prerequisites

* A Semgrep account
* Codex CLI installed (`codex` command)

## Setup

<Steps>
  <Step title="Install the plugin">
    Add the Semgrep marketplace, then install the Guardian plugin from it:

    ```bash theme={null}
    codex plugin marketplace add https://github.com/semgrep/guardian --sparse .claude-plugin --sparse plugin
    codex plugin add semgrep@semgrep-marketplace
    ```
  </Step>

  <Step title="Start a new Codex session">
    Start a new Codex session so the plugin loads:

    ```bash theme={null}
    codex
    ```
  </Step>

  <Step title="Sign in to Semgrep">
    Ask Codex:

    ```
    Log in to Semgrep Guardian.
    ```

    Complete the sign-in prompts in your browser.
  </Step>

  <Step title="Confirm you're signed in">
    Ask Codex:

    ```
    Who am I logged in as in Semgrep Guardian?
    ```

    Codex confirms your identity and Semgrep deployment.
  </Step>
</Steps>

To verify the installation from your terminal, run:

```bash theme={null}
codex plugin list --json
```

<Info>
  **For Windows machines:** [Windows Subsystem for Linux (WSL)](https://learn.microsoft.com/en-us/windows/wsl/install) is required. Native Windows is unsupported.
</Info>

## What rules does this setup use?

The Codex plugin scans with the fixed [`guardian-default`](https://semgrep.dev/p/guardian-default) ruleset. Rules enabled in your organization's Policies don't apply. See [Rules and configuration](/semgrep-guardian/rules-and-configuration) for more information.

## Next steps

* [Enterprise deployment](/semgrep-guardian/enterprise-deployment) for authentication and organization-wide deployment
* [Semgrep Guardian overview](/semgrep-guardian/overview)
* [Rules and configuration](/semgrep-guardian/rules-and-configuration)
