#20647: feat: add exec-passthrough extension for direct output delivery
size: M
Cluster:
Plugin Hook Enhancements
## 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
#17346: feat(hooks): add message_persist hook for all transcript messages
by clawee-vanguard · 2026-02-15
72.4%
#17667: feat: tool-hooks extension — run shell commands on tool calls
by FaradayHunt · 2026-02-16
72.0%
#9199: feat: Add Cisco Webex Teams channel plugin
by chrharri · 2026-02-05
70.9%
#11071: Plugins: add tool_result_received hook for output interception
by ThomasLWang · 2026-02-07
70.7%
#9265: Feature: Telegram Inline Button Support for Exec Approvals
by vishaltandale00 · 2026-02-05
70.7%
#22763: feat: expose per-message linkPreview param in message tool
by chrysb · 2026-02-21
70.5%
#20646: feat: add file-writer extension for shell-safe text passing
by okuyam2y · 2026-02-19
69.8%
#15864: feat: add deliverOnlyToolMessages config for clean messaging channe...
by gandalf-the-engineer · 2026-02-14
69.4%
#18934: fix(agents): suppress exec tool output from channel delivery
by BinHPdev · 2026-02-17
69.3%
#7046: feat(telegram): add placeholder message while processing
by shanemort1982 · 2026-02-02
69.0%