rtk-ai/rtk

Feature request: rtk wrapper for ssh remote commands

Open

#1,607 创建于 2026年4月29日

在 GitHub 查看
 (2 评论) (1 反应) (0 负责人)Rust (2,914 fork)batch import
area:clieffort-largeenhancementhelp wantedpriority:medium

仓库指标

Star
 (48,085 star)
PR 合并指标
 (平均合并 11天 1小时) (30 天内合并 45 个 PR)

描述

Real-world numbers from rtk discover --all --since 30:

Pattern Calls (30d)
ssh <host> '<cmd>' 58

Common patterns include checking remote service status (systemctl status), tailing logs (journalctl, tail -n N), inspecting disk usage (df -h), and listing processes (ps aux). The remote command's output flows back unchanged and ends up in the LLM context — often verbose (multi-screen journalctl output, multi-line systemctl status blocks).

Two implementation directions worth considering:

  1. Post-receive output filtering: detect well-known remote commands by parsing ssh ... '<cmd>' and apply the matching rtk filter to the output stream after it returns locally. Works without any setup on the remote.
  2. Remote-side rtk prefix: when the remote machine is known to have rtk installed, prefix the inner command with rtk (i.e. send rtk systemctl status X instead of systemctl status X). Requires a hint mechanism (env var or config file) listing rtk-capable hosts.

Direction (1) is the lower-friction option since it works for any host. Direction (2) gives full RTK filtering quality but adds setup.

Suggested initial scope (direction 1):

For ssh <host> 'systemctl status <unit>':

  • Keep Loaded, Active, Main PID, Memory, Tasks, last 3 log lines
  • Drop CGroup tree, environment dump, repeated whitespace

For ssh <host> 'journalctl ...':

  • Apply standard log dedup (collapse identical-with-timestamp lines)
  • Truncate to last N entries by default

For other commands: pass through with a hint to use rtk on the remote where possible.

Methodology: counts come from rtk discover --all --since 30 against the local Claude Code transcript directory.

贡献者指南