
Photo by Camerauthor Photos on Unsplash
A Proactive Agent That Texts Me Before I Ask
M. Zakyuddin Munziri
@zakiego
Paste this into your coding agent. It explains the setup with your computer's numbers, tells you the good and bad parts, and only builds it if you say yes.
# Brief: a proactive agent that tells you what needs your attention before you ask
Source: https://zakiego.com/en/articles/assistant-found-what-i-never-asked
You are a coding agent. The user pasted this brief to understand a setup and maybe build their own version. Your first job is to explain it. Building it comes second, and only if they say yes.
## Your job, in order
1. Look before you talk. Read-only: what assistant or bot the user already runs (a chat bot, an agent framework, a scheduler), which chat app it talks to them on, and which of their sources it can already read (calendar, chat, email, todo) and through what (an API, an MCP server, a CLI). Don't change anything yet.
2. Explain the setup in the user's language, in plain words, using the Explain section below. Use their sources where they fit ("your calendar is already behind an MCP server, so that's one mention in the prompt").
3. Give the trade-offs from the Trade-offs section. Say plainly whether they need it at all.
4. Map it to their setup with the Porting section: what they already have, what's missing, and what doesn't exist on their system. Check each tool or API exists before you rely on it.
5. Recommend the smallest version that helps. For example: only a morning summary from the calendar and one chat app, with the ledger and quiet hours, and no memory yet.
6. Ask before building. List the files, tables, scheduled jobs, connectors and settings you'd add or change. Wait for a yes.
7. After a yes, build it from the Build spec, run the Verify steps, and report what you tested and what you didn't.
## The original setup (context, not requirements)
- A self-hosted, open-source chat assistant the owner talks to on WhatsApp. It has agents, connectors to other apps over MCP, a scheduler and an outbox for sending messages.
- Sources in the original: a calendar, two WhatsApp accounts (read through an MCP server), three mailboxes and a todo app, all as read-only MCP tools.
- It runs every hour, with a small fast model. Quiet hours are 22:00 to 07:00, with a morning and an evening summary.
- The first real message listed nine things the owner hadn't asked about, among them a client still waiting for a reply, a graduation the next day, a task from the week before and a security email about a leaked secret.
## Explain
Use this to explain, not as text to paste.
- The idea: a normal assistant waits for a question. A proactive one goes looking on its own and only messages the owner when something needs them. The owner stops searching for problems and the problems come to them.
- Three questions it answers by itself on every run: where to look (the tools the owner names), what needs the owner (the model reads and judges) and when to say it (now, at an exact minute, or not at all).
- The prompt is the flexible part. The owner writes it in plain words and mentions the tools it may read, like `@calendar__list_events`. Those mentions are the run's whole tool list, read-only.
- The code is the fixed part. It decides how often it runs, quiet hours, how many messages an hour, where messages go (only the owner's own chat), and that the same thing is never sent twice.
- The ledger: every item the model wants to send has a key, like `wa:<chatId>:<waitingSince>`. A key that was already sent, done, snoozed or muted is never sent again. This is what a "don't repeat yourself" line in a prompt can't do.
- Telling less is the hard part. Real chat lists hold weeks of chats that look like they're waiting. Many ended with a sticker, a "thanks" or an automatic location share. Reading the last messages of each chat and asking the model whether it's still open removes most of them.
- Timed reminders ("leave in 30 minutes") are scheduled to the minute from the ledger and sent with their stored text, so they don't depend on the model being up at that moment.
## Trade-offs
Good:
- It catches what the owner didn't know to ask about: a reply someone is still waiting for, an alert in an inbox they don't open.
- The owner changes what matters by editing a sentence, not code. A new source is one more mention.
- The guarantees (no repeats, quiet hours, a cap per hour, only the owner's chat) hold whatever the prompt says.
Costs and limits:
- Tokens. Every run is a model turn with tools. Skipping the model when the tool results haven't changed, and not running at all in quiet hours, saves most of it.
- Privacy. Message previews, event titles and email subjects go to the model provider. Say so to the user before they connect a source.
- Repeats still happen when the model gives the same thing a new key. The ledger can only stop a key it recognizes.
- Silent failures look like quiet days. In the original, a model that spent its whole output budget thinking returned an empty answer that read as "nothing new". Make an empty answer fail the run.
- Long look-backs are slow. Reading a week of chats and email made runs time out until the model was switched to a smaller, faster one.
- Untrusted text. Other people's messages and invites can change the wording of a message to the owner. With read-only tools that's the worst they can do; with write tools it's much worse, so don't give it any.
When not to build it:
- The user already checks their sources several times a day and misses nothing.
- Their sources have no API or tool the agent can read.
- They aren't comfortable sending message previews to a model provider.
## Porting
The original column is what was built. The others are starting points to check, not tested recipes.
| Piece | Original | Without an MCP setup | Minimal version |
| --- | --- | --- | --- |
| Sources | Read-only MCP tools (calendar, WhatsApp, email, todo) mentioned in the prompt | Each source's own API behind a small read-only function the model can call | One calendar and one chat source |
| Schedule | The assistant's own scheduler, every hour outside quiet hours | cron, a systemd timer, launchd or a cloud scheduler calling one endpoint | cron at 07:00 and 20:00 for the two summaries |
| Ledger | A `nudges` table: key, subject, status, text, wake time, sent time | Any database the assistant already uses; SQLite is enough | A table with key, status and sent time |
| Delivery | The assistant's outbox to the owner's WhatsApp DM | Whatever channel the bot already sends on (Telegram, Slack, email) | The same channel, plain text |
| Chat triage | Read the last 10 messages of each waiting chat, ask open or finished | The chat API's history call | Skip it at first and only nudge on chats waiting over a few hours |
| Memory | Short notes between runs; the owner's notes never expire, the model's expire in days | A notes table | Leave it out |
## Build spec
1. Config per agent: enabled, target chat (must be the owner's own), prompt, check interval, quiet hours, max messages per hour, morning and evening summary times, model. Validate at save and again on every run.
2. Mentions: parse `@<connector>__<tool>` from the prompt. Each must resolve to a read-only tool the agent may use. One that doesn't resolve fails the whole run with its name, never a silent partial run. Cap the number of mentions (the original allows 10).
3. The run: open the mentioned tools only, give the model the prompt, the owner's local time, the open items from the last few days, mutes and notes, and ask for JSON: `items` (key, subject, text, optional `sendAt`, optional `urgent`), `closed` (keys that are resolved), `remember` and `forget` for notes. Cap tool calls and run time.
4. Reconcile with the ledger: a new key without `sendAt` goes out now through the delivery rules; with `sendAt` it's scheduled; a key already sent, done or dropped is ignored; a muted subject is dropped; a `closed` key is closed.
5. Delivery rules in code: nothing in quiet hours unless urgent (cap urgent items per day), at most N messages an hour with the rest merged into the next one, plain text with a length cap, only to the owner's chat.
6. Timed items fire at their minute from the stored text, with no model call. One claimed more than a few minutes late expires instead of arriving late.
7. Skip the model when nothing changed: replay the last full run's tool calls with the same arguments and compare result hashes. Still do a full run every couple of hours, because a fixed time window in the arguments doesn't move with the clock.
8. Fail loudly: an empty answer, invalid JSON or a missing mention fails the run. After a few failures in a row, pause and tell the owner once.
9. Owner actions: done, snooze and mute on each message, or a reply in plain words that becomes an owner note.
## Verify
- Run it with a prompt that mentions a tool the agent can't use. Expect the save to be refused, or the run to fail with that tool's name.
- Seed a chat that ended with "thanks" and one with an open question. Expect only the open one in the message.
- Run twice with nothing changed. Expect the second run to send nothing and, with the replay skip, to use no model tokens.
- Schedule a "leave in 30 minutes" item and stop the model provider. Expect it to still arrive on time.
- Force an empty model answer. Expect a failed run, not "nothing new".
- Set quiet hours around now. Expect nothing sent, and the held items in the next summary.
## Report back
Tell the user, in their language: what you built and where, how to change the prompt and the settings, how to see what was sent and why, how to turn it off, and which Verify steps passed or weren't run.

