Skip to content

feat: HooksEngine rules-based alerting and inspect CLI#21

Open
KetchCyork wants to merge 1 commit into
mainfrom
feature/hooks-and-ux
Open

feat: HooksEngine rules-based alerting and inspect CLI#21
KetchCyork wants to merge 1 commit into
mainfrom
feature/hooks-and-ux

Conversation

@KetchCyork

Copy link
Copy Markdown
Owner

Summary

  • HooksEngine: JSON-persisted alert rules with event matching (search, reindex, work-memory, consolidation, feedback), conditional logic (minLatencyMs, onError, regex pattern), and log action; history bounded to 200 entries
  • Engine fires hooks on all key operations, passing relevant payload (latency, session IDs, vote, etc.)
  • GET /inspect/stats returns aggregate counts: work memory totals, graph entities/edges, feedback signal breakdown, policy count, hook rule count
  • Full CRUD HTTP routes for hook rules (GET/POST /hooks, GET/PATCH/DELETE /hooks/:id, GET /hooks/:id/history)
  • MCP tools: inspect_stats, add_hook_rule, list_hook_rules
  • npm run inspect CLI for quick terminal stats readout

Test plan

  • HooksEngine unit tests: add/get/list/update/remove rules, condition evaluation (latency/onError/pattern), event routing, disabled rules, persistence, history bounded to 200
  • All 80+ existing tests still pass
  • npm run typecheck exits 0

Closes #12
Closes #13

🤖 Generated with Claude Code

- HooksEngine: rules with event/condition/action stored in JSON state
  file; conditions support minLatencyMs, onError, regex pattern; history
  bounded to 200 entries; currently supports 'log' action
- Engine fires hooks on search (with latency), reindex, work-memory,
  consolidation, and feedback events
- GET /inspect/stats returns aggregate counts for all memory subsystems
- CRUD HTTP routes for hooks: GET/POST /hooks, GET/PATCH/DELETE /hooks/:id,
  GET /hooks/:id/history
- MCP tools: inspect_stats, add_hook_rule, list_hook_rules
- npm run inspect CLI command displays a formatted stats table
- Hooks test suite with 20 assertions covering all conditions and persistence

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Developer UX: inspection, edit, provenance UI/CLI Proactive agent hooks (alerts & suggestions)

1 participant