Skip to content

Multi Agent

Rina edited this page May 13, 2026 · 2 revisions

Multi-Agent Support

Overview

The bot can run different AI coding agents — not just Claude Code. Each room can use a different agent CLI. Agents are defined via environment variables.

Defining Agents

Use AGENT_<NAME>=<full command> in your .env file:

AGENT_CLAUDE=claude --dangerously-skip-permissions
AGENT_CODEX=codex --full-auto
AGENT_GEMINI=gemini --yolo
AGENT_COPILOT=copilot

The name after AGENT_ becomes the agent identifier (lowercased). Use it with /new and /agent.

Default Behavior

If no AGENT_* variables are set, the bot registers a single agent:

  • Name: claude
  • Command: value of CLAUDE_CMD env var (default: claude)

Per-Agent System Prompts

Each agent can have its own system prompt via AGENT_<NAME>_PROMPT:

AGENT_CLAUDE=claude --dangerously-skip-permissions
AGENT_CLAUDE_PROMPT=You are connected to Discord. Use discord-send to reply...

AGENT_GEMINI=gemini --yolo
AGENT_GEMINI_PROMPT=You are a Gemini agent. Use discord-send to communicate...

If AGENT_<NAME>_PROMPT is not set, the agent uses the default CLAUDE_SYSTEM_PROMPT.

How Agents Start

Claude Agents

When the agent command starts with claude, Claude-specific behavior is applied:

  • --append-system-prompt flag injects the system prompt
  • --permission-mode or --dangerously-skip-permissions based on room mode
  • --continue flag for session resume
  • Claude history in ~/.claude/projects/ is checked for resume

Non-Claude Agents

For all other agents:

  • The system prompt is sent as the first message after the agent boots
  • Mode flags are not applied (they're Claude-specific)
  • Resume (--continue) is not applied
  • The agent still gets DISCORD_TOKEN and DEFAULT_CHANNEL_ID env vars

Using Agents

Create a room with a specific agent

/new name:my-room agent:codex
/new name:fix-bug agent:gemini
/new name:review agent:claude

If agent is omitted, the default agent is used (first AGENT_* found, or claude).

Switch agent for an existing room

/agent gemini

This will:

  1. Show the new agent name and command
  2. Reset the tmux session (the current session is killed)
  3. Next /enter starts the new agent

Check current agent

/status

Shows the agent name and its full command.

List available agents

/help

The help text lists all configured agents and their commands.

Ready Detection

The bot uses a universal regex to detect when any agent is ready:

/[❯>$#%]\s*$/

This matches common CLI prompt characters:

  • — Claude Code
  • > — various CLIs
  • $ — bash/shell prompts
  • # — root prompts
  • % — zsh prompts

The bot polls the tmux pane every second for up to 60 seconds.

Example Setup

# .env
DISCORD_TOKEN=your-token
REGISTER_GUILD_ID=your-guild

# Agents
AGENT_CLAUDE=claude --dangerously-skip-permissions
AGENT_CODEX=codex --full-auto
AGENT_GEMINI=gemini --yolo

# Custom prompt for Gemini
AGENT_GEMINI_PROMPT=You are connected to a Discord bot. Use discord-send "<message>" to reply to the user. Anything you output that is NOT this command stays hidden.

# Fallback system prompt (used when AGENT_<NAME>_PROMPT is not set)
CLAUDE_SYSTEM_PROMPT=

Clone this wiki locally