Group Chat
Multi-agent group chat with persona-based collaborative discussions across any messaging channel.
The group_chat module provides channel-agnostic orchestration for multi-persona collaborative discussions. Multiple agents with different personas can participate in a shared conversation, each contributing their expertise to solve problems collaboratively.
Design Philosophy
- Persona-driven — Each participant has a distinct role, expertise, and communication style
- Channel-agnostic — Works over Discord, Telegram, CLI, or any connected interface
- Shared session — All participants see the full conversation context
Architecture
┌─────────────────────────────────────────────┐
│ GroupChatOrchestrator │
├─────────────────────────────────────────────┤
│ │
│ ┌──────────────┐ ┌─────────────────┐ │
│ │ Coordinator │◄────►│ Executor │ │
│ │ (turn logic) │ │ (LLM calls) │ │
│ └──────────────┘ └─────────────────┘ │
│ │ │
│ ▼ │
│ ┌──────────────┐ ┌─────────────────┐ │
│ │ Session │ │ Persona │ │
│ │ (state) │ │ Registry │ │
│ └──────────────┘ └─────────────────┘ │
│ │
└─────────────────────────────────────────────┘Core Components
GroupChatOrchestrator
Manages the overall chat flow:
pub struct GroupChatOrchestrator {
session: GroupChatSession,
personas: Vec<Persona>,
coordinator: GroupChatCoordinator,
}GroupChatCoordinator
Determines whose turn it is and what they should do:
pub struct GroupChatCoordinator;
impl GroupChatCoordinator {
pub fn next_speaker(
&self,
session: &GroupChatSession,
) -> Option<&Persona> { /* ... */ }
pub fn build_persona_prompt(
&self,
persona: &Persona,
context: &ChatHistory,
) -> String { /* ... */ }
}System prompt handling: The system prompt is passed via the proper .with_system() parameter, not embedded in user message text.
GroupChatExecutor
Runs LLM calls for each participant:
pub struct GroupChatExecutor {
provider: Arc<dyn LlmProvider>,
}Persona
Defines a participant's identity:
pub struct Persona {
pub id: String,
pub name: String,
pub system_prompt: String,
pub expertise: Vec<String>,
}Presets: The PersonaRegistry includes predefined personas (e.g., "coder", "reviewer", "architect").
GroupChatSession
Maintains conversation state:
pub struct GroupChatSession {
pub messages: Vec<ChatMessage>,
pub participants: Vec<String>,
}Protocol
Message types for group chat communication:
pub enum GroupChatMessage {
Text { from: String, content: String },
Join { persona: String },
Leave { persona: String },
System { content: String },
}Intent Types
The intent module provides lightweight type definitions retained from the old intent detection pipeline:
pub enum TaskCategory {
Code,
Search,
FileOperation,
// ... etc
}
pub enum DetectionLayer {
L2Heuristic,
L3Llm,
}Note: The detection/classification pipeline has been removed in favor of LLM-native tool selection. Only shared type definitions remain.
Safety Properties
- UTF-8 safe —
char_indices()for truncation,.chars().count()for length - Deterministic ordering —
list_presets()returns sorted results - No lock poisoning — Uses
tokio::sync::Mutex - No SQL injection — No database queries in this module
Code Location
Group Chat:
src/group_chat/mod.rs— Module entry pointsrc/group_chat/orchestrator.rs— Chat flow managementsrc/group_chat/coordinator.rs— Turn logic and prompt buildingsrc/group_chat/executor.rs— LLM executionsrc/group_chat/session.rs— Conversation statesrc/group_chat/persona.rs— Persona definitionssrc/group_chat/protocol.rs— Message typessrc/group_chat/channel.rs— Channel abstraction
Intent:
src/intent/mod.rs— Type re-exportssrc/intent/types/— TaskCategory, DetectionLayer, etc.
See Also
- Agent Runtime — How individual agents work
- Arena — Multi-agent collaboration workspace
- Teams — Agent team management