scope-guard
Skill2 starsChanged 12 days agoMITView on GitHub
Session boundary discipline contract. Establishes and self-audits write scope for infrastructure and multi-file work. Behavioral discipline, not a filesystem interceptor.
12 other projects use a version of this.
Adopted by
Most recently taken up by
- ThanhNguyxnOrg/blendopstheir own version, first seen Nov 8, 2026
- runbooklabhq/freelancer-ops-skills-litetheir own version, first seen Nov 8, 2026
- drvoss/everything-copilot-clitheir own version, first seen Oct 26, 2026
- CalebAnderson-Coder/ai-agency-os-startertheir own version, first seen Oct 25, 2026
- CorvusWing/CorvusWingtheir own version, first seen Oct 25, 2026
- kritikosgns-web/freelancer-ops-skills-litetheir own version, first seen Oct 20, 2026
Other versions12 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 12
- drvoss/everything-copilot-cli★ 48same name
- ThanhNguyxnOrg/blendops★ 3same name
- CorvusWing/CorvusWing★ 1same name
- dylanburkey/claude-code-sidekick★ 1same name
- InsightStudio-2026/agent-assets★ 1same name
- kaelen2026/skills★ 1same name
- CalebAnderson-Coder/ai-agency-os-starter★ 0same name
- grxkun/scope-guard★ 0same name
- kritikosgns-web/freelancer-ops-skills-lite★ 0same name
- owen-dev-6174/bodhisattva-skills★ 0same name
2 more not listed
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository29 other files it gives its agents.
- AGENTS.mdAGENTS.md
- apply-review-findingsSkill
- author-workflow-fanoutSkill
- chain-launcherSkill
- delegateSkill
- design-consultationSkill
- design-fail-closed-gateSkill
- document-releaseSkill
- gistSkill
- goal-promptSkill
- grokbotSkill
- incident-as-codeSkill
- investigateSkill
- learn-captureSkill
- office-hoursSkill
- orion-deep-researchSkill
- oss-loopSkill
- pre-compactSkill
- pre-prSkill
- prove-control-bindsSkill
- prove-deploy-is-liveSkill
- readonlySkill
- reassert-guards-on-rewriteSkill
- reprobe-stale-premiseSkill
- shipSkill
- tdd-loopSkill
- tools-routerSkill
- triage-fanout-verdictsSkill
- xSkill
The file
We split this skill into the rules it gives an agent
10 rules. 0 are common, 10 are distinctive, and 0 are very specific to this project.
0
Common
Most of the 10 edited versions we read keep these.
10
Distinctive
This author's own choices. Worth a look.
0
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 12
When invoked, collect these parameters:
- Distinctive: line 18
If the user does not provide explicit paths, attempt to derive defaults from:
- Distinctive: line 22
If neither exists, ask the user to declare write scope explicitly
- Distinctive: line 53
If both pass, proceed with the write.
- Distinctive: line 54
If either fails, STOP. Do not write.
- Distinctive: line 94
Does not intercept filesystem writes mechanically
- Distinctive: line 95
Does not prevent reads of any file
- Distinctive: line 96
Does not hardcode repo-specific paths globally
- Distinctive: line 97
Does not depend on any specific internal package
- Distinctive: line 98
Does not govern racing a concurrent session (write-scope, not concurrency): when two sessions may mutate shared state at once, use a …
“Common” is measured: kept by at least 6 in 10 of the 10 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Scope Guard
Session boundary discipline. Constrains which files Claude may write to during a session. This is a behavioral contract: it shapes how Claude operates through self-imposed discipline. It is NOT a filesystem-level interceptor and cannot guarantee hard prevention of every out-of-scope edit.
Activation
When invoked, collect these parameters:
- Scope description: what this session is doing (one sentence)
- Allowed write paths: directories and/or file globs that may be modified
- Excluded areas: directories and/or file globs that must NOT be modified
If the user does not provide explicit paths, attempt to derive defaults from:
- Repo-local
CLAUDE.mdboundary declarations - Repo-local
AGENTS.mdboundary notes (e.g., "this repo owns X, not Y") - If neither exists, ask the user to declare write scope explicitly
Deterministic enforcement (Claude Code hook)
In Claude Code the scope-guard-enforce PreToolUse hook makes this contract
self-enforcing. On activation, after collecting the scope, write the session
marker so the hook can block out-of-scope writes:
mkdir -p ~/.claude/state && cat > ~/.claude/state/scope-guard.json <<'JSON'
{"active": true,
"scope": "<one-sentence scope>",
"allowed": ["/abs/path/or/glob/**", "..."],
"excluded": ["/abs/path/to/protect", "..."]}
JSONThe hook then DENIES any Edit/Write whose target is outside allowed or inside
excluded. Clear it when the scope changes or the session ends:
rm -f ~/.claude/state/scope-guard.json. No marker = no enforcement (the hook is
inert by default, safe). No-hook environments: the hook is absent, so
the self-check below IS the enforcement; apply it manually before each write.
Scope Rules
Read scope: Unrestricted. Reading broadly for context is always allowed.
Write scope: Constrained to declared allowed paths. Before any file write (Edit, Write tool calls), self-check:
- Is the target file within the declared allowed write paths?
- Is the target file NOT in the excluded areas?
- If both pass, proceed with the write.
- If either fails, STOP. Do not write. Report:
## Scope Violation Detected
Target file: <path>
Declared write scope: <allowed paths>
Excluded areas: <excluded paths>
Reason: <which rule was violated>
Stopping. This file is outside declared write scope.
To proceed, explicitly expand the scope or confirm this exception.Session Audit
At session end, or when /pre-pr is invoked, or when the user asks for a scope audit, produce:
## Scope Audit
**Session scope:** <description>
**Allowed write paths:** <paths>
**Excluded areas:** <paths>
| File | Action | In Scope? |
|------|--------|-----------|
| path/to/file.py | modified | yes |
| path/to/other.py | inspected (read-only) | n/a |
| path/to/edge.py | modified | WARNING: near boundary |Distinguish modified (Edit/Write was used) from inspected (Read only).
Honesty Note
This skill operates as self-imposed discipline within Claude's reasoning. If paired with a hook that validates edited file paths against declared scope, enforcement becomes mechanical. Without that hook, it relies on Claude's adherence to the contract. Do not claim or imply filesystem-level enforcement.
What this skill does NOT do
- Does not intercept filesystem writes mechanically
- Does not prevent reads of any file
- Does not hardcode repo-specific paths globally
- Does not depend on any specific internal package
- Does not govern racing a concurrent session (write-scope, not concurrency): when two sessions may mutate shared state at once, use a claim-or-probe discipline to serialize access instead of relying on this skill
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

