Quick Start
- Run
/agentsin TUI to open the configuration panel. - Press
Tabto switch to theUserorProjecttab. - Select
Create new agent..., enter a Subagent description, and confirm. - After generation, invoke it directly in the conversation:
What a Subagent Is
Use a Subagent when a task spans many files, needs stable domain-specific criteria, or would otherwise fill the main conversation with search and analysis details. The main session understands the user goal and coordinates the work; the Subagent completes a clear subtask and returns its result to the main session. Core benefits:
Core capabilities:
If you already know the exact file or command, use the direct tool. Subagents are best for open-ended, multi-step work that needs judgment and synthesis.
Built-In Subagents
Qoder CLI registers a set of built-in Subagents. The exact list in theBuiltIn tab of /agents can vary by version, runtime mode, and enabled features.
Common built-in Subagents:
Depending on mode and feature flags, you may also see:
Built-in Subagents are provided and maintained by Qoder CLI. They are not edited like user-level or project-level Subagents. To customize behavior, create a custom Subagent with a new name or the same name and rely on source priority.
View and Use Subagents
View Available Subagents
TUI
In TUI, enter:/agents panel groups Subagents by source and lets you inspect details, create Subagents, enable or disable them, edit custom entries, and reload definitions. After changing .qoder/agents/ or ~/.qoder/agents/, run:
Non-Interactive
In non-interactive environments, use:Sources and Priority
Qoder CLI discovers Subagents from multiple sources. Same-name definitions override each other by priority, from low to high:
The highest-priority same-name definition is active; overridden definitions are marked as
shadowed in qodercli agents list.
Explicit Invocation
TUI Mode
In a TUI conversation, the most stable way to invoke a Subagent is to name it directly in the input:@ in TUI input:
Headless Mode
In Headless mode, pass the same natural-language request throughqodercli -p:
Implicit Invocation
TUI Mode
In a TUI conversation, you can describe the task and let Qoder CLI match it against each Subagent’sdescription:
Headless Mode
In Headless mode, pass only the task description throughqodercli -p:
@name.
Use a Subagent as the Session Agent
--agent uses an already loaded Subagent as the main agent for the current session. In this mode, that definition’s initialPrompt is used as the session’s initial prompt.
TUI Mode
Specify--agent when starting TUI:
api-reviewer as the main agent. Running an agent from the /agents panel does not switch the main session agent; it submits an @agent-name request for a single Subagent invocation.
Headless Mode
In Headless mode, use it together with-p:
Orchestrate Multiple Subagents
Describe the Subagent execution order in natural language, and Qoder CLI will process the task according to that sequence.TUI Mode
Enter the orchestration request directly in a TUI conversation:Headless Mode
In Headless mode, pass the same orchestration request throughqodercli -p:
--max-turns limits the whole Headless query. To limit a single Subagent invocation, set maxTurns in that Subagent’s configuration.
Customize Subagents
Create Persistent Local Subagent Definitions
Method 1: AI-Assisted Generation (Recommended)
This is the easiest way to create a Subagent. Describe what you need in natural language, and Qoder CLI generates a complete configuration file for you. Steps:- Run
/agentsin TUI to open the configuration panel. - Press
Tabto switch to theUserorProjecttab. - Select
Create new agent...and pressEnter. - Enter a Subagent description and press
Enterto confirm.
Method 2: Write Configuration Manually (Advanced)
If you need full control over Subagent configuration, create a Markdown configuration file manually:name field.
Inject Temporary Subagents with --agents
--agents is useful for Headless runs, scripts, and one-off automation. It accepts a JSON object whose keys are Subagent names and whose values are definitions. Subagents injected with --agents only exist for the current process and have the highest priority for name conflicts.
--agents uses the prompt field as the system prompt. The current JSON schema supports description, prompt, tools, disallowedTools, mcpServers, model, effort, color, maxTurns, initialPrompt, skills, and permissionMode. Use Markdown configuration when you need timeoutMins, temperature, hooks, memory, background, or isolation.
Configure Subagents
Select a Scope
When creating or injecting a custom Subagent, choose one of these scopes:Configure Tools
tools and disallowedTools can be comma-separated strings or string arrays. String arrays can use either YAML inline-array syntax or YAML block-list syntax:
Read, Grep, Glob, Bash, Write, Edit, WebFetch, WebSearch, and Agent.
MCP tools use fully qualified names:
Agent(name) expression:
Agent:
tools, then remove tools listed in disallowedTools. MCP tools must be discovered through mcpServers or global MCP configuration and also allowed by tools before the Subagent can use them.
Configure MCP
Reference an already configured MCP server:mcpServers supports both array and object formats. Inline server fields:
Define Hooks
hooks in Subagent frontmatter are scoped to that Subagent session. Supported events include PreToolUse, PostToolUse, PostToolUseFailure, Stop, SubagentStart, SubagentStop, and Notification.
hooks does not support string shorthand. The value of each event must be a matcher array, and each matcher declares one or more hooks through its own hooks array.
Inside a Subagent, Stop is remapped to SubagentStop, so it fires when that Subagent finishes rather than when the main session ends.
hooks array with these hook types:
The frontmatter schema accepts
once, but ordinary Subagent frontmatter does not preserve one-shot hook semantics. If you need one-shot behavior, implement it in the hook command or external state.
Configure Permission Modes
permissionMode controls approval behavior for Subagent tool calls.
Use the canonical values above in public configuration. Runtime parsing also tolerates case and separator variants;
yolo is parsed as bypassPermissions for compatibility, but bypassPermissions is the recommended spelling.
Notes:
- If
permissionModeis omitted, the Subagent inherits the current parent session mode. - If the parent session is already in
acceptEdits,bypassPermissions, orauto, the Subagent cannot make itself stricter through its own configuration. plandoes not affect the main session’s plan state. It only applies inside the Subagent’s isolated context.
Configure Remote Subagents
Remote Subagents are loaded from Agent Cards. They do not use the Markdown body as a system prompt; behavior comes from the remote Agent Card’s exposed capabilities and description.agentCardJson to inline the Agent Card JSON. Remote Subagents support the auth field; common auth types include apiKey, http, and oauth. If authentication is required, prefer user-level configuration so credentials are not committed to the project repository.
Override Existing Subagents with settings.json
settings.json cannot create new Subagents. It only overrides Subagents that have already been discovered. Current overrides support enabled state, model configuration, runtime limits, tool allowlists, and appended MCP servers.
- Set
"enabled": falseto hide a Subagent temporarily. - Give one Subagent a different model and temperature.
- Limit maximum turns or maximum runtime for automation.
- Tighten the tool set without editing the original Markdown.
- Append MCP servers to an existing local Subagent.
hooks, mcpServers, and permissionMode are removed, and isolation is preserved only when it is worktree.
Local Subagent Full Field Reference
The fields below apply to Markdown frontmatter. Unknown fields are ignored.Test the Result
After creating or editing a Subagent, verify it in this order:- Run
/agents reloador start a new session. - Confirm it appears under the expected source in
/agentsorqodercli agents list. - Check that
descriptionclearly explains when it should be used. - Invoke it by explicit name once:
- If it is configured as read-only, ask it not to modify files and confirm no write operation appears.
- If it has
disallowedTools, ask for a blocked capability and confirm it chooses another path or explains the restriction. - If it uses MCP, confirm the target MCP tool is discovered and not blocked by
tools. - If it uses
backgroundor background execution, confirm the main session does not wait for the full result and that completion arrives as a later notification.
@name. If it is still unavailable, check load errors in the /agents panel.
Best Practices
- Give each Subagent one clear responsibility instead of mixing review, implementation, testing, and release work.
- Write
descriptionfor selection, and write the body prompt for the Subagent itself. Both should be specific. - Start with read-only tools, then add
Edit,Write, orBashonly when needed. - For higher-risk Subagents, set
maxTurns,timeoutMins, and an explicitpermissionMode. - Use
isolation: worktreewhen a Subagent needs an isolated working copy, then inspect the returned worktree path and actual diff. - If the Subagent depends on MCP tools, configure both
mcpServersandtoolsso the tools are discovered and allowed. - Use project-level Subagents for team-shared standards and user-level Subagents for personal preferences or cross-project workflows.
- Test with explicit invocation before relying on implicit selection.
- For plugin-shipped Subagents, do not depend on
hooks,mcpServers, orpermissionMode, because the plugin safety policy removes those fields.
FAQ
How is a Subagent different from the main session?
A Subagent runs in an independent context with its own system prompt, tool set, runtime limits, and permission declaration. Its result is returned to the main session, which can summarize or continue the work.Why does my project-level Subagent not appear?
Confirm the file is at.qoder/agents/<name>.md, the frontmatter includes at least name and description, and the current project is trusted. Then run /agents reload and check load errors in the /agents panel.
Why did a same-name Subagent not take effect?
Higher-priority sources override lower-priority sources. The order is Built-in < User < Project < Plugin < Flag. Useqodercli agents list to see shadowed entries.
What is the difference between description and the body prompt?
description explains when to call the Subagent and affects selection. The body prompt is the system prompt the Subagent sees after it is invoked and affects how it performs the task.
Can multiple Subagents run at the same time?
Yes. Qoder CLI can dispatch independent Subagents concurrently. For dependent work, describe the order in your prompt.Can a Subagent call another Subagent?
Yes, if theAgent tool remains available. Use Agent(name) or Agent(name1, name2) to allow only specific Subagents. Use disallowedTools: [Agent] to prevent further dispatch.
Why can my Subagent not use the MCP tool I configured?
First confirm the MCP server is discovered throughmcpServers or global MCP configuration. Then confirm tools allows the fully qualified MCP tool name. mcpServers discovers tools; it does not automatically authorize every MCP tool.
Why did the Subagent permission mode not become stricter?
If the parent session is already inacceptEdits, bypassPermissions, or auto, the Subagent cannot make itself stricter through permissionMode. If permissionMode is omitted, it inherits the current parent session mode.