claude-code icon indicating copy to clipboard operation
claude-code copied to clipboard

[BUG] Custom commands duplicated and non-functional when running Claude Code from home directory

Open Systemic-Void opened this issue 6 months ago • 1 comments

Environment

  • Platform (select one):
    • [x] Anthropic API
    • [ ] AWS Bedrock
    • [ ] Google Vertex AI
    • [ ] Other:
  • Claude CLI version: 1.0.29 (Claude Code)
  • Operating System: Ubuntu 22.04 LTS (Pop!_OS)
  • Terminal: Alacritty and Warp Terminal

Bug Description

When running Claude Code from the home directory, custom user commands from ~/.claude/commands/ are duplicated in the slash command list and become non-functional. Each scroll cycle adds more non-functional duplicate entries at the top of the command list.

Image

Steps to Reproduce

  1. Create custom commands in ~/.claude/commands/
  2. Run claude from home directory (cd ~ && claude)
  3. Type / to open command list
  4. Scroll through the entire command list to the end or move between first and last entry.
  5. Observe additional duplicate lines appear

Expected Behavior

Each custom command should appear once in the list in alphabetical order.

Actual Behavior

  • Custom commands are duplicated multiple times throughout the command list
  • Each time you scroll to the end and back to top, another non-functional duplicate line is added at the top
  • The duplicated commands at the top cannot be executed
  • Command list becomes increasingly cluttered and difficult to navigate

Additional Context

  • Issue only occurs when running Claude Code from the home directory (~)
  • Commands work normally when running Claude Code from any other directory
  • Personal commands are stored in ~/.claude/commands/ as documented
  • Bug makes the command interface unusable when working from home directory

Systemic-Void avatar Jun 19 '25 14:06 Systemic-Void

Can confirm this is the same on macOS and on other terminals like iTerm2 or IntelliJ integrated terminal.

andybergon avatar Jun 19 '25 15:06 andybergon

In case any devs from Anthropic read this, the issue is that when the slash commands from both ~/.claude/commands and ./.claude/commands are combined, the duplicates throw off the renderer. You can just create a set of uniques by name to fix this.

With the latest version (1.59.0), you can do a

sed -i '' 's/\[\.\.\.o,\.\.\.v1\]/[...new Map([...o, ...v1].map(item => { return [item.name, item] })).values()]/g' "/path/to/cli.js"

to patch it.

adamrogal-dd avatar Jul 24 '25 21:07 adamrogal-dd

Fixed in v1.0.61

dicksontsai avatar Jul 28 '25 07:07 dicksontsai

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.

github-actions[bot] avatar Aug 04 '25 14:08 github-actions[bot]