Skip to content

Subagents ​

Subagents are specialized agents with their own tool sets and instructions, invoked by the main agent via the delegate_subagent tool to complete sub-tasks within a defined scope. Subagents are ideal for parallel work, context isolation, or restricting tool permissions in complex scenarios.

How They Work ​

  1. The main agent identifies decomposable sub-tasks
  2. It calls delegate_subagent with an agent name and task description
  3. The subagent runs in an isolated session context
  4. After completion, results (summary, modified files, transcript) are returned to the main agent
  5. The main agent integrates the result and continues

Subagents can be configured with tool allowlists/denylists, max turns, isolation modes, and more to keep execution scope under control.

Built-in Subagents ​

ByteMind ships with three built-in subagents:

explorer ​

Read-only repository exploration agent. Finds files, symbols, call chains, and configuration flows. No writes or shell commands.

PropertyValue
Toolslist_files read_file search_text
Max turns6
When to useFinding files, understanding code structure, locating patterns
text
/explorer

review ​

Code review agent. Analyzes correctness, regression risk, security issues, and test coverage gaps. Findings only — no code modifications.

PropertyValue
Toolslist_files read_file search_text
Max turns8
When to useReviewing code, checking for bugs, assessing quality
text
/review

general ​

General-purpose coding agent with read/write access. Handles complex multi-step tasks requiring file modifications. Cannot further delegate to other subagents.

PropertyValue
Toolslist_files read_file search_text replace_in_file write_file
Max turns12
Isolationnone
When to useMulti-file edits, refactoring, feature implementation

Listing Subagents ​

List all available subagents:

text
/agents

View details for a specific subagent:

text
/agents explorer

Show built-in agent definitions directly:

text
/explorer
/review

Custom Subagents ​

Define project-level subagents by creating .md files under .agents/agents/. Each file uses YAML frontmatter for metadata, with the Markdown body serving as the subagent's execution instructions.

Directory Structure ​

.agents/
  agents/
    frontend-developer.md
    api-tester.md

Frontmatter Fields ​

FieldTypeDescriptionDefault
namestringAgent name used in delegate_subagent callsFilename (no extension)
descriptionstringShort description shown in /agents listAuto-extracted from body
toolsarrayAllowed tools whitelist—
disallowed_toolsarrayForbidden tools blacklist—
modelstringSpecific model override (e.g. sonnet)Inherited from session
modestringWork mode: build or planbuild
max_turnsintMaximum tool call turns0 (unlimited)
isolationstringIsolation mode: none or worktreenone
when_to_usestringHint for when the main agent should delegate—
aliasesarrayAlias namesAuto-generated

Example ​

markdown
---
name: api-tester
description: "Focused on writing and debugging integration tests for API endpoints"
tools: [list_files, read_file, search_text, write_file, replace_in_file, run_shell]
disallowed_tools: [delegate_subagent]
model: sonnet
max_turns: 10
isolation: none
when_to_use: "For writing API tests, debugging endpoint issues, adding HTTP test coverage"
---

You are an API testing specialist.

## Workflow

1. Read relevant handler and route definitions first
2. Analyze existing test patterns and coverage gaps
3. Write minimal but complete integration tests
4. Run tests and fix failures

## Standards

- Each test case is independent and reproducible
- Cover happy paths and common error paths
- Do not modify business logic code

Scope Priority ​

Subagents load from three scopes. Agents with the same name are overridden by higher priority scopes:

ScopePathPriority
project.agents/agents/Highest
user~/.bytemind/agents/Medium
builtinBuilt-inLowest

Project-level configuration takes the highest priority: .agents/agents/frontend-developer.md (project) overrides ~/.bytemind/agents/frontend-developer.md (user).

Subagent Isolation (Worktree) ​

Setting isolation: worktree causes the subagent to run in an isolated git worktree. File changes are separated from the main workspace. The worktree can be kept or discarded upon completion. Ideal for scenarios requiring extensive experimental changes.

Delegating in Conversation ​

You generally don't need to call delegate_subagent manually — the main agent decides when delegation is appropriate based on task complexity. You can also ask directly:

text
Use the explorer subagent to find all auth-related middleware
Use the review subagent to review the latest changes

See Also ​

  • Skills — specialized workflows activated by slash commands
  • Chat Mode — the interactive mode in which subagents run
  • Core Concepts — agent modes and tools

Released under the MIT License.