Optimal use of subagents #2240

Open
opened 2026-02-16 17:34:48 -05:00 by yindo · 9 comments
Owner

Originally created by @glennvdv on GitHub (Oct 23, 2025).

Question

I have created a bunch of subagents (following https://github.com/VoltAgent/awesome-claude-code-subagents/tree/main) . How to optimal use them? Does the build agent select them automatically? Because i have the feeling it doesn't. Only when im telling him specifically to do so fe: "Refactor this code use the @javaspecialist to do so", it gets invoked with his own subsession. Im using clause 4.5

Originally created by @glennvdv on GitHub (Oct 23, 2025). ### Question I have created a bunch of subagents (following https://github.com/VoltAgent/awesome-claude-code-subagents/tree/main) . How to optimal use them? Does the build agent select them automatically? Because i have the feeling it doesn't. Only when im telling him specifically to do so fe: "Refactor this code use the @javaspecialist to do so", it gets invoked with his own subsession. Im using clause 4.5
Author
Owner

@github-actions[bot] commented on GitHub (Oct 23, 2025):

This issue might be a duplicate of existing issues. Please check:

  • #2130: GPT-5 not able to trigger subagents consistently - discusses similar problems with agents not automatically triggering subagents and needing explicit instructions
  • #2965: How to reference other mds in the md of Subagents by using @? - related to subagent configuration and usage
  • #2588: Feature request: let subagents inherit context - discusses subagent invocation and context handling

Feel free to ignore if none of these address your specific case.

@github-actions[bot] commented on GitHub (Oct 23, 2025): This issue might be a duplicate of existing issues. Please check: - #2130: GPT-5 not able to trigger subagents consistently - discusses similar problems with agents not automatically triggering subagents and needing explicit instructions - #2965: How to reference other mds in the md of Subagents by using @? - related to subagent configuration and usage - #2588: Feature request: let subagents inherit context - discusses subagent invocation and context handling Feel free to ignore if none of these address your specific case.
Author
Owner

@towry commented on GitHub (Oct 23, 2025):

Mine will automatically call the subagent. I have main agent that use glm4.5 model, and a subagent named sage using copilot grok fast code 1 for code research. So i ask a question, it automatically use the sage to do the codebase search.

@towry commented on GitHub (Oct 23, 2025): Mine will automatically call the subagent. I have main agent that use glm4.5 model, and a subagent named sage using copilot grok fast code 1 for code research. So i ask a question, it automatically use the sage to do the codebase search.
Author
Owner

@malhashemi commented on GitHub (Oct 23, 2025):

Description of the subagent is the determining factor. Build only sees the subagent description so make sure it is click baity I have found writing it as a marketing material helps, here is how I run web search for example.

  • I have webfetch tool turned off from the config (Coz it is horrible)
  • I have web-search-researcher with (Brave MCP as well as Exa for search/crawl)
  • All my MCPs are turned off by default and only enabled for subagents that actually need them
  • Below is the description of that web search agent (Credites to humanlayer ):
---
mode: subagent
description: Do you find yourself desiring information that you don't quite feel well-trained (confident) on? Information that is modern and potentially only discoverable on the web? Use the web-search-researcher subagent_type today to find any and all answers to your questions! It will research deeply to figure out and attempt to answer your questions! If you aren't immediately satisfied you can get your money back! (Not really - but you can re-run web-search-researcher with an altered prompt in the event you're not satisfied the first time)
tools:
  bash: true
  edit: true
  write: true
  read: true
  grep: true
  glob: true
  list: true
  todowrite: true
  todoread: true
  webfetch: false
  "brave-search*": true
  "exa*": true
@malhashemi commented on GitHub (Oct 23, 2025): Description of the subagent is the determining factor. Build only sees the subagent description so make sure it is `click baity` I have found writing it as a marketing material helps, here is how I run web search for example. - I have webfetch tool turned off from the config (Coz it is horrible) - I have web-search-researcher with (Brave MCP as well as Exa for search/crawl) - All my MCPs are turned off by default and only enabled for subagents that actually need them - Below is the description of that web search agent (Credites to [humanlayer](https://github.com/humanlayer/humanlayer/tree/e317ba38bd3766def245cc218a88a7778d6a9811/.claude/agents) ): ```yaml --- mode: subagent description: Do you find yourself desiring information that you don't quite feel well-trained (confident) on? Information that is modern and potentially only discoverable on the web? Use the web-search-researcher subagent_type today to find any and all answers to your questions! It will research deeply to figure out and attempt to answer your questions! If you aren't immediately satisfied you can get your money back! (Not really - but you can re-run web-search-researcher with an altered prompt in the event you're not satisfied the first time) tools: bash: true edit: true write: true read: true grep: true glob: true list: true todowrite: true todoread: true webfetch: false "brave-search*": true "exa*": true ```
Author
Owner

@rekram1-node commented on GitHub (Oct 23, 2025):

I think @malhashemi explained it pretty well, if a subagent isn't being called when you would expect then I would recommend updating it's description. Keep in mind that the description is effectively a prompt to the primary agent so you may need to fiddle around with it a bit for optimal performance

@rekram1-node commented on GitHub (Oct 23, 2025): I think @malhashemi explained it pretty well, if a subagent isn't being called when you would expect then I would recommend updating it's description. Keep in mind that the description is effectively a prompt to the primary agent so you may need to fiddle around with it a bit for optimal performance
Author
Owner

@lgladysz commented on GitHub (Oct 23, 2025):

Add a proper description for your subagent with mode mode: subagent or mode: all.
You can also add proper instructions to use a specific subagent for some action in your AGENTS.md file.
Remember that different willingness to invoke subagents is specific to different models.
For example, Anthropic's ones like when you write phrases like “use PROACTIVELY” or “MUST BE USED” in your description field.
See https://docs.claude.com/en/docs/claude-code/sub-agents#using-subagents-effectively

@lgladysz commented on GitHub (Oct 23, 2025): Add a proper description for your subagent with mode `mode: subagent` or `mode: all`. You can also add proper instructions to use a specific subagent for some action in your AGENTS.md file. Remember that different willingness to invoke subagents is specific to different models. For example, Anthropic's ones like when you write phrases like “use PROACTIVELY” or “MUST BE USED” in your description field. See https://docs.claude.com/en/docs/claude-code/sub-agents#using-subagents-effectively
Author
Owner

@glennvdv commented on GitHub (Oct 24, 2025):

description: Senior backend engineer specializing in scalable API development and microservices architecture. Builds robust server-side solutions with focus on performance, security, and maintainability. mode: subagent
This is my current description

@glennvdv commented on GitHub (Oct 24, 2025): `description: Senior backend engineer specializing in scalable API development and microservices architecture. Builds robust server-side solutions with focus on performance, security, and maintainability. mode: subagent` This is my current description
Author
Owner

@rekram1-node commented on GitHub (Oct 24, 2025):

@glennvdv and what circumstances are you wanting it to be used? Any edit to a backend file? < I would say you prolly want most edits to be done by a primary agent so you can go back and forth with it

@rekram1-node commented on GitHub (Oct 24, 2025): @glennvdv and what circumstances are you wanting it to be used? Any edit to a backend file? < I would say you prolly want most edits to be done by a primary agent so you can go back and forth with it
Author
Owner

@glennvdv commented on GitHub (Oct 24, 2025):

When working on backend code (java, kotlin, springboot). I'm currently experimenting with subagents to even better results. To not reinvent the wheel i thought of taking the predefined (sub)agents from that repo

@glennvdv commented on GitHub (Oct 24, 2025): When working on backend code (java, kotlin, springboot). I'm currently experimenting with subagents to even better results. To not reinvent the wheel i thought of taking the predefined (sub)agents from that repo
Author
Owner

@rekram1-node commented on GitHub (Oct 24, 2025):

2 things you can do to help subagents get triggered more often:

  1. Include instruction in AGENTS.md (either globally or for your project) about when to trigger certain subagentsp
  2. Include a more demanding prompt in the description:

YOU MUST USE WHEN EDITING KOTLIN FILES: Senior backend engineer specializing in scalable API development and microservices architecture. Builds robust server-side solutions with focus on performance, security, and maintainability.

Tbh this example ^ is probably too demanding because like I said you prolly wouldn't want alll your edits to be made by subagents but you prolly understand what im getting at with the "demanding" in the prompt

@rekram1-node commented on GitHub (Oct 24, 2025): 2 things you can do to help subagents get triggered more often: 1. Include instruction in AGENTS.md (either globally or for your project) about when to trigger certain subagentsp 2. Include a more demanding prompt in the description: > YOU MUST USE WHEN EDITING KOTLIN FILES: Senior backend engineer specializing in scalable API development and microservices architecture. Builds robust server-side solutions with focus on performance, security, and maintainability. Tbh this example ^ is probably too demanding because like I said you prolly wouldn't want alll your edits to be made by subagents but you prolly understand what im getting at with the "demanding" in the prompt
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#2240