Expand description
Write-boundary primitives.
Stateless classifiers shared by the armed guard ([super::decide]) and
pipeline::detect-stray-writes: which tools write, which Bash commands
mutate state outside a sandbox, and whether a path falls under an allowed
root.
Constants§
- WRITE_
TOOLS - Tools that mutate the filesystem and carry a target path argument.
Functions§
- apply_
patch_ paths - Extract file paths from a Codex
apply_patchhook payload. Codex can expose patch targets as a structuredfileslist or as freeform patch text; collect both so the guard can deny unknown or out-of-bounds patches before they run. - classify_
bash - If a Bash command matches a mutation pattern and is not scoped to one of
allowed_roots, return the human reason; otherwiseNone. A command is treated as scoped when it textually references an allowed root. - is_
under - True when
targetresolves todiror a descendant of it. Relativetargets resolve againstrepo_root.Path::starts_withmatches whole path components, soskills-workspace2is correctly not underskills-workspace. - is_
under_ any - True when
targetis under any ofdirs. - is_
write_ tool - True for a tool name that writes the filesystem with a path argument.
- path_
arg - Pull the target path from a write tool’s arguments (
file_path→notebook_path→path). ReturnsNonewhen the input is not an object or carries no string path.