[BUG] Commands working inconsistently

Resolved 💬 7 comments Opened Jul 10, 2025 by harshh-jainn Closed Jan 5, 2026

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

  1. Create a cost.md file in ~/.claude/commands/ containing "Sorry not allowed"
  2. Verify file permissions are correct (640) and ownership is correct
  3. Start Claude Code in interactive mode: claude --add-dir /path/to/workspace
  4. Type /cost in the interactive session
  5. Exit Claude and start a new session
  6. Type /cost again in the new session
  7. 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

View original on GitHub ↗

This issue has 7 comments on GitHub. Read the full discussion on GitHub ↗