preflight

A pre-deployment checklist based on FMEA, a method for listing how a system could fail, what the effects would be, and how to reduce the risks. It scans a service or coding agent for selected problems and saves a report.

In plain words
What is it for?
Use it to create a dated service checklist, scan Python files for problematic time calls and exception patterns, and record pass or fail results in .fettle/.
Why use it?
It helps catch known reliability issues before deployment, such as unsafe time handling or weak exception handling. The checks are limited to the patterns described by the command.

Command

Part of the fettle plugin — 34 commands, 4 hooks shipped together

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add commands/milindgaharwar/fettle/preflight
Clone the repo
git clone --depth 1 https://github.com/MilindGaharwar/fettle

Or install fettle, the plugin that ships this one along with the rest of its 34 commands, 4 hooks.

Per session 16 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 989 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 1 finding. Scan, not verified.
Origin 94% copy Near-identical to another mod in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00016 $0.00989
Opus 5 $0.00008 $0.00495
Sonnet 5 $0.00003 $0.00198
Haiku 4.5 $0.00002 $0.00099

Measured 2d ago against content hash 0dc3cd0338e4, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

preflight scanned grade A with 1 finding against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Makes network callslowCapability

Not a fault in itself. Listed so you know the mod talks to something, and to what.

- Search for `AsyncClient` (or `httpx.Client`, `requests.get`, `requests.post`) without `timeout` on the same line or within 5 lines. Flag as [FAIL] if timeout is missing.
Origin

This is a copy

94% identical to fettle-preflight — 9 lines differ, which has more behind it and is treated as the original. This page carries a canonical link to it rather than competing with it.

commands/preflight.md · 82 lines

What it actually says

Run a pre-deployment FMEA (Failure Mode and Effects Analysis) quality checklist for the target service.

Procedure

  1. Determine service name. Use $ARGUMENTS if provided. If not provided, derive the name from the current working directory basename.

  2. Create output directory. Create .fettle/ in the current working directory if it doesn't already exist:

    mkdir -p .fettle
    
  3. Copy the preflight template. Locate the bundled template and write it to .fettle/preflight-{name}.md, replacing {SERVICE_NAME} with the service name and {DATE} with today's date:

    python3 -c "from fettle._resources import templates_dir; print(templates_dir() / 'preflight.md')"
    

    Read the file at the printed path.

  4. Run automated checks on the codebase. Use Grep and Glob to scan for known anti-patterns and pre-fill the template sections:

    Time Model (Section 1):

    • Search for datetime.now across all Python files. Any hit is a [FAIL] — record file:line.
    • Search for datetime.utcnow as well (deprecated in Python 3.12+). Any hit is a [FAIL].
    • If no hits, mark as [PASS].

    Error Handling (Section 2):

    • Search for except.*:.*pass or bare except: patterns. Any hit is a [FAIL] — record file:line.
    • Search for AsyncClient (or httpx.Client, requests.get, requests.post) without timeout on the same line or within 5 lines. Flag as [FAIL] if timeout is missing.
    • If no hits, mark as [PASS].

    LLM Output Parsing (Section 3):

    • Search for re.search, re.findall, re.match patterns that appear to parse LLM output (look in pipeline/, agents/, or similar directories). Any hit is a [FAIL] — record file:line.
    • If no hits, mark as [PASS].

    Data Persistence (Section 4):

    • Search for .write_text( or .write_bytes( on paths that are NOT in /tmp or using tempfile. Flag as [?] for manual review with file:line.
    • Search for absence of atomic write patterns (no tempfile + rename/replace pattern). Flag as [?].

    External Dependencies (Section 5):

    • Search for HTTP client instantiations without explicit timeout. Flag as [FAIL] with file:line.
    • Mark remaining items as [?] for manual review.

    Resource Lifecycle (Section 6):

    • Search for open( without a with statement context manager. Flag as [?] with file:line.
    • Mark as [?] for manual review.

    Observability (Section 7):

    • Search for logging. or logger. or structlog usage. If found, mark as [PASS]. If absent, mark as [FAIL].
    • Mark remaining items as [?].

    Testing Coverage (Section 8):

    • Count test files matching test_*.py or *_test.py using Glob.
    • Count total test functions (def test_) using Grep.
    • Pre-fill {TEST_COUNT} and {TEST_FILES} in the template.
    • If zero test files, mark as [FAIL]. Otherwise mark as [?] for manual assessment of coverage quality.
  5. Fill the summary table. For each section, set the status based on findings:

    • PASS — all auto-checks passed and no issues found
    • FAIL — at least one auto-detected issue
    • REVIEW — needs manual inspection (items marked [?])
  6. Write the completed checklist to .fettle/preflight-{name}.md.

  7. Present the results to the user. Show:

    • A summary of auto-detected issues (with file:line references)
    • The overall pass/fail count
    • Which sections still need manual review ([?] items)
  8. Ask the user to review and complete any remaining [?] items.

  9. Suggest running the full automated scan:

    fettle check --all
    
Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 2d ago First seen · 82 lines · 16 tokens per session scan A 0dc3cd0338e4

Subscribe to this mod's changes

preflight is a command published in the GitHub repository MilindGaharwar/fettle (2 stars, last pushed 4d ago), licensed Apache-2.0. It adds 16 tokens to every session and 989 once invoked, about $0.0001 per session on Opus 5. A static security scan graded it A with 1 finding (makes network calls). It is 94% identical to fettle-preflight, differing in 9 lines, and is treated as a copy.