Skip to content

Spec: Mobile Human Inbox, approvals and push notifications #1646

Open
1 of 2 issues completed
Open

Description

@DoodleBears

Parent: #1643

Problem Statement

The most time-sensitive moments with a PersonaBot are when it stops and waits for the Human: a Tool approval, a formal Human question, a private input request, or a reply the Human asked to be told about. Away from the computer, the Human only finds out when they next sit down, so Bots sit blocked for hours. IM Approval destinations help only for Bots connected to an external IM, and they are not the Human's own inbox.

Solution

The phone gets a push notification when something in the Human Inbox needs the Human. Tapping it opens a native screen where the Human approves or rejects the tool call, answers the question, or reads the reply, and the Bot continues immediately. The app also has a native Human Inbox list mirroring the one in Activity Center. Notifications carry no conversation content; the phone fetches details from the computer over the paired route.

User Stories

  1. As the Human, I want a push notification when a PersonaBot requests a Tool approval, so that it is not blocked while I am away.
  2. As the Human, I want a push notification when a PersonaBot asks me a formal Human question, so that I can answer quickly.
  3. As the Human, I want a push notification when a private input request (ask-secret) is waiting, so that I know a Bot needs a credential.
  4. As the Human, I want a push notification for mentions and replies that Channel Attention marks action-required, so that I hear about what matters and not every message.
  5. As the Human, I want notifications to show the PersonaBot's name and the kind of request but no message text, so that nothing sensitive passes through Apple, Google or Expo servers.
  6. As the Human, I want tapping a notification to open the exact approval, question or DM, so that I act in one step.
  7. As the Human, I want to approve once or reject a Tool approval natively, with the tool name and arguments shown readably, so that I can decide safely on a small screen.
  8. As the Human, I want to answer a formal Human question natively, including choice and free-text answers, so that I do not need the full client.
  9. As the Human, I want private input requests to open in the full client (or a native secure form if the existing contract allows), so that secrets are entered through the authenticated Owner path only.
  10. As the Human, I want a native Human Inbox list with unresolved actions first, then mentions/replies, then handled history, so that it matches Activity Center.
  11. As the Human, I want an item to disappear from the phone when I resolve it on the computer or another device, so that I never answer twice.
  12. As the Human, I want a clear message when an approval was already decided or expired, so that I understand why my tap had no effect.
  13. As the Human, I want an app icon badge with the count of unresolved actions, so that I see pending work at a glance.
  14. As the Human, I want to turn notification kinds on or off per kind, so that I control interruptions.
  15. As the Human, I want notifications to stop for a device as soon as I revoke it, so that a lost phone receives nothing.
  16. As the Human, I want notifications to still arrive when the app is closed, so that I do not need to keep it open.
  17. As the Human, I want a "test notification" button, so that I can confirm setup works.
  18. As a BotHarness developer, I want push sends recorded as bounded developer diagnostics (kind, device, outcome, never content), so that "I didn't get notified" is debuggable.

Implementation Decisions

  • Source of truth stays the Human Inbox. Push is a projection of action-required Human Inbox items; it does not create a second notification authority or copy Channel content (CONTEXT.md: Human Inbox, Channel Attention).
  • Decisions use existing bridge methods: the same Tool approval, Human question and ask-secret methods the live CLI verbs call (tool-approval-*, user-question-*, ask-secret-*). First accepted decision wins, as today; the phone handles "already decided" as a coded refusal.
  • Push delivery module on the Host (application-defined, one deep module): subscribes to Human Inbox changes, decides which items notify per device preferences, sends a content-free payload (item id, kind, PersonaBot id) to Expo Push Service, records outcome, retries with bounds, and drops tokens Expo reports invalid. Push tokens are registered per paired device and deleted on revocation.
  • Why Expo Push Service: the Host can send directly over HTTPS without operating our own APNs/FCM server or holding APNs keys on the Human's machine. If relying on Expo's service is rejected later, the module's sender is the only part to replace (t3code sends through its hosted relay instead).
  • App: expo-notifications registration after pairing, deep-link routing from a notification to the item screen, native Inbox list fed by the existing Activity/Inbox stream, badge count from unresolved items.
  • Payload privacy: title is " needs your approval" style text; no message body, tool arguments or question text in the push.

Testing Decisions

  • Host: test the push delivery module through its public interface with a fake Expo sender: an approval admitted → exactly one send per enabled device; resolved elsewhere → no send / badge update; revoked device → no send; invalid token → token removed. Prior art: existing Host owner module tests in packages/core/test/.
  • App: component tests for approval and question screens, including already-decided and expired states.
  • Acceptance on a physical device with a real isolated Host and a real PersonaBot: trigger a Tool approval, receive the push with the app closed, approve from the notification, and see the Bot continue in the DM. Record it for the PR.

Out of Scope

  • iOS Live Activities and widgets (t3code has them; later).
  • Notification content previews or end-to-end encrypted rich notifications.
  • IM Approval destinations and external Approvers (unchanged; separate feature).
  • Email or desktop notifications.

Further Notes

Depends on device pairing (#1643 workstream 1) for per-device registration and revocation, and on the app foundation (workstream 2) for the app shell. Reference: t3code apps/mobile/modules/t3-agent-notifications, infra/relay/src/agentActivity.

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:fullstackEnd-to-end Host and Client implementationfeature:inboxBot Inbox and Human Inbox attentionready-for-agentFully specified, ready for an AFK agentscope:specNormative specification for follow-on slices

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions