PrePrompt
Underspecified prompts get mediocre answers. PrePrompt rewrites the vague ones — adding the missing context, constraints, and output format — before the model ever sees them.
Get PrePrompt
Most people want the Chrome extension. It rewrites your prompts right where you already work — ChatGPT, Claude, Gemini, and Perplexity — with nothing to install locally.
👉 Add PrePrompt to Chrome → preprompt.org — free, 30 rewrites/month.
This package (pip install preprompt) brings the same service to your IDE and
terminal: a hook and MCP server for Claude Code, Cursor, Windsurf, and Zed,
plus a small CLI. It uses the same PrePrompt account and the same monthly
credits as the extension.
What it does
Most prompts sent to an LLM are underspecified — they're missing context, output format expectations, or technical constraints that the developer has in their head but didn't type. PrePrompt scores every prompt and rewrites the complex ones. Simple prompts ("what is jwt") pass through untouched.
BEFORE write a function that handles youtube oauth token refresh
and manages expired credentials with error handling
AFTER Write a Python function for FastAPI that handles YouTube OAuth 2.0
token refresh. The function should: (1) detect expired credentials
by checking the expiry timestamp, (2) use the refresh token to
obtain a new access token via the YouTube API, (3) update and
persist the new credentials (consider using a database or file
storage), and (4) include comprehensive error handling for invalid
refresh tokens, network failures, and API errors with appropriate
logging and exception types.
In Claude Code, a rewritten prompt shows up as an annotation box:
╔═ PrePrompt +58 ════════════════════════════════════════════╗
║ The rewritten prompt specifies the technical ║
║ implementation details, clarifies the complete workflow, ║
║ and adds concrete error scenarios and storage ║
║ considerations relevant to FastAPI applications. ║
╠════════════════════════════════════════════════════════════╣
║ ORIGINAL write a function that handles youtube oauth t... ║
║ OPTIMIZED Write a Python function for FastAPI that handles ║
║ YouTube OAuth 2.0 token refresh. The function ║
║ should: (1) detect expired credentials by ║
║ checking the expiry timestamp... ║
╚════════════════════════════════════════════════════════════╝
Install
pip install preprompt
preprompt-install # registers the hook + MCP server (Claude Code, and Cursor if installed)
preprompt-login # paste a token from preprompt.org/dashboard/tokens
# Restart Claude Code or Cursor
A PrePrompt account is required — the free plan works. PrePrompt never asks for, stores, or uses an Anthropic API key.
Upgrading from 0.1.x
0.2.0 requires a PrePrompt account and no longer uses your own Anthropic key.
Upgrade, re-run preprompt-install (it replaces the old hook and Cursor entry,
which held your key), then sign in:
pip install --upgrade preprompt
preprompt-install
preprompt-login
0.1.x also saved the key in ~/.preprompt/.env. 0.2.0 ignores it; delete that
line.
How it works
Classification runs on your machine: a pure-heuristic scorer, no network call, under 1ms per prompt.
- Clear prompts pass through untouched — nothing is sent anywhere.
- Prompts that look like they contain a secret (API keys, tokens, private keys) are never sent — they pass through unchanged.
- Prompts that need work are sent to PrePrompt's hosted engine, rewritten, and returned. Each delivered rewrite uses one credit.
SCORE REWRITE PROMPT
48 YES write me a middleware that validates tokens and handles refresh
-35 no what is jwt
-45 no thanks
65 YES refactor this to handle edge cases and manage errors properly
-20 no add tests
70 YES implement a rate limiter that tracks requests, manages quotas...
Credits
Rewrites draw from your PrePrompt account's monthly credits — the same pool as the Chrome extension. The free plan includes 30 rewrites/month; paid plans add more. See preprompt.org/pricing.
You are not charged when a prompt passes through, when a secret is detected, when you're signed out or out of credits, or when a rewrite fails.
CLI
preprompt-install # register the hook + MCP server (Claude Code, Cursor)
preprompt-uninstall # remove everything preprompt-install added
preprompt-login # sign in with a PrePrompt access token
preprompt-usage # credits used / remaining this month
preprompt-history # recent prompt events across all sessions
preprompt-stats # rewrite stats (total, intercepted, avg score)
preprompt-test-classifier # see how sample prompts are scored (runs locally)
preprompt-feedback # rate recent rewrites
preprompt-watch # live feed of rewrites in a second terminal
preprompt-clip # rewrite the prompt on your clipboard
preprompt-optimize "..." # rewrite a prompt from the command line
MCP tools
| Tool | Parameters | Returns |
|---|---|---|
optimize_prompt |
user_prompt, conversation_history, turn_number |
{optimized_prompt, was_intercepted, score, reason} |
get_prompt_history |
limit (default 20) |
list of recent prompt events for this session |
get_usage |
— | your plan's credit usage |
Requirements
- Python 3.11+
- A PrePrompt account (preprompt.org)
- Claude Code, Cursor, Windsurf, or Zed
Local history is kept at ~/.preprompt/history.db. See
what's collected and why.
License
Proprietary — © 2026 PrePrompt. All rights reserved. See LICENSE.
Working on PrePrompt itself? Start with AGENTS.md in the repository.
Metadata
Release files for preprompt 0.2.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 | |
|---|---|---|---|
| preprompt-0.2.0.tar.gz | 59.7 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| preprompt-0.2.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 126.6 kB
Release files / preprompt-0.2.0.tar.gz
| Download URL | preprompt-0.2.0.tar.gz |
|---|---|
| Size | 59.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
8fcf51662690e36fb3fd1d5761ef42566d8ba3a7c1cd0793adf87a391c51ecfd
|
|
BLAKE2b-256 checksum How to use checksums |
49a5b41cb7c9414bc259ff6aa5408afd5a1a7629dd39d0e55013223d9a4c83d4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 28, 2026.
Transparency logRelease files / preprompt-0.2.0-py3-none-any.whl
| Download URL | preprompt-0.2.0-py3-none-any.whl |
|---|---|
| Size | 66.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
6c70ad0f77f6b55d48615f5882bf10dbcaaab456d9bbe2c4d90d6b8509576fbc
|
|
BLAKE2b-256 checksum How to use checksums |
b8143caaaf497c61c27ea6cde4b9dc3f870f3d14b8afe075860d336dfc480d33
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 28, 2026.
Transparency log