返回顶部
l

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 hard to inspect directly.

作者: admin | 来源: ClawHub
源自
ClawHub
版本
V 0.0.1
安全检测
已通过
84
下载量
1
收藏
概述
安装方式
版本历史

long-context-shell

# 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`

标签

skill ai

通过对话安装

该技能支持在以下平台通过对话安装:

OpenClaw WorkBuddy QClaw Kimi Claude

方式一:安装 SkillHub 和技能

帮我安装 SkillHub 和 long-context-shell-1776030312 技能

方式二:设置 SkillHub 为优先技能安装源

设置 SkillHub 为我的优先技能安装源,然后帮我安装 long-context-shell-1776030312 技能

通过命令行安装

skillhub install long-context-shell-1776030312

下载 Zip 包

⬇ 下载 long-context-shell v0.0.1

文件大小: 10.58 KB | 发布时间: 2026-4-13 10:54

v0.0.1 最新 2026-4-13 10:54
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.

Archiver·手机版·闲社网·闲社论坛·羊毛社区· 多链控股集团有限公司 · 苏ICP备2025199260号-1

Powered by Discuz! X5.0   © 2024-2025 闲社网·线报更新论坛·羊毛分享社区·http://xianshe.com

p2p_official_large
返回顶部