首页openclaw插件 › Openclaw Exec Truncate — 插件工具

代码插件 安全

Openclaw Exec Truncate — 插件工具

v1.0.0

The plugin's code, instructions, and configuration are internally consistent with its stated purpose (truncating exec/bash output); it does not request unrelated credentials or elevated privileges and does not contain obvious exfiltration behavior.

0· 0·0 当前
下载插件包 项目主页
最后更新
2026/4/7
安全扫描
VirusTotal
无害
查看报告
OpenClaw
安全
high confidence
The plugin's code, instructions, and configuration are internally consistent with its stated purpose (truncating exec/bash output); it does not request unrelated credentials or elevated privileges and does not contain obvious exfiltration behavior.
安全有层次,运行前请审查代码。

版本

latestv1.0.02026/4/7
● 无害

安装命令 点击复制

官方npx clawhub@latest install openclaw-exec-truncate
镜像加速npx clawhub@latest install openclaw-exec-truncate --registry https://cn.clawhub-mirror.com

插件文档

exec-truncate

Domain-aware output truncation for the OpenClaw exec tool.

Installs as an OpenClaw plugin. Intercepts exec / bash output, detects the command domain from output patterns, and compresses verbose output — git diffs, logs, grep results, directory listings, and build logs — down to their informative core.

# before
+import { defineConfig } from 'vite'                 # 2,847 lines of diff
+import { defineConfig } from 'vite'
...
+export default defineConfig({                       # +2,840 more lines
# after
+import { defineConfig } from 'vite'
  ... [2845 lines truncated by exec-truncate] ...
+export default defineConfig({

Token savings: 20–40% on typical git/build/grep output.


Supported Domains

DomainDetectsWhat it does
gitDiffdiff --git, index [hash]Additions-only head+tail; skips unchanged context lines
gitLog40-char hash + Author:One line per commit: hash7 \subject
grepfile:line:colStrips absolute paths; deduplicates identical matches
lsdrwxr-xr-x perms formatIcon + abbreviated size + name; strips perms/owner/time
builderror, Error, warning keywordsStrips ANSI, progress bars; keeps errors and warnings

Installation

openclaw plugins install exec-truncate
openclaw gateway restart

Or add to your openclaw.json:

{
  "plugins": {
    "entries": [
      { "module": "exec-truncate" }
    ]
  }
}

Uninstallation

Via OpenClaw CLI (recommended)

openclaw plugins uninstall exec-truncate
openclaw gateway restart

Via Uninstall Script

If the CLI is not available, use the bundled uninstall script:

cd /path/to/openclaw-exec-truncate
./uninstall.sh

Options:

    • --force: Skip confirmation prompt
    • Environment variable OPENCLAW_CONFIG_PATH: Override config location (default: ~/.openclaw/openclaw.json)

The uninstall script will:

    • Find your OpenClaw config automatically
    • Back up the config before modification
    • Remove the exec-truncate entry from plugins.entries
    • Verify removal succeeded
    • Show backup location for recovery

Configuration

Defaults work out of the box. Override per domain in openclaw.json:

{
  "plugins": {
    "entries": [
      { "module": "exec-truncate" }
    ]
  },
  "skills": {
    "entries": {
      "exec-truncate": {
        "config": {
          "enabled": true,
          "gitDiff": { "headLines": 80, "tailLines": 20 },
          "gitLog": { "maxLines": 50 },
          "grep": { "maxMatches": 50 },
          "ls": { "maxEntries": 100 },
          "build": { "headLines": 10, "tailLines": 30 }
        }
      }
    }
  }
}
OptionDefaultDescription
enabledtrueMaster kill switch
gitDiff.headLines80Addition lines to keep at start
gitDiff.tailLines20Addition lines to keep at end
gitLog.maxLines50Max commit summary lines
grep.maxMatches50Max grep result lines
ls.maxEntries100Max directory entry lines
build.headLines10Build output lines to keep at start
build.tailLines30Error/warning lines to keep at end

Behavior

    • Small outputs pass through unchanged. Outputs under 200 characters are not truncated.
    • Detection is output-based, not command-based. The plugin reads the output content and identifies the domain from patterns — no command metadata required.
    • The MARKER... [N lines truncated by exec-truncate] ... — appears whenever lines are omitted, so you always know truncation happened.
    • All domains can be disabled individually via domain.enabled: false.

Testing

npm install
npm test        # 25 tests — truncation functions + hook integration

Architecture

tool_result_persist (synchronous hook)
  └── message.content
        ├── string → used directly
        └── array  → text parts joined, filtered to type:"text"
              ├── < 200 chars → returned unchanged
              ├── domain detected? → apply domain truncation
              └── no domain → returned unchanged

Changelog

    • 1.0.0 — Initial release. 5 domains: gitDiff, gitLog, grep, ls, build.

Built with OpenClaw Plugin SDK.

数据来源:ClawHub ↗ · 中文优化:龙虾技能库
OpenClaw 技能定制 / 插件定制 / 私有工作流定制

免费技能或插件可能存在安全风险,如需更匹配、更安全的方案,建议联系付费定制

了解定制服务