Get the FREE Ultimate OpenClaw Setup Guide →

delayed-command

Flagged

{"isSafe":false,"isSuspicious":false,"riskLevel":"medium","findings":[{"category":"shell_command","severity":"high","description":"Delays and executes a user-provided Bash command after a specified duration, enabling execution of potentially destructive or harmful commands.","evidence":"The workflow explicitly supports parsing a duration and then running 'sleep <seconds> && <command>' (e.g., in the Delay and Execute sections)."},{"category":"system_harm","severity":"high","description":"Arbitrary post-delay command execution can be used to perform destructive actions (e.g., file deletion, unauthorized deployments) without immediate user oversight.","evidence":"The command to run after the delay is provided by the user and executed by the system (e.g., 'sleep <seconds> && <command>')."},{"category":"data_exfiltration","severity":"medium","description":"The user-supplied command could perform data exfiltration or external communications if network access is available (e.g., curl/wget to external endpoints).","evidence":"The command field is an unrestricted shell command; nothing in the spec limits network or data access for the executed command."},{"category":"prompt_injection","severity":"low","description":"No explicit prompt-injection defenses are described; risk exists if the skill is exposed in a chat/interface where users can influence or bypass model/system instructions via the delayed command.","evidence":"Content states 'user-invocable: true' and executes user-provided commands after a delay, which could undermine prompt integrity in some integrations."}],"summary":"The Delayed Command Execution skill enables running arbitrary user-provided shell commands after a delay. This is potentially dangerous because it can be misused to perform destructive actions or exfiltrate data. Mitigations should include input validation, command whitelisting, sandboxing, restricted privileges, and audit/logging, plus clear UX safeguards (e.g., confirmation, cancelation, and status reporting)."}

npx machina-cli add skill PaulRBerg/agent-skills/delayed-command --openclaw
Files (1)
SKILL.md
3.2 KB

Delayed Command Execution

Wait for a specified duration, then execute a Bash command.

Arguments

  • duration: Time to wait before execution (e.g., 30s, 5m, 1h, 1h30m)
  • command: The Bash command to run after the delay

Duration Format

FormatExampleMeaning
Xs30s30 seconds
Xm5m5 minutes
Xh1h1 hour
XhYm1h30m1 hour 30 minutes
XhYmZs1h5m30s1 hour 5 min 30 s

Workflow

1. Parse Duration

Convert the duration argument to seconds:

  • Extract hours (h), minutes (m), and seconds (s) components
  • Calculate total seconds: hours * 3600 + minutes * 60 + seconds

Parsing logic:

duration="$1"
seconds=0

# Extract hours
if [[ $duration =~ ([0-9]+)h ]]; then
  seconds=$((seconds + ${BASH_REMATCH[1]} * 3600))
fi

# Extract minutes
if [[ $duration =~ ([0-9]+)m ]]; then
  seconds=$((seconds + ${BASH_REMATCH[1]} * 60))
fi

# Extract seconds
if [[ $duration =~ ([0-9]+)s ]]; then
  seconds=$((seconds + ${BASH_REMATCH[1]}))
fi

2. Execute with Delay

For durations up to 10 minutes (600 seconds):

Run synchronously using the Bash tool with appropriate timeout:

sleep <seconds> && <command>

Set the Bash tool's timeout parameter to at least (seconds + 60) * 1000 milliseconds.

For durations over 10 minutes:

Run in background using run_in_background: true:

sleep <seconds> && <command>

Inform the user the command is running in background and provide the task ID for checking status.

3. Report Result

After execution completes:

  • Display command output
  • Report exit status
  • Note total elapsed time

Examples

Short Delay (Synchronous)

User: /delayed-command 5m npm test

  1. Parse: 5 minutes = 300 seconds
  2. Execute: sleep 300 && npm test (timeout: 360000ms)
  3. Report test results

Long Delay (Background)

User: /delayed-command 1h git commit -m "auto-commit"

  1. Parse: 1 hour = 3600 seconds
  2. Execute in background: sleep 3600 && git commit -m "auto-commit"
  3. Return task ID for status checking

Combined Duration

User: /delayed-command 1h30m ./deploy.sh

  1. Parse: 1h30m = 5400 seconds
  2. Execute in background (>600s): sleep 5400 && ./deploy.sh
  3. Inform user of background task

Error Handling

ErrorResponse
Invalid duration formatShow supported formats and examples
Missing command argumentPrompt for the command to execute
Command not foundReport error after delay completes
Duration exceeds 24hWarn user and suggest alternative (cron, at)

Source

git clone https://github.com/PaulRBerg/agent-skills/blob/main/skills/delayed-command/SKILL.mdView on GitHub

Overview

Delayed Command Execution lets you specify a duration and a Bash command to run after the delay. It supports formats like 5m, 1h, or 1h30m and can run synchronously for short delays or in the background for longer tasks. This enables automation of timed tasks such as tests, deployments, or maintenance commands.

How This Skill Works

The skill converts the duration into total seconds, then sleeps for that period before executing the provided command. For delays up to 10 minutes (600 seconds) it runs synchronously with a suitable timeout; for longer delays it executes the command in the background and returns a task ID for status checks. After completion it reports the command output, exit status, and total elapsed time.

When to Use It

  • Run npm test after 30 minutes
  • Git commit after 1 hour
  • Wait 2h then deploy
  • Sleep 45m and run build
  • After 10m run prettier

Quick Start

  1. Step 1: Enter /delayed-command <duration> <command>
  2. Step 2: The skill parses the duration to seconds and schedules execution
  3. Step 3: Receive results or a background task ID to monitor

Best Practices

  • Use supported duration formats (Xs, Xm, Xh, XhYm, XhYmZs) to avoid parsing errors.
  • Always provide a concrete command to execute after the delay.
  • For short delays, prefer synchronous execution; for delays longer than 10 minutes, run in the background and share a task ID.
  • Validate the command environment and paths to prevent failures after the delay.
  • Test with short delays first to verify the workflow before scheduling longer ones.

Example Use Cases

  • /delayed-command 5m npm test
  • /delayed-command 1h git commit -m 'auto-commit'
  • /delayed-command 1h30m ./deploy.sh
  • /delayed-command 30s echo 'ping'
  • /delayed-command 2h npm run build

Frequently Asked Questions

Add this skill to your agents
Sponsor this space

Reach thousands of developers