Add the zcode write-path guard instance with its adaptation matrix

Why: zcode lacks a rules feature (AGENTS.md is the resident layer) but
supports PreToolUse hooks that can block Edit/Write before the write lands,
upgrading A1/A3 from commit-time to write-time enforcement; the two block
shapes (integration branch, detached submodule) mirror the real incidents.
Evidence: script-level suite 8/8 (N1-N3 blocks with exit 2 and remediation
hints, P1-P5 allows incl. fail-open degradation paths); config JSON valid;
client-side live-fire interception marked pending-live in the matrix.
Impact: .zcode/config.json enables the hook runner for this workspace;
.zcode/plans/ ignored (client state); no product code change.
Refs: Development-Guidelines 0.1.0-draft.8; policy/tool-adaptation-zcode.md
This commit is contained in:
weichen
2026-09-30 03:43:26 +00:00
parent 17a07a5e42
commit ccddcc2b2b
5 changed files with 93 additions and 0 deletions
+20
View File
@@ -0,0 +1,20 @@
{
"hooks": {
"enabled": true,
"events": {
"PreToolUse": [
{
"matcher": "Edit|Write|ApplyPatch",
"hooks": [
{
"type": "command",
"command": "bash \"${ZCODE_PROJECT_DIR}/scripts/zcode/write-guard.sh\"",
"timeout": 15,
"statusMessage": "检查写入目标的工作区状态(门禁 A1/A3)"
}
]
}
]
}
}
}