Skip to Content
Amaru
Amaru LightOperate

Prompt guard

How the Amaru Light prompt guard screens issue text and review feedback with a local injection classifier, what happens to flagged text, and its settings.

The agent runs unattended, with permission to run commands and with the bot's GitHub token. Anyone who can write an issue or comment on a pull request can try to give it instructions. The prompt guard checks that text with a local classifier before the agent reads it, and keeps what it flags away from the agent. It is on by default.

Before you begin

amaru-guard must be on PATH; the container image and the packages include it. The first start downloads the model into $XDG_CACHE_HOME/amaru-guard or ~/.cache/amaru-guard. In a container, keep the home directory on a volume, or the model is downloaded again at each start.

What is checked

InputTextWhen flagged
issue (default)The issue's title and body; for Jira, the description with its commentsThe ticket stops before the agent turn, with amaru:blocked and a comment that names the score but never quotes the text.
review (default)Each review, review comment and failed CI check that reaches the agentThat item is marked handled, gets a reply that says why, and is never given to the agent.
checksThe output of a failed project checkThe ticket stops, as for an issue.

A flagged issue

A classifier can be wrong. If the issue is harmless, remove amaru:blocked, run amaru unblock <ticket>, or press Unblock on the web page. That exact text then passes; an edit to the issue afterwards is checked again. Each check is recorded as a ticket event: GUARD_PASSED, GUARD_REJECTED, GUARD_ALLOWED or GUARD_ERROR.

Daemon settings

amaru.yaml
guard:
  enabled: true             # false turns it off; only where every issue author is trusted
  command: amaru-guard
  config: guard.yaml        # the guard's own settings; optional
  inputs: [issue, review]   # add checks for failed check output
  on_error: block           # or allow
  timeout: 15m
KeyDefaultMeaning
enabledtrueCheck untrusted text before the agent reads it.
commandamaru-guardThe guard executable. Any program with the same exit codes works.
confignoneThe guard's own settings file, relative to the daemon file.
inputs[issue, review]What is checked: issue, review, checks.
on_errorblockWhen the guard fails: block stops the ticket, allow records GUARD_ERROR and passes the text on.
timeout15mThe longest one check, or the model download, may take.

amaru serve, amaru drain and amaru claim --now run amaru-guard download before any work; when it fails, the daemon does not start.

amaru-guard

amaru-guard download [-c guard.yaml]       # get the model into the cache
amaru-guard check [-c guard.yaml] "text"   # classify one text
amaru-guard check [-c guard.yaml] -        # the text on stdin

check prints one JSON line, never the text, and exits with 0 to pass it, 1 to reject it and 2 when it cannot decide. It runs the model with ONNX Runtime and needs no Python.

The default model is wolf-defender-prompt-injection-small from Patronus Studio (Apache 2.0), about 280 MB; the larger wolf-defender-prompt-injection is built in too. Both are pinned to a commit and checked by SHA-256. The guard's own guard.yaml accepts model, threshold_percent (default 50), threads and other keys listed in the source document.

Limits

The guard is one layer, not a sandbox. It does not replace a token that can only reach the bot's repositories, a container, or a human review of every pull request. It does not see what the agent reads by itself while it works, such as files in the repository or pages it fetches.

Based on docs/prompt-guard.md.

Next steps

On this page