Skip to content

feat: interceptable event hooks (before/after phases) #70

@dougss

Description

@dougss

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

  1. Create src/core/hooks.ts:
    • HookRegistry with before(phase, handler) / after(phase, handler)
    • Handlers can return { abort: true, reason } or { inject: "extra context" }
  2. Integrate in runPipeline() — call before/after each phase
  3. Add built-in hooks: cost-threshold, telegram-notify
  4. 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

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Medium priorityenhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions