#13643: feat(slack): add agent-specific persona support for messages
channel: slack
commands
Cluster:
Agent Messaging Enhancements
## Summary
Enables agents to have custom display identities (name, emoji, avatar) when sending Slack messages via `chat:write.customize`. This allows multi-agent systems to visually differentiate between agents in Slack channels.
## Changes
- Add `persona.ts` module to resolve agent identity into Slack-compatible persona fields
- Thread `agentId` through the full delivery pipeline — heartbeat, cron, CLI agent, gateway, and route-reply paths
- Support `username`, `icon_emoji`, and `icon_url` customization per agent
- **Graceful scope fallback**: if `chat:write.customize` scope is missing, catches the error, logs a warning, and retries without persona fields — no hard failure
## How It Works
1. `resolveSlackPersona(cfg, agentId)` looks up agent identity from config
2. Normalizes emoji formats (shortcodes → `:name:`, unicode passthrough)
3. Prioritizes avatar URLs over emoji for higher fidelity icons
4. Only attaches persona when at least one field is configured
5. If Slack rejects persona fields due to missing scope, falls back to default bot identity for the rest of the message
## Requirements
- Requires `chat:write.customize` scope in Slack workspace for custom identity
- Works without the scope — gracefully degrades to default bot appearance
## Known Limitations (follow-up)
- Media captions via `files.uploadV2` don't support persona fields (only subsequent `chat.postMessage` chunks get custom identity)
- No validation on username length or persona field content
- Unicode emoji in `icon_emoji` is passed through as-is (Slack behavior may vary)
## Test Plan
- [ ] Verify agents with configured identity use custom username in Slack
- [ ] Test emoji icon formats (shortcode, unicode, colonized)
- [ ] Confirm avatar URLs override emoji when both are present
- [ ] Ensure messages without agent identity use default bot appearance
- [ ] Validate thread replies maintain persona consistency
- [ ] Test graceful degradation when chat:write.customize scope is missing
- [ ] Verify heartbeat, cron, and CLI delivery paths all activate persona
Most Similar PRs
#23356: feat(slack): pass agent identity via chat:write.customize
by keshav55 · 2026-02-22
76.6%
#21147: feat(slack): support chat:write.customize for custom bot name/avatar
by bernardclaw · 2026-02-19
68.9%
#22486: feat: add /agent command for dynamic per-chat agent switching
by cesarfavero · 2026-02-21
62.7%
#9726: feat: add identityDir config for separate identity file location
by rickburn · 2026-02-05
61.2%
#9985: feat(slack): add channel-aware context for AI Assistant threads
by natedenh · 2026-02-05
60.4%
#7516: feat(sessions): Auto-inject From:/To: identity headers in agent-to-...
by RusDyn · 2026-02-02
60.4%
#11491: feat(slack): allow agents to resolve channel IDs to names and list ...
by Lukavyi · 2026-02-07
60.3%
#11603: feat(gateway): avatar upload + config identity
by advaitpaliwal · 2026-02-08
60.2%
#6430: feat(protocol): include agent identity in hello-ok handshake response
by astoreyai · 2026-02-01
59.9%
#9671: feat(slack): add AI Assistant loading states support
by natedenh · 2026-02-05
59.8%