Skip to content

Add multi-agent support for named agents per channel#19

Open
ZoeFridler wants to merge 20 commits intompociot:mainfrom
ZoeFridler:dev
Open

Add multi-agent support for named agents per channel#19
ZoeFridler wants to merge 20 commits intompociot:mainfrom
ZoeFridler:dev

Conversation

@ZoeFridler
Copy link

Summary

  • Adds named agent support so multiple agents can work in the same Slack channel, each with its own working directory and conversation session
  • Agents are addressed via @name <message> or broadcast to all with @all <message>
  • Agents can communicate with each other via claude-flow MCP memory tools (memory_store, memory_retrieve)

Changes

  • src/types.ts — Added AgentConfig and ParsedCommand interfaces
  • src/agent-manager.ts (new) — Agent CRUD, command parsing, and directory resolution
  • src/claude-handler.ts — Added agent session key/get/create methods
  • src/slack-handler.ts — Added agent command routing, handler methods, extracted executeQuery() helper from the streaming loop for reuse by both regular messages and agent messages

Commands

Command Action
create agent <name> on <path> Creates a named agent with its own working directory
remove agent <name> Removes an agent
list agents Lists all agents in the channel
@<name> <message> Sends message to a specific agent
@all <message> Broadcasts message to all agents concurrently

Test plan

  • Run npm run dev — bot starts without errors
  • Send create agent linux-agent on linux-metrics — agent created with resolved path
  • Send list agents — shows the agent
  • Send @linux-agent what files are in src/ — responds with [linux-agent] prefix
  • Send create agent slack-agent on claude-code-slack-bot — second agent created
  • Send @all describe your project — both agents respond concurrently
  • Send remove agent linux-agent — agent removed
  • Regular (non-agent) messages still work as before

🤖 Generated with Claude Code

zoe-fridler and others added 20 commits February 18, 2026 14:24
Allow multiple named agents in the same Slack channel, each with its
own working directory and conversation session. Agents can be addressed
individually via @name or all at once via @ALL broadcast.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
… path

- Persist agent configs to agents.json so they survive restarts
- Bypass permission prompts for agent sessions (autonomous mode)
- Fix hardcoded permission MCP server path to use relative path
- Upgrade SDK to 1.0.128 for Node 22 compatibility
- Add agent announcement on creation in main conversation
- Add agents.json to .gitignore

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…d agent-to-agent messaging

New commands: set/clear rules, rename agent, quiet mode on/off, agent status,
schedule/unschedule tasks, list templates, create from template, @agent1 ask @agent2.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Type "help" or "commands" in DMs to see the full command reference.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Sessions with a sessionId are saved to sessions.json and restored on
startup, so agents remember their conversation history across restarts.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Status message now updates every 5s showing elapsed time and what
the agent is doing (Thinking/Working/Responding + tool name), so
you can tell if it's active or stuck.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Use `model <agent> sonnet` for fast responses or `model <agent> opus`
for smarter reasoning. Shown in agent list and status.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
If asked in the main conversation, reply there. If asked in a
thread, reply in the thread.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Agents take turns working on a shared task, each responding to
the other until one signals DONE or the 10-turn limit is reached.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Global rules are prepended to every agent's identity prompt, before
their individual rules. Persisted to global-rules.json.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
When exact command syntax doesn't match, the bot now understands
natural language like "add a global rule to not delete files",
"make lina fast", "show me my agents", "how is lina doing", etc.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
"lina do that", "tell lina to check the logs", "ask lina about
the auth module" all work now without needing @lina.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Each agent is auto-assigned a unique color from a 10-color palette.
Messages from agents display with a colored sidebar via Slack
attachments API. Colors are applied to greetings, responses, tool
output, collaboration, and agent-to-agent queries. Existing agents
without colors get auto-assigned on load.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Edit diffs now show removed code with a red sidebar and added code
with a green sidebar (like GitHub). Bash commands use a dark sidebar.
New file creation uses a blue sidebar. Search tools (Glob/Grep) get
a search icon. All via Slack attachments API for visual distinction.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The natural language parser matched "remove" anywhere in text as a
remove_agent command, so "lina ... remove comments" deleted the agent.

Fixed by:
1. Moving "agent name at start" check to the top of NLP parser —
   messages starting with an agent name are always sent to that agent
2. Requiring "agent" keyword near "remove/delete" for destructive cmds
3. Adding confirmation step for agent removal (30s timeout)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Two fixes for the "Could not process image" error:

1. Images are now embedded as base64 directly in the prompt instead
   of telling Claude to use the Read tool. This prevents image data
   from being stored in the session history, which would corrupt the
   session on resume when the API can't reprocess stale images.

2. Added auto-retry in streamQuery — if a resumed session fails with
   an image/invalid_request error, automatically clears the corrupted
   session and retries fresh instead of crashing.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The base64 approach just dumped unreadable text into the prompt.
The Read tool is the correct way for Claude to view images.
The auto-retry in claude-handler.ts handles corrupted sessions
from stale images on resume.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Handles case where user sends "lina" with a file attachment but
no additional text. Previously fell through to the regular handler
which requires a working directory.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants