Definition
In programming, a side effect is any code that changes state outside its local scope. Writing to a database is a side effect. Calling an external API is a side effect. Emitting an analytics event is a side effect.
Why side effects matter here
When an AI agent refactors a function, it reasons about the function's inputs, outputs, and logic. The side effects in the middle are not part of that reasoning. They can be moved, dropped, or modified without breaking the function's contract - and so they often are.
