claim_task
CLAIMS a task ATOMICALLY so no other agent of the queue takes it at the same time: "to do" → "in progress" in ONE conditional write, the claim signed (agentLabel, otherwise your key's name; and the time). It replaces update_task({ status: "doing" }), which stops no one from taking the same task. taskId omitted = the FIRST ready task of the queue (priority, then position) — if another agent takes it in the same second, you get the next one. A selection (label, labels, labelsAny, labelsNone, cellId: the list_tasks filters, ANDed) narrows the queue to your perimeter, i.e. list_tasks({ executable: true, <selection> }); with taskId, a task outside it is refused (outside-selection). Response: { claimed: true, task } or { claimed: false, reason, message }; a refusal is never reported as a success. reason: not-found · already-claimed (with heldBy/heldAt when the claim was signed, null otherwise — a task set "in progress" by hand has no holder) · done · archived · blocked ("blocked" status set by hand) · open-dependencies (a dependency BLOCKS unless its prerequisite is done or a human decision LIFTED it: an ARCHIVED prerequisite not done still blocks. The refusal carries openDependencies, the ids of the blocking tasks archived ones included, and blockedBy, one entry per blocking dependency of either source with its state — open, target-archived (an archived task or cancelled plan nobody lifted: only a human decision frees the task, see list_tasks({ hasArchivedDependency: true })), or target-missing; the work graph is read on every claim, and if unreadable the call answers { error } and claims NOTHING) · arbitrage (an arbitration, a question to decide, is not work to claim: it follows its update_task.arbitrageAction cycle) · awaiting-validation / awaiting-approval (the task carries the LABEL a-valider / a-approuver: a human must validate or approve — it can neither be claimed nor reclaimed, EVEN if it is already "in progress"; these labels are not removed to claim the task: they are set and lifted by a human, and a status change through update_task is not a claim) · awaiting-triage (LABEL etat-tri:a-trier: awaiting triage — neither claimable nor listed by executable; the triage, per the project flow (the human or the designated agent), replaces the label with etat-tri:trie; evaluated AFTER done and already-claimed, which keep their reason) · plan-not-ready (the task carries the label plan: + the code of an existing work plan that does not hand it out: the plan is not pret or en-cours (planGate.why is plan-status), or waits on unsettled dependencies (plan-blocked, with planGate.blockedBy), or another identity leads it (plan-held: planGate.heldBy, planGate.leaseUntil; the holder passes its claim_work_plan agentName as agentLabel, and a subagent of the holder leaves the task to its orchestrator), or the task is not refined (task-unrefined, with planGate.missing); planGate.exit gives the way out: a string for a plan problem; for an unrefined task an update_task call ({ tool, params }, one step per missing thing, sent once its <…> placeholders are filled) or { humanOnly } when only a human can unblock it. A task of several plans is held back by the first plan (alphabetical order of codes) that does not hand it out. Judged after blocked, before open-dependencies. Tasks without a plan label are unaffected. Guidance for the claim protocol, not a lock: an agent that writes can still set a task to doing with update_task) · no-ready-task (without taskId: no ready task; blockedByArchivedDependency: N = how many are not ready ONLY because a prerequisite is archived and not lifted, blockedByPlanGate: N how many a work plan holds back, outsideSelection: N ready tasks outside your selection, each absent when 0) · conflict (the row changed during the claim: a re-read then a retry settle it) · write-locked (agent writes are LOCKED on this block or project for this account: message says what to unlock — without taskId, tasks of a locked view are skipped). A refusal writes NOTHING. Claiming a CHILD task of an arbitration already DECIDED (step arbitre) STARTS it in your name — startedBy/startedAt, and startedArbitrages in the response, absent otherwise: carry out a decision through CHILD tasks of the arbitration, not through tasks that DEPEND on it (a dependent task cannot be claimed before its closure). update_task({ arbitrageAction: { type: "start" } }) remains allowed. A claimed task leaves list_tasks({ executable: true }). Handing a task back: update_task({ status }). A task marked executor: "human" is refused with human-task (evaluated AFTER done and already-claimed) and is left out of executable: an agent does not take a human's task. LEASE: a claim is a LEASE of 15 minutes. The response carries claimToken (a SECRET identifying you as holder, kept out of every written text), leaseUntil (the deadline) and leaseMinutes. Past the deadline the task is claimable again on the same terms as a task to do: every refusal above applies (plan-held included), a caller the gate admits takes it over (claimed: true with reclaimed: { reason: "lease-expired", previousHolder, expiredAt }: a TAKEOVER, not a refusal), and list_tasks({ executable: true }) lists it for that caller. already-claimed then also carries leaseUntil. One connection plus one agentLabel is ONE holder: its live claim named by taskId is retaken with a NEW token, the old one dies (reclaimed.reason: "same-holder"; a concurrent twin gets conflict, then wins on retry), so agents sharing a connection each need their own agentLabel (none, or your key's name: no reprise). The plan gate still judges that retake: under a plan another identity holds, it is refused (plan-held). A task set "in progress" by hand (no signed claim) has no deadline. RENEW with renew_claim (at least once per lease, DECLARING your progress). During the lease, any agent write on the task (update_task, archive_task, unarchive_task) requires claimToken: without it CLAIM_HELD, with an expired token CLAIM_LOST. The token does NOT cover the tracking of the implementation plan (impl-2026-10-* tasks), which this tool never "claims": no claim, no token. REMOVAL: a human can REMOVE your claim ("Take the task back"): the task returns to "to do", your writes on it are refused (CLAIM_REMOVED, with or without a token) and your key cannot reclaim it — claim_task answers claim-removed — until a human hands it back to you. A human can also ASK you to stop: read stop[] (reason stop_requested) in get_contextual_updates and hand back your claim with a progress report.
Tool call template
This tool declares no required parameters. Add optional parameters from the input schema as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {},
"name": "claim_task"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| label | No | As `list_tasks.label`. | |
| cellId | No | As `list_tasks.cellId`. | |
| labels | No | As `list_tasks.labels`. | |
| taskId | No | The task to CLAIM. Omitted, the FIRST ready task of the queue (of your selection) — "my next task". | |
| labelsAny | No | As `list_tasks.labelsAny`. | |
| agentLabel | No | The label that SIGNS the claim ("agent-doc", "worker-2"…) — what another agent reads in the refusal "already claimed by …". Optional: omitted, the claim is signed with the NAME OF THE API KEY of the call (without a named key, e.g. in the chat, no label: `claimedBy: null`). Two agents of the same key sign the same way: `agentLabel` tells them apart once several agents share a queue. Omitted, the call is never the holder of a work plan: the tasks of a plan you hold are claimed with its claim_work_plan `agentName` as `agentLabel`. | |
| labelsNone | No | As `list_tasks.labelsNone`. | |
| expectedProjectId | No | UUID of the project THIS call targets (overrides the session project). |