Skip to main content

A health checker for LLM prompts and conversations.

Project description

prompthealth

A health checker for LLM prompts and conversations. Catches underspecified, ambiguous, and misaligned prompts before they hit the model. Monitors conversation health as context accumulates.

prompthealth scores prompts across four axes (constraint density, solution space width, intent clarity, context sufficiency), generates actionable rewrite suggestions, recommends thinking effort levels, and predicts response quality. Works offline with rule-based heuristics. Optionally connects to an LLM API for semantic analysis.

from prompthealth import Session

s = Session(api_key="sk-...", provider="anthropic")
s.add_context("FastAPI backend, PostgreSQL, deployed on AWS ECS")

result = s.check("What's the best caching strategy?")
# result.health: 0.5
# result.axes.constraint_density: 0.6
# result.axes.solution_space: 0.3
# result.axes.intent_clarity: 0.4
# result.axes.context_sufficiency: 0.7
# result.suggestions: ["Specify what you're caching (responses, DB queries, sessions)", ...]
# result.thinking_effort: "high"

Phases

  1. Core health engine. Rule-based heuristics for constraint density, intent clarity, structural analysis. Session object for context accumulation. Pydantic result models. Works fully offline.
  2. Semantic analysis. API-backed scoring for solution space width and context sufficiency. LLM-generated suggestions. Requires user-provided API key.
  3. Thinking effort and response prediction. Classifies prompt complexity to recommend reasoning depth. Predicts whether the prompt will produce a useful response.
  4. Conversation health. Track health over a full conversation. Detect context drift, prompt degradation, and model repetition across turns.
  5. Claude Code plugin. Skill or hook integration for pre-submission health checks inside Claude Code.

Docs

  • /docs/architecture.md — Module dependency graph, rule engine vs semantic layer split, Session lifecycle, data flow from prompt input to HealthResult output.
  • /docs/axes.md — Definitions, scoring logic, and calibration notes for each axis. Includes the labeled prompt dataset used for threshold tuning.
  • /docs/rules.md — Full catalog of rule-based heuristics: pattern matchers, keyword lists, scoring functions, and edge cases per axis.
  • /docs/api-layer.md — Prompt templates sent to the LLM for semantic scoring, response parsing, fallback behavior when API is unavailable.
  • /docs/extending.md — How to add new axes, new rules, or new checker types (response checker, conversation checker) against the base interface.

Install

pip install prompthealth

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

prompthealth-0.1.0a1.tar.gz (4.7 kB view details)

Uploaded Source

Built Distribution

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

prompthealth-0.1.0a1-py3-none-any.whl (2.5 kB view details)

Uploaded Python 3

File details

Details for the file prompthealth-0.1.0a1.tar.gz.

File metadata

  • Download URL: prompthealth-0.1.0a1.tar.gz
  • Upload date:
  • Size: 4.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.5

File hashes

Hashes for prompthealth-0.1.0a1.tar.gz
Algorithm Hash digest
SHA256 c164cdbf993068b4778b9b2c292c637cf2d0a113ef2017b0895d7c08201ce776
MD5 ee66c6d33a039d03f7ab812ec26bbe13
BLAKE2b-256 02b5cd7389069c9c3d44f061bf6eb2eaf140c61ba453122613ee943061730f33

See more details on using hashes here.

File details

Details for the file prompthealth-0.1.0a1-py3-none-any.whl.

File metadata

  • Download URL: prompthealth-0.1.0a1-py3-none-any.whl
  • Upload date:
  • Size: 2.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.5

File hashes

Hashes for prompthealth-0.1.0a1-py3-none-any.whl
Algorithm Hash digest
SHA256 1bab5236331a78288c545f5316778d3559d608bc174c2d032bd8d77ea7919811
MD5 3cbe868335689049ecd82a33f6620ad5
BLAKE2b-256 fd86d6029f1c8821b3a4a042bfdb62ca9b6c0888af42813e9736903e66b8f66e

See more details on using hashes here.

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