Open-Source Tool Keeps AI Privacy Safe by Anonymizing PII
DocCloak lets users share sensitive documents with AI models without leaking personal data.
Overview
A new open-source tool named DocCloak is addressing one of the most pressing concerns in enterprise AI adoption: data privacy. As organizations increasingly integrate large language models into their workflows, the risk of inadvertently exposing sensitive personally identifiable information (PII) has grown exponentially. DocCloak offers a browser-based solution that anonymizes documents before they ever reach an AI service, ensuring that confidential data never leaves the user's local machine.
The tool is designed for professionals in high-stakes fields such as law, healthcare, and human resources, where the handling of client records, patient notes, and employee data is strictly regulated. By operating entirely offline after initial setup, DocCloak eliminates the need for third-party servers or API calls, providing a robust layer of security for users who require AI assistance without compromising confidentiality.
How It Works
DocCloak functions through a straightforward four-step process that prioritizes user control and data sovereignty. Users can paste text directly into the interface or upload documents in formats such as .doc, .docx, .pdf, and various image types including PNG and JPG. For image-based inputs, the tool employs local optical character recognition (OCR) to extract text before processing begins.
Once the document is loaded, DocCloak scans for PII using a combination of machine learning models and regular expression patterns. The system detects a wide range of entities, including names, email addresses, phone numbers, social security numbers, credit card details, and even proprietary secrets like API keys and JWTs. Instead of simply deleting this information, the tool replaces it with typed placeholders, such as [PERSON_1] or [DATE_2].
These placeholders are crucial because they provide context to the AI model. By indicating that a redacted segment refers to a person, date, or company, the AI can generate coherent and grammatically correct responses without ever seeing the actual sensitive data. After the user receives the AI-generated summary or analysis, they can paste the response back into DocCloak. The tool then restores the original names and details, mapping the placeholders back to their real-world counterparts.
"The AI never sees the real data. You get the full power of AI assistance without the privacy risk."
This cycle ensures that the intelligence of generative AI is utilized while maintaining strict data boundaries. The entire pipeline, from redaction to restoration, occurs within the user's browser, leaving no digital footprint on external servers.
Key Features and Technical Architecture
The technical foundation of DocCloak is built on performance, security, and flexibility. A standout feature is its hybrid detection engine, which combines deep learning models with 178 regex rules. This dual approach catches both complex, unstructured PII and highly structured patterns like government IDs or regional phone numbers. The tool supports entity propagation, meaning if a specific name is detected once, DocCloak automatically identifies and redacts all subsequent occurrences throughout the document, ensuring consistency.
Users are not limited to a single detection model. DocCloak offers three distinct options to cater to different performance needs and device capabilities:
- GLiNER PII Small: A lightweight option at approximately 83 MB, ideal for phones or low-memory devices, with multi-language support.
- GLiNER PII Base: A larger model at ~197 MB, offering improved accuracy for English and date recognition.
- BardS.ai EU PII: The most comprehensive model at ~279 MB, supporting over 24 EU languages and 35 entity types for maximum multilingual accuracy.
The application also implements a consent-first setup protocol. Models are not downloaded until the user explicitly accepts the terms. When downloading, the tool verifies the integrity of the model files and tokenizers against pinned SHA-256 hashes, protecting against tampered or corrupted data. Downloads are resilient, utilizing HTTP Range requests to resume interrupted transfers and exponential backoff for transient network errors.
For document handling, DocCloak goes beyond simple text redaction. When exporting PDFs, the tool preserves the original text layer and attempts to match fonts for placeholders. If font matching is not feasible, it uses metrics-compatible alternatives. Annotations, forms, bookmarks, and attachments are stripped from the exported file to prevent accidental data leakage through hidden metadata. Image outputs can be downloaded with sensitive words blacked out, and metadata scrubbing ensures no hidden data remains in .docx exports.
Who Is This For?
DocCloak is tailored for professionals who rely on AI tools but operate in environments where data leakage is not an option. Its utility spans several critical industries:
Lawyers and Legal Teams Attorneys can redact client names and case specifics from contracts before submitting them to AI for clause review or precedent analysis. This prevents the exposure of privileged information while still leveraging AI for legal research.
Consultants Business consultants often handle proprietary company data in reports. DocCloak allows them to anonymize sensitive financial figures or internal strategies before generating AI summaries, ensuring competitive intelligence remains protected.
Healthcare Professionals In the medical field, patient privacy is paramount. Doctors and researchers can strip patient identifiers from clinical notes before using AI for diagnostic research or documentation assistance, complying with regulations like HIPAA without sacrificing efficiency.
HR Departments Human resources teams deal with sensitive employee records daily. They can remove PII from policy drafts or performance reviews before seeking AI input on compliance or wording, safeguarding employee data throughout the drafting process.
The tool also serves anyone who uses public AI services but handles sensitive data they cannot afford to leak. By running locally via ONNX Runtime WebAssembly, DocCloak ensures that once the app shell and necessary models are cached, the system works completely offline. This makes it a viable solution for air-gapped environments or users with strict connectivity policies, bridging the gap between powerful AI capabilities and rigorous privacy requirements.
Sources
- 1
Open-Source Tool Keeps AI Privacy Safe by Anonymizing PII
https://github.com/WLojek/DocCloak
Tools mentioned
Ahrefs
https://ahrefs.com
SEMrush
https://semrush.com
SpyFu
https://spyfu.com
Ubersuggest
https://ubersuggest.com
Google Search Console
https://search.google.com/search-console
Bing Webmaster Tools
https://www.bing.com/webmasters
Perplexity AI
https://perplexity.ai
Grok
https://grok.com
Cohere Command
https://cohere.com
Mistral Chat
https://mistral.ai