feat: Discord guild channels, slash commands, and agent handoff#141
Open
0x177630b6 wants to merge 6 commits intoTinyAGI:mainfrom
Open
feat: Discord guild channels, slash commands, and agent handoff#1410x177630b6 wants to merge 6 commits intoTinyAGI:mainfrom
0x177630b6 wants to merge 6 commits intoTinyAGI:mainfrom
Conversation
…ssions Add guild/server message handling to Discord client with @mention and designated channel support, role mention stripping, and default agent routing. Fix child Claude Code processes failing due to inherited CLAUDECODE env var. Pass senderId through conversation pipeline so responses route back to the correct channel. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
When an agent responds with @agent_id prefix, the system intercepts the response, delivers it to the user for full transparency, and re-enqueues it as a new message for the target agent — preserving original channel and sender context. - Add parseResponseHandoff() to routing.ts for detecting @agent mentions - Add handoff_depth column to messages table with idempotent migration - Intercept responses in queue-processor with depth-limited re-enqueue - Loop prevention via MAX_HANDOFF_DEPTH (5) and self-handoff rejection - System-level [signed: @agentName] suffix on all agent responses Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…t signatures - Register /agent, /team, /reset as guild slash commands with autocomplete - Remove text-based !agent/!team/!reset fallback commands - Add cached getCachedSettings() (mtime-based) to eliminate redundant file reads - Extract interactionReplySplit() and resetAgents() shared helpers - Add GuildCreate handler to register commands when bot joins new guilds - Move agent signature from inline [signed:] text to per-channel "— AgentName" suffix - Fix parseResponseHandoff to rewrite @name to @id on name-matched handoffs - Add sign_responses setting type Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…tures - Respect sign_responses setting in Discord client (defaults to true) - Remove unused signed response logic from queue-processor - Update README: slash commands, guild channels, agent handoff, sign_responses Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Discord-only setting belongs in the discord channel config, not at root level. Co-Authored-By: Claude Opus 4.6 <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.
Summary
guild_channelsconfig. Messages in bound channels auto-route to the configured agent without requiring@prefix. Bot responds to@mentionsand designated channels while ignoring other guild messages./agent,/team,/resetregistered as native guild slash commands with autocomplete. Text-based!agent/!team/!resetfallback removed. Slash commands auto-register on bot startup and when joining new guilds (GuildCreatehandler).@agent_idprefix in responses. Handoffs are re-enqueued with depth tracking (max 5 hops) to prevent infinite loops. Both agent IDs and names are supported (names are rewritten to IDs).— AgentNamesuffix on Discord, controlled bychannels.discord.sign_responses(defaults totrue).getCachedSettings()with mtime-based invalidation replaces 5 separatefs.readFileSync+JSON.parsecalls in the Discord client.interactionReplySplit()for split reply/followUp pattern,resetAgents()for reset logic,registerGuildCommands()for slash command registration.CLAUDECODEenv var when spawning agent subprocesses to prevent session conflicts.senderIdnow flows through tocompleteConversation()so team responses route back to the correct guild channel.Files changed
src/channels/discord-client.tssrc/queue-processor.tsparseResponseHandoff, remove inline[signed:]suffixsrc/lib/routing.tsparseResponseHandoff(), fix name-to-ID rewrite on handoffsrc/lib/db.tshandoff_depthcolumn and fieldsrc/lib/types.tsguild_channels,sign_responses,senderIdon Conversationsrc/lib/conversation.tssenderIdthrough toenqueueResponsesrc/lib/invoke.tsCLAUDECODEenv from child processesREADME.mdsign_responsesTest plan
npm run build:maincompiles clean./tinyclaw.sh restart— check logs for "Registered 3 slash commands for guild"/and verifyagent,team,resetappear in autocomplete/agent— lists all agents (handles >2000 char responses via message splitting)/team— lists all teams/reset coder— resets agent, verify autocomplete suggests agent IDs— AgentNamesignature appears on responses"sign_responses": falseinchannels.discord— verify signature disappears@other_agent message)🤖 Generated with Claude Code