Summary
Allow binding a custom system_prompt (or soul override) to individual Telegram DM topics and group forum topics, so each topic can have its own agent personality/instructions without affecting other topics.
Current Behavior
SOUL.md is global — all chats share the same identity
agent.system_prompt in config.yaml is global
AGENTS.md is based on filesystem TERMINAL_CWD, not per-chat
/personality is session-level and must be manually switched
- Topics can only bind a
skill as a workaround, but that's a hack — skills are injected into the user message, not the system prompt, and only on new sessions
Proposed Behavior
Add an optional system_prompt field to dm_topics and group_topics config:
platforms:
telegram:
extra:
dm_topics:
- chat_id: 123456789
topics:
- name: Code Review
system_prompt: |
You are a senior code reviewer. Be concise, focus on bugs and security issues.
# skill can coexist
skill: code-review
- chat_id: -1001234567890
group_topics:
topics:
- thread_id: 5
system_prompt: "你是代码审查专家,用中文回复"
- thread_id: 12
system_prompt: "You are a research assistant specialized in ML papers"
The topic-level system_prompt would be injected into the system prompt stack after SOUL.md (layer 2 in _build_system_prompt), so it supplements but doesn't replace the global identity.
Use Cases
- Team supergroup with different topic personas (Engineering, Research, Support)
- DM topics for different projects with domain-specific instructions
- Different language preferences per topic
- Different output format/style per topic without creating hacky skills
Implementation Notes
- Add
topic_system_prompt: Optional[str] to MessageEvent (base.py)
- Read
system_prompt from topic config in Telegram adapter's _parse_message
- Inject in
_build_system_prompt after SOUL.md, before tool guidance
- Apply on every message (not just new sessions), since it's part of the system prompt stack
- Consider adding a
soul field as an alternative that fully replaces SOUL.md for that topic
Summary
Allow binding a custom
system_prompt(orsouloverride) to individual Telegram DM topics and group forum topics, so each topic can have its own agent personality/instructions without affecting other topics.Current Behavior
SOUL.mdis global — all chats share the same identityagent.system_promptinconfig.yamlis globalAGENTS.mdis based on filesystemTERMINAL_CWD, not per-chat/personalityis session-level and must be manually switchedskillas a workaround, but that's a hack — skills are injected into the user message, not the system prompt, and only on new sessionsProposed Behavior
Add an optional
system_promptfield todm_topicsandgroup_topicsconfig:The topic-level
system_promptwould be injected into the system prompt stack after SOUL.md (layer 2 in_build_system_prompt), so it supplements but doesn't replace the global identity.Use Cases
Implementation Notes
topic_system_prompt: Optional[str]toMessageEvent(base.py)system_promptfrom topic config in Telegram adapter's_parse_message_build_system_promptafter SOUL.md, before tool guidancesoulfield as an alternative that fully replaces SOUL.md for that topic