Codex (beta)
The Rius plugin also runs in the Codex CLI. Each Codex session becomes one trace in Rius, with your prompts, every model call with its tokens, every tool call, and the subagents Codex started. The plugin also brings the Rius MCP server, so you can ask Codex about those sessions.
Beta. Codex support needs version 0.6.0 or later of the Rius plugin. It is tested with codex-cli 0.144.1. The same plugin traces Claude Code and Cursor; each one keeps its own sign-in, key, and folder rules.
Try it in 5 minutes
- Install. In a terminal, run
codex plugin marketplace add glassflow/rius-coding-agents, thencodex plugin add rius@rius-coding-agents. See Install. - Trust the hooks. In Codex, open
/hooksand trust the fiveriushooks. See Trust the hooks. - Sign in. Type
$rius:rius-login, approve the sandbox escalation, then pick a workspace in the browser and click Connect. See Sign in. - Turn tracing on. In a repo, run
$rius:rius-enable-here, then$rius:rius-status. See Choose which folders are traced. - Work as usual, then find the session in the trace list at
console.rius-glassflow.com. - Ask about it. Run
codex mcp login riusonce, then ask Codex “list my recent Codex sessions in Rius”. See Query your sessions.
Requirements
- The Codex CLI with plugin support.
- Python 3.9 or later on your
PATH. The plugin uses only the standard library. - macOS or Linux. Windows is untested for Codex.
Install
codex plugin marketplace add glassflow/rius-coding-agents
codex plugin add rius@rius-coding-agentsInstalling sends nothing. Tracing stays off for every folder until you enable one.
Trust the hooks
Codex runs no plugin hook until you approve it. Open /hooks in Codex and
trust the five rius hooks: SessionStart, UserPromptSubmit, PostToolUse,
Stop, and SubagentStop.
Until you do, nothing is traced and Codex doesn’t tell you. The Hooks:
line of $rius:rius-status counts the approved ones, so check it if a
session doesn’t show up. Codex keeps the approval across plugin updates,
and asks again if a new version changes the hooks.
Sign in
The plugin’s commands are Codex skills. Type $ and pick one. Codex never
runs them on its own, so only you can start one, and it may ask before
running the command behind it.
$rius:rius-loginLogin writes to ~/.codex/rius/ and needs the network, so in the default
sandbox Codex asks you to approve an escalation. Then, in the browser:
- Sign in, or sign up if you don’t have an account yet.
- Check that the page shows the same code, and the name of your machine. Only continue if you just started the sign-in yourself.
- Choose the workspace this machine sends sessions to.
- Click Connect.
If the sandbox won’t allow it, run the same command from a terminal:
bash ~/.codex/plugins/cache/rius-coding-agents/rius/<version>/scripts/rius_ctl.sh login --agent codexIt prints a link and a code. Approve in the browser, then run the same
command again with login-wait in place of login.
Signing in stores one key for this machine in
~/.codex/rius/credentials.json, readable only by you. It is separate from
the Claude Code key: signing out of one doesn’t sign out the other. Rius
always keeps it under your own home folder, even if CODEX_HOME points
somewhere else. The key is listed under Settings → API keys in the console, where a workspace
admin can revoke it.
Choose which folders are traced
Tracing is off everywhere until you turn it on for a folder. The enable and
disable skills write to ~/.codex/rius/, so Codex asks you to approve them.
| Skill | What it does |
|---|---|
$rius:rius-enable-here | Trace this folder and everything under it, structure only |
$rius:rius-enable-content-here | The same, plus prompts, replies, and tool output, with secrets removed |
$rius:rius-disable-here | Stop tracing this folder. A disabled folder beats any enabled parent. |
$rius:rius-on, $rius:rius-off | Turn tracing on or off for this session only |
$rius:rius-status | Whether this folder is traced and why, the account, the key, and the hooks |
$rius:rius-logout | Revoke the key and delete it from this machine |
The rules apply to every Codex session on the machine, and are separate from the Claude Code ones.
What you see in the console
- Traces. Each session is one trace. Resuming it, with
codex resumeorcodex exec resume, continues the same trace. - Agents. Sessions show up as an agent named
codexon the Agents page. An open session is a live instance. The agent’s trace, error, and cost figures count a session once its trace is closed. - Users. The plugin doesn’t set an end user, so sessions land in the anonymous row of the Users page. The Sent by column in the trace list shows whose key sent each one.
When a trace closes
Codex doesn’t tell plugins when a session ends. So a Codex trace is closed by the next Codex session you start on the same key, once the old session’s Codex process has exited and it has been idle for about an hour. The trace ends at the last thing the session did. Until then it shows as in progress.
codex exec --ephemeral sessions aren’t traced, because Codex keeps no
record of them for the plugin to read.
What gets captured
AGENT codex session
└─ CHAIN a turn: one prompt and everything it caused
└─ LLM a model call: model, input, cached, output, and reasoning tokens
├─ TOOL a tool call. A command that exits non-zero is an error.
└─ TOOL spawn_agent: the call that started a subagent
└─ AGENT the subagent, with its own turns and calls| Captured | Structure only (default) | With content |
|---|---|---|
| Span tree, timing, status | ✓ | ✓ |
| Model names, tokens, cost | ✓ | ✓ |
| Tool names, error types, subagents | ✓ | ✓ |
| Your prompts and Codex’s replies | ✗ | ✓ |
| Tool inputs and outputs | ✗ | ✓ |
With content on, the plugin replaces the secrets it recognizes, such as cloud and API keys, tokens, and private keys, with a marker before anything is sent, and caps each value at 32 KB. This is best effort: a secret in a format it doesn’t know is sent.
Cost is worked out from token counts at API rates, so it isn’t what you pay on a ChatGPT plan.
The plugin contacts three hosts and nothing else:
ingest.eu.console.rius-glassflow.com for traces,
connect.console.rius-glassflow.com for sign-in and sign-out, and
mcp.eu.console.rius-glassflow.com when you use the MCP tools.
Query your sessions from Codex
The plugin registers the Rius MCP server as rius. It signs in on its own,
through your Rius account, so run this once:
codex mcp login riusThis is a second sign-in, separate from $rius:rius-login. Then ask in
plain language:
- “Which of my Codex sessions this week used the most tokens?”
- “Show me my last failed session and which command went wrong.”
The tools reference lists everything the server can answer.
Use a key you made in the console
To trace with a key you created under Settings → API keys (with Send telemetry), store it from a terminal. The command reads the key from standard input (here, the clipboard on macOS), so it never lands in your shell history:
pbpaste | bash ~/.codex/plugins/cache/rius-coding-agents/rius/<version>/scripts/rius_ctl.sh use-key --agent codexSetting RIUS_API_KEY or RIUS_ENDPOINT in the environment does nothing.
A repository can set environment variables for Codex, so the plugin only
uses a key you stored yourself.
Settings
These are environment variables. They can only turn things off.
| Variable | What it does |
|---|---|
RIUS_CAPTURE_CONTENT | false sends structure only from every folder |
RIUS_CODEX_ENABLED | false turns tracing off everywhere |
RIUS_CODEX_MAX_ATTR_BYTES | Lowers the 32 KB cap on each captured value |
RIUS_CODEX_DEBUG | true writes verbose logs to ~/.codex/rius/log/ |
Sign out and uninstall
Run $rius:rius-logout first. It revokes the key and deletes it from this
machine; if you skip it, the key stays valid until it expires. Then remove
the plugin, and delete ~/.codex/rius/ to remove folder rules, logs, and
session state:
rm -rf ~/.codex/rius/Troubleshooting
Start with $rius:rius-status.
Hooks:shows fewer than 5 approved. Open/hooksand trust theriushooks.- The
Reasonline says no path rule matches. Run$rius:rius-enable-herein this folder. - The
Reasonline says there is no key. Run$rius:rius-login. - A session stays in progress. That’s expected for about an hour after you exit Codex. It closes when you start your next Codex session.
- The MCP tools answer 401. Run
codex mcp login rius.
Known gaps
- Model-call start times are approximate.
- OpenAI doesn’t report cache-write tokens, so none are shown.
- A failed tool call is marked as an error only when a command exits non-zero or an MCP tool fails. Other failures look like success.