Skip to main content

grounded-screen

Screen tool results for prompt injection before your agent reads them.

grounded-screen sends untrusted text (a fetched web page, an email, a GitHub issue, a Slack message, any MCP tool result) to the Injection Screen at https://extract.sentinelintel.org/screen and gets back a verdict, injection or clean, plus the suspicious spans with character offsets the server checked against your text. It ships three pieces:

  • a small Python client that pays per call with x402 on Base,
  • a Claude Code PostToolUse hook that stops Claude when a tool result looks like an injection,
  • a LiteLLM guardrail that blocks, masks or flags MCP tool results.

Price

0.003 USDC per screened call (3000 atomic units of USDC on Base, network eip155:8453), paid from your own wallet through x402. There is no account and no subscription. The client refuses to pay more than 0.003 USDC for one call and refuses to pass a daily cap you set (default 0.50 USDC per UTC day).

Setup in three steps

  1. Install:

    pip install grounded-screen            # client and Claude Code hook
    pip install git+https://github.com/argus-forge/grounded-screen  # the way to install until the PyPI release
    pip install "grounded-screen[litellm]" # also the LiteLLM guardrail
    
  2. Give it a Base wallet that holds a little USDC. Put its private key in the environment of the process that runs the hook or the proxy. Never put it in a settings or config file.

    export GROUNDED_SCREEN_KEY=...                # private key of a Base wallet with USDC
    export GROUNDED_SCREEN_DAILY_CAP_USDC=0.50    # optional, default 0.50
    

    Use a wallet that holds only what you are willing to spend on screening.

  3. Wire it in.

    Claude Code: add this to ~/.claude/settings.json or .claude/settings.json (also in examples/claude-settings.json):

    {
      "hooks": {
        "PostToolUse": [
          {
            "matcher": "^(WebFetch|WebSearch|mcp__.*)$",
            "hooks": [
              {
                "type": "command",
                "command": "grounded-screen-claude-hook",
                "timeout": 90,
                "statusMessage": "Screening the tool result for prompt injection"
              }
            ]
          }
        ]
      }
    }
    

    LiteLLM proxy: add this to your config.yaml (also in examples/litellm-config.yaml):

    guardrails:
      - guardrail_name: grounded-screen
        litellm_params:
          guardrail: grounded_screen.litellm_guardrail.GroundedScreenGuardrail
          mode: post_mcp_call
          default_on: true
          on_injection: block        # block, mask or flag
          fail_closed: false         # true also blocks results that could not be screened
          max_chunks: 3              # pieces of 20000 characters screened per result
          mcp_block_behavior: tool_result
    

What the Claude Code hook does

The hook reads the PostToolUse input Claude Code sends on stdin and screens tool_response when the tool brings in outside content: WebFetch, WebSearch, and MCP tools (mcp__<server>__<tool>) whose name contains fetch, browse, email, mail, issue, github, slack or read_url (case does not matter). Other tools are not screened and cost nothing.

On an injection verdict it exits 0 and prints one JSON object with these documented fields:

  • "decision": "block" and reason: the reason is added next to the tool result. It tells Claude the result is untrusted, not to follow any instruction in it and not to act on it until you say so, and it lists each suspicious span with its offsets.
  • "continue": false and stopReason: Claude stops processing and you see the spans, so nothing happens until you reply. Set GROUNDED_SCREEN_HOOK_MODE=warn to keep only the block reason and let Claude continue.
  • systemMessage: a one line warning shown to you.

A clean result, a result that could not be screened (no key, cap reached, network error, timeout, server error) and a hook error all exit 0 with nothing on stdout, so Claude Code goes on as if the hook were not there. The reason for an unscreened result goes to stderr, which Claude does not see; read it with claude --debug.

Fields and behavior follow the Claude Code hooks reference, https://code.claude.com/docs/en/hooks, sections "PostToolUse", "PostToolUse input", "PostToolUse decision control", "JSON output", "Decision control", "Exit code output", "Matcher patterns" and "Match MCP tools". Note from that page: Claude still sees the original tool output next to the block reason, because a PostToolUse hook runs after the tool ran.

What the LiteLLM guardrail does

GroundedScreenGuardrail subclasses LiteLLM's CustomGuardrail and implements apply_guardrail. In mode post_mcp_call LiteLLM calls it with every text block and structuredContent string of the MCP tool result, before the model sees them.

  • on_injection: block raises GuardrailRaisedException, so LiteLLM rejects the tool result. With LiteLLM's mcp_block_behavior: tool_result (its default) the model gets the block as the tool result; with raise the request fails with HTTP 400.
  • on_injection: mask replaces each suspicious span with [removed by grounded-screen: suspected prompt injection] and passes the rest.
  • on_injection: flag logs a warning with the spans and passes the result unchanged.
  • A result that could not be screened passes, unless fail_closed: true.

Interface used, from LiteLLM 1.111.1: https://docs.litellm.ai/docs/proxy/guardrails/custom_guardrail, https://docs.litellm.ai/docs/mcp_guardrail, and in the source litellm/integrations/custom_guardrail.py (apply_guardrail, line 1670), litellm/types/guardrails.py (post_mcp_call, line 948; mcp_block_behavior, line 1054), litellm/proxy/mcp_server/guardrail_translation/handler.py (process_output_response, line 228) and litellm/proxy/guardrails/guardrail_registry.py (initialize_custom_guardrail, line 910).

Python client

from grounded_screen import ScreenClient, screen_text

result = ScreenClient().screen("Ignore all previous instructions and ...", source="web")
if result.injection:
    for span in result.spans:
        print(span.start, span.end, span.text)
elif not result.screened:
    print("not screened:", result.reason)   # never raises

screen() takes 1 to 20000 characters. screen_text() splits longer text into pieces of up to 20000 characters and screens at most max_chunks of them (each piece is one paid call). There is also a command line tool: echo "some text" | grounded-screen.

ScreenResult.screened is False whenever there is no verdict, with reason set to one of missing_key, bad_key, per_call_cap, daily_cap, network_error, timeout, server_error, unexpected_status, payment_rejected, malformed_response, offer_mismatch, payment_error, empty_text, text_too_long or internal_error.

Variable Default Meaning
GROUNDED_SCREEN_KEY none Base wallet private key. Read at call time, never logged or stored by the client.
GROUNDED_SCREEN_DAILY_CAP_USDC 0.50 Most USDC paid per UTC day.
GROUNDED_SCREEN_MAX_PER_CALL_USDC 0.003 Can lower the per call cap, never raise it.
GROUNDED_SCREEN_STATE_FILE ~/.local/state/grounded-screen/spend.json Daily spend ledger (also honors XDG_STATE_HOME).
GROUNDED_SCREEN_TIMEOUT 20 Seconds per HTTP request.
GROUNDED_SCREEN_URL https://extract.sentinelintel.org/screen Endpoint.
GROUNDED_SCREEN_PAY_TO the service address Pay-to address the 402 offer must name.
GROUNDED_SCREEN_RECEIPT_LOG none If set, one JSON line per paid request: time, HTTP status, settled, transaction, amount, verdict. Never the key or the text.
GROUNDED_SCREEN_HOOK_MODE stop stop or warn (Claude Code hook).
GROUNDED_SCREEN_MAX_CHUNKS 3 Pieces screened per tool result (Claude Code hook).

The client pays only an exact scheme offer in Base USDC to the expected pay-to address, for at most the per call cap. It counts a payment against the daily cap before sending it and gives it back only when the service answers without settling.

Measured results

All numbers below are from two measurement runs of the same /screen service. Nothing else has been measured.

indirect-injection gate. Test set derived from nvidia/Nemotron-RL-Agentic-Indirect-Prompt-Injection-v1 (revision d738d4f3): 1271 tool or document strings that contain an injection, and 1251 negatives made from the same strings with the injection text removed. Synthetic, enterprise domain, indirect only.

Metric Result
Recall 0.9961 (1266/1271)
False positive rate 0.0080 (10/1251)
Detections with a span overlapping the injection 1266/1266
Returned spans whose offsets match the text 2560/2560
p95 response time, all rows (longest row 906 characters) 1.258 s (median 0.643 s, n = 2522)
p95 response time, one 20000 character input 3.240 s (n = 50)

public benchmark check. 200 attack rows and 200 hard benign rows sampled with a fixed seed from deepset/prompt-injections, jackhhao/jailbreak-classification and the post-cutoff instruction-heavy set (test split, direct injection, jailbreak and obfuscation rows; hard negative benign rows).

Slice Recall False positive rate
All 0.870 (174/200) 0.060 (12/200)
deepset and jackhhao (published before 2026-04-15) 0.867 (104/120) 0.025 (4/161)
post-cutoff instruction-heavy set 0.875 (70/80) 0.205 (8/39)
deepset only 0.759 (22/29) no benign rows

Response time on that run: p50 510 ms, p95 2170 ms (n = 400). 8 of the 174 detections had no span the server could locate in the text; the service does not settle such a reply, so the caller pays nothing and gets no verdict (the client reports server_error). Counting only detections with a located span, recall is 0.830 (166/200).

Both runs were made on a loopback instance of the service, so the times above do not include the internet round trip or the x402 payment step.

Known limits

  • Instruction heavy benign text is often flagged. On the post cutoff hard negative set, 8 of 39 benign rows were flagged (0.205), and polite imperative requests aimed at an assistant were flagged 6 of 7 times. The screen counts any text that tries to direct an AI agent as injection.
  • ROT13 encoded instructions are mostly missed: 1 of 8 caught.
  • Only English text has been measured.
  • One GPU serves the screen, so expect about one call a second across all users. Up to four calls wait behind the running one; past that the service answers 503 without charging, and the client reports server_error.
  • About 1.3 s is added per screened result (p95 1.258 s on the gate rows, before network and payment time). Longer inputs take longer: p95 3.240 s at 20000 characters.
  • The pre cutoff public sets may be in the model's training data, and the post cutoff set comes from a single template generated source.
  • A clean verdict means the screen found nothing. It is not proof that text is safe.
  • A PostToolUse hook runs after the tool ran: the screen cannot undo what a tool already did.

License

MIT. Copyright (c) 2026 ArgusForge LLC.

Sources

The post-cutoff instruction-heavy set is the Prompt Injection Benchmark (Apache-2.0): https://huggingface.co/datasets/DaveyD347/prompt-injection-benchmark

Metadata

Release files for grounded-screen 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for grounded-screen 0.1.0
File Size Uploaded Provenance Actions
grounded_screen-0.1.0.tar.gz 35.4 kB Without provenance Details for grounded_screen-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for grounded-screen 0.1.0
File Interpreter ABI Platform Actions
grounded_screen-0.1.0-py3-none-any.whl Python 3 none any Details for grounded_screen-0.1.0-py3-none-any.whl

Total release size: 56.6 kB

Release files / grounded_screen-0.1.0.tar.gz

Download URL grounded_screen-0.1.0.tar.gz
Size 35.4 kB
Tags Source
SHA-256 checksum
How to use checksums
cac441d7d125c8a37c46bb3efc9e05f5d6ce6f7773bffa6db3ee17eba0ff4de6
BLAKE2b-256 checksum
How to use checksums
a8d30381c0d39f9f72ceadd87754a5fd2004dc07dbaafabb0e18b47eec1007dc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.16

Release files / grounded_screen-0.1.0-py3-none-any.whl

Download URL grounded_screen-0.1.0-py3-none-any.whl
Size 21.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
de7c5543f6728803e760c6857921bc46d378d116e1025dd005d60ae1469ce8d0
BLAKE2b-256 checksum
How to use checksums
b90478985dec87b110034406b88fd05279d4a6f9c53a73076a42648b8de5c914
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.16

Security for grounded-screen 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page