The way the current chat feature is structure will always break prompt caching. It inject all context at the top system message.
This could be drastically improved by only injecting the pinned context at the top and adding the keyword codex content alongside the messages that triggered them. This way as a chat continue more and more will be cached reducing inference costs for the user.