Skip to navigation

Manage Persistent Integrations

View as MarkdownOpen in Claude

Install a persistent integration so you can start your coding agent normally and load NeMo Relay without a nemo-relay run command. This page covers installation, verification, updates, and removal.

The setup differs by coding agent:

Coding AgentWhat Loads When It StartsGateway Startup
Claude CodeA generated Relay plugin that starts nemo-relay mcp and invokes Relay lifecycle hooks.nemo-relay mcp starts or reuses a background Relay gateway.
CodexA generated Relay plugin, provider configuration, and verified lifecycle hooks.nemo-relay mcp starts or reuses the same background gateway used by Claude Code.

The gateway is a nemo-relay process that receives agent events and forwards configured model requests. The background gateway managed by Claude Code and Codex is also called the shared sidecar in the detailed sections below.

For agent-specific capture behavior and limitations, see the Claude Code or Codex guide.

Requirements

Install the NeMo Relay CLI and make nemo-relay available on PATH or %PATH%. The installer uses this executable; it does not download another Relay binary or install a Relay daemon.

To use the integration, make the selected coding-agent CLI available:

Coding AgentCommandVersion
Claude Codeclaude2.1.121 or newer
Codexcodex0.150.0 or newer

For Claude Code and Codex, install and doctor reject unsupported, malformed, and prerelease versions before changing agent configuration.

Prepare Relay Configuration

Before expecting exported activity, configure the exporter and any required provider settings.

nemo-relay config edit writes the user config.toml, and nemo-relay plugins edit writes the user plugins.toml. By default, these are ~/.config/nemo-relay/config.toml and ~/.config/nemo-relay/plugins.toml. An absolute XDG_CONFIG_HOME changes their directory to $XDG_CONFIG_HOME/nemo-relay. On Windows, Relay uses USERPROFILE when HOME is unavailable.

The Relay gateway reads these files when resolving its configuration. System configuration can also apply. See Shared Configuration for system file locations and precedence.

For the generated Claude Code and Codex integrations, the shared gateway uses system and user configuration. It does not automatically select a project’s .nemo-relay/config.toml or .nemo-relay/plugins.toml, including files created during a quick start.

To select project configuration for an individual run, use an explicit launch:

nemo-relay --config .nemo-relay/config.toml run -- codex

See Use Project Configuration for file selection, and Provider Authentication for credentials.

Install a Persistent Integration

To review the generated files and agent settings before installing, see What Install Changes.

  1. Optional: Preview installation without changing agent configuration:

    nemo-relay install codex --dry-run

    Replace codex with claude-code for Claude Code.

  2. Run the installation command for your coding agent. Choose one:

    nemo-relay install claude-code
    nemo-relay install codex
  3. Close existing sessions and start a new coding-agent process. Restart the Codex desktop app if it was already running so it reloads the provider, environment, and hook configuration.

    For Claude Code or Codex, start claude or codex normally. The installed integration starts or reuses its shared gateway.

Continue with Verify the Installation.

Installation Options

For Claude Code and Codex, --install-dir selects a different generated marketplace directory.

The tables below use <install-root> for the selected directory:

PlatformDefault Install Root
macOS~/Library/Application Support/nemo-relay/plugins
Linux$XDG_DATA_HOME/nemo-relay/plugins when XDG_DATA_HOME is absolute; otherwise ~/.local/share/nemo-relay/plugins
Windows%LOCALAPPDATA%\nemo-relay\plugins; otherwise AppData\Local\nemo-relay\plugins beneath HOME, or USERPROFILE when HOME is unavailable

Relay serializes install, force-install, rollback, and uninstall operations for each user and host, even when two operations name different install directories. If another operation is still active after a short wait, Relay stops with a timeout instead of changing host-wide plugin state concurrently.

Verify the Installation

  1. Check the installed integration. Choose the command for your coding agent:

    nemo-relay doctor --plugin claude-code
    nemo-relay doctor --plugin codex

    Resolve failed checks before continuing. For Claude Code and Codex, a stopped shared gateway can be informational: the next coding-agent session starts it.

  2. Start a new session and perform a small task. Follow the export verification instructions for Claude Code or Codex.

Doctor checks installation and readiness. It does not prove that a model request succeeded or that an exporter delivered the resulting activity.

For detailed checks and custom installation directories, see Diagnostic Reference. For runtime or exporter failures, see Troubleshoot the CLI.

Refresh Installed Integrations

After upgrading the nemo-relay binary, refresh every Relay-managed Codex and Claude Code installation with:

nemo-relay integrations refresh

Refresh retires each old MCP generation, stops the authenticated Relay-owned sidecar, and republishes the integration from the current binary. Restart the affected host clients afterward. To bring a legacy custom-directory installation under Relay management, reinstall the appropriate host before refreshing it:

nemo-relay install codex --install-dir <path-to-plugins> --force
nemo-relay integrations refresh

Refresh preflight validates installed targets and retires their active MCP generations. A preflight failure stops the refresh before any target is attempted. A deleted Codex marketplace has no generation to retire, so its recovery remains in the per-target forced-install loop. If its surviving lock is unsafe, Relay reports that target, continues refreshing the others, and returns an error after every target has been attempted.

Manual MCP configurations are not changed; reinstall them through Relay if you want Relay to manage future refreshes.

Uninstall

Close the coding agent before removing its integration.

Run the command for the installed integration that you want to remove:

nemo-relay uninstall claude-code
nemo-relay uninstall codex

Uninstall removes Codex provider configuration and trust for the exact plugin hooks before unregistering the plugin, while Codex can still report its hook metadata. It then removes the host registration and marketplace. Claude Code provider routing is restored from the Relay backup. Unrelated user hooks and configuration remain unchanged.

Start a new coding-agent process after removal. Restart the Codex desktop app if it was running so it reloads configuration without Relay’s managed settings.

Run the corresponding doctor command to inspect the remaining installation state.

Installation Details

What Install Changes

For Claude Code and Codex, nemo-relay install writes a local marketplace named nemo-relay-local, then registers the generated nemo-relay-plugin package with the selected host.

Relay writes the following files during installation. The coding agent reads its settings and generated plugin files when a new process starts.

FilesWriter and ReaderPurpose
~/.claude/settings.jsonRelay updates it; Claude Code reads it.Sets env.ANTHROPIC_BASE_URL for Relay routing and adds CLAUDE_CODE_GATEWAY_HINT_HEADERS when absent.
~/.claude/settings.json.nemo-relay.bakRelay writes and reads it.Records prior settings needed to restore Relay-managed changes.
$CODEX_HOME/config.toml, default ~/.codex/config.tomlRelay updates it; Codex reads it.Configures provider routing, hooks, and related managed settings.
$CODEX_HOME/config.toml.nemo-relay.bak, default ~/.codex/config.toml.nemo-relay.bakRelay writes and reads it.Records prior Codex configuration for restoration.
$CODEX_HOME/.env, default ~/.codex/.envRelay manages an authentication block; Codex reads it after restart.Supplies the OPENAI_PROJECT assignment used for Relay client proof while preserving unrelated settings.

For Claude Code, <plugin-root> is <install-root>/claude-code-marketplace/plugins/nemo-relay-plugin. For Codex, it is <install-root>/codex-marketplace/plugins/nemo-relay-plugin.

Generated FilesReader and Purpose
<plugin-root>/.mcp.jsonThe coding agent reads this to start nemo-relay mcp.
<plugin-root>/hooks/hooks.jsonThe coding agent reads this to invoke nemo-relay hook-forward for supported lifecycle events.
<plugin-root>/.nemo-relay-hook-config.jsonhook-forward reads the gateway address and installation identity needed for delivery.
<plugin-root>/.nemo-relay-generationRelay’s MCP and hook processes use this to reject cached commands from a retired installation.

Relay also generates marketplace and plugin manifests and registers them through the coding agent’s plugin commands. Use Relay’s install, refresh, doctor, and uninstall commands to manage these generated files.

For Claude Code, nemo-relay install claude-code registers the local marketplace, installs nemo-relay-plugin@nemo-relay-local at user scope, and enables provider routing through the local NeMo Relay sidecar. Relay preserves existing Claude authentication and model settings and backs them up only when it adds the provider route. The plugin also declares the native nemo-relay mcp lifecycle client.

For Codex, nemo-relay install codex registers the local marketplace, installs nemo-relay-plugin@nemo-relay-local, enables Codex hooks, and configures the Codex built-in openai provider to use the local Relay sidecar. The installed base URL contains no credential. A managed assignment in $CODEX_HOME/.env provides the per-user proof through Codex’s OpenAI-Project header after restart. Relay validates and removes that proof before observability and forwarding, preserving any original project value. Installation and removal preserve other .env settings. Restart Codex after either operation; no special launcher is required. Legacy capability URLs remain supported for older installations. The installer retains a nemo-relay-openai provider alias only so sessions created by earlier Relay versions remain resumable. The plugin’s hooks/hooks.json is the sole persistent Relay hook source. The installer uses the Codex app-server API to select hooks by plugin ID, exact canonical command, and event definition. It never trusts unrelated user, project, or plugin hooks. If Codex does not discover exactly one enabled and trusted handler for every generated event—SessionStart, UserPromptSubmit, PreToolUse, PostToolUse, SubagentStart, SubagentStop, Stop, PreCompact, PostCompact, SessionEnd, and Interrupt—installation restores the previous Codex config, legacy hooks, Relay backup files, and every original targeted trust entry. These eleven events are the complete Relay-generated Codex hook set; Relay does not generate PermissionRequest, PostToolUseFailure, or Notification handlers. Upgrade removes legacy Relay groups from $CODEX_HOME/hooks.json (default ~/.codex/hooks.json) while preserving unrelated hooks.

After upgrading to a release with file-backed hook configuration, uninstall and reinstall the Relay plugin so the coding-agent host refreshes its stored hook commands and trust hashes.

Generated hooks invoke the native Relay binary with a short private --hook-config path. The private Relay-owned file contains the gateway URL, generation fence, and hook lifecycle settings, so host-managed hook configuration does not expose those values or exceed Windows command-length limits. Both install and doctor verify the generated command and event ownership.

On Unix, Relay creates the plugin root and temporary hook directories with mode 0700. Hook configuration files use mode 0600. These permissions allow only the owner to access the directories and files, even when your umask is 0002.

If nemo-relay doctor reports unsafe permissions on the hook configuration directory, run nemo-relay install <host> --force. Replace <host> with claude-code or codex. This recreates the plugin with safe permissions.

How Claude Code and Codex Connect

Each persistent integration forwards the lifecycle signals that its host exposes, including agent, subagent, tool, prompt, compaction, and stop events where available. Model-provider routing sends LLM traffic through the local NeMo Relay gateway. Hooks alone cannot capture complete LLM request and response spans.

Both integrations share the same lifecycle gateway. Provider traffic joins that gateway when routing is configured for the host:

Codex / Claude Code
|-> Relay MCP lifecycle client -------> shared Relay gateway
|-> generated lifecycle hooks --------> shared Relay gateway
\-> provider route (when configured) -> shared Relay gateway -> model provider

Each agent starts its own lightweight MCP stdio process. Those processes share one compatible gateway. Generated lifecycle hooks use hook-forward to deliver their canonical payloads to that same gateway.

Shared Gateway Lifecycle

Claude Code and Codex processes use the same nemo-relay mcp lifecycle client. Before reading MCP protocol frames, it starts or reuses a detached native sidecar on 127.0.0.1:47632. The client authenticates Relay with a per-user bootstrap proof and confirms its version and protocol readiness. It binds the effective user-level configuration fingerprint into that proof without requiring it to match the running gateway’s fingerprint. Therefore, a configuration-only difference does not reject or replace a healthy gateway: clients that share the same user bootstrap state can reuse it. The fingerprint does not expose credentials or configuration secrets, and it is not the gateway ownership boundary.

The client heartbeats the sidecar every 3 seconds by default. Relay shortens the default automatically when necessary to keep it below the gateway idle timeout. Set NEMO_RELAY_PLUGIN_HEARTBEAT_INTERVAL_SECS to a positive integer shorter than the idle timeout to override it. Concurrent Claude Code and Codex MCP clients that share the bootstrap state reuse the gateway. After the final MCP client closes, the sidecar exits after 300 idle seconds by default. If the gateway exits while MCP stdio is open, the client performs one coordinated restart and fails if recovery does not succeed. Relay reports a port conflict for a foreign process instead of accepting it merely because it returned HTTP 200.

For a cold start, the lifecycle client allows up to 20 seconds from spawning a sidecar until authenticated readiness. This window includes persistent configuration resolution, listener binding, and readiness publication. If the window expires, the MCP session fails and the coding agent cannot send requests through Relay. Restart the coding agent to make a new startup attempt. If the failure recurs, inspect the gateway_acquisition_failed event with failure_kind = "gateway_readiness_timeout" in Relay’s operational log before collecting support diagnostics.

Health and readiness responses include a per-process instance ID. A per-user startup lock serializes launch and recovery, while a small recovery record lets overlapping MCP clients share the same restart attempt. The gateway tracks its own activity, idle shutdown, and authenticated ownership-record cleanup.

When a newly launched MCP client detects a verified Relay-owned gateway from a different Relay version, it stops that old sidecar and starts a matching one. This intentionally interrupts MCP clients still attached to the old gateway.

Codex marks the MCP server as required, so the captured turn waits for verified gateway readiness. Claude Code 2.1.121 or newer uses alwaysLoad, which blocks session startup until the MCP connection is ready. Installed MCP entries and hook-forward commands carry both the generation-file path and the immutable identity expected at that path. This prevents a host process with cached plugin configuration from adopting a replacement installation after --force. Persistent hooks wait for the MCP-owned gateway, verify it on the same connection used for delivery, and send the canonical payload once. They never start or recover the gateway, and Relay does not retry after payload transmission begins. The MCP server advertises no tools in any host.

Dynamic plugin manifests, artifacts, and signatures included in this identity must be regular files. Relay limits the complete activation snapshot—including adjacent runtime files and a copied managed Python environment—to 100,000 filesystem entries, 512 MiB, and a maximum directory traversal depth of 128. When startup reports an activation snapshot budget error, remove unrelated files from the manifest or load-target directory, flatten deeply nested directories, or reduce the managed Python environment before retrying.

To explicitly stop the managed shared gateway, first close active MCP clients, then run:

nemo-relay --bind 127.0.0.1:47632 gateway stop

The command resolves the process listening at that exact loopback address, verifies that its executable is named nemo-relay or nemo-relay-pinned, and stops it. It can only stop a gateway running on the local machine; remote gateway processes are not supported. An open MCP client can restart the managed gateway as part of its one allowed recovery.

nemo-relay gateway start starts the gateway server. nemo-relay gateway stop stops that gateway at the default endpoint, 127.0.0.1:4040. Pass the same --bind value to both commands for a custom endpoint. On Unix, add --force to terminate the process immediately instead of requesting a graceful shutdown. Windows always terminates the gateway process tree.

Hook Delivery and Upgrade Safety

Before contacting the gateway, Relay rejects a fixed-endpoint hook-forward command that lacks a valid installer-owned generation fence. Generated persistent hook commands reference a private Relay-owned configuration file; that file contains the generation-file path and immutable generation identity. Relay uses the configured hook failure policy. This prevents a legacy hook retained by a host process from reviving a retired installation. If install or uninstall reports a missing or invalid generation marker, follow the error’s cleanup instructions. If the generated Codex marketplace was deleted but its registration remains, see Recover a Deleted Codex Marketplace. For other missing or invalid generation markers, or when forced recovery cannot validate the surviving lock, follow the error’s manual cleanup instructions: close the host and standalone nemo-relay mcp processes, remove the stale registration and state it identifies, and then run the requested --force command.

Transparent hooks reference a temporary private configuration file containing their process-private gateway URL and never recover a persistent gateway, so they do not need this fence. Source plugins and custom automation can use --forward-only to contact an existing gateway without a fence. That mode waits for an authenticated, configuration-compatible Relay gateway and rejects foreign or incompatible listeners before it sends the payload. Authentication and delivery use the same TCP connection, so a process that replaces the listener after a health probe cannot receive lifecycle data. The mode never launches or recovers Relay.

Relay cannot guarantee exactly-once delivery if the gateway fails after it accepts a request. It does not keep a durable hook outbox or deduplication journal. The opt-in end-to-end tests verify exactly-once lifecycle output for the healthy and cold-start paths they exercise, not for arbitrary crashes between request acceptance and response delivery.

On Windows, Relay requests Job Object breakaway when the host job permits it. When breakaway is unavailable and the host permits nested assignment, the gateway remains scoped to the host job and can exit before the normal idle reuse window. If the host rejects nested assignment, persistent bootstrap stops and explains the conflict instead of running without process-tree cleanup guarantees. Managed workers launched for MCP hosts follow the same rule.

The compatibility fingerprint covers resolved provider, exporter, dynamic plugin, and relevant environment settings without exposing their values in the health response. For Claude Code and Codex, nemo-relay install <host> --force rotates the immutable MCP and hook generation identity, then uses a private ownership token to stop the shared fixed-endpoint gateway as one serialized operation. Ownership is keyed by endpoint rather than host, so an upgrade from any installed host can retire a gateway that another host originally started.

Relay leaves custom managed endpoints untouched and never sends its shutdown token to an unrelated listener.

Configuration and Credentials

For configuration files and project selection, see Prepare Relay Configuration.

Each coding agent supplies environment settings differently:

  • Codex stores the names of forwarded variables for provider credentials, Relay settings, OpenTelemetry, AWS, proxies, certificates, and supported credential variables referenced by user observability configuration.
  • Claude Code supplies its normal plugin MCP environment.

For Codex’s built-in openai provider, Relay writes a managed OPENAI_PROJECT assignment into $CODEX_HOME/.env, default ~/.codex/.env. After Codex restarts, its OpenAI-Project header carries Relay’s private client proof along with any original project value. Relay validates and removes the proof before observability and upstream forwarding.

The retained nemo-relay-openai provider alias supports older sessions. Its http_headers configuration also contains Relay client proof. This is distinct from the .env mechanism used by the built-in provider.

Codex files containing Relay proof use owner-only permissions on Unix or protected owner/System permissions on Windows. Installation and removal preserve unrelated .env settings. Restart Codex after either operation.

Both managed background gateways and foreground gateways require Relay client proof before using provider credentials from the gateway’s configuration or environment. Requests can still use provider credentials supplied by the coding agent. Starting nemo-relay --bind does not bypass this requirement.

See Provider Authentication for the supported credential paths and their limitations.

Diagnostic Reference

nemo-relay doctor includes every persistent integration it finds. It checks generated marketplace and plugin files where applicable, the Relay binary and hook support, agent version, registration, provider routing, hooks, and sidecar readiness assumptions. For Codex, doctor also asks the Codex app-server whether each exact Relay-generated hook is trusted and enabled. JSON output includes checks.codex_hooks_trusted and a codex_hook_trust object that groups trusted, untrusted, modified, disabled, missing, or duplicated required hooks. A stopped Codex sidecar is informational; the required plugin MCP starts it before the captured turn. Doctor also reports newly required forwarded environment names and recommends nemo-relay install codex --force.

In nemo-relay doctor --json output, a configured but unloadable Codex marketplace is reported with host_marketplace_unloadable: true under the integration’s host_registration object. In that state, host_plugin_registered is null because Codex could not determine whether the plugin is registered.

For Claude Code, doctor also validates version 2.1.121 or newer, the generated alwaysLoad MCP server, and its generation marker. A stopped sidecar remains informational because the next MCP process starts it. Persistent hooks wait for that MCP-owned gateway instead of starting it themselves.

Use the focused plugin doctor when diagnosing one host or an installation that uses a custom directory:

nemo-relay doctor --plugin codex --install-dir /path/to/plugins

If an installed integration is incomplete, doctor reports the failed check and suggests nemo-relay install <host> --force. Agents without a persistent installation remain informational, so transparent-run setup does not require one.

Recover a Deleted Codex Marketplace

If the generated Codex marketplace directory is deleted while Codex still has nemo-relay-local registered, Codex reports the marketplace as present but unloadable and cannot say whether nemo-relay-plugin is registered. Relay recognizes this exact dangling state when both the expected marketplace root and its generation marker are absent. Recovery is explicit:

nemo-relay install codex --force
nemo-relay uninstall codex --force

Use the first command to rebuild the integration or the second to finish removing it. The corresponding command without --force does not change the dangling state and tells you which forced command to run.

Recovery reuses the surviving generation lock and fails before changing anything if that lock cannot be proved safe—for example, if it is missing, malformed, replaced, symlinked, not a regular file, or held by another process, or if the marketplace root or marker reappears while Relay acquires it. In that case, follow the manual-remediation instructions in the error instead of replacing the lock.

During a forced reinstall, removal of the old provider and hooks, plugin registration, and marketplace registration is one cleanup phase. Until all three areas have been cleaned, a failure restores only prior state Relay can prove existed. Marketplace removal is durable progress because the generated tree is already gone, so a later probe failure records that removal and retries forward. After all three are clean, cleanup is committed: a later install failure does not recreate the dangling Codex registration. Relay keeps the validated lock and records the clean progress so another nemo-relay install codex --force or nemo-relay integrations refresh can retry safely. A partially failed forced uninstall is likewise retryable with nemo-relay uninstall codex --force; Relay removes the retained lock and state only after cleanup succeeds completely.

Compatibility and Migration

These integrations require Codex 0.150.0 or Claude Code 2.1.121 at minimum. Relay rejects prerelease or malformed version output. If you configured an opaque wrapper, its --version output must identify the selected host.

The MCP bootstrap is host-neutral. Generated Codex and Claude Code configuration invokes nemo-relay mcp; Hermes-specific --agent hermes selections no longer parse. The --agent option remains supported for Claude Code and Codex run flows. Existing fenced installations can be refreshed with nemo-relay install <host> --force. Relay refuses to replace an older MCP installation without a valid generation marker because a cached host process might still be running. The exact deleted-Codex-marketplace state can be recovered through Recover a Deleted Codex Marketplace when its surviving lock is safe. For other missing-marker states, follow the manual cleanup steps in the error before you retry the forced install.

This release removes the internal nemo-relay plugin-shim command. Refresh a fenced generated installation with nemo-relay install <host> --force; use Recover a Deleted Codex Marketplace for that exact Codex state, and use manual cleanup for other missing-marker states. For custom automation, use these supported replacements:

Removed Internal CommandSupported Replacement
nemo-relay plugin-shim hook <agent>nemo-relay hook-forward <agent> --forward-only with the canonical lifecycle payload on standard input and an existing gateway
nemo-relay plugin-shim servenemo-relay mcp for host-managed lifecycle, or nemo-relay --bind <address> to run a gateway directly
nemo-relay plugin-shim install <agent>nemo-relay install <host>
nemo-relay plugin-shim uninstall <agent>nemo-relay uninstall <host>
nemo-relay plugin-shim provider claude enablenemo-relay install claude-code
nemo-relay plugin-shim provider claude restorenemo-relay uninstall claude-code
nemo-relay plugin-shim provider claude statusnemo-relay doctor --plugin claude-code
nemo-relay plugin-shim doctor <agent>nemo-relay doctor --plugin <host>

Persistent and transparent generated hook commands reference a private Relay hook configuration instead of embedding gateway details. The process environment lets an installed plugin MCP authenticate, borrow, and monitor that exact gateway. Transparent hook delivery authenticates the wrapper gateway before writing its lifecycle payload. When a transparent run uses a recognizable wrapper command, such as npx codex, Relay checks the host version through that wrapper. Opaque custom wrappers remain supported when the configured command emits the selected host’s canonical version output in response to --version. Install and doctor enforce the same minimum-version policy.

Source Marketplace Discovery

This repository also contains source marketplace manifests for development and validation:

  • .claude-plugin/marketplace.json
  • .agents/plugins/marketplace.json

Those manifests are useful when validating host plugin metadata from a source checkout. For end-user setup, use nemo-relay install <host>. For Claude Code and Codex, the command generates the local marketplace, registers the host plugin, and performs the required provider and hook setup. Source manifests do not provide Codex’s complete provider, environment-forwarding, and verified-trust workflow.

Do not keep a source-installed plugin and the generated plugin active for the same host. Both can forward the same lifecycle payload and produce duplicate events. Remove the source-installed plugin before you use the generated install.