Loading...
Loading...
Control interactive terminal applications like vim, git rebase -i, git add -i, git add -p, apt, rclone config, sudo, w3m, and TUI apps. Can also supervise another CLI LLM (cursor-agent, codex, etc.) - approve or reject its actions by pressing y/n at confirmation prompts. Use when you need to interact with applications that require keyboard input, show prompts, menus, or have full-screen interfaces. Also use when commands fail or hang with errors like "Input is not a terminal" or "Output is not a terminal". Better than application specific hacks such as GIT_SEQUENCE_EDITOR or bypassing interactivity through file use.
npx skill4agent add mstsirkin/interminai interminai# 1. Start session (prints socket path to use in subsequent commands)
./scripts/interminai start -- vim /tmp/test.txt
# Output:
# PID: 12345
# Socket: /tmp/interminai-aBc123/socket
# Auto-generated: true
# 2. Use the socket path shown above for all subsequent commands
./scripts/interminai input --socket /tmp/interminai-aBc123/socket --text ':wq\r'
# 3. Check screen
./scripts/interminai output --socket /tmp/interminai-aBc123/socket
# 4. Clean up (always!)
./scripts/interminai stop --socket /tmp/interminai-aBc123/socketstartstart -- COMMANDinput --socket PATH --text 'text'\r\n\e\t\xHHoutput --socket PATH--cursor printstatus --socket PATHstatus --socket PATH --quietwait --socket PATHwait --socket PATH --quietwait --socket PATH --line Nwait --socket PATH --line N --not-contains PATTERNwait --socket PATH --line N --contains PATTERNstop --socket PATH--socketstopsleep 0.2\ftimeout 10 interminai wait --socket PATHoutputstatus./scripts/interminai status --socket /tmp/interminai-xxx/socket
# Output:
# Running: true
# Activity: true# After sending input, check if there's activity before fetching output
./scripts/interminai input --socket $SOCK --text 'make build\r'
sleep 0.5
# Check activity without blocking
./scripts/interminai status --socket $SOCK
# If Activity: true, fetch output
# If Activity: false, wait longer or send more inputoutputstatuswait| CLI | Busy Pattern | Idle Pattern |
|---|---|---|
| cursor-agent | | |
| codex | | |
| gemini | | |
| claude | | |
ctrl+c to stopctrl+c to stop# Start cursor-agent
./scripts/interminai start --size 120x40 -- cursor-agent
# Output: Socket: /tmp/interminai-xxx/socket
SOCK=/tmp/interminai-xxx/socket
# Send a prompt
./scripts/interminai input --socket $SOCK --text 'Write hello world in Python'
sleep 0.1
./scripts/interminai input --socket $SOCK --text '\r'
# Find the line with ctrl+c to stop (the input prompt line during generation)
# This line number may vary based on screen content
./scripts/interminai output --socket $SOCK --no-color > /tmp/screen.txt
INPUT_LINE=$(grep -n 'ctrl+c to stop' /tmp/screen.txt | head -1 | cut -d: -f1)
# Wait for that line to no longer contain 'ctrl+c to stop'
timeout 120 ./scripts/interminai wait --socket $SOCK \
--line $INPUT_LINE --not-contains 'ctrl+c to stop'
# Now cursor-agent is idle (or showing approval prompt), check output
SCREEN=$(./scripts/interminai output --socket $SOCK --no-color)
# Check what state we're in
if echo "$SCREEN" | grep -q 'Run this command?'; then
# Approval prompt - approve with 'y' or skip with 'n'
./scripts/interminai input --socket $SOCK --text 'y'
else
# Idle - ready for next command
echo "cursor-agent is idle"
fi--sizeresize# Start with larger terminal
./scripts/interminai start --size 80x256 -- COMMAND
# Or resize during session (use socket path from start output)
./scripts/interminai resize --socket /tmp/interminai-xxx/socket --size 80x256hjkldd:<number>:5\rdd/<pattern>/goodbye\rddggG--cursor print:%s/old/new/gcynoutput:e!\r:q!\r\n\r\n\r\r\r\r\n\r\n# Submit a command (use \r)
./scripts/interminai input --socket /tmp/interminai-xxx/socket --text 'hello world\r'
# Multiline input (use \n for newlines, \r to submit)
./scripts/interminai input --socket /tmp/interminai-xxx/socket --text 'line1\nline2\nline3\r'y# Send text, wait, then send Enter
./scripts/interminai input --socket /tmp/interminai-xxx/socket --text 'your prompt here'
sleep 0.1
./scripts/interminai input --socket /tmp/interminai-xxx/socket --text '\r'debuginterminai startGIT_EDITOR=vim ./scripts/interminai start -- bash
# Output shows: Socket: /tmp/interminai-xxx/socket
sleep 0.5
./scripts/interminai output --socket /tmp/interminai-xxx/socket
# ... send commands now, using the socket path from above ...
./scripts/interminai input --socket /tmp/interminai-xxx/socket --text 'vim foo.txt\r'
./scripts/interminai input --socket /tmp/interminai-xxx/socket --text ':wq\r'
./scripts/interminai input --socket /tmp/interminai-xxx/socket --text 'vim bar.txt\r'
./scripts/interminai input --socket /tmp/interminai-xxx/socket --text ':wq\r'
./scripts/interminai input --socket /tmp/interminai-xxx/socket --text 'exit\r'
./scripts/interminai wait --socket /tmp/interminai-xxx/socketGIT_EDITOR=vim ./scripts/interminai start -- git rebase -i HEAD~3
# Output shows: Socket: /tmp/interminai-xxx/socket
sleep 0.5
./scripts/interminai output --socket /tmp/interminai-xxx/socket
# ... edit with input commands, using the socket path from above ...
./scripts/interminai input --socket /tmp/interminai-xxx/socket --text ':wq\r'
./scripts/interminai wait --socket /tmp/interminai-xxx/socket--no-color--no-color# Normal viewing - no --no-color flag:
./scripts/interminai output --socket /tmp/interminai-xxx/socket
# Piping to grep/head/tail - add --no-color:
./scripts/interminai output --socket /tmp/interminai-xxx/socket --no-color | grep pattern
./scripts/interminai output --socket /tmp/interminai-xxx/socket --no-color | tail -5interminai input --password./scripts/interminai start -- sudo apt update
# Output shows: Socket: /tmp/interminai-xxx/socket
sleep 0.5
./scripts/interminai output --socket /tmp/interminai-xxx/socket
# Shows: [sudo] password for user:
# IMPORTANT: Tell the user to run interminai input --password
echo "Password required. Please run: interminai input --socket /tmp/interminai-xxx/socket --password"
# User runs the command, types password, and it's sent to sudo
./scripts/interminai wait --socket /tmp/interminai-xxx/socket--password\r