plugins/collection/HOOKS.md
Snider ecefb8a952 refactor: restructure as Claude Code marketplace plugin
- Add .claude-plugin/plugin.json manifest for auto-updates
- Move claude/ contents to root level (commands/, hooks/, scripts/, skills/)
- Update hooks.json to use ${CLAUDE_PLUGIN_ROOT} for portability
- Add .gitignore for IDE files
- Update CLAUDE.md with new structure and installation instructions

Plugin can now be installed via:
  claude plugin add host-uk/core-agent

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

1.6 KiB

Collection Hooks

Event-driven hooks that trigger during data collection.

Available Hooks

Hook Trigger Purpose
collect-whitepaper.sh PDF/paper URL detected Auto-queue whitepapers
on-github-release.sh Release found Archive release metadata
on-explorer-block.sh Block data fetched Index blockchain data

Hook Events

on_url_found

Fired when a new URL is discovered during collection.

# Pattern matching
*.pdf              → collect-whitepaper.sh
*/releases/*       → on-github-release.sh
*/api/block/*      → on-explorer-block.sh

on_file_collected

Fired after a file is successfully downloaded.

# Post-processing
*.json             → validate-json.sh
*.html             → extract-links.sh
*.pdf              → extract-metadata.sh

on_collection_complete

Fired when a job batch finishes.

# Reporting
→ generate-index.sh
→ update-registry.sh

Plugin Integration

For the marketplace plugin system:

{
  "name": "whitepaper-collector",
  "version": "1.0.0",
  "hooks": {
    "on_url_found": {
      "pattern": "*.pdf",
      "handler": "./collect-whitepaper.sh"
    }
  }
}

Registration

Hooks register in hooks.json:

{
  "on_url_found": [
    {
      "pattern": "\\.pdf$",
      "handler": "./hooks/collect-whitepaper.sh",
      "priority": 10
    }
  ]
}

Usage in Collectors

Collectors call hooks via:

# In job-collector/process.sh
source ./hooks/dispatch.sh

# When URL found
dispatch_hook "on_url_found" "$URL"

# When file collected
dispatch_hook "on_file_collected" "$FILE" "$TYPE"