Cancel a running background task.
Stops running background tasks with confirmation or force option.
/plugin marketplace add Data-Wise/craft/plugin install data-wise-craft@Data-Wise/craftworkflow/Cancel a running background task.
Stop execution of background tasks from:
/workflow:brainstorm --background/workflow:refine (option 2: background)Use when:
/workflow:task-cancel <task_id> # Cancel specific task
/workflow:task-cancel <task_id> --force # Force cancel without confirmation
/workflow:task-cancel --all # Cancel all running tasks
/workflow:task-cancel abc123
Output:
CANCEL BACKGROUND TASK
════════════════════════════════════════════════════════════
Task ID: abc123
Command: /workflow:brainstorm "improve test coverage"
Status: 🔄 Running
Started: 2 minutes ago
Estimated completion: ~1 minute remaining
────────────────────────────────────────────────────────────
⚠️ CONFIRM CANCELLATION
Are you sure you want to cancel this task?
Progress will be lost and the task cannot be resumed.
────────────────────────────────────────────────────────────
Confirm? (y/n)
>
If user confirms (y):
✅ Task cancelled: abc123
The task has been stopped and removed from the queue.
────────────────────────────────────────────────────────────
💡 NEXT STEPS:
Retry with different approach:
/workflow:brainstorm "improve test coverage" --wait
Try interactive mode:
/workflow:brainstorm
Check remaining tasks:
/workflow:task-status
If user declines (n):
❌ Cancellation aborted
Task abc123 is still running.
Check status:
/workflow:task-status abc123
Implementation:
/workflow:task-cancel abc123 --force
Output:
✅ Task cancelled: abc123 (forced)
Task stopped immediately without confirmation.
────────────────────────────────────────────────────────────
Check remaining tasks:
/workflow:task-status
Use case: Quickly cancel during scripting or when very certain.
/workflow:task-cancel --all
Output:
CANCEL ALL BACKGROUND TASKS
════════════════════════════════════════════════════════════
Found 3 running tasks:
abc123 - /workflow:brainstorm "improve test coverage"
xyz789 - /workflow:refine "help with tests"
def456 - /code:test-gen
────────────────────────────────────────────────────────────
⚠️ CONFIRM CANCELLATION
Cancel all 3 running tasks?
All progress will be lost.
────────────────────────────────────────────────────────────
Confirm? (y/n)
>
If user confirms (y):
✅ Cancelled 3 tasks:
• abc123 - /workflow:brainstorm
• xyz789 - /workflow:refine
• def456 - /code:test-gen
All running tasks have been stopped.
────────────────────────────────────────────────────────────
💡 Task queue is now clear
Start new tasks:
/workflow:brainstorm "..."
/workflow:refine "..."
If user declines (n):
❌ Cancellation aborted
All tasks are still running.
Check status:
/workflow:task-status
❌ Task not found: abc123
Recent tasks:
xyz789 - /workflow:brainstorm (completed 5m ago)
def456 - /workflow:refine (running)
Cancel a running task:
/workflow:task-cancel def456
List all tasks:
/workflow:task-status
❌ Cannot cancel: Task already completed
Task ID: abc123
Status: ✅ Completed
Finished: 3 minutes ago
────────────────────────────────────────────────────────────
View results:
/workflow:task-output abc123
❌ Task already cancelled: abc123
Cancelled: 2 minutes ago
────────────────────────────────────────────────────────────
Start a new task:
/workflow:brainstorm "..."
/workflow:task-status - View all tasks
❌ Cannot cancel: Task already failed
Task ID: abc123
Status: ❌ Failed
Failed: 5 minutes ago
────────────────────────────────────────────────────────────
View error:
/workflow:task-output abc123
Retry:
/workflow:brainstorm "..." --wait
No running tasks to cancel.
────────────────────────────────────────────────────────────
Recent tasks:
abc123 - Completed 3m ago
xyz789 - Completed 10m ago
View results:
/workflow:task-output abc123
What happens when task is cancelled:
Partial work:
Why: Partial results could be misleading or incorrect.
--force skips confirmation/workflow:brainstorm "improve performance" --background
> Task abc123 launched
[Realize you meant "improve test coverage"]
/workflow:task-cancel abc123
> Confirm? y
> ✅ Cancelled
/workflow:brainstorm "improve test coverage" --background
> Task xyz789 launched
/workflow:brainstorm "complex redesign" --background
> Task abc123 launched (estimated 5 min)
[After 10 minutes, still running]
/workflow:task-status abc123
> Running for 10m (way over estimate)
/workflow:task-cancel abc123
> Confirm? y
> ✅ Cancelled
/workflow:brainstorm "complex redesign" --wait
> [Try synchronously to see what's wrong]
/workflow:task-status
> 3 tasks running
[Need to shutdown computer]
/workflow:task-cancel --all
> Cancel 3 tasks? y
> ✅ All cancelled
[Safe to shutdown]
Typical flow:
# Launch background task
/workflow:brainstorm "ideas" --background
> Task abc123 launched
# Realize mistake
> Oh no, wrong topic!
# Quick cancel
/workflow:task-cancel abc123 --force
> ✅ Cancelled
# Retry correctly
/workflow:brainstorm "correct topic" --background
> Task xyz789 launched
/workflow:task-cancel abc123 --force && \
/workflow:brainstorm "better topic" --background
/workflow:task-cancel --all --force && \
/workflow:task-status
/workflow:task-cancel abc123
# Add to IDEAS.md: "Cancelled brainstorm - topic was too broad"
/workflow:task-status - Check what's running/workflow:task-output - View completed results/workflow:brainstorm --background - Launch new task/workflow:refine - Optimize prompts/workflow:task-cancel abc123
AI: Confirm cancellation? (y/n)
User: y
AI: ✅ Cancelled
Retry: /workflow:brainstorm "..."
/workflow:task-cancel abc123 --force
AI: ✅ Task cancelled: abc123 (forced)
/workflow:task-cancel --all
AI: Cancel 3 tasks? (y/n)
User: y
AI: ✅ Cancelled 3 tasks
/workflow:task-cancel abc123
AI: ❌ Cannot cancel: Task already completed
View results: /workflow:task-output abc123
Cancellation mechanism:
Task registry update:
{
"id": "abc123",
"status": "cancelled",
"cancelled": "2025-12-14T14:45:00Z",
"cancelled_by": "user"
}
Last Updated: 2025-12-14 Category: Workflow Phase: 1 (Foundation)