Non-Blocking Execution Skill
Agents often need to run servers (npm start), watchers (npm run watch), or long builds. Standard execution blocks the agent until the command finishes—which for a server is never.
1. The Async Pattern (Preventing the Hang)
The Problem: By default, run_command waits for the command to finish. For npm run dev, this means the agent hangs forever and never gets to Step 3.
The Solution: You MUST use the WaitMsBeforeAsync parameter.
- This parameter tells the tool: "Run for X milliseconds, then detach and give me back control."
- This is the ONLY way to run a server without killing it or hanging the agent.
Mandatory Parameters
WaitMsBeforeAsync: Set to 2000 (2 seconds).
- Effect: The tool runs the command, waits 2 seconds to catch startup errors, and then IMMEDIATELY returns a
CommandId while the process keeps running in the background.
- Result: You regain control to perform Step 2 & 3.
Example
// ❌ WRONG - The agent will HANG FOREVER here.
// It will never reach the next line of code.
run_command({ CommandLine: "npm run dev" })
// ✅ CORRECT - The agent waits 2 seconds, then wakes up.
// The server stays running in the background.
run_command({
CommandLine: "npm run dev",
WaitMsBeforeAsync: 2000
})
2. The Verification Loop
Async commands return a CommandId. You MUST verify they are actually running.
- Launch: Run with
WaitMsBeforeAsync: 2000.
- Wait: Sleep/Tokens (implicit in tool usage).
- Check Status: Use
command_status with the CommandId and WaitDurationSeconds: 5 (to peek at new output).
- Status: Is it
running?
- Output: Does it say "Server started on localhost:3000"?
- Confirm: Only proceed once output confirms success.
3. Clean Termination (Ctrl+C)
Trigger: You are done testing the server or need to stop a blocking process.
Tool: send_command_input
- Action:
Terminate: true
- Why?: Leaving zombie servers eats resources and blocks ports for future agents.
- Equivalent: This is exactly the same as pressing
Ctrl+C in a terminal.
Example:
// Stop the server
send_command_input({
CommandId: "previously-returned-uuid",
Terminate: true
})
4. Troubleshooting Blocking Commands
If you accidentally run a blocking command (forgot WaitMsBeforeAsync):
- You will likely timeout or be stuck.
- In the next turn, IMMEDIATELY use
send_command_input with Terminate: true on the blocking command if you can identify it, or ask the user to kill it.
- Self-Correction: Restart the command with
WaitMsBeforeAsync: 2000.
5. Common Blocking Commands (The Block List)
MANDATORY: If you see a command in this list OR a compound command containing one of these (e.g., npm install && npm run dev), you MUST use WaitMsBeforeAsync: 2000.
Compound Commands (Chains)
- Rule: If a command uses
&&, ;, or | and any part of it is a blocking command, the entire command is blocking.
- Example:
npm install && npm start -> BLOCKING. Use async pattern.
- Example:
cd app && python manage.py runserver -> BLOCKING. Use async pattern.
Web & Node.js
npm start, npm run start, npm run dev, npm run watch, npm run serve, npm run build:watch
yarn start, yarn dev, yarn watch
pnpm start, pnpm dev
npx next dev, npx vite, npx webpack serve, npx nodemon
node --watch
Mobile (iOS/Android/Cross-Platform)
npx react-native start, npx expo start
flutter run, flutter drive
./gradlew installDebug, ./gradlew bootRun
xcodebuild -scheme <Schema> run
adb logcat (unless piped/limited)
Backend & Systems
- Python:
python manage.py runserver, uvicorn, flask run, celery worker
- .NET:
dotnet watch, dotnet run
- Java/JVM:
./gradlew bootRun, mvn spring-boot:run
- Go:
go run ., air (live reload)
- Rust:
cargo run, cargo watch
- Ruby:
rails server, bundle exec sidekiq
- PHP:
php artisan serve, symfony server:start
Infrastructure & Tools
- Docker:
docker-compose up (without -d), docker run (without -d if interactive service)
- Database Consoles:
psql, mysql, mongo (interactive shells block)
- Terraform/Cloud:
terraform apply (can be long/interactive), kubectl port-forward, kubectl logs -f
Converted and distributed by TomeVault — claim your Tome and manage your conversions.
1---2name: non-blocking-execution3description: Guidelines for running long-lived processes (servers, watchers) without blocking agent execution. Use when this capability is needed.4---56# Non-Blocking Execution Skill78Agents often need to run servers (`npm start`), watchers (`npm run watch`), or long builds. Standard execution blocks the agent until the command finishes—which for a server is **never**.910## 1. The Async Pattern (Preventing the Hang)1112**The Problem**: By default, `run_command` waits for the command to finish. For `npm run dev`, this means the agent **hangs forever** and never gets to Step 3.1314**The Solution**: You **MUST** use the `WaitMsBeforeAsync` parameter.15- This parameter tells the tool: "Run for X milliseconds, then **detach** and give me back control."16- This is the ONLY way to run a server without killing it or hanging the agent.1718### Mandatory Parameters19- **`WaitMsBeforeAsync`**: Set to `2000` (2 seconds).20 - **Effect**: The tool runs the command, waits 2 seconds to catch startup errors, and then **IMMEDIATELY returns** a `CommandId` while the process keeps running in the background.21 - **Result**: You regain control to perform Step 2 & 3.2223### Example24```javascript25// ❌ WRONG - The agent will HANG FOREVER here.26// It will never reach the next line of code.27run_command({ CommandLine: "npm run dev" })2829// ✅ CORRECT - The agent waits 2 seconds, then wakes up.30// The server stays running in the background.31run_command({ 32 CommandLine: "npm run dev",33 WaitMsBeforeAsync: 2000 34})35```3637## 2. The Verification Loop3839Async commands return a `CommandId`. You **MUST** verify they are actually running.40411. **Launch**: Run with `WaitMsBeforeAsync: 2000`.422. **Wait**: Sleep/Tokens (implicit in tool usage).433. **Check Status**: Use `command_status` with the `CommandId` and `WaitDurationSeconds: 5` (to peek at new output).44 - **Status**: Is it `running`?45 - **Output**: Does it say "Server started on localhost:3000"?464. **Confirm**: Only proceed once output confirms success.4748## 3. Clean Termination (Ctrl+C)4950**Trigger**: You are done testing the server or need to stop a blocking process.51**Tool**: `send_command_input`5253- **Action**: `Terminate: true`54- **Why?**: Leaving zombie servers eats resources and blocks ports for future agents.55- **Equivalent**: This is exactly the same as pressing `Ctrl+C` in a terminal.5657**Example**:58```javascript59// Stop the server60send_command_input({61 CommandId: "previously-returned-uuid",62 Terminate: true63})64```6566## 4. Troubleshooting Blocking Commands6768If you accidentally run a blocking command (forgot `WaitMsBeforeAsync`):691. You will likely timeout or be stuck.702. In the next turn, **IMMEDIATELY** use `send_command_input` with `Terminate: true` on the blocking command if you can identify it, or ask the user to kill it.713. **Self-Correction**: Restart the command with `WaitMsBeforeAsync: 2000`.7273## 5. Common Blocking Commands (The Block List)7475**MANDATORY**: If you see a command in this list OR a compound command containing one of these (e.g., `npm install && npm run dev`), you MUST use `WaitMsBeforeAsync: 2000`.7677### Compound Commands (Chains)78- **Rule**: If a command uses `&&`, `;`, or `|` and *any part* of it is a blocking command, the **entire command** is blocking.79- **Example**: `npm install && npm start` -> **BLOCKING**. Use async pattern.80- **Example**: `cd app && python manage.py runserver` -> **BLOCKING**. Use async pattern.8182### Web & Node.js83- `npm start`, `npm run start`, `npm run dev`, `npm run watch`, `npm run serve`, `npm run build:watch`84- `yarn start`, `yarn dev`, `yarn watch`85- `pnpm start`, `pnpm dev`86- `npx next dev`, `npx vite`, `npx webpack serve`, `npx nodemon`87- `node --watch`8889### Mobile (iOS/Android/Cross-Platform)90- `npx react-native start`, `npx expo start`91- `flutter run`, `flutter drive`92- `./gradlew installDebug`, `./gradlew bootRun`93- `xcodebuild -scheme <Schema> run`94- `adb logcat` (unless piped/limited)9596### Backend & Systems97- **Python**: `python manage.py runserver`, `uvicorn`, `flask run`, `celery worker`98- **.NET**: `dotnet watch`, `dotnet run`99- **Java/JVM**: `./gradlew bootRun`, `mvn spring-boot:run`100- **Go**: `go run .`, `air` (live reload)101- **Rust**: `cargo run`, `cargo watch`102- **Ruby**: `rails server`, `bundle exec sidekiq`103- **PHP**: `php artisan serve`, `symfony server:start`104105### Infrastructure & Tools106- **Docker**: `docker-compose up` (without `-d`), `docker run` (without `-d` if interactive service)107- **Database Consoles**: `psql`, `mysql`, `mongo` (interactive shells block)108- **Terraform/Cloud**: `terraform apply` (can be long/interactive), `kubectl port-forward`, `kubectl logs -f`109110---111> Converted and distributed by [TomeVault](https://tomevault.io/claim/seanspiesman) — claim your Tome and manage your conversions.112<!-- tomevault:4.0:skill_md:2026-04-15 -->