Skip to content

Feature: config option to enable swarm mode by default for new sessions (config.toml default_swarm_mode) #3433

Open

Description

@socksrust

Feature request

Add a config option (e.g. default_swarm_mode = true in config.toml, similar to default_plan_mode / default_permission_mode) so that new sessions start with swarm mode enabled by default.

Motivation

Users who work primarily in kimi web (and the TUI) may want swarm mode on for every session without manually toggling it each time. Today swarm mode is a per-session runtime toggle:

  • TUI: /swarm on|off (or /swarm <task>, which auto-disables when the turn completes)
  • Web UI: the swarm toggle in the composer + menu

The 0.39 changelog notes that swarm/goal toggles are now kept per session in the web UI ("each session now keeps its own toggles"), which means the preference cannot persist across sessions. There is also no documented config.toml key or environment variable to make swarm mode default-on — the existing [swarm] section only controls timeout_ms for AgentSwarm subagents.

Proposed behavior

  • default_swarm_mode = true (top-level, default false) makes every new session start with swarm mode on, matching how default_plan_mode works for Plan mode.
  • Resumed sessions keep the toggle state recorded for that session (consistent with current per-session toggle semantics).
  • The per-session toggle (/swarm on|off / web UI toggle) continues to override the default within the session.
  • When swarm mode starts on via config and permission mode is manual, the same auto/yolo permission prompt that /swarm triggers today should apply.

Alternatives considered

  • A KIMI_CODE_SWARM_DEFAULT=1 environment variable, alongside the config key, for containers/CI.

Activity

  1. TheDanaWhite commented on Sep 1, 2026

    @TheDanaWhite

    Didnt know I needed that! Would love it being executed

  2. wintrover commented on Nov 24, 2026

    @wintrover

    Adding fresh source-level evidence from 2.7.3 (current release, 2026-11-24). The setting is still absent, and the implementation surface is small.

    The setting does not exist anywhere in 2.7.3

    • [swarm] accepts exactly one field: timeout_ms (packages/agent-core-v2/src/features/swarm/configSection.ts — SwarmConfigSchema = z.object({ timeoutMs: ... })). No default_enabled, and no top-level default_swarm_mode.
    • The TUI hardcodes the initial value: swarmMode: false (apps/kimi-code/src/tui/kimi-tui.ts:322). There is also no --swarm / --no-swarm flag (apps/kimi-code/src/cli/commands.ts).
    • [experimental] registers only tool-select, notify-user, wait-for, tower, and prompt-prediction. Swarm is not an experimental flag, so there is no KIMI_CODE_EXPERIMENTAL_* route either.
    • Important constraint for the design: AgentSwarmService.enter() rejects the tool trigger with Only the user can turn on swarm mode (packages/agent-core-v2/src/features/swarm/agent/swarmService.ts). A config-driven default therefore needs its own trigger value (e.g. config / default), not a reuse of tool, or the existing invariant will block it. Note also that shouldAutoExit is true for task/tool only — a config trigger must not auto-exit, otherwise the default would vanish after the first turn.

    Why it is cheap to add

    Both halves already exist for other reasons:

    • Resume already restores the flag from session status (apps/kimi-code/src/tui/kimi-tui.ts:3293 → status.swarmMode ?? false; apps/kimi-code/src/tui/utils/message-replay.ts:78).
    • The server-side apply path already exists: applyAgentConfigToSession() calls swarm.enter('manual') when swarm_mode === true (packages/kap-server/src/routes/sessionAgentConfig.ts), and POST /api/v1/prompts honours swarm_mode per request (packages/kap-server/src/routes/prompts.ts).

    So default_swarm_mode only needs to (a) seed the initial app state, and (b) pass swarm_mode: true at session creation — the same shape as default_plan_mode.

    Behaviour I would expect (essentially what @socksrust proposed)

    • default_swarm_mode = true (top-level, default false), mirroring default_plan_mode.
    • Applied to new sessions only; resumed sessions keep their recorded toggle.
    • /swarm on|off and the web toggle still override it within the session.
    • With permission_mode = manual, reuse the existing auto/yolo prompt that /swarm shows today.
    • Optional container/CI escape hatch: KIMI_CODE_SWARM_DEFAULT=1, consistent with the existing KIMI_CODE_SWARM_TIMEOUT_MS naming.

    Current workaround

    None. /swarm on persists for the session and survives kimi --session, but every new session starts off, so it has to be re-issued each time. Swarm is also expensive (up to 128 subagents, ramp-up of 5 immediately then +1 every 700 ms), which is presumably why off-by-default was chosen. An explicit opt-in default keeps that intent while removing the per-session friction.

    Related: #720 (same proposal, filed earlier).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions