---
title: OpenAI Codex
description: Run OpenAI's Codex CLI against any Mirage workspace by mounting it as a real filesystem via FUSE.
icon: /images/openai-logo.svg
---

[OpenAI Codex](https://github.com/openai/codex) can use Mirage through either an installable [TypeScript plugin](/typescript/agents/codex) or a FUSE mount. The Python integration [FUSE-mounts](/python/setup/fuse) a workspace as a normal host directory, so Codex's built-in filesystem and shell tools operate on Mirage without a separate tool server.

## Install

```bash
uv add 'mirage-ai[fuse]'
```

Then install [OpenAI Codex](https://github.com/openai/codex) separately.

## Usage

```python
from mirage import Mount, MountBackend, MountMode, Workspace
from mirage.resource.ram import RAMResource

with Workspace(
    {"/": Mount(RAMResource(), mode=MountMode.WRITE, backend=MountBackend.FUSE)}) as ws:
    print(f"cd {ws.fuse_mountpoint} && codex")
    input("Press Enter when done...")
```

The mountpoint behaves like a regular directory. Codex's built-in file and shell tools all dispatch through Mirage's ops layer. For the Codex app, open the mountpoint as the project folder instead of starting `codex` from it.

## FUSE or plugin?

Use Python FUSE when you want Codex's built-in filesystem tools to see Mirage as an ordinary directory. This works in the CLI and app, but requires an OS FUSE driver and does not add Mirage's agent-level stale-write check.

Use the [TypeScript plugin](/typescript/agents/codex) when you want named Mirage tools, Pi-style stale-write protection, and plugin installation through Codex. The plugin uses Mirage's standard MCP adapter internally.
