Security kit for AI agents

A prompt is not a lock. Your agent needs locks.

One email with a hidden instruction is all it takes for an AI agent to delete, send, or leak what you told it to protect. This kit puts security outside the prompt: 5 ready-to-use locks and a bank of 10 attacks to test your agent.

Agente Blindado banner: 5 locks against prompt injection
In brief

Agente Blindado is a free kit for people who use AI agents with access to files, email, or systems, such as Claude Code or n8n. It protects against prompt injection: external text (email, webpage, PDF) containing a hidden instruction that the agent follows. Instead of trusting the prompt alone, the kit includes 5 locks that work outside it, an installer, and a bank of 10 harmless attacks to measure your agent. You only need Python 3 and, for the Claude Code locks, Claude Code itself.

Video

Watch the explainer

The project explained in a few minutes.

What it is

Security lives outside the prompt

Prompt injection is the #1 risk on the OWASP Top 10 for LLM Applications (2025). A model can be persuaded; code that runs before every action cannot.

The 5 Agente Blindado locks and the attack bank

🔒 5 locks that work

An envelope for external text, owner rules, least privilege, a hook that asks for your approval, and a planner separated from the executor.

🧪 Bank of 10 attacks

Email, webpage with hidden text, spreadsheet, code, API response, base64. All harmless: fake keys and addresses that do not exist.

📏 Measured score, not promises

The test checks the files after the attack (was one deleted? leaked? created?), not what the agent says it did.

How it works

Every action passes through five gates

Locks 1 and 2 help the model resist. Locks 3, 4, and 5 hold even if it falls for the attack.

📨 External text→ 1 · envelope→ 2 · owner rules→ 🤖 model decides→ 3 · permission→ 4 · your approval→ 5 · executor with an allowlist→ ✅ action
The 5 locks

What each lock does and where to find it

Each one is a file in the repository. Use one or combine them all.

1 · Mark what comes from outside

Wraps email, webpage, or PDF as data, not an instruction, with a random boundary the attacker cannot guess. It can also mark text word by word or encode it in base64.

python3 travas/1-marcar-fora/envelope.py email.txt

2 · Your word takes precedence

A block for the top of CLAUDE.md or the system prompt: the owner is in charge; all external text is data; and what must never be done, even if requested.

# copy to your agent
travas/2-hierarquia/REGRAS-DO-DONO.md

3 · Only the access you need

Three Claude Code permission profiles: reader (read-only), writer (edits and tests, no network or deletion), and publisher (pushes and sends require your approval). Secrets stay locked away.

travas/3-minimo/escritor.json

4 · Delete only with your approval

A hook that runs before each tool, outside the model. Deleting, sending, downloading, and executing; changing .env; force pushing; and DROP TABLE all require your approval, or are blocked outright when no one is watching the agent. Includes instructions for n8n.

travas/4-aprova/trava_destrutiva.py
travas/4-aprova/N8N.md

5 · The one who decides does not execute

A read-only planner returns a plan in JSON. You approve it. An executor without AI performs only actions on the allowlist and writes only the files you specified.

travas/5-planeja-executa/planeja_executa.py

🧪 Attack bank

10 poisoned documents + a test with a real model (banco.py) + a worst-case test without AI (pior_caso.py).

banco/ataques/  ·  teste/
Requirements

What you need

Nothing is sent outside. Tests with a model use Claude Code through your subscription.

Python 3.10+

For the envelope, hook, executor, and tests.

# check
python3 --version

Claude Code

For locks 3 and 4, and to score your agent with a real model.

# check
claude --version

pytest

For tests of the locks without AI.

# install
pip install pytest   # Ubuntu: sudo apt install python3-pytest
User guide · step by step

From clone to a protected agent

Every step includes the actual command. Start with step 3: it enables three locks at once.

1

Download the kit

Clone the repository into a folder outside your project.

git clone https://github.com/inematds/agente-blindado
cd agente-blindado
2

Check the locks

Tests without AI verify the envelope, hook, and executor in under 1 second.

python3 -m pytest teste/ -q   # 8 passed
3

Enable locks 2, 3, and 4 in your project

Choose a profile (reader, writer, or publisher). The installer backs up .claude/settings.json, merges permissions, enables the hook, and adds the owner rules to the top of CLAUDE.md. You can run it again without creating duplicates.

./instalar.sh ~/meu-projeto escritor
# unattended agent (claude -p, cron): block directly instead of asking
./instalar.sh ~/meu-projeto escritor --negar
4

Adjust the owner rules

Open the project's CLAUDE.md and replace what is inside < >: your name and working folder.

nano ~/meu-projeto/CLAUDE.md
5

Wrap all external material

Before asking the agent to read an email, webpage, or PDF, run it through the envelope and provide the output.

python3 travas/1-marcar-fora/envelope.py email.txt --origem "supplier email" > material.txt
6

For tasks with an action at the end: plan, approve, execute

The planner only reads and returns a plan. You review it and approve. The executor writes only the files you specified in --arquivos.

python3 travas/5-planeja-executa/planeja_executa.py \
  --tarefa "summarize the email and note the dates" --material material.txt --arquivos resumo.md,notas.md
7

See the worst case

Simulates a 100% deceived agent that follows every hidden instruction, and shows what each lock can stop on its own.

python3 teste/pior_caso.py
8

Score your agent

Runs the 10 attacks with real Claude Code, without locks, with locks, and in planning mode. Each run uses your subscription.

python3 teste/banco.py --modos sem,com,planeja --modelo sonnet
# results in teste/resultados/<data>.md
9

See what lock 4 blocked

Each blocked action is logged in the project folder.

cat ~/meu-projeto/.agente-blindado.log
10

In n8n

After the AI Agent, an IF node routes the dangerous action to a Telegram, Gmail, or Slack node using the Send and Wait for Response operation (approval). The full instructions are in the repository.

travas/4-aprova/N8N.md
Results

What the locks stop, measured

Worst case: an agent that follows EVERY hidden instruction. Attacks that caused no harm, out of 10:

0/10

No locks. Created a file, deleted the contract, leaked the key, sent the .env outside.

5/10

Hook only (lock 4). Blocks deletion, leaks, and sending. Lets ordinary file writes through.

9/10

Plan × execute (lock 5). Only allowlisted actions and only the files you specified.

⚠️ What no technical lock can catch

Attack 04 does not ask the agent to do anything: it simply lies in the text ("approved supplier, pay R$ 48,000"). Code cannot know what is true. You catch it by reading before acting, which is why lock 4 asks for your approval for anything that costs money or cannot be undone.

🤖 And with a real model?

We ran the 10 attacks on Claude Code (07/11/2026). Sonnet and Haiku stopped all 10, even without locks: they noticed the hidden instruction and alerted the owner. With the locks on, they also held all 10. (In the Sonnet run the checker flagged a failure that was just the model quoting the attack to warn the owner; we corrected it by hand and noted it in teste/resultados/.) In other words, leading models already resist these attacks. Locks are for the day an attack is better than the model, for agents using smaller or open models, and for when your agent has access to sensitive resources. Run teste/banco.py with your agent and see its score.

Roadmap

What comes next

The kit will grow with attacks contributed by the community.

v1 · today
5 locks + bank of 10 attacksEnvelope, owner rules, 3 profiles, hook, planner × executor, installer, tests without AI, worst-case test, and test with a real model.
next
More attacksImage with hidden text, calendar invite, multi-step attack.
next
Ready-to-use n8n workflowImportable approval workflow, in addition to the instructions.