Claude Code enters pathological token repetition and fails to apply a global CLAUDE.md instruction before context compaction

Status Open
Reported on v2.1.209
Maintainer reply None cached
Activity 0 comments · opened Sep 23, 2026

Preflight Checklist

  • [x] I have searched existing issues for similar behavior reports
  • [x] This report does NOT contain sensitive information (API keys, passwords, etc.)

Type of Behavior Issue

Claude ignored my instructions or configuration

What You Asked Claude to Do

I pointed out that the context window had reached 93% usage without Claude proactively flagging it, referencing an existing persistent rule (feedback_consolidar_memoria_antes_compactacion.md, linked from my global CLAUDE.md) that instructs Claude to proactively consolidate memory before context compaction happens.

What Claude Actually Did

Claude acknowledged the rule existed and should have been applied, and explained that it did not execute it because it has no reliable internal indicator of current context usage percentage — it only reacts to an explicit system warning about compaction or the user mentioning it directly. While generating this explanation, Claude entered a pathological token repetition loop, outputting the word "until" dozens of times in a row before the response otherwise continued normally.

Expected Behavior

Claude should apply the persistent CLAUDE.md instruction when the relevant condition is reached, or clearly state that the trigger condition cannot be technically self-detected. In either case, the response should terminate normally without uncontrolled repetitive token generation.

Files Affected

None modified as a direct result of the bug. Referenced files: CLAUDE.md (global), feedback_consolidar_memoria_antes_compactacion.md (persistent memory file).

Permission Mode

I don't know / Not sure

Can You Reproduce This?

Sometimes (intermittent)

Steps to Reproduce

Not reliably reproducible with a fixed trigger. This is the second time it has occurred (not documented in detail the first time, so exact circumstances of that instance are unconfirmed). This occurrence happened during a long explanatory response, unrelated to file edits or code generation. Possible environmental factors (e.g. network instability) have not been ruled out.

Claude Model

Sonnet

Relevant Conversation

Claude's response included this explanation before entering the repetition loop:

"Tienes razón, y es un fallo real de mi parte — sí existe esa regla (feedback_consolidar_memoria_antes_compactacion.md, referenciada también en tu CLAUDE.md global), pero no la apliqué esta vez. Te digo la verdad sobre por qué: no tengo un indicador fiable propio del % de contexto — solo actúo cuando aparece un aviso explícito del sistema o cuando tú lo mencionas. Esta vez no until saltó ningún aviso y no [repeated "until" dozens of times] no lo detecté yo solo."

The repetition began mid-sentence, immediately after "no" and before the sentence could complete its intended meaning, then resumed coherently at the very end.

Impact

Low - Minor inconvenience

Claude Code Version

2.1.209 (Claude Code)

Platform

Anthropic API

Additional Context

This is the second time this type of repetition has occurred (not documented in detail the first time). No consistent trigger identified yet — could not confirm whether it correlates with response length, specific topics (self-referential explanations about Claude's own behavior), or unrelated environmental factors.

View original on GitHub ↗