Summary
Enable each sub-channel (Telegram forum topic, Discord channel, Slack channel) to be assigned a specialized agent with its own system prompt, tool allowlist, and model configuration. A Telegram supergroup, Discord server, or Slack workspace can host multiple sub-channel agents running in parallel, each operating independently.
Problem Statement
Currently, ZeroBuild operates as a single agent per platform instance. In multi-channel environments like Telegram supergroups with forum topics, Discord servers with multiple channels, or Slack workspaces, all channels share the same agent configuration. This creates several limitations:
- Context pollution: Different channels have different purposes (e.g., #general vs #dev-support vs #announcements), but the agent treats all messages as part of the same context
- Permission sprawl: All channels get the same tool access, which may be inappropriate (e.g., giving deployment tools to a public channel)
- Personality mismatch: One system prompt cannot serve diverse channel purposes effectively
- No channel specialization: Cannot have a coding assistant in #dev and a marketing assistant in #growth
Proposed Solution
Configuration Schema
sub_channel_agents:
enabled: true
agents:
- id: "dev-support"
name: "DevBot"
# Platform-specific channel matching
match:
telegram:
forum_topic_id: 12345
discord:
channel_id: "987654321"
slack:
channel_id: "C12345678"
# Agent-specific configuration
system_prompt: "You are a senior Rust developer..."
model: "gpt-4"
temperature: 0.2
# Tool allowlist (subset of available tools)
allowed_tools:
- shell
- file_read
- github_*
# Channel-specific memory namespace
memory_namespace: "dev-support"
# Optional: inherit base config + overrides
extends: "base"
overrides:
temperature: 0.1
Key Components
- Channel Resolver: Platform-specific module to identify which sub-channel a message originates from
- Agent Registry: In-memory or persistent store mapping channel IDs to agent configurations
- Isolated Context: Each sub-agent maintains its own conversation history and memory
- Tool Proxy: Middleware that filters tool calls based on agent's allowlist
- Model Router: Routes to different models/providers per agent configuration
Parallel Execution Model
┌─────────────────────────────────────┐
│ Platform Connector │
│ (Telegram / Discord / Slack) │
└─────────────┬───────────────────────┘
│
┌─────────┼─────────┐
▼ ▼ ▼
┌───────┐ ┌───────┐ ┌───────┐
│Agent A│ │Agent B│ │Agent C│ ← Different sub-channels
│#dev │ │#design│ │#admin │
└───────┘ └───────┘ └───────┘
Each agent runs independently with:
- Dedicated memory namespace
- Isolated tool permissions
- Custom system prompt
- Independent model selection
Non-goals / Out of Scope
- Cross-channel agent communication (future feature)
- Dynamic agent creation via chat commands (admin-only config for now)
- Shared memory between sub-agents (explicitly isolated by design)
- Channel migration/hot-swapping agents without restart
- Multi-agent orchestration in a single channel
Acceptance Criteria
Architecture Impact
Current Flow
Message → Platform Handler → Single Agent → Response
New Flow
Message → Platform Handler → Channel Resolver → Agent Registry →
Matched Agent → Response
New Modules
channel_resolver.rs - Extract channel identifiers from platform-specific message metadata
agent_registry.rs - Load and manage sub-agent configurations
agent_context.rs - Per-agent context isolation
tool_filter.rs - Middleware for tool allowlist enforcement
Data Changes
- New table/collection:
sub_channel_agents with fields for channel matching, config overrides
- Memory keys gain namespace prefix:
memory:{namespace}:{key}
Risk and Rollback
| Risk |
Likelihood |
Impact |
Mitigation |
| Config complexity increases |
Medium |
Low |
Provide templates and validation |
| Memory usage increases with many agents |
Medium |
Medium |
Implement agent TTL/lazy loading |
| Breaking change to existing single-agent setups |
High |
High |
Sub-agents are opt-in via config flag |
| Channel ID format changes across platform versions |
Low |
Medium |
Abstract channel identifiers |
| Permission misconfiguration |
Medium |
High |
Config validation + dry-run mode |
Rollback Plan
- Feature is opt-in via
sub_channel_agents.enabled = true
- Default behavior unchanged (single global agent)
- Can disable per-agent or globally without data loss
Breaking Change
No breaking changes. This feature is opt-in and defaults to existing single-agent behavior.
Data Hygiene Checks
Summary
Enable each sub-channel (Telegram forum topic, Discord channel, Slack channel) to be assigned a specialized agent with its own system prompt, tool allowlist, and model configuration. A Telegram supergroup, Discord server, or Slack workspace can host multiple sub-channel agents running in parallel, each operating independently.
Problem Statement
Currently, ZeroBuild operates as a single agent per platform instance. In multi-channel environments like Telegram supergroups with forum topics, Discord servers with multiple channels, or Slack workspaces, all channels share the same agent configuration. This creates several limitations:
Proposed Solution
Configuration Schema
Key Components
Parallel Execution Model
Each agent runs independently with:
Non-goals / Out of Scope
Acceptance Criteria
Architecture Impact
Current Flow
New Flow
New Modules
channel_resolver.rs- Extract channel identifiers from platform-specific message metadataagent_registry.rs- Load and manage sub-agent configurationsagent_context.rs- Per-agent context isolationtool_filter.rs- Middleware for tool allowlist enforcementData Changes
sub_channel_agentswith fields for channel matching, config overridesmemory:{namespace}:{key}Risk and Rollback
Rollback Plan
sub_channel_agents.enabled = trueBreaking Change
No breaking changes. This feature is opt-in and defaults to existing single-agent behavior.
Data Hygiene Checks