app.messages as a tuple containing a and a . The space is already bound to the originating conversation — you don’t need to resolve it yourself to reply.
Receiving messages
The Message shape
Every message conforms to .Message
Message
Narrowing content
is a discriminated union. Narrow onmessage.content.type before accessing fields:
Content
Content
"effect" (an iMessage screen effect wrapping inner content) appear on messages you sent and are echoed by the platform; see iMessage for the builder.
Group-management events (rename, avatar, addMember, removeMember, leaveSpace) arrive with message.sender set to the acting user — or undefined when the platform recorded no actor — so narrow with message.sender?.id. The agent’s own actions (e.g. space.add(...)) are not echoed back.
Filtering out your own messages
Every carries adirection. Skip outbound messages when you only want user input:
Acting on a message
Every message is its own context. You can reply, react, or send new content into the space:react and reply.