When you say Sonnet 4, do you mean literally 4, or 4.6?
You may want to look at the AGENTS.md file too so you can include your stock style things if it’s repeatedly screwing up in the same way.
The Pi framework is probably right up your alley btw! Very extensible