[BUG] Pre-approved bash commands from completed tasks persist across sessions, causing re-execution of finished work
Resolved 💬 6 comments Opened Aug 4, 2025 by ChristopherA Closed Jan 6, 2026
Environment
- Platform (select one):
- [ ] Anthropic API
- [ ] AWS Bedrock
- [ ] Google Vertex AI
- [X] Other: <!-- specify --> Claude CLI
- Claude CLI version: <!-- output of
claude --version--> 1.0.67 (Claude Code) - Operating System: <!-- e.g. macOS 14.3, Windows 11, Ubuntu 22.04 --> macOS 15.5
- Terminal: <!-- e.g. iTerm2, Terminal App --> Terminal App
Description
Claude Code is caching and injecting pre-approved bash commands from previous sessions into new sessions, causing Claude Code to attempt re-executing already completed tasks. These commands appear in the system prompt under "tools without requiring user approval" and persist even after:
- Exiting Claude Code completely
- Starting a fresh session
- Tasks being clearly marked as COMPLETE in project documentation
Steps to Reproduce
- Have CLAUDE.md load CLAUDE_RESUME.md with current completed and uncompleted tasks.
- Have Claude execute bash commands for extracting document sections (e.g., using sed to split a markdown file)
- Complete the task and mark it as done in CLAUDE_RESUME.md
- Exit Claude Code (/exit)
- Start a new session with claude .
- Claude immediately attempts to re-execute the same extraction commands
Expected Behavior
- Pre-approved commands should be cleared between sessions
- Claude should follow the project's defined startup sequence (checking CLAUDE_RESUME.md
first)
- Completed tasks should not be re-attempted
Actual Behavior
- Old bash commands persist in the "tools without requiring user approval" section
- These appear to be interpreted as pending tasks rather than just available tools
- Claude attempts to re-execute completed work, ignoring CLAUDE_RESUME.md that clearly states the task is "✅ COMPLETED - DO NOT REPEAT"
Evidence
Session JSONL shows:
- User input: "."
- Claude's response: "I'll help you extract the individual sections from the v0.92 document..."
- Despite CLAUDE_RESUME.md stating this task is complete
Environment
- Claude Code version: 1.0.67
- Platform: macOS 15.5 Darwin 24.5.0
- Project type: Non-git project with markdown documentation
Workaround
Start sessions with explicit directive instead of just ".":
claude . "Check CLAUDE_RESUME.md for current status"
Impact
- Causes confusion and wasted effort
- Breaks carefully designed context management systems
- Forces users to interrupt Claude to prevent duplicate work
- Undermines project documentation that tracks completed tasks
Suggested Fix
- Clear pre-approved commands cache when session ends
- Add an option to clear commands cache
- Don't persist task-specific commands between sessions
- Or distinguish between "available tools" and "tasks to execute"
This issue has 6 comments on GitHub. Read the full discussion on GitHub ↗