npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

codex-ai-replies-cli

v0.6.0

Published

CLI for reading local Codex session rollouts and extracting assistant replies, tool calls, and MCP activity

Readme

codex-ai-replies-cli

Read local Codex session rollouts as a usable CLI transcript.

codex-ai-replies-cli scans ~/.codex/sessions, picks the most recently updated main-agent rollout by default, and turns JSONL session history into readable output. It helps when you want to review what the assistant said, inspect tool-call sequences, or isolate MCP activity without digging through raw rollout files by hand.

Release Status

Current package version: 0.5.1

  • Timeline filtering, rollout selection hardening, and release checks are included
  • npm test, npm run test:release, and npm run release:final are the intended release gates
  • The CLI is ready for normal npm installation and repository-based validation

Why Use It

  • Review assistant replies from a recent Codex run
  • Inspect tool calls and tool outputs alongside assistant messages
  • Isolate MCP activity for debugging or audit work
  • Save a readable transcript to a text file and open it immediately
  • Target a specific session by id or read a rollout file directly

Install

Install from npm:

npm install -g codex-ai-replies-cli

After install, the recommended short command is:

cxr

If you prefer to validate from a clone before or after publishing, run the entrypoint directly:

node bin/codex-ai-replies.js --help

Quick Start

Show assistant replies from the latest main-agent session:

cxr

Keep following the same rollout as new items arrive:

cxr --watch

Start by showing the latest 20 items, then continue streaming new ones:

cxr --watch --count 20

Read a specific session by id:

cxr --id 019d9bb5-d432-7453-a92c-b3376ef23b58

Show a mixed timeline with assistant, tool, and MCP events:

cxr --include-tools --include-mcp

Read RequestUserInput prompts:

cxr --only user-input

Export every raw rollout entry:

cxr --id 019d9bb5-d432-7453-a92c-b3376ef23b58 --only all --save

Read only MCP activity:

cxr --include-mcp

Read only chrome-devtools evaluate_script MCP activity:

cxr --only mcp --mcp-server chrome-devtools --mcp-tool evaluate_script

Save the latest extracted items and open the output file:

cxr --count 20 --save --output ./messages.txt

What The CLI Actually Reads

  • Defaults to ~/.codex/sessions
  • Chooses the most recently updated root/main-agent rollout when no selector is given
  • Excludes subagent rollouts from the default lookup
  • Accepts --id to select a specific session
  • Accepts --raw-file to read one rollout JSONL file directly

When --id could match more than one rollout, the CLI prefers exact rollout identity matches and main-agent/root rollouts over subagent matches.

Output Modes

By default, cxr prints assistant replies only. Timeline-related flags switch it into event selection mode:

  • --include-tools selects tool call and tool output events
  • --include-mcp selects MCP events
  • --include-user-input selects RequestUserInput-style events
  • --include-tools --include-mcp returns the full mixed timeline with assistant, tool, and MCP events together
  • --only assistant|tools|mcp|user-input|all forces a single category
  • --mcp-server <name> filters selected MCP events by server name
  • --mcp-tool <name> filters selected MCP events by tool name
  • --timeline keeps selected events in timestamp order, and becomes optional once include flags are present

Formatted output uses a readable block layout:

==========
[1] 2026-04-17 21:57:47.361

[mcp_tool_call_end] chrome-devtools take_snapshot

arguments:
{
  "verbose": false
}

Text-mode timestamps are shown in the runtime's local timezone for easier reading. Use --json if you need the original raw rollout timestamps unchanged.

In default text mode, multiline MCP string arguments are rendered as readable text blocks instead of escaped JSON string literals. Use --compact-arguments if you want the old one-line JSON style.

Use --json if you want machine-friendly output instead.

--watch keeps the default initial extraction rules, then streams newly appended items from the same rollout file. It does not switch to a different newer session while running.

Examples

Read only tool calls and tool outputs:

cxr --only tools --json

Render MCP arguments as compact one-line JSON:

cxr --include-mcp --compact-arguments

Read a rollout file directly:

cxr --raw-file ~/.codex/sessions/YYYY/MM/DD/rollout-....jsonl

Use a custom sessions root:

cxr --sessions-root ./fixtures/sessions --include-tools

Command Reference

  • --count <n>: limit to the latest n extracted items after category filtering, default 100
  • --watch: keep streaming newly appended rollout items after printing the initial selection
  • --save: write the extracted output to a text file and open it automatically
  • --open: legacy alias for saving and opening the output file
  • --output <path>: explicit output path
  • --raw-file <path>: read a specific rollout file instead of auto-discovering
  • --id <sessionId>: read a specific session id instead of the latest main-agent session
  • --json: print JSON instead of the formatted text view
  • --include-tools: select function/tool call events
  • --include-mcp: select MCP events
  • --include-user-input: select RequestUserInput-style events
  • --timeline: render selected events in timestamp order
  • --only <kind>: select exactly one category: assistant, tools, mcp, user-input, or all
  • --mcp-server <name>: filter selected MCP events by server name
  • --mcp-tool <name>: filter selected MCP events by tool name
  • --compact-arguments: render MCP arguments as one-line JSON instead of formatted blocks
  • --sessions-root <path>: override the default sessions root
  • --help: show help
  • --version: show package version

Reliability Notes

  • Malformed rollout JSONL is treated as an error, with exact file and line reporting
  • Assistant extraction prefers event_msg.agent_message and falls back to assistant response_item text when needed
  • --count is applied after category filtering, so targeted extracts stay accurate

Release Checks

Use the repo checks that back this release candidate surface:

npm test
npm run test:release
npm run release:final

npm run release:final verifies the worktree is clean, reruns the test gates, and prints the exact next push/tag/publish commands without executing them.

Typical Use Cases

  • Audit what Codex actually replied in a prior session
  • Inspect MCP interactions without opening raw JSONL files
  • Review tool-call sequences around a bug or regression
  • Save a readable transcript for sharing or archiving