Skip to main content

PromptTailor

Model-aware prompt rewriting for Claude Code. Write a rough request — get it rewritten the way your current Claude model works best.

한국어 README

Why

Claude Fable 5, Opus 5, Sonnet 5, and Haiku respond best to different prompt styles — Fable wants goals and constraints in prose (no step lists), Opus over-verifies if you tell it to double-check, Haiku wants small numbered steps. PromptTailor keeps these differences as data (model profiles), detects which model you're running, and rewrites your rough request to match — also routing by task intent (fix / build / research / refactor / docs).

Your input language is preserved: English in → English out, Korean in → Korean out.

Example

$ prompt-tailor "fix the login bug asap, users keep getting logged out" --model fable-5

Users are repeatedly logging out unexpectedly. Before fixing, investigate: exact reproduction steps (when and under what conditions does this happen?), when this started, relevant error logs or console messages, and the login/session management code structure.

Once you've identified the reproduction path and root cause, apply the minimum fix to prevent unintended logouts. Scope: session and login logic only — do not modify other features.

Validation: confirm the issue no longer reproduces through direct testing, or verify that related tests pass.

Notice what happened: vague urgency ("asap") became an investigation directive, a scope boundary, and a validation criterion — and nothing was invented. Unknowns become investigation steps; any added specifics are tagged as assumptions.

Install

As a Claude Code plugin (recommended):

/plugin marketplace add Createyouracccount/PromptTailor
/plugin install prompt-tailor@prompt-tailor

This gives you the /pm command with no path setup.

As a CLI / MCP server:

pip install prompt-tailor    # installs `prompt-tailor` and `prompt-tailor-mcp`

Requirements: Python 3.10+, the claude CLI installed and logged in (no separate API key). Verified on macOS/Linux; Windows untested.

Usage

prompt-tailor "rough request" --model fable-5    # rewrite for a target model
prompt-tailor "rough request" --json             # JSON output
prompt-tailor "rough request" --concise          # faster, condensed meta-prompt

Inside Claude Code/pm rough request: rewrites for your session's detected model, shows a one-line change summary, then executes the rewritten request. If /pm reports "Unknown command" (some clients, e.g. the VSCode extension, register plugin commands under their namespace), use /prompt-tailor:pm instead. In auto mode, add the permission rule printed by claude-code/install.sh so prompts containing risky-looking words (e.g. "docker prune") aren't false-positive blocked — the backend only rewrites text.

Hook auto mode (opt-in) — rewrite every prompt automatically via a UserPromptSubmit hook. Run bash claude-code/install.sh for the settings snippet. Escape hatch: include #raw in a prompt to pass it through untouched. Prompts under 6 tokens or over 800 chars are skipped; if a rewrite doesn't finish within 28s it fails open (your original prompt goes through).

Cursor / any MCP client — a built-in stdio MCP server exposes refine_prompt(raw, target_model, concise) and usage_stats (your local record summary, no LLM call):

// ~/.cursor/mcp.json
{ "mcpServers": { "prompt-tailor": { "command": "prompt-tailor-mcp" } } }
# Codex CLI — ~/.codex/config.toml
[mcp_servers.prompt-tailor]
command = "prompt-tailor-mcp"
claude mcp add prompt-tailor -- prompt-tailor-mcp   # register in Claude Code

GUI apps may not see your shell PATH. If the client reports the command not found, use the absolute path from which prompt-tailor-mcp as command, or use python3 with args: ["-m", "prompt_tailor.mcp_server"].

The rewrite itself always runs through the claude CLI, so the machine needs it installed and logged in regardless of which client calls the tool. Rewrites target Claude models; other-model profiles are not provided (or validated).

Same input, different models (real outputs)

Input: 로그인 버그 고쳐줘 ("fix the login bug" — Korean in, Korean out):

target fable-5 target haiku-4-5
Prose: symptoms to identify first, then "find the cause and apply the simplest fix; verify by test or manual check". No step lists. Step 1 locate the bug (error message? where?) → Step 2 fix ([assumption] tagged) → Step 3 test with valid/invalid credentials → deliverable: fixed code + one-line commit message.

Full texts in eval/results.json.

Measured cost (n=2, 2026-08-15)

What you pay Measured
Per rewrite call (haiku) ≈$0.03 API-equivalent · ~1.8k output tokens · 18–33s wall. ~29.5k input tokens, but ~99% is claude -p's own system prompt (cached: ~8k cache-write + ~21.6k cache-read); the meta-prompt itself adds only hundreds
Hook context injection +527 input tokens in your main conversation (measured as token delta), and it stays in history for the rest of the session
Subscription users No per-call bill — it consumes usage quota instead

Raw data: runs/cost_measurement.json, method: eval/measure_cost.py.

Evidence — including the negative result

Every claim is backed by ledgered experiments (blind pairwise LLM judging; LOOP_LOG.md):

  • Prompt quality (golden set of 20 vague requests): 20/20 judged better than the original (clarity 5.0, fidelity 4.8, actionability 5.0) — EVAL.md
  • Model profiles produce structurally different rewrites: 5/5; intent routing beat profile-only meta 4–1–1
  • Task outcome pilot (n=3): the raw prompt won 3–0. On already-clear, self-contained codegen tasks run headless, rewriting hurt: it inflated scope, its investigation directives stalled a run, and its verification demands made the executor fabricate test results — eval/ab_task_outcome_results.json

What this means: the measured benefit is on vague, underspecified requests — the golden set's territory. Already-clear requests should be left alone, so since v0.2.0 the rewriter runs a clarity gate first: if your request is already specific it returns it untouched (action: keep; the hook then injects nothing). Gate accuracy on a balanced 40-prompt benchmark: 39/40 (98%) — vague recall 20/20, clear recall 19/20. Dataset, runner, and the one miss are documented in BENCHMARK.md.

Usage records, privacy, and how to help improve it

Every rewrite path logs one privacy-safe event (action, source, target model, latency, prompt lengthnever prompt text) to ~/.claude/prompt-tailor/usage.jsonl on your machine. Nothing is ever transmitted — there is no telemetry; we cannot see your usage.

prompt-tailor stats           # summarize your own records: keep/rewrite rate, latency, errors
prompt-tailor stats --share   # numbers-only markdown block, safe to paste into an issue

Because there is no telemetry, improvement runs on what you choose to share: if a rewrite hurt (wrong scope, wrong gate decision, invented specifics), file a bad-rewrite report — reports feed the public benchmark and golden set that gate every change.

What we do NOT guarantee

  • Higher task success is not proven. Prompt-quality wins are judge-based; the only outcome data so far is the 3-task pilot above, which the raw prompt won.
  • The rewriter occasionally adds specifics without an [assumption] tag (fidelity 4.8, not 5.0), and can misclassify intent.
  • All experiments are small-n, single-LLM-judge, and were run in this repo's environment.

Development

python3 -m unittest discover tests   # 42 offline tests, no LLM calls
python3 eval/run_eval.py             # golden-set evaluation (spawns claude)

Project docs (Korean): PLAN.md · ARCHITECTURE.md · RESEARCH.md · gate criteria in GATES.md.

License

MIT

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

prompt_tailor-0.2.2.tar.gz (29.2 kB view details)

Uploaded Source

Built Distribution

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

prompt_tailor-0.2.2-py3-none-any.whl (26.1 kB view details)

Uploaded Python 3

File details

Details for the file prompt_tailor-0.2.2.tar.gz.

File metadata

  • Download URL: prompt_tailor-0.2.2.tar.gz
  • Upload date:
  • Size: 29.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for prompt_tailor-0.2.2.tar.gz
Algorithm Hash digest
SHA256 2d95621c0c5ab48aaaf8f46611908c75c9dcad008cfcfdb310911798f38affc3
MD5 e4b876bf4c83a3fd021c13c7614c1cc1
BLAKE2b-256 233b4487f1a7da08745b3b6847590bba3770e37513be96cbca8515fdcaaa9786

See more details on using hashes here.

Provenance

The following attestation bundles were made for prompt_tailor-0.2.2.tar.gz:

Publisher: publish.yml on Createyouracccount/PromptTailor

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

File details

Details for the file prompt_tailor-0.2.2-py3-none-any.whl.

File metadata

  • Download URL: prompt_tailor-0.2.2-py3-none-any.whl
  • Upload date:
  • Size: 26.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for prompt_tailor-0.2.2-py3-none-any.whl
Algorithm Hash digest
SHA256 b79a860c98b717b62a7352427b10135405e02d19236e528ce09cb284b2b9cd51
MD5 37a5e7d69970810942c64c77c1610941
BLAKE2b-256 fdab867daabbdce13acec7f98bfcfb8d0b81023d304cc5ae1e4d3e492900aa2e

See more details on using hashes here.

Provenance

The following attestation bundles were made for prompt_tailor-0.2.2-py3-none-any.whl:

Publisher: publish.yml on Createyouracccount/PromptTailor

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

Release history Release notifications | RSS feed

0.2.4

2 files

0.2.3

2 files

This release

0.2.2 This release

2 files

0.2.1

2 files

0.2.0

2 files

0.1.0

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page