chmod 444 Failed to Stop AI Agents Editing Rule Files; Immutable Flags Worked But Broke Git
A developer tested whether making AI agent rule files such as AGENTS.md and CLAUDE.md read-only would prevent coding agents from altering them. On macOS, chmod 444 blocked only 3 of 8 mutation commands, because POSIX directory write permissions let tools replace files via rename or temporary-file writes. Setting macOS immutable flags with chflags uchg blocked all 8 paths, but it broke git merge and caused git checkout to exit successfully while leaving the working tree dirty. The findings were benchmarked on macOS 26.2 with Git 2.50.1 in an isolated local repository.
This is an AI-generated summary. ShortSingh links to the original source for the complete article.
Discussion (0)
Log in to join the discussion and vote.
Log in