Stage: connect · Severity: medium (hook interference) · OS: macOS · Agent: Claude · plugin/agent: v0.1.52
Summary
The block-monk.sh hooks script uses a regex pattern that can produce false-positive matches on process names containing "monk" as a substring, such as "monkey", "monk-notify", "monkeyboard", or user-defined scripts that happen to include "monk" in their name.
Root cause
The regex in hooks/block-monk.sh matches process names using a pattern that does not enforce strict word boundaries around "monk". The current pattern:
# Pattern captures: monkd?(\.(exe|cmd|bat|ps1))?
# Character class: [^[:space:]...]
While the comment says "monkey is not matched", the regex does not use proper word boundary anchors (\b). The character class [^[:space:]...] only checks for non-whitespace characters around the match, which fails to distinguish between:
monk (Monk process - should match)
monkd (Monk daemon - should match)
monkey (unrelated process - should NOT match but DOES)
monk-notify (user script - should NOT match but DOES)
Reproduction
- Install Monk plugin in Claude Code
- Create a script named
monk-notify.sh or run a process named monkey
- The block-monk.sh hook fires and incorrectly identifies these as Monk processes
- The hook may block or interfere with the unrelated process
Fix
Replace the regex with proper word boundary matching:
# Use \b word boundary anchors
if [[ "$process_name" =~ (^|/)(monkd?)(\.(exe|cmd|bat|ps1))?$ ]]; then
# Match only "monk" or "monkd" at word boundaries
fi
Or use grep -w (word match) instead of the current character class approach:
if echo "$process_name" | grep -qE '(^|/)monkd?(\.(exe|cmd|bat|ps1))?$'; then
Dedup
Searched for "block", "hook", "false", "process". No existing issue covers this specific regex false-positive problem. Related issue #101 addresses hook path resolution but not the regex matching logic.
Stage: connect · Severity: medium (hook interference) · OS: macOS · Agent: Claude · plugin/agent: v0.1.52
Summary
The
block-monk.shhooks script uses a regex pattern that can produce false-positive matches on process names containing "monk" as a substring, such as "monkey", "monk-notify", "monkeyboard", or user-defined scripts that happen to include "monk" in their name.Root cause
The regex in
hooks/block-monk.shmatches process names using a pattern that does not enforce strict word boundaries around "monk". The current pattern:While the comment says "monkey is not matched", the regex does not use proper word boundary anchors (
\b). The character class[^[:space:]...]only checks for non-whitespace characters around the match, which fails to distinguish between:monk(Monk process - should match)monkd(Monk daemon - should match)monkey(unrelated process - should NOT match but DOES)monk-notify(user script - should NOT match but DOES)Reproduction
monk-notify.shor run a process namedmonkeyFix
Replace the regex with proper word boundary matching:
Or use
grep -w(word match) instead of the current character class approach:Dedup
Searched for "block", "hook", "false", "process". No existing issue covers this specific regex false-positive problem. Related issue #101 addresses hook path resolution but not the regex matching logic.