Query and update the Shipwright task store — pick the next ready task, mark status transitions, and append new tasks. Use whenever you need to read from or write to the task queue. Also use for "what's waiting on me", "what sessions are waiting", "what's blocked" and "unblock <session>" questions: call GET /sessions?state=waiting (mine first by requester email, then unowned, skip other people's sessions) instead of GET /tasks?hitl=true. Calls the task store HTTP API directly via curl.
Installs into .claude/skills of the current project.
Sponsors
SSkills DirectorySkills Directory
Know which skills are safe — weekly.
SSkills DirectorySkills Directory
Is that skill safe to install?
Are you the author of Task Store?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/app-vitals-task-store)
---
name: task-store
description: >
Query and update the Shipwright task store — pick the next ready task, mark status
transitions, and append new tasks. Use whenever you need to read from or write to
the task queue. Also use for "what's waiting on me", "what sessions are waiting",
"what's blocked" and "unblock <session>" questions: call GET /sessions?state=waiting
(mine first by requester email, then unowned, skip other people's sessions) instead
of GET /tasks?hitl=true. Calls the task store HTTP API directly via curl.
---
# Task Store — Skill
Use this skill to interact with the Shipwright task store via its HTTP API.
The task store is a REST service — call it with curl, no script discovery needed.
> **The HTTP API is the only interface.** Never edit the underlying database directly.
> The unit you work with is the **task** (see [task-schema.md](references/task-schema.md)).
---
## Setup
Before using this skill, verify the required environment variables are set:
```bash
echo "URL: ${SHIPWRIGHT_TASK_STORE_URL:-(missing)}"
echo "Token: ${SHIPWRIGHT_TASK_STORE_TOKEN:+(set)}"
```
Missing env vars or other prerequisites? Run `scripts/doctor.sh` from a clone of [app-vitals/shipwright](https://github.com/app-vitals/shipwright); it prints one fix line per problem. For a local task store, see "Local setup" in [docs/task-store.md](../../../../docs/task-store.md).
### Managed / Deployed Setups
On managed Shipwright agents, `SHIPWRIGHT_TASK_STORE_URL` and `SHIPWRIGHT_TASK_STORE_TOKEN` are provisioned automatically by the agent harness via deployment-time configuration and set as agent env vars in the Shipwright admin UI.
If you need to mint additional scoped tokens on a managed setup, use the admin token (`SHIPWRIGHT_TASK_STORE_ADMIN_TOKEN`):
```bash
# Local / HITL use — omit agentId so the token is unscoped.
curl -sf -X POST "$SHIPWRIGHT_TASK_STORE_URL/tokens" \
-H "Authorization: Bearer $SHIPWRIGHT_TASK_STORE_ADMIN_TOKEN" \
-H "Content-Type: application/json" \
-d '{"label": "my-local-agent"}' | jq .
# Managed Shipwright agent — scope the token to that agent's ID.
curl -sf -X POST "$SHIPWRIGHT_TASK_STORE_URL/tokens" \
-H "Authorization: Bearer $SHIPWRIGHT_TASK_STORE_ADMIN_TOKEN" \
-H "Content-Type: application/json" \
-d '{"label": "my-agent-name", "agentId": "<agent-id>"}' | jq .
```
- **`readOnly`** — set `"readOnly": true` to mint a read-only token (default `false`). It can use `GET` routes (tasks, PRs, sessions) but every `POST`, `PATCH` and `DELETE` returns `403`. Use it for dashboards and other consumers that must not write. Existing tokens stay writable.
- **`agentId`** — leave it out of the body for local or HITL use (the token stays unscoped); set it to your agent's ID to scope the token to a managed Shipwright agent.
- The response's `rawToken` field is shown once — copy it immediately and wire it up:
- **Local plugin / shell:** `export SHIPWRIGHT_TASK_STORE_TOKEN=<rawToken>`
- **Managed Shipwright agent:** add `SHIPWRIGHT_TASK_STORE_TOKEN=<rawToken>` as an agent env var via the Shipwright admin UI — it takes effect within 60 seconds, no restart needed
**HITL note:** For local HITL execution (`/shipwright:hitl`), mint an admin token with **`agentId` omitted** — this keeps the token unscoped so it can read any agent's tasks. Pass the task ID explicitly when invoking the skill.
---
## Authentication
All requests require a Bearer token:
```bash
Authorization: Bearer $SHIPWRIGHT_TASK_STORE_TOKEN
```
Both env vars are set either:
- **Locally:** via `scripts/local-store.sh` (see Setup section above)
- **On managed agents:** provisioned automatically by the agent harness via the Shipwright admin UI
| Env var | Description |
|---|---|
| `SHIPWRIGHT_TASK_STORE_URL` | Base URL of the task store service |
| `SHIPWRIGHT_TASK_STORE_TOKEN` | Bearer token for this agent |
Visibility, not filtering, is what the bearer token controls: an agent token with repo access can see every task in that repo's pool — assigned to you, unassigned, or assigned to a different agent sharing the repo (useful for spotting unclaimed pool work). It does **not** narrow results to just your own tasks. Pass `?assignee=$SHIPWRIGHT_AGENT_ID` explicitly whenever you only want your own tasks — e.g. before resuming an `in_progress` task, so you don't pick up (and start committing to) another agent's active work.
Verify the service is reachable before doing anything:
```bash
curl -sf -H "Authorization: Bearer $SHIPWRIGHT_TASK_STORE_TOKEN" \
"$SHIPWRIGHT_TASK_STORE_URL/tasks?ready=true" | jq '.total'
```
---
## Standard lifecycle
### Pick next task
Repo-pool visibility means an unfiltered query can return another agent's tasks — always pass `?assignee=$SHIPWRIGHT_AGENT_ID` to scope to your own. Check for an interrupted task first, then fall back to the next ready one:
```bash
# 1. Resume interrupted task (in_progress assigned to you)
curl -sf -H "Authorization: Bearer $SHIPWRIGHT_TASK_STORE_TOKEN" \
"$SHIPWRIGHT_TASK_STORE_URL/tasks?status=in_progress&assignee=$SHIPWRIGHT_AGENT_ID" | jq .
# 2. If empty, pick next ready task
curl -sf -H "Authorization: Bearer $SHIPWRIGHT_TASK_STORE_TOKEN" \
"$SHIPWRIGHT_TASK_STORE_URL/tasks?ready=true" | jq '.tasks'
```
All list calls return an envelope with a `.tasks` array. Paginated calls (`?status=`, `?session=`, `?pr=`, `?branch=`, etc.) also include `nextCursor` (see Cursor paging below). Ready/blocked calls (`?ready=true`, `?state=ready`, `?state=blocked`) return `{ tasks, total }` without pagination. Always unwrap `.tasks` before accessing elements.
**Cursor paging.** Every list route that takes `?limit` — `GET /tasks`, `/prs`, `/prs/:id/events`, `/tasks/:id/events`, `/sessions`, `/verification-checks`, `/coverage-snapshots`, `/cron-runs`, `/patrol-findings`, `/system-crons/:id/triggers` — also accepts `?cursor=` and returns `nextCursor` beside its normal array key (`tasks`, `prs`, `events`, `sessions`, `checks`, `snapshots`, `runs`, `findings`, `triggers`). `nextCursor` is an opaque string (never parse or build one): pass it back as `?cursor=` to get the next page, and it is `null` on the last page — `null` is the only completeness signal. Ordering is stable across pages (`/sessions` and `GET /prs?blocked=true` order in memory, so rows that tie on sort key may shift between pages). `?offset` is no longer accepted: a leftover `?offset` is a `400` on `GET /tasks` and `GET /sessions` (unknown query parameters are rejected there) and is ignored on the other list routes. A malformed cursor is a `400`. `?ready=true` / `?state=blocked` on `/tasks` are unpaginated and always return `nextCursor: null`.
Follow `nextCursor` until it is `null` (swap the path and the array key for any other list route, e.g. `/prs` and `.prs`):
```bash
cursor=""
while :; do
page=$(curl -sf -H "Authorization: Bearer $SHIPWRIGHT_TASK_STORE_TOKEN" \
"$SHIPWRIGHT_TASK_STORE_URL/tasks?limit=100${cursor:+&cursor=$cursor}")
echo "$page" | jq -c '.tasks[]'
cursor=$(echo "$page" | jq -r '.nextCursor // empty')
[ -z "$cursor" ] && break
done
```
### Start a task
Claim atomically instead of a plain PATCH — a read-modify-write PATCH races any other
concurrent runner that read the same `ready=true` list. The claim is a single conditional
`UPDATE ... WHERE status='pending'`; it also sets `claimedAt`, `heartbeatAt`, and
`startedAt`, so no separate PATCH is needed:
```bash
curl -sf -X POST \
-H "Authorization: Bearer $SHIPWRIGHT_TASK_STORE_TOKEN" \
-H "Content-Type: application/json" \
-d "$(jq -n --arg claimedBy "${SHIPWRIGHT_AGENT_ID:-local}" '{claimedBy: $claimedBy}')" \
"$SHIPWRIGHT_TASK_STORE_URL/tasks/{id}/claim" | jq .
```
Always send `claimedBy` (see [claimed-by.md](../../references/claimed-by.md)). With an agent token
the task-store pins `claimedBy` to the calling agent's own ID server-side and ignores the body; with a
non-agent token (e.g. minted by `scripts/local-store.sh`, `SHIPWRIGHT_AGENT_ID` unset) the body is
required and the call returns `400 claimedBy is required` without it — the fallback identity is `local`. A `409` means another agent
already claimed the task since it was read as `ready` — skip it and pick the next one.
This isn't just a race-avoidance convention — a generic `PATCH /tasks/:id` actively rejects
(`400`) an agent token trying to set `claimedBy`, `claimedAt`, `heartbeatAt`, or
`status: "pending"` directly. `/claim` and `/release` are the only supported ways to move
those fields.
### Open a PR
Must set `pr` and `prCreatedAt` together with the status:
```bash
curl -sf -X PATCH \
-H "Authorization: Bearer $SHIPWRIGHT_TASK_STORE_TOKEN" \
-H "Content-Type: application/json" \
"$SHIPWRIGHT_TASK_STORE_URL/tasks/{id}" \
-d "{\"status\": \"pr_open\", \"pr\": {pr_number}, \"prCreatedAt\": \"$(date -u +%Y-%m-%dT%H:%M:%SZ)\"}" | jq .
```
### Mark blocked
```bash
curl -sf -X PATCH \
-H "Authorization: Bearer $SHIPWRIGHT_TASK_STORE_TOKEN" \
-H "Content-Type: application/json" \
"$SHIPWRIGHT_TASK_STORE_URL/tasks/{id}" \
-d "{\"status\": \"blocked\", \"blockedReason\": \"{reason}\", \"blockedAt\": \"$(date -u +%Y-%m-%dT%H:%M:%SZ)\"}" | jq .
```
### Mark merged / done
```bash
curl -sf -X PATCH \
-H "Authorization: Bearer $SHIPWRIGHT_TASK_STORE_TOKEN" \
-H "Content-Type: application/json" \
"$SHIPWRIGHT_TASK_STORE_URL/tasks/{id}" \
-d "{\"status\": \"merged\", \"mergedAt\": \"$(date -u +%Y-%m-%dT%H:%M:%SZ)\"}" | jq .
```
### Patch task metadata
`metadata` in a PATCH body is merged (RFC 7396 JSON Merge Patch), not replaced: objects merge
recursively, `null` deletes a key, arrays replace. A non-object `metadata` is a `400`. The row is
locked during the merge, so concurrent writers don't clobber each other — each writer should own
one top-level key and send only that key.
```bash
curl -sf -X PATCH -H "Authorization: Bearer $SHIPWRIGHT_TASK_STORE_TOKEN" \
-H "Content-Type: application/json" "$SHIPWRIGHT_TASK_STORE_URL/tasks/{id}" \
-d '{"metadata": {"myWriter": {"seen": true}}}' | jq .
```
### Append new tasks
Post each task individually. The service returns 409 if the `id` already exists — skip silently:
```bash
curl -sf -X POST \
-H "Authorization: Bearer $SHIPWRIGHT_TASK_STORE_TOKEN" \
-H "Content-Type: application/json" \
"$SHIPWRIGHT_TASK_STORE_URL/tasks" \
-d '{"id": "TSS-X.1", "title": "...", "status": "pending", "repo": "...", "branch": "feat/tss-x-1-..."}' | jq .
# 201 → inserted, 409 → already exists (skip)
```
**Required fields for every new task:**
| Field | Why required |
|---|---|
| `id` | Stable key; used by dependency resolution and all updates |
| `title` | Required by schema |
| `status` | Must be `"pending"` on creation |
| `repo` | Routes `dev-task` to the correct worktree |
| `branch` | `dev-task` creates the worktree from this; absent → task is skipped |
`assignee` is optional — omit it to leave the task unassigned in the repo pool (claimable
by any agent with repo access), or set it explicitly to pre-assign the task to a specific
agent ID.
Convention: `branch` = `feat/{id-lowercase}` (e.g. `feat/tss-x-1-my-task`).
**Cron origin convention:** follow-on tasks created by the system-cron skills carry
`originKind: "cron"` and `originRef` = the cron's system-cron definition id (the same value
the `SC-` tasks get), so they can be counted per cron. Ids are hard-coded in each skill — the
scheduler passes nothing. `research-docs --auto` stamps `originRef: "docs-freshness"` (plus
`repo` and `source: "docs-freshness"`); `test-readiness` passes `--origin-cron test-readiness`
to `test-fix`, which then stamps `originRef: "test-readiness"`. Standalone `test-fix` keeps
`originKind: "skill"` / `originRef: "test-fix"`.
**Cron sessions:** a task created with `originKind: "cron"`, an `originRef` and a `repo` and
no `session` gets the session `{originRef}-{repo-slug}` from the task store (the repo slug is
the last segment of `repo`, lowercased; e.g. `error-patrol-shipwright`). An explicit `session`
always wins and is never overwritten. If the derived slug is not a valid session slug, the
rule is skipped with a warning and the task is created with no session. A `PATCH` that sets a
`session` also creates the `Session` row. These sessions show up in `GET /sessions` and in
"what is waiting" answers, in the unowned group.
### Finding routing (auto / review / plan)
Fix skills create follow-on tasks one of three ways. Full contract: [docs/task-store.md](../../../../docs/task-store.md) ("Finding routing" and "System-cron contract").
**System-cron reads.** Agent tokens may call `GET /system-crons`, `/system-crons/:id/last-trigger` and `/system-crons/:id/triggers` (account-scoped to the agent). Create, patch, enable, disable and fire are admin-only (`403` for agent tokens).
| Route | How to create it |
|---|---|
| **auto** | `kind: "dev"`, `status: "pending"`, `hitl: false`. Agents execute it. |
| **review** | `kind: "dev"`, `status: "blocked"`, `blockedReason: "needs-review: <the specific question>"`, never `hitl: true`. A human unblocks it with `POST /tasks/{id}/unblock`, then agents execute it. |
| **plan** | `kind: "prd"`, `hitl: true`, description = draft problem statement plus the findings. A human runs it through `/shipwright:prd` or `/shipwright:plan-session`. |
Human-only dev tasks are the exception and keep `hitl: true` (run via `/shipwright:hitl`): credential rotation/revocation (security-fix) and the branch-protection settings task (test-fix, `status: pending`, `## Human steps`, no coding). Other routes never use it on a dev task. Every routed task carries `originKind: "cron"`, `originRef` = the system-cron id, and `repo`; the run's metrics count auto/review/plan separately.
---
## `?ready=true` semantics
When `?ready=true` is set, `?status` and `?id` filters are ignored. Only
`?session` applies as a post-filter.
- Unlike the general repo-pool visibility described above, `?ready=true` is already scoped: it returns your own tasks plus *unassigned* pool tasks in your repo scope — never another agent's already-assigned pending task. No `?assignee=` needed here.
- `?session` — filter by planning session slug. Omit to return ready tasks across all sessions.
A task is ready when **all** of the following are true:
- `status === "pending"`, AND
- `hitl` is not `true` (HITL tasks are excluded until manually cleared), AND
- every dependency is satisfied per the dependency rules below (terminal status, same-branch PR, or merged cross-branch PR)
**Dependency-satisfied rules** (first match wins):
1. `dep.status ∈ { merged, done, deployed, released, cancelled }` → satisfied
2. Same-branch dep with `status ∈ { pr_open, approved }` → satisfied (bundled PR)
3. `pr_open` dep with a PR number, GitHub reports the PR as merged → satisfied
4. Anything else → **not satisfied** (task is excluded from `?ready=true`)
---
## Empty results
When `?ready=true` returns `{ tasks: [], total: 0 }`:
| Likely cause | How to check |
|---|---|
| No tasks assigned to this agent | Use an admin token to see all ready tasks |
| HITL flag set | Query `?status=pending` — check if tasks have `"hitl": true`. Clear the flag once the human action is complete. |
| Deps not satisfied | Query `?status=pending` — tasks present but blocked on a dependency. Check each dependency against the satisfaction rules above: terminal status, same-branch `pr_open`/`approved`, or a `pr_open` dep whose GitHub PR is merged all satisfy. Any dep failing all three rules blocks the task. |
| Queue empty | No pending tasks exist at all |
---
## Task status values
`pending` → `in_progress` → `pr_open` → `approved` → `merged`
Branch statuses: `blocked`, `cancelled`, `deployed`, `released`, `done`
### Write a whole plan (planning sessions)
`/shipwright:plan-session` reads the session once (`GET /sessions/{slug}`: `homeRepo`, `ownerId`,
`documents[]` with derived `prState` and, for specs, `planned`), acquires the planning lock, and
then writes the plan document, its tasks, the planned-spec marks and the close-out with one call,
`POST /sessions/{slug}/plan`. Body: `{plan: {repo, path, owner?, title?, repos?}, tasks: [...],
specs?: [numbers], holder?, closes?: {taskId}}`; response: `{planDocumentId, inserted}`. Each task
is stamped with the session, `planDocumentId`, `originKind: "document"`, `originRef` (the plan
document id) and the session's owner server-side; a task names its spec with `specNumber`. Send
`plan.owner` only for a new session (see Session owners below). `holder` (the holder returned by the lock acquire) releases
the planning lock on success. `closes` marks an open `initiative`/`idea`/`prd` task `done` (and
links the plan), or only links an already-closed one. The session's repos follow from its tasks
and documents (no `PATCH /sessions` needed). A `403` also covers a token whose scope misses a
session repo (there is no separate preflight call).
It is atomic: a `409` (planning lock held by someone else, or a task id already taken),
`400` (invalid task, or a listed spec no task references), `403` (repo out of scope) or `502`
writes nothing.
`/shipwright:prd` writes a spec with one `POST /documents` (`{session, kind: "spec", number, repo,
path, repos?, originTaskId?}`; `owner` only for a new session): `originTaskId` closes the
initiative/idea/prd task and links `specDocumentId`.
### Session owners
Owners live on **sessions**, not tasks: `POST /sessions/{slug}/plan` and `POST /documents` set a
new session's owner once (first one wins), and every task in the session is stamped with it
server-side. Never send a task `owner`, and never inherit one from a spec or another task.
Plugin commands pick the owner in this order: `--owner`; an email the user asked the agent to
remember (keyed to the Slack sender when there is one); the sender email in the
`[Name <email>]:` prefix of the requesting message; then, only in a local interactive run, ask and
offer to remember the answer; otherwise blank. `git config user.email` is never used, and a missing
owner never blocks. Under `--autonomous` use the session's existing owner, else blank.
To change an existing session's owner: `PATCH /sessions/{slug}` with `{"owner": "{email}"}`
(`null` clears it).
When the user asks you to remember their owner email ("remember my email is …"), store it in the
agent's memory keyed to the requester (the Slack sender when there is one) and use it in the order
above on later runs. Never write an owner email to a committed file (plan, spec, branch, PR title or
body).
Both commands open the docs PR through `scripts/open-docs-pr.ts`, which also PATCHes `prUrl` on
each document it is given (`--doc kind:number:id`), so a command never issues that PATCH itself.
Use it only for planning passes; every other skill that queues tasks
(`error-fix`, `security-fix`, `entropy-fix`, `test-fix`, …) keeps using `POST /tasks/bulk`
(all-or-nothing, `409` on any existing id, at most `MAX_BULK_TASKS` per call).
---
## `GET /sessions` — session rollups and "waiting on a human"
Use this endpoint to answer "what is waiting on a human?". Each session is returned with its tasks rolled up.
```bash
curl -sf -H "Authorization: Bearer $SHIPWRIGHT_TASK_STORE_TOKEN" \
"$SHIPWRIGHT_TASK_STORE_URL/sessions?state=waiting&sort=waitingSince" | jq '.sessions'
```
**Filters** (all optional; verified against `task-store/src/session-service.ts` and `routes/sessions.ts`):
| Param | Meaning |
|---|---|
| `state` | `waiting` \| `active` \| `closed` \| `empty` \| `archived` \| `all`. Omitted → non-archived, non-closed sessions. `all` disables state/archive filtering |
| `org` | Org segment of any of the session's repos (repeatable) |
| `repo` | Session spans this `org/repo` (repeatable) |
| `owner` | Exact owner email |
| `ownerId` | Exact owner principal id |
| `q` | Case-insensitive substring of slug or title |
| `agentId` | Only sessions an agent has worked on |
| `sort` | `waitingSince` (oldest-waiting first, non-waiting after), `lastActivityAt` (default, newest first), `createdAt` (newest first) |
| `limit` | Page size (default 50) |
| `cursor` | Opaque `nextCursor` from the previous page; malformed → 400 |
Admin tokens may also pass `?accountId=`.
**Response:** `{ sessions, total, limit, nextCursor }`. Each session has `slug`, `state`, `waitingSince`, `owner`, `ownerId`, `homeRepo`, `repos`, `counts`, and `waitingTasks` (`{id, kind, title}`), plus other fields.
### What "waiting on a human" means
A session is `waiting` when at least one of its **open** tasks is waiting. Each entry in `waitingTasks` has a `kind` (precedence `blocked` > `pr_blocked` > `hitl`):
- `blocked` — the task's `status` is `blocked`.
- `pr_blocked` — the task's linked PR record is blocked.
- `hitl` — `hitl: true` with **no unmet dependency** (the human gate is the only thing holding it back).
A task that is only waiting on an unmet dependency is not waiting. `waitingSince` is the earliest `updatedAt` among the waiting tasks.
> **Do not use `GET /tasks?hitl=true` to answer "what is waiting".** It is a different, broader set: it includes `hitl` tasks still gated by dependencies and misses `blocked` and `pr_blocked` tasks. Use `GET /sessions?state=waiting`.
### Slack recipes — list, then drill
Answer "what is waiting on me?" in three levels. Replies follow Slack style: headline first, ask last, short; detail goes behind a drill-in.
**Level 1 — the list.** `GET /sessions?state=waiting&sort=waitingSince`. One line per session: slug, waiting count (`waitingTasks.length`), waiting since. Show **mine first** — sessions whose `owner` equals the requester's email from the `[Name <email>]:` prefix — then a separate **unowned** group (`owner` null). Skip other people's sessions unless asked. **Org variant:** add `org={org}` ("what is waiting in app-vitals?"). Matching on `ownerId` is deferred; use `owner`.
**Level 2 — one session.** A named session ("what is blocking X", "unblock X") starts here **without** the level 1 list: fetch `GET /sessions?state=waiting&q={slug}` and show **all** its waiting tasks as `id — title (kind)` before any is worked.
**Level 3 — work one task at a time.** Pick one, propose the action from the table below, and run it only after the owner confirms. Drill-in on request: `GET /tasks/{id}` for the description. Then return to level 2 for the next one.
| `kind` | Action | Notes |
|---|---|---|
| `hitl` | `/shipwright:hitl` | Human-in-the-loop task; hands off to the hitl command |
| `blocked` | `POST /tasks/{id}/unblock` | Show `blockedReason` first; optional body `{to}` |
| `pr_blocked` | `POST /prs/{id}/unblock` | `{id}` is the **PR record id** (verified: `unblock` in `task-store/src/pull-request-service.ts` looks up the row by primary key), **not** the PR number. Resolve it with `GET /prs?repo={org/repo}&prNumber={n}` → `.prs[].id` |
**One task at a time:** propose, then run only on the owner's confirmation. Confirm before each task; never batch or "unblock all".
Example phrases that trigger these recipes:
- "what is waiting on me?"
- "what's waiting in app-vitals?" (org variant)
- "what is blocking sessions-waiting-on-human?"
- "unblock task-store-pagination"
- "show me the details of the second one" (drill-in)
## Full API reference
| Method | Path | Description |
|---|---|---|
| `GET` | `/tasks` | List tasks (`?status`, `?session`, `?assignee`, `?ready=true`) |
| `POST` | `/tasks` | Create a task (409 if `id` exists) |
| `POST` | `/tasks/bulk` | Create many tasks atomically (409 if any `id` exists); used by the fix skills |
| `GET` | `/sessions` | List session rollups (`?state`, `?org`, `?repo`, `?owner`, `?ownerId`, `?q`, `?agentId`, `?sort`, `?limit`, `?cursor`); see [`GET /sessions`](#get-sessions--session-rollups-and-waiting-on-a-human) |
| `POST` | `/sessions/:slug/plan` | Write a plan document, its tasks and planned specs in one transaction (planning sessions) |
| `GET` | `/tasks/:id` | Fetch one task (404 if missing) |
| `PATCH` | `/tasks/:id` | Update fields (partial update, returns updated task) |
| `DELETE` | `/tasks/:id` | Delete a task |
| `POST` | `/tasks/:id/claim` | Atomic claim → `in_progress` (409 if already claimed) |
| `POST` | `/tasks/:id/release` | Unclaim (`in_progress` → `pending`) |
| `POST` | `/tasks/:id/unblock` | Unblock a `blocked` task and reset skip counters. Optional body `{to}` (`pending`, `pr_open`, `merged`, `deployed`, `released`); omitted → inferred from `pr` and the PR record (no `pr` → `pending`, open → `pr_open`, merged → `merged`). Non-`pending` targets need a non-null `pr` (400). 409 if not blocked, or PR closed unmerged with no `to` |
| `POST` | `/tasks/:id/complete` | Mark `done` |
| `POST` | `/tasks/:id/fail` | Mark `blocked` |
**PR tracking (`/prs`)**
| Method | Path | Description |
|---|---|---|
| `GET` | `/prs` | List PR records (`?repo`, `?prNumber`, `?state`, `?reviewState`, `?staged`, `?limit`, `?cursor`; returns `prs` + `nextCursor` — follow `nextCursor` until `null`) |
| `POST` | `/prs/claim` | Upsert + claim a PR record → `in_progress` (body: `repo`, `prNumber`, `commitSha`; `claimedBy` — required for non-agent tokens, ignored for agent tokens) |
| `GET` | `/prs/:id` | Fetch one PR record (404 if missing) |
| `PATCH` | `/prs/:id` | Update PR fields (partial update) |
| `POST` | `/prs/:id/heartbeat` | Extend review TTL (prevents StaleClaimReaper from auto-releasing) |
| `POST` | `/prs/:id/complete` | Mark review complete |
| `POST` | `/prs/:id/patch` | Record a patch cycle on this PR |
| `POST` | `/prs/:id/release` | Release claim → `pending` |
| `POST` | `/prs/:id/unblock` | Human unblock: clears `blocked`, `blockedReason`, skip counters and CI-failure streak in one update (409 if not blocked) |
> **Scoping:** Tasks are scoped by repo access — all agents with access to a repo can see its tasks. Always filter with `?assignee=$SHIPWRIGHT_AGENT_ID` when you only want your own tasks.
---
## Reference
- **Task schema** (all fields + per-status required fields): [task-schema.md](references/task-schema.md)