Expanded documentation image

Codex Setup

Use this guide to connect Codex to Lens Studio, install the CLAD Lens Studio plugin, and start building a SPECS Lens.

Before You Start

Before you start, make sure:

  1. A Lens Studio project prepared for SPECS is open in the Lens Studio editor — Setup Lens Studio.
  2. A terminal is open in the Lens Studio project folder — Open Project in CLI.

Note: The order of these setup steps matter. Lens Studio must be opened first so that it can create an MCP for the terminal to auto-connect to.

Install Codex

Please review Codex documentation on how to install Codex CLI: https://chatgpt.com/codex/

Select your platform:

curl -fsSL https://chatgpt.com/codex/install.sh | bash

curl -fsSL downloads the install script from the URL (-L follows redirects). Piping to bash runs that script in your shell.

irm https://chatgpt.com/codex/install.ps1 | iex

iex is shorthand for Invoke-Expression. This downloads the install script with irm (Invoke-RestMethod) and runs it.

After installation, confirm the CLI is available:

codex --version

Start Codex

From your Lens Studio project folder, start Codex in CLI:

codex

Codex may request you to trust this folder. If you see the following message, select “Yes, continue”.

Install the plugin marketplace

Some of the following commands are for Codex, not terminal. To verify you are typing into Codex, ensure that the line you are typing does not come after a path, like “Documents/NewProject >” shown below on the left. The line should instead be blank besides a single “>” as shown below on the right.

TerminalCodex

For the most up-to-date installation steps, please refer to the ls-extensions repository readme, which can be accessed here: https://github.com/lens-studio-devs/ls-extensions.

In Codex, add the ls-extensions plugin marketplace:

codex plugin marketplace add https://github.com/lens-studio-devs/ls-extensions.git

Alternatively, add the marketplace through the Codex UI:

  • In Codex, enter /plugins.
  • Navigate to the Add Marketplace section, then select “Add marketplace”.
  • Enter in the Marketplace url for Lens Studio Agent Extensions:

    https://github.com/lens-studio-devs/ls-extensions.git

Install the CLAD plugin

After the marketplace is added, install the CLAD plugin from it.

In the Codex UI:

  • Navigate to the section named [ls-extensions] and select “Press Enter to install or view plugin details”.
  • Then select “Install this plugin now.”

For additional instructions on Codex plugins, please view their documentation.

Verify Plugin Installation

To confirm installation, open the plugin menu:

/plugins

Navigate to the Installed tab and verify that the Lens Studio CLAD plugin, “ls-clad”, appears.

Verify MCP Connection

Press Esc to close back to the chat dialog inside Codex, then check the connected MCP servers:

/mcp

You should see “lens-studio” appear automatically in the list.

Tips for troubleshooting MCP connection: Troubleshoot Lens Studio MCP.

Enable Auto-Approval Mode

To avoid approving many individual permissions, you can enter the following command into CLI, or enter it into Codex and it will make the requested changes.

codex config set approval_policy "on-request" && codex config set approvals_reviewer "auto_review"

Start Building

Ask Codex to build a SPECS Lens. Example prompt:

Using SPECS experience builder, can you please build me a periodic table SPECS Lens showing the atomic structure of various elements?

Note: Codex performs best when you use the phrase “Using SPECS experience builder” in your prompt.

Await Completion

Let Codex work. A full Lens build can take 30+ minutes.