Skip to main content

RTK plugin for Hermes — rewrites shell commands for 60-90% LLM token savings

Project description

RTK Plugin for Hermes

PyPI License: MIT

Transparently rewrites shell commands executed via Hermes's terminal tool to their RTK equivalents, achieving 60-90% LLM token savings.

Installation

# 1. Install RTK
brew install rtk
# or: curl -fsSL https://raw.githubusercontent.com/rtk-ai/rtk/refs/heads/master/install.sh | sh

# 2. Install the plugin
pip install rtk-hermes

# 3. Restart Hermes — the plugin auto-registers, no config needed

How it works

Agent runs: terminal(command="cargo test --nocapture")
  → Plugin intercepts pre_tool_call hook
  → Calls `rtk rewrite "cargo test --nocapture"`
  → Mutates args["command"] = "rtk cargo test --nocapture"
  → Agent executes the rewritten command
  → Filtered output reaches LLM (~90% fewer tokens)

The plugin registers a pre_tool_call hook that intercepts terminal tool calls. When the agent runs a command like git status, the plugin delegates to rtk rewrite which returns the optimized command (e.g. rtk git status). The compressed output enters the agent's context window, saving tokens.

All rewrite logic lives in RTK itself (rtk rewrite). This plugin is a thin delegate — when new filters are added to RTK, the plugin picks them up automatically with zero changes.

What gets rewritten

Everything that rtk rewrite supports (30+ commands): git, grep, find, ls, cargo, pytest, npm, docker, kubectl, and more. See the full command list.

Measured savings

Command Token savings
cargo test 90-99%
git log --stat 87%
ls -la 78%
git status 66%
grep (single file) 52%

Configuration

The plugin is enabled by default when RTK is found in $PATH. To disable:

# ~/.hermes/config.yaml
plugins:
  disabled:
    - rtk-rewrite

Graceful degradation

The plugin never blocks command execution:

  • RTK binary not found → plugin disabled silently
  • rtk rewrite times out (>2s) → command passes through unchanged
  • rtk rewrite crashes → command passes through unchanged
  • No RTK equivalent → command passes through unchanged

License

MIT — same as RTK.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

rtk_hermes-1.0.0.tar.gz (5.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

rtk_hermes-1.0.0-py3-none-any.whl (4.9 kB view details)

Uploaded Python 3

File details

Details for the file rtk_hermes-1.0.0.tar.gz.

File metadata

  • Download URL: rtk_hermes-1.0.0.tar.gz
  • Upload date:
  • Size: 5.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.6

File hashes

Hashes for rtk_hermes-1.0.0.tar.gz
Algorithm Hash digest
SHA256 13fdbace602fe0b1d6df5018d3b321992c2f9593db27edf2c825a9534a602bee
MD5 42f4f6881189ab39a56049b846b81516
BLAKE2b-256 ab2c5e0a9f7c5836204d3729c89a21461eeb37b4556cc2c5a00de7a729facf1c

See more details on using hashes here.

File details

Details for the file rtk_hermes-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: rtk_hermes-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 4.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.6

File hashes

Hashes for rtk_hermes-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 e3b33b30ed9f8aded13099fece5a4122d388486ef1b3f7c703b6208e97b21f7f
MD5 174f867bd1884a1ec3a49eeef3a45cde
BLAKE2b-256 53b45907649295e84a58df469e01d7d0474ce4e896a72275bd9497f8579a6d41

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page