Get the FREE Ultimate OpenClaw Setup Guide →

no-polling-agents

npx machina-cli add skill parcadei/Continuous-Claude-v3/no-polling-agents --openclaw
Files (1)
SKILL.md
1.2 KB

No Polling for Background Agents

When launching parallel background agents, do NOT poll with sleep loops.

Pattern

Background agents write to status files when complete. Wait for them naturally.

DO

  • Launch agents with run_in_background: true
  • Continue with other work while agents run
  • Check status file only when user asks or when you need results to proceed
  • Trust the agent completion system

DON'T

  • Run sleep 10 && cat status.txt in loops
  • Continuously poll for completion
  • Waste tokens checking status repeatedly
  • Block on agents unless absolutely necessary

When to Check Status

  1. User explicitly asks "are they done?"
  2. You need agent output to proceed with next task
  3. Significant time has passed and user is waiting

Example

// Launch agents
Task({ ..., run_in_background: true })
Task({ ..., run_in_background: true })

// Continue with other work or conversation
// Agents will write to status file when done

// Only check when needed
cat .claude/cache/status.txt

Source

User feedback: "You can just wait until everyone pings you"

Source

git clone https://github.com/parcadei/Continuous-Claude-v3/blob/main/.claude/skills/no-polling-agents/SKILL.mdView on GitHub

Overview

No Polling for Background Agents avoids sleep loops by letting background tasks signal completion via a status file. Launch agents in the background and continue work, checking status only when needed. This approach saves tokens and aligns with a natural completion system.

How This Skill Works

Background agents run with run_in_background: true and write their completion state to a status file. You proceed with other tasks and only read the status file when the user asks or when results are required to proceed. The status file (for example .claude/cache/status.txt) serves as the single source of truth for completion.

When to Use It

  • You launch multiple background agents with run_in_background: true and want to continue conversing or working without blocking.
  • The user explicitly asks, “are they done?” and you need a definitive answer.
  • You need the agents’ output to proceed with the next task and cannot block on polling.
  • Significant time has passed and the user is waiting, making polling wasteful.
  • You want to minimize token waste from repeated status checks and rely on a single completion signal.

Quick Start

  1. Step 1: Launch agents with Task({ ..., run_in_background: true })
  2. Step 2: Continue with other work or conversation; do not poll
  3. Step 3: When needed, check status via cat .claude/cache/status.txt

Best Practices

  • Launch agents with run_in_background: true to avoid blocking the main flow.
  • Do not poll with sleep loops; rely on the status file written by agents.
  • Check the status file only when the user asks or when results are required to proceed.
  • Trust the agent completion system and its status-file signaling.
  • Continue with other work while agents run to maximize throughput.

Example Use Cases

  • Launch two tasks in the background using Task({ ..., run_in_background: true }) and continue the conversation while they run.
  • When the user asks for results, read the status file at .claude/cache/status.txt to determine completion before presenting results.
  • Avoid sleep-based polling; rely on the status file to signal completion and fetch outputs only when needed.
  • If a long-running task is underway, keep the dialogue flowing and check status only when results are required.
  • If time has passed and the user is waiting, use the status file to decide whether to present interim progress or final results.

Frequently Asked Questions

Add this skill to your agents
Sponsor this space

Reach thousands of developers