Custom Modes
Custom modes extend built-in default and plan behavior with your own instructions and tool policies.
Primary sources:
- Mode registry:
crates/core/src/config/modes/registry.rs - Mode discovery + inheritance:
crates/core/src/config/modes/resolver.rs - Tool filtering at runtime:
crates/core/src/tools_config.rs
File locations and precedence
For mode name <name>, Swarmie resolves in this order:
{cwd}/.swarmie/modes/<name>.toml{cwd}/.swarmie/modes/<name>/MODE.md~/.swarmie/modes/<name>.toml~/.swarmie/modes/<name>/MODE.md
Custom modes cannot override built-in names (default, plan).
TOML mode format
name = "review"
description = "Read-heavy review mode"
extends = "plan"
read_only = true
max_turns = 30
allowed_tools = ["read", "grep", "glob"]
developer_instructions = "Prioritize correctness and risk analysis."Supported fields map to ModeDefinition:
description,developer_instructions,extendsread_only,max_turnsexcluded_tools,allowed_tools
MODE.md format
MODE.md supports optional TOML frontmatter delimited by +++. Markdown body is appended to developer_instructions.
Inheritance and tool filtering rules
Inheritance merge behavior:
developer_instructions: parent then child (concatenated)max_turns, description, tool lists: child overrides when setread_only: inherited if either parent or child enables it
Tool visibility precedence in build_tools_config():
excluded_toolsdenylist (highest)allowed_toolsallowlist (only listed tools visible)- Read-only default exclusions (
bash,write,edit,patch,notebook_edit,undo) - Agent-level allow/deny lists then apply on top