Claw Background Jobs
Agent Buildingclaw-background-jobsClaw Background Jobs is an Agent Skill for agent building published in the x-cmd/x-cmd repository on GitHub: a SKILL.md instruction file an AI agent can load to do this task.
Claw background job management using x agent run and x agent job. Use when the agent needs to offload complex or long-running tasks that would block the chat.
QUICK START
How to use this skill
Bring this guide into your coding agent with a prompt tailored to the tool you use.
- Open your project in Codex.
- Copy and paste the prompt below.
- Review files and risks before approving any action.
Prompt to paste
Inspect the Agent Skill at https://github.com/x-cmd/x-cmd/blob/HEAD/mod/claw/lib/data/workspace/msg/skills/background-jobs/SKILL.md and all supporting files. Report provenance, permissions, scripts, dependencies, and security risks. Propose an exact installation into .agents/skills/claw-background-jobs, but wait for my approval before writing files or running scripts.
Copying this prompt does not install or run the skill. Review third-party files before use.
Claw Background Jobs Skill
When to Use
Use x agent run for tasks estimated >2 minutes or that would block the chat:
- Multi-step tasks
- Data analysis
- Research
- Anything expected to take >2 minutes
When NOT to Use
- Quick Q&A or simple commands (reply directly)
- Tasks needing back-and-forth clarification (stay in chat)
Commands
x agent run --job-id "<id>" --max-iterations <n> "<task>": Create and start an async job. The AI auto-generates a PLAN.md and iterates until done or max iterations reached.x agent job status --job-id "<id>" --llms: Check progress, iteration count, and whether the job is active/completed (YAML output for parsing).x agent job ls --active --llms: List all active jobs.x agent job stop --job-id "<id>": Stop the background process.
Job ID Convention
Use <im>-<chatid>-<brief> for traceability, e.g., weixin-user123-loganalysis.
Critical Constraints
x agent runexecutes in a fresh environment with NO chat memory. The<task>must be self-contained: clear goal, required tools, expected output.- The job does NOT notify the user automatically. Claw checks status via heartbeat and uses
x claw agentrequestto report results.