Session Statistics Feature

Resolved 💬 3 comments Opened Feb 4, 2026 by romitdasgupta Closed May 10, 2026

What variant of Codex are you using?

CLI

What feature would you like to see?

feat(tui): Add /stats command to display session statistics

Description

## Problem
Users currently have no visibility into session performance metrics. There's
no way to see:

  • How many commands were executed and their success/failure rate
  • Which files were accessed or modified during the session
  • Token usage breakdown across turns
  • Time distribution between model inference and tool execution

## Proposed Solution
Add a /stats slash command that displays a scrollable popup with session
statistics organized into sections:

Commands

  • Total executed, successful, failed counts
  • Success rate percentage
  • Total execution time

Files

  • Count of files modified and accessed
  • Top accessed files with frequency

Turns & Tokens

  • Current turn number
  • Total/input/output token counts
  • Per-turn token breakdown (last 5 turns)

Timing

  • Session duration
  • Model wait time (with percentage)
  • Tool execution time (with percentage)

## Implementation Approach

  1. New SessionStats struct to track metrics throughout the session
  2. New StatsView popup with keyboard navigation (↑/↓/j/k scroll, Esc close)
  3. Integration points in ChatWidget to record events:
  • Turn start/end
  • Command execution results
  • File access via MCP tools
  • Patch applications (file modifications)

## Scope

  • TUI only

---

Additional information

_No response_

View original on GitHub ↗

This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗