2025-07-19 21:03:13 -06:00
# Claude Hooks
2025-07-19 18:25:34 -06:00
2025-07-19 21:03:13 -06:00
Intelligent hooks system for Claude Code that provides command validation, session continuity, and learning capabilities using Claude Code's native hooks architecture.
2025-07-19 18:25:34 -06:00
2025-07-19 21:03:13 -06:00
## Quick Start
2025-07-19 18:25:34 -06:00
2025-07-19 21:03:13 -06:00
```bash
# Install globally via npm
npm install -g claude-hooks
2025-07-19 18:25:34 -06:00
2025-07-19 21:03:13 -06:00
# Initialize hooks
claude-hooks init
2025-07-19 18:25:34 -06:00
2025-07-19 21:03:13 -06:00
# Test installation
claude-hooks test
2025-07-19 18:25:34 -06:00
2025-07-19 21:03:13 -06:00
# Restart Claude Code to activate
2025-07-19 18:25:34 -06:00
```
2025-07-19 21:03:13 -06:00
## Features
🧠 **Shadow Learning** - Learns from command failures and suggests working alternatives
📊 **Context Monitoring** - Automatically backs up work before context limits
⚡ **Smart Validation** - Blocks dangerous commands with intelligent suggestions
🔄 **Session Continuity** - Maintains history and state across Claude restarts
## Usage
2025-07-19 18:25:34 -06:00
2025-07-19 21:03:13 -06:00
After installation, Claude Hooks runs automatically:
- **Command Learning**: Try `pip install requests` → suggests `pip3 install requests`
- **Auto Backup**: Triggers before context limits or manually with `claude-hooks backup`
- **Status Check**: Run `claude-hooks status` to verify installation
- **Manual Test**: Use `claude-hooks test` to verify all components
## Commands
2025-07-19 18:25:34 -06:00
```bash
2025-07-19 21:03:13 -06:00
claude-hooks init # Initialize after npm install
claude-hooks status # Check installation status
claude-hooks test # Run test suite
claude-hooks backup # Create manual backup
claude-hooks uninstall # Remove hooks configuration
claude-hooks --help # Show all commands
2025-07-19 18:25:34 -06:00
```
2025-07-19 21:03:13 -06:00
## How It Works
2025-07-19 18:25:34 -06:00
2025-07-19 21:03:13 -06:00
Claude Hooks uses Claude Code's native hook system with four key integration points:
2025-07-19 18:25:34 -06:00
2025-07-19 21:03:13 -06:00
- **UserPromptSubmit**: Monitors context usage and triggers backups
- **PreToolUse[Bash]**: Validates commands and suggests alternatives
- **PostToolUse[*]**: Logs activity and learns from patterns
- **Stop**: Finalizes sessions and creates continuation docs
2025-07-19 18:25:34 -06:00
2025-07-19 21:03:13 -06:00
## Installation Methods
2025-07-19 18:25:34 -06:00
2025-07-19 21:03:13 -06:00
### NPM (Recommended)
```bash
npm install -g claude-hooks
claude-hooks init
```
2025-07-19 18:25:34 -06:00
2025-07-19 21:03:13 -06:00
### Git (Development)
```bash
git clone https://git.supported.systems/rsp2k/claude-hooks.git
cd claude-hooks & & ./scripts/install.sh
```
2025-07-19 18:25:34 -06:00
2025-07-19 21:03:13 -06:00
## Documentation
2025-07-19 18:25:34 -06:00
2025-07-19 21:03:13 -06:00
- [Getting Started Tutorial ](docs/tutorial/getting-started.md )
- [Architecture Explanation ](docs/explanation/architecture.md )
- [How-to Guides ](docs/how-to/ )
- [Reference Documentation ](docs/reference/ )
2025-07-19 18:25:34 -06:00
## Requirements
2025-07-20 03:12:51 -06:00
- **Node.js** 16+ (only runtime required)
2025-07-19 21:03:13 -06:00
- **Claude Code** (hooks integrate with Claude's native system)
2025-07-19 18:25:34 -06:00
## License
MIT License - see [LICENSE ](LICENSE ) for details.
---
*Claude Code Hooks makes your AI assistant smarter by giving it memory, environmental awareness, and the ability to learn from experience.*