Quality and review
Valid YAML does not guarantee good language teaching. OpenL2 separates quality into four layers so structural bugs are caught immediately and pedagogical judgment is tracked explicitly.
The four quality layers
Section titled “The four quality layers”| Layer | What it checks | How it runs |
|---|---|---|
| Authoring validation | Valid fields, identities, references, and ownership. | Automatically before MCP edits are saved. |
| Source validation | File layout, prerequisite/introduction order, annotations, and cross-level consistency. | CLI: openl2 validate <path> · MCP: check_course_health |
| Publication readiness | Completeness checks (every Task target has a teaching Lesson; exercises are present when exercise_source: course). |
CLI: openl2 jetway publish · MCP: check_course_health |
| Semantic audit | Pedagogical quality: dialogue naturalness, explanation clarity, level fit, and transfer readiness. | CLI: prepare packets (openl2 audit) · MCP: prepare_audit_checks + submit_audit_results |
CLI validation
Section titled “CLI validation”# Validate an entire courseopenl2 validate courses/cefr/en
# Validate only task files in one levelopenl2 validate courses/cefr/en/a1 --only tasksSemantic audits (CLI vs. MCP)
Section titled “Semantic audits (CLI vs. MCP)”Canonical audit rules live in src/openl2/courses/course_rulebook/, with language-specific conventions in src/openl2/courses/concept_authoring_rules/. Audits are versioned independently per scope (concept, skill, concept_set, skill_cluster, exercise, lesson, task, task_material, level, course).
- From the CLI (read-only preview): Prepare audit packets without running a model or saving judgments:
Terminal window openl2 audit courses/cefr/en/a1 task --scope focus - From an AI agent (MCP — full review loop):
- Call
prepare_audit_checksto fetch material, applicable rules,check_id, andrevision. - Call
submit_audit_resultsto record findings (an empty findings list records a clean review). - Any subsequent edit to a Concept, Lesson, or Exercise automatically marks only the affected checks stale.
- Call
Reviewed annotation matches (MCP)
Section titled “Reviewed annotation matches (MCP)”When task-text-partially-annotated flags a surface match against an inventory Concept:
- If the text genuinely uses that Concept, annotate it.
- Otherwise, use MCP
list_annotation_matchesandapply_annotation_match_exclusionto record a reviewed exclusion:different_sense: this occurrence has a different meaning than the candidate Concept.incidental_surface_match: accidental substring inside a name or unrelated expression.
Exclusions are tied to the sentence context and Concept revision, so rewriting the sentence automatically invalidates stale exclusions.
Passage analysis & level estimation (CLI)
Section titled “Passage analysis & level estimation (CLI)”Install the optional analysis extra first:
python -m pip install -e ".[analysis]"Then analyze external texts or estimate their level against a course inventory:
openl2 analyze-text courses/cefr/de/a1 "Ich möchte einen Kaffee, bitte." --html report.htmlopenl2 analyze-passages courses/cefr/de/a1 passages.txt --html corpus.htmlopenl2 estimate-level --helpUse analyze-passages --analysis-jsonl <path> to supply reviewed token metadata for exact sentences. The file contains one LinguisticAnalysis JSON object per line. An explicit --analyzer stanza runs Stanza for sentences without an override and skips saved course predictions. Run once without overrides to evaluate the parser itself.
The passage report tracks tokens covered only by an identified grammatical form as grammar_only_token_count. These tokens do not add lexical Concept matches. Course preparation is reported at the requested level from scheduled material. estimate-level reports an unsupported status for languages without bundled CEFR weights and still returns descriptive features.