Workflow
· 9 min read

Consistent codes across documents: where they hold

By Amine Gaaliche · drafted with Claude, reviewed and edited by hand

Within one folder, promptShield gives a name the same code in every file and on every pass. Professionals need that because they work in several passes: they ask, read the answer, paste a second document and refer back. If a person's code changes along the way, the AI loses track of who is who.

The work happens over many turns

Take a contract and its three amendments. You paste the protected contract and ask for a summary of the obligations. Then you paste an amendment and ask whether it changes the buyer's payment terms. Finally, you ask for a clause that resolves a conflict between the two.

For this to work, the model has to know that the buyer in the contract is the buyer in the amendment. It has to know that "the defendant" and "Ms. Laurent" are one party. If the model loses that link, its answer is wrong in a way that is hard to spot.

A tool built to protect one document at a time does not handle this. A professional works on a matter: a set of related files, over weeks.

Why the usual methods fail

ApproachWhat it doesWhy it fails across turns
Blackout barsBlacks out the textThe model cannot reason about what it cannot see
Deleting the namesRemoves the nameDifferent people all become the same blank, and the model may invent someone
A new label each runNew pseudonym on every passThe second turn gives everyone new names, so one person becomes two
Find-and-replaceMaps one spelling to one stringMisses initials and aliases, and knows nothing of the next document
Codes per documentStable codes inside one file onlyA contract and its amendment give the same party different codes

What stable codes need

One code per person, within a folder. Files in the same folder share one code registry. So "John Smith" gets one code, such as [PRKW1FJR], in the contract, the invoice and the email attachment. The linking is automatic.

A file in another folder gets a different code for the same name. To keep one code across folders, pin it by hand in Settings, which makes it global.

Codes that show the type. A code looks like [P0ABCD]. Its first letter gives the type: P for a person, A for an address, S for a Social Security number. The model still knows what kind of thing it is reasoning about, so its answer stays useful.

The code's length follows the text it replaces, so the page keeps its layout. A line of instructions in the downloaded file tells the AI to keep the codes unchanged.

A reliable way back. The mapping from each code to its original sits in a local registry. When the AI's answer comes back full of codes, you decode it in one step. Within a folder, one code stands for one original, so the result is unambiguous.

With all three, the AI follows the same people from turn to turn, and no real identity appears in the conversation.

How it works, step by step

  1. Encode. Each name and identifier becomes a typed code, and files in the same folder share the registry. A person reviews the detections before anything is committed. On a high-stakes document, that review matters most: see why a human stays in the loop.
  2. Ask. Paste the protected version into ChatGPT, Claude or another model. Ask follow-ups and add more documents from the same folder. The codes do not change, so the people stay consistent.
  3. Decode. Bring the AI's output back and restore every code to its real value in one step.

All of this runs on your machine. The originals and the registry stay there, and the model only sees protected text. promptShield was built around this way of working from the start.

Common questions

Why does the same name need the same code?

Because the work spans several turns and files. If one person gets a new code each turn, the AI reads about two different people.

Does the code hold across separate files?

Yes, for files in the same folder, which share one registry. Files in other folders get different codes for the same value, unless you pin the code in Settings. Reversible redaction explained covers the folder scope in full.

Where does the mapping live?

In a local registry on the machine that created the codes. We do not store it online, for the same reason we wrote our own detection engine. An export of the registry is plain text, so never send one with the document.

Found this useful? Let us know.

Share