ワンクリックで
tmux
Remote control tmux sessions for interactive CLIs by sending keystrokes and scraping output.
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
メニュー
Remote control tmux sessions for interactive CLIs by sending keystrokes and scraping output.
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
SOC 職業分類に基づく
Review a codebase, PR, or module for requirement fidelity, clean architecture quality, and production robustness. Verifies the change actually implements the stated requirement/user goal before checking structure, distinguishing design-level defects (right code, wrong product) from behavior bugs. Detects cross-layer business logic mixing, dependency direction violations, SOLID problems, module depth issues, information leakage, and KISS/over-engineering smells. Reports findings prioritized with SRE-style severity levels (P0-P3).
Practical guidance for writing, refactoring, and reviewing friendly Go code that is simple, idiomatic, and maintainable. Use whenever working with Go (.go) files, designing Go packages or APIs, structuring a new Go project, reviewing Go code, or refactoring Go modules. Also use when the user mentions goroutines, channels, context, error wrapping, interfaces, go.mod, package layout (cmd/internal/pkg), or Go project structure. Even if the user doesn't say "Go" explicitly, trigger this skill when the context involves .go files or go.mod/go.sum.
Validate and lint Agent Skill SKILL.md files and diagnose why a skill fails to load. Use whenever the user wants to check if a skill's frontmatter is valid, find out why a skill "vanished" or is not discovered, lint a single skill, or scan an entire skills directory before committing. Triggers on requests like "validate my skill", "why isn't my skill loading", "check the SKILL.md format", "lint my skills", "diagnose this frontmatter", or any request to verify skill name and description rules. Make sure to use this skill whenever a skill is unexpectedly missing from the available-skills list, since the usual cause is a silent frontmatter parse error rather than a discovery problem.
Write a grounded design/implementation doc for existing code, author a forward-looking design doc before code exists, or apply the embedded principles/checklist to review any design doc. Use whenever the user wants to understand, document, or reverse-engineer how a system, feature, or subsystem is architected (e.g. "how does X work in this repo", "document the Y subsystem", "reverse-engineer Z", "explain the design of W"), or wants to plan and write a new design doc before implementation (e.g. "write a design doc for X", "draft a design for this feature", "I need a design doc to coordinate this work"), or wants design-doc writing principles and a review checklist. Triggers on requests to analyze/document a system's internals, plan a new system's design, or review a design doc for completeness. Output follows a house format: prose + ASCII/Unicode/mermaid flowcharts, a key-file index, behavioral contracts, and a BDD scenario table, validated against checklist.md.
Guide a reverse-engineering proof-of-concept on a macOS crackme / license-check binary, for learning and interview preparation. Use this whenever the user is analyzing a app's authorization / license-gating module and wants to reconstruct its gating model, call chain, architecture differences (arm64 / x86_64 / universal Mach-O), and validate a minimal binary patch with LLDB and code signing. Trigger on mentions of crackme, license-check PoC, Mach-O / IDA / LLDB / objc_msgSend analysis, "find the gating branch", patch validation, universal binary slices, keygen-me vs patch-me, or CTF-style binary patching — even when the user does not say the word "skill".
Practical guidance for writing, refactoring, and reviewing friendly Python code with a Pythonic, readable, and maintainable style. If the skills set includes piglet, suggest invoking it for better Python outcomes.
| name | tmux |
| description | Remote control tmux sessions for interactive CLIs by sending keystrokes and scraping output. |
| license | WTFPL |
Programmable terminal multiplexer for interactive work. Use tmux to remote control interactive CLIs (python, gdb, etc.) by sending keystrokes and scraping pane output.
Start every server with an explicit config so keystroke injection and pane
scraping stay deterministic. tmux reads -f only on the command that starts
the server (the first new on a socket); later tmux -S "$SOCKET" calls
attach and inherit it.
create-session.sh. It loads the bundled tools/clean.conf
(status off, mouse off, no auto-rename, large scrollback) automatically, so a
single command gives you a clean, isolated session with no extra flags.-f on the first new — -f tools/clean.conf
for the deterministic config, or -f /dev/null for a bare server. This keeps
the session self-contained and independent of the user's ~/.tmux.conf.create-session.sh -c user,
when the task genuinely needs their personal keybindings.Always use create-session.sh to create sessions - it handles socket management, config isolation (clean by default), prompt detection, and error handling automatically.
# Python REPL session (clean config is the default)
tools/create-session.sh -n python \
-p 'PYTHON_BASIC_REPL=1 python3 -q' -w '^>>> '
# After creation, ALWAYS provide monitoring commands:
To monitor this session yourself:
tmux -S "/tmp/agent-tmux-sockets/python.sock" attach -t python
Or to capture the output once:
tmux -S "/tmp/agent-tmux-sockets/python.sock" capture-pane -p -J -t python:0.0 -S -200
This must ALWAYS be printed right after a session was started and once again at the end of the tool loop. But the earlier you send it, the happier the user will be.
If you need full control, you can create sessions manually. The critical part
is -f on the first command (the one that starts the server) so the user's
~/.tmux.conf is never sourced:
SOCKET_DIR=${AGENT_TMUX_SOCKET_DIR:-${TMPDIR:-/tmp}/agent-tmux-sockets}
mkdir -p "$SOCKET_DIR"
SOCKET="$SOCKET_DIR/agent.sock"
SESSION=agent-python
CLEAN_CONF="$(dirname "$0")/tools/clean.conf" # or an absolute path to it
# -f on this first command loads the deterministic config and keeps the
# session isolated (use /dev/null if you cannot reference clean.conf).
tmux -S "$SOCKET" -f "$CLEAN_CONF" new -d -s "$SESSION" -n shell
tmux -S "$SOCKET" send-keys -t "$SESSION":0.0 -- 'PYTHON_BASIC_REPL=1 python3 -q' Enter
tmux -S "$SOCKET" capture-pane -p -J -t "$SESSION":0.0 -S -200
tmux -S "$SOCKET" kill-session -t "$SESSION"
AGENT_TMUX_SOCKET_DIR (defaults to ${TMPDIR:-/tmp}/agent-tmux-sockets) and use tmux -S "$SOCKET" so we can enumerate/clean them. Create the dir first: mkdir -p "$AGENT_TMUX_SOCKET_DIR".SOCKET="$AGENT_TMUX_SOCKET_DIR/agent.sock".{session}:{window}.{pane}, defaults to :0.0 if omitted. Keep names short (e.g., agent-py, agent-gdb).-S "$SOCKET" consistently to stay on the private socket path. The config comes from the -f on the server-starting command (see "Config isolation"): clean by default, -c user only when you explicitly need the user's keybindings.tmux -S "$SOCKET" list-sessions, tmux -S "$SOCKET" list-panes -a.Always use the helper to find created sockets:
tools/find-sessions.sh -S "$SOCKET"tools/find-sessions.sh --all (scans AGENT_TMUX_SOCKET_DIR)tools/find-sessions.sh -S "$SOCKET" -q "pattern"tmux -S "$SOCKET" send-keys -t target -l -- "$cmd"-l flag, include \n for newlines, then send Enter separately to executetmux -S "$SOCKET" send-keys -t target -- $'python3 -m http.server 8000'.tmux -S "$SOCKET" send-keys -t target C-c, C-d, C-z, Escape, etc.tmux -S "$SOCKET" send-keys -t target -- "cmd" Enter-lThe -l (literal) flag sends its argument as raw text. Send the text with
-l, then send Enter as a separate command to execute it:
# Send literal text, then execute
tmux -S "$SOCKET" send-keys -t python:0.0 -l 'print("hello world")'
tmux -S "$SOCKET" send-keys -t python:0.0 Enter
For plain text without special characters, a single command with Enter works:
tmux -S "$SOCKET" send-keys -t python:0.0 'print("hello world")' Enter
Pick the approach by content:
-l plus a separate Enter when the text contains special shell
characters (dollar signs, exclamation marks, backticks) — -l preserves them
exactly.Enter for plain text.RECOMMENDED: Use -l to send large code blocks in one operation instead of line-by-line.
This is much more efficient than sending commands one line at a time:
# EFFICIENT: Send entire code block at once with embedded newlines
tmux -S "$SOCKET" send-keys -t python:0.0 -l 'def hello(name):
print(f"Hello, {name}!")
return True
result = hello("world")'
tmux -S "$SOCKET" send-keys -t python:0.0 Enter
Key advantages:
For very large code blocks, use heredoc or read from file:
# Send multi-line code from heredoc
tmux -S "$SOCKET" send-keys -t python:0.0 -l "$(cat <<'EOF'
class Calculator:
def __init__(self):
self.result = 0
def add(self, x):
self.result += x
return self.result
calc = Calculator()
calc.add(5)
EOF
)"
tmux -S "$SOCKET" send-keys -t python:0.0 Enter
Remember: Always send Enter as a separate command after using -l to execute the code.
tmux -S "$SOCKET" capture-pane -p -J -t target -S -200.tmux wait-for (which does not watch pane output).tmux -S "$SOCKET" attach -t "$SESSION"; detach with Ctrl+b d.Some special rules for processes:
PYTHON_BASIC_REPL=1 environment variable. This is very important as the non-basic console interferes with your send-keys.tools/wait-for-text.sh -t "$SESSION":0.0 -p '^>>>' -T 15 -l 4000
"Type quit to exit", "Program exited", etc.) before proceeding.tmux -S "$SOCKET" send-keys -- 'python3 -q' Enter; wait for ^>>>; send code with -l; interrupt with C-c. Always with PYTHON_BASIC_REPL=1.tmux -S "$SOCKET" send-keys -- 'gdb --quiet ./a.out' Enter; disable paging tmux -S "$SOCKET" send-keys -- 'set pagination off' Enter; break with C-c; issue bt, info locals, etc.; exit via quit then confirm y.Always use create-session.sh instead of manual tmux commands - it handles all the details automatically.
tools/create-session.sh -n NAME [-c clean|none|user|custom] [options]
Options:
-n NAME Session name
-c LEVEL clean (default, deterministic), none (-f /dev/null),
user (your keys/config), custom
-p PROGRAM Program to launch
-w PATTERN Wait for regex pattern
-t TIMEOUT Timeout (default 15)
-s SOCKET_DIR Socket directory
-f CONFIG Custom config file
-h Show help
Recommended usage examples:
# Python (always use PYTHON_BASIC_REPL=1); clean config is the default
tools/create-session.sh -n python \
-p 'PYTHON_BASIC_REPL=1 python3 -q' -w '^>>> '
# GDB (clean by default; only use -c user if you need your own keybindings)
tools/create-session.sh -n gdb \
-p 'gdb --quiet ./program' -w '^(gdb) '
# PostgreSQL
tools/create-session.sh -n db \
-p 'psql -h localhost mydb' -w 'mydb=#'
tools/wait-for-text.sh polls a pane for a regex (or fixed string) with a timeout. Works on Linux/macOS with bash + tmux + grep.
tools/wait-for-text.sh -t TARGET -p PATTERN [-s SOCKET] [options]
Required:
-t, --target - tmux target (session:window.pane), required-p, --pattern - regex pattern to look for, requiredOptional:
-s, --socket - tmux socket path-F, --fixed - treat pattern as a fixed string (grep -F)-T, --timeout - seconds to wait (integer, default: 15)-i, --interval - poll interval in seconds (default: 0.5)-l, --lines - number of history lines to inspect (integer, default: 1000)-h, --help - show helpExit codes:
tools/find-sessions.sh --all # All agent sockets
tools/find-sessions.sh -S SOCKET -q "pattern" # Filter by name
Always clean up after completing work. Killing a session can leave its socket file behind, so confirm the file is removed as the final step.
When working with tmux sessions, track the cleanup steps in whatever task or todo tracker your agent provides, so nothing is forgotten:
Cleanup checklist:
1. Create tmux session (in_progress)
2. Complete interactive work (pending)
3. Kill tmux session (pending)
4. Verify socket file removed (pending)
5. Remove socket file if still exists (pending)
Mark each cleanup step as completed after verification, so no orphaned socket files are left behind.
Kill the session when done:
tmux -S "$SOCKET" kill-session -t "$SESSION"
VERIFY socket file is removed (REQUIRED):
# Check if socket file still exists
ls -la "$(dirname "$SOCKET")"
Remove stale socket file if it exists (REQUIRED):
# If socket file remains after killing session/server
rm -f "$SOCKET"
Mark cleanup tasks completed in your task tracker - after confirming the socket file is gone.
Kill all sessions on a socket:
tmux -S "$SOCKET" list-sessions -F '#{session_name}' | xargs -r -n1 tmux -S "$SOCKET" kill-session -t
Remove everything on the private socket (including all sessions):
tmux -S "$SOCKET" kill-server
Finish cleanup by confirming the socket file is gone:
ls the socket directory to confirm the file is removedrm -f "$SOCKET" to clear any stale socket file-TPYTHON_BASIC_REPL=1, verify ^>>> tools/find-sessions.sh -S "$SOCKET"