A powerful, extensible tool for analyzing LLM prompts.
Project description
prlyn (Prompt Linter)
prlyn is a professional-grade static analysis tool for LLM prompts. Beyond basic linting, it provides a comprehensive suite of linguistic, security, and model-specific metrics to ensure your prompts are robust, efficient, and safe for production.
🌟 Why prlyn?
Developing effective prompts is often trial-and-error. prlyn brings Engineering Rigor to Prompt Engineering by:
- Quantifying Quality: Move from "it feels slow" to "Actionable Ratio is 0.45".
- Detecting Vulnerabilities: Identify design-time security flaws before they become runtime liabilities.
- Ensuring Model Fit: Adjust scores based on whether you are targeting GPT-4, Claude, or legacy models.
- Preventing Regression: Track metrics over time as you iterate on complex system instructions.
🚀 Key Features
1. Design-time Security (Prompt Shield)
prlyn doesn't just detect attacks; it flags vulnerability patterns in your system prompts:
- Delimiter Analysis: Verifies strong separation between instructions and user data.
- Defensive Anchors: Checks for mandatory safety instructions and negative constraints.
- Reflexive Leakage: Identifies instructions that might inadvertently reveal your prompt's inner workings.
2. Advanced Linguistics
- Flow Cohesion: Uses semantic embeddings to detect "logical jumps" or disjointed instructions that confuse models.
- Instructional Strength: Quantifies the assertiveness of your commands using weighted verb analysis (e.g., Must vs. Try).
- Position Scoring: Detects the "lost middle" phenomenon by measuring instructional density at the context window's edges.
3. Model-Aware Intelligence
Use the --model flag to tailor analysis to specific LLM quirks:
- GPT-4: Penalizes "buried" instructions more heavily due to known recency bias.
- Claude 3.5: Adjusts thresholds for excellent long-context retrieval capabilities.
4. Prompt Shadowing (Iterative Development)
- Automatic History: Every scan is stored in a hidden
.prlyn/directory. - Regression Detection: Use
prlyn --diffto compare your current draft against the previous version and see how your scores changed.
🚀 Quick Start (CLI)
For human users who want to manually scan a prompt. No installation required.
# Basic analysis
uvx --from git+https://github.com/Mishtert/prlyn prlyn "Your prompt here..."
# Show all options
uvx --from git+https://github.com/Mishtert/prlyn prlyn --help
🛠 Usage
CLI Usage
# Basic analysis (if already running via uvx as shown above)
uvx --from git+https://github.com/Mishtert/prlyn prlyn "Your prompt here..."
Model-specific analysis
prlyn "..." --model gpt-4
1. Run analysis (saved automatically)
prlyn "Initial draft..."
2. Iterate and compare against your last run
prlyn "Improved draft..." --diff
🤖 For AI Agents (MCP Server)
For AI Assistants (Claude, Cursor, Antigravity) to self-correct and optimize prompts.
1. Claude Desktop
Add this to your claude_desktop_config.json:
{
"mcpServers": {
"prlyn": {
"command": "uvx",
"args": [
"--from", "git+https://github.com/Mishtert/prlyn",
"prlyn"
]
}
}
}
2. Cursor
- Go to Settings > Cursor Settings > Features > MCP.
- Click + Add New MCP Server.
- Name:
prlyn - Type:
command - Command:
uvx --from git+https://github.com/Mishtert/prlyn prlyn
3. Antigravity
Add the following to your MCP configuration:
{
"mcpServers": {
"prlyn": {
"command": "uvx",
"args": [
"--from", "git+https://github.com/Mishtert/prlyn",
"prlyn"
]
}
}
}
4. Automated Rewriting
prlyn supports self-correction workflows. Your agent can:
- Call
prlyn.analyze_prompt(prompt)to get a quality score. - If the score is low, call
prlyn.get_improvement_template(prompt). - Use the returned Actionable Template to rewrite its own prompt.
🔭 Technical Details
- NLP Engine: Spacy (
en_core_web_sm) for linguistic structure and POS tagging. - Embeddings: SentenceTransformers (
all-MiniLM-L6-v2) for semantic similarity and flow analysis. - Tokenizer:
tiktokenfor accurate token budget estimation.
💻 For Developers
If you want to contribute to prlyn:
# Clone the repository
git clone https://github.com/Mishtert/prlyn.git
cd prlyn
# Install dependencies and setup environment
uv sync
# Run pipeline locally
uv run pytest
uv run pre-commit run --all-files
CI/CD Pipeline
Every PR triggers a 4-stage pipeline:
- Quality: Linting (
ruff) and Type Checking (mypy). - Security: Vulnerability scanning (
bandit). - Test: Unit tests (
pytest). - Build: Package verification (
uv build).
Refer to CONTRIBUTING.md for more details.
🔒 Privacy & Telemetry
prlyn respects your privacy.
- No Home: prlyn does not send any data to external servers.
- Local Analysis: All NLP and scanning happens locally on your machine.
- Usage Tracking: We rely solely on public PyPI download stats to gauge interest.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file prlyn-0.1.1.tar.gz.
File metadata
- Download URL: prlyn-0.1.1.tar.gz
- Upload date:
- Size: 150.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1f4bc8786be32e0e3aaec949a6f4eadb8de39ede47fc110b13a973cd8f59d7d9
|
|
| MD5 |
d9d55a36e41f3936823f7dc9fbee3256
|
|
| BLAKE2b-256 |
3ec3d085e746abcc06ceb33d30e272c92992fde7bed7feb3253b7743912c5e58
|
Provenance
The following attestation bundles were made for prlyn-0.1.1.tar.gz:
Publisher:
publish.yml on Mishtert/prlyn
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
prlyn-0.1.1.tar.gz -
Subject digest:
1f4bc8786be32e0e3aaec949a6f4eadb8de39ede47fc110b13a973cd8f59d7d9 - Sigstore transparency entry: 787248544
- Sigstore integration time:
-
Permalink:
Mishtert/prlyn@fa76044b1c891cbc130cff53f43a899fcf826215 -
Branch / Tag:
refs/tags/v0.1.1 - Owner: https://github.com/Mishtert
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@fa76044b1c891cbc130cff53f43a899fcf826215 -
Trigger Event:
push
-
Statement type:
File details
Details for the file prlyn-0.1.1-py3-none-any.whl.
File metadata
- Download URL: prlyn-0.1.1-py3-none-any.whl
- Upload date:
- Size: 27.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
48de283599b031b7e982eac60642de91648459431d133f75b2d369e82a163059
|
|
| MD5 |
484d0adb37abf23556b4b665a07cef33
|
|
| BLAKE2b-256 |
b99522bf47fc27f1fd3b4d2d1a7d51bb2087fdc58debb215b1208534331f44ed
|
Provenance
The following attestation bundles were made for prlyn-0.1.1-py3-none-any.whl:
Publisher:
publish.yml on Mishtert/prlyn
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
prlyn-0.1.1-py3-none-any.whl -
Subject digest:
48de283599b031b7e982eac60642de91648459431d133f75b2d369e82a163059 - Sigstore transparency entry: 787248546
- Sigstore integration time:
-
Permalink:
Mishtert/prlyn@fa76044b1c891cbc130cff53f43a899fcf826215 -
Branch / Tag:
refs/tags/v0.1.1 - Owner: https://github.com/Mishtert
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@fa76044b1c891cbc130cff53f43a899fcf826215 -
Trigger Event:
push
-
Statement type: