Skip to content

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

@Mino777

Description

@Mino777

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions