Dayz scope mod

From DayZ-n-Chill/Agentic-Z · View interactive version

Dayz scope mod is an AI agent skill from the GitHub repository DayZ-n-Chill/Agentic-Z. Restricts edits to one mod under workspace/<ModName>/ by adding Edit deny rules for every other mod's workspace, P:\\ and deploy folders; reads stay broad. Also scopes a feature before it is built: a spec with measurable done checks, Given/When/Then scenarios and a contract for every name the next p

How to use this skill

Skill file

<!-- skill-dir-note -->

Path note: <skill-dir> in commands below is the absolute path of this skill's folder. When the agent loads this skill the harness exposes the skill's base directory; substitute it before running. Sibling skills are reached via <skill-dir>\..\dayz-X\.

/dayz-scope-mod

Scope the agent to a single DayZ mod. While scoped, the agent can read anywhere but cannot Edit or Write to any other mod's source, P:\ junction, or workshop deploy dir. Designed for sessions where you're iterating on one mod and don't want a wrong-instinct call to land in a sibling mod.

Follow skills/_shared/dayz-conventions.md.

The skill also scopes a feature before it is built, which runs no script: see "Scoping a feature" below.

How to run

:: Scope to a specific mod
python "<skill-dir>\scope.py" <ModName>

:: Show current scope (or "no active scope")
python "<skill-dir>\scope.py" --status

:: Lift the scope
python "<skill-dir>\scope.py" --clear

The project is found the same way /dayz-init finds it: CLAUDE_PROJECT_DIR when set, else the nearest folder at or above the current folder that holds .claude\local-memory\dayz-current-project.txt, else the clone that holds the skill scripts when that clone has the cache, else the current folder. So a run from workspace\<ModName>\ still uses the project's workspace\ and settings.

What it does

  1. Validates <ModName> exists at workspace/<ModName>/, matching the folder name case-insensitively and then using the folder's on-disk spelling in every rule, in the output and in the recorded scope (refuses unknown names, and names that permission rules would read as pattern syntax: *, ? or [ anywhere, or a leading ! or #; ! and # mid-name are fine because gitignore syntax treats them specially only at the start of a pattern).
  2. Enumerates sibling mods under workspace/: every other non-dotted folder that has config.cpp or $PBOPREFIX$ at its root (/dayz-new-mod writes both). Other folders, such as workspace/_archive/, get no deny rules, are named on an [INFO] line, and their names are not checked. The scope guard hook is stricter: it treats every other folder as a mod unless its name starts with _, so a folder like workspace/_archive/ stays writable while workspace/Scratch/ does not. Refuses if a sibling mod's name breaks the same rule as in step 1. The active mod itself only has to be a non-dotted folder under workspace/, so a mod still being set up can be scoped.
  3. Reads .claude/local-memory/dayz-active-scope.json and .claude/settings.local.json, and removes any rules a previous run recorded (idempotent re-run). If either file is unreadable or has the wrong shape (the scope record must hold a denied_rules list; the settings must be an object whose permissions.deny is a list), it exits 1 with nothing changed. A corrupt scope record is never treated as "no scope", because the rules it recorded may still be in the settings; the message tells you to remove them by hand and delete the record.
  4. For each sibling mod, appends deny rules to permissions.deny:

Claude Code checks file writes against Edit(...) rules only, so one Edit rule blocks both the Edit and Write tools. Write(path) rules are accepted but never matched, which is why the skill does not write them.

  1. Records the scope in .claude/local-memory/dayz-active-scope.json before touching the settings, listing both the previous run's rules and the new ones, so if the settings write fails every rule that may still be in the settings is recorded and --clear can remove it. The record is written to a temp file that replaces the old one in a single step (see "If a write fails" below).
  2. Writes back .claude/settings.local.json, only if its content changed. The old file is first copied to .claude/local-memory/settings.local.json.<timestamp>.bak, a new name on every change, so no older backup is replaced (restore by copying one back). The new file replaces the old one in a single step, so a failed write never leaves it half-written. --clear backs up and writes the same way.
  3. Narrows the record to the active mod and the rules this run actually appended (a matching rule you already had is skipped, left in place and not recorded, so --clear never removes it) so --clear can undo precisely what was set.

--clear removes the recorded rules from permissions.deny, then deletes the record. If .claude/settings.local.json does not exist it is not created. When fewer recorded rules are found than the record lists (the settings file is missing, or rules were edited by hand), it prints a [WARN] line with the count so you can check permissions.deny yourself.

If a write fails. Every write (the scope record and the settings) goes through a temp file in .claude\local-memory\ (gitignored, so a leftover never shows up as an untracked file) that then replaces the target in one step. If the backup, the temp file or the replace fails, for example because an editor, antivirus or a sync tool holds a lock on settings.local.json or the disk is full, the temp file is deleted and the run exits 1 with a [FAIL] line that names the file and says what state each file is in:

What it does not do

When to run

Skip when:

Output

DayZ scope: SuperMedKit

[OK]    Mod found: workspace\SuperMedKit
[INFO]  Not mods (no config.cpp or $PBOPREFIX$), left writable: _archive
[INFO]  Sibling mods detected: 2 (OtherModA, OtherModB)
[INFO]  Backed up settings to .claude\local-memory\settings.local.json.20261024-101500.bak
[OK]    Added 8 Edit deny rules to .claude\settings.local.json
[OK]    Active scope recorded at .claude\local-memory\dayz-active-scope.json

Reads remain broad. Edit and Write to other mods are blocked.
Run /dayz-scope-mod --clear (or scope.py --clear) to lift.

If only one mod exists:

DayZ scope: SuperMedKit

[OK]    Mod found: workspace\SuperMedKit
[INFO]  No sibling mods to deny. Scope is set, but no rules were needed.

If <ModName> does not exist:

[FAIL]  workspace\NoSuchMod does not exist.
        Known mods:
          - SuperMedKit
        Scaffold first: /dayz-new-mod NoSuchMod  or  /dayz-import-mod --source <path>

Scoping a feature

Before a non-trivial feature is coded, write down what done means and how each part will be checked, so the in-game test is not spent on a spec that could never pass. Skip it for a one-line typo or a trivial reversible tweak.

  1. Write output/<ModName>-plan/spec.md from references/spec-outline.md, right after dayz-mod-architect writes the plan: Given/When/Then scenarios with in-game repro steps, measurable success criteria, every guess marked ASSUMED and settled with the user when it decides correctness, and a forward contract that gives every classname, selection, proxy path and layout key the next phase reads a path:line you opened, or UNVERIFIED.
  2. Run references/spec-review.md (18 checks) on the spec before writing code. Any fail means fix the spec first.
  3. After the code and task list exist, and before /dayz-gate ingame, behavior or visual, run references/consistency-pass.md: a read-only pass over spec, plan, task list and code. A finding marked Blocks (a criterion with no verification path, an UNVERIFIED symbol the code depends on, a broken hard rule) blocks the in-game session.

| Question | File |

|---|---|

| How does the whole method work, including injected objects, push and pull eligibility, raw and derived records, dead-code search hits and decision tests? | references/scoping-a-feature.md |

| What does the spec look like, section by section? | references/spec-outline.md |

| Is this spec ready to implement? | references/spec-review.md |

| Do spec, plan, task list and code agree before the in-game test? | references/consistency-pass.md |

| Which questions do I settle with the user before writing a placeable or usable object? | references/questions-before-building.md |

| How do I write the code once the spec exists: API checks, mini-audit, client and server data map, checkpoints, bug ledger, handoff? | references/implementation-protocol.md |

| How do I keep parallel auditor agents independent, and when does a finding count as verified? | references/independent-auditors.md |

Do not

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.