Repository navigation
Open
Labels
Description
Environment
- OpenClaw: 2026.5.3-1
- RTK: 0.38.0
- OS: Linux (WSL2)
Issue Description
The RTK OpenClaw plugin is installed and shows as enabled in openclaw plugins list, but the before_tool_call hook does not intercept exec tool calls. Commands like git status and ls still produce full/uncompressed output rather than RTK-filtered output.
Installation Steps
- Installed RTK: curl -fsSL https://raw.githubusercontent.com/rtk-ai/rtk/refs/heads/master/install.sh | sh
- Copied index.ts and openclaw.plugin.json to ~/.openclaw/extensions/rtk-rewrite/
- Installed plugin: openclaw plugins install ~/.openclaw/extensions/rtk-rewrite
- Restarted gateway: openclaw gateway restart
Plugin Status
- openclaw plugins list -> rtk-rewrite: enabled
- openclaw plugins doctor -> "hook-only. This remains a supported compatibility path"
- openclaw hooks list -> Does NOT list rtk-rewrite (only bundled hooks appear)
- But [plugins] [rtk] OpenClaw hook registered appears in doctor output
Config (openclaw.json)
{
"plugins": {
"enabled": true,
"allow": [
"telegram",
"browser",
"minimax",
"deepseek",
"google",
"memory-core",
"tavily",
"volcengine",
"rtk-rewrite"
],
"entries": {
"rtk-rewrite": {
"enabled": true,
"config": {
"enabled": true,
"verbose": true
}
}
}
}
}
Plugin Source (index.ts)
export default function register(api: any) {
const pluginConfig = api.config ?? {};
const enabled = pluginConfig.enabled !== false;
const verbose = pluginConfig.verbose === true;
if (!enabled) return;
if (!checkRtk()) {
console.warn("[rtk] rtk binary not found in PATH — plugin disabled");
return;
}
api.on(
"before_tool_call",
(event: { toolName: string; params: Record<string, unknown> }) => {
if (event.toolName !== "exec") return;
const command = event.params?.command;
if (typeof command !== "string") return;
const rewritten = tryRewrite(command);
if (!rewritten) return;
if (verbose) {
console.log(`[rtk] ${command} -> ${rewritten}`);
}
return { params: { ...event.params, command: rewritten } };
},
{ priority: 10 }
);
if (verbose) {
console.log("[rtk] OpenClaw plugin registered");
}
}Test Results
| Command | Expected (RTK) | Actual |
|---|---|---|
| git status | ? Untracked: 20 files | Full git status output |
| ls -la | Compressed listing | Full listing with all details |
Questions
- Is there an additional step required to ensure before_tool_call fires for exec tool calls?
- Is there a compatibility issue between OpenClaw 2026.5.3-1 and the hook-only plugin format?
- How can we enable additional debug logs to trace hook execution?
Thank you for this excellent project!
Activity
pszymkowiak commentedon May 27, 2026
🔍 Automated Triage
bugmediumSummary
OpenClaw plugin's before_tool_call hook silently fails to intercept exec tool calls despite plugin showing as enabled; investigate hook registration/event routing for exec tools in OpenClaw integration.
Triaged automatically by wshm · This is an automated analysis, not a human review.
mychataa commentedon May 31, 2026
I am also experiencing this exact same issue on OpenClaw 2026.4.23 with rtk-rewrite plugin.
My observation:
Conclusion: The before_tool_call hook is registered but not firing for exec tool calls. This is a blocking issue for using rtk-rewrite.
Please let us know if there is a fix or workaround. Thank you!
kzzalews commentedon Jul 1, 2026
Opened #2783 with a fix.
Root cause was twofold:
package.jsonmissingopenclaw.extensions— without this field, OpenClaw discovers the plugin viaplugins listbut cannot resolve its entry point, so the runtime never loads it.before_tool_callnever fires.openclaw.plugin.jsonmissingactivation.onStartup— since OpenClaw 2026.6.x, plugins without an explicit activation entry are no longer auto-loaded at startup.The PR adds both fields and introduces an
approvalModeconfig option ("auto"/"ask", default"auto") so exit code 3 no longer hard-blocks onrequireApproval(120s timeout → deny).