| name | orchestrator |
| description | Task lifecycle manager for Nexus. Create, monitor, continue, and manage background AI tasks. Use when: (1) breaking complex work into parallel/sequential subtasks, (2) checking task progress or results, (3) following up on completed tasks with new questions, (4) cancelling or cleaning up tasks. Designed for external agents (OpenClaw, Claude, etc.) to delegate and track work without context blowup. |
Tip: For complex multi-step goals that need decomposition into milestones with role-based agents (planner/coder/reviewer/tester), use the mission skill instead.
Task Orchestrator (ไปปๅก็ผๆ + ็ฎก็)
You are a Task Orchestrator. You can create, monitor, query, cancel, and delete background AI tasks via the Nexus Task API.
โ ๏ธ Context Management Rules
Background tasks can produce very long output. To avoid blowing up your context window:
- Use
list first โ get compact task summaries (1 line per task)
- Use
result โ get only the final answer (not full conversation)
- Use
log --tail N โ get only the last N messages when you need conversation detail
- Never dump full logs โ always use
--tail or --max-chars limits
- Batch status checks โ use
list --status doing instead of checking tasks one by one
Tool: Task Manager Script
All operations use the same script with subcommands:
python3 prompts/skills/orchestrator/scripts/orchestrator.py <command> [options]
Global Options
| Option | Default | Description |
|---|
--api | http://localhost:8081/api/nexus | Nexus API base URL |
--exec-user | ubuntu | User namespace for task isolation. Each exec-user has their own task queue. Use the system user running the agent (typically ubuntu). |
Commands Reference
plan โ Batch Create Tasks from JSON
Break complex work into subtasks with dependencies:
python3 prompts/skills/orchestrator/scripts/orchestrator.py plan \
--project-id "my-project" \
--plan '{"tasks": [
{"id": "t1", "title": "Design API", "description": "Design REST API schema", "provider": "claude"},
{"id": "t2", "title": "Implement API", "description": "Build the API endpoints", "provider": "codex", "depends_on": ["t1"]},
{"id": "t3", "title": "Write tests", "description": "Unit tests for API", "provider": "codebuddy", "depends_on": ["t2"]}
]}'
Plan JSON format:
| Field | Required | Description |
|---|
id | Yes | Temp ID for dependency references (e.g. "t1") |
title | Yes | Short task title |
description | Yes | Detailed instructions for the AI executor |
provider | No | claude / gemini / codex / codebuddy |
alias | No | Provider alias |
exec_user | No | Override exec user for this task |
workspace | No | Working directory path |
depends_on | No | List of temp IDs this task depends on |
Provider selection guide:
Providers depend on backend configuration. Common options:
- claude: General tasks, reasoning, code review, documentation
- gemini: Data analysis, multimodal, knowledge Q&A
- codex: Code generation, programming tasks
- codebuddy: IDE-integrated coding, refactoring
If unsure which providers are available, omit the provider field and let the system use its default.
create โ Create Single Task
python3 prompts/skills/orchestrator/scripts/orchestrator.py create "Analyze the auth module and suggest improvements" \
--provider claude --workspace ~/Projects/myapp
list โ List Tasks (Compact)
python3 prompts/skills/orchestrator/scripts/orchestrator.py list
python3 prompts/skills/orchestrator/scripts/orchestrator.py list --status doing
python3 prompts/skills/orchestrator/scripts/orchestrator.py list --search "API" --page-size 10
python3 prompts/skills/orchestrator/scripts/orchestrator.py list --project-id my-project
Output is 1 line per task โ safe for large task lists:
Tasks (3/15, page 1):
[TODO ] abc123 Design API schema (claude)
[DOING ] def456 Implement endpoints (codex) deps=[abc123]
[DONE ] ghi789 Write unit tests (codebuddy)
get โ Task Detail
python3 prompts/skills/orchestrator/scripts/orchestrator.py get TASK_ID
Returns structured detail without conversation content.
result โ Get Task Result (Minimal Context)
This is the preferred way to check what a task produced:
python3 prompts/skills/orchestrator/scripts/orchestrator.py result TASK_ID
python3 prompts/skills/orchestrator/scripts/orchestrator.py result TASK_ID --max-chars 4000
Returns only the final assistant message โ typically 1-2KB instead of 50KB+ full conversation.
continue โ Follow Up on a Task
Send a follow-up message to an existing task (like /chat -c). The task re-enters the queue and the agent continues the conversation where it left off.
python3 prompts/skills/orchestrator/scripts/orchestrator.py continue TASK_ID "Please also add error handling"
python3 prompts/skills/orchestrator/scripts/orchestrator.py continue TASK_ID "Refactor using async/await" --model claude-sonnet-4-20250514
Rules:
- Task must not be currently running (DOING) โ wait for it to finish first
- Task must not be cancelled
- The message is required and cannot be empty
- The task keeps its original session/context โ the agent sees all prior conversation
log โ Task Conversation Log (Controlled)
For debugging or reviewing the full conversation:
python3 prompts/skills/orchestrator/scripts/orchestrator.py log TASK_ID --tail 3
python3 prompts/skills/orchestrator/scripts/orchestrator.py log TASK_ID --tail 10 --max-chars 4000
Note: --tail and --limit are mutually exclusive. --tail returns the last N messages (recommended); --limit returns the first N.
Always use --tail to avoid dumping entire conversations into context.
cancel โ Cancel a Task
python3 prompts/skills/orchestrator/scripts/orchestrator.py cancel TASK_ID
delete โ Hard Delete a Task
python3 prompts/skills/orchestrator/scripts/orchestrator.py delete TASK_ID
status โ Update Task Status
python3 prompts/skills/orchestrator/scripts/orchestrator.py status TASK_ID done
python3 prompts/skills/orchestrator/scripts/orchestrator.py status TASK_ID todo
Valid statuses: todo, doing, done, failed, cancelled, archived
projects โ List Projects
python3 prompts/skills/orchestrator/scripts/orchestrator.py projects
Workflow Patterns
Pattern 1: Create โ Monitor โ Collect
python3 .../orchestrator.py plan --project-id sprint-42 --plan '{"tasks": [...]}'
python3 .../orchestrator.py list --project-id sprint-42 --status doing
python3 .../orchestrator.py result TASK_ID
python3 .../orchestrator.py log TASK_ID --tail 5
Pattern 2: Quick Single Task
python3 .../orchestrator.py create "Refactor the database layer to use connection pooling" --provider codex
python3 .../orchestrator.py result TASK_ID
Pattern 3: Parallel Analysis
python3 .../orchestrator.py plan --plan '{"tasks": [
{"id": "a", "title": "Analyze module A", "description": "...", "provider": "gemini"},
{"id": "b", "title": "Analyze module B", "description": "...", "provider": "gemini"},
{"id": "c", "title": "Analyze module C", "description": "...", "provider": "gemini"},
{"id": "summary", "title": "Summarize findings", "description": "...", "provider": "claude", "depends_on": ["a","b","c"]}
]}'
python3 .../orchestrator.py list --status done
python3 .../orchestrator.py result SUMMARY_TASK_ID
Pattern 4: Cleanup
python3 .../orchestrator.py cancel TASK_ID
python3 .../orchestrator.py delete TASK_ID
Pattern 5: Create โ Review โ Iterate (Follow Up)
python3 .../orchestrator.py create "Implement user authentication" --provider claude
python3 .../orchestrator.py result TASK_ID
python3 .../orchestrator.py continue TASK_ID "Also add rate limiting and input validation"
python3 .../orchestrator.py result TASK_ID
python3 .../orchestrator.py continue TASK_ID "Now add unit tests for the auth module"
Error Handling
When a command fails, the script prints [ERROR] to stderr and exits with code 1. Common scenarios:
| Error | Likely cause | Action |
|---|
HTTP 404 | Task ID doesn't exist or was deleted | Check task ID with list |
HTTP 409 | Invalid status transition | Check current status with get first |
Connection error | Nexus server not running | Verify --api URL and server status |
HTTP 500 | Server-side error | Retry once; if persistent, check server logs |
For plan commands, individual task creation failures are reported inline but do not stop the batch โ remaining tasks continue to be created.
Progress Updates
When you spawn tasks, keep the user informed. Follow these rules:
- On creation: Report what tasks were created, how many, and the project ID
- On status check: Only report if something changed (task finished, failed, or needs attention)
- On completion: Include what the task produced (use
result to get a summary)
- On error/failure: Immediately report the error and suggest next steps (retry, check log, cancel)
- Don't spam: Tasks take minutes to complete โ don't check more than once per minute
- Be concise: "3/5 tasks done, 2 still running" is better than listing all 5 with full details
Rules
- Always check
list before creating โ avoid duplicate tasks
- Use
result not log โ unless you need conversation debug detail
- Always use
--tail/--max-chars on log โ never dump full conversations
- Don't poll too frequently โ tasks take minutes, not seconds
- Use
--project-id to group related tasks for easy tracking
- Report progress โ when you create tasks, tell the user what you created and where to check status