wk-scope-guard
Installation
SKILL.md
Scope Guard
A PreToolUse hook that keeps tool calls inside the project scope. Skill text
is advisory and gets rationalized away under pressure; a hook fires every time
and cannot be talked out of. This is the mechanical backstop for the
simplest-viable scope gate in wk-plan.
What it guards
| Tool | Condition | Action |
|---|---|---|
Bash |
A recursive search (find, fd, grep -r/-R, rg, ls -R) one of whose path operands is / or normalizes outside the repo |
Block (exit 2) |
Bash |
Same search rooted at ., a relative path, or an absolute path inside the repo |
Allow |
Bash |
Search whose out-of-repo text sits in its pattern operand, or in an unrelated non-search segment | Allow (not a root) |
Bash |
Search preceded by cd/pushd to an out-of-repo path (effective root moved) |
Block (exit 2) |
Edit / Write / MultiEdit / NotebookEdit |
Target file is an absolute path outside the repo root | Warn (exit 0) — never blocks; writing to $HOME/.claude config is legitimate |
| anything | cwd is not inside a git repo |
Allow (cannot reason about scope) |