Hi Fred, Your observations are entirely valid. Most of the recurring errors you see aren't due to the AI being "bad," but rather to the lack of a stable working structure. When working with Pascal, Lazarus, or UOS, the model needs some guidance to behave consistently.
To avoid the typical repetition of syntax errors, logic errors, or inconsistent code, everything is greatly simplified by establishing two essential elements: clear instructions and a suitable context file.
1. INSTRUCTIONS / RULES (what you tell the AI before programming)
These are simple rules you provide to the model at the beginning of each session:
This is just a very basic example:
Generate modular and reusable code.
Use the Gettext translation format for strings: _('text')
Keep explanations brief; prioritize code.
If you need to make any significant changes to the architecture, let me know first.
Consistently maintain the same coding style throughout the project.
Don't invent functions or units; Ask questions before making assumptions.Why it's important: Without these rules, the model improvises, changes style, and repeats the same Pascal mistakes you mentioned. With them, it becomes much more stable and predictable.
2.
PROJECT CONTEXT FILE (the external memory the AI needs)
This is a simple .md file that you should save and use every time you start a new session. It acts as the project's "memory." You can ask the model to update it after each session or work section.
What the file should include:
A brief project summary
Overview of the architecture
List of units and their function
Dependencies
Coding conventions (such as the Gettext rule)
Folder structure
Some examples of correct code
Any special constraints or patterns you want to apply
Why it's essential:
Models don't remember previous sessions.If you don't provide them with this file, they lose the big picture and start generating inconsistent code, repeating mistakes. With the context file, even large projects with many units remain consistent.
I have absolutely nothing against AI, quite the contrary, but they should learn their lessons better.
All of them (Claude, Gemini, Chatgpt, Grok, etc.) make glaring syntax errors in Pascal. And when I ask them to create a program that plays MP3s using UOS, they produce an unusable program, full of syntax mistakes. And even though I show them the errors (which they correct with profuse apologies), by the next session they've forgotten everything and make the same mistakes again.