npx claudepluginhub nbkm8y5/claude-plugins --plugin token-economicsDefined in hooks/hooks.json
{
"PreCompact": [
{
"hooks": [
{
"type": "prompt",
"prompt": "The context window is about to be compressed, which means this session has consumed significant tokens. Before compression, briefly assess token efficiency: (1) Were there avoidable full-file reads that could have used line ranges? (2) Were there repeated reads of the same file? (3) Were there Bash commands that produced massive output that could have been filtered? (4) Were there tool calls that didn't contribute to progress? Write a brief cost note (under 20 lines) to .claude/token-efficiency.md with specific wasteful patterns observed and how to avoid them going forward. This file persists as a reference for future sessions."
}
],
"matcher": ""
}
],
"PreToolUse": [
{
"hooks": [
{
"type": "prompt",
"prompt": "Before reading this file, consider: Do you already know what you need from this file? If so, use the offset and limit parameters to read only the relevant section rather than the entire file. If the file is likely large (>500 lines) and you only need a specific function or section, use Grep first to find the line number, then Read with offset. This is a soft reminder, not a block."
}
],
"matcher": "Read"
}
]
}"{\"riskFlags\": {\"touchesBash\": false, \"matchAllTools\": false, \"touchesFileWrites\": false}, \"typeStats\": {\"prompt\": 2}, \"eventStats\": {\"PreCompact\": 1, \"PreToolUse\": 1}, \"originCounts\": {\"absolutePaths\": 0, \"pluginScripts\": 0, \"projectScripts\": 0}, \"timeoutStats\": {\"commandsWithoutTimeout\": 0}}"