[BUG] Plugin hook files auto-open in VSCode and steal focus from CLI input
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?
When starting a Claude Code session with plugins installed (e.g., ok-know), hook files are automatically opened in VSCode:
- ~/.claude/plugins/cache/.../hooks/pre-read.py
- ~/.claude/plugins/cache/.../hooks/user-prompt-submit.py
- ~/.claude/plugins/cache/.../hooks/session-start.py
Problem: The cursor focus moves to the opened file in VSCode instead of staying in the CLI chat window. When I start typing my prompt, I'm accidentally typing into the open Python file instead of the Claude Code CLI.
Expected behavior: Hook files should execute silently without opening in the editor, or there should be a setting to disable this behavior.
Environment:
- OS: Windows 11 with Git Bash
- Running Claude Code from VSCode integrated terminal
- Plugins: ok-know (okkazoo-plugins)
Workaround needed: Currently have to manually click back into the terminal after each session start.
What Should Happen?
Hook files should execute silently in the background without being opened in the editor.
Alternatively, if file syncing is intentional, the focus should remain in the CLI input field rather than jumping to the opened file tab.
Ideally there would be a setting like syncPluginFiles: false to control this behavior.
Steps to Reproduce (if there's that field):
- Install a plugin with hooks (e.g., ok-know from okkazoo-plugins)
- Open VSCode with Claude Code extension
- Start a new Claude Code session in the integrated terminal:
claude - Observe: Multiple hook files auto-open in editor tabs
- Observe: Cursor focus is now in the opened file, not the CLI
- Try typing - text goes into the Python file instead of the prompt
Additional Context (if available):
This appears to happen specifically when the plugin hooks are executed at session start. The files opened are read-only plugin cache files that users shouldn't need to view or edit.
Impact: High - disrupts normal workflow on every session start. Users may accidentally modify plugin files by typing before noticing focus has shifted.
Error Messages/Logs
No error messages - this is a UX/behavior issue.
Files that auto-open on session start:
~/.claude/plugins/cache/okkazoo-plugins/ok-know/1.10.1/hooks/pre-read.py
~/.claude/plugins/cache/okkazoo-plugins/ok-know/1.10.1/hooks/user-prompt-submit.py
~/.claude/plugins/cache/okkazoo-plugins/ok-know/1.10.1/hooks/session-start.py
Steps to Reproduce
- Have VSCode with Claude Code extension installed
- Install a plugin with hooks: ok-know from okkazoo-plugins
- Open VSCode integrated terminal
- Run
claudeto start a new session - Observe: The 3 hook .py files open as tabs in VSCode
- Observe: Cursor focus jumps to one of the opened files
- Start typing a prompt - text appears in the .py file, not the CLI
Claude Model
Opus
Is this a regression?
Yes, this worked in a previous version
Last Working Version
2.0.76
Claude Code Version
2.1.1
Platform
Anthropic API
Operating System
Windows
Terminal/Shell
VS Code integrated terminal
Additional Information
_No response_
This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗