Skip to content

fix: stop generate-rules-recon subagent from recursively spawning itself#79

Merged
Tim-Pohlmann merged 1 commit into
mainfrom
worktree-bridge-cse_01AUcUeo4Gdo2YRkRUd8DQi6
Jul 2, 2026
Merged

fix: stop generate-rules-recon subagent from recursively spawning itself#79
Tim-Pohlmann merged 1 commit into
mainfrom
worktree-bridge-cse_01AUcUeo4Gdo2YRkRUd8DQi6

Conversation

@Tim-Pohlmann

Copy link
Copy Markdown
Owner

Summary

  • The generate-rules-recon agent had no tools/disallowedTools restriction, so it inherited every tool, including Agent and Skill.
  • Its description closely paraphrases the parent generate-rules skill's own description. Mid-recon, the subagent would sometimes match its own task back to that skill and invoke it via the Skill tool, which re-invokes generate-rules-recon via the Agent tool — recursing multiple levels deep before doing any real recon work.
  • This is a known Claude Code failure mode (recursive/nested subagent spawning); the standard mitigation is to restrict a worker subagent's tool surface rather than rely on prompt wording.

Fix

Add disallowedTools: Agent, Skill to agents/generate-rules-recon.md, so the recon agent can no longer spawn subagents or invoke skills at all — it only does read-only reconnaissance and reports candidate rules back to the orchestrating skill.

Test plan

  • Run /generate-rules (or /dolphin:generate-rules) against this repo and confirm the recon step completes without spawning nested recon agents.

…itself

The recon agent inherited every tool by default, including Agent and
Skill. Its description closely mirrors the parent generate-rules
skill's description, so mid-recon it would sometimes match its own
task back to that skill and invoke it, which re-invokes the recon
agent, recursing multiple levels deep before any real work happened.

disallowedTools: Agent, Skill removes both from the recon agent's
tool pool so it can no longer spawn subagents or invoke skills at all.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@sonarqubecloud

sonarqubecloud Bot commented Jul 2, 2026

Copy link
Copy Markdown

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Prevents the generate-rules-recon worker agent from recursively re-invoking itself by restricting its tool surface, so recon remains read-only and reports findings back to the orchestrating generate-rules skill.

Changes:

  • Add a disallowedTools restriction to the generate-rules-recon agent to block Agent and Skill tool usage.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread agents/generate-rules-recon.md
@Tim-Pohlmann Tim-Pohlmann merged commit 7aad83e into main Jul 2, 2026
8 checks passed
@Tim-Pohlmann Tim-Pohlmann deleted the worktree-bridge-cse_01AUcUeo4Gdo2YRkRUd8DQi6 branch July 2, 2026 20:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants