-
Notifications
You must be signed in to change notification settings - Fork 0
Add event hook system for external tools to subscribe to checkpoint events #162
Description
Summary
Allow external tools and scripts to subscribe to Partio checkpoint events (e.g., checkpoint created, session ended) by registering hook scripts in .partio/hooks/. This enables dashboards, notification systems, and automation to react to Partio events without polling the filesystem.
Inspired by entireio/cli#749.
What to implement
Add an event hook dispatch mechanism to Partio's post-commit flow:
-
Hook directory: After a checkpoint is created, look for executables in
.partio/hooks/checkpoint-created/and run them in sequence, passing checkpoint data via environment variables or stdin JSON. -
Event payload: Each hook receives a JSON payload (via stdin or env vars) with:
checkpoint_id— the checkpoint ref/hashcommit_sha— the associated git commitsession_id— the agent session IDagent— the agent name (e.g.,claude-code)branch— current git branchrepo— repo root path
-
Hook execution: Non-zero exit from a user hook should emit a warning but not fail the git operation (consistent with Partio's error-resilient hook philosophy).
-
Configuration: Optionally guard behind a config flag
hooks_enabled: truein.partio/settings.json.
Why
Users building tools on top of Partio (dashboards, Slack notifications, CI triggers) currently must poll the filesystem for checkpoint branch changes. A structured hook system lets them react in real time without fragile polling, and without requiring modifications to Partio itself.
User Relevance
Teams using Partio for AI audit trails often want to pipe events downstream — notify a Slack channel when a Claude session is checkpointed, trigger a CI job to analyze the session, or update a dashboard. Without event hooks, every integration requires custom polling logic. A standardized hook directory makes Partio a composable part of the developer toolchain.
Target Repos
cli
Context Hints
internal/hooks/— existing git hook implementationsinternal/checkpoint/— checkpoint creation logicinternal/session/— session lifecycle
Acceptance Criteria
- After a checkpoint is created, executables in
.partio/hooks/checkpoint-created/are discovered and run - Each hook receives a JSON payload with
checkpoint_id,commit_sha,session_id,agent,branch,repo - A non-zero hook exit emits a warning log but does not fail the git commit
- Hooks run in lexicographic order within the directory
- If
.partio/hooks/does not exist, dispatch is a no-op with no error -
partio doctorreports any hooks that are not executable - Table-driven tests cover hook discovery, execution order, and failure resilience