My experience is in doing this with Claude/Codex/OpenCode with a pretty rigorous setup (AGENTS.md/CLAUDE.md for specific subfolder rules, strict compile/test/lint rules. This isn't me copy-pasting from web chat.
I've been building a general linter tool to help keep repos in a consistent and clean shape when working with AI [0]. You can define repo and file layout, structure, hygiene rules and have them checked in pre-commit, in ci, or manually. It also integrates and plays well with AGENTS.md - allowing exporting agent instructions from the alint rule config [1].
[0] https://github.com/asamarts/alint
[1] https://alint.org/agent-friendly-linter/