Files
rtk-ai__rtk/openclaw/openclaw.plugin.json
Alex 56160d8399 feat: OpenClaw plugin for transparent exec rewriting (#358)
* feat: add OpenClaw plugin for transparent exec rewriting

Adds an OpenClaw plugin that intercepts exec tool calls via the
before_tool_call hook and rewrites commands to their RTK equivalents.

This is the OpenClaw equivalent of hooks/rtk-rewrite.sh for Claude Code.

The plugin:
- Registers a before_tool_call hook on the exec tool
- Rewrites git, grep, find, ls, gh, docker, kubectl, and test commands
- Guards against rewriting piped/compound commands and heredocs
- Returns properly typed PluginHookBeforeToolCallResult
- Supports enabled/verbose config options

Measured savings: 48-87% token reduction on common commands.

Files:
- openclaw/index.ts — plugin source
- openclaw/openclaw.plugin.json — plugin manifest
- openclaw/README.md — installation and usage docs

* refactor: delegate OpenClaw plugin to rtk rewrite

Replace 60+ hardcoded regex rules with a single call to `rtk rewrite`,
matching the OpenCode plugin pattern (hooks/opencode-rtk.ts).

Benefits:
- Zero maintenance: new RTK filters work automatically
- Single source of truth: rewrite logic in Rust (src/discover/registry.rs)
- 122 → 73 lines, no rule duplication

Also: rebase on develop, fix homepage URL, bump version to 1.0.0.
Signed-off-by: Patrick szymkowiak <patrick.szymkowiak@innovtech.eu>

* feat: add package.json for npm publishing

Enables `openclaw plugins install @rtk-ai/rtk-rewrite` for OpenClaw users.

Signed-off-by: Patrick szymkowiak <patrick.szymkowiak@innovtech.eu>

---------

Signed-off-by: Patrick szymkowiak <patrick.szymkowiak@innovtech.eu>
Co-authored-by: Patrick szymkowiak <patrick.szymkowiak@innovtech.eu>
2026-03-18 15:00:30 +01:00

29 lines
797 B
JSON

{
"id": "rtk-rewrite",
"name": "RTK Token Optimizer",
"version": "1.0.0",
"description": "Transparently rewrites shell commands to their RTK equivalents for 60-90% LLM token savings",
"homepage": "https://github.com/rtk-ai/rtk",
"license": "MIT",
"configSchema": {
"type": "object",
"additionalProperties": false,
"properties": {
"enabled": {
"type": "boolean",
"default": true,
"description": "Enable automatic command rewriting to RTK equivalents"
},
"verbose": {
"type": "boolean",
"default": false,
"description": "Log rewrite decisions to console for debugging"
}
}
},
"uiHints": {
"enabled": { "label": "Enable RTK rewriting" },
"verbose": { "label": "Verbose logging" }
}
}