From d31b43a86911ae17af20a02b2162a2349d2b53dc Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 23 Jan 2026 02:07:21 +0000 Subject: [PATCH 1/4] Initial plan From 47a1faf39d76f9a259797dd9bf172736c13f8ca8 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 23 Jan 2026 02:11:37 +0000 Subject: [PATCH 2/4] Fix hooks to use deepwork CLI instead of python directly for Homebrew compatibility Co-authored-by: ncrmro <8276365+ncrmro@users.noreply.github.com> --- src/deepwork/core/hooks_syncer.py | 5 +++-- tests/unit/test_hooks_syncer.py | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/deepwork/core/hooks_syncer.py b/src/deepwork/core/hooks_syncer.py index 4a97cbd7..afc3e9a5 100644 --- a/src/deepwork/core/hooks_syncer.py +++ b/src/deepwork/core/hooks_syncer.py @@ -35,8 +35,9 @@ def get_command(self, project_path: Path) -> str: Command string to execute """ if self.module: - # Python module - run directly with python -m - return f"python -m {self.module}" + # Python module - run via deepwork CLI + # This works regardless of how deepwork was installed (pipx, uv, homebrew, etc.) + return f"deepwork hook {self.module}" elif self.script: # Script path is: .deepwork/jobs/{job_name}/hooks/{script} script_path = self.job_dir / "hooks" / self.script diff --git a/tests/unit/test_hooks_syncer.py b/tests/unit/test_hooks_syncer.py index 79527681..aa2831a8 100644 --- a/tests/unit/test_hooks_syncer.py +++ b/tests/unit/test_hooks_syncer.py @@ -43,7 +43,7 @@ def test_get_command_for_module(self, temp_dir: Path) -> None: ) cmd = entry.get_command(temp_dir) - assert cmd == "python -m deepwork.hooks.rules_check" + assert cmd == "deepwork hook deepwork.hooks.rules_check" class TestJobHooks: From 4153ec9dd6a7a025fe18fd9a90ecdc13dd0a8a21 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 23 Jan 2026 02:14:21 +0000 Subject: [PATCH 3/4] Update .claude/settings.json to use deepwork hook command Co-authored-by: ncrmro <8276365+ncrmro@users.noreply.github.com> --- .claude/settings.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.claude/settings.json b/.claude/settings.json index ac649fc3..58947fd6 100644 --- a/.claude/settings.json +++ b/.claude/settings.json @@ -155,7 +155,7 @@ "hooks": [ { "type": "command", - "command": "python -m deepwork.hooks.rules_check" + "command": "deepwork hook deepwork.hooks.rules_check" } ] } @@ -166,10 +166,10 @@ "hooks": [ { "type": "command", - "command": "python -m deepwork.hooks.rules_check" + "command": "deepwork hook deepwork.hooks.rules_check" } ] } ] } -} \ No newline at end of file +} From ea4f90d98f52551a10c1efe05bbdd2a11cbabf51 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 23 Jan 2026 02:15:42 +0000 Subject: [PATCH 4/4] Update documentation and manual tests to use deepwork hook command Co-authored-by: ncrmro <8276365+ncrmro@users.noreply.github.com> --- doc/architecture.md | 2 +- .../test_infinite_block_command.py | 2 +- .../test_infinite_block_prompt.py | 4 ++-- manual_tests/test_multi_safety/test_multi_safety.py | 6 +++--- manual_tests/test_pair_mode/test_pair_mode_trigger.py | 6 +++--- manual_tests/test_set_mode/test_set_mode_source.py | 4 ++-- .../test_trigger_safety_mode/test_trigger_safety_mode.py | 4 ++-- 7 files changed, 14 insertions(+), 14 deletions(-) diff --git a/doc/architecture.md b/doc/architecture.md index 95617d1f..0f1f54d7 100644 --- a/doc/architecture.md +++ b/doc/architecture.md @@ -1147,7 +1147,7 @@ The hooks are installed to `.claude/settings.json` during `deepwork sync`: { "hooks": { "Stop": [ - {"matcher": "", "hooks": [{"type": "command", "command": "python -m deepwork.hooks.rules_check"}]} + {"matcher": "", "hooks": [{"type": "command", "command": "deepwork hook deepwork.hooks.rules_check"}]} ] } } diff --git a/manual_tests/test_infinite_block_command/test_infinite_block_command.py b/manual_tests/test_infinite_block_command/test_infinite_block_command.py index 22be16c7..e20a485d 100644 --- a/manual_tests/test_infinite_block_command/test_infinite_block_command.py +++ b/manual_tests/test_infinite_block_command/test_infinite_block_command.py @@ -12,7 +12,7 @@ === TEST CASE 1: Rule SHOULD fire (command fails, infinite block) === 1. Edit this file (add a comment below the marker) -2. Run: echo '{}' | python -m deepwork.hooks.rules_check +2. Run: echo '{}' | deepwork hook deepwork.hooks.rules_check 3. Expected: Block with command error AND promise skip instructions === TEST CASE 2: Rule should NOT fire (promise provided) === diff --git a/manual_tests/test_infinite_block_prompt/test_infinite_block_prompt.py b/manual_tests/test_infinite_block_prompt/test_infinite_block_prompt.py index 5c2ee508..a0aa8ad9 100644 --- a/manual_tests/test_infinite_block_prompt/test_infinite_block_prompt.py +++ b/manual_tests/test_infinite_block_prompt/test_infinite_block_prompt.py @@ -13,7 +13,7 @@ === TEST CASE 1: Rule SHOULD fire (infinite block) === 1. Edit this file (add a comment below the marker) -2. Run: echo '{}' | python -m deepwork.hooks.rules_check +2. Run: echo '{}' | deepwork hook deepwork.hooks.rules_check 3. Expected: "Manual Test: Infinite Block Prompt" appears in output with decision="block" 4. The block message should explain that a promise is required @@ -30,7 +30,7 @@ echo '{"role":"assistant","message":{"content":[{"type":"text","text":"Manual Test: Infinite Block Prompt"}]}}' > /tmp/transcript.jsonl 2. Run with transcript: - echo '{"transcript_path":"/tmp/transcript.jsonl"}' | python -m deepwork.hooks.rules_check + echo '{"transcript_path":"/tmp/transcript.jsonl"}' | deepwork hook deepwork.hooks.rules_check 3. Expected: {} (empty JSON = allow) diff --git a/manual_tests/test_multi_safety/test_multi_safety.py b/manual_tests/test_multi_safety/test_multi_safety.py index 27734025..1cf8ba12 100644 --- a/manual_tests/test_multi_safety/test_multi_safety.py +++ b/manual_tests/test_multi_safety/test_multi_safety.py @@ -11,19 +11,19 @@ === TEST CASE 1: Rule SHOULD fire === 1. Edit this file (add a comment below the marker) 2. Do NOT edit any safety files -3. Run: echo '{}' | python -m deepwork.hooks.rules_check +3. Run: echo '{}' | deepwork hook deepwork.hooks.rules_check 4. Expected: "Manual Test: Multi Safety" appears in output === TEST CASE 2: Rule should NOT fire (changelog edited) === 1. Edit this file (add a comment below the marker) 2. ALSO edit test_multi_safety_changelog.md -3. Run: echo '{}' | python -m deepwork.hooks.rules_check +3. Run: echo '{}' | deepwork hook deepwork.hooks.rules_check 4. Expected: "Manual Test: Multi Safety" does NOT appear === TEST CASE 3: Rule should NOT fire (version edited) === 1. Edit this file (add a comment below the marker) 2. ALSO edit test_multi_safety_version.txt -3. Run: echo '{}' | python -m deepwork.hooks.rules_check +3. Run: echo '{}' | deepwork hook deepwork.hooks.rules_check 4. Expected: "Manual Test: Multi Safety" does NOT appear === RULE LOCATION === diff --git a/manual_tests/test_pair_mode/test_pair_mode_trigger.py b/manual_tests/test_pair_mode/test_pair_mode_trigger.py index 369dd18a..ebea40d3 100644 --- a/manual_tests/test_pair_mode/test_pair_mode_trigger.py +++ b/manual_tests/test_pair_mode/test_pair_mode_trigger.py @@ -11,19 +11,19 @@ === TEST CASE 1: Rule SHOULD fire === 1. Edit this file (add a comment below the marker) 2. Do NOT edit test_pair_mode_expected.md -3. Run: echo '{}' | python -m deepwork.hooks.rules_check +3. Run: echo '{}' | deepwork hook deepwork.hooks.rules_check 4. Expected: "Manual Test: Pair Mode" appears in output === TEST CASE 2: Rule should NOT fire (both edited) === 1. Edit this file (add a comment below the marker) 2. ALSO edit test_pair_mode_expected.md -3. Run: echo '{}' | python -m deepwork.hooks.rules_check +3. Run: echo '{}' | deepwork hook deepwork.hooks.rules_check 4. Expected: "Manual Test: Pair Mode" does NOT appear === TEST CASE 3: Rule should NOT fire (expected only) === 1. Do NOT edit this file 2. Edit ONLY test_pair_mode_expected.md -3. Run: echo '{}' | python -m deepwork.hooks.rules_check +3. Run: echo '{}' | deepwork hook deepwork.hooks.rules_check 4. Expected: "Manual Test: Pair Mode" does NOT appear (This verifies the ONE-WAY nature of pair mode) diff --git a/manual_tests/test_set_mode/test_set_mode_source.py b/manual_tests/test_set_mode/test_set_mode_source.py index 6649e424..3edea5f6 100644 --- a/manual_tests/test_set_mode/test_set_mode_source.py +++ b/manual_tests/test_set_mode/test_set_mode_source.py @@ -10,13 +10,13 @@ === TEST CASE 1: Rule SHOULD fire === 1. Edit this file (add a comment below the marker) 2. Do NOT edit test_set_mode_test.py -3. Run: echo '{}' | python -m deepwork.hooks.rules_check +3. Run: echo '{}' | deepwork hook deepwork.hooks.rules_check 4. Expected: "Manual Test: Set Mode" appears in output === TEST CASE 2: Rule should NOT fire === 1. Edit this file (add a comment below the marker) 2. ALSO edit test_set_mode_test.py -3. Run: echo '{}' | python -m deepwork.hooks.rules_check +3. Run: echo '{}' | deepwork hook deepwork.hooks.rules_check 4. Expected: "Manual Test: Set Mode" does NOT appear === RULE LOCATION === diff --git a/manual_tests/test_trigger_safety_mode/test_trigger_safety_mode.py b/manual_tests/test_trigger_safety_mode/test_trigger_safety_mode.py index 68bf59b0..fb661fbc 100644 --- a/manual_tests/test_trigger_safety_mode/test_trigger_safety_mode.py +++ b/manual_tests/test_trigger_safety_mode/test_trigger_safety_mode.py @@ -9,13 +9,13 @@ === TEST CASE 1: Rule SHOULD fire === 1. Edit this file (add a comment below the marker) 2. Do NOT edit test_trigger_safety_mode_doc.md -3. Run: echo '{}' | python -m deepwork.hooks.rules_check +3. Run: echo '{}' | deepwork hook deepwork.hooks.rules_check 4. Expected: "Manual Test: Trigger Safety" appears in output === TEST CASE 2: Rule should NOT fire === 1. Edit this file (add a comment below the marker) 2. ALSO edit test_trigger_safety_mode_doc.md -3. Run: echo '{}' | python -m deepwork.hooks.rules_check +3. Run: echo '{}' | deepwork hook deepwork.hooks.rules_check 4. Expected: "Manual Test: Trigger Safety" does NOT appear === RULE LOCATION ===