{
  id          = "0005",
  slug        = "mode-step-schema",
  description = "All reflection mode steps have actor, on_error, and depends_on fields",
  check       = {
    tag         = "NuCmd",
    cmd         = "let modes_dir = $\"($env.ONTOREF_PROJECT_ROOT)/reflection/modes\"; if not ($modes_dir | path exists) { exit 0 }; let files = (glob $\"($modes_dir)/*.ncl\"); if ($files | is-empty) { exit 0 }; let ip = $env.NICKEL_IMPORT_PATH; let all_ok = ($files | all { |f| let r = (do { ^nickel export --format json --import-path $ip $f } | complete); if $r.exit_code != 0 { false } else { let m = ($r.stdout | from json); let steps = ($m.steps? | default []); ($steps | all { |s| ($s.actor? | is-not-empty) and ($s.on_error? | is-not-empty) }) } }); if $all_ok { exit 0 } else { exit 1 }",
    expect_exit = 0,
  },
  instructions = "
For each file in reflection/modes/*.ncl, ensure every step has:

  {
    id         = \"step-id\",
    action     = \"What this step does.\",
    actor      = 'Agent,   # 'Human | 'Agent | 'Both
    on_error   = 'Stop,    # 'Stop | 'Continue | 'Retry
    depends_on = [],       # [] or [{ step = \"id\", kind = 'OnSuccess }]
  }

actor decision:
  agent runs it autonomously (build, write, export) -> 'Agent
  human must do it (review, approve, deploy)        -> 'Human
  either depending on context                       -> 'Both

on_error decision:
  failure blocks subsequent steps  -> 'Stop
  failure is non-blocking          -> 'Continue
  transient, should retry          -> 'Retry

Validate each mode exports cleanly:
  nickel export --import-path \"$NICKEL_IMPORT_PATH\" reflection/modes/*.ncl > /dev/null

Verify graphs:
  ONTOREF_ACTOR=agent ontoref graph <mode-id>
",
}
