CLM integration

CLM for Codex

Install CLM's lifecycle hooks and the clm_pick_model tool, sign in with the device flow, then review the hooks when Codex next starts.

about 5 minutesCodex 0.150+Python 3.9+

Prerequisites

  • Codex 0.150 or newer, installed and signed in.
  • Git and Python 3.9 or newer available in your terminal.
  • A browser and Metatheory team account for CLM device sign-in.
What this adds

The installer registers lifecycle hooks for behavior checks and tool-call observation, plus an MCP tool that helps the main agent choose a model for subagents. Codex keeps its own approval and sandbox rules.

Step 1

Clone the public repository

git clone https://github.com/metatheoryinc/CLM-Hosted.git
cd CLM-Hosted

The installer copies the integration into your Codex home. Keep the clone if you want to pull and reinstall updates later.

Step 2

Install and sign in

python3 integrations/codex/install.py

When no key is already configured, the installer prints a link and short code. Open the link, sign in with your Metatheory Google account and approve the code. The key is stored in a private local config file shared with the Claude Code integration.

Review on the next launch

The next time Codex starts, it asks you to review and trust the new hooks. They do not run until you accept them. The Sign in page approves device codes and manages issued keys; it does not display the returned secret.

Step 3

Verify the installation

python3 integrations/codex/install.py status

Status reports the registered hook events, copied hook files and whether a CLM key is set. After you trust the hooks and start a session, behavior checks are active by default and tool-call classification remains in shadow mode.

Enable subagent model picks

The installer registers clm_pick_model. To make its use consistent, add the following instruction to your project's AGENTS.md:

Before you call spawn_agent, call the clm_pick_model tool with the task exactly as you will give it to the subagent, and pass the model and reasoning_effort it returns to spawn_agent.

The tool reads the subagent task and returns a configured Codex model and reasoning effort. It does not run the subagent or grant approval for other tools. If CLM is unavailable, it returns the configured middle-tier fallback.

Update or remove

Pull the current repository and rerun the installer to update the copied files:

git pull
python3 integrations/codex/install.py

Remove the hooks, copied files and MCP registration with:

python3 integrations/codex/install.py uninstall

Uninstall preserves the shared CLM config. Add --purge only if you also intend to delete that config and key.

What leaves your machine

The Codex hooks use the same bounded, best-effort-redacted payloads as the Claude Code integration. Tool checks can send a tool name, clipped arguments, working directory and permission mode. Behavior checks can send a bounded rendering of recent prompts, messages, tool calls, results and the final reply. Codex transcript paths, encrypted reasoning and content outside that rendering are not sent by the hook.

The model picker sends the task passed to clm_pick_model. CLM decisions and labels are recorded in the shared collector under your agent identity.

Billing

Codex turns use your OpenAI account. When an uncertain behavior needs a judge, the integration runs a separate Codex command on that account. CLM does not supply provider capacity, and routing does not guarantee lower cost or better results.

Get help

Run installer status first. If hooks are present but inactive, restart Codex and complete its hook review. The detailed reference covers configuration, shadow mode and manual status commands.