Skip to main content

Hook orchestration system for AI agents with SQLite logging and powerful analytics

Project description

๐Ÿ”— Eyelet - Hook Orchestration for AI Agents

"Thread through the eyelet!" - A sophisticated hook management system for AI agent workflows

Python PyPI version uv License CI Status

๐ŸŽ‰ 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:

# 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

# 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

โš ๏ธ Important: Version Updates

By default, uvx eyelet caches the package and won't auto-update. You have three options:

  1. Enable auto-updates (recommended):

    uvx eyelet configure install-all --autoupdate
    

    This uses uvx eyelet@latest which always fetches the latest version.

  2. Manual update when needed:

    uvx --reinstall eyelet@latest execute --log-only
    
  3. Use pipx for global installation:

    pipx install eyelet
    pipx upgrade eyelet  # When updates are available
    

Run eyelet doctor to check if your hooks are configured for auto-updates.

๐ŸŽฏ Universal Hook Handler

Eyelet includes a powerful universal hook handler that logs EVERY Claude Code hook to a structured directory:

# 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

๐Ÿ› ๏ธ Commands

# 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:

# 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 <session-id> --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

{
  "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:

# 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 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

# 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

# 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

๐Ÿ“œ License

MIT License - see 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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

eyelet-0.3.5.tar.gz (148.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

eyelet-0.3.5-py3-none-any.whl (114.2 kB view details)

Uploaded Python 3

File details

Details for the file eyelet-0.3.5.tar.gz.

File metadata

  • Download URL: eyelet-0.3.5.tar.gz
  • Upload date:
  • Size: 148.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.13

File hashes

Hashes for eyelet-0.3.5.tar.gz
Algorithm Hash digest
SHA256 7d5c187c9cd7b5f5627f565873bf5bdef0ddafdba54ef78a5766cb25c5b948b8
MD5 51ac3798279895c1be164fdec49f52ff
BLAKE2b-256 d864e7dab606089261c7ef7e33dcbfaab96d16f0d22d25020124d1d340f4bdf9

See more details on using hashes here.

File details

Details for the file eyelet-0.3.5-py3-none-any.whl.

File metadata

  • Download URL: eyelet-0.3.5-py3-none-any.whl
  • Upload date:
  • Size: 114.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.13

File hashes

Hashes for eyelet-0.3.5-py3-none-any.whl
Algorithm Hash digest
SHA256 384107ce68ff420fe187ebbd076db0d9f9306fd669db0fbe2ff5986ef6f3197f
MD5 713ebdaed1985d034fcf69dad18b28e0
BLAKE2b-256 402fd961c4423076221cdafc22b54499581a3de04d0eb5eac973e5faec27fe87

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page