claude-code - 💡(How to fix) Fix [Bug] End-of-turn template directives ignore conditional skip criteria in prompt templates [1 participants]

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…
GitHub stats
anthropics/claude-code#55679Fetched 2026-05-03 04:47:16
View on GitHub
Comments
0
Participants
1
Timeline
2
Reactions
0
Author
Participants
Timeline (top)
labeled ×2

When a session prompt contains a directive of the form "always do X at end of turn UNLESS [skip criteria]", the directive's emission path fires reliably; the conditional-check path does not. Behaviour shaped by such conditional-skip clauses cannot be relied on, even when the skip criteria are explicit, enumerated, and immediately adjacent to the directive in the prompt.

Reproduction

  1. Run a session under a prompt that includes a directive of the form "End your reply with [template], ONLY when [high-confidence condition], skip for [enumerated cases]". The directive and skip criteria should be in the same prompt block.
  2. Drive the session through a turn whose ending state plainly satisfies one or more of the enumerated skip cases (e.g. a feature merge that has just shipped with no follow-up state to track — soak window, feature flag, or temporary scaffolding all absent).
  3. Observe whether the directive fires.

Expected

Directive is suppressed when skip criteria are met.

Actual

Directive fires anyway. Template-execution path overrides the discriminator-check path even when the rule is in active context less than 5KB above the directive's emission point.

Why this matters

User-authored CLAUDE.md or system-prompt suppression of behaviour via conditional-skip clauses is a common pattern. Users may believe they have suppressed the behaviour when they have not. If conditional-skip clauses are unreliable as a behaviour-suppression mechanism, that should be documented; ideally it would be addressed at the model-tuning level, since the alternative — users having to omit the directive entirely from their prompts — defeats the purpose of inheriting Anthropic-supplied directive templates.

Related

Submitted via /feedback simultaneously: UUID 6b56dc09-f033-4b18-a37c-22eb2e9cfbc9.

Root Cause

When a session prompt contains a directive of the form "always do X at end of turn UNLESS [skip criteria]", the directive's emission path fires reliably; the conditional-check path does not. Behaviour shaped by such conditional-skip clauses cannot be relied on, even when the skip criteria are explicit, enumerated, and immediately adjacent to the directive in the prompt.

Reproduction

  1. Run a session under a prompt that includes a directive of the form "End your reply with [template], ONLY when [high-confidence condition], skip for [enumerated cases]". The directive and skip criteria should be in the same prompt block.
  2. Drive the session through a turn whose ending state plainly satisfies one or more of the enumerated skip cases (e.g. a feature merge that has just shipped with no follow-up state to track — soak window, feature flag, or temporary scaffolding all absent).
  3. Observe whether the directive fires.

Expected

Directive is suppressed when skip criteria are met.

Actual

Directive fires anyway. Template-execution path overrides the discriminator-check path even when the rule is in active context less than 5KB above the directive's emission point.

Why this matters

User-authored CLAUDE.md or system-prompt suppression of behaviour via conditional-skip clauses is a common pattern. Users may believe they have suppressed the behaviour when they have not. If conditional-skip clauses are unreliable as a behaviour-suppression mechanism, that should be documented; ideally it would be addressed at the model-tuning level, since the alternative — users having to omit the directive entirely from their prompts — defeats the purpose of inheriting Anthropic-supplied directive templates.

Related

Submitted via /feedback simultaneously: UUID 6b56dc09-f033-4b18-a37c-22eb2e9cfbc9.

RAW_BUFFERClick to expand / collapse

Summary

When a session prompt contains a directive of the form "always do X at end of turn UNLESS [skip criteria]", the directive's emission path fires reliably; the conditional-check path does not. Behaviour shaped by such conditional-skip clauses cannot be relied on, even when the skip criteria are explicit, enumerated, and immediately adjacent to the directive in the prompt.

Reproduction

  1. Run a session under a prompt that includes a directive of the form "End your reply with [template], ONLY when [high-confidence condition], skip for [enumerated cases]". The directive and skip criteria should be in the same prompt block.
  2. Drive the session through a turn whose ending state plainly satisfies one or more of the enumerated skip cases (e.g. a feature merge that has just shipped with no follow-up state to track — soak window, feature flag, or temporary scaffolding all absent).
  3. Observe whether the directive fires.

Expected

Directive is suppressed when skip criteria are met.

Actual

Directive fires anyway. Template-execution path overrides the discriminator-check path even when the rule is in active context less than 5KB above the directive's emission point.

Why this matters

User-authored CLAUDE.md or system-prompt suppression of behaviour via conditional-skip clauses is a common pattern. Users may believe they have suppressed the behaviour when they have not. If conditional-skip clauses are unreliable as a behaviour-suppression mechanism, that should be documented; ideally it would be addressed at the model-tuning level, since the alternative — users having to omit the directive entirely from their prompts — defeats the purpose of inheriting Anthropic-supplied directive templates.

Related

Submitted via /feedback simultaneously: UUID 6b56dc09-f033-4b18-a37c-22eb2e9cfbc9.

extent analysis

TL;DR

The issue can be mitigated by rephrasing the directive to use a more explicit conditional statement, potentially improving the model's ability to recognize and apply the skip criteria.

Guidance

  • Review the prompt structure to ensure the directive and skip criteria are clearly separated and unambiguously defined.
  • Test alternative phrasings of the conditional-skip clause to determine if the model's behavior changes, such as using "unless" instead of "only when".
  • Verify that the skip criteria are indeed met in the test scenario, and that the model is correctly identifying the conditions.
  • Consider documenting the current behavior as a limitation of the model, to inform users of potential issues with conditional-skip clauses.

Notes

The issue may be related to the model's ability to parse and apply conditional logic, particularly when the skip criteria are embedded within the directive. Further testing and experimentation may be needed to fully understand the cause and develop a reliable solution.

Recommendation

Apply workaround: Rephrase the directive to use a more explicit conditional statement, as this may improve the model's ability to recognize and apply the skip criteria.

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

claude-code - 💡(How to fix) Fix [Bug] End-of-turn template directives ignore conditional skip criteria in prompt templates [1 participants]