Make the chat agent platform-aware (Slack/Discord/Linear)#704
Open
0xdiid wants to merge 3 commits into
Open
Conversation
Discord-ingress sessions reused the Slack-only system prompt and session context, so the agent assumed it was on Slack. Now the chat surface is resolved from the thread key into a shared ChatDestination, a terse platform/destination note is injected into each user turn so the model always knows where it is, the session-context API and SDK expose platform plus Slack/Discord destinations, the system prompt is platform-neutral, and the Discord tool gains file upload/download parity with Slack. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Linear issue threads now get the same chat-surface treatment as Slack and Discord: the per-turn note, the /api/session context block, the SDK helpers, and the system prompt all recognize linear: thread keys. The note reflects Linear's reality — replies are auto-posted as issue comments and there is no file-upload surface, so it points at inline/link sharing and fetch-asset downloads instead. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
9be6a64 to
e8986c9
Compare
Two follow-ups from review of the platform-aware-context change. discord download_url accepted any URL and buffered the whole body in memory, so a steered agent could aim it at an internal host and there was no ceiling on download size. It now rejects non-Discord-CDN hosts and streams to disk under a size cap, mirroring the Slack downloader; the message-attachment path also basenames the Discord-supplied filename so it can't escape the output directory. The message-listing commands now print attachment ids and urls in their default output, so an agent can actually find the file to download instead of only seeing it under --json. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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.
We've been having issues on our Discord + Linear ingress where the agent mistakenly thinks it's in Slack, mostly due to a lot of Slack-specific stuff that was a part of that initial implementation. It figured it out after 2/3 turns but that's just wasted tokens, and looks bad in the chain of thought.
This teaches it where it actually is: every turn now carries a short note about which chat surface it's on and where its reply should go, and the base instructions no longer assume Slack. The session context and the SDK report the platform either way.
The Discord side also gains the ability to send and pull down files, matching what Slack already had.
Validated: