Skip to content

Recipe 26: Prompt-injection screening #26

Closed

Description

@CompleteDotTech

Recipe 26 of 60 · Level 3 (Intermediate) · Trust & security · Noul

Use case

Flag instruction-redirection attempts in retrieved text using adversarial and benign quotation fixtures to measure false positives and missed attacks.

What to build

The folder recipes/26-prompt-injection-screening/ with notebook.ipynb, README.md, and fixtures/, meeting the recipe contract. Start from python tools/new_recipe.py 26 and the template in recipes/_template/.

Build notes

  • Fixtures must cover all four combinations of the two propositions, not two complementary groups. An earlier wording of this bullet said "two groups" and produced a fixture set in which discusses was the mechanical complement of redirect, so the second Noul could not change any composed outcome and scored a perfect F1 by construction (found by the Opus review of PR Recipe 26: prompt-injection screening #206, comment 6092513082). Required: text that redirects only; text that discusses or quotes only; text where both hold at once (for example a passage that discusses injection and also carries a live attempt); and text where neither holds (ordinary content that is not about prompt injection at all, the "no match" case of CONTRIBUTING.md section 5). The both-and-neither cases are the hard cases this recipe is judged on, and they are what justifies two independent Noul questions instead of one Choice.
  • Report false positives and missed attacks separately.
  • State that screening is one layer of defence and no guarantee. S07 documents the model's limits on adversarial content.

Decision design

  • Noul. Write each proposition as a statement that is true or false. One independent question per label or concern, sent together in one request. Noul has no confidence field, so each threshold is chosen from examples and evaluated.

Level 3 scope

Multiple judgments or stages, structured evidence, deterministic composition, and task-level evaluation.

Acceptance criteria

  • recipes/26-prompt-injection-screening/notebook.ipynb runs top to bottom offline, with no key and no network, and its outputs are committed
  • Live mode is opt-in (JEV_COOKBOOK_LIVE=1 with TYPESAFE_API_KEY) and uses the same question definitions as the offline run
  • Fixtures are synthetic, include the hard cases named in the build notes, carry gold labels, and pass the fixture validator
  • Every response fixture records its provenance, and the notebook states which mode it ran in
  • Evaluation: Miss rate on the adversarial group and false-positive rate on the benign group at the chosen threshold.
  • The deterministic composition lives in a Python function with tests in tests/
  • Evaluation is at task level, not only per question
  • Each of the two propositions is independently consequential: flipping one stored decision changes at least one composed outcome, and a test proves it. A per-label metric that is perfect by construction is reported as such or not reported
  • No statement about Jev's quality, latency, or cost appears without recorded live inference; in a synthetic run, metrics are labelled as pipeline checks
  • recipes/26-prompt-injection-screening/README.md says what the recipe teaches, how to run it, and what was and was not measured live
  • The pull request changes only recipes/26-prompt-injection-screening/ and CI is green

Dependencies

Sources

Read these before writing the questions.

Out of scope

  • Changes to shared code, the catalog, or the root README. If the shared package is missing something, open a foundation issue and link it here.
  • Real side effects of any kind. Actions are simulated.

Activity

  1. CompleteDotTech commented on Oct 10, 2026

    @CompleteDotTech
    ContributorAuthor

    Issue text amended by the orchestrator after the Opus review of PR #206 (comment 6092513082) showed that this issue's own Build notes caused a real defect in the recipe.

    What was wrong. The Build notes said "Fixtures in two groups: adversarial text that tries to redirect instructions, and benign text that quotes or discusses such attempts." Two complementary groups is a specification for complementary labels, and that is what the builder produced: build_fixtures.py derives discusses as the mechanical complement of redirect, so no fixture has both labels true or both false. The reviewer measured the consequence — the composed outcome of helpers.screen is identical on all 40 fixtures to a redirect-only rule, flipping any stored discusses decision changes zero outcomes, and evaluation-test prints discusses alone: f1 1.0000 without noting that the 1.0 is perfect by construction. The recipe's own justification for two Noul questions rather than one Choice — that both can hold at once, or neither — is never exercised, and the "mixed" and "no match" hard cases of CONTRIBUTING.md section 5 are both absent.

    What changed here. The two-groups bullet is replaced by one requiring all four combinations: redirect only, discusses or quotes only, both at once, and neither (ordinary content not about prompt injection at all). A new acceptance criterion requires each proposition to be independently consequential — flipping one stored decision must change at least one composed outcome, with a test proving it — and requires a per-label metric that is perfect by construction to be reported as such or not reported at all. Nothing else in the issue was touched.

    Scope of the correction. This is the issue text catching up with what the contract already required, not a new requirement invented late. PR #206's fix round is briefed against the amended text.

    For whoever writes the next multi-label Noul issue: name the mixed and neither cases explicitly in the Build notes. A fixture specification that lists exactly as many groups as there are labels will keep producing label sets that cannot disagree.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    cat: trust & securityCategory: Trust & securitydecision: noulUses a Noul questionlevel: 3 intermediateMultiple judgments or stages with deterministic compositionpriority: p2Scheduled after p1 worksize: MAbout a daystatus: blockedWaiting on the issues listed under Dependenciestype: recipeA cookbook notebook recipe

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions