Install
openclaw skills install terminal-killerClawHub Security found sensitive or high-impact capabilities. Review the scan results before using.
Intelligent shell command detector and executor for OpenClaw. Automatically identifies terminal commands (system builtins, $PATH executables, history matches, command patterns) and executes directly without LLM overhead. Cross-platform support (macOS/Linux/Windows). Use when user input appears to be a shell command to skip AI processing and run immediately.
openclaw skills install terminal-killer🚀 Smart command router that executes shell commands directly, bypassing LLM for instant terminal operations.
Terminal Killer automatically activates when user input matches command patterns. No special syntax needed — just type commands naturally:
ls -la # → Direct exec
git status # → Direct exec
npm install # → Direct exec
"help me code" # → LLM handles normally
User Input → Command Detector → Decision
├── Command → exec (direct)
└── Task → LLM (normal)
Terminal Killer automatically loads your shell environment before executing commands:
~/.zshrc, ~/.bash_profile, ~/.bashrc, etc.)export VAR=value settingsThis ensures commands like adb, kubectl, docker, etc. work exactly as they do in your terminal!
$PATH for matching executablesChecks input against known builtin commands for the current OS:
| macOS/Linux | Windows (PowerShell) | Windows (CMD) |
|---|---|---|
cd, pwd, ls | cd, pwd, ls | cd, dir, cls |
echo, cat | echo, cat | echo, type |
mkdir, rm, cp | mkdir, rm, cp | mkdir, del, copy |
grep, find | grep, find | findstr |
git, npm, node | git, npm, node | git, npm, node |
See references/builtins/ for complete lists.
Scans $PATH directories to verify if the first word is an executable:
# Uses `which` (Unix) or `Get-Command` (PowerShell)
which <command> # Returns path if exists
Compares input against recent shell history (~/.zsh_history, ~/.bash_history, PowerShell history):
Heuristic scoring based on command characteristics:
| Pattern | Score | Example |
|---|---|---|
| Starts with known command | +3 | git status |
| Contains shell operators | +2 | `ls |
| Contains path references | +2 | cd ~/projects |
| Contains flags/args | +1 | npm install --save |
Contains $ variables | +2 | echo $HOME |
| Contains redirection | +2 | cat file > out |
| Looks like natural language | -3 | "please help me" |
| Contains question marks | -2 | "how do I...?" |
Score >= 5 → EXECUTE (high confidence command)
Score 3-4 → ASK (uncertain, confirm with user)
Score < 3 → LLM (likely a task/request)
Terminal Killer triggers automatically when:
Terminal Killer automatically detects and handles interactive shell commands:
Detected Patterns:
adb shell - Opens new terminal with adb shellssh user@host - Opens SSH session in new windowdocker exec -it container bash - Opens container shellmysql -u root -p - Opens MySQL clientpython, node, bash - Opens REPL in new windowBehavior:
Force command execution:
!ls -la # Force exec even if uncertain
Force LLM handling:
?? explain git # Force LLM even if looks like command
Automatically flags potentially dangerous operations:
rm -rf / or similar destructive patternssudo commands (requires explicit approval)dd, mkfs, chmod 777Dangerous command detected!
Command: rm -rf ./important-folder
Risk: HIGH - Recursive delete
[Approve] [Deny] [Edit]
All executed commands are logged to:
~/.openclaw/logs/terminal-killer.log
Log format:
{
"timestamp": "2026-02-28T12:00:00Z",
"command": "ls -la",
"confidence": 8,
"execution_time_ms": 45,
"output_lines": 12,
"status": "success"
}
Add to your OpenClaw config:
terminal-killer:
enabled: true
confidence_threshold: 5
require_approval_for:
- "rm -rf"
- "sudo"
- "dd"
- "mkfs"
log_executions: true
max_history_check: 100 # How many history entries to check
Automatically detects OS and adjusts detection rules:
# Auto-detected at runtime
uname -s # Darwin, Linux, etc.
See scripts/detect-command.js for the main detection logic.
scripts/check-path.js - Verify executable in PATHscripts/check-history.js - Match against shell historyscripts/score-command.js - Calculate confidence scorescripts/safety-check.js - Detect dangerous patternsSee references/TESTING.md for comprehensive test guide.
Quick test:
# Run the test suite
node scripts/test-detector.js
# Test specific commands
node scripts/detect-command.js "ls -la"
node scripts/detect-command.js "help me write code"
To add new builtin commands for your platform:
references/builtins/<platform>.txtscripts/test-detector.jsAuthor: Cosper
Contact: cosperypf@163.com
License: MIT
Interested in this skill? Have suggestions, bug reports, or want to collaborate?
Built for the OpenClaw community. Thanks to everyone contributing to the ecosystem!
🎯 Core Improvements:
✅ Faithful Command Execution
🪟 Interactive Shell Detection
adb shell, ssh, docker exec -it, etc.)📜 Long Output Handling
📦 Files Updated:
scripts/index.js - Long output detection + interactive command handlingscripts/interactive.js - New Terminal window openerSKILL.md - Updated documentationREADME.md - Usage examplesclawhub.json - Version bump to 1.1.0Initial Release:
Version: 1.1.0
Created: 2026-02-28
Last Updated: 2026-02-28