long-context-shell
v0.0.1Runs 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...
详细分析 ▾
运行时依赖
版本
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.
安装命令 点击复制
技能文档
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
免费技能或插件可能存在安全风险,如需更匹配、更安全的方案,建议联系付费定制