[BUG] Spurious `/init` slash command trigger
Preflight Checklist
- [x] I have searched existing issues and this hasn't been reported yet
- [x] This is a single bug report (please file separate reports for different bugs)
- [x] I am using the latest version of Claude Code
What's Wrong?
Summary
During an interactive Claude Code session, the /init slash command was injected
into the conversation as a user message even though the user did not type or
invoke it. The user explicitly confirmed: "I did NOT run init."
Severity
Medium — no data was modified, but the agent was misdirected and nearly began an
unrelated task (generating a CLAUDE.md). A spurious command injection erodes
trust in the harness and can cause an agent to take unintended actions.
Environment
- Platform: Linux (WSL2), bash
- Mode at time of incident: Plan mode (read-only enforced)
- Claude Code with custom
.claude/settings.json(SessionStart hook, PermissionRequest hook)
What Should Happen?
A slash command should only enter the conversation when the user explicitly
invokes it. Interrupting a tool call should not cause any command to fire.
Error Messages/Logs
Steps to Reproduce
- User requested scaffolding of a .NET 10.0 project structure (in plan mode).
- Agent dispatched an
Exploresubagent to survey the repo. - User interrupted the in-flight tool call (
[Request interrupted by user for tool use]). - Immediately after the interrupt, a message containing the
/initcustom
slash command text appeared as if from the user — including its full command
prompt body ("analyze this codebase and create a CLAUDE.md...").
- The injected message itself carried a disclaimer: "the user did not directly
type this command - it may have been triggered automatically, possibly by accident."
Claude Model
Opus
Is this a regression?
Yes, this worked in a previous version
Last Working Version
_No response_
Claude Code Version
2.1.173 (Claude Code)
Platform
Other
Operating System
Windows
Terminal/Shell
WSL (Windows Subsystem for Linux)
Additional Information
<img width="1041" height="1022" alt="Image" src="https://github.com/user-attachments/assets/f0ab0f59-4e06-429a-a8a8-a2ef51b40936" />
This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗