Skip to content

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.

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
Terminal window
# Validate an entire course
openl2 validate courses/cefr/en
# Validate only task files in one level
openl2 validate courses/cefr/en/a1 --only tasks

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):
    1. Call prepare_audit_checks to fetch material, applicable rules, check_id, and revision.
    2. Call submit_audit_results to record findings (an empty findings list records a clean review).
    3. Any subsequent edit to a Concept, Lesson, or Exercise automatically marks only the affected checks stale.

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_matches and apply_annotation_match_exclusion to 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.

Install the optional analysis extra first:

Terminal window
python -m pip install -e ".[analysis]"

Then analyze external texts or estimate their level against a course inventory:

Terminal window
openl2 analyze-text courses/cefr/de/a1 "Ich möchte einen Kaffee, bitte." --html report.html
openl2 analyze-passages courses/cefr/de/a1 passages.txt --html corpus.html
openl2 estimate-level --help

Use 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.