Skip to content

research-readonly-write-guard

Prevent source-file write tools during active research sessions.

hook PreToolUse multi-harness mode: enforce

Prevent source-file write tools during active research sessions.

FieldValue
idresearch-readonly-write-guard
modeenforce
degraded_behavioraudit when the harness payload does not expose a tool name or writable path
logical_eventPreToolUse
matcherWrite|Edit|MultiEdit|apply_patch|edit|create|replace|write_file|run_shell_command
commandpython3 {repo_root}/hooks/wagents-hook.py research-readonly-write-guard --harness {harness}
timeout5
harnesses["codex", "claude-code", "github-copilot", "gemini-cli"]
Full hook config + command reference
config/hook-registry.json (entry)
{
"id": "research-readonly-write-guard",
"description": "Prevent source-file write tools during active research sessions.",
"mode": "enforce",
"degraded_behavior": "audit when the harness payload does not expose a tool name or writable path",
"logical_event": "PreToolUse",
"matcher": "Write|Edit|MultiEdit|apply_patch|edit|create|replace|write_file|run_shell_command",
"command": "python3 {repo_root}/hooks/wagents-hook.py research-readonly-write-guard --harness {harness}",
"timeout": 5,
"harnesses": [
"codex",
"claude-code",
"github-copilot",
"gemini-cli"
]
}
hooks/wagents-hook.py + research_hook.py
def _policy_readonly_write_guard(payload: NormalizedPayload) -> int:
research_hook = _load_research_hook_module()
research_payload = _research_payload(payload, research_hook)
return research_hook._policy_readonly_write_guard(research_payload)

Full logic in skills/research/scripts/research_hook.py.


View source on GitHub