← Back to Skills Marketplace
qipengguo

long-context-shell

by QipengGuo · GitHub ↗ · v0.0.1 · MIT-0
cross-platform ⚠ suspicious
126
Downloads
1
Stars
0
Active Installs
1
Versions
Install in OpenClaw
/install long-context-shell
Description
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...
README (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
Usage Guidance
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.
Capability Analysis
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.
Capability Assessment
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.
How to Use
  1. Make sure OpenClaw is installed (local or Docker)
  2. Run the install command in chat: /install long-context-shell
  3. After installation, invoke the skill by name or use /long-context-shell
  4. Provide required inputs per the skill's parameter spec and get structured output
Version History
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.
Metadata
Slug long-context-shell
Version 0.0.1
License MIT-0
All-time Installs 0
Active Installs 0
Total Versions 1
Frequently Asked Questions

What is 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... It is an AI Agent Skill for Claude Code / OpenClaw, with 126 downloads so far.

How do I install long-context-shell?

Run "/install long-context-shell" in the OpenClaw or Claude Code chat to install it in one step — no extra setup required.

Is long-context-shell free?

Yes, long-context-shell is completely free, licensed under MIT-0. You can download, install and use it at no cost.

Which platforms does long-context-shell support?

long-context-shell is cross-platform and runs anywhere OpenClaw / Claude Code is available (cross-platform).

Who created long-context-shell?

It is built and maintained by QipengGuo (@qipengguo); the current version is v0.0.1.

💬 Comments