rtk-ai/rtk

feat: add `rtk tmux` wrapper for `capture-pane` and `send-keys`

Open

#2031 aperta il 22 mag 2026

Vedi su GitHub
 (2 commenti) (0 reazioni) (0 assegnatari)Rust (2914 fork)batch import
area:clienhancementhelp wantedplatform:macospriority:medium

Metriche repository

Star
 (48.085 star)
Metriche merge PR
 (Merge medio 11g 1h) (45 PR mergiate in 30 g)

Descrizione

feat: add rtk tmux wrapper for capture-pane and send-keys

Problem

Multi-pane tmux orchestration is a common pattern for Claude Code worker pools (e.g. CTO ↔ Worker-1 ↔ Worker-2/3). Two tmux commands dominate this workflow:

  1. tmux capture-pane -t <target> -p — read another pane's output (often 100+ lines of build logs, test failures, etc.)
  2. tmux send-keys -t <target> ... — dispatch commands (short input, but spam-counted)

Measured impact (gma-ios, 30 days via rtk discover)

Command              Count   Example
tmux capture-pane     265    tmux capture-pane -t gma:1.2 -p
tmux send-keys        149    tmux send-keys -t gma:1.4 Escape

capture-pane is the costly one — it often returns 200+ lines of stale log output where the LLM only needs the last 20 lines or a specific anchor (e.g. last "DONE" / "ERROR" marker).

Proposed solution

Add rtk tmux subcommand with:

  1. capture-pane filters:
    • Default to last N=50 lines (override with -S -200 flag — pass through native)
    • Add --since-marker <regex> to capture only output after a specific marker
    • Strip blank trailing lines (tmux pads to pane height)
  2. send-keys filters:
    • Suppress output entirely on success (it has no meaningful return)
    • Only print on error

Example before/after

Before (tmux capture-pane -t gma:1.2 -p, ~150 lines / ~3KB):

[120 lines of stale starship prompt + old build output]
...
❯ /leader /tmp/wo-foo-brief.md
[20 lines of leader analysis]
❯

After (rtk tmux capture-pane -t gma:1.2 -p, ~25 lines / ~500 bytes):

  • Last 50 lines, trailing blanks stripped → focuses LLM on recent activity

Why useful

Worker-pool / agent-orchestration patterns are growing in Claude Code (RTK's own discover history shows it). capture-pane token waste compounds — every poll burns context.

Environment

  • RTK 0.40.0 (Homebrew, macOS arm64)
  • Use case: gma-ios — 4-pane tmux harness for AI worker orchestration

Guida contributor