-
Notifications
You must be signed in to change notification settings - Fork 0
Closed
Labels
documentationImprovements or additions to documentationImprovements or additions to documentationenhancementNew feature or requestNew feature or request
Description
Problem
Users with existing agents may want to add hooks but the documentation focuses on creating new agents with hooks. There's no guidance on retrofitting hooks to existing agents.
Solution
Add a "Adding Hooks to Existing Agents" section to the agent-authoring SKILL.md:
## Adding Hooks to Existing Agents
### Migration Checklist
1. **Identify hook opportunities** - Review your agent's typical workflow:
- What operations could benefit from validation?
- Where would logging/auditing be valuable?
- Are there operations that should trigger notifications?
2. **Start with non-blocking hooks** - Begin with logging/observability:
```yaml
hooks:
- event: "AgentStart"
command: "echo 'Agent started' >> /tmp/agent.log"
description: "Log agent activity (non-blocking)"-
Add blocking hooks incrementally - Test one at a time:
hooks: - event: "Bash" matcher: command: "rm -rf *" command: "./scripts/confirm-destructive.sh" description: "Require confirmation for destructive commands"
-
Test in isolation - Verify hooks work before deploying:
# Test hook script directly ./scripts/my-hook.sh echo $? # Should be 0 for pass, non-zero for block
Common Migration Patterns
| Current State | Hook to Add | Benefit |
|---|---|---|
| No logging | AgentStart/Stop hooks | Audit trail |
| Manual validation | Matcher-based hooks | Automated checks |
| Post-hoc review | Tool-specific hooks | Real-time validation |
Backward Compatibility
Hooks are optional - existing agents work unchanged. Add hooks gradually without disrupting current workflows.
## Files to Update
- `skills/agent-authoring/SKILL.md`
## Impact
- **Priority:** Low
- **Effort:** Medium
- **User Impact:** Enables adoption of hooks for existing agent configurations
---
*Review context: commit f2fe29b (agent hooks documentation)*
Metadata
Metadata
Assignees
Labels
documentationImprovements or additions to documentationImprovements or additions to documentationenhancementNew feature or requestNew feature or request