AI Coding Agent Mode Presets: How Declarative Agent Assembly Works
This article explains the mode preset mechanism in AI coding agents, where each mode maps to a declarative, versionable agent preset that defines a session's persona, tool list, prompt sections, and always-on capabilities. It covers how presets are assembled once per process, how state is keyed per session and agent, why a mode locks once a session produces output, and how the default preset is set. It also compares the standard, code, minimal, and cordis presets and offers practical guidance on mode selection and governance.
1. Why a “Mode” Abstraction Is Needed
A common tension shows up in real usage of AI coding agents: the stronger the model, the more tools and prompts you can attach, yet context window limits, decision stability, and response cost all demand on-demand supply. Handing every capability to the model at once tends to cause choice paralysis, wrong tool calls, and conflicting prompts; trimming capabilities down to the minimum makes real engineering work impossible.
A mode is essentially an agent preset abstraction. It is not a fine-tune of model parameters, nor a one-off prompt concatenation. It is a declarative, versionable, reusable “session assembly sheet.” Each preset maps to its own directory, and an assembly config file inside that directory describes the capability boundary for the session. It decouples “who this session is, what it can do, and what rules it follows” from the code and hands that to configuration management.
This design yields three direct benefits:
- Clear capability boundaries: the tool list and prompt sections the model sees are determined by configuration, not by implementation details.
- Reusability and governance: presets can be version-controlled, reviewed, and rolled out gradually, so a team can standardize the shape of its coding agent.
- Isolation and stability: one assembly can be shared by multiple sessions, while session state stays independent and avoids cross-contamination.
2. Declarative Assembly: One Config Defines One Session
The core of a preset directory is an assembly file (think of it as an agent manifest) that declares at least four things:
- Persona: the first line of the system prompt, which sets the model’s role. A common pattern injects the model name and working directory as placeholder variables:
persona: "You are a coding agent powered by the {{model}} model. Your working directory is {{cwd}}."agent-instructions:maxBytes: 65536
{{model}} and {{cwd}} are resolved at session creation time based on actual routing and workspace, so the opening identity description differs automatically per session. The agent-instructions size cap (64KB here) effectively defines the channel size for “workspace instruction files entering the context”—the conventional instruction file at the project root is read by the model through this channel.
- Tool list: which tools the model may call, and the enable condition for each. Platform adaptation is a common approach:
tool-bash:disabled: process.platform === 'win32'tool-pwsh:disabled: process.platform !== 'win32'
This means: enable the bash-style persistent terminal tool on Unix-like environments, and let a PowerShell-style tool take over the same responsibility on Windows. To the user it feels like “terminal capability is always present”; to the implementation it is “same semantics, different carrier.”
Prompt sections: rules appended as modular fragments, such as plan-mode constraints, code-retrieval priority order, or a pre-commit self-check list. Fragmenting rather than concatenating one block makes it easy to compose and trim per mode.
Always-on capabilities: cross-cutting features such as context compaction, skill discovery, goal tracking, and subagent dispatch, whose enablement is also decided by configuration.
3. Key Mechanisms: Mount Once, Key State, Lock on Output
Three engineering constraints explain how the mode mechanism works.
First, assembly is mounted once per process. Preset resolution and tool registration belong to a long-lived scope, so all sessions in the same process that select the same mode share one assembly result. This avoids re-parsing config and re-registering tools for every new session, and keeps tool behavior consistent across the process.
Second, state is keyed by session and agent. What is shared is the “capability definition,” not “runtime data.” Session history, pending goals, compaction summaries, and skill caches are stored independently and do not interfere with each other. This determines correctness under parallel sessions: session A’s plan never appears in session B’s context.
Third, a session locks its mode once it produces content. The mode determines the tool schemas and prompt sections visible to the model. Switching modes mid-session would make the rules behind existing history inconsistent with the new rules, so the model would interpret existing context ambiguously. The engineering answer is a simple policy: switching is allowed only in an empty session; otherwise the gateway rejects it and returns an error identifier like agent-preset-locked. The practical advice for users is to pick the mode first, then start asking questions.
The default mode comes from user settings. A user-level config file on the machine usually has an entry like agent-presets.default: standard, which decides the initial preset for new sessions. Changing it to another preset id makes a team land in a given working shape by default, without manual selection each time.
4. Four Presets: Positioning and Selection
| Preset | Identifier | Order | Positioning |
|---|---|---|---|
| Standard | standard |
1 | Full-featured coding agent, the default option |
| Code orchestration | code |
2 | Adds programmatic orchestration on top of standard; the model writes a script to complete multiple steps in one round trip |
| Minimal | minimal |
3 | Fixed prompt, two tools, no compaction, no skill discovery |
| Cordis | cordis |
4 | Adds read/write access to the runtime itself on top of standard, used to construct new agents |
The standard mode is officially positioned as “a full coding agent supporting file editing, terminal execution, file and web retrieval, skills, plans, goals, subagents, and workflows.” It fits most day-to-day development: reading code, changing code, running tests, looking things up, breaking down plans, and running parallel subtasks.
The core difference of code orchestration mode is compressing “multiple tool round trips” into “one program execution.” Instead of calling tools step by step, the model writes a script that performs combined operations such as file traversal, batch replacement, and log aggregation inside a controlled runtime. The payoff is a significant drop in round trips and context usage; the cost is higher demands on script correctness, permission boundaries, and runtime isolation. It suits batch refactoring, cross-file migration, and large-scale retrieval summaries.
Minimal mode deliberately subtracts: the prompt is fixed, only the persistent terminal and string-replacement editing tools remain, and compaction and skill discovery are off. Its value is predictability and low cost, often used for automated regression, evaluation baselines, and controlled experiments on whether a minimal prompt can complete a task.
Cordis mode targets meta-tasks: the agent can read and write its own runtime structure, and thus “create another agent.” This capability must be paired with permission isolation and artifact review, otherwise it easily produces self-modifications that are hard to trace.
5. Standard Mode Assembly: What to Note
The standard mode manifest usually contains a dozen or so capability groups. Beyond identity and terminal, the notable ones are:
- File editing: primarily exact string replacement, combined with line-numbered views for reading, to reduce the scope of mistaken edits; confirm the target fragment is unique before editing.
- Retrieval: file content search and web search have clear division of labor—the former locates symbols and call sites, the latter confirms version-related behavior.
- Plans and goals: break long tasks into verifiable steps and maintain goal state within the session to avoid drift in long contexts.
- Subagents and workflows: push parallelizable exploration tasks down to subagents so the main session keeps only conclusions, controlling context growth.
- Context compaction: summarize history near the window limit, keeping decisions and constraints while discarding redundant output.
- Skill discovery: dynamically surface available skills based on the current workspace and task type, reducing ineffective attempts.
6. Practical Advice and Common Pitfalls
- Choose the mode up front: decide the mode when creating the session to avoid being locked after output.
- Govern behavior with config, not prompts: long-term stable rules belong in workspace instruction files or preset prompt sections, not repeated instructions every time.
- Leave platform differences to config: dual terminal implementations are the norm; business code should not assume a fixed command set.
- Use minimal mode as a baseline: when evaluating whether prompt and tool design is effective, establish a control with minimal mode first.
- Pair high-privilege modes with auditing: capabilities involving runtime self-modification or script execution should combine least privilege, operation logging, and artifact review.
- Standardize the default mode across the team: include the default preset in the team config baseline to reduce the communication cost of “same project, different shapes.”
Mode presets move agent capability governance from “hard-coded in the code” to “declared in configuration.” The real value is not just convenient switching, but making capability boundaries, context cost, and auditability controllable at the same time. Understanding the assembly logic and locking rules is what lets you choose among standard, orchestration, minimal, and cordis modes to match the task.
