Own the end-to-end trainer loop contract for a prompt-like file, skill contract, or agent contract after the caller has already chosen the concrete stage capabilities. Use this whenever the current agent must set up the local trainer workspace, coordinate stage sequencing, maintain workflow state, manage steering and candidates, recover from manual follow-up mode, and decide whether a trained candidate is safe to write back.
Use this skill as the orchestration contract for one trainer run against one selected target. Treat the concrete research, synthesis, optimization, and election capabilities as caller-supplied stage implementations. This skill owns the loop behavior, workspace state, steering, validation, and write-back rules around those stages.
references/workspace-contract.md, references/stage-orchestration.md, and references/collaboration-contract.md before broad changes or stage execution.Use it when the current agent needs to:
.trainer-workspace/ for that targetDo not use this skill for isolated research, isolated dataset authoring, single-shot optimization without workspace coordination, or standalone winner selection with no loop orchestration around it.
Stop and report a clear blocker before attempting any optimization, rewrite, or stage execution when:
workflow-status.json is in training state from a prior session (resume instead of re-initializing)Prefer a justified blocker or no-op report over any speculative rewrite. A blocker report must name the missing artifact, explain why the loop cannot advance without it, and leave workflow-status.json in a resumable checkpoint state. Do not describe the loop as complete when a blocker is active.
Follow this order. At each step, read the relevant reference file if the correct path, scoring mode, or artifact name is uncertain.
workflow-status.json. If workflow_state is training, treat this as a resumption: read required_artifacts.latest_iteration_dir, audit which stages already produced artifacts in that iteration directory, and skip completed stages. Do not create a new iteration directory for a resumed run.engineer-prompt/review.md exists. If it is absent, apply the blocker-first rule and stop.workflow-status.json.iterations/iteration-N/optimize/.mode=manual_followup, follow the manual follow-up branch (see below) rather than stopping. Continue the loop after the branch completes.workflow-status.json and required-artifact pointers as checkpoint data that must reflect actual file existence, not intended paths.references/workspace-contract.md when artifact paths, directory names, or workflow-status.json field names are in doubt.Infer the scoring mode from representative dataset rows before passing it to the optimization stage. Use exactly one of these three modes:
expected field and the task genuinely has one correct answer with no normalization or partial-credit logic needed. Use only when this is truly the case.expected_json, row-level scoring fields such as normalized_match or json_schema, or custom_python functions. Use this mode when outputs must be parsed or normalized before comparison.reference answer plus criteria fields, or explicitly declare scoring: "llm_judge". Use this mode when grading depends on subjective quality or multi-criterion judgment.When a row declares scoring, treat that as authoritative. Only infer from fields such as expected, expected_json, reference, or criteria when scoring is absent. If train and validation rows imply different scoring modes, stop and report dataset inconsistency instead of guessing. Do not collapse richer scoring cases into exact-match. Pass the inferred mode explicitly to the optimization stage.
When optimization returns mode=manual_followup:
manual-followup-report.json under iterations/iteration-N/optimize/.optimized-prompt.md under the same optimize directory.operator-followup.md with the blocker reason, handoff summary, and the optional rerun command.optimized-prompt.md as the optimize-stage candidate for the rest of the workflow.Treat manual follow-up mode as a supported branch, not an optimization failure.
Read references/collaboration-contract.md when agent ownership boundaries or candidate bundle structure is uncertain.
Return: