Feature Request: Ability to bypass sub-agents and force main agent execution

Resolved 💬 7 comments Opened Aug 16, 2025 by coygeek Closed Jan 20, 2026

Title: Feature Request: Ability to bypass sub-agents and force main agent execution

Labels: feature-request, enhancement, agents

Is your feature request related to a problem? Please describe.

The sub-agent feature is incredibly powerful for creating specialized workflows. However, the current implementation where the LLM can unpredictably delegate tasks to sub-agents introduces a lack of consistency.

When I run a specific command or prompt, I sometimes want to guarantee that the main agent will handle it directly, without delegating. Currently, even with a carefully crafted prompt, the LLM might choose to use a sub-agent on one run and the main agent on another. This is especially problematic for custom slash commands, where I expect a deterministic behavior every time I use them.

For example, I have a custom /security-audit slash command. One time, the main agent will perform the audit based on its context. The next time, the LLM might decide to delegate the task to my code-reviewer sub-agent, which has a different system prompt and produces a different style of output. This inconsistency makes it difficult to build reliable and repeatable workflows.

Describe the solution you'd like

I would like a mechanism to explicitly instruct Claude Code to bypass all sub-agents for a specific prompt or session, forcing the main agent to perform the action. This would provide greater control and predictability.

Here are a few potential implementations I can think of:

  1. A Prompt Prefix/Command: A special command or prefix that wraps a prompt to disable agent delegation for that turn.
  • Example: /main perform a security audit on the auth module
  • Example: !perform a security audit on the auth module
  1. A Session-level Toggle: A slash command to enable or disable sub-agent delegation for the current session.
  • Example: /agents off to disable delegation, and /agents on to re-enable it.
  1. Slash Command Frontmatter: An option in the frontmatter of a custom slash command's markdown file to prevent delegation. This would be ideal for ensuring custom commands are always consistent.
  • Example /.claude/commands/security-audit.md:

``markdown
---
description: Runs a security audit using the main agent.
delegate-agents: false
---
Please perform a security audit...
``

Describe alternatives you've considered

The only alternative I've found is to manually rename or delete the ~/.claude/agents/ and .claude/agents/ directories before running a command, and then restoring them afterward. This is obviously not a practical or scalable solution. I want the flexibility of keeping my sub-agents available for when I need them, without them interfering when I don't.

Additional context

This feature would be a significant improvement for users who rely on Claude Code for automation and building consistent, reusable tools with slash commands. It bridges the gap between having powerful, specialized agents and needing deterministic, predictable behavior from the main agent.

View original on GitHub ↗

This issue has 7 comments on GitHub. Read the full discussion on GitHub ↗