Skip to content

Windows: Write hook blocks .claude/plans/ files due to forward-slash regex #275

@Jena1011

Description

@Jena1011

Bug

The PreToolUse:Write hook in hooks/hooks.json that blocks unnecessary .md file creation has a Windows path compatibility issue. The regex used to exclude .claude/plans/ only matches forward slashes, but Windows paths use backslashes.

Steps to Reproduce

  1. Use the plugin on Windows
  2. Enter plan mode (Claude Code writes to .claude/plans/*.md)
  3. The Write hook blocks the file creation with:
[Hook] BLOCKED: Unnecessary documentation file creation
[Hook] File: C:\Users\<user>\.claude\plans\generic-nibbling-key.md
[Hook] Use README.md for documentation instead

Root Cause

In hooks/hooks.json line 40, the exclusion regex is:

!/\.claude\/plans\//.test(p)

On Windows, the actual file path is C:\Users\<user>\.claude\plans\file.md (backslashes), so the regex \.claude\/plans\/ never matches.

Suggested Fix

Change the regex to match both forward and backslashes:

!/\.claude[\/\]plans[\/\]/.test(p)

In the JSON string (with proper escaping):

\.claude[\/\\]plans[\/\\]

Environment

  • OS: Windows 11
  • Claude Code plugin: everything-claude-code

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingcodexFlagged for Codex pickupdocs

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions