promptdojo_

The PII proxy — mask before the model, unmask for the named human — step 7 of 8

Write run_proxy(ticket) — mask, refuse, unmask. A ticket has id, text, pii (list of {kind, value}), and reviewer.

  1. Walk pii in order. Token is [KIND_n] with n starting at 1 (kind uppercased). Replace each value in the text. Keep a token map.
  2. If any value in KNOWN is still in the masked text → print {id}: BLOCKED — raw PII and return.
  3. If reviewer is falsy or equal to "auto" → print {id}: BLOCKED — no named human and return.
  4. Otherwise take MODEL_DRAFT[id], restore every token from the map, and print {id}: FOR {reviewer}: {restored}.

Expected output:

exc-441: FOR vera: We'll call 415-555-0142 about MBR-104221 and email [email protected].
exc-442: BLOCKED — raw PII
exc-443: BLOCKED — no named human

full-screen editor opens — close anytime to keep reading.