Metadata-Version: 2.4
Name: shieldprompt
Version: 0.1.4
Summary: Privacy bridge for LLMs — mask PII before it leaves your machine.
Project-URL: Homepage, https://github.com/shieldprompt/shieldprompt
Project-URL: Documentation, https://github.com/shieldprompt/shieldprompt#readme
Author: ShieldPrompt Contributors
License: MIT
License-File: LICENSE
Keywords: gdpr,hipaa,llm,masking,pii,privacy
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Topic :: Security
Classifier: Topic :: Software Development :: Libraries
Requires-Python: >=3.9
Requires-Dist: presidio-analyzer>=2.2.0
Requires-Dist: spacy<3.8.0,>=3.7.0
Provides-Extra: all
Requires-Dist: fastapi>=0.100.0; extra == 'all'
Requires-Dist: span-marker>=1.5.0; extra == 'all'
Requires-Dist: starlette>=0.27.0; extra == 'all'
Requires-Dist: torch>=2.0.0; extra == 'all'
Requires-Dist: transformers>=4.30.0; extra == 'all'
Provides-Extra: dev
Requires-Dist: fastapi>=0.100.0; extra == 'dev'
Requires-Dist: httpx>=0.24; extra == 'dev'
Requires-Dist: pytest-asyncio>=0.21; extra == 'dev'
Requires-Dist: pytest>=7.0; extra == 'dev'
Requires-Dist: starlette>=0.27.0; extra == 'dev'
Provides-Extra: fastapi
Requires-Dist: fastapi>=0.100.0; extra == 'fastapi'
Requires-Dist: starlette>=0.27.0; extra == 'fastapi'
Provides-Extra: ner
Requires-Dist: span-marker>=1.5.0; extra == 'ner'
Requires-Dist: torch>=2.0.0; extra == 'ner'
Requires-Dist: transformers>=4.30.0; extra == 'ner'
Description-Content-Type: text/markdown

# ShieldPrompt

**Stop leaking personal data to LLMs.**

<p align="center">
  <a href="https://pypi.org/project/shieldprompt/">
    <img src="https://readme-typing-svg.demolab.com?font=Fira+Code&weight=600&size=26&duration=2500&pause=800&color=36BCF7&center=true&vCenter=true&width=520&height=60&lines=%24+pip+install+shieldprompt" alt="pip install shieldprompt" />
  </a>
</p>

ShieldPrompt sits between your app and any Large Language Model (ChatGPT,
Claude, Gemini, a local model — doesn't matter which). Before your text
leaves the machine, it swaps real emails, phone numbers, names, credit
cards, and other sensitive values for reversible placeholders. When the
model's answer comes back, the placeholders are swapped back so your users
still see the real values.

**The model never sees the real data. Your users never see placeholders.**

---

## How it works

```
  Your text:         "Email alice@example.com about the invoice."
                                ↓ ShieldPrompt masks
  Sent to the LLM:   "Email [EMAIL_ADDRESS_1] about the invoice."
                                ↓ LLM answers
  Model reply:       "I'll draft an email to [EMAIL_ADDRESS_1]."
                                ↓ ShieldPrompt unmasks
  User sees:         "I'll draft an email to alice@example.com."
```

Under the hood:

1. **Detection** — a hybrid engine combines deterministic regex patterns
   (emails, phones, credit cards with Luhn validation, SSNs, IPs, IBANs,
   URLs, AWS/API keys) with Microsoft Presidio + spaCy NER for
   contextual entities (people, organizations, locations).
2. **Masking** — each detected value is stored in an in-memory vault and
   replaced with a stable token like `[PERSON_1]` or `[EMAIL_ADDRESS_2]`.
3. **Unmasking** — after the LLM responds, tokens are mapped back to the
   real values using the same vault. The vault is scoped to the request
   (or session) so data never leaks between users.

ShieldPrompt ships as:

- a **Python library** (`Shield`, `@mask_pii` decorator),
- a **FastAPI middleware** for automatic protection of chat endpoints,
- a **CLI** (`pii`, `retrace`, `shieldprompt`) for one-off file masking,
- an **MCP server** for Claude Code, Cursor, and other MCP-aware tools.

---

## Getting started

See **[SETUP.md](SETUP.md)** for installation, Claude Code integration, CLI
usage, the Python API, and troubleshooting.

## Contributing

See **[CONTRIBUTING.md](CONTRIBUTING.md)**. All changes land through pull
requests reviewed by the project owner.

## License

MIT
