claude-code - 💡(How to fix) Fix Sub-agents ignore explicit rules embedded in their own prompt

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…

When Claude spawns sub-agents with detailed rules in the prompt, the agents frequently violate those exact rules. The rules are present in the prompt text that the agent receives, yet the agent generates output that contradicts them.

Error Message

Category: logic-error

Root Cause

  • Every rule violation required a follow-up fix cycle (agent + render + verify)
  • 16 out of 26 reports needed post-generation fixes
  • Multiple hours of rework
  • Rules had to be added repeatedly because agents kept ignoring them
RAW_BUFFERClick to expand / collapse

Bug Report

Category: logic-error Severity: Major Claude Code Version: 2.1.84 OS: Windows 11 Pro

Description

When Claude spawns sub-agents with detailed rules in the prompt, the agents frequently violate those exact rules. The rules are present in the prompt text that the agent receives, yet the agent generates output that contradicts them.

Examples (all from today)

Rule in prompt: "Width maxim pe campuri text din header: MAX 300px!" Agent output: Generated textField with width=434px, which covered all fields below it making them invisible.

Rule in prompt: "Padding pe celule tabel: OBLIGATORIU leftPadding=2 rightPadding=2" Agent output: Generated cells without any padding, causing text from adjacent columns to appear visually merged.

Rule in prompt: "Header tabel: Background #D0D0D0 (gri), text #000000" Agent output: 5 out of 26 reports had header background #008B8B (teal) or no background at all.

Rule in prompt: "Crosstab in DETAIL band, not summary" Agent output: All 7 crosstab reports placed the crosstab in summary band, causing blank first page.

Expected Behavior

When rules are explicitly stated in the agent's prompt, the agent should follow them. These are not subtle guidelines — they are explicit, bold, capitalized rules with examples of WRONG vs CORRECT.

Impact

  • Every rule violation required a follow-up fix cycle (agent + render + verify)
  • 16 out of 26 reports needed post-generation fixes
  • Multiple hours of rework
  • Rules had to be added repeatedly because agents kept ignoring them

Possible Causes

  1. Long prompts with many rules — attention may focus on early rules and miss later ones
  2. Agent uses cached patterns from training data that conflict with prompt rules
  3. Rules are stated as constraints but agent optimizes for "complete the task" over "follow all rules"

Suggested Fix

  1. Move critical rules to the TOP of the prompt (not buried in the middle)
  2. Add a post-generation self-check: "Before returning, verify these 5 critical rules..."
  3. Use structured validation (JSON schema?) rather than prose rules

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING