Coach Mission & Grading JSON

Author a flyable, graded mission without touching Swift

This is the real, implemented wire format Coach uses to load a mission script, its grading, and its objectives checklist from a JSON file — downloadable to the app with no update, by a human or an AI model. Every kind documented here is read directly off the current importer (ScriptImport.swift/ScriptImport+Grading.swift/ScriptImport+Objectives.swift in coach-ios) — if this page and the importer ever disagree, the importer is correct and this page has a bug. See Maintaining this spec for how to keep them in sync.

Start here if you're new: read "Anatomy of a mission file" below, then open the worked example — a complete, real, zero-warnings-on-import mission (Multi-Engine Essentials' "Practicing Takeoffs") annotated against every page in this reference.

Anatomy of a mission file

One mission is one JSON file matching ScriptImport.File. triggers is required; grading and objectives are both optional and independent of each other — a file with triggers only is a flyable, ungraded mission.

{
  "schema_version": 1,
  "airport": "KVCB",
  "generated_by": "free text, optional — who/what authored this",
  "notes": "free text, optional",

  "triggers": [ /* required — array of Trigger, see conditions.html / actions.html */ ],
  "grading": { "rules": [ /* optional — array of Rule, see grading.html */ ] },
  "objectives": [ /* optional — array of Objective, see grading.html#objectives */ ]
}

One trigger

{
  "id": "t_fail_1",
  "name": "Scenario 1 -- rejected takeoff",
  "condition": { "kind": "crosses_speed", "knots": 40, "accelerating": true },
  "action": { "kind": "failure", "failure_type": "full", "engine_selection": "random", "probability": 1.0 },

  "reminder": { "interval_seconds": 20, "first_text": "...", "repeating_text": "..." },
  "audio_clip_id": "optional-explicit-pre-recorded-clip-id"
}
fieldrequiredmeaning
idrequireda short, author-chosen string, unique in this file. Resolved to a real UUID at import time — referenced by after_trigger_id, not_before_trigger_id, rearm_trigger_ids, and grading's own trigger_id fields.
nameoptional, default ""the trigger's display name in the app's cue card / debrief UI. Also what objectives[].for_trigger matches against (by name, not id).
conditionrequiredone Condition object.
actionrequiredone Action object.
reminderoptionala repeating spoken nag while this trigger is still waiting — interval_seconds, first_text, repeating_text, all required together. Never recorded as a fired trigger, never touches grading.
audio_clip_idoptionalan explicit pre-recorded clip id this trigger's spoken line should play, bypassing the per-lesson recorded-voice catalog lookup entirely.

A dropped trigger silently breaks everything chained after it. The importer fails soft — an unresolvable condition/action (unknown kind, missing required field, a vspeed_ref not set on the pilot's aircraft profile, a reference to an id that doesn't exist) drops that one trigger with a warning rather than crashing the whole file. But anything else that chains off that trigger's id via after_trigger_id/not_before_trigger_id/rearm_trigger_ids will never fire either. Always check import warnings, not just that the file parsed.

IDs, names & references

Three different reference styles exist in this format, deliberately — know which one each field uses:

Vspeed-relative thresholds

Any condition field expecting a literal speed in knots can instead be given relative to the pilot's own aircraft profile, resolved at import time:

{ "kind": "crosses_speed", "vspeed_ref": "vr", "vspeed_offset_kts": 1, "accelerating": true }

vspeed_ref is a key into AircraftProfile.value(for:) — vr, vmc, vyse, vs0, vs1, vsse, vxse, vle, vlo, vlr, vfe, vne, va, vref. vspeed_offset_kts (default 0) adds to the resolved value before comparing — "Vr + 1 kt," "Vmc exactly." A referenced V-speed the pilot's current profile has left unset is a hard import warning and the whole trigger is dropped — never a silent fallback to 0.