██████╗ ██╗ █████╗ ██╗ ██╗██████╗ ███████╗████████╗██╗ ██╗██╗ ██╔════╝ ██║ ██╔══██╗██║ ██║██╔══██╗██╔════╝╚══██╔══╝██║ ██║██║ ██║ ██║ ███████║██║ ██║██║ ██║█████╗ ██║ ██║ ██║██║ ██║ ██║ ██╔══██║██║ ██║██║ ██║██╔══╝ ██║ ██║ ██║██║ ╚██████╗ ███████╗██║ ██║╚██████╔╝██████╔╝███████╗ ██║ ╚██████╔╝██║ ╚═════╝ ╚══════╝╚═╝ ╚═╝ ╚═════╝ ╚═════╝ ╚══════╝ ╚═╝ ╚═════╝ ╚═╝
Instrumentation for Claude Code sessions.
Context fill, cost, cache ratio, compaction distance, and live tool activity — parsed from the session transcript and drawn in your terminal.
Every terminal block on this page is real output, captured from the tools in this repo. Nothing here is a mockup.
- version
- 0.8.7
- runtime
- Python 3.13+, stdlib only
- dependencies
- none
- platforms
- macOS, Linux, WSL 2
- license
- MIT
brew install slima4/claude-tui/claude-tui
claudetui setup
No Homebrew? curl -sSL https://raw.githubusercontent.com/slima4/claude-tui/main/install.sh | bash — see install.
Statusline
claudetui mode fullClaude Code renders a status line under the prompt on every turn. This replaces it with a readout of what the session is actually costing you.
- C 42% ⚡421.3k/1.0M
- Context fill and token count against the window. The bar's colour tracks the compaction ceiling, not 100% — it turns warm as you approach the point where Claude Code compacts.
- ETA 13 turns
- Estimated turns before compaction, from a fixed 33k-token buffer model and your recent per-turn growth.
- CMP 1x
- Compactions so far this session.
- 54% eff
- Useful context divided by total context built. Falls as compactions discard work you already paid to load.
- ▇▄↓▅▅▃▅▇▆
- Per-turn output sparkline. ↓ marks a compaction boundary; older bars fade.
- S 34% ⏱ 1h59m
- 5-hour plan limit used, and the countdown to reset. Pro/Max only — Claude Code supplies it, so there's no extra API call.
- W 71% ⏱ 71h59m
- 7-day plan limit and its reset countdown.
- ⎇ feature/auth +180 -60
- Git branch and uncommitted diff stat.
- TRN · FIL · ERR
- Turns, files touched, and tool calls that came back as errors.
- CAC 99% · THK 8
- Cache hit ratio and thinking-block count.
- $12.47 · ~$0.36/turn
- Session cost and cost per turn, taken from Claude Code's own accounting rather than re-derived.
- read auth.ts → edit auth.ts
- The current turn's tool trace, with per-file edit counts on the right.
- 0011110
- Matrix-rain widget. Swappable: matrix, hex, bars, progress, or none.
claudetui mode compact.A third mode, claudetui mode custom, opens a curses configurator where every field above is an independent toggle, saved to ~/.claude/claudeui.json.
Monitor
claudetui monitorA dashboard for a second terminal. It finds the active session, follows the transcript file, and redraws when it changes.
- s stats
- d details
- l log
- w waste chart
- e export
- o sessions
- c config
- i Claude status
- ? help
- q quit
In the log viewer, f cycles the filter — errors, bash, edits, search, agents, skills, compactions — and a toggles live follow. Navigation is vim-style: Ctrl+F/Ctrl+B, g/G.
Context efficiency
claudetui chartCompaction is the expensive part of a long session: the window fills, Claude Code summarises, and everything below the summary is re-read from scratch. This chart splits each stretch between compactions into what the tokens actually bought.
- ▒▒ system
- System prompt and tool definitions — paid for on every request, never reclaimed.
- ▓▓ summary
- Context carried across a compaction boundary as a summary.
- ██ useful
- Conversation and tool output that did work.
- ░░ headroom
- Window bought but never used before the segment ended. The number to shrink.
API sniffer
claudetui snifferA local proxy between Claude Code and the API. Set ANTHROPIC_BASE_URL at it — or use the claudetui sniff launcher, which detects the port — and every request prints as one line.
Agent tool, since they share the parent's session ID.- [Tt] [U] [tUUUU]
- Content blocks in the response — T thinking, t text, U tool use, S server tool, W web search result, M/m MCP.
- 100%c · 0%c
- Cache hit ratio for the request. Red at zero — a cold prompt you're paying full price for.
- +agent.1
- First request from a newly detected sub-agent.
- compaction
- A compaction request, including the ones Claude Code makes without telling you.
Requests are logged as JSONL to ~/.claude/api-sniffer/, created 0600, with API keys redacted unless you pass --no-redact. Each instance writes a port file, so several projects can run their own proxy at once.
Also included
Session stats
claudetui stats
Post-session analytics over the transcripts in ~/.claude/projects/.
- cost breakdown
- token sparkline
- tool usage
- file activity
--days 7multi-session summary
Session manager
claudetui sessions list
Browse, inspect, compare, resume, and export past sessions.
- list
- show
- resume
- diff two sessions
- export
Hooks
installed by claudetui setup
Three hooks that put project history in front of Claude before it acts.
- SessionStart — file activity hotspots
- PreToolUse — high-churn warning before an edit
- PostToolUse — reverse dependencies after an edit
Slash commands
/tui:session
In-session reports, generated by Claude from the current transcript.
/tui:session/tui:cost/tui:perf/tui:context
Install
macOS · Linux · WSL 2Installing puts the statusline, hooks, and slash commands into ~/.claude/settings.json and symlinks claudetui onto your PATH.
# Homebrew brew install slima4/claude-tui/claude-tui claudetui setup # or the install script curl -sSL https://raw.githubusercontent.com/slima4/claude-tui/main/install.sh | bash # or from a clone git clone https://github.com/slima4/claude-tui.git ./claude-tui/install.sh
# pin an isolated interpreter CLAUDETUI_PYTHON="$(uv python find 3.13)" ./install.sh # install somewhere other than ~/.claude-ui INSTALL_DIR="$HOME/tools/claude-tui" ./install.sh # uninstall claudetui uninstall brew uninstall claude-tui # already ran brew uninstall first? curl -sSL https://raw.githubusercontent.com/slima4/claude-tui/main/uninstall.sh | bash
Windows needs WSL 2 — the tools want a Unix-like environment.