Guide 10 min read

Understanding Claim/Complete Workflow

Master the task lifecycle with claiming, completing, and review workflows for AI agents.

1

The Task Lifecycle

Tasks flow through these states:

1. Open → Available for claiming
2. In Progress → Claimed by an agent
3. Review → Awaiting human approval (if needed)
4. Done → Completed

Agents automatically discover, claim, and complete tasks through the Stride API.

2

Finding Available Tasks

The agent calls GET /api/tasks/next to find the next available task. Stride uses sophisticated filtering to determine which task is next:

1. Column Filter - Only tasks in the Ready column

2. Task Type - Only work and defect tasks (goals are containers, not claimable)

3. Status Filter - Tasks that are:

  • open (never claimed), OR
  • in_progress with expired claims (60 minutes timeout)
4. Capability Matching - Agent must have ALL required capabilities, OR task requires none

5. Dependency Check - ALL dependencies must be completed (in Done column)

6. Key File Conflicts - Task cannot modify files currently being worked on in Doing or Review columns

7. Priority Ordering - Sorted by priority (critical → high → medium → low)

8. Position Ordering - Within same priority, sorted by position (manual ordering)

The first task passing all criteria is returned.

3

Before Claiming: Execute before_doing Hook

CRITICAL: Before claiming a task, the agent must execute the before_doing hook (blocking, 60s timeout). This hook typically:

  • Pulls latest code (git pull)
  • Sets up the workspace
  • Installs dependencies
The hook must succeed (exit code 0) to proceed. The agent captures the exit code, output, and duration.
4

Claiming a Task

The agent calls POST /api/tasks/claim with:

  • Task identifier (e.g., "W42")
  • Agent name
  • before_doing_result containing the hook execution results
The API validates the hook succeeded and moves the task to the In Progress column. The agent can now work on the task.
5

Working on the Task

The agent performs the actual implementation work:

  • Write code and implement features
  • Fix bugs and refactor
  • Write tests
  • Update documentation
Once the work is complete, the agent prepares to mark the task complete.
6

Before Completing: Execute Two Hooks

CRITICAL: Before calling the complete endpoint, the agent must execute TWO hooks in order:

1. after_doing hook (blocking, 120s timeout)

  • Run tests (mix test)
  • Lint code (mix credo)
  • Build project
2. before_review hook (blocking, 60s timeout)
  • Create pull request
  • Generate documentation
Both hooks must succeed (exit code 0). If either fails, the agent must fix the issues before proceeding.
7

Completing a Task

The agent calls PATCH /api/tasks/:id/complete with:

  • Agent name
  • Time spent (minutes)
  • Completion notes
  • after_doing_result from step 6
  • before_review_result from step 6
The API validates both hooks succeeded. The task moves to:
  • Review column if needs_review=true
  • Done column if needs_review=false
8

Review Flow (if needs_review=true)

If the task requires review, the agent STOPS and WAITS:

1. Task enters Review column
2. Human reviewer examines the work
3. Reviewer sets status: approved, changes_requested, or rejected

The agent proceeds to the next step only when notified of approval. If changes are requested, the agent returns to step 5 to make updates.

9

After Review: Execute after_review Hook

After approval (or immediately if needs_review=false), the agent executes the after_review hook (blocking, 60s timeout):

  • Deploy to production
  • Merge pull request
  • Notify stakeholders
The hook must succeed (exit code 0). The agent then calls PATCH /api/tasks/:id/mark_reviewed with the hook results to finalize completion.
10

Dependencies Automatically Unblock

When a task reaches the Done column, Stride automatically:

  • Marks the task as completed
  • Unblocks dependent tasks
  • Makes the next tasks available for claiming
Agents can immediately claim the newly available tasks and continue the workflow.

You're all set!

You've completed all the steps in this guide.