Skip to content

feat(server): add the proactive engine and its ledger - #24

Draft
zakiego wants to merge 11 commits into
mainfrom
zaki/proactive-agent-design
Draft

zakiego wants to merge 11 commits into
mainfrom
zaki/proactive-agent-design

Conversation

@zakiego

@zakiego zakiego commented Nov 24, 2026 •

Copy link
Copy Markdown
Owner

TL;DR: An agent can now message you first. With proactive on, it checks your calendar and personal WhatsApp every 30 minutes and tells you when to leave, when a meeting starts, when an event moves and who is still waiting for your reply, plus a morning and evening summary. It's per agent and off until you turn it on in the agent's new Proactive tab.

Demo

Red boxes mark what changed.

Before / After (desktop)

Before / After (390 px)

What changed

  • docs/rfc/proactive.md: the design and the decisions behind it. docs/PLAN.md gets section 6d and the four new tables.
  • gcal: events now carry their video link and whether you declined, and the connector has a server-side events action the engine reads.
  • Engine (internal/proactive, a scheduler extension): ticks collect from the sources without the model, reconcile into a nudges ledger (one row per key, so nothing is told twice), then one fast call with zero tools picks what to send and words it. Leave-now and meeting-start nudges fire at their minute from a template, no model. Quiet hours, a per-hour cap, one escalation per chat, and morning and evening summaries. Adds migration 0027_proactive.
  • Owner actions: ndg: buttons (done, snooze 1h/3h/tomorrow, mute) and WhatsApp replies quoting the message, handled by the router before the model.
  • RPCs getProactiveFn, saveProactiveFn, unmuteProactiveFn, checkProactiveNowFn (also MCP tools), and a proactive connector with chat tools (get_proactive, update_proactive, mute_proactive, unmute_proactive, list_nudges, check_proactive_now), offered only in your own turns in your own chats.
  • Dashboard: a Proactive tab on the agent page. Every control saves inline. The off state shows only the switch, the target and the sources.
  • Worst-case fixture data for the tab, connector docs page and changelog.

WhatsApp needs zakiego/wa-hub#19 (structured list_chats with a since filter). Until that's deployed, the WhatsApp source reports a clear error on the tab and calendar keeps working.

How I checked

  • pnpm typecheck: exit 0.
  • pnpm test: all 79 Go packages pass. apps/app 211 tests (7 new for the tab), apps/site 30, apps/host-bridge 36, apps/edge 11.
  • gofmt -l . prints nothing, go vet ./... is clean, pnpm release check passes.
  • New Go tests: config bounds and merge patch, seed then tell, held nudges, a chat answered on the phone closing its nudge, a moved event, a single escalation, quiet hours held until the morning summary, owner actions through the router, source failure told once a day, turning off, the model's decision with untrusted text fenced, and the gcal events action.
  • Ran the real dashboard on the worst fixture at 1280, 768 and 390 px. The live engine ticked against the dev stand-ins and showed real source errors on the tab. A switch change saved and survived a reload.
  • Two fresh-eyes reviews of the tab. Fixed: no auto-picked target chat, names wrap instead of truncating, retry on load error, every request in one queue with rollback to the last confirmed state, and toast.promise for Check now.

Changelog

  • Agents, Added: Proactive messages per agent. It checks your calendar and WhatsApp, then tells you when to leave or who is waiting. Adds a migration.

@zakiego zakiego added the enhancement New feature or request label Nov 24, 2026
@zakiego zakiego self-assigned this Nov 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant