Skip to content

Commit 486b958

Browse files
Add examples/.preflight/ starter config directory
The README references examples/.preflight/ but it didn't exist. Adds well-commented starter configs: - config.yml — profile, related projects, thresholds, embeddings - triage.yml — triage rules with domain-specific keyword examples - contracts/api.yml — sample manual contract definitions - README.md — quick setup guide
1 parent 6cc7294 commit 486b958

4 files changed

Lines changed: 129 additions & 79 deletions

File tree

examples/.preflight/README.md

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# `.preflight/` Config Directory
2+
3+
Drop this directory into your project root to configure preflight for your team.
4+
5+
## Quick Setup
6+
7+
```bash
8+
# From the preflight repo:
9+
cp -r examples/.preflight /path/to/your/project/
10+
11+
# Or from your project:
12+
cp -r /path/to/preflight/examples/.preflight .
13+
```
14+
15+
## Files
16+
17+
| File | Purpose |
18+
|------|---------|
19+
| `config.yml` | Main config — profile, related projects, thresholds, embeddings |
20+
| `triage.yml` | Triage rules — which prompts to check, skip, or flag as cross-service |
21+
| `contracts/*.yml` | Manual contract definitions — types, interfaces, routes |
22+
23+
## What to customize first
24+
25+
1. **`config.yml`** — Add your `related_projects` if you work across multiple repos
26+
2. **`triage.yml`** — Add domain-specific keywords to `always_check` (your project's tricky terms)
27+
3. **`contracts/`** — Define shared types that preflight should know about
28+
29+
## Commit it
30+
31+
These files are meant to be committed to your repo so the whole team shares the same preflight config. No secrets in here — API keys go in env vars.

examples/.preflight/config.yml

Lines changed: 39 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,49 @@
11
# .preflight/config.yml — Drop this in your project root
2+
# Every field is optional. Defaults are sensible — only override what you need.
23
#
3-
# This is an example config for a typical Next.js + microservices setup.
4-
# Every field is optional — preflight works with sensible defaults out of the box.
5-
# Commit this to your repo so the whole team gets the same preflight behavior.
4+
# Copy this entire .preflight/ directory into your project:
5+
# cp -r examples/.preflight /path/to/your/project/
66

7-
# Profile controls how much detail preflight returns.
8-
# "minimal" — only flags ambiguous+ prompts, skips clarification detail
9-
# "standard" — balanced (default)
10-
# "full" — maximum detail on every non-trivial prompt
7+
# ──────────────────────────────────────────────────────────
8+
# Profile: controls how verbose preflight's feedback is
9+
# ──────────────────────────────────────────────────────────
10+
# "minimal" — only flags ambiguous+ prompts, skips detail
11+
# "standard" — balanced (default)
12+
# "full" — maximum detail on every non-trivial prompt
1113
profile: standard
1214

13-
# Related projects for cross-service awareness.
14-
# Preflight will search these for shared types, routes, and contracts
15-
# so it can warn you when a change might break a consumer.
16-
related_projects:
17-
- path: /Users/you/code/auth-service
18-
alias: auth
19-
- path: /Users/you/code/billing-api
20-
alias: billing
21-
- path: /Users/you/code/shared-types
22-
alias: types
15+
# ──────────────────────────────────────────────────────────
16+
# Related projects for cross-service awareness
17+
# ──────────────────────────────────────────────────────────
18+
# When you reference code that lives in another repo (e.g. a shared auth
19+
# service), preflight can search that project's types, routes, and schemas
20+
# to give you relevant context automatically.
21+
#
22+
# related_projects:
23+
# - path: /Users/you/code/auth-service
24+
# alias: auth
25+
# - path: /Users/you/code/shared-types
26+
# alias: types
2327

24-
# Behavioral thresholds — tune these to your workflow
28+
# ──────────────────────────────────────────────────────────
29+
# Behavioral thresholds
30+
# ──────────────────────────────────────────────────────────
2531
thresholds:
26-
session_stale_minutes: 30 # Warn if no activity for this long
27-
max_tool_calls_before_checkpoint: 100 # Suggest a checkpoint after N tool calls
28-
correction_pattern_threshold: 3 # Min corrections before flagging a pattern
32+
# Warn if no session activity for this many minutes
33+
session_stale_minutes: 30
34+
35+
# Suggest a checkpoint after this many tool calls
36+
max_tool_calls_before_checkpoint: 100
37+
38+
# Minimum correction count before preflight detects a pattern
39+
# (e.g. "you've corrected JWT handling 3 times — adding a reminder")
40+
correction_pattern_threshold: 3
2941

30-
# Embedding provider for semantic search over session history.
31-
# "local" uses Xenova transformers (no API key needed, runs on CPU).
32-
# "openai" uses text-embedding-3-small (faster, needs OPENAI_API_KEY).
42+
# ──────────────────────────────────────────────────────────
43+
# Embedding configuration (for semantic search over session history)
44+
# ──────────────────────────────────────────────────────────
45+
# "local" uses Xenova transformers — no API key needed, runs on-device.
46+
# "openai" uses OpenAI embeddings — better quality, requires API key.
3347
embeddings:
3448
provider: local
35-
# openai_api_key: sk-... # Uncomment if using openai provider
49+
# openai_api_key: sk-... # Uncomment if using openai provider
Lines changed: 35 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,58 +1,58 @@
11
# .preflight/contracts/api.yml — Manual contract definitions
22
#
3-
# Define shared types and interfaces that preflight should know about.
43
# These supplement auto-extracted contracts from your codebase.
5-
# Manual definitions win on name conflicts with auto-extracted ones.
4+
# Use them for:
5+
# - API contracts that aren't easily auto-detected
6+
# - Shared types across services that need explicit documentation
7+
# - Domain models that drive business logic
68
#
7-
# Why manual contracts?
8-
# - Document cross-service interfaces that live in docs, not code
9-
# - Define contracts for external APIs your services consume
10-
# - Pin down types that are implicit (e.g., event payloads)
9+
# Manual definitions win on name conflicts with auto-extracted ones.
1110

1211
- name: User
1312
kind: interface
14-
description: Core user model shared across all services
13+
description: Core user model — referenced across auth, billing, and API layers
1514
fields:
1615
- name: id
1716
type: string
1817
required: true
1918
- name: email
2019
type: string
2120
required: true
22-
- name: tier
23-
type: "'free' | 'pro' | 'enterprise'"
21+
- name: role
22+
type: "'admin' | 'member' | 'viewer'"
2423
required: true
2524
- name: createdAt
2625
type: Date
2726
required: true
2827

29-
- name: AuthToken
30-
kind: interface
31-
description: JWT payload structure from auth-service
32-
fields:
33-
- name: userId
34-
type: string
35-
required: true
36-
- name: permissions
37-
type: string[]
38-
required: true
39-
- name: expiresAt
40-
type: number
41-
required: true
42-
43-
- name: WebhookPayload
28+
- name: ApiResponse
4429
kind: interface
45-
description: Standard webhook envelope for inter-service events
30+
description: Standard API response wrapper used by all endpoints
4631
fields:
47-
- name: event
48-
type: string
49-
required: true
50-
- name: timestamp
51-
type: string
32+
- name: success
33+
type: boolean
5234
required: true
5335
- name: data
54-
type: Record<string, unknown>
55-
required: true
56-
- name: source
57-
type: string
58-
required: true
36+
type: T
37+
required: false
38+
- name: error
39+
type: "{ code: string; message: string }"
40+
required: false
41+
42+
# Add your own contracts below. Examples:
43+
#
44+
# - name: OrderStatus
45+
# kind: enum
46+
# description: Order lifecycle states
47+
# values: [pending, confirmed, shipped, delivered, cancelled]
48+
#
49+
# - name: POST /api/webhooks
50+
# kind: route
51+
# description: Incoming webhook handler
52+
# fields:
53+
# - name: event
54+
# type: string
55+
# required: true
56+
# - name: payload
57+
# type: Record<string, unknown>
58+
# required: true

examples/.preflight/triage.yml

Lines changed: 24 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,45 +1,50 @@
1-
# .preflight/triage.yml — Controls how preflight classifies your prompts
1+
# .preflight/triage.yml — Controls the prompt triage engine
22
#
3-
# The triage engine routes prompts into categories:
3+
# Triage classifies every prompt into one of four categories:
44
# TRIVIAL → pass through (commit, format, lint)
55
# CLEAR → well-specified, no intervention needed
66
# AMBIGUOUS → needs clarification before proceeding
7-
# MULTI-STEP → complex task, preflight suggests a plan
8-
# CROSS-SERVICE → touches multiple projects, pulls in contracts
7+
# CROSS-SERVICE → touches multiple projects, needs contract context
98
#
10-
# Customize the keywords below to match your domain.
9+
# Customize the keywords below to match YOUR project's domain.
1110

1211
rules:
13-
# Prompts containing these words are always flagged as AMBIGUOUS.
14-
# Add domain-specific terms that tend to produce vague prompts.
12+
# ── Always check ──────────────────────────────────────
13+
# Prompts containing these words are always flagged as AMBIGUOUS
14+
# (at minimum) so preflight asks for clarification.
15+
# Add your project's tricky/overloaded terms here.
1516
always_check:
1617
- rewards
1718
- permissions
1819
- migration
1920
- schema
20-
- pricing # example: your billing domain
21-
- onboarding # example: multi-step user flows
21+
# - billing # Uncomment for fintech projects
22+
# - deployment # Uncomment if deploys are complex
2223

23-
# Prompts containing these words skip checks entirely (TRIVIAL).
24-
# These are safe, mechanical tasks that don't need guardrails.
24+
# ── Skip (trivial) ───────────────────────────────────
25+
# Prompts matching these pass through without intervention.
26+
# These are low-risk, well-understood commands.
2527
skip:
2628
- commit
2729
- format
2830
- lint
29-
- prettier
30-
- "git push"
31+
- "git status"
32+
- "run tests"
3133

32-
# Prompts containing these words trigger CROSS-SERVICE classification.
33-
# Preflight will search related_projects for relevant types and routes.
34+
# ── Cross-service keywords ───────────────────────────
35+
# Prompts containing these trigger cross-project search,
36+
# pulling in types/routes/schemas from related_projects.
3437
cross_service_keywords:
3538
- auth
3639
- notification
3740
- event
3841
- webhook
39-
- billing # matches the related_project alias
42+
# - payment # Uncomment if payments are a separate service
43+
# - queue # Uncomment for message queue integrations
4044

41-
# How aggressively to classify prompts.
42-
# "relaxed" — more prompts pass as clear (experienced users)
45+
# ── Strictness ────────────────────────────────────────
46+
# How aggressively to classify prompts:
47+
# "relaxed" — more prompts pass as clear (fewer interruptions)
4348
# "standard" — balanced (default)
44-
# "strict" — more prompts flagged as ambiguous (new teams, complex codebases)
49+
# "strict" — more prompts flagged as ambiguous (safer, more verbose)
4550
strictness: standard

0 commit comments

Comments
 (0)