NomenAK 9edf3f8802 docs: Complete Framework-Hooks documentation overhaul
Major documentation update focused on technical accuracy and developer clarity:

Documentation Changes:
- Rewrote README.md with focus on hooks system architecture
- Updated all core docs (Overview, Integration, Performance) to match implementation
- Created 6 missing configuration docs for undocumented YAML files
- Updated all 7 hook docs to reflect actual Python implementations
- Created docs for 2 missing shared modules (intelligence_engine, validate_system)
- Updated all 5 pattern docs with real YAML examples
- Added 4 essential operational docs (INSTALLATION, TROUBLESHOOTING, CONFIGURATION, QUICK_REFERENCE)

Key Improvements:
- Removed all marketing language in favor of humble technical documentation
- Fixed critical configuration discrepancies (logging defaults, performance targets)
- Used actual code examples and configuration from implementation
- Complete coverage: 15 configs, 10 modules, 7 hooks, 3 pattern tiers
- Based all documentation on actual file review and code analysis

Technical Accuracy:
- Corrected performance targets to match performance.yaml
- Fixed timeout values from settings.json (10-15 seconds)
- Updated module count and descriptions to match actual shared/ directory
- Aligned all examples with actual YAML and Python implementations

The documentation now provides accurate, practical information for developers
working with the Framework-Hooks system, focusing on what it actually does
rather than aspirational features.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-06 15:13:07 +02:00

244 lines
6.2 KiB
Markdown

# Hook Settings Configuration (`settings.json`)
## Overview
The `settings.json` file defines the Claude Code hook configuration settings for the SuperClaude-Lite framework. This file registers all framework hooks with Claude Code and specifies their execution parameters.
## Purpose and Role
This configuration provides:
- **Hook Registration**: Registers all 7 SuperClaude hooks with Claude Code
- **Execution Configuration**: Defines command paths, timeouts, and execution patterns
- **Universal Matching**: Applies hooks to all operations through `"matcher": "*"`
- **Timeout Management**: Establishes execution time limits for each hook
## Configuration Structure
### Basic Pattern
```json
{
"hooks": {
"HookName": [
{
"matcher": "*",
"hooks": [
{
"type": "command",
"command": "python3 ~/.claude/hooks/script.py",
"timeout": 15
}
]
}
]
}
}
```
### Hook Definitions
The actual configuration registers these hooks:
#### SessionStart Hook
```json
"SessionStart": [
{
"matcher": "*",
"hooks": [
{
"type": "command",
"command": "python3 ~/.claude/hooks/session_start.py",
"timeout": 10
}
]
}
]
```
**Purpose**: Initialize sessions and detect project context
**Timeout**: 10 seconds for session initialization
**Execution**: Runs at the start of every Claude Code session
#### PreToolUse Hook
```json
"PreToolUse": [
{
"matcher": "*",
"hooks": [
{
"type": "command",
"command": "python3 ~/.claude/hooks/pre_tool_use.py",
"timeout": 15
}
]
}
]
```
**Purpose**: Pre-process tool usage and provide intelligent routing
**Timeout**: 15 seconds for analysis and routing decisions
**Execution**: Runs before every tool use operation
#### PostToolUse Hook
```json
"PostToolUse": [
{
"matcher": "*",
"hooks": [
{
"type": "command",
"command": "python3 ~/.claude/hooks/post_tool_use.py",
"timeout": 10
}
]
}
]
```
**Purpose**: Post-process tool results and apply quality gates
**Timeout**: 10 seconds for result analysis and validation
**Execution**: Runs after every tool use operation
#### PreCompact Hook
```json
"PreCompact": [
{
"matcher": "*",
"hooks": [
{
"type": "command",
"command": "python3 ~/.claude/hooks/pre_compact.py",
"timeout": 15
}
]
}
]
```
**Purpose**: Apply intelligent compression before context compaction
**Timeout**: 15 seconds for compression analysis and application
**Execution**: Runs before Claude Code compacts conversation context
#### Notification Hook
```json
"Notification": [
{
"matcher": "*",
"hooks": [
{
"type": "command",
"command": "python3 ~/.claude/hooks/notification.py",
"timeout": 10
}
]
}
]
```
**Purpose**: Handle notifications and update learning patterns
**Timeout**: 10 seconds for notification processing
**Execution**: Runs when Claude Code sends notifications
#### Stop Hook
```json
"Stop": [
{
"matcher": "*",
"hooks": [
{
"type": "command",
"command": "python3 ~/.claude/hooks/stop.py",
"timeout": 15
}
]
}
]
```
**Purpose**: Session cleanup and analytics generation
**Timeout**: 15 seconds for cleanup and analysis
**Execution**: Runs when Claude Code session ends
#### SubagentStop Hook
```json
"SubagentStop": [
{
"matcher": "*",
"hooks": [
{
"type": "command",
"command": "python3 ~/.claude/hooks/subagent_stop.py",
"timeout": 15
}
]
}
]
```
**Purpose**: Subagent coordination and task management analytics
**Timeout**: 15 seconds for subagent cleanup
**Execution**: Runs when Claude Code subagent sessions end
## Key Configuration Elements
### Universal Matcher
- **Pattern**: `"matcher": "*"`
- **Effect**: All hooks apply to every operation
- **Purpose**: Ensures consistent framework behavior across all interactions
### Command Type
- **Type**: `"command"`
- **Execution**: Runs external Python scripts
- **Environment**: Uses system Python 3 installation
### File Paths
- **Location**: `~/.claude/hooks/`
- **Naming**: Matches hook names in snake_case (e.g., `session_start.py`)
- **Permissions**: Scripts must be executable
### Timeout Values
- **SessionStart**: 10 seconds (session initialization)
- **PreToolUse**: 15 seconds (analysis and routing)
- **PostToolUse**: 10 seconds (result processing)
- **PreCompact**: 15 seconds (compression)
- **Notification**: 10 seconds (notification handling)
- **Stop**: 15 seconds (cleanup and analytics)
- **SubagentStop**: 15 seconds (subagent coordination)
## Installation Requirements
### File Installation
The framework installation process must:
1. Copy Python hook scripts to `~/.claude/hooks/`
2. Set executable permissions on all hook scripts
3. Install this `settings.json` file for Claude Code to read
4. Verify Python 3 is available in the system PATH
### Dependencies
- Python 3.7+ installation
- Required Python packages (see hook implementations)
- Read/write access to `~/.claude/hooks/` directory
- Network access for MCP server communication (if used)
## Troubleshooting
### Hook Not Executing
- **Check file paths**: Verify scripts exist at specified locations
- **Check permissions**: Ensure scripts are executable
- **Check Python**: Verify Python 3 is available in PATH
- **Check timeouts**: Increase timeout if hooks are timing out
### Performance Issues
- **Timeout Tuning**: Adjust timeout values for your system performance
- **Hook Optimization**: Review hook configuration files for performance settings
- **Parallel Execution**: Some hooks can be optimized for parallel execution
### Path Issues
- **Absolute Paths**: Use absolute paths if relative paths cause issues
- **User Directory**: Ensure `~/.claude/hooks/` expands correctly in your environment
- **File Permissions**: Verify both read and execute permissions on hook files
## Related Documentation
- **Hook Implementation**: Individual hook Python files for specific behavior
- **Configuration Files**: YAML configuration files for hook behavior tuning
- **Installation Guide**: Framework installation and setup documentation