|
| 1 | +# Manual Hook/Rule Tests for Claude |
| 2 | + |
| 3 | +This directory contains files designed to manually test different types of deepwork rules/hooks. |
| 4 | +Each test must verify BOTH that the rule fires when it should AND does not fire when it shouldn't. |
| 5 | + |
| 6 | +## How to Run These Tests |
| 7 | + |
| 8 | +**The best way to run these tests is as sub-agents using a fast model (e.g., haiku).** |
| 9 | + |
| 10 | +This approach works because: |
| 11 | +1. Sub-agents run in isolated contexts where changes can be detected |
| 12 | +2. The Stop hook evaluates rules when the sub-agent completes |
| 13 | +3. Using a fast model keeps test iterations quick and cheap |
| 14 | + |
| 15 | +After each sub-agent returns, run the hook to verify: |
| 16 | +```bash |
| 17 | +echo '{}' | python -m deepwork.hooks.rules_check |
| 18 | +``` |
| 19 | + |
| 20 | +Then revert changes before the next test: |
| 21 | +```bash |
| 22 | +git checkout -- manual_tests/ |
| 23 | +``` |
| 24 | + |
| 25 | +## Test Matrix |
| 26 | + |
| 27 | +Each test has two cases: one where the rule SHOULD fire, and one where it should NOT. |
| 28 | + |
| 29 | +| Test | Should Fire | Should NOT Fire | Rule Name | |
| 30 | +|------|-------------|-----------------|-----------| |
| 31 | +| **Trigger/Safety** | Edit `.py` only | Edit `.py` AND `_doc.md` | Manual Test: Trigger Safety | |
| 32 | +| **Set Mode** | Edit `_source.py` only | Edit `_source.py` AND `_test.py` | Manual Test: Set Mode | |
| 33 | +| **Pair Mode** | Edit `_trigger.py` only | Edit `_trigger.py` AND `_expected.md` | Manual Test: Pair Mode | |
| 34 | +| **Pair Mode (reverse)** | — | Edit `_expected.md` only (should NOT fire) | Manual Test: Pair Mode | |
| 35 | +| **Command Action** | Edit `.txt` → log appended | — (always runs) | Manual Test: Command Action | |
| 36 | +| **Multi Safety** | Edit `.py` only | Edit `.py` AND any safety file | Manual Test: Multi Safety | |
| 37 | + |
| 38 | +## Test Results Tracking |
| 39 | + |
| 40 | +| Test Case | Fires When Should | Does NOT Fire When Shouldn't | |
| 41 | +|-----------|:-----------------:|:----------------------------:| |
| 42 | +| Trigger/Safety | ☐ | ☐ | |
| 43 | +| Set Mode | ☐ | ☐ | |
| 44 | +| Pair Mode (forward) | ☐ | ☐ | |
| 45 | +| Pair Mode (reverse - expected only) | — | ☐ | |
| 46 | +| Command Action | ☐ | — | |
| 47 | +| Multi Safety | ☐ | ☐ | |
| 48 | + |
| 49 | +## Test Folders |
| 50 | + |
| 51 | +| Folder | Rule Type | Description | |
| 52 | +|--------|-----------|-------------| |
| 53 | +| `test_trigger_safety_mode/` | Trigger/Safety | Basic conditional: fires unless safety file also edited | |
| 54 | +| `test_set_mode/` | Set (Bidirectional) | Files must change together (either direction) | |
| 55 | +| `test_pair_mode/` | Pair (Directional) | One-way: trigger requires expected, but not vice versa | |
| 56 | +| `test_command_action/` | Command Action | Automatically runs command on file change | |
| 57 | +| `test_multi_safety/` | Multiple Safety | Fires unless ANY of the safety files also edited | |
| 58 | + |
| 59 | +## Corresponding Rules |
| 60 | + |
| 61 | +Rules are defined in `.deepwork/rules/`: |
| 62 | +- `manual-test-trigger-safety.md` |
| 63 | +- `manual-test-set-mode.md` |
| 64 | +- `manual-test-pair-mode.md` |
| 65 | +- `manual-test-command-action.md` |
| 66 | +- `manual-test-multi-safety.md` |
0 commit comments