← 返回 Skills 市场
qipengguo

long-context-shell

作者 QipengGuo · GitHub ↗ · v0.0.1 · MIT-0
cross-platform ⚠ suspicious
126
总下载
1
收藏
0
当前安装
1
版本数
在 OpenClaw 中安装
/install long-context-shell
功能描述
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...
使用说明 (SKILL.md)

Long Context Shell

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

  1. Start the command through the platform shell
  2. Write stdout and stderr to a log file with timestamps
  3. If background is true, prefer a short initial wait and return control quickly
  4. Return a status card with session id, log path, line count, byte count, status, background mode, and truncated preview
  5. 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

  1. Resolve the session or log file
  2. Detect whether the process is still running or already exited
  3. Return a compact status card with truncated preview
  4. 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

  1. Search the log for strong failure signals such as error, exception, failed, fatal, and timeout
  2. Rank matches by severity so likely root-cause lines appear before generic warnings
  3. Return the strongest matches with line numbers, severity, and short context
  4. 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

  1. Use long_context_shell_run for long or continuous commands
  2. If status is running, use long_context_shell_peek to monitor progress
  3. If status is failed or the preview is too short to explain the problem, use long_context_shell_scan
  4. 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
安全使用建议
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 under your system temp directory (trae-long-context-shell) — remove stale sessions/logs if needed; (3) no credentials are requested, but the skill runs with the agent process's OS privileges, so ensure the agent runs in an appropriate sandbox; (4) if you need stricter safeguards, review the handler.js code locally or run the included tests in a safe environment to confirm behavior. Overall the skill is internally consistent, but exercise the usual caution because it executes arbitrary shell commands.
功能分析
Type: OpenClaw Skill Name: long-context-shell Version: 0.0.1 The skill provides high-risk capabilities including arbitrary shell execution and background process management via 'long_context_shell_run'. It contains an arbitrary file read vulnerability in 'handler.js' because the 'long_context_shell_peek' and 'long_context_shell_scan' tools accept a 'logPath' parameter without path sanitization or sandboxing, allowing the agent to read any file on the system (e.g., SSH keys or configuration files). While 'handler.js' includes a 'isDangerousCommand' safety check, it uses a naive regex-based blocklist that is easily bypassed.
能力评估
Purpose & Capability
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.
Instruction Scope
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.
Install Mechanism
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.
Credentials
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.
Persistence & Privilege
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.
如何使用
  1. 确保已安装 OpenClaw(本地或 Docker 部署)
  2. 在对话框中输入安装命令:/install long-context-shell
  3. 安装完成后,直接呼叫该 Skill 的名称或使用 /long-context-shell 触发
  4. 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
版本历史
v0.0.1
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.
元数据
Slug long-context-shell
版本 0.0.1
许可证 MIT-0
累计安装 0
当前安装数 0
历史版本数 1
常见问题

long-context-shell 是什么?

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... 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 126 次。

如何安装 long-context-shell?

在 OpenClaw 或 Claude Code 对话框中运行命令「/install long-context-shell」即可一键安装,无需额外配置。

long-context-shell 是免费的吗?

是的,long-context-shell 完全免费,采用 MIT-0 许可证,可自由下载、安装和使用。

long-context-shell 支持哪些平台?

long-context-shell 跨平台运行,可在任意部署了 OpenClaw / Claude Code 的环境中使用(cross-platform)。

谁开发了 long-context-shell?

由 QipengGuo(@qipengguo)开发并维护,当前版本 v0.0.1。

💬 留言讨论