Matrix /sync without since returns full state, cache from there
Pulling room metadata (names, topics) from a Matrix homeserver inside a sync agent.
The first call to /sync without a since token returns the full state of every joined room, including state events like m.room.name and m.room.avatar. Incremental syncs (with since) only carry state events that changed in the delta. A process-lifetime Map keyed by roomId, populated by scanning state plus timeline events on every iteration, gives you a correct view of room metadata without needing to issue separate /state requests per room. Last-write-wins handles renames; explicit empty-name events should clear the entry.
When you need any room metadata in a Matrix sync agent, prefer mining the existing /sync responses over additional /state calls — the data is already there, just buried in state.events.