claude/skills/tmux-pane-commander/SKILL.md
Send prompts to other AI CLIs (Codex, Claude Code) running in sibling tmux panes and receive results back. Use this skill when the user asks to send a question or task to Codex or another Claude Code instance in a tmux pane. Handles pane discovery, CLI startup if needed, prompt delivery with proper Enter timing, delivery verification, and result return via tmux send-keys.
npx skillsauth add kazuph/dotfiles tmux-pane-commanderInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Orchestrate AI CLIs (Codex CLI, Claude Code) across tmux panes as a team. The core loop: Send task → Child works → Child reports back to parent pane.
You are the parent (manager). Other AI CLIs in sibling panes are children (workers). This is a team: tasks go out, results come back. Both directions use tmux send-keys.
Before anything else, get YOUR pane ID. You will embed this in every prompt you send.
MY_PANE_ID=$(tmux display-message -p -t "$TMUX_PANE" '#{pane_id}')
echo "My pane ID: $MY_PANE_ID"
This $MY_PANE_ID (e.g., %85) is how children will report back to you.
WINDOW_INDEX=$(tmux display-message -p -t "$TMUX_PANE" '#I')
tmux list-panes -t "$WINDOW_INDEX" -F '#{pane_index} #{pane_id} #{pane_pid} #{pane_current_command} #{pane_tty}'
Identify target pane by process name:
node process with codex in the process treenode process with claude in the process treeVerify with:
ps aux | grep -E 'codex|claude' | grep -v grep
Cross-reference PID and TTY to find the correct pane ID (e.g., %87).
IMPORTANT: Capture enough lines to see the actual work area, not just the prompt and status bar. AI CLIs (Claude Code, Codex) display status bars and input prompts at the bottom (~10-15 lines). If you only capture 15-20 lines, you'll only see the chrome and miss the actual output area where work status (e.g., "Compacting conversation...", "Working...", error messages) is displayed.
# Capture 50 lines to see both the work area AND the status bar
tmux capture-pane -t "${TARGET_PANE_ID}" -p | tail -50
Check what you see in the output area above the prompt (not just the prompt line):
> or ›) AND no active status messages above: Can send text directlyCommon misread: An empty prompt ❯ does NOT always mean idle. Check for status messages
like "Compacting conversation..." or "auto-compact: 0%" in the lines ABOVE the prompt.
The status bar field Context left until auto-compact: 0% means compaction is imminent or active.
Codex CLI:
tmux send-keys -t "${TARGET_PANE_ID}" "codex --sandbox workspace-write --config sandbox_workspace_write.network_access=true --dangerously-bypass-approvals-and-sandbox" && sleep 0.5 && tmux send-keys -t "${TARGET_PANE_ID}" Enter
sleep 5
Claude Code:
tmux send-keys -t "${TARGET_PANE_ID}" "claude --dangerously-skip-permissions" && sleep 0.5 && tmux send-keys -t "${TARGET_PANE_ID}" Enter
sleep 5
Wait for the CLI to be ready (check with capture-pane) before proceeding.
CRITICAL: Every prompt MUST include:
Prompt template:
[TASK]
(Your actual task here)
[REPORT BACK]
作業完了後、以下のコマンドで親ペインに結果をワンライナーで報告してください:
tmux send-keys -t {MY_PANE_ID} '[{TARGET_PANE_ID}] 報告内容をここにワンライナーで' && sleep 0.1 && tmux send-keys -t {MY_PANE_ID} Enter
報告形式:
- 必ず [{TARGET_PANE_ID}] プレフィックスを付ける
- ワンライナーで要約(改行不可)
- 成功/失敗を明示
Replace {MY_PANE_ID} with your actual pane ID (e.g., %85) and {TARGET_PANE_ID} with the child's pane ID (e.g., %87).
tmux send-keys -t "${TARGET_PANE_ID}" "Your full prompt including report-back instructions"
IMPORTANT: Do NOT include Enter in this command. Text and Enter MUST be separate steps.
sleep 0.5
tmux send-keys -t "${TARGET_PANE_ID}" Enter
The sleep is MANDATORY. Without it, the Enter arrives before the text is fully rendered in the target CLI's input buffer, causing the prompt to not be submitted.
Wait a few seconds, then capture enough lines to see the work area (not just the status bar):
sleep 3
tmux capture-pane -t "${TARGET_PANE_ID}" -p | tail -50
Look for in the output area above the prompt:
If delivery failed, retry Step 5 only (Enter, NOT the text).
The child will send a report back to your pane via tmux send-keys -t {MY_PANE_ID}.
You can also proactively check their progress:
tmux capture-pane -t "${TARGET_PANE_ID}" -p -S -200 | tail -50
Parent pane %85 sends task to Codex in pane %87:
# Step 0: My ID
MY_PANE_ID="%85"
# Step 3+4: Send prompt with return instructions
tmux send-keys -t "%87" "mimamori-expo-bff のマイグレーション整合性を調査してください。drizzle/ と migrations/ の2つのディレクトリの状態を確認し、問題があれば修正案を提示。完了後: tmux send-keys -t %85 '[%87] 調査完了: (結果要約)' && sleep 0.1 && tmux send-keys -t %85 Enter"
# Step 5: Enter
sleep 0.5
tmux send-keys -t "%87" Enter
# Step 6: Verify (50 lines to see work area, not just status bar)
sleep 3
tmux capture-pane -t "%87" -p | tail -50
When a child's context is getting full, the parent can clear it:
tmux send-keys -t "${TARGET_PANE_ID}" "/clear" && sleep 0.5 && tmux send-keys -t "${TARGET_PANE_ID}" Enter
Timing:
For when the child's report-back is insufficient and you need their full output:
# Last 100 lines
tmux capture-pane -t "${TARGET_PANE_ID}" -p -S -100
# Last 500 lines (for very long outputs)
tmux capture-pane -t "${TARGET_PANE_ID}" -p -S -500
CRITICAL: Direct tmux operations from the parent session are EXPENSIVE.
Every capture-pane output (50+ lines) gets added to your context permanently.
Repeated monitoring eats through your 200k context window fast.
❌ BAD: Parent directly runs capture-pane
Parent context: +500 tokens per check × 5 checks = +2,500 tokens wasted
Result: Context exhaustion, auto-compact triggered early
✅ GOOD: Parent spawns haiku subagent for monitoring
Subagent: does all heavy capture-pane work internally (doesn't affect parent)
Returns: 1-line summary (~30 tokens added to parent)
Why this works: Task tool subagents have their OWN context window. Their internal tool calls (capture-pane, grep, etc.) do NOT consume parent context. Only the final return message gets added to the parent's context.
When you need to check on children's progress, ALWAYS delegate to a haiku subagent:
Task(subagent_type=Bash, model=haiku):
prompt: |
Run this command and parse the output into a single-line status report.
tmux capture-pane -t "%87" -p | tail -50
Return ONLY one line in this exact format (no extra text):
PANE:%87|STATUS:{idle/working/compacting/error}|CTX:{N%}|TASK:{10-word-max}|COST:{$N.NN}
Parse rules:
- STATUS: "idle" if prompt `❯`/`>` visible with no work above, "working" if spinner/tool calls,
"compacting" if "Compacting conversation" visible, "error" if errors shown
- CTX: extract from status bar "N% context left" or "🧠 ... (N%)"
- TASK: last visible task description (from todo list or working message)
- COST: from "💰 $X.XX session" in status bar
For checking ALL panes at once, use ONE subagent to check everything:
Task(subagent_type=Bash, model=haiku):
prompt: |
Check these tmux panes and return a dashboard. Run capture-pane for each.
Panes: %85, %87, %102
For each pane, run: tmux capture-pane -t "{PANE_ID}" -p | tail -50
Return ONLY this format (one line per pane, no extra text):
%85|idle|ctx:15%|EAS build done|$111.38
%87|working|ctx:60%|migration check|$0.00
%102|compacting|ctx:5%|doc update|$45.20
If you need to investigate a specific issue (e.g., why a child is stuck):
Task(subagent_type=Bash, model=haiku):
prompt: |
Investigate pane %87. It appears stuck.
1. Run: tmux capture-pane -t "%87" -p -S -200
2. Look for: error messages, repeated failures, permission issues, stuck loops
3. Return ONLY a 2-3 sentence diagnosis and recommended action.
Do NOT include raw capture output.
capture-pane directly from the parent session for routine monitoring| Operation | Context cost (parent) | Method | |-----------|----------------------|--------| | Direct capture-pane (50 lines) | ~500 tokens | ❌ Avoid for monitoring | | Direct capture-pane (200 lines) | ~2,000 tokens | ❌ Never for monitoring | | Task(haiku) status check | ~30-50 tokens | ✅ Use this | | Task(haiku) multi-pane dashboard | ~50-100 tokens | ✅ Use this | | Task(haiku) deep investigation | ~100-200 tokens | ✅ Use for debugging |
| Mistake | Why it fails | Correct approach |
|---------|-------------|-----------------|
| send-keys "text" Enter in one call | Enter may arrive before text renders | Separate: send text, sleep 0.5, send Enter |
| Resending text when Enter failed | Creates duplicate prompt | Only resend Enter |
| Not checking pane state first | May send to wrong pane or busy CLI | Always capture-pane first |
| Hardcoding pane index from memory | Pane indices change between sessions | Always discover dynamically via list-panes |
| Not including MY_PANE_ID in prompt | Child cannot report back | Always embed return address |
| Not including report format in prompt | Child reports in unparseable format | Always specify format with pane prefix |
| Using pane index instead of pane ID | Index is window-local and fragile | Use pane ID (e.g., %85) which is globally unique |
| tail -15 or tail -20 for state check | Only captures status bar + prompt, misses work area | Use tail -50 to see output area where actual status is shown |
| Assuming empty prompt ❯ means idle | CLI may be compacting, auto-compacting, or processing above the prompt | Always check the output area above the prompt for status messages |
| Running capture-pane directly for repeated monitoring | Each capture adds ~500 tokens to parent context permanently | Delegate to Task(haiku) subagent, receive 1-line summary only |
| Letting subagent return raw capture-pane output | Defeats the purpose of delegation — full output still enters parent context | Enforce strict return format in subagent prompt (1-line per pane) |
tools
X (Twitter) API read-only CLI. Bookmarks retrieval, tweet search, engagement analytics (likes/RT aggregation), mentions, user lookup. Use when: reading X bookmarks, searching tweets, aggregating likes/retweets, checking mentions, looking up users. Triggers: bookmark, bookmarks, X search, Twitter search, likes count, RT count, engagement, tweet analytics.
testing
単体テスト方針の要約。Kiro流で使うときは本文を必ず参照・展開する。
data-ai
TAKT ピースエンジン。Agent Team を使ったマルチエージェントオーケストレーション。ピースYAMLワークフローに従ってマルチエージェントを実行する。
tools
Send messages and files to Slack using the existing bot token and the single configured channel. Never use browser automation for this skill. Do not send to any other channel.