Haunted Inbox: a local Gemma 4 E2B finds the forgotten accounts in 12 years of email
- Hardware
- A laptop with Python 3.12 (standard library only) and Ollama
- Models & engines
- Gemma 4 E2B (gemma4:e2b, a 4.6 GB download) with JSON-schema output
- Key gotcha
- His own test flattered the model because he wrote it in the style he expected mail to be in.
What they built
Niraj Khetre built Haunted Inbox to answer one question: who still has me? It finds the accounts you made over the years from your own mailbox, on your own computer, and gives a plain report of what was hacked after you joined, what may still have your card, how long each has been silent and where to go to delete it. The same accounts can also be walked through as a graveyard.
It reads only the envelope of each email (sender, date and subject) from a Google Takeout file or over IMAP with an app password. Gemma 4 E2B, running through Ollama, is the only model, and it gets the smallest job he could give it: read one short card per sender and say whether it is an account.
He tested it twice, on 102 hand-written senders frozen in git and on 200 senders from his own mail marked by hand, and reports the gap between the two honestly.
Setup
- A laptop with Python 3.12 (standard library only) and Ollama
- Gemma 4 E2B (gemma4:e2b, a 4.6 GB download) with JSON-schema output
- Have I Been Pwned's public breach list and the JustDeleteMe list, both shipped inside the repo
- Optional SerpApi web search for 'what became of this company?', which sends only the company's public name
How it works
- Code turns the mailbox into one card per sender: name, domain, email count, date range and a few subject lines.
- Gemma answers with two fields, kind (account, list, person or other) and service (the company's plain name).
- Code decides everything shown as fact: a breach only counts if it came after your first email from that place, the proof and 'last words' are always your own subject lines, and a throwaway-domain sender with under 10 emails is never a ghost.
- Over IMAP it requests only header fields with BODY.PEEK, so the server never sends message bodies and the connection is read-only.
Results & numbers
- On his real mail it read the envelopes of 7,556 emails from 311 senders in 129 seconds and listed 199 accounts: 4 hacked after he joined, 33 that may still have his card, and one silent for 7.8 years.
- On 166 hand-marked senders, keyword search found 65 of 159 accounts and Gemma found 101, with 3 false alarms each.
- On his frozen test Gemma found 52 of 56 accounts versus 13 for keyword search, at about 0.26 s per card, but that row was tuned on the same test.
- It found 93% of accounts on his own test and 64% on his real mail; of the 58 it missed there, it called 53 a newsletter.
Gotchas
- His own test flattered the model because he wrote it in the style he expected mail to be in.
- Asking Gemma for the number of the proving subject line produced wrong numbers that made his code throw away correct answers; now code picks the proof.
- For acquisitions, the small model read 'acquired' and said yes without noticing who bought whom, so code now checks the wording first; one web result still matched a different company called Notion.
- 3 of 6 test scams still got through, and it only finds accounts that emailed you.
- A regex written with unescaped slashes turned every delete link into a comment and passed node --check.
“A mailbox is the worst place to let a model make things up, so I gave it the smallest job I could.”— Niraj Khetre
Do it yourself
- Install Ollama and run ollama pull gemma4:e2b.
- Clone github.com/nirajkhetre/haunted-inbox and start it with python -m haunted serve.
- Drop in a Google Takeout file, or connect with an app password for Gmail, Yahoo, iCloud, Fastmail, AOL or Zoho.
- Review the report, close accounts on their own sites, then mark them closed in the app.
- Rerun the frozen test with python ml/evaluate.py trick gemma4:e2b.
git clone https://github.com/nirajkhetre/haunted-inbox
cd haunted-inbox
ollama pull gemma4:e2b
python -m haunted serveSimilar setups
A read-only Gemma 4 agent on Ollama that explains what fills a Mac's disk
A sysadmin's one-file Python agent lets Gemma 4 on Ollama dig through his home folder and write a Markdown report on disk usage, while code and a four-line macOS sandbox-exec profile make sure it can only look.
Legacy Code Necromancer: a local Gemma 3 audit for old repos
Waleed Shamhan built a pure-Python CLI that scrubs secrets from old code, sends it only to a local Gemma 3 in Ollama for an audit, and keeps every raw reply so a human can check each finding.
PatchPal TinyAgent: a coding agent on a 4B model and a 6GB laptop GPU
WiseProbe adapted its PatchPal coding agent to run Gemma 4 E4B or Qwen3.5 4B through Ollama on a 6GB RTX A1000, using handoff-note compaction and capped file reads to work inside a 16K or 32K window.
Local AI: a one-click Windows app that picks a model for your PC and sets up Ollama for friends
Tired of setting up local LLMs for friends, a developer built a free MIT-licensed Windows app that detects your GPU and RAM, installs Ollama without admin rights, pulls a fitting model and opens a private chat.