Repository navigation
Closed
Labels
complexity-mediumComplexity: medium (board points 5-8)priority-p2Importanttype-featureNew functionality
Description
Problem
Trinity agents can only respond to channel messages. They cannot initiate a conversation — there is no way for a scheduled task, a process step, or an agent-to-agent signal to push a message to a specific user on Telegram / Slack / web.
Concretely:
telegram_adapter.send_response()only runs inside the inbound pipelinesend_notificationMCP tool broadcasts to the Trinity WebSocket, not to external channels- The
announceskill can post to a preconfigured channel via env var, but it is a CLI side-channel, not an agent runtime capability
This blocks real use cases: reminders, monitoring alerts, scheduled reports, follow-ups after long-running work.
Proposed approach
One new MCP tool — send_message — that resolves a recipient by verified email (the identity key from #311) and dispatches through the correct channel adapter.
send_message(
recipient_email: str, # verified email; MUST be in agent_sharing OR owner
text: str,
channel: \"auto\" | \"telegram\" | \"slack\" | \"web\" = \"auto\",
reply_to_thread: bool = False, # continue last thread if one exists
)
Resolution:
telegram→ look uptelegram_chat_linkswhereverified_email = recipient_emailANDbinding_idbelongs to the calling agentslack→ look up existing DM channel inslack_channel_agents/slack_active_threadsweb→ WebSocket push + persisted message onpublic_chat_sessions(user sees it on next load)auto→ prefer the channel the user most recently used
Reuse map
| Existing primitive | Role |
|---|---|
agent_sharing (#311) |
Authorization — recipient must be in the agent's allow-list |
telegram_chat_links.verified_email (#311) |
Telegram recipient resolution |
telegram_adapter._send_message() |
Outbound transport — already battle-tested |
slack_service.send_message() |
Slack transport — already used for auth prompts |
MCP auth context (agent_name, scope='agent') |
Caller identity — agents can only message their own users |
What's actually new
- MCP tool
send_messageinsrc/mcp-server/src/tools/(new module or extendnotifications.ts) - Backend endpoint
POST /api/agents/{name}/messages— does the authorization + channel dispatch - Rate limiting (per agent, per recipient) to prevent spam — reuse the adapter-layer limiter
- Optional:
last_active_channelcolumn onagent_sharingor a lightweightuser_channel_activitytable forautorouting
Authorization rules
- Agent can only message users where
agent_sharing(agent_name, shared_with_email)exists (or the owner) - Agent cannot message arbitrary Telegram IDs or Slack users
- Admin/
systemscope bypass — needed for platform notifications - Rate limit: e.g. 10 proactive messages per recipient per hour, configurable per agent
Open questions
- Consent: should users opt-in to receive proactive messages, or is being in
agent_sharingenough? Leaning:agent_sharing= implicit consent; add a/stopcommand per channel to revoke. - Process Engine integration: the
notificationstep type should grow achannelparameter so scheduled processes can push via this tool. - Delivery receipts: do we need callbacks when the user reads the message, or is fire-and-forget fine for v1? (Fire-and-forget v1.)
- Cost / abuse: should proactive sends count against the agent's cost budget even though they don't invoke the LLM?
Out of scope
- Group broadcasts (post to every member of a Slack channel) — v2
- Scheduled messaging primitives (send at X) — already possible via schedules + this tool
- WhatsApp / SMS channels
Metadata
Metadata
Assignees
Labels
complexity-mediumComplexity: medium (board points 5-8)priority-p2Importanttype-featureNew functionality
Activity
feat(messaging): proactive agent messaging via send_message MCP tool (#…
docs: add proactive-messaging feature flow (#321)
docs: update architecture.md for proactive messaging (#321)
feat(messaging): proactive agent messaging via send_message MCP tool (A…
feat(ui): add allow_proactive toggle to SharingPanel (#376)
feat(ui): add allow_proactive toggle to SharingPanel (#376) (#377)
feat(sharing): notify requester on channel access-request approval (#951
fix(access): restore the per-recipient proactive-messaging toggle (#1577
feat(channels): make proactive message rate limits admin-configurable (…
feat(channels): make proactive message rate limits admin-configurable (…
Release: v0.8.5 (#1781)
fix(channels): key the inheritance provenance guard on the principal,…
Release: v0.9.0 (#2268)