CLI AI session manager for Claw agents. Manage CLI AI tools (Codex, Claude Code, Gemini, etc.) like tmux sessions, with automatic idle detection and OpenClaw agent notification.
- Session Management — Create, write, read, attach, list, and kill AI tool sessions
- Zero-Daemon Architecture — Uses tmux native
monitor-silence+ hooks for event-driven completion detection - OpenClaw Integration — Automatic notification to Claw agents when sessions go idle or exit
- tmux 3.2+ (for
silence-actionsupport) - jq (for JSON state management)
- Bash 4+
curl -fsSL https://raw.githubusercontent.com/l1veIn/claw-tmux/main/install.sh | bashRe-run to update.
# Start a Codex session
claw-tmux new --agent agent-fe --session sess-123 --tool codex "fix the login bug"
# Returns: pty-1740000000-12345
# Send follow-up input
claw-tmux write pty-1740000000-12345 "now add unit tests"
# Read output
claw-tmux read pty-1740000000-12345 --json
# List all sessions
claw-tmux list
# Kill a session
claw-tmux kill pty-1740000000-12345 -f| Command | Description |
|---|---|
new |
Create a new CLI AI session |
write |
Send input to a session |
read |
Capture output from a session |
attach |
Attach to a session interactively |
list |
List all managed sessions |
kill |
Terminate a session |
Run claw-tmux <command> --help for detailed usage.
claw-tmux newcreates a tmux session and registers hooks:alert-silence— fires when the pane has no output for N secondspane-exited— fires when the process exits
- Hooks call
lib/notify.sh, which reads~/.claw-tmux/state.jsonand sends a notification viaopenclaw agent - The Claw agent receives the notification and can
readthe output,writenew input, orkillthe session
Create ~/.claw-tmux/config to override defaults:
# Idle detection threshold (seconds)
CLAW_TMUX_IDLE_SEC=5
# Default CLI tool
CLAW_TMUX_DEFAULT_TOOL=codex
# Terminal size
CLAW_TMUX_COLS=200
CLAW_TMUX_ROWS=50Environment variables (CLAW_TMUX_IDLE_SEC, etc.) take highest priority.
claw-tmux/
├── claw-tmux # Main entry script
├── lib/
│ ├── session.sh # Session management (new/write/read/list/kill/attach)
│ └── notify.sh # Hook callback script (openclaw notification)
├── config/
│ └── default.conf # Default configuration
├── docs/
│ ├── claw-tmux-cli-design.md
│ └── claw-tmux-implementation-plan.md
└── README.md
Runtime files (~/.claw-tmux/):
state.json— Session bindingsstate.lock— flock concurrency protectionconfig— User configuration overridesnotify.log— Notification failure log
MIT