tmux-tools
Use this skill when the user asks to:
- •get a tmux “screenshot” / current pane output,
- •watch a long-running job from Telegram,
- •copy back logs/text from a pane,
- •(rarely) type into a pane / press Enter (explicitly requested).
Core tool: python3 scripts/tmux_tools.py ...
Safety defaults
- •Prefer read-only operations (
ls,tail,snap). - •
send-keysis dangerous and requires--dangerous. Do not send Ctrl+C /exit/ kill commands unless the user explicitly asks. - •When unsure which pane to act on: run
lsfirst and ask the user to pick a target.
Quick start
List panes:
bash
python3 scripts/tmux_tools.py ls python3 scripts/tmux_tools.py ls --session 3
Get text from a pane (stdout):
bash
python3 scripts/tmux_tools.py tail --target %29 python3 scripts/tmux_tools.py tail --target 3:4.1 --lines 200
Send captured text back to Telegram (message):
bash
python3 scripts/tmux_tools.py tail --target %29 --lines 60 --send
Create a snapshot file under tg_uploads/ (txt + optional png):
bash
python3 scripts/tmux_tools.py snap --target %29 python3 scripts/tmux_tools.py snap --session 3 python3 scripts/tmux_tools.py snap --session 3 --lines 200 --no-png
Send the snapshot to Telegram (as a document):
bash
python3 scripts/tmux_tools.py snap --session 3 --send --caption "tmux session 3"
If you already have an artifact file, return it via bot:
text
/upload tg_uploads/<file>
Target selection rules (when --target is omitted)
tmux_tools.py picks a default target in this order:
- •If running inside tmux (
$TMUXis set) → current#{pane_id} - •Else → pane attached to the most recently active tmux client
- •Else → the first pane from
tmux list-panes -a
Telegram sending (script mode)
--send uses Telegram Bot API directly.
Requirements:
- •
TG_BOT_TOKENmust be available (env or.env.tg_bot) - •
TG_OWNER_CHAT_IDmust be set (or pass--chat-id) - •Optional:
--thread-id(topic/thread id)
Dangerous mode: send keys
Only when explicitly requested:
bash
python3 scripts/tmux_tools.py send-keys --dangerous --target %29 --text "status" --enter python3 scripts/tmux_tools.py send-keys --dangerous --target %29 --dry-run --text "echo hi" --enter