Claude ignores agent frontmatter constraints when selecting subagents
Resolved 💬 4 comments Opened Jan 17, 2026 by SalesforceRocks Closed Mar 1, 2026
Problem
When using the Task tool to delegate work to subagents, Claude ignores the agent's frontmatter metadata (description, allowedProjectGlobs, disallowedProjectGlobs) and selects inappropriate agents.
Example
User was working in project SBWZ_Docs (a documentation repository). Claude needed to write a simple markdown file (an ADR - Architecture Decision Record).
Claude selected terraform-developer agent, which has this frontmatter:
name: terraform-developer
description: Expert Terraform developer - implements production-grade GCP infrastructure from approved designs with security, validation, and operational excellence
allowedProjectGlobs:
- "**/docsense/**"
- "**/infrastructure/**"
disallowedProjectGlobs:
- "**/SBWZ_Docs*/**"
- "**/sabewa*/**"
Problems:
- The
descriptionclearly says "Terraform developer" and "GCP infrastructure" - completely irrelevant to writing a markdown file - The
disallowedProjectGlobsexplicitly excludes**/SBWZ_Docs*/**- the exact project being worked on - Claude should have used
general-purposeagent or written the file directly
Expected Behavior
Claude should:
- Read and respect
disallowedProjectGlobs- never select an agent for a disallowed project - Match the task to the agent's
description- don't use a Terraform agent for markdown files - Prefer simpler solutions (direct tool use or general-purpose agent) for trivial tasks
Environment
- Claude Code CLI
- Model: claude-opus-4-5-20251101
- Custom agents defined in
~/.claude/agents/
This issue has 4 comments on GitHub. Read the full discussion on GitHub ↗