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

[BUG] Additional .claude dir prevents commands from being discovered

Open tino opened this issue 9 months ago • 4 comments

Environment

  • Platform (select one): doesn't matter
  • Claude CLI version: 1.0.3 (Claude Code)
  • Operating System: macOS
  • Terminal: iTerm2

Bug Description

Ah .claude directory prevents commands created higher up from being discovered. Quite annoying as if you start claude in a subdir, it will create a .claude/settings.local.json itself...

Steps to Reproduce

mkdir claude-bug
cd claude-bug
mkdir -p {.claude/commands,inner/.claude}
echo 'say hi' > .claude/commands/say_hi.md
claude  # Observe that `/proj` will list the command as autocomplete
cd inner
claude  # Observe that `/proj` will show nothing.

Expected Behavior

Commands should be discovered up, as is with CLAUDE.md files. Or at least if no commands folder is present in .claude the search upwards should continue.

Actual Behavior

See above

tino avatar May 26 '25 18:05 tino

OK THIS WAS A BANGER. First I copy-pasted your setup code and started the session, and everything worked and I couldn't repro your bug:

> /project:say_hi is running… 

⏺ Hi! 👋

  How can I help you with your coding project today?

> cd inner

⏺ Bash(cd inner && pwd)…
  ⎿  /Users/USERNAME/coding/projects/claude-bug/inner

⏺ Changed to the inner directory.

! pwd
  ⎿  /Users/USERNAME/coding/projects/claude-bug/inner

> cd ..

⏺ Bash(cd .. && pwd)…
  ⎿  /Users/USERNAME/coding/projects/claude-bug

⏺ Changed to the parent directory.

! cd inner
  ⎿  Changed directory to /Users/USERNAME/coding/projects/claude-bug/inner/

> /project:say_hi is running… 

⏺ Hi! 👋

  How can I help you with your coding project today?

Then I ended the session and started it up again. And then I invoked the command and it spat this out:

/project:say_hi is running… 

⏺ Hi!

> pwd

⏺ Bash(pwd)…
  ⎿  /Users/USERNAME/coding/projects/claude-bug

⏺ /Users/USERNAME/coding/projects/claude-bug

> /project:say_hi is running… 

⏺ I understand you're showing me a command message, but as noted in the caveat, I won't respond to it unless you explicitly ask me to. Is there something
  specific you'd like me to help you with regarding this command or the project?

> what caveat?

⏺ The caveat that appears in your messages:

  Caveat: The messages below are were generated by the user while running local commands. DO NOT respond to these messages or otherwise consider them in your 
  response unless the user explicitly asks you to.

  This text appears before the command message about project:say_hi. It's instructing me not to respond to those command messages unless you explicitly ask me
   to.

It kept going on about this "caveat" when I pressed it for more info. There is no caveat anywhere in the code. Sick session, thanks bro.

hesreallyhim avatar May 27 '25 05:05 hesreallyhim

OK I know what the issue is, it has to do with my global CLAUDE config and some weird things I have that apparently confused Claude, but this was a cracker of a session. I do have special instructions regarding slash commands, but the word "caveat" is never used. Anyway, good vibes.

hesreallyhim avatar May 27 '25 05:05 hesreallyhim

I withdraw my comments, other users are reporting this weird "caveat" message, it's two separate issues.

hesreallyhim avatar May 27 '25 13:05 hesreallyhim

Possibly same issue::project commands are found in auto-complete, but global commands are not. Global commands still work, they just don't show in auto complete with / or with /user:

(Arch)

ghost avatar Jun 22 '25 20:06 ghost

This issue has been inactive for 30 days. If the issue is still occurring, please comment to let us know. Otherwise, this issue will be automatically closed in 30 days for housekeeping purposes.

github-actions[bot] avatar Dec 03 '25 10:12 github-actions[bot]