/install 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 runwaitMs(number, optional): how long to wait before returning an initial status cardbackground(boolean, optional): force monitor-first mode and return quickly for later peeksheadLines(number, optional): lines to show from the beginning of the logtailLines(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
backgroundis 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_peeklater 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 idlogPath(string, optional): direct path to a log file if session id is unavailableheadLines(number, optional): lines to show from the beginningtailLines(number, optional): lines to show from the endtimeQuery(string, optional): timestamp fragment to filter lines, such as2026-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
timeQueryis 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 idlogPath(string, optional): direct path to a log filepatterns(array of strings, optional): custom match patternscontextLines(number, optional): surrounding lines to include around each matchlimit(number, optional): maximum number of matches to return
Behavior
- Search the log for strong failure signals such as
error,exception,failed,fatal, andtimeout - 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_runfor long or continuous commands - If status is
running, uselong_context_shell_peekto monitor progress - If status is
failedor the preview is too short to explain the problem, uselong_context_shell_scan - Only read the full log manually when the scan still leaves important ambiguity
Debug Tips
- Start with a small
waitMsand inspect the first status card before increasing complexity - If a command is expected to keep running, set
background: trueand observe with repeatedlong_context_shell_peek - Use
timeQuerywith thestartedAttimestamp prefix to zoom into a suspicious time slice without reading the whole log - If
previewis truncated, treatlogPathas the source of truth and usescanbefore opening the whole file - If
scanmisses the real issue, retry with custompatternsthat 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 -eor 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_stopso old sessions do not keep running in the background - To review a human-readable end-to-end scenario, run
node manual-flow-test.jsand 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_scanover full-log manual review when output is large - Use
long_context_shell_stopwhen a continuous command is no longer needed, especially fortail -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
- 确保已安装 OpenClaw(本地或 Docker 部署)
- 在对话框中输入安装命令:
/install long-context-shell - 安装完成后,直接呼叫该 Skill 的名称或使用
/long-context-shell触发 - 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
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。