Deep Work: Long-Running Autonomous Projects
Deep Work is PocketPaw’s orchestration system for complex, multi-step projects. Describe what you want to build, and PocketPaw researches the domain, writes a product requirements document, breaks it into tasks with dependencies, assembles an agent team, and executes everything autonomously.
How It Works
Describe Your Project
Provide a natural-language description of what you want to build or accomplish.
AI Research & Planning
The planner agent researches the domain, writes a PRD, decomposes the project into atomic tasks, and recommends an agent team.
Review & Approve
Review the generated plan — tasks, dependencies, time estimates, and team — in the dashboard. Approve when ready.
Autonomous Execution
Tasks execute in dependency order. Agent tasks run via Claude, human tasks notify you for manual completion. Failed tasks retry automatically. Progress streams in real time.
Completion
When all tasks finish, the project is marked complete and deliverables are saved to disk.
Project Lifecycle
| Status | Description |
|---|---|
DRAFT | Project created, not yet planned |
PLANNING | Planner agent is researching and decomposing tasks |
AWAITING_APPROVAL | Plan ready for user review |
APPROVED | User approved, ready to execute |
EXECUTING | Tasks are running |
PAUSED | Execution paused by user |
COMPLETED | All tasks finished |
FAILED | Planning or execution error |
CANCELLED | User cancelled the project — all remaining tasks skipped |
Planning Phases
The planner runs four sequential phases, each broadcasting progress events to the dashboard:
1. Research
Gathers domain knowledge before planning. Controlled by research_depth:
| Depth | Behavior |
|---|---|
none | Skip research entirely |
quick | Minimal analysis from existing knowledge, no web search |
standard | Balanced research, may use web search |
deep | Thorough research with extensive web searching |
2. Product Requirements Document (PRD)
Generates a structured PRD with:
- Problem statement
- Scope (in/out)
- Functional requirements
- Non-goals
- Technical constraints
3. Task Breakdown
Decomposes the PRD into atomic tasks. Each task includes:
| Field | Description |
|---|---|
key | Short unique identifier (e.g., t1, t2) |
title | Human-readable name |
description | Full description with acceptance criteria |
task_type | agent, human, or review |
priority | low, medium, high, or urgent |
estimated_minutes | Time estimate (15-120 min range) |
required_specialties | Skills needed (e.g., backend, frontend) |
blocked_by_keys | Dependencies on other tasks |
max_retries | How many times to auto-retry on failure (default: 1) |
timeout_minutes | Per-task execution time limit (optional) |
4. Team Assembly
Recommends the minimal set of AI agents needed. Each agent has a name, role, specialties, and backend. Agents are auto-assigned to tasks based on specialty overlap.
Dependency Scheduling
Tasks execute in dependency order using a topological sort (Kahn’s algorithm):
- Tasks with no blockers run first (concurrently)
- When a task completes, newly unblocked tasks dispatch automatically
- The scheduler validates the dependency graph for cycles and missing references before execution
Level 0: [t1, t2] ← no dependencies, run in parallelLevel 1: [t3, t4] ← depend only on level 0Level 2: [t5] ← depends on level 1Task Types
| Type | Execution |
|---|---|
agent | Runs via the agent backend (Claude Agent SDK). Output saved as deliverable document. |
human | Notification sent to your channels. You complete it manually and mark done in the dashboard. |
review | Quality gate — agent output is ready for your review before dependents proceed. |
Retry & Timeout
Tasks don’t just fail and stop — they fight through problems on their own.
Auto-Retry
Each task has a max_retries count (default: 1). When an agent task fails or times out, the executor checks whether retries remain. If so, it resets the task to ASSIGNED and re-dispatches it automatically. The retry_count field tracks how many attempts have been made.
Once retries are exhausted, the task moves to BLOCKED and waits for your attention. You can also manually retry any blocked task from the dashboard or API — manual retries bypass the max_retries limit.
Task Timeout
Set timeout_minutes on a task to enforce a hard execution time limit. The executor wraps the agent call in asyncio.wait_for — if the agent hasn’t finished within the window, it’s interrupted and treated the same as a failure (triggers retry if attempts remain, otherwise goes BLOCKED).
Leave timeout_minutes unset for tasks that genuinely need open-ended time, like deep research or large code generation.
Output Chaining
When an agent task completes, its full output is stored directly on the task.output field. Downstream tasks can reference this output as context — the executor builds each task’s prompt with deliverables from upstream dependencies already included.
This means later tasks in the dependency chain know what earlier tasks produced, without you having to wire anything up manually.
Cancellation
Cancel a running project when you need to pull the plug. Cancellation is a terminal state — once cancelled, the project can’t be resumed.
What happens when you cancel:
- All currently executing tasks are stopped immediately
- All pending and assigned tasks are marked
SKIPPED - Tasks already completed keep their
DONEstatus (work isn’t lost) - The project status changes to
CANCELLED
You can’t cancel a project that’s already completed or already cancelled.
Usage
Starting a Project
User: Start a deep work project to build a REST API for a recipe management appAgent: Starting Deep Work project... researching domain, writing PRD, decomposing tasks.Or via the REST API:
curl -X POST http://localhost:8000/api/deep-work/start \ -H "Content-Type: application/json" \ -d '{"description": "Build a REST API for recipe management", "research_depth": "standard"}'Reviewing the Plan
The dashboard shows:
- The generated PRD
- Task list with dependencies visualized as execution levels
- Estimated total time
- Recommended agent team
Controlling Execution
| Action | API Endpoint |
|---|---|
| Approve plan | POST /api/deep-work/projects/{id}/approve |
| Pause execution | POST /api/deep-work/projects/{id}/pause |
| Resume execution | POST /api/deep-work/projects/{id}/resume |
| Cancel project | POST /api/deep-work/projects/{id}/cancel |
| Skip a task | POST /api/deep-work/projects/{id}/tasks/{task_id}/skip |
| Retry a blocked task | POST /api/deep-work/projects/{id}/tasks/{task_id}/retry |
Skipping a task marks it as SKIPPED and unblocks dependents. Retrying resets a blocked task to ASSIGNED and re-dispatches it.
PawKit Templates
Deep Work projects can be packaged as PawKit templates — YAML configs that define a full Command Center with layout, automated workflows, user configuration, and bundled skills. The Deep Work engine becomes the “Project Orchestrator” Command Center, and domain experts can publish their own PawKits for others to install.
See Command Centers for the concept and PawKit Reference for the full YAML schema.
Project Directories
Each project gets a working directory at ~/pocketpaw-projects/{project_id}/. Agent tasks execute within this directory, and deliverables are saved there.
Recovery
If the server restarts during execution:
- Projects stuck in
PLANNINGare markedFAILED - Projects in
EXECUTINGhave their in-progress tasks reset and re-dispatched
WebSocket Events
The dashboard receives real-time updates:
| Event | When |
|---|---|
dw_planning_phase | Each planning phase starts (research, prd, tasks, team) |
dw_planning_complete | Planning finishes or fails |
dw_project_cancelled | Project was cancelled |
mc_task_started | A task begins executing |
mc_task_output | Agent produces output (streamed) |
mc_task_completed | A task finishes (includes retry info) |
mc_task_retry | A task is about to be retried after failure |
Deep Work builds on top of Mission Control for task storage, agent management, and the execution engine. The two systems are designed to work together.
Related
Mission Control
The multi-agent execution engine that powers Deep Work task management.
Plan Mode
Structured approval workflows for reviewing agent-generated plans.
Autonomous Messaging
Get notified when human tasks need attention or projects complete.