@alexgreensh/token-optimizer 5.13.67 → 5.13.68

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (31) hide show
  1. package/.claude-plugin/marketplace.json +2 -2
  2. package/.claude-plugin/plugin.json +1 -1
  3. package/package.json +1 -1
  4. package/skills/token-optimizer/scripts/_measure/_vendor/README.md +8 -2
  5. package/skills/token-optimizer/scripts/_measure/_vendor/__init__.py +46 -6
  6. package/skills/token-optimizer/scripts/_measure/_vendor/tomli/__init__.py +34 -3
  7. package/skills/token-optimizer/scripts/_measure/audit.py +5 -21
  8. package/skills/token-optimizer/scripts/_measure/daemon.py +21 -51
  9. package/skills/token-optimizer/scripts/_measure/lifecycle.py +82 -521
  10. package/skills/token-optimizer/scripts/{_measure/_vendor/tomli/_parser.py → _tomli.py} +156 -10
  11. package/skills/token-optimizer/scripts/antigravity_install.py +3 -0
  12. package/skills/token-optimizer/scripts/cloud_kit.py +21 -21
  13. package/skills/token-optimizer/scripts/codex_doctor.py +33 -7
  14. package/skills/token-optimizer/scripts/codex_hook_provenance.py +268 -0
  15. package/skills/token-optimizer/scripts/codex_install.py +33 -69
  16. package/skills/token-optimizer/scripts/command_filters.py +39 -309
  17. package/skills/token-optimizer/scripts/copilot_install.py +5 -0
  18. package/skills/token-optimizer/scripts/cursor_install.py +5 -0
  19. package/skills/token-optimizer/scripts/devin_install.py +6 -12
  20. package/skills/token-optimizer/scripts/devin_source.py +5 -4
  21. package/skills/token-optimizer/scripts/devin_verify.py +16 -0
  22. package/skills/token-optimizer/scripts/grok_install.py +5 -0
  23. package/skills/token-optimizer/scripts/heal_report.py +92 -0
  24. package/skills/token-optimizer/scripts/hook_heal.py +138 -0
  25. package/skills/token-optimizer/scripts/hook_provenance.py +878 -0
  26. package/skills/token-optimizer/scripts/owned_hooks.py +420 -0
  27. package/skills/token-optimizer/scripts/shipped_codex_hook_templates.json +5815 -0
  28. package/skills/token-optimizer/scripts/shipped_hook_templates.py +252 -0
  29. package/skills/token-optimizer/scripts/shipped_starter_hooks.py +55 -0
  30. package/skills/token-optimizer/scripts/_measure/_vendor/tomli/_re.py +0 -112
  31. package/skills/token-optimizer/scripts/_measure/_vendor/tomli/_types.py +0 -10
@@ -0,0 +1,252 @@
1
+ """Every hook command Token Optimizer has shipped in a Claude Code hooks.json.
2
+
3
+ GENERATED by scripts/gen_shipped_hook_templates.py from git history of:
4
+ hooks/hooks.json
5
+ plugins/token-optimizer/hooks/hooks.json
6
+ cowork/token-optimizer/hooks/hooks.json
7
+ Do not edit by hand. Each entry is (event, matcher, hook type, command); the
8
+ command is the exact (JSON-decoded) template with the literal
9
+ ${CLAUDE_PLUGIN_ROOT} placeholder. hook_provenance instantiates it for the
10
+ running install root and compares the whole tuple byte for byte.
11
+ """
12
+
13
+ SHIPPED_HOOK_CONTEXTS = frozenset((
14
+ ('CwdChanged', '', 'command', "test -f '${CLAUDE_PLUGIN_ROOT}/skills/token-optimizer/scripts/read_cache.py' && python3 '${CLAUDE_PLUGIN_ROOT}/skills/token-optimizer/scripts/read_cache.py' --clear --quiet || true"),
15
+ ('CwdChanged', '', 'command', '"${CLAUDE_PLUGIN_ROOT}/hooks/run.py" skills/token-optimizer/scripts/read_cache.py --clear --quiet'),
16
+ ('CwdChanged', '', 'command', 'bash "${CLAUDE_PLUGIN_ROOT}/hooks/python-launcher.sh" "${CLAUDE_PLUGIN_ROOT}/hooks/run.py" skills/token-optimizer/scripts/read_cache.py --clear --quiet'),
17
+ ('CwdChanged', '', 'command', 'for b in bash /bin/bash /usr/bin/bash /usr/local/bin/bash /opt/homebrew/bin/bash; do command -v "$b" >/dev/null 2>&1 && exec "$b" "${CLAUDE_PLUGIN_ROOT}/hooks/python-launcher.sh" "${CLAUDE_PLUGIN_ROOT}/hooks/run.py" skills/token-optimizer/scripts/read_cache.py --clear --quiet; done; exit 0'),
18
+ ('CwdChanged', '', 'command', 'for b in bash /bin/bash /usr/bin/bash /usr/local/bin/bash /opt/homebrew/bin/bash; do command -v "$b" >/dev/null 2>&1 || continue; D="${CLAUDE_PLUGIN_ROOT}"; [ -r "$D/hooks/python-launcher.sh" ] || D="$(ls -d "${D%/*}"/*/ 2>/dev/null | grep -E "/[0-9]+[.][0-9]+[.][0-9]+/$" | sort -V | tail -n1)"; D="${D%/}"; [ -r "$D/hooks/python-launcher.sh" ] || exit 0; exec "$b" "$D/hooks/python-launcher.sh" "$D/hooks/run.py" skills/token-optimizer/scripts/read_cache.py --clear --quiet; done; exit 0'),
19
+ ('CwdChanged', '', 'command', 'for b in bash /bin/bash /usr/bin/bash /usr/local/bin/bash /opt/homebrew/bin/bash; do command -v "$b" >/dev/null 2>&1 || continue; D="${CLAUDE_PLUGIN_ROOT}"; [ -r "$D/hooks/python-launcher.sh" ] || D="$(ls -d "${D%[/\\\\]*}"/*/ 2>/dev/null | grep -E "/[0-9]+[.][0-9]+[.][0-9]+/$" | sort -V | tail -n1)"; D="${D%/}"; [ -r "$D/hooks/python-launcher.sh" ] || exit 0; exec "$b" "$D/hooks/python-launcher.sh" "$D/hooks/run.py" skills/token-optimizer/scripts/read_cache.py --clear --quiet; done; exit 0'),
20
+ ('CwdChanged', '', 'command', 'for b in bash /bin/bash /usr/bin/bash /usr/local/bin/bash /opt/homebrew/bin/bash; do command -v "$b" >/dev/null 2>&1 || continue; D="${CLAUDE_PLUGIN_ROOT}"; case "$D" in *\\\\*) D="$(printf \'%s\' "$D" | tr \'\\\\\' \'/\')";; esac; [ -r "$D/hooks/python-launcher.sh" ] || D="$(ls -d "${D%/*}"/*/ 2>/dev/null | grep -E "/[0-9]+[.][0-9]+[.][0-9]+/$" | sort -V | tail -n1)"; D="${D%/}"; [ -r "$D/hooks/python-launcher.sh" ] || exit 0; exec "$b" "$D/hooks/python-launcher.sh" "$D/hooks/run.py" skills/token-optimizer/scripts/read_cache.py --clear --quiet; done; exit 0'),
21
+ ('CwdChanged', '', 'command', 'for b in bash /bin/bash /usr/bin/bash /usr/local/bin/bash /opt/homebrew/bin/bash; do command -v "$b" >/dev/null 2>&1 || continue; L="${CLAUDE_PLUGIN_ROOT}/hooks/python-launcher.sh"; [ -r "$L" ] || exit 0; exec "$b" "$L" "${CLAUDE_PLUGIN_ROOT}/hooks/run.py" skills/token-optimizer/scripts/read_cache.py --clear --quiet; done; exit 0'),
22
+ ('CwdChanged', '', 'command', 'python3 "${CLAUDE_PLUGIN_ROOT}/hooks/run.py" skills/token-optimizer/scripts/read_cache.py --clear --quiet'),
23
+ ('PostCompact', '', 'command', "python3 '${CLAUDE_PLUGIN_ROOT}/skills/token-optimizer/scripts/measure.py' quality-cache --force --quiet"),
24
+ ('PostCompact', '', 'command', "test -f '${CLAUDE_PLUGIN_ROOT}/skills/token-optimizer/scripts/measure.py' && python3 '${CLAUDE_PLUGIN_ROOT}/skills/token-optimizer/scripts/measure.py' quality-cache --force --quiet || true"),
25
+ ('PostCompact', '', 'command', '"${CLAUDE_PLUGIN_ROOT}/hooks/run.py" skills/token-optimizer/scripts/measure.py quality-cache --force --quiet'),
26
+ ('PostCompact', '', 'command', 'bash "${CLAUDE_PLUGIN_ROOT}/hooks/python-launcher.sh" "${CLAUDE_PLUGIN_ROOT}/hooks/run.py" skills/token-optimizer/scripts/measure.py quality-cache --force --quiet'),
27
+ ('PostCompact', '', 'command', 'for b in bash /bin/bash /usr/bin/bash /usr/local/bin/bash /opt/homebrew/bin/bash; do command -v "$b" >/dev/null 2>&1 && exec "$b" "${CLAUDE_PLUGIN_ROOT}/hooks/python-launcher.sh" "${CLAUDE_PLUGIN_ROOT}/hooks/run.py" skills/token-optimizer/scripts/measure.py quality-cache --force --quiet; done; exit 0'),
28
+ ('PostCompact', '', 'command', 'for b in bash /bin/bash /usr/bin/bash /usr/local/bin/bash /opt/homebrew/bin/bash; do command -v "$b" >/dev/null 2>&1 || continue; D="${CLAUDE_PLUGIN_ROOT}"; [ -r "$D/hooks/python-launcher.sh" ] || D="$(ls -d "${D%/*}"/*/ 2>/dev/null | grep -E "/[0-9]+[.][0-9]+[.][0-9]+/$" | sort -V | tail -n1)"; D="${D%/}"; [ -r "$D/hooks/python-launcher.sh" ] || exit 0; exec "$b" "$D/hooks/python-launcher.sh" "$D/hooks/run.py" skills/token-optimizer/scripts/measure.py quality-cache --force --quiet; done; exit 0'),
29
+ ('PostCompact', '', 'command', 'for b in bash /bin/bash /usr/bin/bash /usr/local/bin/bash /opt/homebrew/bin/bash; do command -v "$b" >/dev/null 2>&1 || continue; D="${CLAUDE_PLUGIN_ROOT}"; [ -r "$D/hooks/python-launcher.sh" ] || D="$(ls -d "${D%[/\\\\]*}"/*/ 2>/dev/null | grep -E "/[0-9]+[.][0-9]+[.][0-9]+/$" | sort -V | tail -n1)"; D="${D%/}"; [ -r "$D/hooks/python-launcher.sh" ] || exit 0; exec "$b" "$D/hooks/python-launcher.sh" "$D/hooks/run.py" skills/token-optimizer/scripts/measure.py quality-cache --force --quiet; done; exit 0'),
30
+ ('PostCompact', '', 'command', 'for b in bash /bin/bash /usr/bin/bash /usr/local/bin/bash /opt/homebrew/bin/bash; do command -v "$b" >/dev/null 2>&1 || continue; D="${CLAUDE_PLUGIN_ROOT}"; case "$D" in *\\\\*) D="$(printf \'%s\' "$D" | tr \'\\\\\' \'/\')";; esac; [ -r "$D/hooks/python-launcher.sh" ] || D="$(ls -d "${D%/*}"/*/ 2>/dev/null | grep -E "/[0-9]+[.][0-9]+[.][0-9]+/$" | sort -V | tail -n1)"; D="${D%/}"; [ -r "$D/hooks/python-launcher.sh" ] || exit 0; exec "$b" "$D/hooks/python-launcher.sh" "$D/hooks/run.py" skills/token-optimizer/scripts/measure.py quality-cache --force --quiet; done; exit 0'),
31
+ ('PostCompact', '', 'command', 'for b in bash /bin/bash /usr/bin/bash /usr/local/bin/bash /opt/homebrew/bin/bash; do command -v "$b" >/dev/null 2>&1 || continue; L="${CLAUDE_PLUGIN_ROOT}/hooks/python-launcher.sh"; [ -r "$L" ] || exit 0; exec "$b" "$L" "${CLAUDE_PLUGIN_ROOT}/hooks/run.py" skills/token-optimizer/scripts/measure.py quality-cache --force --quiet; done; exit 0'),
32
+ ('PostCompact', '', 'command', 'python3 "${CLAUDE_PLUGIN_ROOT}/hooks/run.py" skills/token-optimizer/scripts/measure.py quality-cache --force --quiet'),
33
+ ('PostToolUse', '', 'command', "python3 '${CLAUDE_PLUGIN_ROOT}/skills/token-optimizer/scripts/measure.py' archive-result --quiet"),
34
+ ('PostToolUse', '', 'command', "test -f '${CLAUDE_PLUGIN_ROOT}/skills/token-optimizer/scripts/measure.py' && python3 '${CLAUDE_PLUGIN_ROOT}/skills/token-optimizer/scripts/measure.py' archive-result --quiet || true"),
35
+ ('PostToolUse', 'Bash', 'command', 'for b in bash /bin/bash /usr/bin/bash /usr/local/bin/bash /opt/homebrew/bin/bash; do command -v "$b" >/dev/null 2>&1 || continue; D="${CLAUDE_PLUGIN_ROOT}"; [ -r "$D/hooks/python-launcher.sh" ] || D="$(ls -d "${D%/*}"/*/ 2>/dev/null | grep -E "/[0-9]+[.][0-9]+[.][0-9]+/$" | sort -V | tail -n1)"; D="${D%/}"; [ -r "$D/hooks/python-launcher.sh" ] || exit 0; exec "$b" "$D/hooks/python-launcher.sh" "$D/hooks/run.py" skills/token-optimizer/scripts/bash_compress_hook.py --quiet; done; exit 0'),
36
+ ('PostToolUse', 'Bash', 'command', 'for b in bash /bin/bash /usr/bin/bash /usr/local/bin/bash /opt/homebrew/bin/bash; do command -v "$b" >/dev/null 2>&1 || continue; L="${CLAUDE_PLUGIN_ROOT}/hooks/python-launcher.sh"; [ -r "$L" ] || exit 0; exec "$b" "$L" "${CLAUDE_PLUGIN_ROOT}/hooks/run.py" skills/token-optimizer/scripts/bash_compress_hook.py --quiet; done; exit 0'),
37
+ ('PostToolUse', 'Bash|PowerShell|Read|Glob|Grep|Agent|Edit|Write|MultiEdit|NotebookEdit|mcp__.*', 'command', 'for b in bash /bin/bash /usr/bin/bash /usr/local/bin/bash /opt/homebrew/bin/bash; do command -v "$b" >/dev/null 2>&1 || continue; D="${CLAUDE_PLUGIN_ROOT}"; [ -r "$D/hooks/python-launcher.sh" ] || D="$(ls -d "${D%/*}"/*/ 2>/dev/null | grep -E "/[0-9]+[.][0-9]+[.][0-9]+/$" | sort -V | tail -n1)"; D="${D%/}"; [ -r "$D/hooks/python-launcher.sh" ] || exit 0; exec "$b" "$D/hooks/python-launcher.sh" "$D/hooks/run.py" hooks/posttooluse_runner.py; done; exit 0'),
38
+ ('PostToolUse', 'Bash|PowerShell|Read|Glob|Grep|Agent|Edit|Write|MultiEdit|NotebookEdit|mcp__.*', 'command', 'for b in bash /bin/bash /usr/bin/bash /usr/local/bin/bash /opt/homebrew/bin/bash; do command -v "$b" >/dev/null 2>&1 || continue; D="${CLAUDE_PLUGIN_ROOT}"; [ -r "$D/hooks/python-launcher.sh" ] || D="$(ls -d "${D%[/\\\\]*}"/*/ 2>/dev/null | grep -E "/[0-9]+[.][0-9]+[.][0-9]+/$" | sort -V | tail -n1)"; D="${D%/}"; [ -r "$D/hooks/python-launcher.sh" ] || exit 0; exec "$b" "$D/hooks/python-launcher.sh" "$D/hooks/run.py" hooks/posttooluse_runner.py; done; exit 0'),
39
+ ('PostToolUse', 'Bash|PowerShell|Read|Glob|Grep|Agent|Edit|Write|MultiEdit|NotebookEdit|mcp__.*', 'command', 'for b in bash /bin/bash /usr/bin/bash /usr/local/bin/bash /opt/homebrew/bin/bash; do command -v "$b" >/dev/null 2>&1 || continue; D="${CLAUDE_PLUGIN_ROOT}"; case "$D" in *\\\\*) D="$(printf \'%s\' "$D" | tr \'\\\\\' \'/\')";; esac; [ -r "$D/hooks/python-launcher.sh" ] || D="$(ls -d "${D%/*}"/*/ 2>/dev/null | grep -E "/[0-9]+[.][0-9]+[.][0-9]+/$" | sort -V | tail -n1)"; D="${D%/}"; [ -r "$D/hooks/python-launcher.sh" ] || exit 0; exec "$b" "$D/hooks/python-launcher.sh" "$D/hooks/run.py" hooks/posttooluse_runner.py; done; exit 0'),
40
+ ('PostToolUse', 'Bash|PowerShell|Read|Glob|Grep|Agent|Edit|Write|MultiEdit|NotebookEdit|mcp__.*', 'command', 'for b in bash /bin/bash /usr/bin/bash /usr/local/bin/bash /opt/homebrew/bin/bash; do command -v "$b" >/dev/null 2>&1 || continue; L="${CLAUDE_PLUGIN_ROOT}/hooks/python-launcher.sh"; [ -r "$L" ] || exit 0; exec "$b" "$L" "${CLAUDE_PLUGIN_ROOT}/hooks/run.py" hooks/posttooluse_runner.py; done; exit 0'),
41
+ ('PostToolUse', 'Bash|Read|Glob|Grep|Agent', 'command', 'for b in bash /bin/bash /usr/bin/bash /usr/local/bin/bash /opt/homebrew/bin/bash; do command -v "$b" >/dev/null 2>&1 && exec "$b" "${CLAUDE_PLUGIN_ROOT}/hooks/python-launcher.sh" "${CLAUDE_PLUGIN_ROOT}/hooks/run.py" skills/token-optimizer/scripts/archive_result.py --quiet; done; exit 0'),
42
+ ('PostToolUse', 'Bash|Read|Glob|Grep|Agent', 'command', 'for b in bash /bin/bash /usr/bin/bash /usr/local/bin/bash /opt/homebrew/bin/bash; do command -v "$b" >/dev/null 2>&1 || continue; D="${CLAUDE_PLUGIN_ROOT}"; [ -r "$D/hooks/python-launcher.sh" ] || D="$(ls -d "${D%/*}"/*/ 2>/dev/null | grep -E "/[0-9]+[.][0-9]+[.][0-9]+/$" | sort -V | tail -n1)"; D="${D%/}"; [ -r "$D/hooks/python-launcher.sh" ] || exit 0; exec "$b" "$D/hooks/python-launcher.sh" "$D/hooks/run.py" skills/token-optimizer/scripts/archive_result.py --quiet; done; exit 0'),
43
+ ('PostToolUse', 'Bash|Read|Glob|Grep|Agent', 'command', 'for b in bash /bin/bash /usr/bin/bash /usr/local/bin/bash /opt/homebrew/bin/bash; do command -v "$b" >/dev/null 2>&1 || continue; L="${CLAUDE_PLUGIN_ROOT}/hooks/python-launcher.sh"; [ -r "$L" ] || exit 0; exec "$b" "$L" "${CLAUDE_PLUGIN_ROOT}/hooks/run.py" skills/token-optimizer/scripts/archive_result.py --quiet; done; exit 0'),
44
+ ('PostToolUse', 'Bash|Read|Glob|Grep|Agent|Edit|Write|MultiEdit|NotebookEdit|mcp__.*', 'command', 'bash "${CLAUDE_PLUGIN_ROOT}/hooks/python-launcher.sh" "${CLAUDE_PLUGIN_ROOT}/hooks/run.py" skills/token-optimizer/scripts/measure.py quality-cache --quiet --throttle-only'),
45
+ ('PostToolUse', 'Bash|Read|Glob|Grep|Agent|Edit|Write|MultiEdit|NotebookEdit|mcp__.*', 'command', 'for b in bash /bin/bash /usr/bin/bash /usr/local/bin/bash /opt/homebrew/bin/bash; do command -v "$b" >/dev/null 2>&1 && exec "$b" "${CLAUDE_PLUGIN_ROOT}/hooks/python-launcher.sh" "${CLAUDE_PLUGIN_ROOT}/hooks/run.py" skills/token-optimizer/scripts/measure.py quality-cache --quiet --throttle-only; done; exit 0'),
46
+ ('PostToolUse', 'Bash|Read|Glob|Grep|Agent|Edit|Write|MultiEdit|NotebookEdit|mcp__.*', 'command', 'for b in bash /bin/bash /usr/bin/bash /usr/local/bin/bash /opt/homebrew/bin/bash; do command -v "$b" >/dev/null 2>&1 || continue; D="${CLAUDE_PLUGIN_ROOT}"; [ -r "$D/hooks/python-launcher.sh" ] || D="$(ls -d "${D%/*}"/*/ 2>/dev/null | grep -E "/[0-9]+[.][0-9]+[.][0-9]+/$" | sort -V | tail -n1)"; D="${D%/}"; [ -r "$D/hooks/python-launcher.sh" ] || exit 0; exec "$b" "$D/hooks/python-launcher.sh" "$D/hooks/run.py" hooks/posttooluse_runner.py; done; exit 0'),
47
+ ('PostToolUse', 'Bash|Read|Glob|Grep|Agent|Edit|Write|MultiEdit|NotebookEdit|mcp__.*', 'command', 'for b in bash /bin/bash /usr/bin/bash /usr/local/bin/bash /opt/homebrew/bin/bash; do command -v "$b" >/dev/null 2>&1 || continue; D="${CLAUDE_PLUGIN_ROOT}"; [ -r "$D/hooks/python-launcher.sh" ] || D="$(ls -d "${D%/*}"/*/ 2>/dev/null | grep -E "/[0-9]+[.][0-9]+[.][0-9]+/$" | sort -V | tail -n1)"; D="${D%/}"; [ -r "$D/hooks/python-launcher.sh" ] || exit 0; exec "$b" "$D/hooks/python-launcher.sh" "$D/hooks/run.py" skills/token-optimizer/scripts/measure.py quality-cache --quiet --throttle-only; done; exit 0'),
48
+ ('PostToolUse', 'Bash|Read|Glob|Grep|Agent|Edit|Write|MultiEdit|NotebookEdit|mcp__.*', 'command', 'for b in bash /bin/bash /usr/bin/bash /usr/local/bin/bash /opt/homebrew/bin/bash; do command -v "$b" >/dev/null 2>&1 || continue; L="${CLAUDE_PLUGIN_ROOT}/hooks/python-launcher.sh"; [ -r "$L" ] || exit 0; exec "$b" "$L" "${CLAUDE_PLUGIN_ROOT}/hooks/run.py" hooks/posttooluse_runner.py; done; exit 0'),
49
+ ('PostToolUse', 'Bash|Read|Glob|Grep|Agent|Edit|Write|MultiEdit|NotebookEdit|mcp__.*', 'command', 'for b in bash /bin/bash /usr/bin/bash /usr/local/bin/bash /opt/homebrew/bin/bash; do command -v "$b" >/dev/null 2>&1 || continue; L="${CLAUDE_PLUGIN_ROOT}/hooks/python-launcher.sh"; [ -r "$L" ] || exit 0; exec "$b" "$L" "${CLAUDE_PLUGIN_ROOT}/hooks/run.py" skills/token-optimizer/scripts/measure.py quality-cache --quiet --throttle-only; done; exit 0'),
50
+ ('PostToolUse', 'Bash|Read|Glob|Grep|Agent|mcp__.*', 'command', "test -f '${CLAUDE_PLUGIN_ROOT}/skills/token-optimizer/scripts/archive_result.py' && python3 '${CLAUDE_PLUGIN_ROOT}/skills/token-optimizer/scripts/archive_result.py' --quiet || true"),
51
+ ('PostToolUse', 'Bash|Read|Glob|Grep|Agent|mcp__.*', 'command', "test -f '${CLAUDE_PLUGIN_ROOT}/skills/token-optimizer/scripts/measure.py' && python3 '${CLAUDE_PLUGIN_ROOT}/skills/token-optimizer/scripts/measure.py' archive-result --quiet || true"),
52
+ ('PostToolUse', 'Bash|Read|Glob|Grep|Agent|mcp__.*', 'command', '"${CLAUDE_PLUGIN_ROOT}/hooks/run.py" skills/token-optimizer/scripts/archive_result.py --quiet'),
53
+ ('PostToolUse', 'Bash|Read|Glob|Grep|Agent|mcp__.*', 'command', 'bash "${CLAUDE_PLUGIN_ROOT}/hooks/python-launcher.sh" "${CLAUDE_PLUGIN_ROOT}/hooks/run.py" skills/token-optimizer/scripts/archive_result.py --quiet'),
54
+ ('PostToolUse', 'Bash|Read|Glob|Grep|Agent|mcp__.*', 'command', 'for b in bash /bin/bash /usr/bin/bash /usr/local/bin/bash /opt/homebrew/bin/bash; do command -v "$b" >/dev/null 2>&1 && exec "$b" "${CLAUDE_PLUGIN_ROOT}/hooks/python-launcher.sh" "${CLAUDE_PLUGIN_ROOT}/hooks/run.py" skills/token-optimizer/scripts/archive_result.py --quiet; done; exit 0'),
55
+ ('PostToolUse', 'Bash|Read|Glob|Grep|Agent|mcp__.*', 'command', 'python3 "${CLAUDE_PLUGIN_ROOT}/hooks/run.py" skills/token-optimizer/scripts/archive_result.py --quiet'),
56
+ ('PostToolUse', 'Bash|Read|Grep|Glob|mcp__.*', 'command', 'bash "${CLAUDE_PLUGIN_ROOT}/hooks/python-launcher.sh" "${CLAUDE_PLUGIN_ROOT}/hooks/run.py" skills/token-optimizer/scripts/context_intel.py --quiet'),
57
+ ('PostToolUse', 'Bash|Read|Grep|Glob|mcp__.*', 'command', 'for b in bash /bin/bash /usr/bin/bash /usr/local/bin/bash /opt/homebrew/bin/bash; do command -v "$b" >/dev/null 2>&1 && exec "$b" "${CLAUDE_PLUGIN_ROOT}/hooks/python-launcher.sh" "${CLAUDE_PLUGIN_ROOT}/hooks/run.py" skills/token-optimizer/scripts/context_intel.py --quiet; done; exit 0'),
58
+ ('PostToolUse', 'Bash|Read|Grep|Glob|mcp__.*', 'command', 'for b in bash /bin/bash /usr/bin/bash /usr/local/bin/bash /opt/homebrew/bin/bash; do command -v "$b" >/dev/null 2>&1 || continue; D="${CLAUDE_PLUGIN_ROOT}"; [ -r "$D/hooks/python-launcher.sh" ] || D="$(ls -d "${D%/*}"/*/ 2>/dev/null | grep -E "/[0-9]+[.][0-9]+[.][0-9]+/$" | sort -V | tail -n1)"; D="${D%/}"; [ -r "$D/hooks/python-launcher.sh" ] || exit 0; exec "$b" "$D/hooks/python-launcher.sh" "$D/hooks/run.py" skills/token-optimizer/scripts/context_intel.py --quiet; done; exit 0'),
59
+ ('PostToolUse', 'Bash|Read|Grep|Glob|mcp__.*', 'command', 'for b in bash /bin/bash /usr/bin/bash /usr/local/bin/bash /opt/homebrew/bin/bash; do command -v "$b" >/dev/null 2>&1 || continue; L="${CLAUDE_PLUGIN_ROOT}/hooks/python-launcher.sh"; [ -r "$L" ] || exit 0; exec "$b" "$L" "${CLAUDE_PLUGIN_ROOT}/hooks/run.py" skills/token-optimizer/scripts/context_intel.py --quiet; done; exit 0'),
60
+ ('PostToolUse', 'Edit|Write|MultiEdit|NotebookEdit', 'command', "test -f '${CLAUDE_PLUGIN_ROOT}/skills/token-optimizer/scripts/read_cache.py' && python3 '${CLAUDE_PLUGIN_ROOT}/skills/token-optimizer/scripts/read_cache.py' --invalidate --quiet || true"),
61
+ ('PostToolUse', 'Edit|Write|MultiEdit|NotebookEdit', 'command', '"${CLAUDE_PLUGIN_ROOT}/hooks/run.py" skills/token-optimizer/scripts/read_cache.py --invalidate --quiet'),
62
+ ('PostToolUse', 'Edit|Write|MultiEdit|NotebookEdit', 'command', 'bash "${CLAUDE_PLUGIN_ROOT}/hooks/python-launcher.sh" "${CLAUDE_PLUGIN_ROOT}/hooks/run.py" skills/token-optimizer/scripts/read_cache.py --invalidate --quiet'),
63
+ ('PostToolUse', 'Edit|Write|MultiEdit|NotebookEdit', 'command', 'for b in bash /bin/bash /usr/bin/bash /usr/local/bin/bash /opt/homebrew/bin/bash; do command -v "$b" >/dev/null 2>&1 && exec "$b" "${CLAUDE_PLUGIN_ROOT}/hooks/python-launcher.sh" "${CLAUDE_PLUGIN_ROOT}/hooks/run.py" skills/token-optimizer/scripts/read_cache.py --invalidate --quiet; done; exit 0'),
64
+ ('PostToolUse', 'Edit|Write|MultiEdit|NotebookEdit', 'command', 'for b in bash /bin/bash /usr/bin/bash /usr/local/bin/bash /opt/homebrew/bin/bash; do command -v "$b" >/dev/null 2>&1 || continue; D="${CLAUDE_PLUGIN_ROOT}"; [ -r "$D/hooks/python-launcher.sh" ] || D="$(ls -d "${D%/*}"/*/ 2>/dev/null | grep -E "/[0-9]+[.][0-9]+[.][0-9]+/$" | sort -V | tail -n1)"; D="${D%/}"; [ -r "$D/hooks/python-launcher.sh" ] || exit 0; exec "$b" "$D/hooks/python-launcher.sh" "$D/hooks/run.py" skills/token-optimizer/scripts/read_cache.py --invalidate --quiet; done; exit 0'),
65
+ ('PostToolUse', 'Edit|Write|MultiEdit|NotebookEdit', 'command', 'for b in bash /bin/bash /usr/bin/bash /usr/local/bin/bash /opt/homebrew/bin/bash; do command -v "$b" >/dev/null 2>&1 || continue; L="${CLAUDE_PLUGIN_ROOT}/hooks/python-launcher.sh"; [ -r "$L" ] || exit 0; exec "$b" "$L" "${CLAUDE_PLUGIN_ROOT}/hooks/run.py" skills/token-optimizer/scripts/read_cache.py --invalidate --quiet; done; exit 0'),
66
+ ('PostToolUse', 'Edit|Write|MultiEdit|NotebookEdit', 'command', 'python3 "${CLAUDE_PLUGIN_ROOT}/hooks/run.py" skills/token-optimizer/scripts/read_cache.py --invalidate --quiet'),
67
+ ('PostToolUse', 'mcp__.*', 'command', 'for b in bash /bin/bash /usr/bin/bash /usr/local/bin/bash /opt/homebrew/bin/bash; do command -v "$b" >/dev/null 2>&1 && exec "$b" "${CLAUDE_PLUGIN_ROOT}/hooks/python-launcher.sh" "${CLAUDE_PLUGIN_ROOT}/hooks/run.py" skills/token-optimizer/scripts/archive_result.py --quiet; done; exit 0'),
68
+ ('PostToolUse', 'mcp__.*', 'command', 'for b in bash /bin/bash /usr/bin/bash /usr/local/bin/bash /opt/homebrew/bin/bash; do command -v "$b" >/dev/null 2>&1 || continue; D="${CLAUDE_PLUGIN_ROOT}"; [ -r "$D/hooks/python-launcher.sh" ] || D="$(ls -d "${D%/*}"/*/ 2>/dev/null | grep -E "/[0-9]+[.][0-9]+[.][0-9]+/$" | sort -V | tail -n1)"; D="${D%/}"; [ -r "$D/hooks/python-launcher.sh" ] || exit 0; exec "$b" "$D/hooks/python-launcher.sh" "$D/hooks/run.py" skills/token-optimizer/scripts/archive_result.py --quiet; done; exit 0'),
69
+ ('PostToolUse', 'mcp__.*', 'command', 'for b in bash /bin/bash /usr/bin/bash /usr/local/bin/bash /opt/homebrew/bin/bash; do command -v "$b" >/dev/null 2>&1 || continue; L="${CLAUDE_PLUGIN_ROOT}/hooks/python-launcher.sh"; [ -r "$L" ] || exit 0; exec "$b" "$L" "${CLAUDE_PLUGIN_ROOT}/hooks/run.py" skills/token-optimizer/scripts/archive_result.py --quiet; done; exit 0'),
70
+ ('PostToolUseFailure', 'Bash', 'command', 'for b in bash /bin/bash /usr/bin/bash /usr/local/bin/bash /opt/homebrew/bin/bash; do command -v "$b" >/dev/null 2>&1 || continue; D="${CLAUDE_PLUGIN_ROOT}"; [ -r "$D/hooks/python-launcher.sh" ] || D="$(ls -d "${D%/*}"/*/ 2>/dev/null | grep -E "/[0-9]+[.][0-9]+[.][0-9]+/$" | sort -V | tail -n1)"; D="${D%/}"; [ -r "$D/hooks/python-launcher.sh" ] || exit 0; exec "$b" "$D/hooks/python-launcher.sh" "$D/hooks/run.py" hooks/posttooluse_runner.py; done; exit 0'),
71
+ ('PostToolUseFailure', 'Bash', 'command', 'for b in bash /bin/bash /usr/bin/bash /usr/local/bin/bash /opt/homebrew/bin/bash; do command -v "$b" >/dev/null 2>&1 || continue; L="${CLAUDE_PLUGIN_ROOT}/hooks/python-launcher.sh"; [ -r "$L" ] || exit 0; exec "$b" "$L" "${CLAUDE_PLUGIN_ROOT}/hooks/run.py" hooks/posttooluse_runner.py; done; exit 0'),
72
+ ('PostToolUseFailure', 'Bash|PowerShell', 'command', 'for b in bash /bin/bash /usr/bin/bash /usr/local/bin/bash /opt/homebrew/bin/bash; do command -v "$b" >/dev/null 2>&1 || continue; D="${CLAUDE_PLUGIN_ROOT}"; [ -r "$D/hooks/python-launcher.sh" ] || D="$(ls -d "${D%/*}"/*/ 2>/dev/null | grep -E "/[0-9]+[.][0-9]+[.][0-9]+/$" | sort -V | tail -n1)"; D="${D%/}"; [ -r "$D/hooks/python-launcher.sh" ] || exit 0; exec "$b" "$D/hooks/python-launcher.sh" "$D/hooks/run.py" hooks/posttooluse_runner.py; done; exit 0'),
73
+ ('PostToolUseFailure', 'Bash|PowerShell', 'command', 'for b in bash /bin/bash /usr/bin/bash /usr/local/bin/bash /opt/homebrew/bin/bash; do command -v "$b" >/dev/null 2>&1 || continue; D="${CLAUDE_PLUGIN_ROOT}"; [ -r "$D/hooks/python-launcher.sh" ] || D="$(ls -d "${D%[/\\\\]*}"/*/ 2>/dev/null | grep -E "/[0-9]+[.][0-9]+[.][0-9]+/$" | sort -V | tail -n1)"; D="${D%/}"; [ -r "$D/hooks/python-launcher.sh" ] || exit 0; exec "$b" "$D/hooks/python-launcher.sh" "$D/hooks/run.py" hooks/posttooluse_runner.py; done; exit 0'),
74
+ ('PostToolUseFailure', 'Bash|PowerShell', 'command', 'for b in bash /bin/bash /usr/bin/bash /usr/local/bin/bash /opt/homebrew/bin/bash; do command -v "$b" >/dev/null 2>&1 || continue; D="${CLAUDE_PLUGIN_ROOT}"; case "$D" in *\\\\*) D="$(printf \'%s\' "$D" | tr \'\\\\\' \'/\')";; esac; [ -r "$D/hooks/python-launcher.sh" ] || D="$(ls -d "${D%/*}"/*/ 2>/dev/null | grep -E "/[0-9]+[.][0-9]+[.][0-9]+/$" | sort -V | tail -n1)"; D="${D%/}"; [ -r "$D/hooks/python-launcher.sh" ] || exit 0; exec "$b" "$D/hooks/python-launcher.sh" "$D/hooks/run.py" hooks/posttooluse_runner.py; done; exit 0'),
75
+ ('PostToolUseFailure', 'Bash|PowerShell', 'command', 'for b in bash /bin/bash /usr/bin/bash /usr/local/bin/bash /opt/homebrew/bin/bash; do command -v "$b" >/dev/null 2>&1 || continue; L="${CLAUDE_PLUGIN_ROOT}/hooks/python-launcher.sh"; [ -r "$L" ] || exit 0; exec "$b" "$L" "${CLAUDE_PLUGIN_ROOT}/hooks/run.py" hooks/posttooluse_runner.py; done; exit 0'),
76
+ ('PreCompact', '', 'command', "echo 'COMPACTION GUIDANCE: Preserve code changes, key decisions, and file paths. Discard intermediate attempts, explanations, and verbose tool output.'"),
77
+ ('PreCompact', '', 'command', "python3 '${CLAUDE_PLUGIN_ROOT}/skills/token-optimizer/scripts/measure.py' compact-capture --trigger auto --quiet"),
78
+ ('PreCompact', '', 'command', "test -f '${CLAUDE_PLUGIN_ROOT}/skills/token-optimizer/scripts/measure.py' && python3 '${CLAUDE_PLUGIN_ROOT}/skills/token-optimizer/scripts/measure.py' compact-capture --trigger auto --quiet || true"),
79
+ ('PreCompact', '', 'command', "test -f '${CLAUDE_PLUGIN_ROOT}/skills/token-optimizer/scripts/read_cache.py' && python3 '${CLAUDE_PLUGIN_ROOT}/skills/token-optimizer/scripts/read_cache.py' --clear --quiet || true"),
80
+ ('PreCompact', '', 'command', '"${CLAUDE_PLUGIN_ROOT}/hooks/run.py" skills/token-optimizer/scripts/measure.py compact-capture --trigger auto --quiet'),
81
+ ('PreCompact', '', 'command', '"${CLAUDE_PLUGIN_ROOT}/hooks/run.py" skills/token-optimizer/scripts/read_cache.py --clear --quiet'),
82
+ ('PreCompact', '', 'command', 'bash "${CLAUDE_PLUGIN_ROOT}/hooks/python-launcher.sh" "${CLAUDE_PLUGIN_ROOT}/hooks/run.py" skills/token-optimizer/scripts/measure.py compact-capture --trigger auto --quiet'),
83
+ ('PreCompact', '', 'command', 'bash "${CLAUDE_PLUGIN_ROOT}/hooks/python-launcher.sh" "${CLAUDE_PLUGIN_ROOT}/hooks/run.py" skills/token-optimizer/scripts/measure.py dynamic-compact-instructions --quiet'),
84
+ ('PreCompact', '', 'command', 'bash "${CLAUDE_PLUGIN_ROOT}/hooks/python-launcher.sh" "${CLAUDE_PLUGIN_ROOT}/hooks/run.py" skills/token-optimizer/scripts/read_cache.py --clear --quiet'),
85
+ ('PreCompact', '', 'command', 'echo COMPACTION GUIDANCE: Preserve code changes, key decisions, and file paths. Discard intermediate attempts, explanations, and verbose tool output.'),
86
+ ('PreCompact', '', 'command', 'for b in bash /bin/bash /usr/bin/bash /usr/local/bin/bash /opt/homebrew/bin/bash; do command -v "$b" >/dev/null 2>&1 && exec "$b" "${CLAUDE_PLUGIN_ROOT}/hooks/python-launcher.sh" "${CLAUDE_PLUGIN_ROOT}/hooks/run.py" skills/token-optimizer/scripts/measure.py compact-capture --trigger auto --quiet; done; exit 0'),
87
+ ('PreCompact', '', 'command', 'for b in bash /bin/bash /usr/bin/bash /usr/local/bin/bash /opt/homebrew/bin/bash; do command -v "$b" >/dev/null 2>&1 && exec "$b" "${CLAUDE_PLUGIN_ROOT}/hooks/python-launcher.sh" "${CLAUDE_PLUGIN_ROOT}/hooks/run.py" skills/token-optimizer/scripts/measure.py dynamic-compact-instructions --quiet; done; exit 0'),
88
+ ('PreCompact', '', 'command', 'for b in bash /bin/bash /usr/bin/bash /usr/local/bin/bash /opt/homebrew/bin/bash; do command -v "$b" >/dev/null 2>&1 && exec "$b" "${CLAUDE_PLUGIN_ROOT}/hooks/python-launcher.sh" "${CLAUDE_PLUGIN_ROOT}/hooks/run.py" skills/token-optimizer/scripts/read_cache.py --clear --quiet; done; exit 0'),
89
+ ('PreCompact', '', 'command', 'for b in bash /bin/bash /usr/bin/bash /usr/local/bin/bash /opt/homebrew/bin/bash; do command -v "$b" >/dev/null 2>&1 || continue; D="${CLAUDE_PLUGIN_ROOT}"; [ -r "$D/hooks/python-launcher.sh" ] || D="$(ls -d "${D%/*}"/*/ 2>/dev/null | grep -E "/[0-9]+[.][0-9]+[.][0-9]+/$" | sort -V | tail -n1)"; D="${D%/}"; [ -r "$D/hooks/python-launcher.sh" ] || exit 0; exec "$b" "$D/hooks/python-launcher.sh" "$D/hooks/run.py" skills/token-optimizer/scripts/measure.py compact-capture --trigger auto --quiet; done; exit 0'),
90
+ ('PreCompact', '', 'command', 'for b in bash /bin/bash /usr/bin/bash /usr/local/bin/bash /opt/homebrew/bin/bash; do command -v "$b" >/dev/null 2>&1 || continue; D="${CLAUDE_PLUGIN_ROOT}"; [ -r "$D/hooks/python-launcher.sh" ] || D="$(ls -d "${D%/*}"/*/ 2>/dev/null | grep -E "/[0-9]+[.][0-9]+[.][0-9]+/$" | sort -V | tail -n1)"; D="${D%/}"; [ -r "$D/hooks/python-launcher.sh" ] || exit 0; exec "$b" "$D/hooks/python-launcher.sh" "$D/hooks/run.py" skills/token-optimizer/scripts/measure.py dynamic-compact-instructions --quiet; done; exit 0'),
91
+ ('PreCompact', '', 'command', 'for b in bash /bin/bash /usr/bin/bash /usr/local/bin/bash /opt/homebrew/bin/bash; do command -v "$b" >/dev/null 2>&1 || continue; D="${CLAUDE_PLUGIN_ROOT}"; [ -r "$D/hooks/python-launcher.sh" ] || D="$(ls -d "${D%/*}"/*/ 2>/dev/null | grep -E "/[0-9]+[.][0-9]+[.][0-9]+/$" | sort -V | tail -n1)"; D="${D%/}"; [ -r "$D/hooks/python-launcher.sh" ] || exit 0; exec "$b" "$D/hooks/python-launcher.sh" "$D/hooks/run.py" skills/token-optimizer/scripts/read_cache.py --clear --quiet; done; exit 0'),
92
+ ('PreCompact', '', 'command', 'for b in bash /bin/bash /usr/bin/bash /usr/local/bin/bash /opt/homebrew/bin/bash; do command -v "$b" >/dev/null 2>&1 || continue; D="${CLAUDE_PLUGIN_ROOT}"; [ -r "$D/hooks/python-launcher.sh" ] || D="$(ls -d "${D%[/\\\\]*}"/*/ 2>/dev/null | grep -E "/[0-9]+[.][0-9]+[.][0-9]+/$" | sort -V | tail -n1)"; D="${D%/}"; [ -r "$D/hooks/python-launcher.sh" ] || exit 0; exec "$b" "$D/hooks/python-launcher.sh" "$D/hooks/run.py" skills/token-optimizer/scripts/measure.py compact-capture --trigger auto --quiet; done; exit 0'),
93
+ ('PreCompact', '', 'command', 'for b in bash /bin/bash /usr/bin/bash /usr/local/bin/bash /opt/homebrew/bin/bash; do command -v "$b" >/dev/null 2>&1 || continue; D="${CLAUDE_PLUGIN_ROOT}"; [ -r "$D/hooks/python-launcher.sh" ] || D="$(ls -d "${D%[/\\\\]*}"/*/ 2>/dev/null | grep -E "/[0-9]+[.][0-9]+[.][0-9]+/$" | sort -V | tail -n1)"; D="${D%/}"; [ -r "$D/hooks/python-launcher.sh" ] || exit 0; exec "$b" "$D/hooks/python-launcher.sh" "$D/hooks/run.py" skills/token-optimizer/scripts/measure.py dynamic-compact-instructions --quiet; done; exit 0'),
94
+ ('PreCompact', '', 'command', 'for b in bash /bin/bash /usr/bin/bash /usr/local/bin/bash /opt/homebrew/bin/bash; do command -v "$b" >/dev/null 2>&1 || continue; D="${CLAUDE_PLUGIN_ROOT}"; [ -r "$D/hooks/python-launcher.sh" ] || D="$(ls -d "${D%[/\\\\]*}"/*/ 2>/dev/null | grep -E "/[0-9]+[.][0-9]+[.][0-9]+/$" | sort -V | tail -n1)"; D="${D%/}"; [ -r "$D/hooks/python-launcher.sh" ] || exit 0; exec "$b" "$D/hooks/python-launcher.sh" "$D/hooks/run.py" skills/token-optimizer/scripts/read_cache.py --clear --quiet; done; exit 0'),
95
+ ('PreCompact', '', 'command', 'for b in bash /bin/bash /usr/bin/bash /usr/local/bin/bash /opt/homebrew/bin/bash; do command -v "$b" >/dev/null 2>&1 || continue; D="${CLAUDE_PLUGIN_ROOT}"; case "$D" in *\\\\*) D="$(printf \'%s\' "$D" | tr \'\\\\\' \'/\')";; esac; [ -r "$D/hooks/python-launcher.sh" ] || D="$(ls -d "${D%/*}"/*/ 2>/dev/null | grep -E "/[0-9]+[.][0-9]+[.][0-9]+/$" | sort -V | tail -n1)"; D="${D%/}"; [ -r "$D/hooks/python-launcher.sh" ] || exit 0; exec "$b" "$D/hooks/python-launcher.sh" "$D/hooks/run.py" skills/token-optimizer/scripts/measure.py compact-capture --trigger auto --quiet; done; exit 0'),
96
+ ('PreCompact', '', 'command', 'for b in bash /bin/bash /usr/bin/bash /usr/local/bin/bash /opt/homebrew/bin/bash; do command -v "$b" >/dev/null 2>&1 || continue; D="${CLAUDE_PLUGIN_ROOT}"; case "$D" in *\\\\*) D="$(printf \'%s\' "$D" | tr \'\\\\\' \'/\')";; esac; [ -r "$D/hooks/python-launcher.sh" ] || D="$(ls -d "${D%/*}"/*/ 2>/dev/null | grep -E "/[0-9]+[.][0-9]+[.][0-9]+/$" | sort -V | tail -n1)"; D="${D%/}"; [ -r "$D/hooks/python-launcher.sh" ] || exit 0; exec "$b" "$D/hooks/python-launcher.sh" "$D/hooks/run.py" skills/token-optimizer/scripts/measure.py dynamic-compact-instructions --quiet; done; exit 0'),
97
+ ('PreCompact', '', 'command', 'for b in bash /bin/bash /usr/bin/bash /usr/local/bin/bash /opt/homebrew/bin/bash; do command -v "$b" >/dev/null 2>&1 || continue; D="${CLAUDE_PLUGIN_ROOT}"; case "$D" in *\\\\*) D="$(printf \'%s\' "$D" | tr \'\\\\\' \'/\')";; esac; [ -r "$D/hooks/python-launcher.sh" ] || D="$(ls -d "${D%/*}"/*/ 2>/dev/null | grep -E "/[0-9]+[.][0-9]+[.][0-9]+/$" | sort -V | tail -n1)"; D="${D%/}"; [ -r "$D/hooks/python-launcher.sh" ] || exit 0; exec "$b" "$D/hooks/python-launcher.sh" "$D/hooks/run.py" skills/token-optimizer/scripts/read_cache.py --clear --quiet; done; exit 0'),
98
+ ('PreCompact', '', 'command', 'for b in bash /bin/bash /usr/bin/bash /usr/local/bin/bash /opt/homebrew/bin/bash; do command -v "$b" >/dev/null 2>&1 || continue; L="${CLAUDE_PLUGIN_ROOT}/hooks/python-launcher.sh"; [ -r "$L" ] || exit 0; exec "$b" "$L" "${CLAUDE_PLUGIN_ROOT}/hooks/run.py" skills/token-optimizer/scripts/measure.py compact-capture --trigger auto --quiet; done; exit 0'),
99
+ ('PreCompact', '', 'command', 'for b in bash /bin/bash /usr/bin/bash /usr/local/bin/bash /opt/homebrew/bin/bash; do command -v "$b" >/dev/null 2>&1 || continue; L="${CLAUDE_PLUGIN_ROOT}/hooks/python-launcher.sh"; [ -r "$L" ] || exit 0; exec "$b" "$L" "${CLAUDE_PLUGIN_ROOT}/hooks/run.py" skills/token-optimizer/scripts/measure.py dynamic-compact-instructions --quiet; done; exit 0'),
100
+ ('PreCompact', '', 'command', 'for b in bash /bin/bash /usr/bin/bash /usr/local/bin/bash /opt/homebrew/bin/bash; do command -v "$b" >/dev/null 2>&1 || continue; L="${CLAUDE_PLUGIN_ROOT}/hooks/python-launcher.sh"; [ -r "$L" ] || exit 0; exec "$b" "$L" "${CLAUDE_PLUGIN_ROOT}/hooks/run.py" skills/token-optimizer/scripts/read_cache.py --clear --quiet; done; exit 0'),
101
+ ('PreCompact', '', 'command', 'python3 "${CLAUDE_PLUGIN_ROOT}/hooks/run.py" skills/token-optimizer/scripts/measure.py compact-capture --trigger auto --quiet'),
102
+ ('PreCompact', '', 'command', 'python3 "${CLAUDE_PLUGIN_ROOT}/hooks/run.py" skills/token-optimizer/scripts/read_cache.py --clear --quiet'),
103
+ ('PreToolUse', 'Agent|Task', 'command', "test -f '${CLAUDE_PLUGIN_ROOT}/skills/token-optimizer/scripts/measure.py' && python3 '${CLAUDE_PLUGIN_ROOT}/skills/token-optimizer/scripts/measure.py' checkpoint-trigger --milestone pre-fanout --quiet || true"),
104
+ ('PreToolUse', 'Agent|Task', 'command', '"${CLAUDE_PLUGIN_ROOT}/hooks/run.py" skills/token-optimizer/scripts/measure.py checkpoint-trigger --milestone pre-fanout --quiet'),
105
+ ('PreToolUse', 'Agent|Task', 'command', 'bash "${CLAUDE_PLUGIN_ROOT}/hooks/python-launcher.sh" "${CLAUDE_PLUGIN_ROOT}/hooks/run.py" skills/token-optimizer/scripts/measure.py checkpoint-trigger --milestone pre-fanout --quiet'),
106
+ ('PreToolUse', 'Agent|Task', 'command', 'for b in bash /bin/bash /usr/bin/bash /usr/local/bin/bash /opt/homebrew/bin/bash; do command -v "$b" >/dev/null 2>&1 && exec "$b" "${CLAUDE_PLUGIN_ROOT}/hooks/python-launcher.sh" "${CLAUDE_PLUGIN_ROOT}/hooks/run.py" skills/token-optimizer/scripts/measure.py checkpoint-trigger --milestone pre-fanout --quiet; done; exit 0'),
107
+ ('PreToolUse', 'Agent|Task', 'command', 'for b in bash /bin/bash /usr/bin/bash /usr/local/bin/bash /opt/homebrew/bin/bash; do command -v "$b" >/dev/null 2>&1 || continue; D="${CLAUDE_PLUGIN_ROOT}"; [ -r "$D/hooks/python-launcher.sh" ] || D="$(ls -d "${D%/*}"/*/ 2>/dev/null | grep -E "/[0-9]+[.][0-9]+[.][0-9]+/$" | sort -V | tail -n1)"; D="${D%/}"; [ -r "$D/hooks/python-launcher.sh" ] || exit 0; exec "$b" "$D/hooks/python-launcher.sh" "$D/hooks/run.py" skills/token-optimizer/scripts/measure.py checkpoint-trigger --milestone pre-fanout --quiet; done; exit 0'),
108
+ ('PreToolUse', 'Agent|Task', 'command', 'for b in bash /bin/bash /usr/bin/bash /usr/local/bin/bash /opt/homebrew/bin/bash; do command -v "$b" >/dev/null 2>&1 || continue; D="${CLAUDE_PLUGIN_ROOT}"; [ -r "$D/hooks/python-launcher.sh" ] || D="$(ls -d "${D%[/\\\\]*}"/*/ 2>/dev/null | grep -E "/[0-9]+[.][0-9]+[.][0-9]+/$" | sort -V | tail -n1)"; D="${D%/}"; [ -r "$D/hooks/python-launcher.sh" ] || exit 0; exec "$b" "$D/hooks/python-launcher.sh" "$D/hooks/run.py" skills/token-optimizer/scripts/measure.py checkpoint-trigger --milestone pre-fanout --quiet; done; exit 0'),
109
+ ('PreToolUse', 'Agent|Task', 'command', 'for b in bash /bin/bash /usr/bin/bash /usr/local/bin/bash /opt/homebrew/bin/bash; do command -v "$b" >/dev/null 2>&1 || continue; D="${CLAUDE_PLUGIN_ROOT}"; case "$D" in *\\\\*) D="$(printf \'%s\' "$D" | tr \'\\\\\' \'/\')";; esac; [ -r "$D/hooks/python-launcher.sh" ] || D="$(ls -d "${D%/*}"/*/ 2>/dev/null | grep -E "/[0-9]+[.][0-9]+[.][0-9]+/$" | sort -V | tail -n1)"; D="${D%/}"; [ -r "$D/hooks/python-launcher.sh" ] || exit 0; exec "$b" "$D/hooks/python-launcher.sh" "$D/hooks/run.py" skills/token-optimizer/scripts/measure.py checkpoint-trigger --milestone pre-fanout --quiet; done; exit 0'),
110
+ ('PreToolUse', 'Agent|Task', 'command', 'for b in bash /bin/bash /usr/bin/bash /usr/local/bin/bash /opt/homebrew/bin/bash; do command -v "$b" >/dev/null 2>&1 || continue; L="${CLAUDE_PLUGIN_ROOT}/hooks/python-launcher.sh"; [ -r "$L" ] || exit 0; exec "$b" "$L" "${CLAUDE_PLUGIN_ROOT}/hooks/run.py" skills/token-optimizer/scripts/measure.py checkpoint-trigger --milestone pre-fanout --quiet; done; exit 0'),
111
+ ('PreToolUse', 'Agent|Task', 'command', 'python3 "${CLAUDE_PLUGIN_ROOT}/hooks/run.py" skills/token-optimizer/scripts/measure.py checkpoint-trigger --milestone pre-fanout --quiet'),
112
+ ('PreToolUse', 'Bash', 'command', "test -f '${CLAUDE_PLUGIN_ROOT}/skills/token-optimizer/scripts/bash_hook.py' && python3 '${CLAUDE_PLUGIN_ROOT}/skills/token-optimizer/scripts/bash_hook.py' --quiet || true"),
113
+ ('PreToolUse', 'Bash', 'command', '"${CLAUDE_PLUGIN_ROOT}/hooks/run.py" skills/token-optimizer/scripts/bash_hook.py --quiet'),
114
+ ('PreToolUse', 'Bash', 'command', 'bash "${CLAUDE_PLUGIN_ROOT}/hooks/python-launcher.sh" "${CLAUDE_PLUGIN_ROOT}/hooks/run.py" skills/token-optimizer/scripts/bash_hook.py --quiet'),
115
+ ('PreToolUse', 'Bash', 'command', 'for b in bash /bin/bash /usr/bin/bash /usr/local/bin/bash /opt/homebrew/bin/bash; do command -v "$b" >/dev/null 2>&1 && exec "$b" "${CLAUDE_PLUGIN_ROOT}/hooks/python-launcher.sh" "${CLAUDE_PLUGIN_ROOT}/hooks/run.py" skills/token-optimizer/scripts/bash_hook.py --quiet; done; exit 0'),
116
+ ('PreToolUse', 'Bash', 'command', 'for b in bash /bin/bash /usr/bin/bash /usr/local/bin/bash /opt/homebrew/bin/bash; do command -v "$b" >/dev/null 2>&1 || continue; D="${CLAUDE_PLUGIN_ROOT}"; [ -r "$D/hooks/python-launcher.sh" ] || D="$(ls -d "${D%/*}"/*/ 2>/dev/null | grep -E "/[0-9]+[.][0-9]+[.][0-9]+/$" | sort -V | tail -n1)"; D="${D%/}"; [ -r "$D/hooks/python-launcher.sh" ] || exit 0; exec "$b" "$D/hooks/python-launcher.sh" "$D/hooks/run.py" skills/token-optimizer/scripts/bash_hook.py --quiet; done; exit 0'),
117
+ ('PreToolUse', 'Bash', 'command', 'for b in bash /bin/bash /usr/bin/bash /usr/local/bin/bash /opt/homebrew/bin/bash; do command -v "$b" >/dev/null 2>&1 || continue; D="${CLAUDE_PLUGIN_ROOT}"; [ -r "$D/hooks/python-launcher.sh" ] || D="$(ls -d "${D%[/\\\\]*}"/*/ 2>/dev/null | grep -E "/[0-9]+[.][0-9]+[.][0-9]+/$" | sort -V | tail -n1)"; D="${D%/}"; [ -r "$D/hooks/python-launcher.sh" ] || exit 0; exec "$b" "$D/hooks/python-launcher.sh" "$D/hooks/run.py" skills/token-optimizer/scripts/bash_hook.py --quiet; done; exit 0'),
118
+ ('PreToolUse', 'Bash', 'command', 'for b in bash /bin/bash /usr/bin/bash /usr/local/bin/bash /opt/homebrew/bin/bash; do command -v "$b" >/dev/null 2>&1 || continue; D="${CLAUDE_PLUGIN_ROOT}"; case "$D" in *\\\\*) D="$(printf \'%s\' "$D" | tr \'\\\\\' \'/\')";; esac; [ -r "$D/hooks/python-launcher.sh" ] || D="$(ls -d "${D%/*}"/*/ 2>/dev/null | grep -E "/[0-9]+[.][0-9]+[.][0-9]+/$" | sort -V | tail -n1)"; D="${D%/}"; [ -r "$D/hooks/python-launcher.sh" ] || exit 0; exec "$b" "$D/hooks/python-launcher.sh" "$D/hooks/run.py" skills/token-optimizer/scripts/bash_hook.py --quiet; done; exit 0'),
119
+ ('PreToolUse', 'Bash', 'command', 'for b in bash /bin/bash /usr/bin/bash /usr/local/bin/bash /opt/homebrew/bin/bash; do command -v "$b" >/dev/null 2>&1 || continue; L="${CLAUDE_PLUGIN_ROOT}/hooks/python-launcher.sh"; [ -r "$L" ] || exit 0; exec "$b" "$L" "${CLAUDE_PLUGIN_ROOT}/hooks/run.py" skills/token-optimizer/scripts/bash_hook.py --quiet; done; exit 0'),
120
+ ('PreToolUse', 'Bash', 'command', 'python3 "${CLAUDE_PLUGIN_ROOT}/hooks/run.py" skills/token-optimizer/scripts/bash_hook.py --quiet'),
121
+ ('PreToolUse', 'Read', 'command', "test -f '${CLAUDE_PLUGIN_ROOT}/skills/token-optimizer/scripts/read_cache.py' && python3 '${CLAUDE_PLUGIN_ROOT}/skills/token-optimizer/scripts/read_cache.py' --quiet || true"),
122
+ ('PreToolUse', 'Read', 'command', '"${CLAUDE_PLUGIN_ROOT}/hooks/run.py" skills/token-optimizer/scripts/read_cache.py --quiet'),
123
+ ('PreToolUse', 'Read', 'command', 'bash "${CLAUDE_PLUGIN_ROOT}/hooks/python-launcher.sh" "${CLAUDE_PLUGIN_ROOT}/hooks/run.py" skills/token-optimizer/scripts/read_cache.py --quiet'),
124
+ ('PreToolUse', 'Read', 'command', 'for b in bash /bin/bash /usr/bin/bash /usr/local/bin/bash /opt/homebrew/bin/bash; do command -v "$b" >/dev/null 2>&1 && exec "$b" "${CLAUDE_PLUGIN_ROOT}/hooks/python-launcher.sh" "${CLAUDE_PLUGIN_ROOT}/hooks/run.py" skills/token-optimizer/scripts/read_cache.py --quiet; done; exit 0'),
125
+ ('PreToolUse', 'Read', 'command', 'for b in bash /bin/bash /usr/bin/bash /usr/local/bin/bash /opt/homebrew/bin/bash; do command -v "$b" >/dev/null 2>&1 || continue; D="${CLAUDE_PLUGIN_ROOT}"; [ -r "$D/hooks/python-launcher.sh" ] || D="$(ls -d "${D%/*}"/*/ 2>/dev/null | grep -E "/[0-9]+[.][0-9]+[.][0-9]+/$" | sort -V | tail -n1)"; D="${D%/}"; [ -r "$D/hooks/python-launcher.sh" ] || exit 0; exec "$b" "$D/hooks/python-launcher.sh" "$D/hooks/run.py" skills/token-optimizer/scripts/read_cache.py --quiet; done; exit 0'),
126
+ ('PreToolUse', 'Read', 'command', 'for b in bash /bin/bash /usr/bin/bash /usr/local/bin/bash /opt/homebrew/bin/bash; do command -v "$b" >/dev/null 2>&1 || continue; D="${CLAUDE_PLUGIN_ROOT}"; [ -r "$D/hooks/python-launcher.sh" ] || D="$(ls -d "${D%[/\\\\]*}"/*/ 2>/dev/null | grep -E "/[0-9]+[.][0-9]+[.][0-9]+/$" | sort -V | tail -n1)"; D="${D%/}"; [ -r "$D/hooks/python-launcher.sh" ] || exit 0; exec "$b" "$D/hooks/python-launcher.sh" "$D/hooks/run.py" skills/token-optimizer/scripts/read_cache.py --quiet; done; exit 0'),
127
+ ('PreToolUse', 'Read', 'command', 'for b in bash /bin/bash /usr/bin/bash /usr/local/bin/bash /opt/homebrew/bin/bash; do command -v "$b" >/dev/null 2>&1 || continue; D="${CLAUDE_PLUGIN_ROOT}"; case "$D" in *\\\\*) D="$(printf \'%s\' "$D" | tr \'\\\\\' \'/\')";; esac; [ -r "$D/hooks/python-launcher.sh" ] || D="$(ls -d "${D%/*}"/*/ 2>/dev/null | grep -E "/[0-9]+[.][0-9]+[.][0-9]+/$" | sort -V | tail -n1)"; D="${D%/}"; [ -r "$D/hooks/python-launcher.sh" ] || exit 0; exec "$b" "$D/hooks/python-launcher.sh" "$D/hooks/run.py" skills/token-optimizer/scripts/read_cache.py --quiet; done; exit 0'),
128
+ ('PreToolUse', 'Read', 'command', 'for b in bash /bin/bash /usr/bin/bash /usr/local/bin/bash /opt/homebrew/bin/bash; do command -v "$b" >/dev/null 2>&1 || continue; L="${CLAUDE_PLUGIN_ROOT}/hooks/python-launcher.sh"; [ -r "$L" ] || exit 0; exec "$b" "$L" "${CLAUDE_PLUGIN_ROOT}/hooks/run.py" skills/token-optimizer/scripts/read_cache.py --quiet; done; exit 0'),
129
+ ('PreToolUse', 'Read', 'command', 'python3 "${CLAUDE_PLUGIN_ROOT}/hooks/run.py" skills/token-optimizer/scripts/read_cache.py --quiet'),
130
+ ('PreToolUse', 'mcp__.*', 'command', 'for b in bash /bin/bash /usr/bin/bash /usr/local/bin/bash /opt/homebrew/bin/bash; do command -v "$b" >/dev/null 2>&1 && exec "$b" "${CLAUDE_PLUGIN_ROOT}/hooks/python-launcher.sh" "${CLAUDE_PLUGIN_ROOT}/hooks/run.py" skills/token-optimizer/scripts/refetch_guard.py --quiet; done; exit 0'),
131
+ ('PreToolUse', 'mcp__.*', 'command', 'for b in bash /bin/bash /usr/bin/bash /usr/local/bin/bash /opt/homebrew/bin/bash; do command -v "$b" >/dev/null 2>&1 || continue; D="${CLAUDE_PLUGIN_ROOT}"; [ -r "$D/hooks/python-launcher.sh" ] || D="$(ls -d "${D%/*}"/*/ 2>/dev/null | grep -E "/[0-9]+[.][0-9]+[.][0-9]+/$" | sort -V | tail -n1)"; D="${D%/}"; [ -r "$D/hooks/python-launcher.sh" ] || exit 0; exec "$b" "$D/hooks/python-launcher.sh" "$D/hooks/run.py" skills/token-optimizer/scripts/refetch_guard.py --quiet; done; exit 0'),
132
+ ('PreToolUse', 'mcp__.*', 'command', 'for b in bash /bin/bash /usr/bin/bash /usr/local/bin/bash /opt/homebrew/bin/bash; do command -v "$b" >/dev/null 2>&1 || continue; D="${CLAUDE_PLUGIN_ROOT}"; [ -r "$D/hooks/python-launcher.sh" ] || D="$(ls -d "${D%[/\\\\]*}"/*/ 2>/dev/null | grep -E "/[0-9]+[.][0-9]+[.][0-9]+/$" | sort -V | tail -n1)"; D="${D%/}"; [ -r "$D/hooks/python-launcher.sh" ] || exit 0; exec "$b" "$D/hooks/python-launcher.sh" "$D/hooks/run.py" skills/token-optimizer/scripts/refetch_guard.py --quiet; done; exit 0'),
133
+ ('PreToolUse', 'mcp__.*', 'command', 'for b in bash /bin/bash /usr/bin/bash /usr/local/bin/bash /opt/homebrew/bin/bash; do command -v "$b" >/dev/null 2>&1 || continue; D="${CLAUDE_PLUGIN_ROOT}"; case "$D" in *\\\\*) D="$(printf \'%s\' "$D" | tr \'\\\\\' \'/\')";; esac; [ -r "$D/hooks/python-launcher.sh" ] || D="$(ls -d "${D%/*}"/*/ 2>/dev/null | grep -E "/[0-9]+[.][0-9]+[.][0-9]+/$" | sort -V | tail -n1)"; D="${D%/}"; [ -r "$D/hooks/python-launcher.sh" ] || exit 0; exec "$b" "$D/hooks/python-launcher.sh" "$D/hooks/run.py" skills/token-optimizer/scripts/refetch_guard.py --quiet; done; exit 0'),
134
+ ('PreToolUse', 'mcp__.*', 'command', 'for b in bash /bin/bash /usr/bin/bash /usr/local/bin/bash /opt/homebrew/bin/bash; do command -v "$b" >/dev/null 2>&1 || continue; L="${CLAUDE_PLUGIN_ROOT}/hooks/python-launcher.sh"; [ -r "$L" ] || exit 0; exec "$b" "$L" "${CLAUDE_PLUGIN_ROOT}/hooks/run.py" skills/token-optimizer/scripts/refetch_guard.py --quiet; done; exit 0'),
135
+ ('SessionEnd', '', 'command', "python3 '${CLAUDE_PLUGIN_ROOT}/skills/token-optimizer/scripts/measure.py' collect --quiet && python3 '${CLAUDE_PLUGIN_ROOT}/skills/token-optimizer/scripts/measure.py' dashboard --quiet"),
136
+ ('SessionEnd', '', 'command', "python3 '${CLAUDE_PLUGIN_ROOT}/skills/token-optimizer/scripts/measure.py' compact-capture --trigger end --quiet"),
137
+ ('SessionEnd', '', 'command', "test -f '${CLAUDE_PLUGIN_ROOT}/skills/token-optimizer/scripts/measure.py' && python3 '${CLAUDE_PLUGIN_ROOT}/skills/token-optimizer/scripts/measure.py' collect --quiet && python3 '${CLAUDE_PLUGIN_ROOT}/skills/token-optimizer/scripts/measure.py' dashboard --quiet || true"),
138
+ ('SessionEnd', '', 'command', "test -f '${CLAUDE_PLUGIN_ROOT}/skills/token-optimizer/scripts/measure.py' && python3 '${CLAUDE_PLUGIN_ROOT}/skills/token-optimizer/scripts/measure.py' compact-capture --trigger end --quiet || true"),
139
+ ('SessionEnd', '', 'command', '"${CLAUDE_PLUGIN_ROOT}/hooks/run.py" skills/token-optimizer/scripts/measure.py session-end-flush'),
140
+ ('SessionEnd', '', 'command', 'bash "${CLAUDE_PLUGIN_ROOT}/hooks/python-launcher.sh" "${CLAUDE_PLUGIN_ROOT}/hooks/run.py" skills/token-optimizer/scripts/measure.py session-end-flush'),
141
+ ('SessionEnd', '', 'command', 'for b in bash /bin/bash /usr/bin/bash /usr/local/bin/bash /opt/homebrew/bin/bash; do command -v "$b" >/dev/null 2>&1 && exec "$b" "${CLAUDE_PLUGIN_ROOT}/hooks/python-launcher.sh" "${CLAUDE_PLUGIN_ROOT}/hooks/run.py" skills/token-optimizer/scripts/measure.py session-end-flush --trigger end --defer; done; exit 0'),
142
+ ('SessionEnd', '', 'command', 'for b in bash /bin/bash /usr/bin/bash /usr/local/bin/bash /opt/homebrew/bin/bash; do command -v "$b" >/dev/null 2>&1 && exec "$b" "${CLAUDE_PLUGIN_ROOT}/hooks/python-launcher.sh" "${CLAUDE_PLUGIN_ROOT}/hooks/run.py" skills/token-optimizer/scripts/measure.py session-end-flush; done; exit 0'),
143
+ ('SessionEnd', '', 'command', 'for b in bash /bin/bash /usr/bin/bash /usr/local/bin/bash /opt/homebrew/bin/bash; do command -v "$b" >/dev/null 2>&1 || continue; D="${CLAUDE_PLUGIN_ROOT}"; [ -r "$D/hooks/python-launcher.sh" ] || D="$(ls -d "${D%/*}"/*/ 2>/dev/null | grep -E "/[0-9]+[.][0-9]+[.][0-9]+/$" | sort -V | tail -n1)"; D="${D%/}"; [ -r "$D/hooks/python-launcher.sh" ] || exit 0; exec "$b" "$D/hooks/python-launcher.sh" "$D/hooks/run.py" hooks/stop_runner.py; done; exit 0'),
144
+ ('SessionEnd', '', 'command', 'for b in bash /bin/bash /usr/bin/bash /usr/local/bin/bash /opt/homebrew/bin/bash; do command -v "$b" >/dev/null 2>&1 || continue; D="${CLAUDE_PLUGIN_ROOT}"; [ -r "$D/hooks/python-launcher.sh" ] || D="$(ls -d "${D%/*}"/*/ 2>/dev/null | grep -E "/[0-9]+[.][0-9]+[.][0-9]+/$" | sort -V | tail -n1)"; D="${D%/}"; [ -r "$D/hooks/python-launcher.sh" ] || exit 0; exec "$b" "$D/hooks/python-launcher.sh" "$D/hooks/run.py" skills/token-optimizer/scripts/measure.py session-end-flush --trigger end --defer; done; exit 0'),
145
+ ('SessionEnd', '', 'command', 'for b in bash /bin/bash /usr/bin/bash /usr/local/bin/bash /opt/homebrew/bin/bash; do command -v "$b" >/dev/null 2>&1 || continue; D="${CLAUDE_PLUGIN_ROOT}"; [ -r "$D/hooks/python-launcher.sh" ] || D="$(ls -d "${D%[/\\\\]*}"/*/ 2>/dev/null | grep -E "/[0-9]+[.][0-9]+[.][0-9]+/$" | sort -V | tail -n1)"; D="${D%/}"; [ -r "$D/hooks/python-launcher.sh" ] || exit 0; exec "$b" "$D/hooks/python-launcher.sh" "$D/hooks/run.py" hooks/stop_runner.py; done; exit 0'),
146
+ ('SessionEnd', '', 'command', 'for b in bash /bin/bash /usr/bin/bash /usr/local/bin/bash /opt/homebrew/bin/bash; do command -v "$b" >/dev/null 2>&1 || continue; D="${CLAUDE_PLUGIN_ROOT}"; case "$D" in *\\\\*) D="$(printf \'%s\' "$D" | tr \'\\\\\' \'/\')";; esac; [ -r "$D/hooks/python-launcher.sh" ] || D="$(ls -d "${D%/*}"/*/ 2>/dev/null | grep -E "/[0-9]+[.][0-9]+[.][0-9]+/$" | sort -V | tail -n1)"; D="${D%/}"; [ -r "$D/hooks/python-launcher.sh" ] || exit 0; exec "$b" "$D/hooks/python-launcher.sh" "$D/hooks/run.py" hooks/stop_runner.py; done; exit 0'),
147
+ ('SessionEnd', '', 'command', 'for b in bash /bin/bash /usr/bin/bash /usr/local/bin/bash /opt/homebrew/bin/bash; do command -v "$b" >/dev/null 2>&1 || continue; L="${CLAUDE_PLUGIN_ROOT}/hooks/python-launcher.sh"; [ -r "$L" ] || exit 0; exec "$b" "$L" "${CLAUDE_PLUGIN_ROOT}/hooks/run.py" hooks/stop_runner.py; done; exit 0'),
148
+ ('SessionEnd', '', 'command', 'for b in bash /bin/bash /usr/bin/bash /usr/local/bin/bash /opt/homebrew/bin/bash; do command -v "$b" >/dev/null 2>&1 || continue; L="${CLAUDE_PLUGIN_ROOT}/hooks/python-launcher.sh"; [ -r "$L" ] || exit 0; exec "$b" "$L" "${CLAUDE_PLUGIN_ROOT}/hooks/run.py" skills/token-optimizer/scripts/measure.py session-end-flush --trigger end --defer; done; exit 0'),
149
+ ('SessionEnd', '', 'command', 'python3 "${CLAUDE_PLUGIN_ROOT}/hooks/run.py" skills/token-optimizer/scripts/measure.py session-end-flush'),
150
+ ('SessionStart', '', 'command', "python3 '${CLAUDE_PLUGIN_ROOT}/skills/token-optimizer/scripts/measure.py' compact-restore --new-session-only"),
151
+ ('SessionStart', '', 'command', "python3 '${CLAUDE_PLUGIN_ROOT}/skills/token-optimizer/scripts/measure.py' ensure-health"),
152
+ ('SessionStart', '', 'command', "python3 '${CLAUDE_PLUGIN_ROOT}/skills/token-optimizer/scripts/measure.py' quality-cache --force --quiet"),
153
+ ('SessionStart', '', 'command', "test -f '${CLAUDE_PLUGIN_ROOT}/skills/token-optimizer/scripts/measure.py' && python3 '${CLAUDE_PLUGIN_ROOT}/skills/token-optimizer/scripts/measure.py' compact-restore --new-session-only || true"),
154
+ ('SessionStart', '', 'command', "test -f '${CLAUDE_PLUGIN_ROOT}/skills/token-optimizer/scripts/measure.py' && python3 '${CLAUDE_PLUGIN_ROOT}/skills/token-optimizer/scripts/measure.py' ensure-health || true"),
155
+ ('SessionStart', '', 'command', "test -f '${CLAUDE_PLUGIN_ROOT}/skills/token-optimizer/scripts/measure.py' && python3 '${CLAUDE_PLUGIN_ROOT}/skills/token-optimizer/scripts/measure.py' quality-cache --force --quiet || true"),
156
+ ('SessionStart', '', 'command', '"${CLAUDE_PLUGIN_ROOT}/hooks/run.py" skills/token-optimizer/scripts/measure.py compact-restore --new-session-only'),
157
+ ('SessionStart', '', 'command', '"${CLAUDE_PLUGIN_ROOT}/hooks/run.py" skills/token-optimizer/scripts/measure.py ensure-health'),
158
+ ('SessionStart', '', 'command', '"${CLAUDE_PLUGIN_ROOT}/hooks/run.py" skills/token-optimizer/scripts/measure.py quality-cache --force --quiet'),
159
+ ('SessionStart', '', 'command', 'bash "${CLAUDE_PLUGIN_ROOT}/hooks/python-launcher.sh" "${CLAUDE_PLUGIN_ROOT}/hooks/run.py" skills/token-optimizer/scripts/measure.py compact-restore --new-session-only'),
160
+ ('SessionStart', '', 'command', 'bash "${CLAUDE_PLUGIN_ROOT}/hooks/python-launcher.sh" "${CLAUDE_PLUGIN_ROOT}/hooks/run.py" skills/token-optimizer/scripts/measure.py ensure-health'),
161
+ ('SessionStart', '', 'command', 'bash "${CLAUDE_PLUGIN_ROOT}/hooks/python-launcher.sh" "${CLAUDE_PLUGIN_ROOT}/hooks/run.py" skills/token-optimizer/scripts/measure.py quality-cache --force --quiet'),
162
+ ('SessionStart', '', 'command', 'for b in bash /bin/bash /usr/bin/bash /usr/local/bin/bash /opt/homebrew/bin/bash; do command -v "$b" >/dev/null 2>&1 && exec "$b" "${CLAUDE_PLUGIN_ROOT}/hooks/python-launcher.sh" "${CLAUDE_PLUGIN_ROOT}/hooks/run.py" skills/token-optimizer/scripts/measure.py compact-restore --new-session-only --once-mark; done; exit 0'),
163
+ ('SessionStart', '', 'command', 'for b in bash /bin/bash /usr/bin/bash /usr/local/bin/bash /opt/homebrew/bin/bash; do command -v "$b" >/dev/null 2>&1 && exec "$b" "${CLAUDE_PLUGIN_ROOT}/hooks/python-launcher.sh" "${CLAUDE_PLUGIN_ROOT}/hooks/run.py" skills/token-optimizer/scripts/measure.py compact-restore --new-session-only --once-per-session; done; exit 0'),
164
+ ('SessionStart', '', 'command', 'for b in bash /bin/bash /usr/bin/bash /usr/local/bin/bash /opt/homebrew/bin/bash; do command -v "$b" >/dev/null 2>&1 && exec "$b" "${CLAUDE_PLUGIN_ROOT}/hooks/python-launcher.sh" "${CLAUDE_PLUGIN_ROOT}/hooks/run.py" skills/token-optimizer/scripts/measure.py compact-restore --new-session-only; done; exit 0'),
165
+ ('SessionStart', '', 'command', 'for b in bash /bin/bash /usr/bin/bash /usr/local/bin/bash /opt/homebrew/bin/bash; do command -v "$b" >/dev/null 2>&1 && exec "$b" "${CLAUDE_PLUGIN_ROOT}/hooks/python-launcher.sh" "${CLAUDE_PLUGIN_ROOT}/hooks/run.py" skills/token-optimizer/scripts/measure.py ensure-health --once-mark; done; exit 0'),
166
+ ('SessionStart', '', 'command', 'for b in bash /bin/bash /usr/bin/bash /usr/local/bin/bash /opt/homebrew/bin/bash; do command -v "$b" >/dev/null 2>&1 && exec "$b" "${CLAUDE_PLUGIN_ROOT}/hooks/python-launcher.sh" "${CLAUDE_PLUGIN_ROOT}/hooks/run.py" skills/token-optimizer/scripts/measure.py ensure-health --once-per-session; done; exit 0'),
167
+ ('SessionStart', '', 'command', 'for b in bash /bin/bash /usr/bin/bash /usr/local/bin/bash /opt/homebrew/bin/bash; do command -v "$b" >/dev/null 2>&1 && exec "$b" "${CLAUDE_PLUGIN_ROOT}/hooks/python-launcher.sh" "${CLAUDE_PLUGIN_ROOT}/hooks/run.py" skills/token-optimizer/scripts/measure.py ensure-health; done; exit 0'),
168
+ ('SessionStart', '', 'command', 'for b in bash /bin/bash /usr/bin/bash /usr/local/bin/bash /opt/homebrew/bin/bash; do command -v "$b" >/dev/null 2>&1 && exec "$b" "${CLAUDE_PLUGIN_ROOT}/hooks/python-launcher.sh" "${CLAUDE_PLUGIN_ROOT}/hooks/run.py" skills/token-optimizer/scripts/measure.py quality-cache --force --quiet --once-mark; done; exit 0'),
169
+ ('SessionStart', '', 'command', 'for b in bash /bin/bash /usr/bin/bash /usr/local/bin/bash /opt/homebrew/bin/bash; do command -v "$b" >/dev/null 2>&1 && exec "$b" "${CLAUDE_PLUGIN_ROOT}/hooks/python-launcher.sh" "${CLAUDE_PLUGIN_ROOT}/hooks/run.py" skills/token-optimizer/scripts/measure.py quality-cache --force --quiet --once-per-session; done; exit 0'),
170
+ ('SessionStart', '', 'command', 'for b in bash /bin/bash /usr/bin/bash /usr/local/bin/bash /opt/homebrew/bin/bash; do command -v "$b" >/dev/null 2>&1 && exec "$b" "${CLAUDE_PLUGIN_ROOT}/hooks/python-launcher.sh" "${CLAUDE_PLUGIN_ROOT}/hooks/run.py" skills/token-optimizer/scripts/measure.py quality-cache --force --quiet; done; exit 0'),
171
+ ('SessionStart', '', 'command', 'for b in bash /bin/bash /usr/bin/bash /usr/local/bin/bash /opt/homebrew/bin/bash; do command -v "$b" >/dev/null 2>&1 || continue; D="${CLAUDE_PLUGIN_ROOT}"; [ -r "$D/hooks/python-launcher.sh" ] || D="$(ls -d "${D%/*}"/*/ 2>/dev/null | grep -E "/[0-9]+[.][0-9]+[.][0-9]+/$" | sort -V | tail -n1)"; D="${D%/}"; [ -r "$D/hooks/python-launcher.sh" ] || exit 0; exec "$b" "$D/hooks/python-launcher.sh" "$D/hooks/run.py" hooks/sessionstart_runner.py; done; exit 0'),
172
+ ('SessionStart', '', 'command', 'for b in bash /bin/bash /usr/bin/bash /usr/local/bin/bash /opt/homebrew/bin/bash; do command -v "$b" >/dev/null 2>&1 || continue; D="${CLAUDE_PLUGIN_ROOT}"; [ -r "$D/hooks/python-launcher.sh" ] || D="$(ls -d "${D%/*}"/*/ 2>/dev/null | grep -E "/[0-9]+[.][0-9]+[.][0-9]+/$" | sort -V | tail -n1)"; D="${D%/}"; [ -r "$D/hooks/python-launcher.sh" ] || exit 0; exec "$b" "$D/hooks/python-launcher.sh" "$D/hooks/run.py" skills/token-optimizer/scripts/measure.py compact-restore --new-session-only --once-mark; done; exit 0'),
173
+ ('SessionStart', '', 'command', 'for b in bash /bin/bash /usr/bin/bash /usr/local/bin/bash /opt/homebrew/bin/bash; do command -v "$b" >/dev/null 2>&1 || continue; D="${CLAUDE_PLUGIN_ROOT}"; [ -r "$D/hooks/python-launcher.sh" ] || D="$(ls -d "${D%/*}"/*/ 2>/dev/null | grep -E "/[0-9]+[.][0-9]+[.][0-9]+/$" | sort -V | tail -n1)"; D="${D%/}"; [ -r "$D/hooks/python-launcher.sh" ] || exit 0; exec "$b" "$D/hooks/python-launcher.sh" "$D/hooks/run.py" skills/token-optimizer/scripts/measure.py ensure-health --once-mark; done; exit 0'),
174
+ ('SessionStart', '', 'command', 'for b in bash /bin/bash /usr/bin/bash /usr/local/bin/bash /opt/homebrew/bin/bash; do command -v "$b" >/dev/null 2>&1 || continue; D="${CLAUDE_PLUGIN_ROOT}"; [ -r "$D/hooks/python-launcher.sh" ] || D="$(ls -d "${D%/*}"/*/ 2>/dev/null | grep -E "/[0-9]+[.][0-9]+[.][0-9]+/$" | sort -V | tail -n1)"; D="${D%/}"; [ -r "$D/hooks/python-launcher.sh" ] || exit 0; exec "$b" "$D/hooks/python-launcher.sh" "$D/hooks/run.py" skills/token-optimizer/scripts/measure.py quality-cache --force --quiet --once-mark; done; exit 0'),
175
+ ('SessionStart', '', 'command', 'for b in bash /bin/bash /usr/bin/bash /usr/local/bin/bash /opt/homebrew/bin/bash; do command -v "$b" >/dev/null 2>&1 || continue; D="${CLAUDE_PLUGIN_ROOT}"; [ -r "$D/hooks/python-launcher.sh" ] || D="$(ls -d "${D%[/\\\\]*}"/*/ 2>/dev/null | grep -E "/[0-9]+[.][0-9]+[.][0-9]+/$" | sort -V | tail -n1)"; D="${D%/}"; [ -r "$D/hooks/python-launcher.sh" ] || exit 0; exec "$b" "$D/hooks/python-launcher.sh" "$D/hooks/run.py" hooks/sessionstart_runner.py; done; exit 0'),
176
+ ('SessionStart', '', 'command', 'for b in bash /bin/bash /usr/bin/bash /usr/local/bin/bash /opt/homebrew/bin/bash; do command -v "$b" >/dev/null 2>&1 || continue; D="${CLAUDE_PLUGIN_ROOT}"; case "$D" in *\\\\*) D="$(printf \'%s\' "$D" | tr \'\\\\\' \'/\')";; esac; [ -r "$D/hooks/python-launcher.sh" ] || D="$(ls -d "${D%/*}"/*/ 2>/dev/null | grep -E "/[0-9]+[.][0-9]+[.][0-9]+/$" | sort -V | tail -n1)"; D="${D%/}"; [ -r "$D/hooks/python-launcher.sh" ] || exit 0; exec "$b" "$D/hooks/python-launcher.sh" "$D/hooks/run.py" hooks/sessionstart_runner.py; done; exit 0'),
177
+ ('SessionStart', '', 'command', 'for b in bash /bin/bash /usr/bin/bash /usr/local/bin/bash /opt/homebrew/bin/bash; do command -v "$b" >/dev/null 2>&1 || continue; L="${CLAUDE_PLUGIN_ROOT}/hooks/python-launcher.sh"; [ -r "$L" ] || exit 0; exec "$b" "$L" "${CLAUDE_PLUGIN_ROOT}/hooks/run.py" hooks/sessionstart_runner.py; done; exit 0'),
178
+ ('SessionStart', '', 'command', 'for b in bash /bin/bash /usr/bin/bash /usr/local/bin/bash /opt/homebrew/bin/bash; do command -v "$b" >/dev/null 2>&1 || continue; L="${CLAUDE_PLUGIN_ROOT}/hooks/python-launcher.sh"; [ -r "$L" ] || exit 0; exec "$b" "$L" "${CLAUDE_PLUGIN_ROOT}/hooks/run.py" skills/token-optimizer/scripts/measure.py compact-restore --new-session-only --once-mark; done; exit 0'),
179
+ ('SessionStart', '', 'command', 'for b in bash /bin/bash /usr/bin/bash /usr/local/bin/bash /opt/homebrew/bin/bash; do command -v "$b" >/dev/null 2>&1 || continue; L="${CLAUDE_PLUGIN_ROOT}/hooks/python-launcher.sh"; [ -r "$L" ] || exit 0; exec "$b" "$L" "${CLAUDE_PLUGIN_ROOT}/hooks/run.py" skills/token-optimizer/scripts/measure.py ensure-health --once-mark; done; exit 0'),
180
+ ('SessionStart', '', 'command', 'for b in bash /bin/bash /usr/bin/bash /usr/local/bin/bash /opt/homebrew/bin/bash; do command -v "$b" >/dev/null 2>&1 || continue; L="${CLAUDE_PLUGIN_ROOT}/hooks/python-launcher.sh"; [ -r "$L" ] || exit 0; exec "$b" "$L" "${CLAUDE_PLUGIN_ROOT}/hooks/run.py" skills/token-optimizer/scripts/measure.py quality-cache --force --quiet --once-mark; done; exit 0'),
181
+ ('SessionStart', '', 'command', 'python3 "${CLAUDE_PLUGIN_ROOT}/hooks/run.py" skills/token-optimizer/scripts/measure.py compact-restore --new-session-only'),
182
+ ('SessionStart', '', 'command', 'python3 "${CLAUDE_PLUGIN_ROOT}/hooks/run.py" skills/token-optimizer/scripts/measure.py ensure-health'),
183
+ ('SessionStart', '', 'command', 'python3 "${CLAUDE_PLUGIN_ROOT}/hooks/run.py" skills/token-optimizer/scripts/measure.py quality-cache --force --quiet'),
184
+ ('SessionStart', 'compact', 'command', "python3 '${CLAUDE_PLUGIN_ROOT}/skills/token-optimizer/scripts/measure.py' compact-restore"),
185
+ ('SessionStart', 'compact', 'command', "test -f '${CLAUDE_PLUGIN_ROOT}/skills/token-optimizer/scripts/measure.py' && python3 '${CLAUDE_PLUGIN_ROOT}/skills/token-optimizer/scripts/measure.py' compact-restore || true"),
186
+ ('SessionStart', 'compact', 'command', '"${CLAUDE_PLUGIN_ROOT}/hooks/run.py" skills/token-optimizer/scripts/measure.py compact-restore'),
187
+ ('SessionStart', 'compact', 'command', 'bash "${CLAUDE_PLUGIN_ROOT}/hooks/python-launcher.sh" "${CLAUDE_PLUGIN_ROOT}/hooks/run.py" skills/token-optimizer/scripts/measure.py compact-restore --compact'),
188
+ ('SessionStart', 'compact', 'command', 'bash "${CLAUDE_PLUGIN_ROOT}/hooks/python-launcher.sh" "${CLAUDE_PLUGIN_ROOT}/hooks/run.py" skills/token-optimizer/scripts/measure.py compact-restore'),
189
+ ('SessionStart', 'compact', 'command', 'for b in bash /bin/bash /usr/bin/bash /usr/local/bin/bash /opt/homebrew/bin/bash; do command -v "$b" >/dev/null 2>&1 && exec "$b" "${CLAUDE_PLUGIN_ROOT}/hooks/python-launcher.sh" "${CLAUDE_PLUGIN_ROOT}/hooks/run.py" skills/token-optimizer/scripts/measure.py compact-restore --compact; done; exit 0'),
190
+ ('SessionStart', 'compact', 'command', 'for b in bash /bin/bash /usr/bin/bash /usr/local/bin/bash /opt/homebrew/bin/bash; do command -v "$b" >/dev/null 2>&1 && exec "$b" "${CLAUDE_PLUGIN_ROOT}/hooks/python-launcher.sh" "${CLAUDE_PLUGIN_ROOT}/hooks/run.py" skills/token-optimizer/scripts/read_cache.py --clear-compacted --quiet; done; exit 0'),
191
+ ('SessionStart', 'compact', 'command', 'for b in bash /bin/bash /usr/bin/bash /usr/local/bin/bash /opt/homebrew/bin/bash; do command -v "$b" >/dev/null 2>&1 || continue; D="${CLAUDE_PLUGIN_ROOT}"; [ -r "$D/hooks/python-launcher.sh" ] || D="$(ls -d "${D%/*}"/*/ 2>/dev/null | grep -E "/[0-9]+[.][0-9]+[.][0-9]+/$" | sort -V | tail -n1)"; D="${D%/}"; [ -r "$D/hooks/python-launcher.sh" ] || exit 0; exec "$b" "$D/hooks/python-launcher.sh" "$D/hooks/run.py" skills/token-optimizer/scripts/measure.py compact-restore --compact; done; exit 0'),
192
+ ('SessionStart', 'compact', 'command', 'for b in bash /bin/bash /usr/bin/bash /usr/local/bin/bash /opt/homebrew/bin/bash; do command -v "$b" >/dev/null 2>&1 || continue; D="${CLAUDE_PLUGIN_ROOT}"; [ -r "$D/hooks/python-launcher.sh" ] || D="$(ls -d "${D%/*}"/*/ 2>/dev/null | grep -E "/[0-9]+[.][0-9]+[.][0-9]+/$" | sort -V | tail -n1)"; D="${D%/}"; [ -r "$D/hooks/python-launcher.sh" ] || exit 0; exec "$b" "$D/hooks/python-launcher.sh" "$D/hooks/run.py" skills/token-optimizer/scripts/read_cache.py --clear-compacted --quiet; done; exit 0'),
193
+ ('SessionStart', 'compact', 'command', 'for b in bash /bin/bash /usr/bin/bash /usr/local/bin/bash /opt/homebrew/bin/bash; do command -v "$b" >/dev/null 2>&1 || continue; L="${CLAUDE_PLUGIN_ROOT}/hooks/python-launcher.sh"; [ -r "$L" ] || exit 0; exec "$b" "$L" "${CLAUDE_PLUGIN_ROOT}/hooks/run.py" skills/token-optimizer/scripts/measure.py compact-restore --compact; done; exit 0'),
194
+ ('SessionStart', 'compact', 'command', 'for b in bash /bin/bash /usr/bin/bash /usr/local/bin/bash /opt/homebrew/bin/bash; do command -v "$b" >/dev/null 2>&1 || continue; L="${CLAUDE_PLUGIN_ROOT}/hooks/python-launcher.sh"; [ -r "$L" ] || exit 0; exec "$b" "$L" "${CLAUDE_PLUGIN_ROOT}/hooks/run.py" skills/token-optimizer/scripts/read_cache.py --clear-compacted --quiet; done; exit 0'),
195
+ ('SessionStart', 'compact', 'command', 'python3 "${CLAUDE_PLUGIN_ROOT}/hooks/run.py" skills/token-optimizer/scripts/measure.py compact-restore'),
196
+ ('Stop', '', 'command', "python3 '${CLAUDE_PLUGIN_ROOT}/skills/token-optimizer/scripts/measure.py' compact-capture --trigger stop --quiet"),
197
+ ('Stop', '', 'command', "test -f '${CLAUDE_PLUGIN_ROOT}/skills/token-optimizer/scripts/measure.py' && python3 '${CLAUDE_PLUGIN_ROOT}/skills/token-optimizer/scripts/measure.py' compact-capture --trigger stop --quiet || true"),
198
+ ('Stop', '', 'command', '"${CLAUDE_PLUGIN_ROOT}/hooks/run.py" skills/token-optimizer/scripts/measure.py compact-capture --trigger stop --quiet'),
199
+ ('Stop', '', 'command', 'bash "${CLAUDE_PLUGIN_ROOT}/hooks/python-launcher.sh" "${CLAUDE_PLUGIN_ROOT}/hooks/run.py" skills/token-optimizer/scripts/measure.py compact-capture --trigger stop --quiet'),
200
+ ('Stop', '', 'command', 'bash "${CLAUDE_PLUGIN_ROOT}/hooks/python-launcher.sh" "${CLAUDE_PLUGIN_ROOT}/hooks/run.py" skills/token-optimizer/scripts/measure.py keepwarm-arm --quiet'),
201
+ ('Stop', '', 'command', 'bash "${CLAUDE_PLUGIN_ROOT}/hooks/python-launcher.sh" "${CLAUDE_PLUGIN_ROOT}/hooks/run.py" skills/token-optimizer/scripts/measure.py session-end-flush --trigger stop --quiet --defer'),
202
+ ('Stop', '', 'command', 'for b in bash /bin/bash /usr/bin/bash /usr/local/bin/bash /opt/homebrew/bin/bash; do command -v "$b" >/dev/null 2>&1 && exec "$b" "${CLAUDE_PLUGIN_ROOT}/hooks/python-launcher.sh" "${CLAUDE_PLUGIN_ROOT}/hooks/run.py" skills/token-optimizer/scripts/measure.py compact-capture --trigger stop --quiet; done; exit 0'),
203
+ ('Stop', '', 'command', 'for b in bash /bin/bash /usr/bin/bash /usr/local/bin/bash /opt/homebrew/bin/bash; do command -v "$b" >/dev/null 2>&1 && exec "$b" "${CLAUDE_PLUGIN_ROOT}/hooks/python-launcher.sh" "${CLAUDE_PLUGIN_ROOT}/hooks/run.py" skills/token-optimizer/scripts/measure.py keepwarm-arm --quiet; done; exit 0'),
204
+ ('Stop', '', 'command', 'for b in bash /bin/bash /usr/bin/bash /usr/local/bin/bash /opt/homebrew/bin/bash; do command -v "$b" >/dev/null 2>&1 && exec "$b" "${CLAUDE_PLUGIN_ROOT}/hooks/python-launcher.sh" "${CLAUDE_PLUGIN_ROOT}/hooks/run.py" skills/token-optimizer/scripts/measure.py session-end-flush --trigger stop --quiet --defer; done; exit 0'),
205
+ ('Stop', '', 'command', 'for b in bash /bin/bash /usr/bin/bash /usr/local/bin/bash /opt/homebrew/bin/bash; do command -v "$b" >/dev/null 2>&1 || continue; D="${CLAUDE_PLUGIN_ROOT}"; [ -r "$D/hooks/python-launcher.sh" ] || D="$(ls -d "${D%/*}"/*/ 2>/dev/null | grep -E "/[0-9]+[.][0-9]+[.][0-9]+/$" | sort -V | tail -n1)"; D="${D%/}"; [ -r "$D/hooks/python-launcher.sh" ] || exit 0; exec "$b" "$D/hooks/python-launcher.sh" "$D/hooks/run.py" hooks/stop_runner.py; done; exit 0'),
206
+ ('Stop', '', 'command', 'for b in bash /bin/bash /usr/bin/bash /usr/local/bin/bash /opt/homebrew/bin/bash; do command -v "$b" >/dev/null 2>&1 || continue; D="${CLAUDE_PLUGIN_ROOT}"; [ -r "$D/hooks/python-launcher.sh" ] || D="$(ls -d "${D%/*}"/*/ 2>/dev/null | grep -E "/[0-9]+[.][0-9]+[.][0-9]+/$" | sort -V | tail -n1)"; D="${D%/}"; [ -r "$D/hooks/python-launcher.sh" ] || exit 0; exec "$b" "$D/hooks/python-launcher.sh" "$D/hooks/run.py" skills/token-optimizer/scripts/measure.py compact-capture --trigger stop --quiet; done; exit 0'),
207
+ ('Stop', '', 'command', 'for b in bash /bin/bash /usr/bin/bash /usr/local/bin/bash /opt/homebrew/bin/bash; do command -v "$b" >/dev/null 2>&1 || continue; D="${CLAUDE_PLUGIN_ROOT}"; [ -r "$D/hooks/python-launcher.sh" ] || D="$(ls -d "${D%/*}"/*/ 2>/dev/null | grep -E "/[0-9]+[.][0-9]+[.][0-9]+/$" | sort -V | tail -n1)"; D="${D%/}"; [ -r "$D/hooks/python-launcher.sh" ] || exit 0; exec "$b" "$D/hooks/python-launcher.sh" "$D/hooks/run.py" skills/token-optimizer/scripts/measure.py keepwarm-arm --quiet; done; exit 0'),
208
+ ('Stop', '', 'command', 'for b in bash /bin/bash /usr/bin/bash /usr/local/bin/bash /opt/homebrew/bin/bash; do command -v "$b" >/dev/null 2>&1 || continue; D="${CLAUDE_PLUGIN_ROOT}"; [ -r "$D/hooks/python-launcher.sh" ] || D="$(ls -d "${D%/*}"/*/ 2>/dev/null | grep -E "/[0-9]+[.][0-9]+[.][0-9]+/$" | sort -V | tail -n1)"; D="${D%/}"; [ -r "$D/hooks/python-launcher.sh" ] || exit 0; exec "$b" "$D/hooks/python-launcher.sh" "$D/hooks/run.py" skills/token-optimizer/scripts/measure.py session-end-flush --trigger stop --quiet --defer; done; exit 0'),
209
+ ('Stop', '', 'command', 'for b in bash /bin/bash /usr/bin/bash /usr/local/bin/bash /opt/homebrew/bin/bash; do command -v "$b" >/dev/null 2>&1 || continue; D="${CLAUDE_PLUGIN_ROOT}"; [ -r "$D/hooks/python-launcher.sh" ] || D="$(ls -d "${D%[/\\\\]*}"/*/ 2>/dev/null | grep -E "/[0-9]+[.][0-9]+[.][0-9]+/$" | sort -V | tail -n1)"; D="${D%/}"; [ -r "$D/hooks/python-launcher.sh" ] || exit 0; exec "$b" "$D/hooks/python-launcher.sh" "$D/hooks/run.py" hooks/stop_runner.py; done; exit 0'),
210
+ ('Stop', '', 'command', 'for b in bash /bin/bash /usr/bin/bash /usr/local/bin/bash /opt/homebrew/bin/bash; do command -v "$b" >/dev/null 2>&1 || continue; D="${CLAUDE_PLUGIN_ROOT}"; case "$D" in *\\\\*) D="$(printf \'%s\' "$D" | tr \'\\\\\' \'/\')";; esac; [ -r "$D/hooks/python-launcher.sh" ] || D="$(ls -d "${D%/*}"/*/ 2>/dev/null | grep -E "/[0-9]+[.][0-9]+[.][0-9]+/$" | sort -V | tail -n1)"; D="${D%/}"; [ -r "$D/hooks/python-launcher.sh" ] || exit 0; exec "$b" "$D/hooks/python-launcher.sh" "$D/hooks/run.py" hooks/stop_runner.py; done; exit 0'),
211
+ ('Stop', '', 'command', 'for b in bash /bin/bash /usr/bin/bash /usr/local/bin/bash /opt/homebrew/bin/bash; do command -v "$b" >/dev/null 2>&1 || continue; L="${CLAUDE_PLUGIN_ROOT}/hooks/python-launcher.sh"; [ -r "$L" ] || exit 0; exec "$b" "$L" "${CLAUDE_PLUGIN_ROOT}/hooks/run.py" hooks/stop_runner.py; done; exit 0'),
212
+ ('Stop', '', 'command', 'for b in bash /bin/bash /usr/bin/bash /usr/local/bin/bash /opt/homebrew/bin/bash; do command -v "$b" >/dev/null 2>&1 || continue; L="${CLAUDE_PLUGIN_ROOT}/hooks/python-launcher.sh"; [ -r "$L" ] || exit 0; exec "$b" "$L" "${CLAUDE_PLUGIN_ROOT}/hooks/run.py" skills/token-optimizer/scripts/measure.py compact-capture --trigger stop --quiet; done; exit 0'),
213
+ ('Stop', '', 'command', 'for b in bash /bin/bash /usr/bin/bash /usr/local/bin/bash /opt/homebrew/bin/bash; do command -v "$b" >/dev/null 2>&1 || continue; L="${CLAUDE_PLUGIN_ROOT}/hooks/python-launcher.sh"; [ -r "$L" ] || exit 0; exec "$b" "$L" "${CLAUDE_PLUGIN_ROOT}/hooks/run.py" skills/token-optimizer/scripts/measure.py keepwarm-arm --quiet; done; exit 0'),
214
+ ('Stop', '', 'command', 'for b in bash /bin/bash /usr/bin/bash /usr/local/bin/bash /opt/homebrew/bin/bash; do command -v "$b" >/dev/null 2>&1 || continue; L="${CLAUDE_PLUGIN_ROOT}/hooks/python-launcher.sh"; [ -r "$L" ] || exit 0; exec "$b" "$L" "${CLAUDE_PLUGIN_ROOT}/hooks/run.py" skills/token-optimizer/scripts/measure.py session-end-flush --trigger stop --quiet --defer; done; exit 0'),
215
+ ('Stop', '', 'command', 'python3 "${CLAUDE_PLUGIN_ROOT}/hooks/run.py" skills/token-optimizer/scripts/measure.py compact-capture --trigger stop --quiet'),
216
+ ('StopFailure', '', 'command', "python3 '${CLAUDE_PLUGIN_ROOT}/skills/token-optimizer/scripts/measure.py' compact-capture --trigger stop-failure --quiet"),
217
+ ('StopFailure', '', 'command', "test -f '${CLAUDE_PLUGIN_ROOT}/skills/token-optimizer/scripts/measure.py' && python3 '${CLAUDE_PLUGIN_ROOT}/skills/token-optimizer/scripts/measure.py' compact-capture --trigger stop-failure --quiet || true"),
218
+ ('StopFailure', '', 'command', '"${CLAUDE_PLUGIN_ROOT}/hooks/run.py" skills/token-optimizer/scripts/measure.py compact-capture --trigger stop-failure --quiet'),
219
+ ('StopFailure', '', 'command', 'bash "${CLAUDE_PLUGIN_ROOT}/hooks/python-launcher.sh" "${CLAUDE_PLUGIN_ROOT}/hooks/run.py" skills/token-optimizer/scripts/measure.py compact-capture --trigger stop-failure --quiet'),
220
+ ('StopFailure', '', 'command', 'for b in bash /bin/bash /usr/bin/bash /usr/local/bin/bash /opt/homebrew/bin/bash; do command -v "$b" >/dev/null 2>&1 && exec "$b" "${CLAUDE_PLUGIN_ROOT}/hooks/python-launcher.sh" "${CLAUDE_PLUGIN_ROOT}/hooks/run.py" skills/token-optimizer/scripts/measure.py compact-capture --trigger stop-failure --quiet; done; exit 0'),
221
+ ('StopFailure', '', 'command', 'for b in bash /bin/bash /usr/bin/bash /usr/local/bin/bash /opt/homebrew/bin/bash; do command -v "$b" >/dev/null 2>&1 || continue; D="${CLAUDE_PLUGIN_ROOT}"; [ -r "$D/hooks/python-launcher.sh" ] || D="$(ls -d "${D%/*}"/*/ 2>/dev/null | grep -E "/[0-9]+[.][0-9]+[.][0-9]+/$" | sort -V | tail -n1)"; D="${D%/}"; [ -r "$D/hooks/python-launcher.sh" ] || exit 0; exec "$b" "$D/hooks/python-launcher.sh" "$D/hooks/run.py" skills/token-optimizer/scripts/measure.py compact-capture --trigger stop-failure --quiet; done; exit 0'),
222
+ ('StopFailure', '', 'command', 'for b in bash /bin/bash /usr/bin/bash /usr/local/bin/bash /opt/homebrew/bin/bash; do command -v "$b" >/dev/null 2>&1 || continue; D="${CLAUDE_PLUGIN_ROOT}"; [ -r "$D/hooks/python-launcher.sh" ] || D="$(ls -d "${D%[/\\\\]*}"/*/ 2>/dev/null | grep -E "/[0-9]+[.][0-9]+[.][0-9]+/$" | sort -V | tail -n1)"; D="${D%/}"; [ -r "$D/hooks/python-launcher.sh" ] || exit 0; exec "$b" "$D/hooks/python-launcher.sh" "$D/hooks/run.py" skills/token-optimizer/scripts/measure.py compact-capture --trigger stop-failure --quiet; done; exit 0'),
223
+ ('StopFailure', '', 'command', 'for b in bash /bin/bash /usr/bin/bash /usr/local/bin/bash /opt/homebrew/bin/bash; do command -v "$b" >/dev/null 2>&1 || continue; D="${CLAUDE_PLUGIN_ROOT}"; case "$D" in *\\\\*) D="$(printf \'%s\' "$D" | tr \'\\\\\' \'/\')";; esac; [ -r "$D/hooks/python-launcher.sh" ] || D="$(ls -d "${D%/*}"/*/ 2>/dev/null | grep -E "/[0-9]+[.][0-9]+[.][0-9]+/$" | sort -V | tail -n1)"; D="${D%/}"; [ -r "$D/hooks/python-launcher.sh" ] || exit 0; exec "$b" "$D/hooks/python-launcher.sh" "$D/hooks/run.py" skills/token-optimizer/scripts/measure.py compact-capture --trigger stop-failure --quiet; done; exit 0'),
224
+ ('StopFailure', '', 'command', 'for b in bash /bin/bash /usr/bin/bash /usr/local/bin/bash /opt/homebrew/bin/bash; do command -v "$b" >/dev/null 2>&1 || continue; L="${CLAUDE_PLUGIN_ROOT}/hooks/python-launcher.sh"; [ -r "$L" ] || exit 0; exec "$b" "$L" "${CLAUDE_PLUGIN_ROOT}/hooks/run.py" skills/token-optimizer/scripts/measure.py compact-capture --trigger stop-failure --quiet; done; exit 0'),
225
+ ('StopFailure', '', 'command', 'python3 "${CLAUDE_PLUGIN_ROOT}/hooks/run.py" skills/token-optimizer/scripts/measure.py compact-capture --trigger stop-failure --quiet'),
226
+ ('UserPromptSubmit', '', 'command', "python3 '${CLAUDE_PLUGIN_ROOT}/skills/token-optimizer/scripts/measure.py' quality-cache --warn --quiet"),
227
+ ('UserPromptSubmit', '', 'command', "test -f '${CLAUDE_PLUGIN_ROOT}/skills/token-optimizer/scripts/measure.py' && python3 '${CLAUDE_PLUGIN_ROOT}/skills/token-optimizer/scripts/measure.py' quality-cache --warn --quiet || true"),
228
+ ('UserPromptSubmit', '', 'command', '"${CLAUDE_PLUGIN_ROOT}/hooks/run.py" skills/token-optimizer/scripts/measure.py quality-cache --warn --quiet'),
229
+ ('UserPromptSubmit', '', 'command', '[ -n "$CLAUDE_CODE_CONTAINER_ID" ] || case "$AI_AGENT$CLAUDE_PLUGIN_ROOT" in *harness*|*/plugins/synced/*) ;; *) exit 0;; esac; for b in bash /bin/bash /usr/bin/bash /usr/local/bin/bash /opt/homebrew/bin/bash; do command -v "$b" >/dev/null 2>&1 && exec "$b" "${CLAUDE_PLUGIN_ROOT}/hooks/python-launcher.sh" "${CLAUDE_PLUGIN_ROOT}/hooks/run.py" skills/token-optimizer/scripts/measure.py compact-restore --new-session-only --once-per-session; done; exit 0'),
230
+ ('UserPromptSubmit', '', 'command', '[ -n "$CLAUDE_CODE_CONTAINER_ID" ] || case "$AI_AGENT$CLAUDE_PLUGIN_ROOT" in *harness*|*/plugins/synced/*) ;; *) exit 0;; esac; for b in bash /bin/bash /usr/bin/bash /usr/local/bin/bash /opt/homebrew/bin/bash; do command -v "$b" >/dev/null 2>&1 && exec "$b" "${CLAUDE_PLUGIN_ROOT}/hooks/python-launcher.sh" "${CLAUDE_PLUGIN_ROOT}/hooks/run.py" skills/token-optimizer/scripts/measure.py ensure-health --once-per-session; done; exit 0'),
231
+ ('UserPromptSubmit', '', 'command', '[ -n "$CLAUDE_CODE_CONTAINER_ID" ] || case "$AI_AGENT$CLAUDE_PLUGIN_ROOT" in *harness*|*/plugins/synced/*) ;; *) exit 0;; esac; for b in bash /bin/bash /usr/bin/bash /usr/local/bin/bash /opt/homebrew/bin/bash; do command -v "$b" >/dev/null 2>&1 && exec "$b" "${CLAUDE_PLUGIN_ROOT}/hooks/python-launcher.sh" "${CLAUDE_PLUGIN_ROOT}/hooks/run.py" skills/token-optimizer/scripts/measure.py quality-cache --force --quiet --once-per-session; done; exit 0'),
232
+ ('UserPromptSubmit', '', 'command', '[ -n "$CLAUDE_CODE_CONTAINER_ID$CLAUDE_CODE_REMOTE" ] || case "$AI_AGENT$CLAUDE_PLUGIN_ROOT" in *harness*|*/plugins/synced/*) ;; *) exit 0;; esac; for b in bash /bin/bash /usr/bin/bash /usr/local/bin/bash /opt/homebrew/bin/bash; do command -v "$b" >/dev/null 2>&1 && exec "$b" "${CLAUDE_PLUGIN_ROOT}/hooks/python-launcher.sh" "${CLAUDE_PLUGIN_ROOT}/hooks/run.py" skills/token-optimizer/scripts/measure.py compact-restore --new-session-only --once-per-session; done; exit 0'),
233
+ ('UserPromptSubmit', '', 'command', '[ -n "$CLAUDE_CODE_CONTAINER_ID$CLAUDE_CODE_REMOTE" ] || case "$AI_AGENT$CLAUDE_PLUGIN_ROOT" in *harness*|*/plugins/synced/*) ;; *) exit 0;; esac; for b in bash /bin/bash /usr/bin/bash /usr/local/bin/bash /opt/homebrew/bin/bash; do command -v "$b" >/dev/null 2>&1 && exec "$b" "${CLAUDE_PLUGIN_ROOT}/hooks/python-launcher.sh" "${CLAUDE_PLUGIN_ROOT}/hooks/run.py" skills/token-optimizer/scripts/measure.py ensure-health --once-per-session; done; exit 0'),
234
+ ('UserPromptSubmit', '', 'command', '[ -n "$CLAUDE_CODE_CONTAINER_ID$CLAUDE_CODE_REMOTE" ] || case "$AI_AGENT$CLAUDE_PLUGIN_ROOT" in *harness*|*/plugins/synced/*) ;; *) exit 0;; esac; for b in bash /bin/bash /usr/bin/bash /usr/local/bin/bash /opt/homebrew/bin/bash; do command -v "$b" >/dev/null 2>&1 && exec "$b" "${CLAUDE_PLUGIN_ROOT}/hooks/python-launcher.sh" "${CLAUDE_PLUGIN_ROOT}/hooks/run.py" skills/token-optimizer/scripts/measure.py quality-cache --force --quiet --once-per-session; done; exit 0'),
235
+ ('UserPromptSubmit', '', 'command', 'bash "${CLAUDE_PLUGIN_ROOT}/hooks/python-launcher.sh" "${CLAUDE_PLUGIN_ROOT}/hooks/run.py" skills/token-optimizer/scripts/measure.py prompt-continuity --quiet'),
236
+ ('UserPromptSubmit', '', 'command', 'bash "${CLAUDE_PLUGIN_ROOT}/hooks/python-launcher.sh" "${CLAUDE_PLUGIN_ROOT}/hooks/run.py" skills/token-optimizer/scripts/measure.py quality-cache --warn --quiet'),
237
+ ('UserPromptSubmit', '', 'command', 'bash "${CLAUDE_PLUGIN_ROOT}/hooks/python-launcher.sh" "${CLAUDE_PLUGIN_ROOT}/hooks/run.py" skills/token-optimizer/scripts/measure.py verbosity-steer --quiet'),
238
+ ('UserPromptSubmit', '', 'command', 'for b in bash /bin/bash /usr/bin/bash /usr/local/bin/bash /opt/homebrew/bin/bash; do command -v "$b" >/dev/null 2>&1 && exec "$b" "${CLAUDE_PLUGIN_ROOT}/hooks/python-launcher.sh" "${CLAUDE_PLUGIN_ROOT}/hooks/run.py" hooks/userpromptsubmit_runner.py; done; exit 0'),
239
+ ('UserPromptSubmit', '', 'command', 'for b in bash /bin/bash /usr/bin/bash /usr/local/bin/bash /opt/homebrew/bin/bash; do command -v "$b" >/dev/null 2>&1 && exec "$b" "${CLAUDE_PLUGIN_ROOT}/hooks/python-launcher.sh" "${CLAUDE_PLUGIN_ROOT}/hooks/run.py" skills/token-optimizer/scripts/measure.py compact-restore --new-session-only --once-per-session; done; exit 0'),
240
+ ('UserPromptSubmit', '', 'command', 'for b in bash /bin/bash /usr/bin/bash /usr/local/bin/bash /opt/homebrew/bin/bash; do command -v "$b" >/dev/null 2>&1 && exec "$b" "${CLAUDE_PLUGIN_ROOT}/hooks/python-launcher.sh" "${CLAUDE_PLUGIN_ROOT}/hooks/run.py" skills/token-optimizer/scripts/measure.py ensure-health --once-per-session; done; exit 0'),
241
+ ('UserPromptSubmit', '', 'command', 'for b in bash /bin/bash /usr/bin/bash /usr/local/bin/bash /opt/homebrew/bin/bash; do command -v "$b" >/dev/null 2>&1 && exec "$b" "${CLAUDE_PLUGIN_ROOT}/hooks/python-launcher.sh" "${CLAUDE_PLUGIN_ROOT}/hooks/run.py" skills/token-optimizer/scripts/measure.py prompt-continuity --quiet; done; exit 0'),
242
+ ('UserPromptSubmit', '', 'command', 'for b in bash /bin/bash /usr/bin/bash /usr/local/bin/bash /opt/homebrew/bin/bash; do command -v "$b" >/dev/null 2>&1 && exec "$b" "${CLAUDE_PLUGIN_ROOT}/hooks/python-launcher.sh" "${CLAUDE_PLUGIN_ROOT}/hooks/run.py" skills/token-optimizer/scripts/measure.py quality-cache --force --quiet --once-per-session; done; exit 0'),
243
+ ('UserPromptSubmit', '', 'command', 'for b in bash /bin/bash /usr/bin/bash /usr/local/bin/bash /opt/homebrew/bin/bash; do command -v "$b" >/dev/null 2>&1 && exec "$b" "${CLAUDE_PLUGIN_ROOT}/hooks/python-launcher.sh" "${CLAUDE_PLUGIN_ROOT}/hooks/run.py" skills/token-optimizer/scripts/measure.py quality-cache --warn --quiet; done; exit 0'),
244
+ ('UserPromptSubmit', '', 'command', 'for b in bash /bin/bash /usr/bin/bash /usr/local/bin/bash /opt/homebrew/bin/bash; do command -v "$b" >/dev/null 2>&1 && exec "$b" "${CLAUDE_PLUGIN_ROOT}/hooks/python-launcher.sh" "${CLAUDE_PLUGIN_ROOT}/hooks/run.py" skills/token-optimizer/scripts/measure.py verbosity-steer --quiet; done; exit 0'),
245
+ ('UserPromptSubmit', '', 'command', 'for b in bash /bin/bash /usr/bin/bash /usr/local/bin/bash /opt/homebrew/bin/bash; do command -v "$b" >/dev/null 2>&1 || continue; D="${CLAUDE_PLUGIN_ROOT}"; [ -r "$D/hooks/python-launcher.sh" ] || D="$(ls -d "${D%/*}"/*/ 2>/dev/null | grep -E "/[0-9]+[.][0-9]+[.][0-9]+/$" | sort -V | tail -n1)"; D="${D%/}"; [ -r "$D/hooks/python-launcher.sh" ] || exit 0; exec "$b" "$D/hooks/python-launcher.sh" "$D/hooks/run.py" hooks/userpromptsubmit_runner.py; done; exit 0'),
246
+ ('UserPromptSubmit', '', 'command', 'for b in bash /bin/bash /usr/bin/bash /usr/local/bin/bash /opt/homebrew/bin/bash; do command -v "$b" >/dev/null 2>&1 || continue; D="${CLAUDE_PLUGIN_ROOT}"; [ -r "$D/hooks/python-launcher.sh" ] || D="$(ls -d "${D%[/\\\\]*}"/*/ 2>/dev/null | grep -E "/[0-9]+[.][0-9]+[.][0-9]+/$" | sort -V | tail -n1)"; D="${D%/}"; [ -r "$D/hooks/python-launcher.sh" ] || exit 0; exec "$b" "$D/hooks/python-launcher.sh" "$D/hooks/run.py" hooks/userpromptsubmit_runner.py; done; exit 0'),
247
+ ('UserPromptSubmit', '', 'command', 'for b in bash /bin/bash /usr/bin/bash /usr/local/bin/bash /opt/homebrew/bin/bash; do command -v "$b" >/dev/null 2>&1 || continue; D="${CLAUDE_PLUGIN_ROOT}"; case "$D" in *\\\\*) D="$(printf \'%s\' "$D" | tr \'\\\\\' \'/\')";; esac; [ -r "$D/hooks/python-launcher.sh" ] || D="$(ls -d "${D%/*}"/*/ 2>/dev/null | grep -E "/[0-9]+[.][0-9]+[.][0-9]+/$" | sort -V | tail -n1)"; D="${D%/}"; [ -r "$D/hooks/python-launcher.sh" ] || exit 0; exec "$b" "$D/hooks/python-launcher.sh" "$D/hooks/run.py" hooks/userpromptsubmit_runner.py; done; exit 0'),
248
+ ('UserPromptSubmit', '', 'command', 'for b in bash /bin/bash /usr/bin/bash /usr/local/bin/bash /opt/homebrew/bin/bash; do command -v "$b" >/dev/null 2>&1 || continue; L="${CLAUDE_PLUGIN_ROOT}/hooks/python-launcher.sh"; [ -r "$L" ] || exit 0; exec "$b" "$L" "${CLAUDE_PLUGIN_ROOT}/hooks/run.py" hooks/userpromptsubmit_runner.py; done; exit 0'),
249
+ ('UserPromptSubmit', '', 'command', 'python3 "${CLAUDE_PLUGIN_ROOT}/hooks/run.py" skills/token-optimizer/scripts/measure.py quality-cache --warn --quiet'),
250
+ ))
251
+
252
+ SHIPPED_HOOK_TEMPLATES = frozenset(context[3] for context in SHIPPED_HOOK_CONTEXTS)
@@ -0,0 +1,55 @@
1
+ """Every hook entry Token Optimizer's examples/hooks-starter.json has shipped.
2
+
3
+ GENERATED by scripts/gen_shipped_hook_templates.py from git history of:
4
+ examples/hooks-starter.json
5
+ skills/token-optimizer/examples/hooks-starter.json
6
+ plugins/token-optimizer/skills/token-optimizer/examples/hooks-starter.json
7
+ cowork/token-optimizer/skills/token-optimizer/examples/hooks-starter.json
8
+ Do not edit by hand. Each entry is (event, matcher, hook type, command),
9
+ exact and literal (no instantiation). Script-install users paste these into
10
+ settings.json; measure.py cleanup removes an entry only when its whole
11
+ context is byte-identical to one of these.
12
+ """
13
+
14
+ STARTER_HOOK_CONTEXTS = frozenset((
15
+ ('CwdChanged', '', 'command', 'for b in bash /bin/bash /usr/bin/bash /usr/local/bin/bash /opt/homebrew/bin/bash; do command -v "$b" >/dev/null 2>&1 || continue; L="${CLAUDE_PLUGIN_ROOT:-$HOME/.claude/token-optimizer}/hooks/python-launcher.sh"; [ -r "$L" ] || exit 0; exec "$b" "$L" "${CLAUDE_PLUGIN_ROOT:-$HOME/.claude/token-optimizer}/hooks/run.py" skills/token-optimizer/scripts/read_cache.py --clear --quiet; done; exit 0'),
16
+ ('PostCompact', '', 'command', 'for b in bash /bin/bash /usr/bin/bash /usr/local/bin/bash /opt/homebrew/bin/bash; do command -v "$b" >/dev/null 2>&1 || continue; L="${CLAUDE_PLUGIN_ROOT:-$HOME/.claude/token-optimizer}/hooks/python-launcher.sh"; [ -r "$L" ] || exit 0; exec "$b" "$L" "${CLAUDE_PLUGIN_ROOT:-$HOME/.claude/token-optimizer}/hooks/run.py" skills/token-optimizer/scripts/measure.py quality-cache --force --quiet; done; exit 0'),
17
+ ('PostToolUse', 'Bash|Read|Glob|Grep|Agent|Edit|Write|MultiEdit|NotebookEdit|mcp__.*', 'command', 'for b in bash /bin/bash /usr/bin/bash /usr/local/bin/bash /opt/homebrew/bin/bash; do command -v "$b" >/dev/null 2>&1 || continue; L="${CLAUDE_PLUGIN_ROOT:-$HOME/.claude/token-optimizer}/hooks/python-launcher.sh"; [ -r "$L" ] || exit 0; exec "$b" "$L" "${CLAUDE_PLUGIN_ROOT:-$HOME/.claude/token-optimizer}/hooks/run.py" hooks/posttooluse_runner.py; done; exit 0'),
18
+ ('PostToolUseFailure', 'Bash', 'command', 'for b in bash /bin/bash /usr/bin/bash /usr/local/bin/bash /opt/homebrew/bin/bash; do command -v "$b" >/dev/null 2>&1 || continue; L="${CLAUDE_PLUGIN_ROOT:-$HOME/.claude/token-optimizer}/hooks/python-launcher.sh"; [ -r "$L" ] || exit 0; exec "$b" "$L" "${CLAUDE_PLUGIN_ROOT:-$HOME/.claude/token-optimizer}/hooks/run.py" hooks/posttooluse_runner.py; done; exit 0'),
19
+ ('PreCompact', '', 'command', "python3 '$MEASURE_PY' compact-capture --trigger auto --quiet"),
20
+ ('PreCompact', '', 'command', 'bash "${CLAUDE_PLUGIN_ROOT:-$HOME/.claude/token-optimizer}/hooks/python-launcher.sh" \'$MEASURE_PY\' compact-capture --trigger auto --quiet'),
21
+ ('PreCompact', '', 'command', 'for b in bash /bin/bash /usr/bin/bash /usr/local/bin/bash /opt/homebrew/bin/bash; do command -v "$b" >/dev/null 2>&1 && exec "$b" "${CLAUDE_PLUGIN_ROOT:-$HOME/.claude/token-optimizer}/hooks/python-launcher.sh" \'$MEASURE_PY\' compact-capture --trigger auto --quiet; done; exit 0'),
22
+ ('PreCompact', '', 'command', 'for b in bash /bin/bash /usr/bin/bash /usr/local/bin/bash /opt/homebrew/bin/bash; do command -v "$b" >/dev/null 2>&1 || continue; L="${CLAUDE_PLUGIN_ROOT:-$HOME/.claude/token-optimizer}/hooks/python-launcher.sh"; [ -r "$L" ] || exit 0; exec "$b" "$L" "${CLAUDE_PLUGIN_ROOT:-$HOME/.claude/token-optimizer}/hooks/run.py" skills/token-optimizer/scripts/measure.py compact-capture --trigger auto --quiet; done; exit 0'),
23
+ ('PreCompact', '', 'command', 'for b in bash /bin/bash /usr/bin/bash /usr/local/bin/bash /opt/homebrew/bin/bash; do command -v "$b" >/dev/null 2>&1 || continue; L="${CLAUDE_PLUGIN_ROOT:-$HOME/.claude/token-optimizer}/hooks/python-launcher.sh"; [ -r "$L" ] || exit 0; exec "$b" "$L" "${CLAUDE_PLUGIN_ROOT:-$HOME/.claude/token-optimizer}/hooks/run.py" skills/token-optimizer/scripts/measure.py dynamic-compact-instructions --quiet; done; exit 0'),
24
+ ('PreCompact', '', 'command', 'for b in bash /bin/bash /usr/bin/bash /usr/local/bin/bash /opt/homebrew/bin/bash; do command -v "$b" >/dev/null 2>&1 || continue; L="${CLAUDE_PLUGIN_ROOT:-$HOME/.claude/token-optimizer}/hooks/python-launcher.sh"; [ -r "$L" ] || exit 0; exec "$b" "$L" "${CLAUDE_PLUGIN_ROOT:-$HOME/.claude/token-optimizer}/hooks/run.py" skills/token-optimizer/scripts/read_cache.py --clear --quiet; done; exit 0'),
25
+ ('PreToolUse', 'Agent|Task', 'command', 'for b in bash /bin/bash /usr/bin/bash /usr/local/bin/bash /opt/homebrew/bin/bash; do command -v "$b" >/dev/null 2>&1 || continue; L="${CLAUDE_PLUGIN_ROOT:-$HOME/.claude/token-optimizer}/hooks/python-launcher.sh"; [ -r "$L" ] || exit 0; exec "$b" "$L" "${CLAUDE_PLUGIN_ROOT:-$HOME/.claude/token-optimizer}/hooks/run.py" skills/token-optimizer/scripts/measure.py checkpoint-trigger --milestone pre-fanout --quiet; done; exit 0'),
26
+ ('PreToolUse', 'Bash', 'command', 'for b in bash /bin/bash /usr/bin/bash /usr/local/bin/bash /opt/homebrew/bin/bash; do command -v "$b" >/dev/null 2>&1 || continue; L="${CLAUDE_PLUGIN_ROOT:-$HOME/.claude/token-optimizer}/hooks/python-launcher.sh"; [ -r "$L" ] || exit 0; exec "$b" "$L" "${CLAUDE_PLUGIN_ROOT:-$HOME/.claude/token-optimizer}/hooks/run.py" skills/token-optimizer/scripts/bash_hook.py --quiet; done; exit 0'),
27
+ ('PreToolUse', 'Read', 'command', 'for b in bash /bin/bash /usr/bin/bash /usr/local/bin/bash /opt/homebrew/bin/bash; do command -v "$b" >/dev/null 2>&1 || continue; L="${CLAUDE_PLUGIN_ROOT:-$HOME/.claude/token-optimizer}/hooks/python-launcher.sh"; [ -r "$L" ] || exit 0; exec "$b" "$L" "${CLAUDE_PLUGIN_ROOT:-$HOME/.claude/token-optimizer}/hooks/run.py" skills/token-optimizer/scripts/read_cache.py --quiet; done; exit 0'),
28
+ ('PreToolUse', 'mcp__.*', 'command', 'for b in bash /bin/bash /usr/bin/bash /usr/local/bin/bash /opt/homebrew/bin/bash; do command -v "$b" >/dev/null 2>&1 || continue; L="${CLAUDE_PLUGIN_ROOT:-$HOME/.claude/token-optimizer}/hooks/python-launcher.sh"; [ -r "$L" ] || exit 0; exec "$b" "$L" "${CLAUDE_PLUGIN_ROOT:-$HOME/.claude/token-optimizer}/hooks/run.py" skills/token-optimizer/scripts/refetch_guard.py --quiet; done; exit 0'),
29
+ ('SessionEnd', '', 'command', "python3 '$MEASURE_PY' collect --quiet && python3 '$MEASURE_PY' dashboard --quiet"),
30
+ ('SessionEnd', '', 'command', "python3 '$MEASURE_PY' compact-capture --trigger end --quiet"),
31
+ ('SessionEnd', '', 'command', 'bash "${CLAUDE_PLUGIN_ROOT:-$HOME/.claude/token-optimizer}/hooks/python-launcher.sh" \'$MEASURE_PY\' collect --quiet && $(command -v python3 || command -v python || echo py -3) \'$MEASURE_PY\' dashboard --quiet'),
32
+ ('SessionEnd', '', 'command', 'bash "${CLAUDE_PLUGIN_ROOT:-$HOME/.claude/token-optimizer}/hooks/python-launcher.sh" \'$MEASURE_PY\' compact-capture --trigger end --quiet'),
33
+ ('SessionEnd', '', 'command', 'for b in bash /bin/bash /usr/bin/bash /usr/local/bin/bash /opt/homebrew/bin/bash; do command -v "$b" >/dev/null 2>&1 && exec "$b" "${CLAUDE_PLUGIN_ROOT:-$HOME/.claude/token-optimizer}/hooks/python-launcher.sh" \'$MEASURE_PY\' compact-capture --trigger end --quiet; done; exit 0'),
34
+ ('SessionEnd', '', 'command', 'for b in bash /bin/bash /usr/bin/bash /usr/local/bin/bash /opt/homebrew/bin/bash; do command -v "$b" >/dev/null 2>&1 && exec "$b" "${CLAUDE_PLUGIN_ROOT:-$HOME/.claude/token-optimizer}/hooks/python-launcher.sh" \'$MEASURE_PY\' session-end-flush --trigger end; done; exit 0'),
35
+ ('SessionEnd', '', 'command', 'for b in bash /bin/bash /usr/bin/bash /usr/local/bin/bash /opt/homebrew/bin/bash; do command -v "$b" >/dev/null 2>&1 || continue; "$b" "${CLAUDE_PLUGIN_ROOT:-$HOME/.claude/token-optimizer}/hooks/python-launcher.sh" \'$MEASURE_PY\' collect --quiet && $(command -v python3 || command -v python || echo py -3) \'$MEASURE_PY\' dashboard --quiet; exit; done; exit 0'),
36
+ ('SessionEnd', '', 'command', 'for b in bash /bin/bash /usr/bin/bash /usr/local/bin/bash /opt/homebrew/bin/bash; do command -v "$b" >/dev/null 2>&1 || continue; L="${CLAUDE_PLUGIN_ROOT:-$HOME/.claude/token-optimizer}/hooks/python-launcher.sh"; [ -r "$L" ] || exit 0; exec "$b" "$L" "${CLAUDE_PLUGIN_ROOT:-$HOME/.claude/token-optimizer}/hooks/run.py" hooks/stop_runner.py; done; exit 0'),
37
+ ('SessionStart', '', 'command', "python3 '$MEASURE_PY' compact-restore --new-session-only"),
38
+ ('SessionStart', '', 'command', 'bash "${CLAUDE_PLUGIN_ROOT:-$HOME/.claude/token-optimizer}/hooks/python-launcher.sh" \'$MEASURE_PY\' compact-restore --new-session-only'),
39
+ ('SessionStart', '', 'command', 'for b in bash /bin/bash /usr/bin/bash /usr/local/bin/bash /opt/homebrew/bin/bash; do command -v "$b" >/dev/null 2>&1 && exec "$b" "${CLAUDE_PLUGIN_ROOT:-$HOME/.claude/token-optimizer}/hooks/python-launcher.sh" \'$MEASURE_PY\' compact-restore --new-session-only; done; exit 0'),
40
+ ('SessionStart', '', 'command', 'for b in bash /bin/bash /usr/bin/bash /usr/local/bin/bash /opt/homebrew/bin/bash; do command -v "$b" >/dev/null 2>&1 && exec "$b" "${CLAUDE_PLUGIN_ROOT:-$HOME/.claude/token-optimizer}/hooks/python-launcher.sh" \'$MEASURE_PY\' ensure-health --once-mark; done; exit 0'),
41
+ ('SessionStart', '', 'command', 'for b in bash /bin/bash /usr/bin/bash /usr/local/bin/bash /opt/homebrew/bin/bash; do command -v "$b" >/dev/null 2>&1 || continue; L="${CLAUDE_PLUGIN_ROOT:-$HOME/.claude/token-optimizer}/hooks/python-launcher.sh"; [ -r "$L" ] || exit 0; exec "$b" "$L" "${CLAUDE_PLUGIN_ROOT:-$HOME/.claude/token-optimizer}/hooks/run.py" hooks/sessionstart_runner.py; done; exit 0'),
42
+ ('SessionStart', 'compact', 'command', "python3 '$MEASURE_PY' compact-restore"),
43
+ ('SessionStart', 'compact', 'command', 'bash "${CLAUDE_PLUGIN_ROOT:-$HOME/.claude/token-optimizer}/hooks/python-launcher.sh" \'$MEASURE_PY\' compact-restore --compact'),
44
+ ('SessionStart', 'compact', 'command', 'bash "${CLAUDE_PLUGIN_ROOT:-$HOME/.claude/token-optimizer}/hooks/python-launcher.sh" \'$MEASURE_PY\' compact-restore'),
45
+ ('SessionStart', 'compact', 'command', 'for b in bash /bin/bash /usr/bin/bash /usr/local/bin/bash /opt/homebrew/bin/bash; do command -v "$b" >/dev/null 2>&1 && exec "$b" "${CLAUDE_PLUGIN_ROOT:-$HOME/.claude/token-optimizer}/hooks/python-launcher.sh" \'$MEASURE_PY\' compact-restore --compact; done; exit 0'),
46
+ ('Stop', '', 'command', "python3 '$MEASURE_PY' compact-capture --trigger stop --quiet"),
47
+ ('Stop', '', 'command', 'bash "${CLAUDE_PLUGIN_ROOT:-$HOME/.claude/token-optimizer}/hooks/python-launcher.sh" \'$MEASURE_PY\' compact-capture --trigger stop --quiet'),
48
+ ('Stop', '', 'command', 'for b in bash /bin/bash /usr/bin/bash /usr/local/bin/bash /opt/homebrew/bin/bash; do command -v "$b" >/dev/null 2>&1 && exec "$b" "${CLAUDE_PLUGIN_ROOT:-$HOME/.claude/token-optimizer}/hooks/python-launcher.sh" \'$MEASURE_PY\' compact-capture --trigger stop --quiet; done; exit 0'),
49
+ ('Stop', '', 'command', 'for b in bash /bin/bash /usr/bin/bash /usr/local/bin/bash /opt/homebrew/bin/bash; do command -v "$b" >/dev/null 2>&1 || continue; L="${CLAUDE_PLUGIN_ROOT:-$HOME/.claude/token-optimizer}/hooks/python-launcher.sh"; [ -r "$L" ] || exit 0; exec "$b" "$L" "${CLAUDE_PLUGIN_ROOT:-$HOME/.claude/token-optimizer}/hooks/run.py" hooks/stop_runner.py; done; exit 0'),
50
+ ('StopFailure', '', 'command', 'for b in bash /bin/bash /usr/bin/bash /usr/local/bin/bash /opt/homebrew/bin/bash; do command -v "$b" >/dev/null 2>&1 || continue; L="${CLAUDE_PLUGIN_ROOT:-$HOME/.claude/token-optimizer}/hooks/python-launcher.sh"; [ -r "$L" ] || exit 0; exec "$b" "$L" "${CLAUDE_PLUGIN_ROOT:-$HOME/.claude/token-optimizer}/hooks/run.py" skills/token-optimizer/scripts/measure.py compact-capture --trigger stop-failure --quiet; done; exit 0'),
51
+ ('UserPromptSubmit', '', 'command', "python3 '$MEASURE_PY' quality-cache --warn --quiet"),
52
+ ('UserPromptSubmit', '', 'command', 'bash "${CLAUDE_PLUGIN_ROOT:-$HOME/.claude/token-optimizer}/hooks/python-launcher.sh" \'$MEASURE_PY\' quality-cache --warn --quiet'),
53
+ ('UserPromptSubmit', '', 'command', 'for b in bash /bin/bash /usr/bin/bash /usr/local/bin/bash /opt/homebrew/bin/bash; do command -v "$b" >/dev/null 2>&1 && exec "$b" "${CLAUDE_PLUGIN_ROOT:-$HOME/.claude/token-optimizer}/hooks/python-launcher.sh" \'$MEASURE_PY\' quality-cache --warn --quiet; done; exit 0'),
54
+ ('UserPromptSubmit', '', 'command', 'for b in bash /bin/bash /usr/bin/bash /usr/local/bin/bash /opt/homebrew/bin/bash; do command -v "$b" >/dev/null 2>&1 || continue; L="${CLAUDE_PLUGIN_ROOT:-$HOME/.claude/token-optimizer}/hooks/python-launcher.sh"; [ -r "$L" ] || exit 0; exec "$b" "$L" "${CLAUDE_PLUGIN_ROOT:-$HOME/.claude/token-optimizer}/hooks/run.py" hooks/userpromptsubmit_runner.py; done; exit 0'),
55
+ ))