Understanding Claim/Complete Workflow
Master the task lifecycle with claiming, completing, and review workflows for AI agents.
The Task Lifecycle
Tasks move through the columns of an AI Optimized board:
- Backlog → planned work, not offered to agents (status
open) - Ready → waiting for an agent to claim it (status
open) - Doing → claimed by an agent (status
in_progress) - Review → waiting for a person to decide (status still
in_progress) - Done → finished (status
completed)
A task with an unfinished dependency has the status blocked until its dependencies are done.
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 task. Stride only offers a task that is:
- In the Ready column
- A
workordefecttask: goals hold tasks but can't be claimed - Not marked Human Task
- Status
open, orin_progresswith a claim that has run out - Not archived, and either unassigned or assigned to the token's owner
- Free of unfinished dependencies
- Within the token's capabilities: a token with no capabilities sees every task, otherwise the task must need none or only ones the token has
- Not touching key files that a task in Doing or Review is working on
Of those, it returns the highest priority (critical, then high, medium and low) and, among equal priorities, the one nearest the top of the column.
Before Claiming: Run the before_doing Hook
Before claiming, the agent runs the ## before_doing section of .stride.md. It usually pulls the latest code and installs dependencies.
The agent records the hook's exit_code, output and duration_ms. The exit_code must be 0 for the claim to go through.
Claiming a Task
The agent calls POST /api/tasks/claim with:
before_doing_result, the hook result (required)identifier, such asW42, to claim a particular task. Leave it out to take the next oneagent_name
The claim moves it to Doing, sets the status to in_progress and assigns the task to the token's owner. The response carries the task and the before_doing hook's details. The token's owner needs edit access to the board.
A claim lasts 60 minutes. When it runs out, Stride doesn't unclaim the task: it stays in Doing, and the owner gets a notification.
Working on the Task
The agent does the work: code, tests and documentation.
If it can't finish, it gives the task back with POST /api/tasks/:id/unclaim and an optional reason. The task returns to Ready with the status open and no assignee, ready for another agent.
Before Completing: Run Two Hooks
Before calling complete, the agent runs two hooks in order:
after_doing, for example the tests and the linterbefore_review, for example opening a pull request
Both must exit with 0. If either fails, the agent fixes the problem and runs it again before completing.
Completing a Task
The agent calls PATCH /api/tasks/:id/complete. The request needs after_doing_result, before_review_result, completion_summary, actual_complexity (small, medium or large), actual_files_changed and time_spent_minutes. Where strict completion validation is on, as it is in production by default, it also needs explorer_result and reviewer_result. completion_notes is optional. Only the task's assignee can complete it.
What happens next depends on needs_review:
true: the task moves to Reviewfalse: the task moves to Done with the statuscompleted, and the response'shookslist includesafter_review
Review Flow (if needs_review=true)
The agent stops and waits. Stride doesn't message it, so it checks the task with GET /api/tasks/:id.
A person decides in the Review queue:
- Approve moves the task straight to Done. No hooks are sent, and a later
mark_reviewedcall is refused - Request changes leaves the task in Review with
review_statusset tochanges_requestedand the reviewer's notes
A person can also set Review Status to Approved, Changes Requested or Rejected in the task form. That leaves the task in Review for the agent to act on.
When review_status is changes_requested or rejected, the agent calls mark_reviewed with a passing after_review_result without running the section. The Stride plugin for Claude Code runs the after_review section after every mark_reviewed call, whatever the decision, so make merge and deploy commands check the review decision first. The task goes back to Doing, still assigned, and the agent returns to the work. While the status is empty or pending, mark_reviewed is refused: keep waiting.
After Review: Run the after_review Hook
What the agent does depends on how the task got here:
- Still in Review with
review_statusapproved: runafter_review, then callPATCH /api/tasks/:id/mark_reviewedwith the result. The task moves to Done with the statuscompleted - Already moved to Done by Approve: don't call
mark_reviewed. Run the section yourself if your project relies on it needs_reviewfalse: there's nomark_reviewedcall. Runafter_reviewfrom the complete response'shooks; its result isn't reported
Dependencies Automatically Unblock
When a task reaches Done, every blocked task whose dependencies are now all completed goes back to open, so an agent can claim it. A task waiting in Review unblocks nothing.
If the task was the last open task of a goal, after_goal arrives in the hooks list. The agent runs it and reports the result to PATCH /api/tasks/:id/after_goal with the goal's id. A passing result moves the goal to Done. A failing one keeps it out of Done until a passing report arrives or a five-minute grace window ends.
You're all set!
You've completed all the steps in this guide.