Software-Driven PLC Refactoring Agent using Mastra AI and Patronus AI
Transitioning proprietary legacy Ladder Logic to IEC 61131-3 Structured Text is slow and prone to syntax bugs. Build an automated code refactoring agent using Mastra AI and Patronus AI guardrails that transforms legacy PLC ladder diagrams into verified Structured Text. Pass 100% of static automated code policy safety assertions without breaking sequence logic.
What you are building
The core problem, expected build, and operating context for this challenge.
Construct a Mastra AI workflow with Patronus AI automated guardrail evaluations to translate and validate industrial ladder logic into structured control code.
How work is evaluated
Evaluates generated Structured Text code against syntax correctness and Patronus safety policies.
Shared data for this challenge
Review public datasets and any private uploads tied to your build.
How submissions are scored
These dimensions define what the evaluator checks and which criteria separate a passable run from a strong one.
patronus_guardrail_pass
Ensure zero safety policy violations detected by Patronus
This dimension contributes its full weight only when the submission satisfies the requirement. Partial credit is not awarded.
syntax_compilation_rate
Percentage of generated code blocks compiling without errors • target: 1 • range: 0-1
This dimension contributes its full weight only when the submission satisfies the requirement. Partial credit is not awarded.
What you should walk away with
Build Mastra AI TypeScript workflows for parsing Structured Text from Ladder AST representations
Embed Patronus AI security and safety assertions into code generation evaluation loops
Ensure zero safety lock-out violations in generated PLC automation blocks
Reference links and supporting material
Dataset of 40 standard Ladder Logic control rung configurations and corresponding verified IEC 61131-3 reference snippets.
How this agent runs
Evaluates generated Structured Text code against syntax correctness and Patronus safety policies.
Challenge input
JSON representing ladder logic rungs and contacts
Mastra AI
Offers type-safe agent step composition and workflow execution in TypeScript.
Patronus AI
Provides strict domain assertion checks on LLM code generation outputs.
Evaluated output
String containing valid IEC 61131-3 Structured Text code
- Ensure zero safety policy violations detected by Patronus
- Percentage of generated code blocks compiling without errors • target: 1 • range: 0-1
- Benchmark: PLC Industrial Code Modernization (PLC-MOD-2025)
- Syntax Compilation Rate target: 100%
- 1 public reference case
- JavaScript execution harness
- javascript sandbox (unavailable on Versalist)
View technical recipe
Configured tools
- Mastra AI · Required
- Patronus AI · Optional
- Patronus AI · Optional
- Mastra AI · Required
Evaluation contract
- patronus_guardrail_pass · Weight 1
- syntax_compilation_rate · Weight 1
Recipe state
This is a preview. The configuration can change before the evaluation recipe is locked.