https://github.com/bdmorin/eyelet
Eyelet - Claude Code Hook Orchestration Framework
https://github.com/bdmorin/eyelet
ai-agents claude-code claude-hook claude-hooks eyelet hook-orchestration python-cli
Last synced: 4 months ago
JSON representation
Eyelet - Claude Code Hook Orchestration Framework
- Host: GitHub
- URL: https://github.com/bdmorin/eyelet
- Owner: bdmorin
- License: mit
- Created: 2025-07-28T20:59:54.000Z (6 months ago)
- Default Branch: main
- Last Pushed: 2025-07-28T22:34:30.000Z (6 months ago)
- Last Synced: 2025-07-29T01:29:54.137Z (6 months ago)
- Topics: ai-agents, claude-code, claude-hook, claude-hooks, eyelet, hook-orchestration, python-cli
- Language: Python
- Homepage:
- Size: 127 KB
- Stars: 1
- Watchers: 0
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# ๐ Eyelet - Hook Orchestration for AI Agents
> "Thread through the eyelet!" - A sophisticated hook management system for AI agent workflows
[](https://www.python.org/)
[](https://badge.fury.io/py/eyelet)
[](https://github.com/astral-sh/uv)
[](LICENSE)
[](https://github.com/bdmorin/eyelet/actions/workflows/ci.yml)
[](https://github.com/bdmorin/eyelet)
## ๐ New in v0.3.5: TUI Exit Fix!
### v0.3.4 Updates
- **Auto-update support**: `--autoupdate` flag for install-all command
- **Version detection**: Doctor command warns about unpinned versions
- **Critical fix**: Execute command now supports both hook_type and hook_event_name
- **Enhanced doctor**: Clear guidance on enabling auto-updates
### v0.3.3 Updates (Hotfix)
- Fixed missing TUI module in PyPI package
- Added .tcss file to package data
### v0.3.2 Updates
- **Recall Feature**: Search Claude Code conversation history with `eyelet recall`
- **TUI Framework**: Complete Textual-based UI (experimental)
- **Test Improvements**: Better test coverage and pytest-asyncio support
### v0.3.0 Features
**SQLite database logging support!** Choose between JSON files, SQLite database, or both:
```bash
# Enable SQLite logging
uvx eyelet configure logging --format sqlite
# Use both JSON and SQLite
uvx eyelet configure logging --format json,sqlite
# Query your hook data
uvx eyelet query search --text "error"
uvx eyelet query summary --last 24h
```
## ๐ฆ About
Eyelet provides comprehensive management, templating, and execution handling for AI agent hooks. Like an eyelet that securely connects hooks to fabric, Eyelet connects and orchestrates your AI agent's behavior through a reliable workflow system.
## โจ Features
- ๐ช **Universal Hook Support** - Captures all Claude Code hook types โ
- ๐พ **Flexible Logging** - JSON files, SQLite database, or both โ
- ๐ **Powerful Queries** - Search, filter, and analyze your hook data โ
- ๐ฅ **Health Monitoring** - `eyelet doctor` checks your configuration โ
- ๐ **Zero Config** - `eyelet configure install-all` sets up everything โ
- ๐ **Rich Analytics** - Session summaries, error analysis, and more โ
- ๐ง **Git Integration** - Automatic Git metadata enrichment โ
- โก **High Performance** - SQLite with WAL mode for concurrent access โ
## ๐ Quick Start
```bash
# Install universal logging for ALL hooks with auto-updates
uvx eyelet configure install-all --autoupdate
# Or install without auto-updates (manual updates required)
uvx eyelet configure install-all
# Enable SQLite logging for better performance
uvx eyelet configure logging --format sqlite
# Check your configuration health (detects unpinned versions)
uvx eyelet doctor
# Query your hook data
uvx eyelet query summary # Session overview
uvx eyelet query search --help # Search options
uvx eyelet query errors # Debug issues
```
### ๐ Web Dashboard
The web dashboard provides real-time monitoring of all eyelet databases. Since it requires additional dependencies, you have three options:
```bash
# Option 1: Install locally with web dependencies
uv add eyelet[web] fastapi uvicorn[standard] jinja2
eyelet dashboard web --open-browser
# Option 2: Use uvx with dependencies (one-time setup)
uvx --with fastapi --with "uvicorn[standard]" --with jinja2 eyelet dashboard web -o
# Option 3: Use CLI-only commands (no web dependencies required)
uvx eyelet dashboard metrics # Static metrics
uvx eyelet dashboard hooks # Recent hooks table
uvx eyelet dashboard search "error" # Search across databases
```
The web dashboard automatically finds available ports (preferring 443) and generates sslip.io URLs for easy access.
### โ ๏ธ Important: Keeping Eyelet Updated
When using `uvx`, eyelet runs in an isolated environment. To ensure you're using the latest version:
1. **Always use @latest tag** (recommended):
```bash
uvx eyelet@latest [command]
```
This fetches the latest version from PyPI every time.
2. **For persistent installation with uv**:
```bash
uv tool install eyelet@latest # Install latest
uv tool install --reinstall eyelet@latest # Force reinstall
```
3. **Enable auto-updates in hooks**:
```bash
uvx eyelet configure install-all --autoupdate
```
This configures hooks to use `uvx eyelet@latest` which always fetches the latest version.
4. **Check current version**:
```bash
uvx eyelet --version
```
5. **Use pipx for global installation** (auto-updatable):
```bash
pipx install eyelet
pipx upgrade eyelet # When updates are available
```
See [Update Guide](docs/UPDATE_GUIDE.md) for detailed update instructions.
Run `eyelet doctor` to check if your hooks are configured for auto-updates.
### ๐ง Integration with mise
If you're using [mise](https://mise.jdx.dev/) for project management, add eyelet to your `.mise.toml`:
```toml
# .mise.toml or mise.toml
[tools]
python = "3.11"
[tasks.hooks-install]
description = "Install eyelet hooks for Claude Code"
run = "uvx eyelet@latest configure install-all --autoupdate"
[tasks.hooks-doctor]
description = "Check eyelet configuration and version"
run = """
uvx eyelet@latest doctor
echo "๐ Version: $(uvx eyelet@latest --version)"
"""
[tasks.hooks-logs]
description = "View recent hook logs"
run = "uvx eyelet@latest logs --tail 20"
# Shortcuts
[tasks.hd]
alias = "hooks-doctor"
```
Then use:
```bash
mise run hooks-install # Set up eyelet hooks
mise run hd # Check configuration (shortcut)
mise run hooks-logs # View recent logs
```
See [full example](.mise.toml) for more tasks and options.
**Note:** Eyelet is designed to run via `uvx`. Local installation may require additional configuration (YMMV).
## ๐ฏ Universal Hook Handler
Eyelet includes a powerful universal hook handler that logs EVERY Claude Code hook to a structured directory:
```bash
# Install logging for all hooks with one command
uvx eyelet configure install-all
# Your hooks will be logged to:
./eyelet-hooks/
โโโ PreToolUse/
โ โโโ Bash/2025-07-28/
โ โโโ 20250728_133300_236408_PreToolUse_Bash.json
โโโ PostToolUse/
โ โโโ Read/2025-07-28/
โโโ UserPromptSubmit/2025-07-28/
โโโ Stop/2025-07-28/
โโโ PreCompact/manual/2025-07-28/
```
Each log contains:
- Complete input data from Claude Code
- Environment variables and context
- Timestamps (ISO and Unix)
- Session information
- Tool inputs/outputs
- Python version and platform details
## ๐ฏ Features
- **Dynamic Hook Discovery** - Automatically detects new tools and generates all valid hook combinations โ
- **Beautiful TUI** - Navigate with a Textual-powered interface for reliable connections โ
- **Template System** - Deploy pre-configured hook patterns with a single command โ
- **Workflow Engine** - Chain complex behaviors with conditional logic โ (Not implemented - raises NotImplementedError)
- **Comprehensive Logging** - Track every hook execution in SQLite or filesystem โ
- **AI Integration** - Native Claude Code SDK support for intelligent workflows โ
- **Real-time Monitoring** - Watch hook executions as they happen โ
(via `eyelet logs --follow`)
## ๐ Documentation
- [Installation Guide](docs/installation.md)
- [Hook Types & Matchers](docs/hooks.md)
- [Creating Workflows](docs/workflows.md)
- [Template Library](docs/templates.md)
- [API Reference](docs/api.md)
## ๐ ๏ธ Commands
```bash
# Core Operations
uvx eyelet configure # Configure hooks โ
uvx eyelet configure logging # Manage logging settings (JSON/SQLite) โ
uvx eyelet execute # Run as hook endpoint โ
uvx eyelet logs # View JSON execution logs โ
uvx eyelet doctor # Health check and diagnostics โ
uvx eyelet recall # Search Claude Code conversations (NEW!) โ
# Query & Analytics (SQLite)
uvx eyelet query search # Full-text search with filters โ
uvx eyelet query summary # Session and hook statistics โ
uvx eyelet query errors # Error analysis and debugging โ
uvx eyelet query session # View specific session logs โ
uvx eyelet query grep # Pattern matching across logs โ
# Discovery & Templates
uvx eyelet discover # Find available hooks โ
uvx eyelet template list # Browse templates โ
uvx eyelet template install # Deploy a template โ
```
## ๐พ SQLite Logging
Eyelet's SQLite logging provides powerful analytics and querying capabilities:
```bash
# Enable SQLite logging
uvx eyelet configure logging --format sqlite
# Search for specific patterns
uvx eyelet query search --text "error" --tool Bash --last 1h
# Get session summary
uvx eyelet query summary --format json
# Analyze errors
uvx eyelet query errors --last 24h
# Export specific session
uvx eyelet query session --format json > session.json
```
### Why SQLite?
- โก **Fast queries** across millions of hooks
- ๐ **Full-text search** with advanced filters
- ๐ **Analytics** without external dependencies
- ๐ **Concurrent access** with WAL mode
- ๐พ **Compact storage** compared to JSON files
## ๐จ Example Hook Configuration
```json
{
"hooks": [{
"type": "PreToolUse",
"matcher": "Bash",
"handler": {
"type": "command",
"command": "uvx eyelet execute --log-only"
}
}]
}
```
## ๐ JSON Validation & Linting
Eyelet provides built-in validation for Claude settings files and VS Code integration:
```bash
# Validate your Claude settings
uvx eyelet validate settings
# Validate a specific file
uvx eyelet validate settings ~/.claude/settings.json
```
### VS Code Integration
The project includes a JSON schema for Claude settings files. VS Code users get:
- โ
IntelliSense/autocomplete for hook configurations โ ๏ธ (Schema exists but no .vscode/settings.json in project)
- โ
Real-time error detection โ ๏ธ (Schema exists but VS Code config not set up)
- โ
Hover documentation โ ๏ธ (Schema exists but VS Code config not set up)
See [docs/vscode-json-linting.md](docs/vscode-json-linting.md) for setup instructions.
## ๐ Connection Philosophy
Eyelet embraces hardware connection terminology for reliable, secure attachment:
- **"Thread through the eyelet!"** - Launch the TUI
- **"Secure the connection!"** - Deploy templates
- **"Check the connection log"** - View logs
- **"Scan for connection points"** - Discover new hooks
- **"Hold fast!"** - Maintain current configuration
## ๐งช Testing
Eyelet includes comprehensive testing tools to ensure your hooks are working correctly:
### Testing Hook Integration
```bash
# Run the interactive hook test
mise run test-hooks
# This will generate a unique test ID and guide you through testing all tools
# After running the test commands, verify with:
mise run test-hooks-verify zebra-1234-flamingo-5678
# View hook statistics
mise run hook-stats
# Generate a coverage report
mise run hook-coverage
# Clean old logs (older than 7 days)
mise run hook-clean
```
### Development Testing
```bash
# Run all tests
mise run test
# Run linting
mise run lint
# Run type checking
mise run typecheck
# Run all CI checks
mise run ci
```
### Manual Hook Testing
The `test_all_hooks.py` script provides comprehensive hook testing:
- Generates unique test identifiers for tracking
- Tests all Claude Code tools (Bash, Read, Write, Edit, etc.)
- Verifies hook logs contain expected data
- Provides coverage reports
## ๐ค Contributing
We welcome contributions! Please open issues and pull requests on GitHub.
## ๐ Documentation
- **[Quickstart Guide](docs/QUICKSTART.md)** - Get up and running quickly
- **[Design Documents](docs/design/)** - Architecture and design decisions
- **[Setup Guides](docs/setup/)** - GitHub Actions and deployment setup
## ๐ License
MIT License - see [LICENSE](LICENSE) for details.
## ๐ Acknowledgments
Built with love for the AI development community. Special thanks to the Anthropic team for Claude Code and its powerful hook system.
---
*"The strongest connections are forged under pressure." - Connect with Eyelet and explore the possibilities of AI agent orchestration.*