Appearance
ADR-019 — Hook API consolidation (HookPhase + @HookHandler) (v0.10)
Status
Accepted — implemented in v0.10.0 as an additive coexistence migration (legacy annotations remain).
Context
Hook dispatch historically used many annotations (@PreReasoning, @OnSessionEnd, ...). This increases discovery complexity and makes static analysis/tooling harder.
Decision
Introduce:
HookPhaseenum — canonical lifecycle phases.@HookHandler(HookPhase)— single annotation for hook methods.HookEventmarker interface implemented by existing hook event types.
Update DefaultHookChain discovery so each fire path matches either:
- legacy annotation (existing behavior), or
@HookHandlerwith the mappedHookPhase.
Consequences
- Pros: new code can standardize on one annotation; reduces long-term maintenance burden.
- Cons: temporary dual-discovery until legacy annotations are deleted in a later release.
Follow-ups
- Delete legacy hook annotations once all internal + documented examples migrate.
- Consider a compile-time module test limiting
kairo-api/hookfile count after deletion wave.