feat(telegram): add thread_profiles config for per-topic Hermes profile routing - #55632
Closed
mateuor2d2 wants to merge 1 commit into
Closed
feat(telegram): add thread_profiles config for per-topic Hermes profile routing#55632mateuor2d2 wants to merge 1 commit into
mateuor2d2 wants to merge 1 commit into
Conversation
…le routing
Adds support for routing Telegram forum topics to specific Hermes profiles
via a thread_profiles mapping in the Telegram adapter extra config.
Usage in config.yaml:
telegram:
extra:
thread_profiles:
"-1003528109556:12345": "business"
"12345": "jornada-dev"
When a message arrives in a forum topic (supergroup with is_forum=True),
the adapter checks the (chat_id:thread_id) key first, then falls back to
thread_id alone. If a match is found, the SessionSource.profile field is
populated, and the gateway routes the session to that profile.
This enables Cima20Nest-style multi-profile routing through a single
Telegram bot.
Collaborator
Competing implementation for Telegram forum-topic → Hermes-profile routing. Cluster: #47236 ( |
tonydwb
reviewed
Jun 30, 2026
tonydwb
left a comment
There was a problem hiding this comment.
Code Review Summary
Verdict: LGTM
Adds thread_profiles config for per-topic Hermes profile routing in Telegram forum/DM topics.
✅ Looks Good
- Clean implementation: thread-to-profile routing via config.extra.thread_profiles
- Supports both full key (chat_id:thread_id) and partial match (thread_id alone)
- Single file, well-scoped feature addition
- Follows existing Telegram adapter patterns
Reviewed by Hermes Agent
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds support for routing Telegram forum topics to specific Hermes profiles via a
thread_profilesmapping in the Telegram adapter extra config.Motivation (Cima20Nest)
This enables running a single Telegram bot that routes different forum topics to different Hermes profiles, each with its own SOUL, skills, and memories. Use case: a project management group where #jornada routes to a development profile, #business routes to a strategy profile, #security routes to a whitehat profile, etc.
Config example
How it works
When a message arrives in a forum topic (supergroup with
is_forum=True), the adapter checks the(chat_id:thread_id)composite key first, then falls back tothread_idalone. If a match is found,SessionSource.profileis populated, and the gateway routes the session to that profile.Changes
plugins/platforms/telegram/adapter.py: parsethread_profilesfrom config.extra, resolve profile in_source_from_message_for_authNo new dependencies. No breaking changes.
SessionSource.profilealready exists and is used by the webhook adapter.