Skip to main content

A powerful, extensible tool for analyzing LLM prompts.

Project description

prlyn (Prompt Linter)

PyPI version License: MIT CI Downloads

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 --diff to 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

  1. Go to Settings > Cursor Settings > Features > MCP.
  2. Click + Add New MCP Server.
  3. Name: prlyn
  4. Type: command
  5. 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:

  1. Call prlyn.analyze_prompt(prompt) to get a quality score.
  2. If the score is low, call prlyn.get_improvement_template(prompt).
  3. 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: tiktoken for 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:

  1. Quality: Linting (ruff) and Type Checking (mypy).
  2. Security: Vulnerability scanning (bandit).
  3. Test: Unit tests (pytest).
  4. 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

prlyn-0.1.1.tar.gz (150.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

prlyn-0.1.1-py3-none-any.whl (27.2 kB view details)

Uploaded Python 3

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

Hashes for prlyn-0.1.1.tar.gz
Algorithm Hash digest
SHA256 1f4bc8786be32e0e3aaec949a6f4eadb8de39ede47fc110b13a973cd8f59d7d9
MD5 d9d55a36e41f3936823f7dc9fbee3256
BLAKE2b-256 3ec3d085e746abcc06ceb33d30e272c92992fde7bed7feb3253b7743912c5e58

See more details on using hashes here.

Provenance

The following attestation bundles were made for prlyn-0.1.1.tar.gz:

Publisher: publish.yml on Mishtert/prlyn

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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

Hashes for prlyn-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 48de283599b031b7e982eac60642de91648459431d133f75b2d369e82a163059
MD5 484d0adb37abf23556b4b665a07cef33
BLAKE2b-256 b99522bf47fc27f1fd3b4d2d1a7d51bb2087fdc58debb215b1208534331f44ed

See more details on using hashes here.

Provenance

The following attestation bundles were made for prlyn-0.1.1-py3-none-any.whl:

Publisher: publish.yml on Mishtert/prlyn

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page