[BUG] Plugin hook files auto-open in VSCode and steal focus from CLI input

Resolved 💬 2 comments Opened Jan 7, 2026 by okkazoo Closed Jan 10, 2026

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):

  1. Install a plugin with hooks (e.g., ok-know from okkazoo-plugins)
  2. Open VSCode with Claude Code extension
  3. Start a new Claude Code session in the integrated terminal: claude
  4. Observe: Multiple hook files auto-open in editor tabs
  5. Observe: Cursor focus is now in the opened file, not the CLI
  6. 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

  1. Have VSCode with Claude Code extension installed
  2. Install a plugin with hooks: ok-know from okkazoo-plugins
  3. Open VSCode integrated terminal
  4. Run claude to start a new session
  5. Observe: The 3 hook .py files open as tabs in VSCode
  6. Observe: Cursor focus jumps to one of the opened files
  7. 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_

View original on GitHub ↗

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