feat(gateway/slack): support channel_skill_bindings - #16283
Merged
Conversation
Extends the existing channel_skill_bindings mechanism (previously
Discord-only) to Slack, so a channel or DM can auto-load one or more
skills at session start without relying on the model's skill selector
for every short reply.
Motivation: Mats's German flashcards DM pushes a cron-driven card
5x/day; he responds with one-word guesses like 'work'. Previously each
reply required the main agent to decide whether to load german-flashcards
(full opus turn just to pick a skill). With the binding configured per
Slack channel, the skill is injected at session start and grading runs
directly.
Changes:
- Extract resolve_channel_skills() from DiscordAdapter._resolve_channel_skills
into gateway.platforms.base (now shared across adapters).
- DiscordAdapter._resolve_channel_skills delegates to the shared helper
(behavior preserved — existing test suite still passes unchanged).
- SlackAdapter: resolve channel_skill_bindings on each message and attach
auto_skill to MessageEvent. gateway/run.py already handles auto-skill
injection on new sessions; this just wires Slack through it.
- gateway/config.py: accept channel_skill_bindings in slack: block of
config.yaml (was Discord-only).
- Tests: new tests/gateway/test_slack_channel_skills.py with 11 cases
covering DM/thread/parent resolution, single-vs-list skills, dedup,
malformed entries. Discord suite unchanged.
- Docs: add 'Per-Channel Skill Bindings' section to Slack user guide.
Config example:
slack:
channel_skill_bindings:
- id: "D0ATH9TQ0G6"
skills: ["german-flashcards"]
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.
Port Discord's
channel_skill_bindingsfeature to Slack, sharing a new helper so both adapters stay in sync.Why
Slack channels/DMs with a dedicated purpose (flashcard DM, support channel, domain-specific Q&A) currently burn a full agent turn on skill selection for every short reply. Discord already has
channel_skill_bindingsto pre-load a skill at session start; Slack gets parity.Changes
gateway/platforms/base.py: new sharedresolve_channel_skills()helper (mirrors the existingresolve_channel_prompt()pattern — same config semantics, same lookup order).gateway/platforms/discord.py:_resolve_channel_skills()now delegates to the shared helper. No behavior change — existing tests still pass.gateway/platforms/slack.py:_handle_slack_messageresolveschannel_skill_bindingsper message and attachesauto_skilltoMessageEvent. The gateway's existing auto-skill injection path does the actual session-start skill load.gateway/config.py:channel_skill_bindingsis now bridged fromslack:in config.yaml (was Discord-only).website/docs/user-guide/messaging/slack.md: new Per-Channel Skill Bindings section.tests/gateway/test_slack_channel_skills.py: 11 new tests covering DM/thread/parent resolution, single-vs-list skill values, dedup, malformed entries, and end-to-endMessageEventwiring.Usage
Validation
tests/gateway/test_slack_channel_skills.py+test_discord_channel_skills.py+test_slack.py+test_slack_mention.py: 203 passed. Discord tests unchanged and passing (delegation is behavior-preserving).Credits
mats@hermes.local).Closes #13962