Defined in hooks/hooks.json
{
"Stop": [
{
"hooks": [
{
"type": "command",
"command": "${CLAUDE_PLUGIN_ROOT}/scripts/session-summary.sh",
"timeout": 30
},
{
"type": "command",
"command": "${CLAUDE_PLUGIN_ROOT}/scripts/collect-cleanup-context.sh",
"timeout": 30
},
{
"type": "prompt",
"prompt": "You are a cleanup recommendation assistant for claude-code-harness.\n\nAnalyze the project context and determine if cleanup should be recommended.\n\nProject Context:\n$ARGUMENTS\n\n## Evaluation Criteria\n\nRecommend cleanup (/cleanup command) when ANY of the following conditions are met:\n\n1. **Completed Task Accumulation**: 10+ completed tasks (cc:完了 or pm:確認済 (compat: cursor:確認済))\n2. **Old Completed Tasks**: Completed tasks older than 7 days exist\n3. **Large Plans.md**: Over 200 lines\n4. **Large Session Log**: session-log.md over 500 lines\n5. **Large CLAUDE.md**: Over 100 lines (suggest splitting to .claude/rules/)\n\n## Response Format\n\nRespond with JSON only:\n```json\n{\n \"decision\": \"approve\",\n \"reason\": \"Brief explanation\",\n \"systemMessage\": \"Optional: Cleanup recommended: [specific suggestion] (run /cleanup)\"\n}\n```\n\n- If cleanup IS recommended: Include a `systemMessage` with the specific recommendation\n- If cleanup is NOT needed: Set `systemMessage` to empty string or omit it\n- Always set `decision` to `approve` (we don't want to block the stop)\n\nAnalyze the context and provide your recommendation.",
"timeout": 30
},
{
"type": "prompt",
"prompt": "You are a Plans.md hygiene reminder assistant for claude-code-harness.\n\nYour goal: prevent forgetting to update Plans.md markers after finishing work, especially in solo PM↔Impl operation.\n\nProject Context:\n$ARGUMENTS\n\n## What to check\n\n- If there are session changes (session.changes_this_session > 0) OR git has uncommitted changes (git.uncommitted_changes > 0)\n- AND Plans.md exists\n\nThen remind the user to update Plans.md markers if needed:\n\n- If pm_pending_tasks > 0: PM has pending requests → make sure the intended tasks are marked `pm:依頼中` (compat: cursor:依頼中)\n- If cc_wip_tasks > 0: Impl has WIP tasks → ensure WIP is accurate; if work is done, change to `cc:完了`\n- If cc_done_tasks > 0: Impl has finished tasks → PM should review and then change to `pm:確認済`\n\nAlso suggest the handoff commands:\n- PM→Impl: /handoff-to-impl-claude\n- Impl→PM: /handoff-to-pm-claude\n\n## Response Format\n\nRespond with JSON only:\n```json\n{\n \"decision\": \"approve\",\n \"reason\": \"Brief explanation\",\n \"systemMessage\": \"Optional: Japanese reminder message\"\n}\n```\n\nRules:\n- Always decision=approve.\n- If everything looks consistent (no changes and no markers to manage), systemMessage should be empty.\n- systemMessage must be in Japanese and concise, and include concrete next commands when applicable.",
"timeout": 30
}
]
}
],
"PreToolUse": [
{
"hooks": [
{
"type": "command",
"command": "${CLAUDE_PLUGIN_ROOT}/scripts/pretooluse-guard.sh",
"timeout": 30
}
],
"matcher": "Write|Edit|Bash"
}
],
"PostToolUse": [
{
"hooks": [
{
"type": "command",
"command": "${CLAUDE_PLUGIN_ROOT}/scripts/auto-cleanup-hook.sh",
"timeout": 30
},
{
"type": "command",
"command": "${CLAUDE_PLUGIN_ROOT}/scripts/track-changes.sh",
"timeout": 30
},
{
"type": "command",
"command": "${CLAUDE_PLUGIN_ROOT}/scripts/auto-test-runner.sh",
"timeout": 30
},
{
"type": "command",
"command": "${CLAUDE_PLUGIN_ROOT}/scripts/plans-watcher.sh",
"timeout": 30
}
],
"matcher": "Write|Edit"
}
],
"SessionStart": [
{
"hooks": [
{
"type": "command",
"command": "${CLAUDE_PLUGIN_ROOT}/scripts/session-init.sh",
"timeout": 30
},
{
"type": "command",
"command": "${CLAUDE_PLUGIN_ROOT}/scripts/session-monitor.sh",
"timeout": 30
}
],
"matcher": "startup"
}
],
"PermissionRequest": [
{
"hooks": [
{
"type": "command",
"command": "${CLAUDE_PLUGIN_ROOT}/scripts/permission-request.sh",
"timeout": 30
}
],
"matcher": "Bash"
}
]
}{
"riskFlags": {
"touchesBash": true,
"matchAllTools": false,
"touchesFileWrites": true
},
"typeStats": {
"prompt": 2,
"command": 9
},
"eventStats": {
"Stop": 4,
"PreToolUse": 1,
"PostToolUse": 4,
"SessionStart": 2
},
"originCounts": {
"absolutePaths": 0,
"pluginScripts": 9,
"projectScripts": 0
},
"timeoutStats": {
"commandsWithoutTimeout": 0
}
}