# NousResearch/hermes-agent · Inject Discord channel topic into agent session context

## Open now

- 1 issue, 0 PRs open on GitHub.
- #40532: feat(discord): inject channel topic/description into agent context

These issues and pull requests concern adding Discord channel or forum topic/description data to the context available during agent sessions. The work spans gateway and Discord integration layers.

## TL;DR

- 3 member(s): 1 open issue(s), 1 closed issue(s), 0 open PR(s), 1 merged PR(s), 0 PR(s) closed without merging.
- A fix was merged to main in PR #248. Verify it addresses your case.
- **Recommended:** read PR #248 (and any competing PRs below) before filing. Confirm the merged change covers your symptom.

## Maintainer resolution verdict

- Internal-tracker verdict over this cluster's issue members: `partially_resolved` · deciding PR(s): `pr-248`. This is distinct from the fix status above. Weigh it yourself.

## How this cluster was grouped

- Link evidence (`STRUCTURAL_PARTIAL`): some members are connected by structural evidence (shared changed files, or a closing/superseded reference); the rest are joined by an automated relevance judgement over their text.
- Members outside that structural core may belong to a different underlying problem.
- Pairwise link density `0.45`: the share of member pairs that carry a link, counting a structural link in full and a relevance-only link at 0.36. `1.00` means every pair is linked.

## Open related issues

- #40532: feat(discord): inject channel topic/description into agent context

## Closed / duplicate issues

- #163: Feature Request: Include Discord channel topic in session context

## Prior & competing PRs

- **#248: feat(gateway): include Discord channel topic in session context**. merged to main · fix tier `verified`
  - maintainer direction: category `merged`
  - files: `gateway/platforms/base.py`, `gateway/platforms/discord.py`, `gateway/session.py`
  - fix hunks:
  - `gateway/platforms/base.py`

    ```diff
    @@ -736,9 +736,13 @@ def build_source(
             chat_type: str = "dm",
             user_id: Optional[str] = None,
             user_name: Optional[str] = None,
    -        thread_id: Optional[str] = None
    +        thread_id: Optional[str] = None,
    +        chat_topic: Optional[str] = None,
         ) -> SessionSource:
             """Helper to build a SessionSource for this platform."""
    +        # Normalize empty topic to None
    +        if chat_topic is not None and not chat_topic.strip():
    +            chat_topic = None
             return SessionSource(
                 platform=self.platform,
                 chat_id=str(chat_id),
    ```

    ```diff
    @@ -747,6 +751,7 @@ def build_source(
                 user_id=str(user_id) if user_id else None,
                 user_name=user_name,
                 thread_id=str(thread_id) if thread_id else None,
    +            chat_topic=chat_topic.strip() if chat_topic else None,
             )
         
         @abstractmethod
    ```
  - `gateway/platforms/discord.py`

    ```diff
    @@ -542,6 +542,9 @@ def _build_slash_event(self, interaction: discord.Interaction, text: str) -> Mes
                 chat_name = interaction.channel.name
                 if hasattr(interaction.channel, "guild") and interaction.channel.guild:
                     chat_name = f"{interaction.channel.guild.name} / #{chat_name}"
    +        
    +        # Get channel topic (if available)
    +        chat_topic = getattr(interaction.channel, "topic", None)
     
             source = self.build_source(
                 chat_id=str(interaction.channel_id),
    ```

    ```diff
    @@ -549,6 +552,7 @@ def _build_slash_event(self, interaction: discord.Interaction, text: str) -> Mes
                 chat_type=chat_type,
                 user_id=str(interaction.user.id),
                 user_name=interaction.user.display_name,
    +            chat_topic=chat_topic,
             )
     
             msg_type = MessageType.COMMAND if text.startswith("/") else MessageType.TEXT
    ```

    ```diff
    @@ -661,6 +665,9 @@ async def _handle_message(self, message: DiscordMessage) -> None:
             if isinstance(message.channel, discord.Thread):
                 thread_id = str(message.channel.id)
             
    +        # Get channel topic (if available - TextChannels have topics, DMs/threads don't)
    +        chat_topic = getattr(message.channel, "topic", None)
    +        
             # Build source
             source = self.build_source(
                 chat_id=str(message.channel.id),
    ```

    ```diff
    @@ -669,6 +676,7 @@ async def _handle_message(self, message: DiscordMessage) -> None:
                 user_id=str(message.author.id),
                 user_name=message.author.display_name,
                 thread_id=thread_id,
    +            chat_topic=chat_topic,
             )
             
             # Build media URLs -- download image attachments to local cache so the
    ```
  - `gateway/session.py`

    ```diff
    @@ -44,6 +44,7 @@ class SessionSource:
         user_id: Optional[str] = None
         user_name: Optional[str] = None
         thread_id: Optional[str] = None  # For forum topics, Discord threads, etc.
    +    chat_topic: Optional[str] = None  # Channel topic/description (Discord, Slack)
         
         @property
         def description(self) -> str:
    ```

    ```diff
    @@ -75,6 +76,7 @@ def to_dict(self) -> Dict[str, Any]:
                 "user_id": self.user_id,
                 "user_name": self.user_name,
                 "thread_id": self.thread_id,
    +            "chat_topic": self.chat_topic,
             }
         
         @classmethod
    ```

    ```diff
    @@ -87,6 +89,7 @@ def from_dict(cls, data: Dict[str, Any]) -> "SessionSource":
                 user_id=data.get("user_id"),
                 user_name=data.get("user_name"),
                 thread_id=data.get("thread_id"),
    +            chat_topic=data.get("chat_topic"),
             )
         
         @classmethod
    ```

    ```diff
    @@ -154,6 +157,10 @@ def build_session_context_prompt(context: SessionContext) -> str:
             lines.append(f"**Source:** {platform_name} (the machine running this agent)")
         else:
             lines.append(f"**Source:** {platform_name} ({context.source.description})")
    +    
    +    # Channel topic (if available - provides context about the channel's purpose)
    +    if context.source.chat_topic:
    +        lines.append(f"**Channel Topic:** {context.source.chat_topic}")
     
         # User identity (especially useful for WhatsApp where multiple people DM)
         if context.source.user_name:
    ```

## Fix status

- Merged to main in PR #248 (cited above). No release data is tracked. Verify downstream.
- Fix last verified (merged) `2026-03-02`. This confirmation is old and may be out of date (a revert/reopen would not have invalidated it here); re-verify.
- Subsystem: `gateway`
