You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/message-flow.md
+16-7Lines changed: 16 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,13 +4,14 @@ How user messages reach Gordie and how Gordie responds, from webhook to delivery
4
4
5
5
## Entry Points
6
6
7
-
Three webhooks accept inbound messages. Each returns immediately and processes the message in a background thread.
7
+
Three webhooks accept inbound messages. Each returns immediately and processes the message in a background thread. Discord can also run through an outbound Gateway bot for local installs.
@@ -22,7 +23,8 @@ Inbound webhooks run the same guard sequence before processing. Verification log
22
23
4.**SMS-only: rate limiting** — in-memory sliding window (5 messages per 60 seconds per phone number)
23
24
5.**SMS-only: opt-out/opt-in** — STOP/START keywords (and variants like UNSUBSCRIBE, CANCEL, END, QUIT) are handled inline and short-circuit before reaching the agent. Opted-out users receive no responses until they send START
24
25
6.**SMS-only: cold start** — if the phone number has no registered user, a pending user record is created and an OAuth link is sent via SMS instead of invoking the agent
25
-
7.**Discord-only: deferred response** — slash commands return Discord response type `5`, then Gordie edits the original interaction response after the agent finishes
26
+
7.**Discord interactions-only: deferred response** — slash commands return Discord response type `5`, then Gordie edits the original interaction response after the agent finishes
27
+
8.**Discord gateway-only: allowlist + mention filter** — direct messages are accepted from `DISCORD_ALLOWED_USER_IDS`; server messages require an @mention unless `DISCORD_REQUIRE_MENTION=false`
26
28
27
29
## Billing Enforcement
28
30
@@ -40,7 +42,7 @@ Each channel resolves a `thread_id` to maintain conversation continuity through
40
42
41
43
**SMS** maps each phone number to one `conversation_threads` row for the SMS medium.
42
44
43
-
**Discord** maps each Discord user ID to one `conversation_threads` row for the Discord medium. The latest Discord interaction token for that thread is stored in `discord_interaction_targets` so the response adapter can edit the deferred original response.
45
+
**Discord** maps each Discord user ID to one `conversation_threads` row for the Discord medium. Interactions mode stores the latest Discord interaction token for that thread in `discord_interaction_targets` so the response adapter can edit the deferred original response. Gateway mode sends the captured response directly back to the Discord channel.
44
46
45
47
## Agent Processing
46
48
@@ -131,12 +133,18 @@ The response node (`agent/response_node.py`) dispatches the final message throug
After dispatch, the response node calls `summarize_and_store_conversation()` which uses GPT-4o-mini to extract a summary, key topics, players mentioned, and decisions made from the last 10 messages. Summaries are stored in both:
@@ -147,14 +155,15 @@ After dispatch, the response node calls `summarize_and_store_conversation()` whi
0 commit comments