agent/claude/issues/011-collect-dispatch.md
Snider beb24f71d2 docs: add feature request issues for core CLI migration
12 issue files documenting features needed to replace shell scripts:

Claude Code hooks:
- 001: core ai session (state management)
- 002: core ai context (fact capture)
- 003: core ai hook (command validation)
- 004: core qa debug (debug statement detection)

Data collection:
- 005: core collect github (issues/PRs archive)
- 006: core collect bitcointalk (forum threads)
- 007: core collect market (CMC/CoinGecko)
- 008: core collect papers (whitepapers)
- 009: core collect excavate (project archaeology)
- 010: core collect process (HTML→MD)
- 011: core collect dispatch (event hooks)

000: Overview tracking issue

These will be submitted to host-uk/core when rate limit resets.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-01 18:49:35 +00:00

1.8 KiB

feat(collect): Add event hook dispatch system

Summary

Add core collect dispatch command to fire events during data collection, allowing modular hook handling.

Required Commands

core collect dispatch <event> [args...]       # Fire an event
core collect dispatch on_url_found <url>      # URL discovered
core collect dispatch on_file_collected <file> <type>  # File downloaded
core collect dispatch on_collection_complete  # Batch finished
core collect hooks list                       # List registered hooks
core collect hooks register <event> <handler> # Register new hook

Current Shell Script Being Replaced

  • claude/collection/dispatch.sh - Hook dispatcher

Events

Event Trigger Args
on_url_found URL discovered during collection url
on_file_collected File successfully downloaded file, type
on_collection_complete Job batch finishes -

Hook Registration

Hooks defined in hooks.json:

{
  "hooks": {
    "on_url_found": [
      {
        "name": "whitepaper-collector",
        "pattern": "\\.pdf$",
        "handler": "collect papers queue",
        "priority": 10,
        "enabled": true
      }
    ]
  }
}

Pattern Matching

  • Hooks can specify regex pattern for filtering
  • Only matching events trigger the handler
  • Multiple hooks can handle same event (priority ordering)

Handler Types

  1. Core commands: collect papers queue
  2. Shell scripts: ./my-handler.sh
  3. External binaries: /usr/local/bin/handler

Output Format

{
  "event": "on_url_found",
  "args": ["https://example.com/paper.pdf"],
  "handlers_fired": 2,
  "results": [
    {"handler": "whitepaper-collector", "status": "ok"},
    {"handler": "archive-notifier", "status": "ok"}
  ]
}