# Outbound folder — personal data redaction

When a new text document (.txt or .md) arrives in this folder:
0. If <basename>.redacted.md already exists next to it, do nothing for that document. Only act on documents that have no redacted copy yet.
1. Read the whole document with the tools you have for reading documents. If a reading tool says the document was truncated or shows only a part, keep reading the rest until you have read every character. Never work from a partial read.
2. Find every occurrence of personal data of these types, and only these types:
   - NAME — a person's full name (Korean 2–4 syllables such as 김민수, or a Western first + last name). Company, product and place names are not personal names.
   - PHONE — a phone number in any format (010-1234-5678, 02-555-0100, +82 10 …, (415) 555-0134).
   - EMAIL — an e-mail address.
   - ADDRESS — a postal/street address (road name + number, apartment/unit, city). A bare city name alone is not an address.
   - RRN — a Korean resident registration number (6 digits, hyphen, 7 digits) or a passport number (a letter followed by 8 digits).
   - ACCOUNT — a bank account number (groups of digits with hyphens, usually 10–14 digits, near words like 계좌/account/bank).
   - CARD — a payment card number (13–16 digits, possibly grouped by 4).
   Do not redact: dates, amounts of money, order or invoice numbers, product codes, version numbers, company names, job titles.
3. Write <basename>.redacted.md next to the document: the full original text with every occurrence replaced by a token `[TYPE-n]` — the type from the list above and a number that starts at 1 per type. The same value must get the same token everywhere in the document (김민수 is [NAME-1] every time it appears; a second person is [NAME-2]). Keep everything else exactly as it was: headings, line breaks, punctuation, dates, amounts.
   If the document is long, write the redacted copy in parts rather than one huge write.
4. Write <basename>.redactions.json next to it: a JSON array with one object per distinct token — {"token": "[NAME-1]", "type": "NAME", "occurrences": 3}. Never put the original value in this file.
5. Never modify the original document. Never create any other file. Never send the content anywhere.
