diff --git a/README.md b/README.md index 64cc13f..b1c11bb 100644 --- a/README.md +++ b/README.md @@ -212,7 +212,6 @@ Nelson is not purely advisory. A set of Claude Code hooks (`hooks/nelson_hooks.p | Event | Hook | What it enforces | |---|---|---| | `PreToolUse` on `Agent` | `preflight` | Station tier gate, file ownership conflicts, mode-tool consistency | -| `PreToolUse` on `TaskCreate` | `mode-check` | Rejects task creation in non-agent-team modes | | `PostToolUse` on `Write`/`Edit` | `brief-validate` | Turnover brief quality gate | | `TaskCompleted` | `task-complete` | Validation evidence and station controls | | `TeammateIdle` | `idle-ship` | Paid-off standing order advisory | diff --git a/hooks/hooks.json b/hooks/hooks.json index 2eb0add..27df8ef 100644 --- a/hooks/hooks.json +++ b/hooks/hooks.json @@ -9,15 +9,6 @@ "command": "python3 \"${CLAUDE_PLUGIN_ROOT}/hooks/nelson_hooks.py\" preflight" } ] - }, - { - "matcher": "TaskCreate", - "hooks": [ - { - "type": "command", - "command": "python3 \"${CLAUDE_PLUGIN_ROOT}/hooks/nelson_hooks.py\" mode-check" - } - ] } ], "PostToolUse": [ diff --git a/hooks/nelson_hooks.py b/hooks/nelson_hooks.py index 0f72337..8866799 100644 --- a/hooks/nelson_hooks.py +++ b/hooks/nelson_hooks.py @@ -7,7 +7,6 @@ preflight — PreToolUse on Agent: station tier gate, file ownership conflicts, mode-tool consistency - mode-check — PreToolUse on TaskCreate: reject in non-agent-team modes brief-validate — PostToolUse on Write/Edit: turnover brief quality gate task-complete — TaskCompleted: validation evidence and station controls idle-ship — TeammateIdle: paid-off standing order advisory @@ -222,31 +221,6 @@ def cmd_preflight(args: argparse.Namespace) -> None: _allow() -# --------------------------------------------------------------------------- -# Subcommand: mode-check (PreToolUse on TaskCreate) -# --------------------------------------------------------------------------- - - -def cmd_mode_check(args: argparse.Namespace) -> None: - """Reject TaskCreate in non-agent-team execution modes.""" - payload = _read_stdin() - ctx = _load_mission_context(payload) - if ctx is None: - _allow() - - _, battle_plan = ctx - mode = _get_mode(battle_plan) - if mode in ("subagents", "single-session"): - _reject( - f"Standing order violation (wrong-ensign): " - f"TaskCreate is not available in {mode} mode. " - f"Track work in the admiral's conversation context. " - f"See references/tool-mapping.md." - ) - - _allow() - - # --------------------------------------------------------------------------- # Subcommand: brief-validate (PostToolUse on Write/Edit) # --------------------------------------------------------------------------- @@ -669,10 +643,6 @@ def main() -> None: "preflight", help="Pre-flight standing order gate (PreToolUse on Agent)", ) - subparsers.add_parser( - "mode-check", - help="Mode-tool consistency check (PreToolUse on TaskCreate)", - ) subparsers.add_parser( "brief-validate", help="Turnover brief quality gate (PostToolUse on Write/Edit)", @@ -690,7 +660,6 @@ def main() -> None: dispatch = { "preflight": cmd_preflight, - "mode-check": cmd_mode_check, "brief-validate": cmd_brief_validate, "task-complete": cmd_task_complete, "idle-ship": cmd_idle_ship, diff --git a/hooks/test_nelson_hooks.py b/hooks/test_nelson_hooks.py index 8d9a057..9cb6670 100644 --- a/hooks/test_nelson_hooks.py +++ b/hooks/test_nelson_hooks.py @@ -1,8 +1,7 @@ """Tests for nelson_hooks.py — hook enforcement script. -Tests the preflight, mode-check, brief-validate, task-complete, -and idle-ship subcommands using temporary mission directories and -monkeypatched stdin. +Tests the preflight, brief-validate, task-complete, and idle-ship +subcommands using temporary mission directories and monkeypatched stdin. """ from __future__ import annotations @@ -35,7 +34,6 @@ _has_evidence, cmd_brief_validate, cmd_idle_ship, - cmd_mode_check, cmd_preflight, cmd_task_complete, ) @@ -302,28 +300,6 @@ def test_marine_subagent_in_agent_team_allows(self, tmp_path: Path) -> None: assert code == 0 -# --------------------------------------------------------------------------- -# Mode-check -# --------------------------------------------------------------------------- - - -class TestModeCheck: - def test_no_mission_allows(self, tmp_path: Path) -> None: - assert _run(cmd_mode_check, {"tool_name": "TaskCreate", "tool_input": {}}, str(tmp_path)) == 0 - - def test_subagents_mode_rejects(self, tmp_path: Path) -> None: - _make_mission(tmp_path, mode="subagents") - assert _run(cmd_mode_check, {"tool_name": "TaskCreate", "tool_input": {}}, str(tmp_path)) == 2 - - def test_single_session_rejects(self, tmp_path: Path) -> None: - _make_mission(tmp_path, mode="single-session") - assert _run(cmd_mode_check, {"tool_name": "TaskCreate", "tool_input": {}}, str(tmp_path)) == 2 - - def test_agent_team_allows(self, tmp_path: Path) -> None: - _make_mission(tmp_path, mode="agent-team") - assert _run(cmd_mode_check, {"tool_name": "TaskCreate", "tool_input": {}}, str(tmp_path)) == 0 - - # --------------------------------------------------------------------------- # Brief-validate # ---------------------------------------------------------------------------