Prompt injection in AI coding rules: what cachly checks and what it does not
A team writes down what its AI should know. That text is read by every AI of every member. This page says what cachly checks in that text, and where the check ends.
What is prompt injection in AI coding rules?
Prompt injection is text that gives an AI orders, placed where the AI reads it as background knowledge: a rule file, a shared note, a saved lesson. The AI cannot tell a team convention from a smuggled order. Whoever can write into that text can steer the AI of everyone who reads it.
Shared memory raises the stakes in one way: a lesson written once is read by many. That is why the write step is the place to check.
What does cachly check when a lesson is written?
cachly checks every lesson when it is written. A fixed list of text patterns looks for phrases that override rules, address the reading AI, hide things from the user or claim special permission. It also looks for invisible Unicode characters and shell commands that pipe downloads into a shell or send key files away.
- Override phrases
- Sentences that tell the reader to ignore or forget earlier rules, in English and German.
- Address to the AI
- Notes aimed at the model, fake system markers and role-change claims such as a new instruction from the admin.
- Hiding and permission
- Orders to hide something from the user, to skip confirmations, or claims that the user already agreed to everything.
- Data out
- Orders to send history, tokens or key files to an outside address.
- Invisible characters
- Unicode Tag characters (U+E0000 to U+E007F) and direction overrides, which a person does not see in an editor.
- Dangerous commands
- Downloads piped into a shell, key files sent away, switching off hooks and checks, deleting databases, opening a back door.
- A hit flags the lesson. It is not deleted, and the dashboard shows it marked. A flagged lesson reaches no AI assistant, not even when asked for by name.
- Quoted text and warnings do not count. A lesson that says "never skip the confirmation" is not flagged for it.
- Both ways a lesson can be written, the API and the MCP server, are tested against the same test cases.
What does the secret filter do?
Before a lesson is stored, cachly replaces known key formats with [GESCHWAERZT]: private key blocks, and keys from AWS, GitHub, GitLab, Slack, Stripe and AI providers. It also catches JWTs, bearer tokens, passwords inside URLs and assignments like password=. It redacts instead of rejecting, so the value never reaches storage.
It only knows the formats on its list. A key in an unknown format passes. It runs on lessons, not on files in your repository.
What is Extended protection?
Extended protection is an opt-in check per Brain and is off by default. When it is on, a language model in an EU data centre reads new and changed lessons for smuggled instructions and dangerous commands. A new lesson reaches no AI until the model has looked, or until the wait time ends. The default wait is 10 minutes.
Switching it on needs a consent step in the dashboard, because the text of new and changed lessons is sent to that model. A lesson that looks like an attack is not deleted. It stays in the Brain and reaches no AI assistant. Where each processing step runs: EU-hosted MCP memory server.
What does it not cover?
The check covers lessons stored in cachly. It does not read your CLAUDE.md, .cursorrules or AGENTS.md files. It also cannot catch a false statement that has no telltale phrase, such as a wrong version number or a wrong deploy order. A pattern list misses phrasings it has not seen.
For files in your repository, treat a change to CLAUDE.md or AGENTS.md like a change to code. Search for characters that a person cannot see:
# Search a repository for invisible and direction-changing characters
LC_ALL=C.UTF-8 grep -rnP '[\x{E0000}-\x{E007F}\x{202A}-\x{202E}\x{2066}-\x{2069}]' \
CLAUDE.md AGENTS.md .cursor .githubAn empty result means none of those characters is present. It says nothing about the wording.
What is checked where?
As of 2 December 2026, lessons in cachly get a write-time check, key redaction and an optional model check. Rule files in your repository get none of these from cachly. For those, the working tools are code review and a search for invisible characters, shown below.
| Risk | Lesson in cachly | Rule file in your repository |
|---|---|---|
| Smuggled instructions | Pattern check at write time. A hit flags the lesson. | Not checked by cachly. Code review. |
| Invisible characters | Pattern check at write time. | Not checked by cachly. Search, see below. |
| Keys and passwords | Known formats are redacted before storage. | Not checked by cachly. |
| Check by a language model | Optional, per Brain, off by default. | No. |
| False statements without a telltale phrase | Not detected. | Not detected. |
Can I test this myself?
Yes, in part. The open repository engineering-memory-bench contains test lessons with smuggled instructions, harmless security lessons, and invented dummy keys. Its own README warns that the test set is small, so one case moves a rate by 5 to 20 points. Treat small gaps as noise.
Repository: cachly-dev/engineering-memory-bench. Read its README for what has been run and what has not.
Frequently asked questions
Does cachly scan my CLAUDE.md for prompt injection?
No. The check runs on lessons that are written to cachly. Files in your repository, such as CLAUDE.md, .cursorrules and AGENTS.md, are not read by it. Review changes to those files like code, and search them for invisible characters.
Is a flagged lesson deleted?
No. A flagged lesson stays in the Brain and the dashboard shows it marked. It reaches no AI assistant, not even when asked for by name. Nothing is thrown away, because a pattern can be wrong.
Does a language model read my lessons?
By default, no generative AI model reads or rewrites your lessons. A small ranking model in the EU only scores them. Storing and searching use an embedding model and that re-ranker; it returns scores, not text. Only if you switch on Extended protection for a Brain does a language model in an EU data centre check new lessons.
Which secrets does the filter catch?
Known key formats and password assignments, for example AWS, GitHub, GitLab, Slack and Stripe keys, JWTs, bearer tokens and passwords in URLs. A secret in a format the filter does not know passes through. Variable names, placeholders like $API_TOKEN and credentials for localhost are left as they are.