McAgent
macOS appMcAgent is a local-first macOS menu-bar agent that remembers what was on your screen, finds open loops like promises and follow-ups, and drafts the email to close them, sending nothing without your approval.
Built by Sehaj Preet. Started , last updated .

How it works
- Reads on-screen text through the macOS Accessibility API. No screenshots.
- Stores memories in SQLite with FTS5 and sqlite-vec, and searches them with hybrid keyword + embedding retrieval.
- A hand-written function-calling loop searches memory and Gmail, drafts a reply, waits for you to approve the exact text, then checks it landed in Sent.
- The agent has no send tool. Recipient and authority rules live in code, and screen text is treated as data, never as instructions.
Numbers
- 97% Recall@5 and 0.94 MRR on memory search (31 questions over 45 memories).
- Open-loop detection: 100% precision and recall on 43 labelled screens; 91% precision and 100% recall on 16 held-out screens; 0 unsafe closes.
- 12/12 agent scenarios passed, including prompt injection. 0 emails sent by the agent.
The eval that passed and was still wrong
My first agent eval scored 10/10, while one of the drafts agreed to renew an 11-month lease on the user's behalf. The rubric had no axis for authority. I fixed the eval first, then moved the rule out of the prompt and into code.
Screenshots


Stack
- Swift 6 / SwiftUI
- macOS Accessibility API
- Python 3.13 + FastAPI + Pydantic
- SQLite (WAL) + FTS5 + sqlite-vec
- Gemini embeddings + Gemini Flash
- SSE streaming
- Gmail API (OAuth token in Keychain)
- pytest