Skip to Content
Rius

What does a session in Codex (beta) look like as a trace?

Rius shows a Codex (beta) session as one trace, with the session as the root and each turn, model call, tool call and subagent nested below it. Each model call carries its model and token counts, and each tool call carries its name and error status. Prompts, replies and tool output appear only for folders where you turned content on.

How it works

The Rius plugin reads a Codex (beta) session and builds the trace as the session runs. The tree looks like this:

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

What is on each span:

  • Session (root). The whole session, with its timing and status. Resuming it with codex resume or codex exec resume continues the same trace.
  • Turn. One prompt and everything it caused.
  • Model call. The model name and the input, cached, output and reasoning token counts. Rius works out the cost from them.
  • Tool call. The tool name and an error type when it fails. A command that exits non-zero is marked as an error, and so is a failed MCP tool.
  • Subagent. The spawn_agent tool call that started it, then the subagent as its own agent span with its own turns, model calls and tool calls.

Every span also carries user.id, set to the email you signed in with, from plugin 0.6.2. That is how sessions appear under your name on the Users page. Sessions sent with a key you stored yourself carry no user.

Codex does not tell plugins when a session ends. The trace shows as in progress until the next Codex session you start on the same key, once the old session’s process has exited and it has been idle for about an hour. The trace then ends at the last thing the session did. Sessions started with codex exec --ephemeral are not traced.

Set it up

  1. Install the plugin. It needs Python 3.9 or later on your PATH, and macOS or Linux.
codex plugin marketplace add glassflow/rius-coding-agents codex plugin add rius@rius-coding-agents
  1. In Codex (beta), open /hooks and trust the five rius hooks: SessionStart, UserPromptSubmit, PostToolUse, Stop and SubagentStop. Until you do, nothing is traced.
  2. Run $rius:rius-login, approve the sandbox escalation, pick a workspace in the browser and click Connect.
  3. In the repo you want traced, run $rius:rius-enable-here for structure only, or $rius:rius-enable-content-here to add prompts, replies and tool output. Then run $rius:rius-status to confirm the folder is traced.
  4. Work as usual, then open the session in the trace list in the console. The waterfall shows each turn, model call, tool call and subagent in order.

The full walkthrough, including signing out and troubleshooting, is in Codex (beta). The other coding agents are compared on Coding agents.

What you get

  • One trace per session, so you can go from a session that cost too much or went wrong to the exact turn, model call or tool call.
  • Tokens and cost on each model call. Cost is a list-price estimate at API rates, so on a ChatGPT plan it measures usage, not what you pay. OpenAI does not report cache-write tokens, so none are shown.
  • Subagents in place. Each subagent sits under the spawn_agent call that started it, with its own calls and tokens.
  • Two capture levels. Structure only gives the span tree, timing, status, model names, tokens, cost, tool names, error types and subagents. With content on, you also get your prompts, Codex’s replies, and tool inputs and outputs. The plugin replaces the secrets it recognizes first and caps each value at 32 KB. This is best effort, so a secret in a format it does not know is sent.
  • An agent named codex on the Agents page, with an open session shown as a live instance.

Two gaps to know. Model-call start times are approximate. A failed tool call is marked as an error only when a command exits non-zero or an MCP tool fails, so other failures look like success.

When something else fits

  • If you roll out Claude Code to a team and want per-developer cost, read Track Claude Code usage and cost across a team.
  • If you need a trace closed the moment a session ends, note that Codex gives the plugin no end signal, so a trace stays in progress for about an hour.

Still stuck? Get help

Last updated on