Skip to content

Feature request: rtk wrapper for ssh remote commands #1607

Closed as duplicate

Description

@mshogin

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.

Activity

  1. added
    effort-large
    enhancement
    on Apr 29, 2026
  2. pszymkowiak commented on Apr 29, 2026

    @pszymkowiak
    Collaborator

    wshm · Automated triage by AI

    🔍 Automated Triage

    ✨ Category feature
    🟡 Priority medium
    🎯 Confidence 85%

    Summary

    Feature request to add rtk wrapper/filter for SSH remote commands (systemctl, journalctl, etc.), partially overlaps with #2073 which already tracks ssh coverage


    Triaged automatically by wshm · This is an automated analysis, not a human review.

  3. pitimon commented on Apr 30, 2026

    @pitimon

    FYI — there is already a built-in ssh filter in the registry (rtk verify --filter ssh reports 3/3 passing on 0.37.2), but it currently does not fire on the Claude Code hook path because rtk rewrite returns exit 1 for every ssh shape. Filed as #1654 with reproduction. The FR here is real, just flagging in case fixing the existing filter wiring is cheaper than shipping a new wrapper.

  4. KuSh commented on Sep 5, 2026

    @KuSh
    Collaborator

    Closing as a duplicate of #333, which tracks the same problem with the more complete discussion. Please follow up there; if your case differs in a way that issue does not cover, comment here and it can be reopened.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:clieffort-largeenhancementhelp wantedpriority:medium

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions