[BUG] CLAUDE.md language instructions (Spanish accents) ignored inconsistently in long sessions

Status Fixed / completed
Reported on v2.1.76
Maintainer reply None cached
Activity 7 comments · opened Mar 15, 2026 · closed Apr 16, 2026

Preflight Checklist

  • [x] I have searched existing issues and this hasn't been reported yet
  • [x] This is a single bug report
  • [x] I am using the latest version of Claude Code

What's Wrong?

CLAUDE.md files at multiple directory levels explicitly instruct Claude Code to use Spanish with correct accent marks (a, e, i, o, u, n). The instruction is respected at the start of a session but ignored intermittently as the conversation grows longer.

Directory chain loaded (4 CLAUDE.md files):

  • ~/CLAUDE.md — global rules including: "Usar correctamente: tildes (a, e, i, o, u), ene (n), signos de apertura"
  • ~/Trabajo/RSM/CLAUDE.md
  • ~/Trabajo/RSM/RSM Peru/CLAUDE.md
  • ~/Trabajo/RSM/RSM Peru/MVP-Planillas/CLAUDE.md

Observed pattern:

  • Early in session: Spanish accents appear correctly ("ano fiscal", "segun", "codigo")
  • Later in session (after ~30+ tool calls): accents drop randomly ("ano", "segun", "codigo")
  • The pattern is inconsistent — not every word, not every message
  • The same CLAUDE.md instructions that were followed at the start are ignored later

In Spanish, missing accents changes meaning. "ano" (year) vs "ano" (anus) is not a cosmetic issue — it's a semantic error that makes professional documents unusable.

What Should Happen?

CLAUDE.md language instructions should be respected consistently throughout the entire session, regardless of conversation length or context window usage.

Error Messages/Logs

No error messages. The issue is silent — accents simply stop appearing without any indication that the instruction is being ignored.

Steps to Reproduce

  1. Create ~/CLAUDE.md with content including:

```
## Idioma

  • Idioma por defecto: espanol
  • Usar correctamente: tildes (a, e, i, o, u), ene (n), signos de apertura

```

  1. Start a long Claude Code session (30+ tool calls) in a project directory
  2. Early messages will use correct accents: "ano", "segun", "codigo"
  3. After extended interaction (context compression kicks in?), accents start dropping: "ano", "segun", "codigo"
  4. The degradation is gradual and inconsistent

Is this a regression?

I don't know

Claude Code Version

2.1.76 (Claude Code)

Platform

Anthropic API

Operating System

macOS

Terminal/Shell

Terminal.app (macOS)

Additional Information

  • Locale: C.UTF-8 (terminal encoding is NOT the cause — renders accents fine independently)
  • Model: Opus 4.6 (1M context)
  • Hypothesis: CLAUDE.md instructions may be getting deprioritized or truncated as context window fills up during long sessions, possibly during automatic context compression.
  • This affects professional document generation where accent correctness is mandatory (legal/financial documents in Spanish).

View original on GitHub ↗

7 Comments

msouga · 5 months ago

Related issues: This appears to be the same root cause as #32886 (which has has repro and area:core labels).

Our report adds an additional observation: the accent dropping worsens progressively as the conversation grows longer (30+ tool calls). Early in the session, CLAUDE.md instructions are respected. Later, they are ignored intermittently. This suggests the issue may be related to context compression deprioritizing CLAUDE.md instructions.

Also related: #13006, #26128.

yurukusa · 5 months ago

I've run into a very similar pattern with Japanese language instructions in CLAUDE.md across long sessions. A few workarounds that have helped:

  1. Keep language rules at the top of CLAUDE.md. Content earlier in the file survives context compression better than content deeper in the file. If your accent rules are buried under other instructions, move them to lines 1-3.
  1. Reinforce in conversation when you notice drift. A single correction like "Recuerda: usar tildes correctamente (año, según, código)" in your next message usually snaps it back for several more exchanges. The model weights recent conversation turns more heavily than system-level instructions as context grows.
  1. Use /compact proactively before the degradation window. If you consistently see it at ~30 tool calls, compact at ~25 with a summary that includes "Language: Spanish with proper diacritics." This reloads CLAUDE.md at full weight in the compacted context.
  1. For professional documents, use focused sessions. One per document section rather than marathon sessions. Each fresh session reloads CLAUDE.md at full weight.

The root cause is instruction adherence degrading under context pressure — it's a model-level issue. But CLAUDE.md positioning (rule 1) and proactive compaction (rule 3) together have made it manageable in my experience.

msouga · 5 months ago

Reactivating this issue with additional context that explains the root cause.

Issue #32886 contains a detailed analysis of cli.js that explains exactly why language instructions degrade in long sessions:

  1. The language instruction template (around line 6230) generates a vague directive with no mention of diacritical marks or orthographic correctness — the model interprets it loosely
  2. The CLAUDE.md wrapper (around line 6315) adds "this context may or may not be relevant to your tasks" — this explicitly downgrades language rules to optional context
  3. The compaction function (around line 2286) summarizes conversation history without including language/locale instructions — so the compacted context comes back orthographically degraded

Point 3 is directly responsible for what this issue describes: CLAUDE.md instructions working correctly at the start of a session and then silently failing after context compaction. It's not that the model forgets — it's that the compaction pipeline actively discards the language rules.

This is the same structural issue affecting Spanish (#26128, closed), German (#14131), Japanese (#15768), Chinese (#14287), Arabic (#34134), and others. It warrants a fix at the template/compaction level, not per-language workarounds.

msouga · 4 months ago

Following up on this. The technical root cause is well documented (see my previous comment and #32886), but I want to emphasize why this matters beyond my specific case.

Claude Code is being used internationally to build production software for non-English-speaking clients. We developers may code and communicate in English, but our end users don't. We're building apps in Spanish, Japanese, German, Arabic, Chinese -- and Claude Code's output goes directly into user-facing interfaces, professional documents, and client deliverables.

This isn't a niche concern. Issues have been filed for Spanish (#26128), German (#14131), Japanese (#15768), Chinese (#14287), and Arabic (#34134). That's a pattern, not an edge case.

The fix is structural and has been identified:

  1. The language template (cli.js ~line 6230) needs to explicitly preserve diacritical marks and orthographic rules
  2. The CLAUDE.md wrapper should NOT include "this context may or may not be relevant" for language instructions -- they are always relevant
  3. The compaction function (~line 2286) must carry language/locale instructions forward into the compacted context

These are small, targeted changes that would make Claude Code a truly international tool. Right now, it works perfectly for English users and degrades for everyone else. I know we're a minority in the developer community, but our clients aren't -- and they're the ones who see the broken output.

msouga · 4 months ago

Closing — the root cause issue #32886 was fixed and closed on 2026-04-13 by @bcherny. The fix is included in Claude Code 2.1.110. Since both issues share the same structural root cause (language instructions lost during context compaction), this should be resolved as well. Will reopen if the behavior persists in long sessions after updating.

2vn9s1c · 4 months ago

I used Claude for the translation because I don't speak English. I checked the reverse translation, and it perfectly reflects what I meant.
I'm leaving this note in case it feels like it was written by an AI.

---

Hi — I'd like to request that this issue be reopened. I'm hitting what I believe is the exact same underlying bug that @msouga reported, just with a different surface symptom, and I'd rather add context here than fragment the signal across a new issue.

Same root cause, different symptom

  • msouga's case: Spanish accent marks and ñ (año vs ano, según vs segun) are respected early in the session and silently dropped later.
  • My case: the Spanish dialect register itself flips. I explicitly require neutral Latin American Spanish (tuteo) and explicitly forbid Rioplatense voseo (vos, tenés, sos, querés, podés, mirá, etc.). Claude Code respects this at the start of a session and then drifts into voseo after a while — exactly the same degradation pattern msouga describes.

The fact that two different users, with different CLAUDE.md rules about Spanish, are seeing the same "works at first, ignored later" pattern strongly suggests this isn't a prompt-authoring problem on the user side. It's a context/instruction-persistence problem.

Why this is worse than a cosmetic issue

Voseo isn't just "an accent" — several verb forms collide semantically with neutral Spanish:

  • corregí in neutral Spanish = first person past tense ("I corrected it")
  • corregí in Rioplatense voseo = second person imperative ("correct it [you]")

When this happens in a long, technical response (e.g. a code review or a refactor plan), every instruction to me reads as a statement by Claude about itself, and vice versa. The output becomes genuinely ambiguous, not just stylistically off. Multiply that by many occurrences in a long response and the reply is effectively unusable — I have to re-read every sentence to figure out who is the subject.

Instructions I currently have configured

I am not under-specifying this. These rules exist in three separate layers, all of which are supposed to be authoritative:

1. Global ~/.claude/CLAUDE.md:

## Idioma (OBLIGATORIO)
- SIEMPRE responder en español neutro latinoamericano (tuteo).
- PROHIBIDO usar voseo argentino o uruguayo bajo cualquier circunstancia (vos, tenés, sos, querés, podés, mirá, etc.).
- Si una respuesta contiene voseo, se considera incorrecta.
- Reescribir automáticamente cualquier frase antes de enviarla para eliminar voseo.
- Usar formas: "tú", "tienes", "quieres", "puedes", "mira".

2. Project-level CLAUDE.md reinforcement:

**Como primera tarea en cada respuesta se debe revisar y aplicar
las instrucciones escritas en `## Idioma (OBLIGATORIO)` en
`.claude/CLAUDE.md`**

3. A persistent memory entry (feedback type):

---
name: "Feedback: prohibición estricta de voseo"
description: Nunca usar voseo argentino/uruguayo bajo ninguna
  circunstancia, incluyendo formas encubiertas
type: feedback
---
Prohibido usar voseo en cualquier forma, incluyendo formas
encubiertas como "te pido disculpas" (voseo implícito de registro).
Why: El usuario lo ha corregido múltiples veces y lo distrae
activamente.
How to apply: Antes de enviar cualquier respuesta, revisar
mentalmente si hay palabras o frases de registro argentino/uruguayo
y reescribirlas en tuteo neutro.

That is three redundant, explicit, hierarchical instructions all saying the same thing. And it still fails.

Observed pattern (matches msouga's)

  • First few messages of the session: neutral Spanish, as instructed.
  • After enough tool calls / enough context accumulated: voseo starts leaking in — often mid-response, not even consistently within a single message.
  • The failure is silent. There's no indication that the language rule has been deprioritized.
  • It gets worse on expensive, long responses — the exact moments where a re-roll is most costly. I can easily burn ~40% of a usage window on a single demanding prompt and get back a wall of voseo that I then have to throw out.

What I'd like

  • Reopen this issue, or at minimum link it from a broader tracking issue, because it isn't specific to accents — it's about language/register instructions in CLAUDE.md and memory not persisting reliably across long sessions.
  • Some acknowledgement that user-authored language rules (especially those repeated in the global CLAUDE.md, the project CLAUDE.md, and long-term memory) are expected to hold regardless of session length or post-compaction state. Right now, in practice, they don't.

This has a multi-year history of being reported in various forms for Spanish specifically, and I suspect it affects other languages with strong regional registers too (Portuguese BR vs PT, Arabic dialects, etc.). It would be great to see it treated as a first-class correctness issue rather than a styling preference.

Thanks for taking a look.

github-actions[bot] · 4 months ago

This issue has been automatically locked since it was closed and has not had any activity for 7 days. If you're experiencing a similar issue, please file a new issue and reference this one if it's relevant.