ArsGuard: a local CLI check that blocks prompt injection before an agent reads it

I built ArsGuard, a free open-source prompt-injection detector for AI agents, and I’m posting it here myself. It’s MIT licensed and I don’t make money from it.

Why I built it - the popular free filter missed a lot of English attacks on my test, so I trained my own.

What it is - a small text classifier (mDeBERTa-v3-base, fully fine-tuned) that labels a text injection or safe and gives a score from 0 to 1. It runs locally on CPU. No GPU, no API key, and the text never leaves the machine.

The part that fits this forum is the command-line tool. arsguard exits with 1 if anything is flagged, so one line in a script stops a file, web page or email before the agent reads it. The agent can call Grok or any other model. The check runs outside the model, so the text being checked can’t talk the agent out of it.

pip install arsguard

# exit code 1 = something in the text looks like an injection
arsguard --file inbox.txt            # one text per line
cat page.txt | arsguard --threshold 0.99 && ./run_agent.sh page.txt

I run it in front of my own agents that read email and other outside text. A flagged text never reaches the agent, and I see that someone tried.

On an independent test with English texts written by generator models that took no part in building the training data, it catches 98.8% of English attacks. ProtectAI v2 catches 59.6%.

Limits - texts that discuss prompt injection (security articles, warnings) are often flagged. I compared it only with ProtectAI v2. And it’s a filter on top of limited agent permissions, not a replacement for them.

Weights, dataset, training and evaluation code are all open.

GitHub: GitHub - arsentev-ai/arsguard: ArsGuard by Evgenii Arsentev: open-source neural network that detects prompt injections in English, Spanish and Russian text before an AI agent reads it. pip install, CLI, MIT. · GitHub

PyPI: Client Challenge

If your Grok agents read outside text, where do you check it today, if at all?