← Back to PRs

#20647: feat: add exec-passthrough extension for direct output delivery

by okuyam2y open 2026-02-19 05:34 View on GitHub →
size: M
## Summary - Adds an extension that intercepts `__PASSTHROUGH__` markers in exec tool results and sends content directly to the user's channel - Bypasses LLM re-summarization — the LLM sees only a slim placeholder - Currently supports Telegram as delivery channel, with a `ChannelSender` interface for extensibility ## Motivation When CLI tools produce formatted output (reports, tables, summaries), the LLM often re-summarizes or reformats it unnecessarily. This is wasteful for both tokens and user experience. With exec-passthrough, CLI scripts can wrap output in markers: ```bash echo "__PASSTHROUGH__" cat formatted-report.txt echo "__END_PASSTHROUGH__" ``` The plugin: 1. Detects the markers in the `tool_result_persist` hook 2. Sends the marked content directly to the user's channel (e.g. Telegram) 3. Replaces the tool result with `[output sent directly to user — no reply needed]` 4. The LLM sees only the slim result and generates minimal confirmation ## Architecture ``` CLI script → exec tool → tool_result_persist hook ↓ extractPassthrough() ↓ ↓ ChannelSender Slim for LLM (Telegram API) (replaces tool result) ``` The `ChannelSender` interface allows adding support for other channels (Slack, Discord, etc.) without changing the core marker parsing logic. ## Files | File | Description | |------|-------------| | `extensions/exec-passthrough/index.ts` | Plugin entry point | | `extensions/exec-passthrough/openclaw.plugin.json` | Plugin manifest | | `extensions/exec-passthrough/package.json` | Package metadata | | `extensions/exec-passthrough/src/passthrough.ts` | Marker parsing + Telegram sender | ## Configuration ```json { "plugins": { "exec-passthrough": { "channel": "telegram" } } } ``` Reads Telegram bot token and chat ID from the main OpenClaw config (`channels.telegram.botToken` / `channels.telegram.allowFrom`). ## Test plan - [x] `tsgo --noEmit` passes - [ ] Manual test: exec a script that outputs `__PASSTHROUGH__` markers - [ ] Verify Telegram receives the content directly - [ ] Verify LLM sees only the slim placeholder <!-- greptile_comment --> <h3>Greptile Summary</h3> Adds a new `exec-passthrough` plugin that intercepts `__PASSTHROUGH__` markers in exec tool output and sends content directly to Telegram, bypassing LLM re-summarization. The plugin hooks into `tool_result_persist` to detect markers, extract content, and deliver it via Telegram API. **Key changes:** - New plugin structure under `extensions/exec-passthrough/` - Marker parsing logic extracts content between `__PASSTHROUGH__` and `__END_PASSTHROUGH__` - Telegram sender chunks messages at 4000 char limit - Replaces marked content with slim placeholder for LLM **Issues found:** - Critical: `toolName` accessed incorrectly from message instead of event context (line 127) - The plugin correctly registers on the `tool_result_persist` hook with appropriate priority <h3>Confidence Score: 3/5</h3> - This PR contains a critical bug that will prevent the plugin from working correctly - The plugin won't function due to accessing `toolName` from the wrong location (message vs context). Once fixed, the implementation is straightforward and follows established patterns. - passthrough.ts requires a fix on line 127 to access toolName from event context <sub>Last reviewed commit: 4e88d36</sub> <!-- greptile_other_comments_section --> <sub>(4/5) You can add custom instructions or style guidelines for the agent [here](https://app.greptile.com/review/github)!</sub> <!-- /greptile_comment -->

Most Similar PRs