-
-
Notifications
You must be signed in to change notification settings - Fork 69.5k
Feature: Auto-rename Telegram DM topics based on conversation content #51485
Copy link
Copy link
Closed
Description
Summary
Automatically rename Telegram DM forum topics when the first message arrives in a new topic/session. Currently users must either manually rename topics or instruct the agent to do it via SOUL.md/system prompt - which is unreliable since the model may ignore the instruction.
Problem
When using Telegram DM topics (forum mode in 1:1 bot chats), new topics get generic names like "Topic #123". Users have to:
- Manually rename each topic, OR
- Add instructions to SOUL.md/MEMORY.md telling the agent to rename - but this is model-dependent and unreliable (the agent frequently forgets)
This is a gateway-level concern, not something that should depend on model compliance.
Proposed Solution
Add an autoTopicLabel config option to TelegramDirectConfig and/or TelegramAccountConfig:
{
"telegram": {
"direct": {
"63448508": {
"autoTopicLabel": true
}
}
}
}Behavior
When autoTopicLabel: true and a message arrives in a DM topic:
- Detect if this is the first turn in the session (
isFirstTurnInSessionalready exists inget-reply-run.ts) - After the agent reply is sent, generate a short topic label from the user message (first ~30-50 chars, or a lightweight LLM summary)
- Call
renameTopic()(API already exists and works)
Implementation Notes
isFirstTurnInSessiondetection already exists insrc/auto-reply/reply/get-reply-run.ts:235renameTopicAPI is fully functional viaextensions/telegram/runtime-api.tseditForumTopicaction permission exists inTelegramActionConfig- Could use a simple heuristic (truncated first message) or a lightweight model call for better labels
- Should respect
actions.editForumTopicpermission - Should be opt-in (default: false)
Alternatives Considered
- Agent-level instruction (SOUL.md): Unreliable - model frequently ignores the instruction
- Internal hook on
message:sent: Would work but adds complexity; a config flag is cleaner - Manual
/set_topic_namecommand: PR feat: add /set_topic_name for telegram topic labels #46983 adds this, but does not solve the auto-rename case
Related
- PR feat: add /set_topic_name for telegram topic labels #46983 -
/set_topic_namecommand (manual rename) - Issue [Feature]: Session sidebar should show human-readable title + preview snippet #28168 - Session sidebar human-readable titles (similar concept for Control UI)
- Issue Feature: Smart session switch reminder based on context usage and topic change #47812 - Smart session switch reminder (topic change detection)
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels
Type
Fields
Give feedbackNo fields configured for issues without a type.