
Claude Prompt Optimizer
io.github.rishiatlan由 GitHub 账号 rishiatlan 发布v2.2.2更新于 Oct 24, 2026
Scores, compiles & optimizes prompts for any LLM. Zero AI calls inside. Freemium.
发布方自己的服务:Claude Platform Docs
概览
为 LLM 提示词打分、分类并编译,推荐合适模型并估算成本,全程不调用任何 LLM。
- 可以做什么
- 提供约 20 个提示词质量相关工具:pre_flight 一次完成分类、风险评估、模型路由和质量打分;optimize_prompt 运行完整流程,给出阻塞性问题和编译后的提示词;check_prompt、estimate_cost、compress_context、classify_task、route_model 和 prune_tools 负责更轻量的检查。还可管理会话、用量和许可证状态。所有分析均为确定性、离线完成,服务器内部不调用 LLM。
- 适用场景
- 适合在提示词送入模型前做质量把关,例如在 CI 或编辑器钩子中使用;也适合需要评估模糊提示词、获取模型推荐或估算 token 与成本的场景。
- 运行要求
- 本地需 Node.js 20+ 并支持 ESM;以 npm 包 claude-prompt-optimizer-mcp(也发布为 pcp-engine)通过 stdio 运行。可选环境变量:PROMPT_OPTIMIZER_LOG_LEVEL 和 PROMPT_OPTIMIZER_PRO。更高配额需要 Pro 或 Power 许可证密钥;免费版每月 50 次优化。
安装
在 SourceWeft 中
- 打开 控制台中的 Claude Prompt Optimizer,将其添加到工作区。
- 为需要使用其工具的对话启用该服务。
Desktop only,通过 STDIO。 STDIO 服务会启动本地进程,因此需要 SourceWeft 桌面宿主。
其他 MCP 客户端
参照 仓库 中的启动说明。
README
Prompt Control Plane
The control plane for AI prompts. Score, enforce policy, lock config, and audit every prompt decision. Free tier included.
[CI] [npm version] [Node.js] [TypeScript] [License] [No Dependencies] [npm downloads]
Quick Start
Two powerhouse commands:
Supporting commands:
Free tier gives you 50 optimizations/month to try it out.
Try It
GitHub Action
Full GitHub Action configuration
Run optimize in CI (full pipeline):
This action expects your repo to be checked out (
actions/checkout). Without it, file globs will match nothing.
SHA-pinned example (for enterprise users):
Notes:
- The action installs
pcpvianpm install --prefixinto$RUNNER_TEMP, then runs the binary. Falls back toprompt-lintfor v4 installs. - Action tag
@v5maps to npm@5(latest 5.x). Use@v5.0.0for exact pinning. subcommandinput acceptscheck(default),preflight,optimize, orscore. Usepreflightfor CI gates.comment: 'true'posts results as a PR comment (requirespull-requests: writepermission).- Exit code 2 means no files matched or invalid input: not "all passed." Zero matched files is always an error.
- On Windows runners, prefer single quotes or escape glob wildcards in PowerShell.
- Rule IDs (e.g.,
vague_objective,missing_constraints) are stable: treat as a public contract.
Why This Exists
- Prompts run without any quality check. "Make the code better" gives Claude no constraints, no success criteria, and no target: leading to unpredictable results and wasted compute.
- No structure scoring, no ambiguity detection. Even experienced engineers skip success criteria, constraints, and workflow steps. This linter flags structural gaps before you send.
- Cost is invisible until after you've spent it. Most users have no idea how many tokens their prompt will consume. The linter shows cost breakdowns across 21 costed models from Anthropic, OpenAI, Google, and Perplexity before you commit. Cost estimates are approximate: validate for billing-critical workflows.
- Simple tasks run on expensive models. Without routing intelligence, every prompt goes to the same model. The decision engine classifies complexity and routes simple tasks to cheaper models automatically: reducing LLM spend without changing your prompts.
- Context bloat is the hidden cost multiplier. Sending 500 lines of code when 50 are relevant burns tokens on irrelevant context. The smart compressor runs 5 heuristics (license strip, comment collapse, duplicate collapse, stub collapse, aggressive truncation) with zone protection for code blocks and tables: standard mode is safe, aggressive mode is opt-in.
- Human-in-the-loop approval. The MCP asks blocking questions when your prompt is ambiguous, requires you to answer them before proceeding, and only finalizes the compiled prompt after you explicitly approve. No prompt runs without your sign-off: the gate is enforced in code, not convention.
How It Works
The Approval Loop
Every prompt goes through a mandatory review cycle before it's finalized:
- Analyze: You type a prompt. The MCP scores it, detects ambiguities, and compiles a structured version.
- Ask: If the prompt is vague or missing context, the MCP surfaces up to 3 blocking questions. You answer them via
refine_prompt. - Review: You see the compiled prompt, quality score, cost estimate, and what changed. No surprises.
- Approve: You say "approve" and the compiled prompt is locked in.
approve_prompthard-fails if unanswered blocking questions remain: the gate is enforced in code, not convention.
The MCP is a co-pilot for the co-pilot. It does the structural work (decomposition, gap detection, template compilation, token counting) so Claude can focus on intelligence.
Zero LLM calls inside the MCP. All analysis is deterministic: regex, heuristics, and rule engines. The host Claude provides all intelligence. This means the MCP itself is instant, free, and predictable.
Works for all prompt types: code, writing, research, planning, analysis, communication, data, and more. The pipeline auto-detects 13 task types and adapts scoring, constraints, templates, and model recommendations accordingly. A Slack post gets writing-optimized constraints; a refactoring task gets code safety guardrails. Intent-first detection classifies prompts about technical topics that request non-code work correctly: the opening verb phrase takes priority over technical keywords in the body.
Benchmarks
Real results from the deterministic pipeline. PCP scores the input prompt quality, not the compiled output: the compiled prompt gets a structural checklist instead:
Score = input prompt quality (0-100). Confidence = how much improvement to expect (high = prompt is weak, lots of room; low = prompt is already strong). Compiled output gets a structural checklist (e.g. 7/9 elements present), not an inflated numeric score. Vague prompts get blocked with targeted questions. Well-specified prompts get compiled with safety constraints, workflow steps, and model routing: all deterministically, with zero LLM calls.
Features
CLI (pcp)
The pcp command exposes the full scoring, routing, and policy engine from the terminal.
Exit codes: 0 = success, 1 = threshold fail (check/doctor), 2 = input error, 3 = policy blocked (enforce mode).
All subcommands: preflight, optimize, check, score, benchmark, demo, badge, report, classify, route, cost, compress, config, doctor, hook.
CI flags: --format github (PR annotations), --warn-only (advisory mode, always exit 0), --output <dir> (report destination).
Global flags: --json, --quiet, --pretty, --target, --file, --context, --context-file, --intent, --strict, --relaxed, --threshold.
Backward compat:
prompt-lintstill works and maps topcp check.
Auto-Check Hooks
Hooks automatically check every prompt before it reaches the LLM. Works with any MCP client that supports UserPromptSubmit hooks: Claude Code, Cursor, Windsurf, and others.
When a prompt scores below the threshold, inline feedback is injected into the conversation context. Prompts above the threshold pass through silently. Hooks respect the same governance config that the CLI and MCP read.
Install
Requires Node.js 20+ with ESM support. Pick one method: 30 seconds or less.
Free tier gives you 50 optimizations/month to try it out.
Add MCP integration (optional: for AI-assisted workflows)
Add to your project's .mcp.json (or ~/.claude/settings.json for global access) to use inside Claude Code, Cursor, or Windsurf:
Restart your MCP client. All 20 tools appear automatically.
Claude Desktop config path:
- macOS:
~/Library/Application Support/Claude/claude_desktop_config.json - Windows:
%APPDATA%\Claude\claude_desktop_config.json
From source (for contributors)
Programmatic API
Use the linter as a library in your own Node.js code: no MCP server needed.
The optimize() function runs the exact same pipeline as the optimize_prompt MCP tool. Pure, synchronous, deterministic.
API Exports
Targets: 'claude' (XML), 'openai' (System/User), 'generic' (Markdown). Default is 'claude'.
ESM only. This package requires Node 20+ with ESM support.
importworks;require()does not. The./serversubpath starts the MCP stdio transport as a side effect: use it only for MCP server startup.
Usage
20 Capabilities
Pricing
Free tier gives you 50 optimizations/month to experience the full pipeline. No credit card required.
Enterprise includes unlimited usage, custom integrations, and dedicated support. Contact sales for pricing and details.
Activate a License
- Free: No action needed: you get 50 optimizations/month immediately.
- Pro/Power: Purchase at the Prompt Control Plane store and you receive a license key starting with
pcp_... - Tell Claude: "Use set_license with key: pcp_YOUR_KEY_HERE"
- Done: your tier upgrades instantly. Verify with
license_status. - Enterprise: Contact sales for custom license key generation.
Enterprise Features
Enterprise features are gated by an Enterprise license key. All features below are managed through the Enterprise Console: a web-based admin interface with one-click toggles.
Enterprise Console
A browser-based admin panel that provides full visibility and control over your Prompt Control Plane deployment. Requires an Enterprise license key to access. Configure policies, build custom rules, manage audit settings, and deploy governance changes: all without touching configuration files.
Policy Enforcement
Switch from advisory to enforce mode. In enforce mode, BLOCKING rules (built-in + custom) gate every prompt optimization and approval. Risk threshold gating blocks high-risk approvals based on strictness level (relaxed, standard, strict). All blocked actions include the specific violation details.
Policy-Locked Configuration
Lock your governance settings so no one can change policy, strictness, or audit settings without the correct passphrase. Every lock, unlock, and blocked attempt is audit-logged. When activated through the Enterprise Console, the lock passphrase is auto-derived from your license key.
Hash-Chained Audit Trail
Every governance action generates a JSONL audit entry with integrity verification. Each entry is hash-chained to its predecessor: if any line is deleted or modified, all subsequent hashes break, making unauthorized changes detectable. Local-only, opt-in, never stores prompt content.
Custom Governance Rules
Build custom regex-based rules in the Enterprise Console with a visual editor. Define match patterns, negative patterns, risk dimensions, severity levels (BLOCKING or NON-BLOCKING), and risk weights. Deploy rules directly to your Prompt Control Plane with one click via the save_custom_rules tool: they take effect on the next optimization. Up to 25 rules per deployment.
Session & Data Lifecycle
Purge only affects session data. Configuration, audit log, license, usage data, and custom rules are never deleted.
Reproducible Session Exports
Every session export includes rule_set_hash, rule_set_version, risk_score, and policy_hash: enabling full reproducibility. Given the same prompt, configuration, and rules, the output is identical. Any change to rules or policy produces a different hash.
Preflight Pipeline
All v3 outputs are deterministic, offline, and reproducible: no LLM calls are made inside the MCP. Risk score (0-100) drives routing decisions; riskLevel (low / medium / high) is derived for display only.
The pre_flight tool runs the full decision pipeline in a single call: classify your prompt, assess risk, route to the optimal model, and score quality. No compilation, no approval loop: just instant intelligence about what your prompt needs.
pre_flight counts as 1 metered optimization use (same quota as optimize_prompt). It does not call optimize_prompt internally: no double-metering. classify_task and route_model are always free and unlimited.
Model Routing
The route_model tool recommends the optimal model using a 2-step deterministic process:
Step 1: Pick tier from complexity + risk:
Step 2: Apply overrides:
budgetSensitivity=high→ downgrade one tierlatencySensitivity=high→ prefer smaller models within tier- Research intent detected → recommend Perplexity (Sonar / Sonar Pro / Sonar Reasoning Pro)
Google and Perplexity are first-class provider targets for cost and routing. Their compiled prompt output uses generic Markdown because PCP only emits native provider envelopes for Claude XML and OpenAI system/user prompts.
Every decision is recorded in decision_path for full auditability. All tool outputs include schema_version: 1 for forward-compatible versioning.
Optimization Profiles
5 built-in presets that configure routing defaults. Explicit inputs always override profile defaults.
Quality Scoring System
Prompts are scored 0-100 across multiple weighted dimensions. Each deduction is traceable: you'll see exactly why your score dropped and what to fix.
Scoring adapts to task type: code tasks reward file paths and code references; writing/communication tasks reward audience, tone, platform, and length constraints.
The confidence level shows how much improvement to expect: high means significant structural gains, medium means targeted refinements, low means the prompt is already strong.
Ambiguity Detection Rules
Multiple deterministic rules (regex + keyword matching) catch common prompt weaknesses. No LLM calls. Rules are task-type aware: code-only rules skip for writing/research tasks, prose-only rules skip for code tasks.
What gets detected:
- Vague objectives without specific targets
- Missing file paths or function references in code tasks
- Scope explosion ("do everything") without clear boundaries
- High-risk domains (auth, payment, database) without constraints
- Missing audience for writing/communication tasks
- Hallucination risk (ungrounded generation without sources)
- Agent tasks without safety constraints or stopping criteria
- Contradictory instructions
- Token budget mismatches
Hard caps: max 3 blocking questions per cycle, max 5 assumptions shown.
Compiled Prompt Format (XML-tagged)
The default output format is an XML-tagged structure optimized for Claude:
Every compiled prompt gets: role, goal, definition of done, constraints (including universal safety defaults), task-specific workflow, output format, and an uncertainty policy.
Cost Estimation Details
Token estimation uses a standard word-based approximation calibrated against real-world tokenizer behavior.
Output tokens are estimated based on task type:
- Questions: min(input, 500): short answers
- Reviews: min(input × 0.5, 2000): structured feedback
- Debug: min(input × 0.7, 3000): diagnosis + fix
- Code changes: min(input × 1.2, 8000): code + explanation
- Creation: min(input × 2.0, 12000): full implementation
- Writing/Communication: min(input × 1.5, 4000): prose generation
- Research: min(input × 2.0, 6000): findings + sources
- Planning: min(input × 1.5, 5000): structured plan
- Analysis: min(input × 1.2, 4000): insights + data
- Data: min(input × 0.8, 3000): transformations
Model recommendation logic:
- Haiku: questions, simple reviews, data transformations (fast, cheap)
- Sonnet: writing, communication, research, analysis, standard code changes (best balance)
- Opus: high-risk tasks, complex planning, large-scope creation/refactoring (maximum capability)
Pricing is based on published rates from Anthropic, OpenAI, Google, and Perplexity: kept up to date with each release.
Session & Storage
Sessions and usage data are persisted to ~/.prompt-control-plane/ (file-based storage). Sessions have a 30-minute TTL and auto-cleanup on access.
Each session tracks:
- Raw prompt and context
- Intent spec (decomposed intent)
- Compiled prompt
- Quality scores (before/after)
- Cost estimate
- User answers to questions
- State (ANALYZING → COMPILED → APPROVED)
Storage also tracks:
- Usage counters (lifetime + monthly with calendar-month reset)
- License data (Ed25519 validated, tier, expiry)
- Configuration (mode, threshold, strictness, target)
- Aggregate statistics (total optimized, score averages, cost savings)
Examples
Example 1: Vague Prompt Detection
Example 2: Well-Specified Prompt
Example 3: Multi-Task Overload
Example 4: Cost Estimation
Example 5: Context Compression
Example 6: Full Refine Flow
Example 7: Writing Task (Slack Post)
Example 8: Research Task (Redis and Memcached)
Example 9: Planning Task (REST → GraphQL Roadmap)
Security & Privacy Posture (Offline-First)
- Offline-first by default: the core optimizer runs locally and does not require network access.
- Deterministic and reproducible: given the same inputs, version, and configuration, outputs are stable. All heuristics and pruning decisions are deterministic (no randomness, no runtime learning). Session exports include
rule_set_hash(SHA-256 of all built-in rules) andrule_set_versionfor full reproducibility: any rule change produces a different hash. - No LLM calls inside the MCP: compression, tool pruning, and risk scoring are local transforms.
- No telemetry: the core engine does not send usage or prompt data anywhere.
- Local-only state: persisted artifacts (sessions, usage, config, stats, license) live under
~/.prompt-control-plane/. - Aggressive compression is opt-in:
mode=aggressivemay truncate the middle of context to fit a token budget; standard mode never truncates the middle. - Optional integrations: any network calls (e.g., cost lookups for external providers) occur only when an integration tool is explicitly invoked.
- License validation: Ed25519 asymmetric signatures. Public key only in the package. No PII in the key.
chmod 600on POSIX (best-effort). - Prompt logging: disabled by default. Opt-in via
PROMPT_CONTROL_PLANE_LOG_PROMPTS=true. Never enable in shared environments. - Dependencies: 3 runtime:
@modelcontextprotocol/sdk,zod, andfast-glob. No transitive bloat.
Troubleshooting
Roadmap
- Core prompt optimizer with 5 MCP tools (v1.0)
- Deterministic ambiguity detection rules (task-type aware)
- Quality scoring (0-100) with before/after delta
- Cost estimation with per-model breakdown (Anthropic, OpenAI, Google)
- Context compression
- Session-based state with sign-off gate
- Universal task type support: 13 types (code, writing, research, planning, analysis, communication, data)
- Task-type-aware pipeline (scoring, constraints, model recommendations adapt per type)
- Intent-first detection: prevents topic and task misclassification for technical writing prompts
- Answered question carry-forward: refine flow no longer regenerates already-answered blocking questions
- NPM package:
npx pcp-enginefor zero-friction install - Structured audience/tone/platform detection: 19 audience patterns, 9 platforms, tone signals
- Multi-LLM output targets: Claude (XML), OpenAI (system/user), Generic (Markdown)
- Persistent file-based storage (
~/.prompt-control-plane/) - 3-tier freemium system: Free (50/mo), Pro ($6/mo, 100/mo), Power ($11/mo, unlimited)
- Ed25519 offline license key activation: no phone-home, no backend
- Monthly usage enforcement with calendar-month reset
- Rate limiting: tier-keyed sliding window (5/30/60 per minute)
- v2.0 11 MCP tools including
check_prompt,configure_optimizer,get_usage,prompt_stats,set_license,license_status - Usage metering, statistics tracking, and cost savings aggregation
- Programmatic API:
import { optimize } from 'pcp-engine'for library use - Dual entry points:
"."(API) +"./server"(MCP server) - Curl installer:
curl -fsSL .../install.sh | bash - Razorpay checkout integration: tier-specific purchase URLs
- v3.0 Decision Engine: complexity classifier, 5 optimization profiles, model routing with decision_path, risk scoring (0-100), Perplexity routing
- 3 new tools:
classify_task,route_model,pre_flight(14 total in v3.0) - v3.1 Smart Compression: multi-stage pipeline with zone protection, standard/aggressive modes
- v3.1 Tool Pruning: task-aware relevance scoring, mention protection, always-relevant tools
- v3.1 Expanded ambiguity detection: hallucination risk, agent underspec, conflicting constraints, token budget mismatch
- v3.1 Pre-flight deltas: compression savings surfaced when context provided
- v3.2.0 Enterprise Unlock: 4-tier system with Enterprise (unlimited, 120/min, dedicated support), contact form, updated gating
- v3.2.1 Custom Rules: user-defined regex rules in
~/.prompt-control-plane/custom-rules/, risk dimension integration, CLI validation - v3.2.1 Reproducible Exports: auto-calculated
rule_set_hash,rule_set_version,risk_scorein session exports: no placeholders - v3.3.0 Enterprise Operations: policy enforcement, config lock mode, hash-chained audit trail, session lifecycle management
- 20 capabilities including custom governance rules (Enterprise), comprehensive test suite
- v5.0.0 Full CLI suite: 11 subcommands (
pcp preflight,optimize,check,score,classify,route,cost,compress,config,doctor,hook), consistent JSON envelope, policy enforcement (exit 3) - Auto-check hooks:
pcp hook install/uninstall/status: silently checks every prompt before it reaches the LLM - Optional Haiku pass for nuanced ambiguity detection
- Prompt template library (common patterns)
- Always-on mode for Power tier (auto-optimize every prompt)
Contributors
- @aish-varya: audience/tone/platform detection, goal enrichment,
generic_vague_askrule, CLI flags (PR #1)
Credits
Built on the Model Context Protocol by Anthropic.
License
Elastic License 2.0 (ELv2): use, modify, and redistribute freely. You may not offer it as a competing hosted service or remove the license key system.
来源:README.md,提交 76b49b9
工具
0版本历史
1- v2.2.2最新Sep 16, 2026
评分
已满足适用检查项的 40%
该评分衡量此收录条目的完整程度,依据注册中心条目、端点与公开来源计算得出。它不是对服务器本身的评价,也不表示服务器安全或当前可用:可连通性是带日期的检查结果,评分也不包含安装量或用户评价。
- 近 30 天内可连通25 分
请保持端点能够响应 MCP 握手;SourceWeft 每 30 天探测一次。
- 已声明认证方式10 分
请在注册中心条目中声明凭据请求头,或保持端点能够响应探测,以便判定其认证方式。
- 已列出工具15 分
请让服务器在无凭据时响应 tools/list,或发布可在沙箱中无凭据启动的软件包。
- 描述必需15 分
- 图标10 分
- 文档15 分
- 许可证10 分
请在仓库或注册中心条目中声明许可证。
其他 Claude 集成
Claude Platform Docs
com.claude.platform官方发布者
远程 MCP 服务器,让助手搜索并阅读 Claude 平台文档与 API 参考。

Insta Edits for Claude
由 GitHub 账号 faisalkhanzemi 发布
让 Claude 驱动 Mac 版 Instagram Edits 完整 274 个工具编辑器的桥接服务,并随项目打开同步工具列表。

Claude Checkpoint Mcp
由 GitHub 账号 daniel-munoz 发布
本地 MCP 服务器,把 Claude Code 会话状态保存为项目内的检查点文件,并可重新加载为精简的续接摘要。

Qwen DAP MCP — C/C++ Debugger for Claude Code, Codex & Qwen
由 GitHub 账号 spk-c 发布
通过 GDB、LLDB 和 MCP 为 Claude Code、Codex 和 Qwen 提供 C/C++ 崩溃、挂起和转储调试AI 翻译

AVE for Claude Code — Local Video Editing
由 GitHub 账号 lemberalla 发布
仅适用于 Claude Code 的本地 AVE 时间线编辑与导出。需要现有 AVE 连接。AI 翻译