---
name: "agent-task-priority-queue"
description: "Schedule and prioritize autonomous agent tasks with dynamic priority queues."
metadata:
  author: "Celery Project"
  version: "1.0.0"
  runtime_compatibility:
    - "codex"
    - "claude-code"
    - "cursor"
    - "windsurf"
triggers:
  - "prioritize agent tasks"
  - "resolve agent task deadlock"
  - "schedule background agent tasks"
permissions:
  fs_read: true
  fs_write: "workspace"
  shell_exec: false
  net_access: false
---

# Agent Dynamic Task Priority Queue & Deadlock Resolver

Manages agent execution scheduling: priority heap queues, dependency resolution DAGs, fair scheduling across users, and automatic timeout resolution for deadlocked subtasks.

## When to Invoke
Invoke this skill whenever you need to:
- prioritize agent tasks
- resolve agent task deadlock
- schedule background agent tasks

## Execution SOP & Rules
1. Implement priority queues using binary heaps or Redis sorted sets (ZADD priority score).
2. Assign task priorities dynamically based on user tier, urgency, and deadline constraints.
3. Attach heartbeat timeouts to running tasks; re-queue tasks if workers fail to check in.
4. Audit dependency graphs to prevent cyclic task dependencies from causing permanent deadlocks.

## Verification Checklist
- Run local linting, syntax validation, and type-checks before reporting completion.
- Ensure all created or modified files adhere to workspace boundaries and avoid uncommitted secrets.
- Verify tests or build commands exit cleanly with return code 0.
