I recommend mirroring the file restrictions you describe with chown+chmod, and then instead of telling the bot what not to do, tell it only what to do. When then it goes outside of the constraints it will also not change these files, because it can't.
There are multiple theories on why a bot should not get negatively reinforced, and I haven't seen an agreeable universal explanation yet, but regardless of why, it seems to work.
I recommend mirroring the file restrictions you describe with chown+chmod, and then instead of telling the bot what not to do, tell it only what to do. When then it goes outside of the constraints it will also not change these files, because it can't.