Contracts

body-sync.md

Contract: Body Sync (Post-Cutover)

Feature: 064-complete-mission-identity-cutover Date: 2026-04-06

Upload Request Payload

POST /api/dossier/push-content/

{
  "project_uuid": "uuid",
  "mission_slug": "064-my-mission",
  "target_branch": "main",
  "mission_type": "software-dev",
  "manifest_version": "1.0",
  "artifact_path": "kitty-specs/064-my-mission/spec.md",
  "content_hash": "sha256:...",
  "hash_algorithm": "sha256",
  "content_body": "..."
}

Required Fields

FieldTypeDescription
project_uuidstring (UUID)Project identity
mission_slugstringMission instance identifier
target_branchstringTarget branch for the mission
mission_typestringMission workflow kind
manifest_versionstringArtifact manifest version
artifact_pathstringRelative path to artifact
content_hashstringContent hash with algorithm prefix
hash_algorithmstringHash algorithm name
content_bodystringArtifact content

Forbidden Fields

FieldReason
feature_slugLegacy; replaced by mission_slug
mission_keyLegacy intermediate field; replaced by mission_type

NamespaceRef Fields

The NamespaceRef dataclass identifies an artifact's position in the project hierarchy:

FieldTypeDescription
project_uuidstringProject identity
mission_slugstringMission instance identifier
target_branchstringTarget branch
mission_typestringMission workflow kind
manifest_versionstringArtifact manifest version

Queue Schema (SQLite)

CREATE TABLE body_upload_queue (
    row_id INTEGER PRIMARY KEY AUTOINCREMENT,
    project_uuid TEXT NOT NULL,
    mission_slug TEXT NOT NULL,      -- was: feature_slug
    target_branch TEXT NOT NULL,
    mission_type TEXT NOT NULL,       -- was: mission_key
    manifest_version TEXT NOT NULL,
    artifact_path TEXT NOT NULL,
    content_hash TEXT NOT NULL,
    hash_algorithm TEXT NOT NULL,
    content_body TEXT NOT NULL,
    size_bytes INTEGER NOT NULL,
    retry_count INTEGER NOT NULL DEFAULT 0,
    next_attempt_at REAL NOT NULL,
    created_at REAL NOT NULL
);

event-envelope.md

Contract: Event Envelope (3.0.0 Conformance)

Feature: 064-complete-mission-identity-cutover Date: 2026-04-06 Upstream: spec-kitty-events @ 5b8e6dc, spec-kitty-saas @ 3a0e4af

Envelope Shape

Every event emitted to SaaS (via WebSocket, batch sync, or offline queue) must include:

{
  "schema_version": "3.0.0",
  "build_id": "uuid-of-this-checkout",
  "aggregate_type": "Mission",
  "event_type": "MissionCreated | MissionClosed | WPStatusChanged | ...",
  "payload": {
    "mission_slug": "064-my-mission",
    "mission_number": "064",
    "mission_type": "software-dev",
    ...
  }
}

Required Envelope Fields

FieldTypeDescription
schema_versionstringMust be "3.0.0"
build_idstring (UUID)Unique checkout/worktree identity
aggregate_typestringMust be "Mission" (never "Feature")
event_typestringOne of the canonical event types

Forbidden Envelope Fields

FieldReason
feature_slugLegacy alias; use mission_slug in payload
aggregate_type: "Feature"Legacy aggregate type

Required Payload Fields (mission-scoped events)

FieldTypeDescription
mission_slugstringMission instance identifier (e.g., "064-my-mission")
mission_numberstringMission sequence number (e.g., "064")
mission_typestringMission workflow kind (e.g., "software-dev")

Forbidden Payload Fields

FieldReason
feature_slugLegacy; replaced by mission_slug
feature_numberLegacy; replaced by mission_number
feature_typeLegacy; replaced by mission_type

Canonical Event Types

Event TypeWhen Emitted
MissionCreatedNew mission scaffolded
MissionClosedMission accepted/completed
WPStatusChangedWork package lane transition
WPCreatedWork package added
WPAssignedWork package claimed by actor
HistoryAddedAudit log entry appended
ErrorLoggedError event recorded
DependencyResolvedWP dependency resolved
MissionOriginBoundTracker origin binding

Forbidden Event Types

Event TypeReason
FeatureCreatedLegacy; replaced by MissionCreated
FeatureCompletedLegacy; replaced by MissionClosed

build_id Invariants

  • build_id must be present and non-null on every emitted envelope
  • build_id must be preserved through serialization, queue storage, replay, and reduction
  • Different checkouts/worktrees of the same repository must have different build_id values
  • The same checkout must retain its build_id across sessions

orchestrator-api.md

Contract: Orchestrator API (Post-Cutover)

Feature: 064-complete-mission-identity-cutover Date: 2026-04-06 Consumer: spec-kitty-orchestrator (Priivacy-ai/spec-kitty-orchestrator)

Commands

Renamed Commands

CommandPurposeKey Parameters
mission-stateQuery mission status and WP lanes--mission (mission slug), --policy
accept-missionMark all WPs done, accept mission--mission (mission slug), --policy
merge-missionMerge mission worktrees to target branch--mission (mission slug), --strategy, --policy

Unchanged Commands

CommandPurpose
contract-versionReport contract version and minimum provider version
list-readyList WPs ready for implementation/review
start-implementationClaim and start implementing a WP
start-reviewStart reviewing a WP
transitionTransition a WP between lanes
append-historyAppend audit history entry

CLI Parameter Rename

All 8 commands currently use --feature as the CLI flag for the mission slug. After cutover, this parameter must be renamed to --mission across all commands. The --feature flag must not be accepted on any live command.

Old FlagNew FlagScope
--feature--missionAll 8 commands that accept a mission slug

Error Codes

CodeMeaning
MISSION_NOT_FOUNDMission slug does not resolve to a kitty-specs directory
MISSION_NOT_READYNot all WPs are done (for accept-mission)
USAGE_ERRORCLI parse/usage error
POLICY_METADATA_REQUIRED--policy missing on run-affecting command
POLICY_VALIDATION_FAILEDPolicy JSON invalid or contains secrets
WP_NOT_FOUNDWP ID does not exist in the mission
TRANSITION_REJECTEDTransition not allowed by state machine
WP_ALREADY_CLAIMEDWP claimed by a different actor
PREFLIGHT_FAILEDPreflight checks failed (for merge-mission)
CONTRACT_VERSION_MISMATCHProvider version below minimum
UNSUPPORTED_STRATEGYMerge strategy not implemented

Response Envelope

All commands emit a single JSON object to stdout. The envelope always includes:

{
  "ok": true,
  "command": "mission-state",
  "contract_version": "...",
  "mission_slug": "064-my-mission",
  "data": { ... }
}

Removed fields: feature_slug (was injected as alias, no longer present).

Required field: mission_slug (always present in data payloads that reference a mission).

Failure Envelope

{
  "ok": false,
  "command": "mission-state",
  "error_code": "MISSION_NOT_FOUND",
  "error": "Mission '064-nonexistent' not found in kitty-specs/",
  "contract_version": "..."
}

Unknown Command Behavior

Calling a removed command name (e.g., feature-state, accept-feature, merge-feature) results in a standard CLI unknown-command error. The orchestrator API does not recognize these names and does not provide a redirect or deprecation notice.

tracker-bind.md

Contract: Tracker Bind (Post-Cutover)

Feature: 064-complete-mission-identity-cutover Date: 2026-04-06

Bind Payload

The project_identity dict sent during tracker bind operations:

{
  "uuid": "project-uuid",
  "slug": "project-slug",
  "node_id": "node-uuid",
  "repo_slug": "repo-slug",
  "build_id": "build-uuid"
}

Required Fields

FieldTypeDescription
uuidstring (UUID)Project identity
slugstringProject slug
node_idstring (UUID)Causal emitter identity (Lamport ordering)
repo_slugstringRepository slug
build_idstring (UUID)Checkout/worktree identity

Change from Current

Added: build_id (previously absent from tracker bind payload).

All other fields unchanged.

upstream-3.0.0-shape.json

{ "_comment": "Machine-readable contract shape derived from spec-kitty-events @ 5b8e6dc and spec-kitty-saas @ 3a0e4af. The compatibility gate MUST load and enforce this artifact, not hand-maintained constants.", "_source_events_commit": "5b8e6dc", "_source_saas_commit": "3a0e4af", "_schema_version": "3.0.0", "envelope": { "required_fields": ["schema_version", "build_id", "aggregate_type", "event_type"], "forbidden_fields": ["feature_slug", "feature_number", "from_lane", "to_lane", "actor", "force", "reason", "review_ref", "execution_mode", "evidence"], "aggregate_type": { "allowed": ["Build", "Mission", "WorkPackage", "MissionDossier"], "forbidden": ["Feature"] }, "schema_version": { "value": "3.0.0" } }, "payload": { "mission_scoped": { "required_fields": ["mission_slug", "mission_number", "mission_type"], "forbidden_fields": ["feature_slug", "feature_number", "feature_type"] } }, "body_sync": { "required_fields": ["project_uuid", "mission_slug", "target_branch", "mission_type", "manifest_version"], "forbidden_fields": ["feature_slug", "mission_key"] }, "tracker_bind": { "required_fields": ["uuid", "slug", "node_id", "repo_slug", "build_id"], "forbidden_fields": [] }, "orchestrator_api": { "allowed_commands": ["contract-version", "mission-state", "list-ready", "start-implementation", "start-review", "transition", "append-history", "accept-mission", "merge-mission"], "forbidden_commands": ["feature-state", "accept-feature", "merge-feature"], "allowed_error_codes": ["USAGE_ERROR", "POLICY_METADATA_REQUIRED", "POLICY_VALIDATION_FAILED", "MISSION_NOT_FOUND", "WP_NOT_FOUND", "TRANSITION_REJECTED", "WP_ALREADY_CLAIMED", "MISSION_NOT_READY", "WORKFLOW_EVIDENCE_REQUIRED", "PREFLIGHT_FAILED", "CONTRACT_VERSION_MISMATCH", "UNSUPPORTED_STRATEGY", "HISTORY_COMMIT_FAILED", "DEPENDENCIES_NOT_SATISFIED", "SAFE_COMMIT_BACKSTOP", "SAFE_COMMIT_DESTINATION_NOT_FOUND", "SAFE_COMMIT_DESTINATION_REF_SHAPE", "SAFE_COMMIT_EMPTY_CHANGESET", "SAFE_COMMIT_GENERIC", "SAFE_COMMIT_HEAD_MISMATCH", "SAFE_COMMIT_NOT_A_WORKTREE", "SAFE_COMMIT_PROTECTED_BRANCH", "SAFE_COMMIT_PATH_POLICY", "SAFE_COMMIT_RECOVERY_FAILED"], "forbidden_error_codes": ["FEATURE_NOT_FOUND", "FEATURE_NOT_READY"], "forbidden_payload_fields": ["feature_slug"], "required_payload_fields": ["mission_slug"], "allowed_cli_flags": ["--mission"], "forbidden_cli_flags": ["--feature"] } }