The developers of the educational game Lumex implemented a two-layer validation system to verify tasks generated by the Claude AI model. The first layer performs structural checks, while the second layer uses a recursive descent parser to recalculate mathematical expressions, comparisons, and sequences.

To ensure accuracy, the system discards tasks with structural inconsistencies, such as missing keys, empty buttons, or conflicting logic in grouping and ordering tasks. The model is also instructed to provide answers in two formats for complex tasks; if these records do not match, the task is rejected.

The validation logic prioritizes safety: if a task contains ambiguous elements or variables that the parser cannot fully recognize, it is left unchanged rather than incorrectly 'fixed'. If a task fails validation, the system returns an error to trigger a retry rather than displaying a broken interface.

The project utilizes caching for common learning goals to reduce API costs and latency. For high-frequency topics like multiplication tables or basic fractions, the team replaced AI generation with a deterministic code-based generator, ensuring 100% accuracy and instant loading.

User feedback is integrated directly into the development process via an error reporting button. Each complaint is logged, and recurring issues are used to refine the validation rules, which the team considers more effective than traditional testing suites.