Hooks Overview¶
Quaestor's hook system provides automated triggers that execute at specific points in your development workflow. The system is designed to be minimal and helpful, not intrusive.
What are Hooks?¶
Hooks are automated commands that execute when specific Claude Code events occur. With Quaestor's uvx-based system, hooks run without requiring any Python installation in your project:
- Session Events: When a Claude session starts
- Tool Events: When specific tools are used (like TodoWrite)
- Zero Dependencies: Hooks execute via
uvx
- no local Quaestor installation needed
Current Hooks¶
Quaestor includes two essential hooks that work together to provide automatic specification tracking:
📋 Session Context Loader¶
Loads active specifications and project context when a session starts:
# .quaestor/hooks/session_context_loader.py
def on_session_start():
"""Load active specifications into session context."""
- Display active specifications with progress bars
- Show git branch information
- Highlight next steps
- Performance tracking (<50ms target)
Features: - Visual progress bars for specification completion - Tree-structured display of acceptance criteria - Git branch alignment checking - Performance monitoring - Supports both SessionStart and PostCompact events
🎯 TODO-Based Specification Progress¶
Automatically tracks specification progress through TODO completion:
# .quaestor/hooks/todo_spec_progress.py
def on_todo_completed(todos):
"""Update specification progress when TODOs are completed."""
- Match completed TODOs to specification criteria
- Update YAML files automatically
- Add progress notes
- Calculate completion percentage
Features: - Zero manual intervention required - Intelligent keyword matching - Automatic YAML updates - Natural workflow integration
Hook Configuration¶
Hooks are configured in .claude/settings.json
and execute via uvx
:
{
"hooks": {
"SessionStart": [
{
"hooks": [
{
"type": "command",
"command": "uvx --from quaestor quaestor hook session-context-loader",
"description": "Load active specifications into session context"
}
]
}
],
"PostToolUse": [
{
"matcher": "TodoWrite",
"hooks": [
{
"type": "command",
"command": "uvx --from quaestor quaestor hook todo-spec-progress",
"description": "Update specification progress when TODOs are completed"
}
]
}
]
}
}
How uvx-based Hooks Work¶
- No Installation Required: Hooks run via
uvx
without installing Quaestor in your project - Always Up-to-Date: Uses the latest published version of Quaestor
- Project Context: Hooks read your local
.quaestor/
files while running remotely - Clean Dependencies: Your project stays free of Quaestor dependencies
Hook Events¶
SessionStart¶
Triggered when a new Claude session begins: - Loads project context - Displays active specifications - Shows current progress
PostToolUse¶
Triggered after specific tools are used: - Currently monitors TodoWrite operations - Updates specification progress automatically
How They Work Together¶
- Session Starts: The session context loader displays your active specifications
- You Work: Create TODOs that relate to specification criteria
- Complete TODOs: Mark TODOs as completed as you work
- Automatic Updates: The todo_spec_progress hook updates specifications
- See Progress: Next session shows updated progress
Benefits¶
Minimal and Helpful¶
- Only two hooks to maintain
- No intrusive enforcement
- Natural workflow integration
- Zero configuration needed
Automatic Progress Tracking¶
- No manual YAML editing
- Progress updates as you work
- Clear visibility into what's done
- Maintains focus on implementation
Performance¶
- Session loading optimized for <50ms
- Lightweight TODO monitoring
- No impact on development speed
Installation¶
Hooks are automatically configured during initialization:
# Using uvx (recommended - no installation)
uvx quaestor init
# Creates .claude/settings.json with uvx commands
# Team mode
uvx quaestor init --mode team
# Creates shared .claude/settings.json
# Traditional installation
pip install quaestor
quaestor init
Note: No hook files are copied to your project. Hooks run via uvx
commands configured in .claude/settings.json
.
Customization¶
While the default hooks cover most needs, you can:
-
Adjust Performance Target:
-
Customize Progress Display:
-
Add Custom Hooks: Create new hooks by following the pattern in
base.py
Troubleshooting¶
Hooks Not Running¶
- Check
.claude/settings.json
exists and is valid JSON - Verify
uvx
is installed (comes withuv
) - Check internet connection (uvx downloads Quaestor on first run)
- Try running manually:
echo '{}' | uvx --from quaestor quaestor hook session-context-loader
Progress Not Updating¶
- Ensure TODOs are marked as "completed" status
- Check TODO content relates to specification criteria
- Verify specification is in "ACTIVE" status
Performance Issues¶
- Check session_context_loader.py logs for timing
- Reduce number of active specifications
- Consider disabling visual progress bars
Next Steps¶
- Learn about Session Context Loading
- Understand Specification Progress Tracking
- Explore the Specification Workflow