Understanding Claim/Complete Workflow
Master the task lifecycle with claiming, completing, and review workflows for AI agents.
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.
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), ORin_progresswith expired claims (60 minutes timeout)
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.
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
Claiming a Task
The agent calls POST /api/tasks/claim with:
- Task identifier (e.g., "W42")
- Agent name
before_doing_resultcontaining the hook execution results
Working on the Task
The agent performs the actual implementation work:
- Write code and implement features
- Fix bugs and refactor
- Write tests
- Update documentation
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
- Create pull request
- Generate documentation
Completing a Task
The agent calls PATCH /api/tasks/:id/complete with:
- Agent name
- Time spent (minutes)
- Completion notes
after_doing_resultfrom step 6before_review_resultfrom step 6
- Review column if
needs_review=true - Done column if
needs_review=false
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.
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
PATCH /api/tasks/:id/mark_reviewed with the hook results to finalize completion.
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
You're all set!
You've completed all the steps in this guide.