CODESYS AI Practice — Import/Export Files
In CODESYS v3, code lives inside the project — a binary file. AI cannot open or edit it. In the AI era we need a way for AI to operate on the files inside the project. Goal Close the loop: project ⇄ text ⇄ A
In CODESYS v3, code lives inside the project — a binary file. AI cannot open or edit it.
In the AI era we need a way for AI to operate on the files inside the project.
Goal
Close the loop: project ⇄ text ⇄ AI.
Export POUs to text, let the AI edit them, import them back into the project.
Constraints
- CODESYS must stay the source of truth for the project structure
- Import must not corrupt an existing project
- Prefer a small, scriptable tool over a heavy IDE plugin
Approach
- Export selected POUs (declaration + implementation) to plain text files
- Edit the text (AI or human)
- Import: backup, compare, write back, save
Creating or deleting POUs is not supported in this pass — only updating existing ones.
Import pipeline
Import does four things before touching the live project:
- Backup — snapshot first
- Compare — diff bodies
- Write back — set POU code
- Save — persist the project
Notes
- Update only: creating or deleting POUs is not supported in this version
- Declarations and implementations are paired per POU
- After import, rebuild in CODESYS to verify
Repository and tooling details follow the same codesys-sync / codesys-connect series used elsewhere on this blog.
Originally published by Dev.to AI. Aggregated on AIWithGhost for educational purposes — full credit and traffic to the original publisher.

