prompt-shield
Catch brittle prompts before production does.
prompt-shield runs your LLM function against semantically-equivalent paraphrases of your test inputs. If outputs diverge, your prompt is brittle — and production will find it before you do.
Install
pip install prompt-shield
Quick Start
from prompt_shield import BrittlenessRunner
def my_llm(user_input: str) -> str:
return call_my_llm(user_input) # your LLM function
runner = BrittlenessRunner(llm_function=my_llm)
result = runner.run(
test_inputs=["What is the return policy?"],
prompt_name="support_prompt",
)
print(result.verdict) # ROBUST / CONDITIONAL / BRITTLE
print(result.score) # BrittlenessScore (0.0–1.0)
print(result.certificate.to_markdown())
Three Stress Levels
Based on Matthew 7:24-27 (Two Builders) — three storm vectors:
| Level | Vector | Example |
|---|---|---|
lexical |
Rain — synonym substitution | "What is" → "What's the meaning of" |
syntactic |
Streams — structural transformation | "What is X?" → "Tell me about X" |
semantic |
Wind — full meaning reformulation | "How do I cancel?" → "I'd like to end my subscription" |
CLI
# Run audit
shield run --config shield.yaml
# CI gate (exit 0 = pass, 1 = brittle)
shield ci --config shield.yaml
# History
shield report --store ./shield.db
Verdicts
| Verdict | BrittlenessScore | Meaning |
|---|---|---|
ROBUST |
≤ 0.15 | Prompt handles paraphrase variation |
CONDITIONAL |
0.15–0.30 | Some sensitivity — review fault lines |
BRITTLE |
> 0.30 | Prompt relies on surface form — fix before deploying |
Biblical Pattern
PAT-048 (Daniel 5:25-28 — TEKEL): The prompt is weighed on the scales. PAT-049 (Matthew 7:24-27 — Two Builders): Three storm levels stress-test every prompt. PAT-050 (Proverbs 17:3 — The Crucible): The BrittleCertificate is the crucible output.
License
MIT
Release files for prompt-brittleness 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| prompt_brittleness-0.1.0.tar.gz | 24.7 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| prompt_brittleness-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 43.7 kB
Release files / prompt_brittleness-0.1.0.tar.gz
| Download URL | prompt_brittleness-0.1.0.tar.gz |
|---|---|
| Size | 24.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
d8e6faa8c391ed283c85490f6a430dec0f583e1359ca4d4d01615c7fb3804a05
|
|
BLAKE2b-256 checksum How to use checksums |
e3476574dad60671b201d26d1ce5009b1c5ba5711573cb50d20989acd0987732
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.3
|
Release files / prompt_brittleness-0.1.0-py3-none-any.whl
| Download URL | prompt_brittleness-0.1.0-py3-none-any.whl |
|---|---|
| Size | 19.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
7c5b36dfcc9fa9a2d9ccec2a24823dff392ef615fd702dd780bec4267f5ee1ba
|
|
BLAKE2b-256 checksum How to use checksums |
7e344378a09d3fb279fc3e1cd8727d41b832f153e79e7c09105e402b4f0f58eb
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.3
|