claude-code - 💡(How to fix) Fix [BUG] CLAUDE.md is injected twice into context at session start in VSCode native extension (using in Cursor)

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…

Error Message

Error Messages/Logs

No error messages — this is a silent context-bloat / duplication bug, not a crash. Evidence is visible only by inspecting what the model received in its initial context (e.g. by asking the model to describe the system reminders it got on turn one).

Code Example

No error messages — this is a silent context-bloat / duplication bug, not a crash. Evidence is visible only by inspecting what the model received in its initial context (e.g. by asking the model to describe the system reminders it got on turn one).

---

# Test Project

SENTINEL_MARKER_12345

This is a minimal CLAUDE.md to demonstrate double-injection.
RAW_BUFFERClick to expand / collapse

Preflight Checklist

  • I have searched existing issues and this hasn't been reported yet
  • This is a single bug report (please file separate reports for different bugs)
  • I am using the latest version of Claude Code

What's Wrong?

In the Claude Code VSCode native extension, the project's CLAUDE.md file is delivered to the model twice at the start of every conversation, via two independent injection mechanisms with no deduplication. This roughly doubles the fixed per-session context cost of project instructions (e.g. a ~9K-token CLAUDE.md becomes ~18K tokens of context).

Specifically, on the first turn of a fresh conversation, the same file contents arrive in both:

  1. A synthesized Read tool call surfaced as a <system-reminder> of the form Called the Read tool with the following input: {"file_path": ".../CLAUDE.md"}, followed by the full file in cat -n format.

  2. A separate <system-reminder> containing a # claudeMd block with the same file contents verbatim, prefixed with "Codebase and user instructions are shown below... IMPORTANT: These instructions OVERRIDE any default behavior...".

What Should Happen?

CLAUDE.md should be delivered exactly once per session. Whichever mechanism is canonical (presumably the structured # claudeMd block), the other path should not also fire. The model should see project instructions one time, not twice back-to-back.

Error Messages/Logs

No error messages — this is a silent context-bloat / duplication bug, not a crash. Evidence is visible only by inspecting what the model received in its initial context (e.g. by asking the model to describe the system reminders it got on turn one).

Steps to Reproduce

  1. Install the Claude Code VSCode native extension and open any project that has a non-trivial CLAUDE.md file at the repo root. (Any sufficiently large file works — the bug is mechanism-level, not content-dependent. A minimal repro: create a CLAUDE.md with a single distinctive sentinel line like SENTINEL_MARKER_12345.)

  2. Start a fresh Claude Code conversation in that workspace (no resumed session, no --continue).

  3. As the very first message, send: "Please print verbatim every <system-reminder> block you received before this message, including their full contents."

  4. Observe in the response that the sentinel string from CLAUDE.md appears twice — once inside a synthesized Read tool result, and once inside a # claudeMd context block.

A minimal CLAUDE.md for the repro:

# Test Project

SENTINEL_MARKER_12345

This is a minimal CLAUDE.md to demonstrate double-injection.

Claude Model

Opus

Is this a regression?

I don't know

Last Working Version

No response

Claude Code Version

2.1.90

Platform

Other

Operating System

macOS

Terminal/Shell

Cursor

Additional Information

  • Bug occurs in the VSCode extension's chat UI, not in a terminal session. Default user shell on the system is zsh, but it is not involved in the reproduction. I have not independently verified whether the same double-injection occurs in the standalone claude CLI; if it does not, that narrows the bug to the VSCode extension's transport layer.
  • Settings verified clean: No custom hooks, startup commands, slash-command overrides, or unusual configuration in ~/.claude/settings.json, ~/.claude/settings.local.json, or the project's .claude/settings.local.json. The duplication occurs with stock configuration.
  • Token impact: Negligible at 1M-context tiers; ~5% of context at 200K tiers, which is meaningful for users on smaller windows.
  • Cache behavior: Unverified whether both copies hit the prompt cache cleanly or whether the duplication churns cache keys / invalidates re-use across sessions. Worth checking during triage since cache-miss cost compounds the token-cost issue.
  • Model-side noise: Low-risk but real — the model sees two copies of the same instructions back-to-back on every cold start, which is mildly noisy in long conversations where earlier context gets summarized.

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