
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 或編輯器 hook 中使用;也適合需要評估模糊提示詞、取得模型建議或估算 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 翻譯