gateway-cache-sync-keeper
Skill1.1k starsChanged 35 days agoMITView on GitHub
Maintain gateway event handlers — payload hydration, cache mutation, event return shapes, and handler registration. Use when touching WebSockets/Events, Handlers.php, or Event.php.
Trending
More talk lately.about the whole repository
Who's talking about discord-php/DiscordPHP
- @throwable.bsky.social“📦 team-reflex/discord-php v10.45.21 An unofficial API to interact with the voice and text service Discord. …”Bluesky · Feb 27, 2026 · 1 likes
- crimsonstrife/streamer.live“Bump team-reflex/discord-php from 10.18.24 to 10.18.45”GitHub · Aug 19, 2025 · 1 reactions
- crimsonstrife/streamer.live“Bump team-reflex/discord-php from 10.18.0 to 10.18.5”GitHub · Jul 8, 2025 · 1 reactions
- crimsonstrife/streamer.live“build(deps): bump team-reflex/discord-php from 10.17.0 to 10.17.3”GitHub · Jun 16, 2025 · 1 reactions
- crimsonstrife/streamer.live“build(deps): bump team-reflex/discord-php from 10.13.1 to 10.14.0”GitHub · Jun 9, 2025 · 1 reactions
The biggest 5 of 52 mentions linking to the repository that our crawl found. Each line is their own headline.
See all 52
Talked about on GitHub and Bluesky (52 times).
On GitHub · 50
- Aug 19, 2025Bump team-reflex/discord-php from 10.18.24 to 10.18.45 — crimsonstrife/streamer.live1 reaction · 2 comments
- Jul 8, 2025Bump team-reflex/discord-php from 10.18.0 to 10.18.5 — crimsonstrife/streamer.live1 reaction · 3 comments
- Jun 16, 2025build(deps): bump team-reflex/discord-php from 10.17.0 to 10.17.3 — crimsonstrife/streamer.live1 reaction · 3 comments
- Jun 9, 2025build(deps): bump team-reflex/discord-php from 10.13.1 to 10.14.0 — crimsonstrife/streamer.live1 reaction · 3 comments
- Jun 2, 2025build(deps): bump team-reflex/discord-php from 10.10.12 to 10.11.6 — crimsonstrife/streamer.live1 reaction · 3 comments
45 more on GitHub
- May 26, 2025build(deps): bump team-reflex/discord-php from 10.10.0 to 10.10.6 — crimsonstrife/streamer.live1 reaction · 2 comments
- May 19, 2025build(deps): bump team-reflex/discord-php from 10.7.3 to 10.8.5 — crimsonstrife/streamer.live1 reaction · 2 comments
- May 5, 2025build(deps): bump team-reflex/discord-php from 10.7.1 to 10.7.2 — crimsonstrife/streamer.live1 reaction · 2 comments
- Apr 28, 2025build(deps): bump team-reflex/discord-php from 10.4.7 to 10.7.1 — crimsonstrife/streamer.live1 reaction · 3 comments
- Mar 25, 2025build(deps): bump team-reflex/discord-php from 10.4.3 to 10.4.4 — crimsonstrife/streamer.live1 reaction · 3 comments
- Jul 18, 2024✨ Add support for polls — laracord/framework1 reaction
- May 11, 2024update d.py/d.php polls — advaith1/libs1 reaction · 1 comment
- Nov 2, 2026build(deps): update team-reflex/discord-php requirement from 10.66.* to 10.71.* — smrealms/smr0 reactions
- Oct 26, 2026build(deps): update team-reflex/discord-php requirement from 10.66.* to 10.69.* — smrealms/smr0 reactions · 1 comment
- Oct 20, 2026build(deps): update team-reflex/discord-php requirement from 10.66.* to 10.68.* — smrealms/smr0 reactions · 1 comment
- Oct 19, 2026Bump team-reflex/discord-php from 10.59.0 to 10.67.0 — omnicolor/commlink0 reactions · 1 comment
- Oct 14, 2026build(deps): update team-reflex/discord-php requirement from 10.66.* to 10.67.* — smrealms/smr0 reactions · 1 comment
- Oct 13, 2026Bump team-reflex/discord-php from 10.59.0 to 10.66.3 — omnicolor/commlink0 reactions · 1 comment
- Oct 6, 2026Bump team-reflex/discord-php from 10.59.0 to 10.66.1 — omnicolor/commlink0 reactions · 1 comment
- Oct 5, 2026Bump team-reflex/discord-php from 10.59.0 to 10.65.0 — omnicolor/commlink0 reactions · 1 comment
- Oct 1, 2026build(deps): update team-reflex/discord-php requirement from 10.49.* to 10.66.* — smrealms/smr0 reactions
- Oct 1, 2026Bump team-reflex/discord-php from 10.57.0 to 10.59.0 — omnicolor/commlink0 reactions
- Sep 30, 2026build(deps): update team-reflex/discord-php requirement from 10.49.* to 10.62.* — smrealms/smr0 reactions · 1 comment
- Sep 29, 2026Bump team-reflex/discord-php from 10.57.0 to 10.58.0 — omnicolor/commlink0 reactions · 1 comment
- Sep 28, 2026build(deps): update team-reflex/discord-php requirement from 10.49.* to 10.59.* — smrealms/smr0 reactions · 1 comment
- Sep 25, 2026build(deps): update team-reflex/discord-php requirement from 10.49.* to 10.58.* — smrealms/smr0 reactions · 1 comment
- Sep 25, 2026Bump team-reflex/discord-php from 10.56.18 to 10.57.0 — omnicolor/commlink0 reactions
- Sep 23, 2026Bump team-reflex/discord-php from 10.56.17 to 10.56.18 — omnicolor/commlink0 reactions
- Sep 21, 2026build(deps): update team-reflex/discord-php requirement from 10.49.* to 10.57.* — smrealms/smr0 reactions · 1 comment
- Sep 14, 2026Bump team-reflex/discord-php from 10.56.15 to 10.56.17 — omnicolor/commlink0 reactions
- Sep 7, 2026Bump team-reflex/discord-php from 10.56.10 to 10.56.15 — omnicolor/commlink0 reactions
- Sep 7, 2026build: Bump team-reflex/discord-php from 10.48.14 to 10.56.15 — VATSIM-UK/core0 reactions
- Sep 4, 2026Bump team-reflex/discord-php from 10.56.10 to 10.56.13 — omnicolor/commlink0 reactions · 1 comment
- Sep 2, 2026Bump team-reflex/discord-php from 10.56.8 to 10.56.10 — omnicolor/commlink0 reactions
- Sep 1, 2026Bump team-reflex/discord-php from 10.56.8 to 10.56.9 — omnicolor/commlink0 reactions · 1 comment
- Aug 26, 2026Bump team-reflex/discord-php from 10.55.1 to 10.56.5 — omnicolor/commlink0 reactions
- Aug 25, 2026Bump team-reflex/discord-php from 10.55.1 to 10.56.3 — omnicolor/commlink0 reactions · 1 comment
- Aug 18, 2026build(deps): update team-reflex/discord-php requirement from 10.49.* to 10.56.* — smrealms/smr0 reactions · 1 comment
- Apr 20, 2026Bump team-reflex/discord-php from 10.47.12 to 10.48.1 — crimsonstrife/streamer.live0 reactions · 1 comment
- Feb 10, 2026Bump team-reflex/discord-php from 10.45.15 to 10.45.16 — crimsonstrife/streamer.live0 reactions · 3 comments
- Nov 4, 2025Add Discord Announcement Bot System — k33bz/lastwar-server15860 reactions · 4 comments
- Oct 20, 2025Tag "@property" has error when both ? and null types are included — phpDocumentor/phpDocumentor0 reactions · 1 comment
- Nov 15, 2024Update dependency team-reflex/discord-php to v10 — System3-2/discord-bot0 reactions
- Feb 11, 2024Thread gets terminated when using a slash command with options. — DiscordBot-PMMP/DiscordBot0 reactions · 3 comments
- Jan 14, 2024Update dependency team-reflex/discord-php to v7.3.5 — Karhal/discord-gpt0 reactions
- Jan 14, 2024Update dependency team-reflex/discord-php to v7.3.5 — System3-2/discord-bot0 reactions
- Jan 31, 2023Invalid Activity URL — DiscordBot-PMMP/DiscordBot0 reactions · 3 comments
- Dec 20, 2022Another message type not supported when delete the message — DiscordBot-PMMP/DiscordBot0 reactions · 6 comments
- Aug 19, 2022[Egg Request]: DiscordPHP — pelican-eggs/eggs0 reactions · 1 comment
- Apr 17, 2022Intents help — DiscordBot-PMMP/DiscordBot0 reactions · 4 comments
On Bluesky · 2
- Feb 27, 2026📦 team-reflex/discord-php v10.45.21 An unofficial API to interact with the voice and text service Discord. 🔗… — @throwable.bsky.social1 likes and repost
- Aug 10, 2026📦 team-reflex/discord-php v10.55.0 An unofficial API to interact with the voice and text service Discord. 🔗… — @throwable.bsky.social0 likes and reposts · 1 reply
In this repository14 other files it gives its agents.
- AGENTS.mdAGENTS.md
- async-test-and-doc-syncSkill
- builder-payload-smithSkill
- helpers-and-infra-keeperSkill
- interaction-flow-keeperSkill
- legacy-command-client-keeperSkill
- part-model-maintainerSkill
- repository-cache-keeperSkill
- runtime-bootstrap-keeperSkill
- type-map-keeperSkill
- voice-subsystem-keeperSkill
- discord-php-bot-securitySkill
- discord-php-extensionSkill
- discord-php-interactionsSkill
The file
Show its rules and text
We split this skill into the rules it gives an agent
31 rules. About 0 are common, 24 are distinctive, and 7 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈24
Distinctive · estimate
This author's own choices. Worth a look.
7
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 11
Use this skill when work touches:
- Distinctive: line 21
Keep gateway handling as real-time state sync layer:
- Distinctive: line 48
update owning repositories and related caches
- Distinctive: line 53
If handler only hydrates one object and ignores related caches, change is probably incomplete.
- Distinctive: line 57
When adding or changing event family, inspect all three:
- Distinctive: line 63
If one changes and the others do not, make sure that is intentional.
- Distinctive: line 69
Use when payload contains user data.
- Very specific: line 73
Use when payload contains guild member data.
- Distinctive: line 75
Do not manually duplicate user/member cache update logic unless event family has special latency or shape constraints.
- Distinctive: line 81
Use factory plus subtype maps when payload family is polymorphic:
- Very specific: line 87
Do not push raw stdClass payloads deep into caches when repo already has typed part model.
- Distinctive: line 91
create events usually instantiate new parts and set them into owning repo
- Distinctive: line 92
update events often clone old cached part, mutate current part, and return both new and old values
- Distinctive: line 93
delete events often pull from cache and return removed typed part plus extra status
- Very specific: line 106
update author/mention/interacting user caches
- Very specific: line 109
If you change MessageCreate or MessageUpdate, inspect:
- Distinctive: line 123
Do not treat guild create as "just one guild part".
- Very specific: line 130
update parent threads repo
- Distinctive: line 140
avoid unnecessarily slow cache paths
- Distinctive: line 153
Before changing a return shape, inspect:
- Distinctive: line 161
When changing event behavior, walk this checklist:
- Distinctive: line 167
Do counters, last IDs, or status fields need sync?
- Distinctive: line 170
If you cannot answer each, handler is not fully understood yet.
- Distinctive: line 174
When adding new dispatch type:
- Very specific: line 176
add constant to Event.php
- Very specific: line 177
add handler registration to Handlers.php
- Distinctive: line 180
ensure any runtime option that disables events still behaves sensibly
- Distinctive: line 193
Do not blindly overwrite cached richer state with partial payload unless code already accounts for missing fields.
- Distinctive: line 197
prefer payload data over avoidable REST fetches
- Distinctive: line 204
Stop if you see:
- Distinctive: line 210
update event overwriting rich cached fields with partial sparse payload
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Skill: gateway-cache-sync-keeper
Use this skill when work touches:
src/Discord/WebSockets/Handlers.phpsrc/Discord/WebSockets/Event.phpsrc/Discord/WebSockets/Events/*
This is event-to-cache coherence skill. Load it when changing gateway dispatch behavior, event return shapes, or cache mutation.
Goal
Keep gateway handling as real-time state sync layer:
- dispatch payloads become typed parts
- related repositories get updated immediately
- emitted event payloads stay semantically useful
- caches for users, members, channels, messages, threads, guilds stay coherent
Read in this order
src/Discord/WebSockets/Event.phpsrc/Discord/WebSockets/Handlers.php- Matching part/repository families
- Representative events:
src/Discord/WebSockets/Events/MessageCreate.phpsrc/Discord/WebSockets/Events/MessageUpdate.phpsrc/Discord/WebSockets/Events/GuildCreate.phpsrc/Discord/WebSockets/Events/GuildDelete.phpsrc/Discord/WebSockets/Events/InteractionCreate.phpsrc/Discord/WebSockets/Events/ThreadListSync.phpsrc/Discord/WebSockets/Events/GuildMemberAdd.php
Core contract
Event classes in this repo are not dumb payload forwarders. They:
- interpret transport payloads
- instantiate correct typed parts, often via runtime
TYPESmaps - update owning repositories and related caches
- warm user/member caches from nested payloads
- preserve secondary invariants like counters or
last_message_id - return semantic values used by userland listeners
If handler only hydrates one object and ignores related caches, change is probably incomplete.
Three files usually move together
When adding or changing event family, inspect all three:
src/Discord/WebSockets/Event.php— constantsrc/Discord/WebSockets/Handlers.php— registrationsrc/Discord/WebSockets/Events/<Name>.php— implementation
If one changes and the others do not, make sure that is intentional.
Event base helpers to use
cacheUser(object $userdata)
Use when payload contains user data. Keeps top-level user cache current.
cacheMember(MemberRepository $members, array $memberdata)
Use when payload contains guild member data. Keeps guild member cache current. Some event families override details for performance reasons, like InteractionCreate.
Do not manually duplicate user/member cache update logic unless event family has special latency or shape constraints.
Hydration rules
Prefer typed parts immediately
Use factory plus subtype maps when payload family is polymorphic:
- channels from
Channel::TYPES - interactions from
Interaction::TYPES - components from component
TYPES
Do not push raw stdClass payloads deep into caches when repo already has typed part model.
Create vs update vs delete semantics matter
- create events usually instantiate new parts and set them into owning repo
- update events often clone old cached part, mutate current part, and return both new and old values
- delete events often pull from cache and return removed typed part plus extra status
Preserve those shapes unless you have strong compatibility reason to change them.
Coherence rules by family
Message events
These are easy to break because they carry many side effects:
- store or update message in channel/thread repo when configured
- keep
last_message_idcurrent - handle message-content intent limits correctly
- update author/mention/interacting user caches
- preserve old/new payload behavior on update
If you change MessageCreate or MessageUpdate, inspect:
- message cache behavior
- intent-gated content handling
- DM vs guild channel routing
- thread message counting or parent lookup logic
Guild create/delete/update families
Guild events often do bulk cache work:
- guild create populates guild repo plus member, user, voice state, thread, stage instance, scheduled event, sound caches
- guild delete must preserve unavailable-vs-removed semantics
Do not treat guild create as "just one guild part". It is bootstrap event for several nested repositories.
Thread events
Threads are child collections hanging off parent channels. Thread handlers usually must:
- locate parent channel
- update parent
threadsrepo - possibly update thread member state
- preserve thread counters or metadata
Interaction events
Interaction handlers are latency-sensitive. They still must:
- hydrate correct interaction subtype
- cache resolved users/members
- avoid unnecessarily slow cache paths
- invoke registered command handlers/autocomplete flow
Event return-shape rules
Userland listens to emitted values. Keep return shapes stable and meaningful.
Common patterns already used:
MessageCreatereturns newMessageMessageUpdatereturns[newOrData, oldMessage]GuildDeletereturns[$guildPartOrData, $unavailableFlag]
Before changing a return shape, inspect:
- existing event listeners in examples/tests/docs
- parity with sibling events in same family
- whether old state is required for consumers
Cache path playbook
When changing event behavior, walk this checklist:
- What is primary part produced by payload?
- Which repository should own it?
- Which parent or child repositories also need update?
- Which related users or members appear in payload?
- Do counters, last IDs, or status fields need sync?
- What should event listener receive back?
If you cannot answer each, handler is not fully understood yet.
Registration playbook
When adding new dispatch type:
- add constant to
Event.php - add handler registration to
Handlers.php - create event class
- choose emitted event aliases if handler needs alternatives
- ensure any runtime option that disables events still behaves sensibly
Partial payload and intent rules
Gateway payloads are not always full objects.
Examples:
- message update may be partial
- message content may be missing without
MESSAGE_CONTENTintent - interaction-related payloads may favor speed over full cache warmup
- guild create member lists vary with guild size and enabled intents
Do not blindly overwrite cached richer state with partial payload unless code already accounts for missing fields.
Performance rules
- prefer payload data over avoidable REST fetches
- reuse cache lookups instead of broad scans when possible
- but preserve correctness for parent-child lookup when repo shape demands it
- interaction path should avoid slow cache resolution that delays response handling
Smells
Stop if you see:
- event class added without handler registration
- cache update for primary part but not related repositories
- raw payload stuffed in cache when typed part exists
- user/member data in payload ignored even though later code depends on cache
- update event overwriting rich cached fields with partial sparse payload
- return shape change with no thought for existing listener contract
Checklist before commit
- event constant and handler registration aligned
- correct subtype hydration path used
- primary and related repositories updated
- user/member caches updated where payload carries them
- partial/intents behavior preserved
- event return shape still intentional and compatible
- tests/docs/examples checked if public listener contract changed
Bottom line
Gateway events are cache-synchronization code. Treat them like consistency-critical logic, not like thin adapters. One missed repository update can make the whole object graph lie.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

