Skip to content

Persist one work package transition unit.

API version mission-write unreleased

POST
/missions/{missionId}/work-package-transitions

The service validates the transition against the lane state machine, its guards and dependency gating (it is authoritative; a CLI pre-check is advisory only), verifies the write location of the request context, then persists the unit’s rows and answers 201 once they are durable: for checkout_append in one O_APPEND write of full JSON lines, synced; for coordination_ref_commit as one commit onto the coordination branch, moved by compare-and-swap, with its objects and ref synced (ADR-0007). A refusal writes nothing. Writes to one repository are serialized by the service.

Authorizations

Parameters

Path Parameters

missionId
required
MissionId

The canonical machine identity of a Mission: a 26-character Crockford ULID minted when the Mission is created and never changed. It is the only Mission selector the write service accepts.

string
/^[0-9A-HJKMNP-TV-Z]{26}$/

The identity of the Mission, a 26-character ULID; the only Mission selector accepted.

Header Parameters

Spec-Kitty-Write-Protocol
required
ProtocolVersion

A major version of the write-service protocol, a positive integer. The client sends the major it negotiated in the Spec-Kitty-Write-Protocol header; the handshake lists the majors the service speaks. This document describes major 1.

integer
>= 1

The protocol major the client negotiated through GET /handshake. A missing header, a value that is not an integer, or a major the service does not speak, is refused with PROTOCOL_VERSION_UNSUPPORTED.

Request Bodyrequired

Media type application/json
TransitionUnit

One work package transition: the transition row first, then its annotations, in order. The unit lands whole or not at all, in one write of full JSON lines that is synced before the answer. Every row names wpId as its wp_id, and a row that names a Mission names the missionId of the path; otherwise the request is REQUEST_MALFORMED. The service owns the row encoding and writes the bytes the CLI’s one encoder writes (store.serialize_event_line, ADR 2026-10-22-1 D-7): sanitize_event_for_log first, which strips host and developer fields, then sorted keys. It never writes the bytes as received, and judges a retry by comparing sanitized rows as JSON values.

object
context
required
RequestContext

The request context of the unit.

object
actor
required

The actor of the write, as the rows carry it.

string
>= 1 characters
checkout
required

The caller’s checkout, relative to the repository root checkout: a single dot for the repository root checkout, otherwise the worktree’s relative path. For checkout_append it is the checkout that holds the Mission directory, always the repository root checkout. For coordination_ref_commit it only names who asks: the write touches no checkout (ADR-0007).

string
>= 1 characters /^(\.|(?!/)(?![A-Za-z]:)(?!.*\\)(?!(.*/)?\.\.(/|$)).+)$/
destinationRef
required

The branch the unit’s status commit lands on, when the CLI resolved one; null otherwise. Always set for coordination_ref_commit: it is the coordination branch whose ref the service moves.

string | null
missionDirectory
required

The Mission directory (the write location the CLI resolved). For checkout_append it is relative to the checkout; for coordination_ref_commit it is the path of the Mission directory in the tree of destinationRef, relative to the root of that tree.

string
>= 1 characters /^(\.|(?!/)(?![A-Za-z]:)(?!.*\\)(?!(.*/)?\.\.(/|$)).+)$/
writeSurface
required
WriteSurface

The CLI write contract the location was resolved under.

string
Allowed values: checkout_append coordination_ref_commit
implementationEvidencePresent

Whether implementation evidence exists, for the unforced in_progress -> for_review guard. Absent or null: the service infers it as core’s pipeline does (any earlier transition of the work package). true or false: used verbatim. It never affects the subtask half of the guard, is ignored for other transitions and under force, and is never persisted (the appended bytes and replay are identical with and without it). An older service that does not know the field answers 400 REQUEST_MALFORMED (additionalProperties is false), so a client omits it unless the caller gave an explicit value (core #6195 documents the rolling upgrade).

boolean | null
operation
WriteOperation

The operation that produced the unit; absent means transition.

string
Allowed values: transition start_implementation start_review
rows
required

The rows of the unit, the transition first.

Array<object>
>= 1 items
EventRow

One event row as the CLI built it, written by the service as one full JSON line. Its shape is owned by the spec-kitty-events envelope (spec-kitty/spec-kitty-events#92) and today matches the CLI’s status rows (StatusEvent, InnerStateChanged); this contract does not redefine it and requires only the event_id the acknowledgement and idempotency rules refer to. The service validates the row against the envelope and its lane rules, and refuses what it cannot accept.

object
event_id
required

The ULID of the event; unique in the Mission’s event log.

string
/^[0-9A-HJKMNP-TV-Z]{26}$/
policy_metadata

The row’s policy metadata as the CLI built it (an object or null). Untyped, as before, except for the one key this contract types: wp_window, the window-opening record of core’s status-event-wp-window contract (spec-kitty/spec-kitty-events#229), which the CLI stamps from the same lane-head reading as lane_head. The service relays the whole object, wp_window included, as the same JSON value (contract rule W-7), subject only to the row-wide rules every field obeys: the PII keys are stripped at any depth, keys are sorted, and a non-finite number, a duplicate key or an over-deep or oversized body is refused. It never takes a lane-head reading of its own and never refuses, delays or retries a unit because of the wp_window value (W-4): a value outside WpWindow is appended as sent, and readers read it as not recorded (R-5). WpWindow therefore documents the shape a conforming writer sends; it is not a request constraint, and a client, gateway or generated SDK must not refuse a row for violating it.

object
wp_window
One of:
WpWindow

Where the work package’s review window opens, on a window-opening move only.

object
gap
One of:
WpWindowGap

Why the move recorded no lane head.

object
cause
required
WpWindowGapCause

Present exactly when reason is capture_failed.

string
Allowed values: git_error probe_error
detail

The reading’s diagnostic, cut to 500 characters by the writer; optional.

string
<= 500 characters
reason
required
Allowed value: capture_failed
open_sha
required

The lane head commit when the window opened, a SHA-1 or SHA-256 object name in lower case. It is branch-relative provenance, valid for one consolidation attempt (core ADR 2026-11-07-1).

string
/^([0-9a-f]{40}|[0-9a-f]{64})$/
schema_version

The version of this value’s shape; only 1 exists. Writers send the integer 1. JSON Schema compares numbers by value, so this also accepts 1.0, which core’s reader rejects (it requires an integer), as it does the boolean true.

Allowed value: 1
key
additional properties
any
key
additional properties
any
wpId
required
WpId

The work package the unit moves.

string
>= 1 characters <= 64 characters /^WP[0-9]{2,}$/

Responses

201

The unit is durable.

Media type application/json
DurabilityAck

The answer to a persisted unit. For checkout_append its rows were appended in one O_APPEND write of full JSON lines and synced (fsync) before this answer was sent. For coordination_ref_commit the rows were appended to the event log blob of a new commit on the coordination branch, and the objects and the moved ref were durable before this answer was sent (ADR-0007). For checkout_append, where the topology commits status, the status commit joins the unit at migration step 4 of ADR 2026-10-22-1, and until then statusCommit is null. A coordination_ref_commit is itself the commit, so its statusCommit is always that commit; the surface is served from migration step 4.

object
appendedLines
required

The number of lines this request appended; 0 when the unit was already persisted (replayed).

integer
eventIds
required

The event_id of every persisted row, in write order.

Array<string>
>= 1 items
fsynced
required

Always true: the unit’s rows are durable. An answer is sent only after the append is synced (checkout_append) or the commit’s objects and the moved ref are synced (coordination_ref_commit); for a replay the rows were synced when they were first written.

boolean
replayed
required

True when every row of the unit was already persisted with identical content, so nothing was written.

boolean
statusCommit
required

The commit that holds the unit, where the topology commits status and the service owns the commit; null otherwise. For coordination_ref_commit it is the commit the compare-and-swap moved destinationRef to (ADR-0007).

string | null
/^[0-9a-f]{40,64}$/

400

The request was refused before it was read (400): REQUEST_MALFORMED or PROTOCOL_VERSION_UNSUPPORTED.

Media type application/problem+json
WriteRefusal

The body of every refused write-service request: the shared Problem with a code from WriteRefusalCode and the status that code fixes. A guard refusal also carries type, a WriteRefusalReason URN; every other refusal omits type (about:blank). The body never echoes the bearer token, a host path or row content. A refused batch names the unit that failed in instance, as the JSON pointer #/units/ of the request. Consumers branch on code, never on title.

object
code
required

A stable machine-readable code for the problem, such as the name of a refusal reason. Consumers branch on it, never on the title.

string
detail

A human-readable explanation specific to this occurrence of the problem.

string
instance

A URI reference that identifies this occurrence of the problem.

string
status
required

The HTTP status code of this occurrence.

integer
>= 400 <= 599
title
required

A short, human-readable summary of the kind of problem. It does not change between occurrences.

string
type

A URI reference that identifies the kind of problem. Absent means about:blank.

string
code
required
One of:
WriteRefusalCode
  1. The lane state machine or one of its guards refused the transition. The type names the reason, including stale_from_lane for a stale unit whose from_lane is not the work package’s current lane. The CLI’s orchestrator-api code for a TransitionError.
string
Allowed value: TRANSITION_REJECTED
type
One of:
WriteRefusalReason

The from or to status lane is not one of the 11 persisted Lane values.

string
Allowed value: urn:spec-kitty:write-refusal:unknown_lane

401

The bearer token is missing or wrong (401, WRITE_TOKEN_INVALID). The body never echoes the token.

Media type application/problem+json
WriteRefusal

The body of every refused write-service request: the shared Problem with a code from WriteRefusalCode and the status that code fixes. A guard refusal also carries type, a WriteRefusalReason URN; every other refusal omits type (about:blank). The body never echoes the bearer token, a host path or row content. A refused batch names the unit that failed in instance, as the JSON pointer #/units/ of the request. Consumers branch on code, never on title.

object
code
required

A stable machine-readable code for the problem, such as the name of a refusal reason. Consumers branch on it, never on the title.

string
detail

A human-readable explanation specific to this occurrence of the problem.

string
instance

A URI reference that identifies this occurrence of the problem.

string
status
required

The HTTP status code of this occurrence.

integer
>= 400 <= 599
title
required

A short, human-readable summary of the kind of problem. It does not change between occurrences.

string
type

A URI reference that identifies the kind of problem. Absent means about:blank.

string
code
required
One of:
WriteRefusalCode
  1. The lane state machine or one of its guards refused the transition. The type names the reason, including stale_from_lane for a stale unit whose from_lane is not the work package’s current lane. The CLI’s orchestrator-api code for a TransitionError.
string
Allowed value: TRANSITION_REJECTED
type
One of:
WriteRefusalReason

The from or to status lane is not one of the 11 persisted Lane values.

string
Allowed value: urn:spec-kitty:write-refusal:unknown_lane

Headers

WWW-Authenticate
string

The bearer challenge (RFC 9110), Bearer with no parameters.

403

The Host, Origin or Sec-Fetch-Site guard refused the request (403, REQUEST_REFUSED).

Media type application/problem+json
WriteRefusal

The body of every refused write-service request: the shared Problem with a code from WriteRefusalCode and the status that code fixes. A guard refusal also carries type, a WriteRefusalReason URN; every other refusal omits type (about:blank). The body never echoes the bearer token, a host path or row content. A refused batch names the unit that failed in instance, as the JSON pointer #/units/ of the request. Consumers branch on code, never on title.

object
code
required

A stable machine-readable code for the problem, such as the name of a refusal reason. Consumers branch on it, never on the title.

string
detail

A human-readable explanation specific to this occurrence of the problem.

string
instance

A URI reference that identifies this occurrence of the problem.

string
status
required

The HTTP status code of this occurrence.

integer
>= 400 <= 599
title
required

A short, human-readable summary of the kind of problem. It does not change between occurrences.

string
type

A URI reference that identifies the kind of problem. Absent means about:blank.

string
code
required
One of:
WriteRefusalCode
  1. The lane state machine or one of its guards refused the transition. The type names the reason, including stale_from_lane for a stale unit whose from_lane is not the work package’s current lane. The CLI’s orchestrator-api code for a TransitionError.
string
Allowed value: TRANSITION_REJECTED
type
One of:
WriteRefusalReason

The from or to status lane is not one of the 11 persisted Lane values.

string
Allowed value: urn:spec-kitty:write-refusal:unknown_lane

404

The Mission or the work package does not exist (404, MISSION_NOT_FOUND or WP_NOT_FOUND).

Media type application/problem+json
WriteRefusal

The body of every refused write-service request: the shared Problem with a code from WriteRefusalCode and the status that code fixes. A guard refusal also carries type, a WriteRefusalReason URN; every other refusal omits type (about:blank). The body never echoes the bearer token, a host path or row content. A refused batch names the unit that failed in instance, as the JSON pointer #/units/ of the request. Consumers branch on code, never on title.

object
code
required

A stable machine-readable code for the problem, such as the name of a refusal reason. Consumers branch on it, never on the title.

string
detail

A human-readable explanation specific to this occurrence of the problem.

string
instance

A URI reference that identifies this occurrence of the problem.

string
status
required

The HTTP status code of this occurrence.

integer
>= 400 <= 599
title
required

A short, human-readable summary of the kind of problem. It does not change between occurrences.

string
type

A URI reference that identifies the kind of problem. Absent means about:blank.

string
code
required
One of:
WriteRefusalCode
  1. The lane state machine or one of its guards refused the transition. The type names the reason, including stale_from_lane for a stale unit whose from_lane is not the work package’s current lane. The CLI’s orchestrator-api code for a TransitionError.
string
Allowed value: TRANSITION_REJECTED
type
One of:
WriteRefusalReason

The from or to status lane is not one of the 11 persisted Lane values.

string
Allowed value: urn:spec-kitty:write-refusal:unknown_lane

409

The lane state machine, a guard, the claim, the status lock, the event log, or the coordination branch (moved during the compare-and-swap, or checked out in a worktree) refused the write (409). Nothing was written.

Media type application/problem+json
WriteRefusal

The body of every refused write-service request: the shared Problem with a code from WriteRefusalCode and the status that code fixes. A guard refusal also carries type, a WriteRefusalReason URN; every other refusal omits type (about:blank). The body never echoes the bearer token, a host path or row content. A refused batch names the unit that failed in instance, as the JSON pointer #/units/ of the request. Consumers branch on code, never on title.

object
code
required

A stable machine-readable code for the problem, such as the name of a refusal reason. Consumers branch on it, never on the title.

string
detail

A human-readable explanation specific to this occurrence of the problem.

string
instance

A URI reference that identifies this occurrence of the problem.

string
status
required

The HTTP status code of this occurrence.

integer
>= 400 <= 599
title
required

A short, human-readable summary of the kind of problem. It does not change between occurrences.

string
type

A URI reference that identifies the kind of problem. Absent means about:blank.

string
code
required
One of:
WriteRefusalCode
  1. The lane state machine or one of its guards refused the transition. The type names the reason, including stale_from_lane for a stale unit whose from_lane is not the work package’s current lane. The CLI’s orchestrator-api code for a TransitionError.
string
Allowed value: TRANSITION_REJECTED
type
One of:
WriteRefusalReason

The from or to status lane is not one of the 11 persisted Lane values.

string
Allowed value: urn:spec-kitty:write-refusal:unknown_lane

413

The body exceeds the size cap (413, REQUEST_TOO_LARGE). Provisional.

Media type application/problem+json
WriteRefusal

The body of every refused write-service request: the shared Problem with a code from WriteRefusalCode and the status that code fixes. A guard refusal also carries type, a WriteRefusalReason URN; every other refusal omits type (about:blank). The body never echoes the bearer token, a host path or row content. A refused batch names the unit that failed in instance, as the JSON pointer #/units/ of the request. Consumers branch on code, never on title.

object
code
required

A stable machine-readable code for the problem, such as the name of a refusal reason. Consumers branch on it, never on the title.

string
detail

A human-readable explanation specific to this occurrence of the problem.

string
instance

A URI reference that identifies this occurrence of the problem.

string
status
required

The HTTP status code of this occurrence.

integer
>= 400 <= 599
title
required

A short, human-readable summary of the kind of problem. It does not change between occurrences.

string
type

A URI reference that identifies the kind of problem. Absent means about:blank.

string
code
required
One of:
WriteRefusalCode
  1. The lane state machine or one of its guards refused the transition. The type names the reason, including stale_from_lane for a stale unit whose from_lane is not the work package’s current lane. The CLI’s orchestrator-api code for a TransitionError.
string
Allowed value: TRANSITION_REJECTED
type
One of:
WriteRefusalReason

The from or to status lane is not one of the 11 persisted Lane values.

string
Allowed value: urn:spec-kitty:write-refusal:unknown_lane

422

The write location or its destination refused the write (422): a protected branch, a destination ref problem, a deleted coordination branch, an owned checkout that does not hold the Mission or an unverified write location. Nothing was written.

Media type application/problem+json
WriteRefusal

The body of every refused write-service request: the shared Problem with a code from WriteRefusalCode and the status that code fixes. A guard refusal also carries type, a WriteRefusalReason URN; every other refusal omits type (about:blank). The body never echoes the bearer token, a host path or row content. A refused batch names the unit that failed in instance, as the JSON pointer #/units/ of the request. Consumers branch on code, never on title.

object
code
required

A stable machine-readable code for the problem, such as the name of a refusal reason. Consumers branch on it, never on the title.

string
detail

A human-readable explanation specific to this occurrence of the problem.

string
instance

A URI reference that identifies this occurrence of the problem.

string
status
required

The HTTP status code of this occurrence.

integer
>= 400 <= 599
title
required

A short, human-readable summary of the kind of problem. It does not change between occurrences.

string
type

A URI reference that identifies the kind of problem. Absent means about:blank.

string
code
required
One of:
WriteRefusalCode
  1. The lane state machine or one of its guards refused the transition. The type names the reason, including stale_from_lane for a stale unit whose from_lane is not the work package’s current lane. The CLI’s orchestrator-api code for a TransitionError.
string
Allowed value: TRANSITION_REJECTED
type
One of:
WriteRefusalReason

The from or to status lane is not one of the 11 persisted Lane values.

string
Allowed value: urn:spec-kitty:write-refusal:unknown_lane

500

The write failed after it was accepted (500): the append, its verification or the status commit failed, or the coordination surface is unreadable. Nothing is acknowledged.

Media type application/problem+json
WriteRefusal

The body of every refused write-service request: the shared Problem with a code from WriteRefusalCode and the status that code fixes. A guard refusal also carries type, a WriteRefusalReason URN; every other refusal omits type (about:blank). The body never echoes the bearer token, a host path or row content. A refused batch names the unit that failed in instance, as the JSON pointer #/units/ of the request. Consumers branch on code, never on title.

object
code
required

A stable machine-readable code for the problem, such as the name of a refusal reason. Consumers branch on it, never on the title.

string
detail

A human-readable explanation specific to this occurrence of the problem.

string
instance

A URI reference that identifies this occurrence of the problem.

string
status
required

The HTTP status code of this occurrence.

integer
>= 400 <= 599
title
required

A short, human-readable summary of the kind of problem. It does not change between occurrences.

string
type

A URI reference that identifies the kind of problem. Absent means about:blank.

string
code
required
One of:
WriteRefusalCode
  1. The lane state machine or one of its guards refused the transition. The type names the reason, including stale_from_lane for a stale unit whose from_lane is not the work package’s current lane. The CLI’s orchestrator-api code for a TransitionError.
string
Allowed value: TRANSITION_REJECTED
type
One of:
WriteRefusalReason

The from or to status lane is not one of the 11 persisted Lane values.

string
Allowed value: urn:spec-kitty:write-refusal:unknown_lane

503

The service cannot take the write or repair now (503). SERVICE_BUSY: it is serializing other writes beyond its queue bound; retry the same service after Retry-After seconds. SERVICE_DRAINING: it is about to exit; re-read the endpoint file. A write or repair still waiting for the turn or the Mission lock when draining begins answers 503 SERVICE_DRAINING and writes nothing; one already holding the lock finishes. Provisional.

Media type application/problem+json
WriteRefusal

The body of every refused write-service request: the shared Problem with a code from WriteRefusalCode and the status that code fixes. A guard refusal also carries type, a WriteRefusalReason URN; every other refusal omits type (about:blank). The body never echoes the bearer token, a host path or row content. A refused batch names the unit that failed in instance, as the JSON pointer #/units/ of the request. Consumers branch on code, never on title.

object
code
required

A stable machine-readable code for the problem, such as the name of a refusal reason. Consumers branch on it, never on the title.

string
detail

A human-readable explanation specific to this occurrence of the problem.

string
instance

A URI reference that identifies this occurrence of the problem.

string
status
required

The HTTP status code of this occurrence.

integer
>= 400 <= 599
title
required

A short, human-readable summary of the kind of problem. It does not change between occurrences.

string
type

A URI reference that identifies the kind of problem. Absent means about:blank.

string
code
required
One of:
WriteRefusalCode
  1. The lane state machine or one of its guards refused the transition. The type names the reason, including stale_from_lane for a stale unit whose from_lane is not the work package’s current lane. The CLI’s orchestrator-api code for a TransitionError.
string
Allowed value: TRANSITION_REJECTED
type
One of:
WriteRefusalReason

The from or to status lane is not one of the 11 persisted Lane values.

string
Allowed value: urn:spec-kitty:write-refusal:unknown_lane

Headers

Retry-After
integer
>= 1

Seconds to wait before retrying; sent with SERVICE_BUSY, absent with SERVICE_DRAINING.