diff options
| author | Clawd <ai@clawd.bot> | 2026-03-08 09:58:35 -0700 |
|---|---|---|
| committer | Clawd <ai@clawd.bot> | 2026-03-08 09:58:35 -0700 |
| commit | 975acc2bf48ddbd98d58864ba04f95b2fcca6803 (patch) | |
| tree | e83bc32a466f424e9086a6f4e10d7b4276d51946 /docs/typing-indicators.md | |
| parent | 4522797a0cf378cc44485ed77a01dee9643b6ebe (diff) | |
Add ephemeral event support (kinds 20000-29999)
Per NIP-01, ephemeral events are broadcast to subscribers but not
persisted to storage. This enables real-time features like typing
indicators without bloating the database.
Also adds typing-indicators.md spec for kind 20001.
Diffstat (limited to 'docs/typing-indicators.md')
| -rw-r--r-- | docs/typing-indicators.md | 80 |
1 files changed, 80 insertions, 0 deletions
diff --git a/docs/typing-indicators.md b/docs/typing-indicators.md new file mode 100644 index 0000000..a85633d --- /dev/null +++ b/docs/typing-indicators.md | |||
| @@ -0,0 +1,80 @@ | |||
| 1 | # Typing/Thinking Indicators | ||
| 2 | |||
| 3 | Ephemeral events for real-time activity feedback in Nostr conversations. | ||
| 4 | |||
| 5 | ## Event Kind | ||
| 6 | |||
| 7 | **Kind 20001** - Typing/Thinking Indicator (ephemeral) | ||
| 8 | |||
| 9 | Per NIP-01, kinds 20000-29999 are ephemeral and should not be stored by relays. | ||
| 10 | |||
| 11 | ## Event Structure | ||
| 12 | |||
| 13 | ```json | ||
| 14 | { | ||
| 15 | "kind": 20001, | ||
| 16 | "content": "<status>", | ||
| 17 | "tags": [ | ||
| 18 | ["p", "<recipient_pubkey>"], | ||
| 19 | ["e", "<event_id_being_replied_to>", "", "reply"] | ||
| 20 | ], | ||
| 21 | "created_at": <unix_timestamp>, | ||
| 22 | "pubkey": "<sender_pubkey>", | ||
| 23 | "id": "<event_id>", | ||
| 24 | "sig": "<signature>" | ||
| 25 | } | ||
| 26 | ``` | ||
| 27 | |||
| 28 | ### Content Values | ||
| 29 | |||
| 30 | | Value | Meaning | | ||
| 31 | |-------|---------| | ||
| 32 | | `typing` | User is composing a message | | ||
| 33 | | `thinking` | Agent is processing/generating | | ||
| 34 | | `stopped` | Activity stopped (explicit clear) | | ||
| 35 | | `` (empty) | Clear indicator | | ||
| 36 | |||
| 37 | ### Tags | ||
| 38 | |||
| 39 | - `p` (required): Pubkey of the recipient | ||
| 40 | - `e` (optional): Event being replied to, with `reply` marker | ||
| 41 | |||
| 42 | ## Client Behavior | ||
| 43 | |||
| 44 | ### Sending | ||
| 45 | 1. Publish `thinking` when starting to process a message | ||
| 46 | 2. Publish actual response when done | ||
| 47 | 3. Optionally publish `stopped` or empty content to clear early | ||
| 48 | |||
| 49 | ### Receiving | ||
| 50 | 1. Subscribe to kind 20001 events where you're tagged | ||
| 51 | 2. Display indicator while active | ||
| 52 | 3. Auto-clear after ~15 seconds if no update (stale indicator) | ||
| 53 | 4. Clear immediately when: | ||
| 54 | - Receive `stopped` or empty content from same pubkey | ||
| 55 | - Receive an actual message (kind 1, 4, 14, etc.) from same pubkey | ||
| 56 | |||
| 57 | ## Example Flow | ||
| 58 | |||
| 59 | ``` | ||
| 60 | Agent receives message | ||
| 61 | └─> Publish kind:20001 content:"thinking" p:[user] | ||
| 62 | └─> Process request... | ||
| 63 | └─> Publish kind:1 content:"Here's the answer..." (reply) | ||
| 64 | └─> (indicator auto-clears on client when they see the kind:1) | ||
| 65 | ``` | ||
| 66 | |||
| 67 | ## Relay Support | ||
| 68 | |||
| 69 | Relays SHOULD: | ||
| 70 | - Forward ephemeral events to matching subscriptions | ||
| 71 | - NOT persist ephemeral events to storage | ||
| 72 | - NOT return ephemeral events in REQ responses for historical data | ||
| 73 | |||
| 74 | muxstr handles this correctly as of the ephemeral event support addition. | ||
| 75 | |||
| 76 | ## Security Considerations | ||
| 77 | |||
| 78 | - Indicators reveal that someone is actively engaged with you | ||
| 79 | - Consider privacy implications before implementing | ||
| 80 | - Clients MAY offer a setting to disable sending indicators | ||
