AIToday

Higgs: local CLI for Proton Mail using local AI, no cloud or telemetry

Hacker News9h agoSend on LINE
Higgs: local CLI for Proton Mail using local AI, no cloud or telemetry

Key takeaway

Higgs is a locally-run CLI tool that classifies Proton Mail inbox messages using an on-device language model—no cloud, no telemetry, no API keys. It was built with AI agents in mind: every command outputs machine-readable JSON, emits structured error envelopes, and declares its interface upfront so a language model can drive it automatically without natural-language parsing. All credentials stay in the OS keyring, and all inference runs on localhost via Proton Mail Bridge and Ollama (or any compatible self-hosted LLM server).

Summaries like this, in your inbox every morning.

Sign up free →

3 Key Points

  • What happened

    An independent developer released Higgs, a CLI tool that classifies Proton Mail messages using a local LLM (Ollama or self-hosted OpenAI-compatible server) connected via Proton Mail Bridge. The tool emits structured JSON output designed specifically for language-model agents rather than human interaction, with features including schema manifests, NDJSON streaming with terminators, typed error envelopes, exit-code enums, and OS keyring credential storage. All processing runs on localhost with no external API calls or telemetry.

  • Why it matters

    Most email CLIs mix human-readable prose with data on stdout and use vague error messages—making them awkward to integrate into AI agent loops. Higgs inverts the design: it speaks JSON natively, emits deterministic error codes, and declares its interface once via schema so an agent can drive it without prompt engineering. For Proton users who want local inbox classification without cloud inference costs or privacy trade-offs, this bridges a gap. For AI application builders, it demonstrates a contract pattern (schema manifest, NDJSON terminators, typed errors, exit-code enums) that makes any CLI agent-friendly.

  • What to watch

    The tool is available via Homebrew, go install, or from source on GitHub (github.com/higgscli/higgs). It runs against Proton Mail Bridge over IMAP and uses Gemma 4 by default but supports any OpenAI-compatible server. The classifier stores state in local SQLite (resumable after crashes), pipes commands together, and includes utilities for backfill, label consolidation, and audit. It is an unofficial, independent project not endorsed by Proton AG.

In Depth

Higgs is a CLI for Proton Mail designed from the ground up to be driven by language models rather than humans. The tool connects to Proton Mail Bridge (a local IMAP service) and streams each message through a local LLM running on Ollama or a compatible server such as llama.cpp llama-server. It applies labels from an 11-category taxonomy—all inference happens on localhost, with no API keys, cloud calls, or telemetry.

The core innovation is the agent contract. Instead of human-readable prose and ambiguous exit codes, every command outputs structured JSON. The schema manifest (higgs schema) returns a machine-readable description of every subcommand: flag types, argument names, stdout format (JSON or NDJSON), and exit codes. An agent loads this once and can drive the CLI without prompt engineering. Streaming commands emit one JSON object per line followed by a terminator record ({"type": "summary", ...}), so the agent knows when the stream is done. Every error emits a typed envelope with kind, code, reason, message, and hint—agents branch on the kind field (auth, config, imap, classify, state, etc.) rather than parsing English. Exit codes 0–9 map 1:1 to error kinds: 0 for success, 2 for auth failure, 3 for validation, 4 for config, 5 for IMAP protocol error, 6 for classification error, 7 for state DB error, and so on.

For the mail classifier workload, users export their Proton Mail Bridge IMAP username and password (stored in the OS keyring, not the shell), set the Ollama host and model (default: Gemma 4), and run higgs classify --dry-run --limit 20 INBOX. The tool emits NDJSON: each row contains the mailbox name, UID, subject, sender, suggested labels, confidence score, and a rationale. A summary record follows. If the suggestions look correct, rerun with --apply to write labels back. The tool supports flags for dry-run, concurrent workers (default: 4), and per-message limit. State is checkpointed in a local SQLite database, so runs are resumable after crashes. Commands compose over pipes: higgs search INBOX --before 2025-07-01 | higgs archive INBOX --uid - chains a search and archive. Other commands include scan-folders (enumerate mailboxes), cleanup-labels (consolidate legacy labels), backfill (replay a prior NDJSON log into the state DB), verify (audit a mailbox against an expected UID set), and state query (inspect per-message classification records without reconnecting to IMAP).

Credentials are stored in the OS keyring (macOS Keychain, Windows Credential Manager, Linux Secret Service) or an encrypted file (~/.higgs/credentials.enc, AES-256-GCM with Argon2id keys). All configuration is read from environment variables: PM_IMAP_HOST, PM_IMAP_USERNAME, PM_IMAP_PASSWORD for Proton Mail Bridge; PM_OLLAMA_BASE_URL and PM_OLLAMA_MODEL for Ollama (default: http://localhost:11434 and gemma4). Alternatively, set PM_LLM_BACKEND=openai and point to a compatible self-hosted server such as llama.cpp or Qwen3. The tool is available via Homebrew (brew install higgs), go install, or built from source. It is an independent, community-built project not affiliated with or endorsed by Proton AG.

Context & Analysis

Higgs addresses a real friction point in AI agent development: most CLI tools were designed for human operators, with prose help text, English error messages, and 0/1 exit codes. Wiring them into an agent loop requires prompt engineering, natural-language parsing, and heuristics to detect completion. Higgs inverts the assumption—every design decision assumes the primary caller is a language model. The schema manifest lets an agent load the tool's interface once (flags, args, output format, exit codes) without parsing --help. NDJSON streaming with a typed terminator ("summary" record) means the agent knows when a stream ends without counting lines. Typed error envelopes (with kind, code, reason, message, hint) let the agent branch on error.kind rather than substring-matching English text. Exit codes 1–9 map 1:1 to error kinds, so retry and escalation become deterministic.

The first workload is a mail classifier built on Proton Mail Bridge (IMAP) and Ollama, but the contract is the point. This pattern—schema-first, agent-first output, deterministic errors and codes—is reusable for any CLI. For Proton Mail users specifically, Higgs offers local-only classification with no cloud inference, no API costs, and all credentials in the OS keyring. The tool's state is persisted in SQLite, making runs resumable after crashes, and commands pipe together, so you can chain discovery, search, classify, apply, and audit operations in a single shell pipeline.

FAQ

Do I need to sign up for cloud inference or pay per message?
No. All processing runs on localhost using a local LLM you run yourself (Ollama, llama.cpp, or another OpenAI-compatible server). There are no API keys, cloud calls, or telemetry. You authenticate only to Proton Mail Bridge over IMAP.
What language models does Higgs use?
The default is Gemma 4, chosen for its native function-calling support and 128K context window. You can swap to any OpenAI-compatible LLM by setting PM_LLM_BACKEND=openai and pointing to your server (e.g., llama.cpp llama-server or Qwen3). Reasoning models are supported; thinking is disabled for structured calls and enabled for ask and summarize.
Where does Higgs store passwords and secrets?
Credentials go to the OS keyring (macOS Keychain, Windows Credential Manager, or Linux Secret Service via libsecret). If the keyring is unavailable, they fall back to an AES-256-GCM encrypted file at ~/.higgs/credentials.enc. Nothing sensitive flows through the agent's context.
Can I use Higgs in a shell script or call it from code?
Yes. Every command outputs NDJSON or JSON; you pipe streams between commands using --uid -. For example, higgs search INBOX --before 2025-07-01 | higgs archive INBOX --uid - chains a search and archive in one pass. Exit codes map 1:1 to error kinds (success, auth, validation, config, imap, classify, state, discovery, internal), so callers can branch deterministically.

Get the latest Large Language Models news every morning

AI-summarized, only the topics you pick — one digest a day via Email, Slack, or Discord.

Free · takes 30 seconds · unsubscribe anytime

Discussion

No comments yet. Be the first to share your thoughts!

Log in to join the discussion

Related Articles

Stay ahead with AI news

Get curated AI news from 200+ sources delivered daily to your inbox. Free to use.

Get Started Free

Free · takes 30 seconds · unsubscribe anytime