Skip to content

feat: per-channel model and system prompt overrides for gateway platforms #1955

@rivercrab26

Description

@rivercrab26

Use Case

In a Discord server (or Telegram group), different channels often serve different purposes:

  • #daily — low-cost summarization channel using a free/cheap model (e.g. openrouter/healer-alpha)
  • #dev — coding assistant channel using a capable model (e.g. anthropic/claude-opus-4.6)
  • #casual — general chat with a different persona/system prompt

Currently, the gateway uses a single global model + system prompt for all channels. Users who need per-channel differentiation must run separate bot instances or use an external routing layer.

Proposed Design

Add a channel_overrides section under each platform config in config.yaml:

platforms:
  discord:
    enabled: true
    channel_overrides:
      "1234567890":           # channel ID
        model: openrouter/healer-alpha
        provider: openrouter
        system_prompt: "You are a daily news summarizer."
      "9876543210":
        model: anthropic/claude-opus-4.6
        provider: anthropic
        system_prompt: "You are a coding assistant."

Resolution priority (high → low):

  1. /model command (ephemeral, per-session)
  2. channel_overrides[channel_id] (persistent, per-channel)
  3. model.default / agent.system_prompt (global fallback)

Implementation scope:

  1. gateway/config.py — extend PlatformConfig with channel_overrides: Dict[str, ChannelOverride]
  2. gateway/run.py_resolve_gateway_model() and _load_ephemeral_system_prompt() accept chat_id parameter, check overrides before global config
  3. Agent construction — pass resolved model/provider/system_prompt per dispatch

What it does NOT change:

  • No changes to CLI mode
  • No changes to the agent loop or prompt caching
  • Channels without overrides behave exactly as today

Alternatives Considered

  • Multiple bot instances: works but wastes resources, hard to manage
  • External routing proxy: adds latency and complexity
  • Personality system (/personality): exists but is per-session, not per-channel, and does not support model overrides

Prior Art

Other agent frameworks (e.g. OpenClaw) support modelByChannel config and it is a commonly requested feature for multi-channel deployments.

Metadata

Metadata

Assignees

No one assigned

    Labels

    P3Low — cosmetic, nice to havearea/configConfig system, migrations, profilescomp/gatewayGateway runner, session dispatch, deliverytype/featureNew feature or request

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions