Everything runs locally. Two runtime dependencies. No API keys consumed by the engine itself.
Seven pillars of deterministic prompt governance
0–100 score across five dimensions: clarity, specificity, completeness, constraints, and efficiency.
Deterministic rules catch scope explosion, missing constraints, hallucination risk, and more.
Outputs prompts with role, goal, and constraints — targeting Claude XML, OpenAI system/user, or Markdown.
Multi-stage compression pipeline strips irrelevant content and reports token savings. Zone-aware, preserves structure.
Token and cost estimates across 11 models from 4 providers: Anthropic, OpenAI, Google, and Perplexity.
Ed25519-signed keys verified locally. No accounts, no network calls, no tracking. Your prompts stay private.
import { optimize } — pure functions, zero side effects. Use as a library, not just a server.
Fully offline. Zero LLM calls. Extensively tested. Run the suite yourself to verify.
Every prompt passes through 8 sequential gates. All decisions are deterministic — zero LLM calls, zero randomness.
20 capabilities across every tier — 17 always free, 3 metered. Enterprise governance unlocks with the Enterprise plan.
| # | Capability | Tier | What it does |
|---|---|---|---|
| Core Capabilities | |||
| 1 | Optimize | Metered | Full analysis: score, compile, and estimate cost in one pass. Enterprise: blocked if policy violations are detected in enforce mode |
| 2 | Refine | Metered | Iterate on a result — answer blocking questions or add context to update the compiled output |
| 3 | Approve | Free | Sign off on a result to get the final compiled prompt. Enterprise: blocked on violations or high risk score in enforce mode |
| Analysis & Utilities | |||
| 4 | Estimate Cost | Free | Token count + cost across Anthropic, OpenAI, Google, and Perplexity before you run anything |
| 5 | Compress Context | Free | Shrink long context with a multi-stage heuristic pipeline — no lossy summarization |
| 6 | Quick Check | Free | Instant pass/fail score and top issues — no compilation, no session |
| 7 | Configure | Free Enterprise | Set mode, thresholds, and output target. Enterprise: policy enforcement mode, audit trail, config lock, retention policy |
| 8 | View Usage | Free | Check how many optimizations you've used, your limits, and what's remaining |
| 9 | Usage Stats | Free | Aggregated metrics: average score, top task types, estimated token savings |
| Decision Engine | |||
| 10 | Classify Task | Free | Identify task type, reasoning complexity, risk level, and recommended optimization profile |
| 11 | Route Model | Free | Pick the optimal model for cost, speed, or quality — with a full audit trail of the routing decision |
| 12 | Pre-flight | Metered | One-shot analysis: classify, assess risk, route model, and score quality — before committing to a full optimization |
| Context & Session Management | |||
| 13 | Prune Context | Free | Score and rank context by relevance to the task; optionally remove low-signal sections to save tokens |
| 14 | List Sessions | Free | Browse your optimization history — metadata only, raw prompts never stored in the list |
| 15 | Export Session | Free | Full session export with reproducibility hash. Enterprise: includes policy enforcement data and custom rule metadata |
| 16 | Delete Session | Free | Remove a single session from your history |
| 17 | Purge Sessions | Free | Bulk-clear old sessions by age, with a dry-run preview and keep-last safeguard |
| Account & Licensing | |||
| 18 | Activate License | Free | Enter your Pro, Power, or Enterprise license key to unlock your tier — validated offline, no account required |
| 19 | View License Status | Free | See your current tier, license expiry date, and where to upgrade if needed |
| Enterprise Governance | |||
| 20 | Save Custom Rules | Free Enterprise | Deploy custom governance rules built in the Enterprise Console directly to your Prompt Control Plane |
Every prompt gets a 0–100 score. Each dimension contributes 20 points. After optimization, every prompt scores 90+.
How clearly the intent is stated. Vague terms and short goals lose points.
File paths, code blocks, audience, tone, and platform all add specificity.
Does the prompt define what “done” looks like? Are success criteria present?
Scope limits, forbidden actions, and time budgets protect against scope explosion.
Token budget and repetition. Concise prompts with no duplication score highest.
Example: “Delete all inactive users from production database” — high underspec + constraint risk. In enforce mode (threshold=60), this prompt gets blocked.
Enterprise-only capabilities that turn scoring into enforcement
A browser-based admin panel for managing your entire governance configuration. Build custom rules with a visual editor, toggle policies, configure audit settings, and deploy changes — all gated by your Enterprise license key.
Switch between advisory and enforce mode. In enforce mode, prompts that fail quality rules or exceed risk thresholds are blocked before they reach any LLM. Both built-in and custom rules are enforced.
Configure via Enterprise Console → Advisory warns, Enforce blocks
Lock the governance configuration with a passphrase. Once locked, no settings can be changed until unlocked with the original passphrase. Prevents unauthorized changes to quality thresholds, policy mode, and audit settings.
Passphrase is SHA-256 hashed, never stored in plaintext
Append-only JSONL audit log with SHA-256 hash chaining. Every optimization, approval, deletion, and configuration change is logged. If any entry is modified or deleted, all subsequent hashes break — integrity violation detected.
Local-only, no prompt content stored, privacy-safe
Build up to 25 organization-specific rules in the Enterprise Console with a visual editor. Define match patterns, risk dimensions, severity levels (blocking or non-blocking), and weights. Deploy with one click — rules take effect on the next optimization.
Deploy via the Enterprise Console or CLI
Automatic session cleanup with configurable retention policies. Set how long optimization sessions are kept before they're purged. Supports dry-run to preview what would be deleted before committing.
Configure retention window via Enterprise Console
Block prompts that exceed a risk score threshold based on your strictness setting. Relaxed blocks above 40, Standard above 60, Strict above 75. Risk scores are dimensional — scored across hallucination, scope, constraint, and underspec dimensions.
Three strictness levels: Relaxed, Standard, Strict — each with progressively tighter thresholds
All governance controls are deterministic, offline, and zero-LLM. Configuration changes are audit-logged when the trail is enabled.
See full plan comparison →
PCP classifies prompt complexity and risk, then picks the cheapest model that can still handle the task correctly.
Who benefits from deterministic prompt governance
Score and compile prompts before they reach production. Catch ambiguity that leads to unpredictable LLM output.
Multi-provider cost estimates across 11 models. Know exactly what each prompt will cost before you send it.
Run the CLI as a quality gate. Fail builds when prompt quality drops below your threshold.
Integrates natively with Claude Desktop, Claude Code, Cursor, Windsurf, and any MCP-compatible client.
Context compression strips irrelevant tokens. Tool pruning removes unnecessary tools from the context window.
Enforce prompt quality policies before deployment. Hash-chained audit trail, config lock, and custom rules provide governance without runtime overhead.
Alternatives and their trade-offs
| Method | Pros | Cons |
|---|---|---|
| Manual prompt rewriting | Full control, no tooling needed | Inconsistent quality, not scalable, no scoring |
| Fine-tuning models | Optimized for your domain | Expensive, slow iteration, requires ML expertise |
| Trial-and-error | Quick to start | No structured feedback, wastes tokens, not reproducible |
| Prompt Control Plane | Deterministic scoring, policy enforcement, multi-provider routing, offline, CI/CD ready | Deterministic rules only — no semantic understanding of domain context |
Use as a library — no MCP server required
npm install claude-prompt-optimizer-mcp