SuperAPI AI Directory

preflight

Catch vague Claude Code prompts before they waste tokens: prompt scorecards, session history search, cross-service contract awareness and cost estimation.

Open website Compare
PricingOpen sourceGitHub 开源项目 · 14 Stars
GitHub stars14GitHub

Sources: GitHub

About this tool

Preflight is an MCP server for Claude Code, providing 24 tools, with the core goal of intercepting vague prompts before they cause token waste. It is built on an analysis of 9 months of real Claude Code usage data (512 sessions, 32,000+ events, 3,200+ prompts, 1,642 commits, 258 subagent spawns), finding that 41% of prompts are fewer than 50 characters, each vague prompt triggers an error-to-correction loop that consumes 2-3 times the tokens, and an estimated 30-40% of tokens are wasted on avoidable back-and-forth communication.

Main capabilities:

  1. Preflight core: a unified preflight_check entry point that automatically classifies prompts and chains the correct checks.
  2. Smart classification: routes prompts via a decision tree (simple → vague → multi-step → cross-service).
  3. Correction pattern learning: remembers past mistakes and issues warnings before repetition.
  4. Cross-service contracts: extracts types, interfaces, routes, and patterns from related projects.
  5. Session history search: semantic search using LanceDB vectors, supporting timeline views and real-time scanning.
  6. Cost estimator: estimates token spending and waste caused by corrections.
  7. 12-category scorecard: evaluates prompt discipline, supporting trend and comparison scorecards, and PDF export.

Usage:

  • Quick start via npx (no installation required), or clone and configure manually, or install globally via npm.
  • Add the configuration to the project's .mcp.json, restart Claude Code, and the tools activate automatically.
  • Use onboard_project to index project history, parse JSONL session files, extract contracts, generate embeddings, and store them in LanceDB.
  • Supports local embeddings (Xenova/all-MiniLM-L6-v2, downloads about 90MB model on first run) or OpenAI embeddings (requires API key).
  • Configuration is done via .preflight/config.yml, .preflight/triage.yml, and .preflight/contracts/*.yml, with environment variables supported as fallback.

Applicable scenarios:

  • Teams or individuals using Claude Code for development who want to reduce token waste caused by vague prompts.
  • NeedA contract-aware development environment for sharing across microservice projects.
  • Users who want to analyze and improve their prompting habits.

Limitations:

  • The project is relatively young and features are still being refined.
  • Local embeddings on first run require downloading about a 90MB model, which may be slow.
  • The CLAUDE_PROJECT_DIR environment variable needs to be set correctly.
  • Some features depend on Playwright for PDF export.
  • Data is kept local by default unless OpenAI embeddings are chosen.