An approach that's worked fairly well is asking Codex to summarize mistakes made in a session use the lessons learned to modify the AGENTS.md file for future agents to avoid similar errors. It also helps to audit the AGENTS.md file every once in a while to clean up/compact instructions