Skip to main content
opentrain lms retraining is the case-orchestration layer for individualized quality remediation. Course authoring, Native Forms, Preview, publishing, grading, result release, and RETURN remain in their existing LMS and Project To-do commands.
Individualized retraining requires @opentrain-ai/cli 0.9.0 or newer. Hosted visual proof requires CLI 0.17.0 or newer. Canonical authoring intent and the no-write retraining scaffold require CLI 0.21.0 or newer.
Install the latest CLI and verify the active token has lms:read and lms:write:

Discover the live LMS contract

Start every agent run with:
Inspect the root response’s agentSurfaces LMS family status and each operation’s authorized value. Then read the LMS response’s retraining, assessments, course, lessonContent, assets, preview, and mastery sections before generating content or mutations. Do not hard-code question types, limits, or retry rules from an older run. If either capability command reports disabled, rollout_gated, or unauthorized, stop and return that structured result.

Update an already assigned module

Publishing a corrected course version does not silently rewrite active learner assignments. If the retraining module is already assigned, follow publish with the canonical rollout preview/apply/status workflow. It carries compatible progress, protects submitted attempt rules, and queues learners who are inside an unsafe assessment boundary. Do not cancel and recreate the Project To-do. See Update an assigned LMS course for the exact CLI sequence and safety model.

Use JSON as the agent protocol

Use --json for automation. The CLI writes exactly one JSON document to stdout and does not prompt. A failure exits nonzero with this shape:
Branch on error.code, error.status, and structured error.details, not the message. Reuse the same --key after a transport failure; do not generate a new key for the retry.

Register a published skill-gap module

Create a draft case

Prefer a stable contract ID:
Use --worker-name only when you do not have a contract ID. It must resolve to exactly one active contract. For a wall-clock deadline, replace the offset with all three flags:
For evidence arrays, Instructions references, and an authoring brief, pass the complete typed request through --body-json-file. Do not mix it with field flags.

Generate the no-write authoring scaffold

After capturing the case, ask OpenTrain for the deterministic build packet:
The scaffold performs no writes. It returns the masked recipient, approved grounding, lesson outline, assessment constraints, canonical authoringIntent, and ordered requests for the existing course, Native Forms, validation, Preview, publish, module-registration, and assignment operations. For MASTERY, the intent is INDIVIDUAL_MASTERY + SYSTEM, the module must contain at least one required auto-graded question, and manual questions are not allowed. For EMPLOYER_REVIEW, the intent is STANDARD + EMPLOYER_REVIEW. Copy the returned authoringIntent into course.yaml or the draft tree before authoring. OpenTrain preserves it through checkout, diff, push, publish, and Preview. A request that combines INDIVIDUAL_MASTERY with EMPLOYER_REVIEW fails with AUTHORING_CONTRADICTION; do not downgrade or retry around that error.

Update a draft case

Only a DRAFT case can be edited. Read the latest case revision, then apply one revision-fenced patch:
Use --patch-json for a small inline patch. When switching the due-date channel, clear the old channel and set the new one in the same patch so the case still has exactly one due rule.

Preview and plan

Use the existing opentrain lms preview … commands to test the worker renderer without creating an assignment. For agent-verifiable visual proof, first select the exact lesson and then use the hosted renderer. No local browser or development server is required:
The command downloads checksum-verified PNG, ARIA, diagnostics, and manifest artifacts. The target flags assert the session’s current focus; they do not navigate. Run opentrain lms preview select first when the target differs. Test one supported interaction through the closed action grammar:
step supports open_lesson and complete_content. It never accepts raw selectors, scripts, URLs, or coordinates. When a human should inspect the same session, mint an observe-only link:
The URL is returned once and requires a signed-in employer organization member. Opening it never changes Preview state. Revoke it with opentrain lms preview links revoke after review. Then generate the assignment plan:
Planning performs no writes. An authorized employer must review and explicitly approve the exact masked worker, contract ID, immutable course version, module, content hash, frozen due instant, eligibility, effect counts, request hash, and receipt expiry.

Confirm the assignment

--confirm-assign records the employer-approved mutation; it does not let an agent approve its own plan. The write creates exactly one canonical Project To-do assignment. If the receipt is stale or expired, run plan again and obtain approval for the new result.

Monitor and close

--all follows bounded cursor pages. Before reporting a complete audit, confirm the returned collection is complete; otherwise persist its resume cursor and continue. Use existing LMS status, run-history, employer-review, grading, result-release, and Project To-do RETURN commands for the live assignment. Close the case only when its requested outcome agrees with that canonical assignment:
Run opentrain lms retraining <command> --help for action-specific flags and safety rules. See Manage individualized retraining with an agent for the complete authoring, Preview, approval, assignment, grading, and retry sequence.