首页龙虾技能列表 › long-context-shell

long-context-shell

v0.0.1

Runs long or continuous shell commands with file-backed logs, truncated previews, and fast log scanning. Invoke when shell output may be large, ongoing, or h...

1· 89·0 当前·0 累计
by @qipengguo (QipengGuo)·MIT-0
下载技能包
License
MIT-0
最后更新
2026/3/25
安全扫描
VirusTotal
可疑
查看报告
OpenClaw
安全
high confidence
The skill's code, instructions, and requirements are internally consistent: it runs shell commands, writes file-backed logs under a temp directory, provides peek/scan/stop operations, and does not request unrelated credentials or network access.
评估建议
This skill appears coherent and implements what it promises: executing user-provided shell commands, writing timestamped logs to a temp folder, offering truncated previews, scanning for common error patterns, and stopping background sessions. Before installing or invoking it, consider: (1) it will execute any command you pass (shell -lc on Unix or PowerShell on Windows) — avoid sending destructive or privileged commands unless you explicitly approve them; (2) it stores logs and session state und...
详细分析 ▾
用途与能力
The skill's name and description (long-running shell commands with file-backed logs and scanning) match the provided code and SKILL.md. The handler spawns shell processes, timestamps stdout/stderr into log files, tracks sessions, provides peek/scan/stop tools, and includes tests exercising those features — all expected for this purpose.
指令范围
SKILL.md and the code both instruct the agent to execute arbitrary shell commands via the platform shell and to persist logs and session state under a tmp directory. This is expected for a shell-monitoring tool, but it inherently grants the skill the ability to execute any command the user supplies. The README includes safety guidance (ask before destructive commands), but the code does not enforce a separate approval step — enforcement is left to the agent/owner. Users should be aware that if the agent is instructed (or allowed) to run destructive or privilege-escalating commands, those commands will run with the agent's OS user privileges.
安装机制
There is no install spec (instruction-only skill with bundled code). No external downloads or package installs are required. The code runs from the skill bundle and writes to a temp directory, which is a low-risk install pattern.
凭证需求
The skill does not request environment variables, credentials, or config paths. The code only writes/reads session and log files under os.tmpdir() and uses standard Node APIs. No external service credentials are requested or used.
持久化与权限
The skill persists session JSON and log files under a dedicated tmp directory (os.tmpdir()/trae-long-context-shell). It is not marked always:true. Autonomous invocation is allowed (default), which is normal for skills; combined with the ability to execute arbitrary shell commands, that means an agent with this skill could run commands without an extra install-time prompt if the agent is authorized to do so. There is no evidence the skill modifies other skills or system configurations.
handler.js:169
Shell command execution detected (child_process).
安全有层次,运行前请审查代码。

License

MIT-0

可自由使用、修改和再分发,无需署名。

运行时依赖

无特殊依赖

版本

latestv0.0.12026/3/25

Initial release of long-context-shell skill. - Run long or continuous shell commands with file-backed logs and truncated previews. - Monitor, peek, scan, and stop running sessions for easier management of large or live shell output. - Compact status cards summarize progress; avoid dumping raw command output. - Offers fast log scanning for likely errors, warnings, and failures. - Provides flexible log previewing and timestamp-based querying for efficient inspection. - Includes safety and recommended workflow guidance to prevent accidental destructive actions.

● 可疑

安装命令 点击复制

官方npx clawhub@latest install long-context-shell
镜像加速npx clawhub@latest install long-context-shell --registry https://cn.clawhub-mirror.com

技能文档

Use this skill when a shell command is likely to produce long output, keep running, refresh continuously, or require structured monitoring instead of raw stdout.

Invoke When

  • The command may print more than a small screen of output
  • The command may run for a long time
  • The command may stream continuously, such as watch, top, tail -f, ping, or log followers
  • The command fails and you need a lightweight scan instead of manually reviewing a large log

Core Behavior

  • Always write stdout and stderr to a timestamped log file
  • Return a compact status card instead of raw full output
  • Truncate long previews by default and point to the log file for deeper inspection
  • Preserve timestamps so you can inspect the latest state or a specific time window
  • Offer a lightweight scan step for locating likely errors, warnings, and failures

Tools

long_context_shell_run

Run a shell command in a detached process with file-backed logging.

Inputs

  • command (string, required): shell command to run
  • waitMs (number, optional): how long to wait before returning an initial status card
  • background (boolean, optional): force monitor-first mode and return quickly for later peeks
  • headLines (number, optional): lines to show from the beginning of the log
  • tailLines (number, optional): lines to show from the end of the log

Behavior

  • Start the command through the platform shell
  • Write stdout and stderr to a log file with timestamps
  • If background is true, prefer a short initial wait and return control quickly
  • Return a status card with session id, log path, line count, byte count, status, background mode, and truncated preview
  • If the command still runs, use long_context_shell_peek later instead of rerunning the command

long_context_shell_peek

Read the latest state of an existing session or log file.

Inputs

  • sessionId (string, optional): previously returned session id
  • logPath (string, optional): direct path to a log file if session id is unavailable
  • headLines (number, optional): lines to show from the beginning
  • tailLines (number, optional): lines to show from the end
  • timeQuery (string, optional): timestamp fragment to filter lines, such as 2026-03-24T10:15

Behavior

  • Resolve the session or log file
  • Detect whether the process is still running or already exited
  • Return a compact status card with truncated preview
  • If timeQuery is present, return matching lines for that timestamp fragment

long_context_shell_scan

Scan a large log for likely failures instead of manually reading the full file.

Inputs

  • sessionId (string, optional): previously returned session id
  • logPath (string, optional): direct path to a log file
  • patterns (array of strings, optional): custom match patterns
  • contextLines (number, optional): surrounding lines to include around each match
  • limit (number, optional): maximum number of matches to return

Behavior

  • Search the log for strong failure signals such as error, exception, failed, fatal, and timeout
  • Rank matches by severity so likely root-cause lines appear before generic warnings
  • Return the strongest matches with line numbers, severity, and short context
  • Prefer this tool over manual full-log inspection when output is large

long_context_shell_stop

Stop a running session when monitoring is no longer needed.

Inputs

  • sessionId (string, required): session to stop

Recommended Workflow

  • Use long_context_shell_run for long or continuous commands
  • If status is running, use long_context_shell_peek to monitor progress
  • If status is failed or the preview is too short to explain the problem, use long_context_shell_scan
  • Only read the full log manually when the scan still leaves important ambiguity

Debug Tips

  • Start with a small waitMs and inspect the first status card before increasing complexity
  • If a command is expected to keep running, set background: true and observe with repeated long_context_shell_peek
  • Use timeQuery with the startedAt timestamp prefix to zoom into a suspicious time slice without reading the whole log
  • If preview is truncated, treat logPath as the source of truth and use scan before opening the whole file
  • If scan misses the real issue, retry with custom patterns that match the toolchain, framework, or service you are debugging
  • When shell quoting gets tricky, first validate the raw command directly in the terminal, then move the exact command string into long_context_shell_run
  • Prefer short self-contained repro commands such as node -e or a tiny script file when debugging behavior across shells
  • Remember that shell syntax can differ across Unix and Windows, so commands using pipes, redirects, or quoting may need platform-specific forms
  • For continuous commands, always finish the debug loop with long_context_shell_stop so old sessions do not keep running in the background
  • To review a human-readable end-to-end scenario, run node manual-flow-test.js and inspect the printed status cards and scan output

Safety

  • Do not run destructive commands without explicit user approval
  • Ask before using commands that delete files, reformat disks, reboot the machine, or escalate privileges
  • Prefer long_context_shell_scan over full-log manual review when output is large
  • Use long_context_shell_stop when a continuous command is no longer needed, especially for tail -f, watch, or similar monitoring sessions

Examples

  • Long build:
- long_context_shell_run({ command: "npm run build", waitMs: 1500 })
  • Continuous output:
- long_context_shell_run({ command: "tail -f app.log", background: true, waitMs: 500 })
  • Check latest state:
- long_context_shell_peek({ sessionId: "..." })
  • Check a specific timestamp:
- long_context_shell_peek({ sessionId: "...", timeQuery: "2026-03-24T10:15" })
  • Scan failures:
- long_context_shell_scan({ sessionId: "..." })
  • Human-readable flow test:
- node manual-flow-test.js

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

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

了解定制服务