Skip to content

Little Canary

Detects prompt injection by its effect on a sacrificial canary model, not just pattern matching: untrusted input hits a powerless model first, a behavioral check reads the…

Install: pip install little-canary

Works with Claude Code, Gemini CLI · 41 GitHub stars

Install

$pip install little-canary

Install command taken from the project's README or registry entry. Always review code before running it.

Little Canary

Screen untrusted prompts for signs of injection before your agent acts.

Little Canary runs untrusted text through a powerless "canary" model first and watches what it does. A host integration can use the verdict to block the input or restrict downstream tool authority, depending on that host's capabilities.

Quick start · Integrations · How it works · Evaluation · Research · Website


The problem

A prompt injection looks like ordinary data — a web page, an email, a tool result — until your agent follows the instructions hidden inside it. Pattern-matching filters can miss attacks that do not match known patterns. By the time you notice, the agent has already acted.

The idea

Coal miners sent a canary in first. Little Canary does the same thing for agents:

  1. Send the untrusted text to a canary model that has no tools, no credentials, and nothing to lose.
  2. Inspect the canary's response for signs the input changed its behavior.
  3. Return a verdict (PASS, FLAG, BLOCK) for the host to enforce within its available interception points.

Structural checks run alongside to catch known attack shapes. The canary can reveal attacks that no pattern check has catalogued yet.

Little Canary is developed by Hermes Labs.

How well does it work?

Short version: we publish our corpora and our method, not a detection-rate headline. Our benchmarks guide states the claim boundary explicitly — a historical aggregate rate was withdrawn when a rerun didn't reproduce it, and we won't publish a new percentage without a frozen, preregistered evaluation. We'd rather you know the edges than find them in production.

What we stand behind today:

Corpus Contents What it's for
prompts.json 160 attacks + 20 safe/mixed cases Structural decision vector, adversarial case selection
prompts_fp_realistic.json 40 benign hard negatives Case-by-case false-positive investigation
jailbench_injection_cases.json 5 embedded-injection attacks + 5 matched benign controls Regression probe (report positives and controls separately, never pooled)

Reproduce it:

python3 benchmarks/red_team_runner.py --corpus jailbench-injection --mode structural-only --headless --output /tmp/jailbench-structural.jsonl
python3 benchmarks/red_team_runner.py --corpus jailbench-injection --mode pipeline --model qwen2.5:1.5b --timeout 30 --headless --output /tmp/jailbench-pipeline.jsonl

External evidence: decision-model gates

Independent researcher Juraj Bednář benchmarked prompt-injection gates built on decision models — a related but different mechanism from the canary probe. (His gate asks a decision model two questions about extracted text; the canary probe watches a powerless model's behavior.) His numbers are not Little Canary's numbers. They are the closest public measurement of the model-judgment layer, cited here so you can judge the approach class, not this product.

Detector Test AUC Caught¹ Test false positives
Jev (cloud decision model) 0.981 88.9% 3.5%
Nimble 9B, 4-bit (local via Ollama) 0.927 80.6% 3.5%

Similar plugs

The agent harness performance optimization system. Skills, instincts, memory, security, and research-first development for Claude Code, Codex, Opencode, Cursor and beyond.

Build Agentic workflows, RAG pipelines, with rich AI model and tool support on one collaborative workspace. Deploy on cloud, VPC, or self-hosted, so teams move from prototype…

A cross-platform desktop All-in-One assistant for Claude Code, Codex, OpenCode, OpenClaw, Grok Build & Hermes Agent. Only official website: ccswitch.io

Explore related