| name | claude-tui |
| description | Send slash commands (like /context, /compact, /cost) to a Claude Code TUI session via tmux and capture the output. Use when the user wants to run TUI-only commands on a session programmatically. |
Claude TUI
Send slash commands to a Claude Code TUI session via tmux and capture the output.
Resumes the target session in a detached tmux pane, sends the command, waits for output to stabilize, captures it, and tears down.
Prerequisites
- tmux must be installed (
brew install tmux on macOS)
Commands
python3 .claude/skills/claude-tui/scripts/tui_cmd.py <session-id> /context
python3 .claude/skills/claude-tui/scripts/tui_cmd.py --latest /compact
python3 .claude/skills/claude-tui/scripts/tui_cmd.py <session-id> /cost
python3 .claude/skills/claude-tui/scripts/tui_cmd.py --latest --timeout 60 /compact
python3 .claude/skills/claude-tui/scripts/tui_cmd.py --latest --dir /path/to/projects /context
Output
Session: 82c946c8-1eb8-4c70-9414-813fc0a278e4
Command: /context
Context Usage
...
How it works
- Launches
claude --resume <session-id> in a detached tmux session
- Waits for the TUI to initialize (polls until pane output stabilizes)
- Sends the slash command via
tmux send-keys
- Polls every 0.5s until output stabilizes (two identical captures), max 30s
- Captures the final pane content
- Kills the tmux session and Claude process