Summary
Extend event system with interceptable hooks that can pause, modify, or abort pipeline phases. Enables: cost threshold abort, Telegram notifications per phase, context injection before REVIEW.
Current State
HarnessEvent in src/harness/events.ts is fire-and-forget
onEvent callback is one-way (no return value)
- No before/after lifecycle
Plan
- Create
src/core/hooks.ts:
HookRegistry with before(phase, handler) / after(phase, handler)
- Handlers can return
{ abort: true, reason } or { inject: "extra context" }
- Integrate in
runPipeline() — call before/after each phase
- Add built-in hooks: cost-threshold, telegram-notify
- Config:
hooks section in config.yaml for declarative hook setup
Files
src/core/hooks.ts (NEW)
src/core/pipeline.ts
config/config.yaml
src/config-schema.ts
Summary
Extend event system with interceptable hooks that can pause, modify, or abort pipeline phases. Enables: cost threshold abort, Telegram notifications per phase, context injection before REVIEW.
Current State
HarnessEventinsrc/harness/events.tsis fire-and-forgetonEventcallback is one-way (no return value)Plan
src/core/hooks.ts:HookRegistrywithbefore(phase, handler)/after(phase, handler){ abort: true, reason }or{ inject: "extra context" }runPipeline()— call before/after each phasehookssection in config.yaml for declarative hook setupFiles
src/core/hooks.ts(NEW)src/core/pipeline.tsconfig/config.yamlsrc/config-schema.ts