preflight-dev/preflight

πŸ€– Coding Agents
0 Views
0 Installs

πŸ“‡ 🏠 🍎 πŸͺŸ 🐧 - 24-tool MCP server for Claude Code that catches vague prompts before they waste tokens. Includes 12-category prompt scorecards, session history search with LanceDB vectors, cross-service contract awareness, correction pattern learning, and cost estimation.

Quick Install

One-Click IDE Configuration
claude_desktop_config.json
{
  "mcpServers": {
    "preflight-dev-preflight": {
      "command": "npx",
      "args": [
        "-y",
        "preflight-dev-preflight"
      ]
    }
  }
}
Or

Using an AI coding agent (Claude Code, Cursor, etc.)? Copy a ready-made prompt that tells it to fetch the setup instructions and install this server for you.

Documentation Overview

✈️ preflight

Stop burning tokens on vague prompts.

A 24-tool MCP server for Claude Code that catches ambiguous instructions before they cost you 2-3x in wrong→fix cycles — plus semantic search across your entire session history, cross-service contract awareness, and 12-category scorecards.

TypeScript MCP License: MIT npm Node 18+

Quick Start Β· How It Works Β· Tool Reference Β· Configuration Β· Scoring


What's New in v3.2.0

  • Unified preflight_check entry point β€” one tool that triages every prompt and chains the right checks automatically
  • Smart triage classification β€” routes prompts through a decision tree (trivial β†’ ambiguous β†’ multi-step β†’ cross-service)
  • Correction pattern learning β€” remembers past mistakes and warns you before repeating them
  • Cross-service contracts β€” extracts types, interfaces, routes, and schemas across related projects
  • .preflight/ config directory β€” team-shareable YAML config for triage rules and thresholds
  • Trend & comparative scorecards β€” weekly/monthly trend lines, cross-project comparisons, radar charts, PDF export
  • Cost estimator β€” estimates token spend and waste from corrections

The Problem

We built this after analyzing 9 months of real Claude Code usage β€” 512 sessions, 32,000+ events, 3,200+ prompts, 1,642 commits, and 258 sub-agent spawns across a production Next.js/Prisma/Supabase app. The findings were brutal:

  • 41% of prompts were under 50 characters β€” things like fix the tests, commit this, remove them
  • Each vague prompt triggers a wrongβ†’fix cycle costing 2-3x tokens
  • ~33K characters/day duplicated from repeated context pastes
  • 124 corrections logged β€” places where Claude went the wrong direction and had to be steered back
  • 94 context compactions from unbounded session scope blowing past the context window
  • Estimated 30-40% of tokens wasted on avoidable back-and-forth

The pattern is always the same: vague prompt β†’ Claude guesses β†’ wrong output β†’ you correct β†’ repeat. That's your money evaporating.

The Solution

24 tools in 5 categories that run as an MCP server inside Claude Code:

CategoryToolsWhat it does
✈️ Preflight Core1Unified entry point β€” triages every prompt, chains the right checks automatically
🎯 Prompt Discipline12Catches vague prompts, enforces structure, prevents waste
πŸ” Timeline Intelligence4LanceDB vector search across months of session history
πŸ“Š Analysis & Reporting4Scorecards, cost estimation, session stats, pattern detection
βœ… Verification & Hygiene3Type-check, test, audit, and contract search

Before / After

❌  "fix the auth bug"
     β†’ Claude guesses which auth bug, edits wrong file
     β†’ You correct it, 3 more rounds
     β†’ 12,000 tokens burned

βœ…  preflight intercepts β†’ clarify_intent fires
     β†’ "Which auth bug? I see 3 open issues:
        1. JWT expiry not refreshing (src/auth/jwt.ts)
        2. OAuth callback 404 (src/auth/oauth.ts)
        3. Session cookie SameSite (src/middleware/session.ts)
        Pick one and I'll scope the fix."
     β†’ 4,000 tokens, done right the first time

Quick Start

Option A: npx (fastest β€” no install)

claude mcp add preflight -- npx -y preflight-dev-serve

With environment variables:

claude mcp add preflight \
  -e CLAUDE_PROJECT_DIR=/path/to/your/project \
  -- npx -y preflight-dev-serve

Option B: Clone & configure manually

git clone https://github.com/TerminalGravity/preflight.git
cd preflight && npm install

Add to your project's .mcp.json:

{
  "mcpServers": {
    "preflight": {
      "command": "npx",
      "args": ["tsx", "/path/to/preflight/src/index.ts"],
      "env": {
        "CLAUDE_PROJECT_DIR": "/path/to/your/project"
      }
    }
  }
}

Restart Claude Code. The tools activate automatically.

Option C: npm (global)

npm install -g preflight-dev
claude mcp add preflight -- preflight-dev-serve

Note: preflight-dev runs the interactive setup wizard. preflight-dev-serve starts the MCP server β€” that's what you want in your Claude Code config.


How It Works

The Triage Decision Tree

Every prompt flows through a classification engine before any work begins. This is the actual decision tree from src/lib/triage.ts:

flowchart TD
    A[Prompt Arrives] --> B{Skip keyword?}
    B -->|Yes| T1[βœ… TRIVIAL]
    B -->|No| C{Multi-step indicators?}
    C -->|Yes| MS[πŸ”Ά MULTI-STEP]
    C -->|No| D{Cross-service keywords?}
    D -->|Yes| CS[πŸ”— CROSS-SERVICE]
    D -->|No| E{always_check keyword?}
    E -->|Yes| AM1[⚠️ AMBIGUOUS]
    E -->|No| F{"< 20 chars + common cmd?"}
    F -->|Yes| T2[βœ… TRIVIAL]
    F -->|No| G{"< 50 chars, no file refs?"}
    G -->|Yes| AM2[⚠️ AMBIGUOUS]
    G -->|No| H{Vague pronouns or verbs?}
    H -->|Yes| AM3[⚠️ AMBIGUOUS]
    H -->|No| CL[βœ… CLEAR]

    style T1 fill:#2d6a4f,color:#fff
    style T2 fill:#2d6a4f,color:#fff
    style CL fill:#2d6a4f,color:#fff
    style AM1 fill:#e9c46a,color:#000
    style AM2 fill:#e9c46a,color:#000
    style AM3 fill:#e9c46a,color:#000
    style CS fill:#457b9d,color:#fff
    style MS fill:#e76f51,color:#fff

Each level triggers different tool chains:

LevelWhat firesExample prompt
TrivialNothing β€” pass throughcommit
ClearFile verification onlyfix null check in src/auth/jwt.ts line 42
AmbiguousClarify intent + git state + workspace prioritiesfix the auth bug
Cross-serviceClarify + search related projects + contractsadd tiered rewards
Multi-stepClarify + scope + sequence + checkpointsrefactor auth to OAuth2 and update all consumers

Additionally, correction pattern matching can boost any triage level. If your prompt matches 2+ keywords from a previously logged correction, it's bumped to at least ambiguous β€” even if it would otherwise pass through.

Data Flow

flowchart LR
    A[User Prompt] --> B[Triage Engine]
    B --> C[Tool Chain]
    C --> D[Response]

    B -.-> E[".preflight/\nconfig.yml\ntriage.yml"]
    B -.-> F["Patterns\nLog"]
    C -.-> G["LanceDB\n(per-project)"]
    C -.-> H["Contracts\n(per-project)"]
    G -.-> I["~/.claude/projects/\n(session JSONL)"]

    style A fill:#264653,color:#fff
    style B fill:#2a9d8f,color:#fff
    style C fill:#e9c46a,color:#000
    style D fill:#e76f51,color:#fff

Session Data Structure

Claude Code stores session data as JSONL files:

~/.claude/projects/<encoded-path>/
β”œβ”€β”€ <session-uuid>.jsonl              # Main session
β”œβ”€β”€ <session-uuid>/
β”‚   └── subagents/
β”‚       └── <sub-uuid>.jsonl          # Sub-agent sessions

Each JSONL line is an event. The session parser extracts 8 event types:

Event TypeSourceWhat it captures
promptuser messagesWhat the dev typed
assistantassistant messagesClaude's text response
tool_callassistant tool_use blocksTool invocations (Read, Write, Bash, etc.)
sub_agent_spawnTask/dispatch_agent tool_useWhen Claude delegates to a sub-agent
correctionuser messages after assistantDetected via negation patterns (no, wrong, actually, undo…)
compactionsystem messagesContext was compressed (session hit token limit)
errortool_result with is_errorFailed operations
commitgit log integrationCommits made during session

LanceDB Schema

Events are stored in per-project LanceDB databases with vector embeddings for semantic search:

~/.preflight/projects/<sha256-12-char>/
β”œβ”€β”€ timeline.lance/       # LanceDB vector database
β”œβ”€β”€ contracts.json        # Extracted API contracts
└── meta.json             # Project metadata

Table: events
β”œβ”€β”€ id: string            (UUID)
β”œβ”€β”€ content: string       (event text)
β”œβ”€β”€ content_preview: string (first 200 chars)
β”œβ”€β”€ vector: float32[384]  (Xenova/all-MiniLM-L6-v2) or float32[1536] (OpenAI)
β”œβ”€β”€ type: string          (event type from above)
β”œβ”€β”€ timestamp: string     (ISO 8601)
β”œβ”€β”€ session_id: string    (session UUID)
β”œβ”€β”€ project: string       (decoded project path)
β”œβ”€β”€ project_name: string  (short name)
β”œβ”€β”€ branch: string        (git branch at time of event)
β”œβ”€β”€ source_file: string   (path to JSONL file)
β”œβ”€β”€ source_line: number   (line number in JSONL)
└── metadata: string      (JSON β€” model, tool name, etc.)

The project registry at ~/.preflight/projects/index.json maps absolute paths to their SHA-256 hashes.

Contract Extraction

The contract extractor scans your project for API surfaces:

PatternWhat it finds
export interface/type/enumTypeScript type definitions
export function GET/POST/…Next.js API routes
router.get/post/…Express route handlers
model Foo { … }Prisma models and enums
OpenAPI/Swagger specsRoutes and schema components
.preflight/contracts/*.ymlManual contract definitions

Contracts are stored per-project and searched across related projects during cross-service triage.


Onboarding a Project

Run onboard_project to index a project's history. Here's what happens:

  1. Discovers sessions β€” finds JSONL files in ~/.claude/projects/<encoded-path>/, including subagent sessions
  2. Parses events β€” extracts the 8 event types from each session file (streams files >10MB)
  3. Extracts contracts β€” scans source for types, interfaces, enums, routes, Prisma models, OpenAPI schemas
  4. Loads manual contracts β€” merges any .preflight/contracts/*.yml definitions (manual wins on name conflicts)
  5. Generates embeddings β€” local Xenova/all-MiniLM-L6-v2 by default (~90MB model download on first run, ~50 events/sec) or OpenAI if OPENAI_API_KEY is set (~200 events/sec)
  6. Stores in LanceDB β€” per-project database at ~/.preflight/projects/<sha256-12>/timeline.lance/
  7. Updates registry β€” records the project in ~/.preflight/projects/index.json

No data leaves your machine unless you opt into OpenAI embeddings.

After onboarding, you get:

  • πŸ”Ž Semantic search β€” "How did I set up auth middleware last month?" actually works
  • πŸ“Š Timeline view β€” see what happened across sessions chronologically
  • πŸ”„ Live scanning β€” index new sessions as they happen
  • πŸ”— Cross-service search β€” query across related projects

Tool Reference

✈️ Preflight Core

ToolWhat it does
preflight_checkThe main entry point. Triages your prompt (trivial β†’ multi-step), chains the right checks automatically, matches against known correction patterns. Accepts force_level override: skip, light, full.

🎯 Prompt Discipline

ToolWhat it does
scope_workCreates structured execution plans before coding starts
clarify_intentGathers project context (git state, workspace docs, ambiguity signals) to disambiguate vague prompts
enrich_agent_taskEnriches sub-agent tasks with file paths, patterns, and cross-service context
sharpen_followupResolves "fix it" / "do the others" to actual file targets
token_auditDetects waste patterns, grades your session A–F
sequence_tasksOrders tasks by dependency, locality, and risk
checkpointSave game before compaction β€” commits + resumption notes
check_session_healthMonitors uncommitted files, time since commit, turn count
log_correctionTracks corrections and identifies recurring error patterns
check_patternsChecks prompts against learned correction patterns β€” warns about known pitfalls
session_handoffGenerates handoff briefs for new sessions
what_changedSummarizes diffs since last checkpoint

πŸ” Timeline Intelligence

ToolWhat it does
onboard_projectIndexes a project's session history + contracts into per-project LanceDB
search_historySemantic search with scope: current project, related, or all indexed projects
timelineChronological view of events across sessions
scan_sessionsLive scanning of active session data

πŸ“Š Analysis & Reporting

ToolWhat it does
generate_scorecard12-category report card β€” session, trend (week/month), or cross-project comparative. Radar chart SVG, PDF or markdown.
estimate_costToken usage, dollar cost, waste from corrections, preflight savings
session_statsLightweight session analysis β€” no embeddings needed
prompt_scoreGamified A–F grading on specificity, scope, actionability, done-condition

βœ… Verification & Hygiene

ToolWhat it does
verify_completionRuns type check + tests + build before declaring done
audit_workspaceFinds stale/missing workspace docs vs git activity
search_contractsSearch API contracts, types, and schemas across current and related projects

Usage Examples

Real prompts you'd type in Claude Code once preflight is installed. The tools fire automatically via preflight_check, or you can call them directly.

Catch a vague prompt before it wastes tokens

> fix the auth bug

preflight_check intercepts β†’ clarify_intent fires:
  "I found 3 auth-related recent changes:
   1. JWT refresh logic in src/auth/jwt.ts (modified 2h ago)
   2. OAuth callback route in src/routes/oauth.ts (3 open TODOs)
   3. Session middleware in src/middleware/auth.ts (failing test)
   Which one? Or describe the symptoms."

Scope a multi-step task before starting

> refactor the database layer to use Drizzle instead of Prisma

preflight_check triages as MULTI-STEP β†’ scope_work + sequence_tasks fire:
  Phase 1: Install drizzle-orm, create schema (src/db/schema.ts)
  Phase 2: Migrate queries in src/services/ (12 files)
  Phase 3: Update tests (8 files reference prisma mocks)
  Phase 4: Remove prisma dependencies, delete prisma/ dir
  Estimated: 4 checkpoints, ~45 min

Search your session history

> use search_history to find how I set up the rate limiter

Searches LanceDB across your indexed sessions:
  Found 3 relevant events (similarity > 0.82):
  - Session abc123 (Jan 15): Added express-rate-limit to src/middleware/
  - Session def456 (Jan 16): Configured per-route limits in src/routes/api.ts
  - Session ghi789 (Feb 2): Fixed rate limit bypass via X-Forwarded-For

Grade your prompting habits

> use prompt_score on "update the thing"

  Grade: D
  - Specificity: 1/5 β€” no file paths, no identifiers
  - Scope: 1/5 β€” "the thing" is completely ambiguous
  - Actionability: 2/5 β€” "update" is vague (refactor? fix? add feature?)
  - Done-condition: 0/5 β€” no way to know when it's done
  Suggestion: "Update the price formatter in src/utils/currency.ts
  to handle JPY (zero-decimal currency)"

Check session health mid-work

> use check_session_health

  ⚠️ 47 uncommitted files (last commit: 38 min ago)
  ⚠️ 23 turns since last checkpoint
  πŸ’‘ Consider running `checkpoint` before context compaction hits

Get a cost estimate

> use estimate_cost

  This session: ~$2.40 (148K tokens)
  Waste from corrections: ~$0.85 (3 wrong→fix cycles)
  Preflight savings: ~$1.20 (4 vague prompts caught early)
  Net: saving roughly 35% vs unchecked prompting

The 12-Category Scorecard

generate_scorecard evaluates your prompt discipline across 12 categories. Each one measures something specific about how you interact with Claude Code:

#CategoryWhat it measuresHow it scores
1PlansDo you start sessions with a plan?% of sessions where the first 3 prompts include file references and >100 chars
2ClarificationAre your prompts specific?% of user prompts containing file paths or specific identifiers
3DelegationAre sub-agent tasks well-defined?% of sub-agent spawns with >200 char descriptions
4Follow-up SpecificityDo follow-ups reference files?% of follow-up prompts (after assistant response) with file refs or β‰₯50 chars
5Token EfficiencyHow many tool calls per file?Ratio of tool_calls to unique files touched (ideal: 5-10 calls/file)
6SequencingDo you stay focused or context-switch?Topic switch rate β€” how often prompts jump between different directory areas
7Compaction ManagementDo you commit before compaction?% of compaction events preceded by a commit within 10 messages
8Session LifecycleDo you commit regularly?% of sessions with healthy commit frequency (every 15-30 min)
9Error RecoveryHow quickly do you recover from mistakes?Correction rate (% of messages) + recovery speed (within 2 messages)
10Workspace HygieneDo you maintain workspace docs?Baseline 75 + bonus for sessions referencing .claude/ or CLAUDE.md
11Cross-Session ContinuityDo new sessions read context?% of sessions where first 3 tool calls read project context docs
12VerificationDo you test at the end?% of sessions that ran tests/build/lint in the final 10% of events

Report Types

TypeWhat you get
ScorecardSingle-period snapshot with 12 categories, radar chart, best/worst highlights
TrendWeekly or monthly trend line, per-category movement, top 3 improvement areas, best/worst prompts
ComparativeSide-by-side across multiple projects, cross-project pattern detection

All three support PDF export (requires Playwright) and historical baselines that track your rolling averages over time.


Cross-Service Awareness

Preflight understands that microservices share contracts. When your prompt mentions a keyword from a related project, triage escalates to cross-service and searches those projects for relevant context.

Setup

Option 1: .preflight/config.yml (recommended β€” committed to repo)

# my-api/.preflight/config.yml
related_projects:
  - path: /Users/jack/Developer/auth-service
    alias: auth-service
  - path: /Users/jack/Developer/notifications
    alias: notifications
  - path: /Users/jack/Developer/shared-types
    alias: shared-types

Option 2: Environment variable (per-user)

PREFLIGHT_RELATED=/path/to/auth-service,/path/to/notifications

How it works

  1. You type: "add rewards tier validation"
  2. Triage detects rewards matches always_check keyword β†’ ambiguous
  3. Cross-service keywords (auth, notification) don't match, but if you had typed "add rewards with auth check" β†’ cross-service
  4. Preflight searches related projects' LanceDB indexes and contract registries
  5. Returns relevant types, interfaces, and routes from those projects
  6. You get context like: "auth-service has interface AuthToken { userId, tier, permissions } and POST /api/validate-tier"

This prevents the common failure mode: changing a shared type in one service and forgetting the consumers.


Configuration Reference

.preflight/config.yml

Drop this in your project root. Every field is optional β€” defaults are sensible.

# Profile controls overall verbosity
# "minimal" β€” only flag ambiguous+, skip clarification detail
# "standard" β€” default behavior
# "full" β€” maximum detail on every non-trivial prompt
profile: standard                          # type: "minimal" | "standard" | "full"

# Related projects for cross-service awareness
related_projects:                          # type: RelatedProject[]
  - path: /absolute/path/to/service        #   path: string (absolute)
    alias: service-name                    #   alias: string (used in output + triage matching)

# Behavioral thresholds
thresholds:
  session_stale_minutes: 30                # type: number β€” warn if no activity for this long
  max_tool_calls_before_checkpoint: 100    # type: number β€” suggest checkpoint after N tool calls
  correction_pattern_threshold: 3          # type: number β€” min corrections to form a pattern

# Embedding configuration
embeddings:
  provider: local                          # type: "local" | "openai"
  openai_api_key: sk-...                   # type: string β€” only needed if provider is "openai"

.preflight/triage.yml

Controls the triage classification engine.

# Keywords that control routing
rules:
  # Prompts containing these β†’ always at least AMBIGUOUS
  always_check:                            # type: string[] β€” default: [rewards, permissions, migration, schema]
    - rewards
    - permissions
    - migration
    - schema

  # Prompts containing these β†’ TRIVIAL (pass through)
  skip:                                    # type: string[] β€” default: [commit, format, lint]
    - commit
    - format
    - lint

  # Prompts containing these β†’ CROSS-SERVICE
  cross_service_keywords:                  # type: string[] β€” default: [auth, notification, event, webhook]
    - auth
    - notification
    - event
    - webhook

# How aggressively to classify
# "relaxed" β€” more prompts pass as clear
# "standard" β€” balanced
# "strict" β€” more prompts flagged as ambiguous
strictness: standard                       # type: "relaxed" | "standard" | "strict"

.preflight/contracts/*.yml

Manual contract definitions that supplement auto-extraction:

# .preflight/contracts/api.yml
- name: RewardsTier
  kind: interface
  description: Reward tier levels and their perks
  fields:
    - name: tier
      type: string
      required: true
    - name: multiplier
      type: number
      required: true
    - name: perks
      type: string[]

Environment Variables

VariableDescriptionDefault
CLAUDE_PROJECT_DIRProject root to monitorRequired
OPENAI_API_KEYOpenAI key for embeddingsUses local Xenova
PREFLIGHT_RELATEDComma-separated related project pathsNone
EMBEDDING_PROVIDERlocal or openailocal
PROMPT_DISCIPLINE_PROFILEminimal, standard, or fullstandard

Environment variables are fallbacks β€” .preflight/ config takes precedence when present.

πŸ’‘ Ready-to-use examples: Copy examples/.preflight/ into your project root for a working starter config with detailed comments.


Embedding Providers

ProviderSetupSpeedDimensionsQualityPrivacy
Local (Xenova)Zero config~50 events/sec384Good100% local
OpenAISet OPENAI_API_KEY~200 events/sec1536ExcellentAPI call

First run with local embeddings downloads the Xenova/all-MiniLM-L6-v2 model (~90MB). After that, everything runs offline.


Architecture

flowchart TB
    CC[Claude Code] <-->|MCP Protocol| PS[preflight server]
    
    PS --> PC[✈️ Preflight Core]
    PS --> DT[🎯 Discipline Tools]
    PS --> TL[πŸ” Timeline Tools]
    PS --> AN[πŸ“Š Analysis Tools]
    PS --> VR[βœ… Verify Tools]

    PC --> TE[Triage Engine]
    DT --> PL[Pattern Learning]
    TL --> LDB[(LanceDB\nper-project)]
    AN --> SCE[Scorecard Engine]

    TE -.-> CFG[".preflight/\nconfig.yml\ntriage.yml\ncontracts/"]
    LDB --> SP[Session Parser]
    SP --> JSONL["~/.claude/projects/\n(session JSONL files)"]

    style CC fill:#264653,color:#fff
    style PS fill:#2a9d8f,color:#fff
    style PC fill:#e76f51,color:#fff
    style DT fill:#e9c46a,color:#000
    style TL fill:#457b9d,color:#fff
    style AN fill:#6a4c93,color:#fff
    style VR fill:#2d6a4f,color:#fff
    style LDB fill:#1d3557,color:#fff

Per-Project Data Layout

~/.preflight/
β”œβ”€β”€ config.json                           # Global config (embedding provider, indexed projects)
└── projects/
    β”œβ”€β”€ index.json                        # Registry: path β†’ { hash, onboarded_at }
    β”œβ”€β”€ a1b2c3d4e5f6/                     # SHA-256(project_path)[:12]
    β”‚   β”œβ”€β”€ timeline.lance/               # LanceDB vector database
    β”‚   β”œβ”€β”€ contracts.json                # Extracted API contracts
    β”‚   β”œβ”€β”€ meta.json                     # Event count, onboard timestamp
    β”‚   └── baseline.json                 # Historical scorecard averages
    └── f6e5d4c3b2a1/
        └── ...                           # Another project

Troubleshooting

"Cannot find module 'vectordb'" or LanceDB import errors

LanceDB uses native binaries. If you see module resolution errors:

# Clean install with native deps rebuilt
rm -rf node_modules package-lock.json
npm install

# If still failing, check your Node version (20+ required)
node --version

On Apple Silicon Macs, make sure you're running a native arm64 Node β€” not Rosetta. Check with node -e "console.log(process.arch)" (should print arm64).

First run is slow (~90MB model download)

The local embedding provider (Xenova/all-MiniLM-L6-v2) downloads a ~90MB model on first use. This is a one-time cost β€” subsequent runs use the cached model. If the download hangs behind a corporate proxy, switch to OpenAI embeddings:

export OPENAI_API_KEY=sk-...
export EMBEDDING_PROVIDER=openai

"OpenAI API key required for openai embedding provider"

You set EMBEDDING_PROVIDER=openai (or embeddings.provider: openai in .preflight/config.yml) but didn't provide a key. Either:

  • Set OPENAI_API_KEY in your environment, or
  • Switch back to local: export EMBEDDING_PROVIDER=local

Tools not showing up in Claude Code

  1. Make sure the MCP server is registered. Run claude mcp list β€” you should see preflight.
  2. If missing, re-add it:
    claude mcp add preflight -- npx tsx /path/to/preflight/src/index.ts
    
  3. Restart Claude Code after adding.

CLAUDE_PROJECT_DIR not set

Some tools (onboarding, session search, contracts) need to know your project root. If they return empty results:

claude mcp add preflight \
  -e CLAUDE_PROJECT_DIR=/path/to/your/project \
  -- npx tsx /path/to/preflight/src/index.ts

Or set it globally: export CLAUDE_PROJECT_DIR=/path/to/your/project

.preflight/config.yml parse errors

If you see warning - failed to parse .preflight/config.yml, your YAML is malformed. Common issues:

  • Tabs instead of spaces (YAML requires spaces)
  • Missing quotes around values with special characters
  • Incorrect indentation under related_projects

Validate with: npx yaml-lint .preflight/config.yml or paste into yamllint.com.

No session data found during onboarding

onboard_project looks for JSONL files in ~/.claude/projects/<encoded-path>/. If nothing is found:

  • Make sure you've actually used Claude Code on the project (at least one session)
  • Check that CLAUDE_PROJECT_DIR matches the exact path Claude Code was opened in
  • The path encoding is URL-style β€” /Users/jack/my-app becomes %2FUsers%2Fjack%2Fmy-app

Ollama embeddings connection refused

If using Ollama as your embedding provider and getting connection errors:

# Make sure Ollama is running
ollama serve

# Pull the embedding model
ollama pull all-minilm

# Verify it works
curl http://localhost:11434/api/embed -d '{"model":"all-minilm","input":"test"}'

Contributing

This project is young and there's plenty to do. Check the issues β€” several are tagged good first issue.

PRs welcome. No CLA, no bureaucracy. If it makes the tool better, it gets merged.

Development

git clone https://github.com/TerminalGravity/preflight.git
cd preflight
npm install
npm run build
npm test

Project Structure

src/
β”œβ”€β”€ index.ts                 # MCP server entry point
β”œβ”€β”€ lib/
β”‚   β”œβ”€β”€ triage.ts            # Prompt classification engine
β”‚   β”œβ”€β”€ session-parser.ts    # JSONL session file parser
β”‚   β”œβ”€β”€ timeline-db.ts       # LanceDB operations
β”‚   β”œβ”€β”€ contracts.ts         # Contract extraction & search
β”‚   β”œβ”€β”€ patterns.ts          # Correction pattern learning
β”‚   β”œβ”€β”€ config.ts            # .preflight/ config loading
β”‚   β”œβ”€β”€ embeddings.ts        # Embedding provider abstraction
β”‚   β”œβ”€β”€ state.ts             # Persistent state (logs, patterns)
β”‚   β”œβ”€β”€ git.ts               # Git operations
β”‚   └── files.ts             # File discovery
└── tools/
    β”œβ”€β”€ preflight-check.ts   # Unified entry point
    β”œβ”€β”€ generate-scorecard.ts # 12-category scoring + trends
    └── ...                  # One file per tool

License

MIT β€” do whatever you want with it.

Related MCP Servers

5dive-ai/5dive-mcp

πŸ“‡ 🏠 🍎 πŸͺŸ 🐧 - Manage a 5dive agent fleet from any MCP client: file tasks, message and inspect agents, and read the fleet digest. Thin adapter over the 5dive CLI.

πŸ€– Coding Agents0 views
agent-blueprint/mcp-server

πŸ“‡ ☁️ - 8 MCP tools for exploring and downloading AI agent blueprints. List blueprints, get summaries, download full Agent Skills directories for implementation by coding agents. Vendor-agnostic output works with any enterprise platform. Install: npx agentblueprint.

πŸ€– Coding Agents0 views
agentic-mcp-tools/owlex

🐍 🏠 🍎 πŸͺŸ 🐧 - AI council server: query CLI agents (Claude Code, Codex, Gemini, and OpenCode) in parallel with deliberation rounds

πŸ€– Coding Agents0 views
alpadalar/netops-mcp

🐍 🏠 - Comprehensive DevOps and networking MCP server providing standardized access to essential infrastructure tools. Features network monitoring, system diagnostics, automation workflows, and infrastructure management with AI-powered operational insights.

πŸ€– Coding Agents0 views

Engagement

Views
0
Installs
0
Upvotes
0

Views and upvotes are unique per visitor network (hashed IP). Installs count copy actions.

Status

Health: Not checked yet

We have not completed a health check for this listing yet.

No check timestamp yet.

Unclaimed listing (imported or pending owner verification). Claim it β†’
β˜… Spotlight Slot

Feature Your MCP Server

Get maximum visibility for your server across our directory, search results, and detail pages.

Spotlight Your Server

Own this project?

This directory is pre-filled from public sources. Claim via GitHub README, site badge, or DNS TXT to get the verified badge and attach your website.

Claim this listing

Promote this listing

Optional paid placement. Free listings stay free forever.

Share & Embed

Add our SVG badge (dark/light directory styles) or embeddable widget to your site.