Quickstart
Before anything else, read the safety model — it is the point of the project. The short version: every mutating command is dry-run until you pass --execute, and nothing can ever delete mail.
Install
Section titled “Install”Not yet on npm — install from a clone (bun ≥ 1.1):
git clone https://github.com/ahmadatallah/fast-classifier.gitcd fast-classifierbun installbun run build && bun link # puts `fast-classifier` and `fast-classifier-mcp` on your PATH(Or skip building and run straight from source: bun src/cli/main.ts <command>.)
Get a scoped Fastmail token
Section titled “Get a scoped Fastmail token”In Fastmail: Settings → Privacy & Security → Integrations → API tokens. Scope it to Mail read + write only — no contacts, calendars, files, or sending. Use a read-only token if you only run analyze/plan.
Tokens live in the environment only — the config loader rejects credentials in config files:
cp .env.example .env # bun loads .env automatically; otherwise export in your shellexport FASTMAIL_API_TOKEN=... # JMAP transport (the default)export FASTMAIL_MCP_TOKEN=... # MCP transport (-p mcp)The canonical loop
Section titled “The canonical loop”Recon, build your rules from your inbox, then execute:
-
Write a starter config:
Terminal window fast-classifier init # writes a starter fast-classifier.config.ts -
Read-only recon — who fills the inbox:
Terminal window fast-classifier analyze # top senders and root domains -
Build your rules from your inbox:
Terminal window fast-classifier suggest # catalog-backed rule suggestions + unknown domainssuggestmatches your top domains against a built-in catalog of well-known senders in 12 generic categories and prints a paste-ready config fragment; domains it does not recognize are listed for you to decide. Paste what you accept intofast-classifier.config.ts. -
Check coverage:
Terminal window fast-classifier plan # coverage % + top unmatched senders -
Edit
fast-classifier.config.ts— add rules for the top unmatched senders and the unknown domainssuggestsurfaced — then runplanagain. Iterate until coverage is where you want it. This flywheel is how the origin session reached 87% coverage without training anything. -
Sweep bulk mail — dry run first, inspect the report, then execute:
Terminal window fast-classifier sweep # dry run — inspect the reportfast-classifier sweep --execute # label + archive bulk mail -
File everything the rules match:
Terminal window fast-classifier file --execute -
Surface what needs a human reply:
Terminal window fast-classifier needs-action -
Prove the run did what the plan said:
Terminal window fast-classifier verify --cleared newsletter@example.com --label 'Inbox/Dev>=1'
Next steps
Section titled “Next steps”- Configuration — categories, rules, keep-list, and building your config from your inbox.
- CLI reference — every command and flag.
- MCP server — drive the same pipelines from an agent.
- See
examples/for a full real-world config.