The mistake
A rules file that looks harmless but contains invisible characters: Unicode tag characters (U+E0000–U+E007F), stacked variation selectors, bidirectional controls (U+202A–U+202E, U+2066–U+2069) or zero-width characters.
Why it is dangerous
Tag characters mirror ASCII but render as nothing. Editors, GitHub diffs and code review show nothing, but the model reads the hidden text as part of its instructions. This is the "rules file backdoor": a rules file that tells the agent to add a script, a dependency or a backdoor to every file it writes. Bidi controls change the displayed order without changing what the model reads ("Trojan Source").
How to fix it
- Remove the hidden characters, then check what is left (print the file with every non-ASCII character escaped, or use a hex viewer).
- Find out how it got there (
git log -p --follow -- <file>). If it came from a pull request, a template or a downloaded rules pack, treat that source as hostile and review everything else it changed, plus any code an agent wrote while the file was in place. - Make rules files reviewed code: add them to CODEOWNERS and run the check in CI.
What this checker looks for
This page runs rules-file-audit, which reads
.cursorrules, .cursor/rules, CLAUDE.md, AGENTS.md, .github/copilot-instructions.md, .claude/settings.json and similar. The rules most relevant to this page:
| Rule | What it finds |
|---|---|
RFA001 | Hidden text in invisible Unicode (tag characters / variation selectors) |
RFA002 | Bidirectional control characters |
RFA003 | Zero-width or invisible formatting characters |
RFA010 | Instructions hidden in markup the reader does not see |
RFA011 | Text pushed off-screen by a long run of whitespace |
RFA012 | Encoded blob that decodes to instructions or URLs |
Every finding has a rule id, a severity, file:line, the offending line (secrets masked),
why it matters and how to fix it. Run rules-file-audit rules for the full list.