1- # Cursor hooks (HPCPerfStats)
1+ # Cursor hooks (HPCPerfStats + monitor workspace )
22
33Project hooks for Cursor Agent. Cursor loads ` .cursor/hooks.json ` from the ** workspace root** .
44
5- This workspace opens at the parent folder (contains ` .venv/ ` ). Symlinks at ` <workspace>/.cursor/ ` point here:
5+ ## Symlink setup
6+
7+ ### Monitor-focused workspace (` .cursor/rules ` → ` monitor/cursor-rules/ ` )
8+
9+ From workspace root (contains ` .venv/ ` and ` HPCPerfStats/ ` ):
610
711``` bash
8- # From workspace root (one-time, if symlinks are missing)
9- ln -sf ../HPCPerfStats/.cursor/hooks.json .cursor/hooks.json
10- ln -sf ../HPCPerfStats/.cursor/hooks .cursor/hooks
12+ ln -sf HPCPerfStats/.cursor/hooks.json .cursor/hooks.json
13+ ln -sf HPCPerfStats/.cursor/hooks .cursor/hooks
1114```
1215
16+ ### Full-stack workspace (` .cursor/rules ` → ` hpcperfstats/cursor-rules/ ` )
17+
18+ From workspace root:
19+
20+ ``` bash
21+ ln -sf HPCPerfStats/.cursor/hooks.json .cursor/hooks.json
22+ ln -sf HPCPerfStats/.cursor/hooks .cursor/hooks
23+ ```
24+
25+ Both layouts share the ** same** hook scripts under ` HPCPerfStats/.cursor/hooks/ ` .
26+
27+ ## Profile detection
28+
29+ Hooks auto-detect workspace profile from the ** ` .cursor/rules ` symlink target** :
30+
31+ | Symlink target | Profile | Rules dir label |
32+ | ----------------| ---------| -----------------|
33+ | ` …/monitor/cursor-rules ` | ` monitor ` | ` HPCPerfStats/monitor/cursor-rules ` |
34+ | ` …/hpcperfstats/cursor-rules ` | ` hpcperfstats ` | ` hpcperfstats/cursor-rules ` |
35+
36+ ` hook_task_router.py ` merges ** ` MONITOR_ROUTER_ENTRIES ` ** and ** ` HPCPERFSTATS_ROUTER_ENTRIES ` ** so authorized cross-edits can trigger rules from both trees.
37+
38+ Plan template paths accepted for Read verification:
39+
40+ - ` HPCPerfStats/monitor/docs/plans/PLAN_TEMPLATE.md ` (monitor workspace)
41+ - ` HPCPerfStats/docs/plans/PLAN_TEMPLATE.md ` (full-stack workspace)
42+
1343## Hooks
1444
1545| Event | Script | Behavior |
@@ -22,14 +52,24 @@ ln -sf ../HPCPerfStats/.cursor/hooks .cursor/hooks
2252
23531 . Cursor ** Settings → Hooks** tab should list both hooks after save/reload.
24542 . Hooks output channel shows stdin/stdout when hooks fire.
25- 3 . Manual smoke test:
55+ 3 . Unit tests: ` cd HPCPerfStats && ../.venv/bin/python3 -m pytest hpcperfstats/tests/test_cursor_hooks.py -q `
56+ 4 . Manual smoke test:
2657
2758``` bash
28- echo ' {"status":"completed","loop_count":0,"transcript_path":"/path/to/transcript.jsonl"}' | \
59+ echo ' {"status":"completed","loop_count":0,"transcript_path":"/path/to/transcript.jsonl","workspace_roots":["/path/to/workspace"] }' | \
2960 python3 HPCPerfStats/.cursor/hooks/check-close-gate.py
3061```
3162
3263## Requirements
3364
34- - ` python3 ` on ` PATH ` (macOS default)
65+ - ` python3 ` on ` PATH `
3566- Trusted workspace (project hooks do not run in untrusted workspaces)
67+
68+ ## Dual registration
69+
70+ New domain rules must appear in ** both** :
71+
72+ 1 . Profile ** ` agent-discipline-core.mdc ` ** task router table
73+ 2 . ** ` hook_task_router.py ` ** — ` MONITOR_ROUTER_ENTRIES ` or ` HPCPERFSTATS_ROUTER_ENTRIES `
74+
75+ See monitor ** ` RULES_README.md ` ** or hpcperfstats ** ` RULES_README.md ` ** for always-on caps.
0 commit comments