Lock the design/ folder outside a design session #2
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "design-guardrail"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
As orbit grew and
design/became the canonical styleguide the web layerwould be ported from, accidental AI edits to those files during unrelated
feature work became a real risk. One thoughtless rewrite of
design/style.cssduring a Go refactor would silently desync thestyleguide from the web layer.
This PR installs a
PreToolUsehook (.claude/hooks/design-session-guard.sh)that enforces a two-mode rule: design work and feature work are strictly
separated. In normal mode,
Edit,Write,MultiEdit, andBashoperations under
design/are blocked. To work on the styleguide, theuser creates a session marker file (
.claude/design-session-active) froma separate terminal outside Claude Code. While the marker is present,
design/is unlocked — and symmetrically, everything else is locked sofeature work can't leak in during a design session.
The hook is deliberately AI-unreachable in every direction: Claude cannot
create, delete, read, or otherwise manipulate the marker file via any
tool, because the whole point of a mode flip is that the human makes it.
Detection
For
Edit/Write/MultiEdit, the hook compares the resolved absolutepath against the repo root and classifies writes as in-design or
out-of-design. For
Bash, it uses a path-token regex —(^|[^[:alnum:]_])design/— that matchesdesign/,./design/,/design/and quoted variants, but deliberately does not matchdesigns/(the Go package) orredesign/.Reads are always allowed
The hook never blocks reading from
design/. Claude can reference thestyleguide for context at any time, from any mode.
feat: guardrail for the design folder via PreToolUse hookto Lock the design/ folder outside a design session