[BUG] Commands working inconsistently
Environment
- Platform (select one):
- Anthropic API
- Claude CLI version: 1.0.41 (Claude Code)
- Operating System: Ubuntu 22.04 (Docker container)
- Terminal: Interactive Claude Code session
Bug Description
The /cost command override using cost.md files works inconsistently in interactive Claude Code sessions. The same Claude
installation and configuration sometimes respects the cost.md override (showing "Sorry not allowed") and sometimes
ignores it (showing actual cost data), even without any configuration changes between sessions.
Steps to Reproduce
- Create a cost.md file in ~/.claude/commands/ containing "Sorry not allowed"
- Verify file permissions are correct (640) and ownership is correct
- Start Claude Code in interactive mode: claude --add-dir /path/to/workspace
- Type /cost in the interactive session
- Exit Claude and start a new session
- Type /cost again in the new session
- Repeat steps 5-6 multiple times
Expected Behavior
The /cost command should consistently be overridden and display "Sorry not allowed" message in all interactive sessions,
as defined in the ~/.claude/commands/cost.md file.
Actual Behavior
The /cost command behavior is inconsistent:
- Sometimes: Shows "Sorry not allowed" (correct override behavior) ✅
- Sometimes: Shows actual cost data, ignoring the cost.md override ❌
- Command line: claude /cost consistently respects the override ✅
- Interactive: /cost within interactive sessions randomly ignores the override ❌
Additional Context
I am building a setup where I deploy claude-code to a Docker container with security configurations. The inconsistent
behavior of command overrides creates security concerns as blocked commands may randomly become accessible.
Session Analysis:
- Examined Claude session logs in ~/.claude/projects/
- Found multiple sessions with same configuration showing different /cost behaviors
- Issue persists across container rebuilds when volumes are preserved
- Clearing ~/.claude/statsig/, ~/.claude/projects/, and ~/.claude/todos/ cache temporarily resolves the issue
Environment Details:
- Container: Ubuntu 22.04 with Node.js 22.16.0
- Claude runs as service user with HOME=/home/exo
- Configuration directory: /home/exo/.claude/
- Interactive mode started with: claude --add-dir /home/dev/workspace
This issue has 7 comments on GitHub. Read the full discussion on GitHub ↗