perf: Push QueryList filters to tmux via -f format filter
まだ誰も着手していません。
評価
調査の方向性
Start at the server.panes.filter(...) entry point and compare it with the libtmux-mcp search_panes proof of concept, which calls server.cmd('list-panes', '-a', '-f', ...). Decide whether this should be a new tmux_filter method or a transparent filter optimization, then verify compatible filters are applied by tmux while existing QueryList behavior remains correct.
索引モデルが issue の本文から書いたものです。
説明
Problem
server.panes.filter(pane_current_command__contains="vim") fetches ALL panes from tmux, then filters in Python. For servers with many sessions/windows, this is unnecessarily slow.
tmux native support
tmux's list-panes, list-windows, and list-sessions commands support a -f flag that applies a format-string filter server-side:
Filter panes by command (done in C, not Python):
$ tmux list-panes -a -f "#{m:*vim*,#{pane_current_command}}"
Filter panes by content (C-level grid search):
$ tmux list-panes -a -f "#{C:search_term}"
Case-insensitive metadata match:
$ tmux list-panes -a -f "#{m/i:*pattern*,#{window_name}}"
Format matching operators:
#{m:glob,text}— glob match (wraps with*...*for contains)#{m/i:glob,text}— case-insensitive glob#{m/r:regex,text}— POSIX extended regex#{C:text}— content search (visible pane text)
Proposed approach
Add a method or option to push compatible QueryList filters into tmux's -f flag:
# Option A: New method
server.panes.tmux_filter(pane_current_command__contains="vim")
# Option B: Optimize existing .filter() transparently
# Detect when filters can be pushed to tmux and do so automatically
Performance impact
For a server with 50 panes, Python-side filtering requires fetching and parsing all 50 pane objects. Tmux-side filtering returns only matching panes, reducing both IPC and object creation overhead.
Context
The libtmux-mcp search_panes tool uses server.cmd('list-panes', '-a', '-f', ...) directly as a proof of concept for tmux-side filtering. See also #645 for the content search API.
- 主要言語
- Python
- スター
- 1.2k
- フォーク
- 127
- 平均マージ
- 2時間 13分
- マージ済み PR(30日)
- 1
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
tmux-python/libtmux のほかの issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
tmux-python/libtmux#759 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
tmux-python/libtmux#745 · コメント 2 件 ·
-
enhancement
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
tmux-python/libtmux#744 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
tmux-python/libtmux#731 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
tmux-python/libtmux#654 ·
tmux-python/libtmux の issue をすべて見る
似ている issue
-
triage/confirmed
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
agentscope-ai/agentscope#2775 ·
-
comp/desktop P3 type/bug
難易度 1/5 1時間未満 初心者へのやさしさ 92/100
NousResearch/hermes-agent#118866 ·
-
bug
難易度 1/5 1時間未満 初心者へのやさしさ 90/100
apache/cloudstack#14222 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100