Refract Guides · Practical AI safety testing patterns

Building a Prompt Injection Battery with Refract

A prompt injection battery should cover direct overrides, obfuscation, tool-call abuse, and safe controls. Refract packs make that battery deterministic and CI-ready.

Cover the main injection classes

Use built-in mutators

Refract can route base prompts through encoders so the same canary is tested in multiple obfuscated forms.

refract scan --target anthropic:claude-opus-5-5 --pack ./packs/jailbreak-encoding.jsonl --mutators homoglyph_confusable,split_token_wrap,markdown_table_wrap

Always include benign controls

A battery that only attacks will reward an overblocking filter. Include normal user prompts with minor formatting quirks to measure false positives.

Read the matrix

refract matrix --scan scan-a1b2c3d4 --db ./runs.sqlite --intervals
Related

RAG Leak Testing with Refract

How to test RAG systems for hidden-footnote leaks, indirect prompt injection, and verbatim retrieval leaks with Refract packs and 2×2 guardrail scoring.