Skip to content

bug: VSCode extension duplicates project skills in context when multiple working directories are configured #33793

Description

@ecosquirrel-dev

Summary

The VSCode extension duplicates project skills in the LLM system prompt when multiple working directories (multi-root workspace) are configured. Each skill from .claude/skills/ in the primary project directory is injected once per working directory instead of once total. For example, with 3 workspace folders and 13 custom skills, the system prompt contains 39 skill entries (13 x 3) instead of 13 — tripling the token cost for skills from ~370 to ~1,100 tokens. The /context command confirms each skill listed 3 times with source "Project".

Motivation

Unnecessary token consumption in the system prompt. While the per-session impact is small (~730 wasted tokens with 13 skills x 3 directories), it adds up across sessions and could become more significant with larger skill sets or more working directories. It also makes the /context output confusing as it suggests misconfiguration.

Out of Scope

  • Skills loaded from different projects that happen to share the same name (legitimate separate skills)
  • Deduplication of built-in/system skills

Dependencies / Blockers

N/A

Specification

Environment: Claude Code VSCode Extension (native extension mode), Windows 11, claude-opus-4-6

Steps to reproduce:

  1. Open a VSCode workspace with multiple folders (e.g., 3 projects in a multi-root workspace)
  2. Only the primary project has .claude/skills/ with custom SKILL.md files
  3. The additional working directories have no .claude/skills/ directory
  4. Start a Claude Code session
  5. Run /context to inspect token usage

Expected: Each skill appears once in the context
Actual: Each skill appears N times (where N = number of working directories)

Evidence from /context output:

### Skills

| Skill | Source | Tokens |
|-------|--------|--------|
| brainstorming | Project | 53 |
| brand-guidelines | Project | 26 |
| debug | Project | 31 |
| ...                              |
| brainstorming | Project | 53 |
| brand-guidelines | Project | 26 |
| debug | Project | 31 |
| ...                              |
| brainstorming | Project | 53 |
| brand-guidelines | Project | 26 |
| debug | Project | 31 |
| ...                              |

Each skill block is identical and repeats once per working directory.

Suggested Doc Updates

N/A — this is a runtime behavior fix.

Suggested Files

Path Reason
Skill loading / registration logic in the VSCode extension Deduplication needed when iterating over working directories

Acceptance Criteria

  • Skills from the primary project are loaded exactly once regardless of how many additional working directories are configured
  • /context output shows each skill only once
  • No regression when skills exist in multiple working directories (each unique skill still loads correctly)

Metadata

Metadata

Assignees

No one assigned

    Labels

    duplicateThis issue or pull request already exists

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions