feat: add pi-yaml-hooks support (YAML hooks for pi)#616
Closed
ryaneggz wants to merge 1 commit into
Closed
Conversation
Pin the pi-yaml-hooks engine (npm:pi-yaml-hooks@2026.6.14) and ship a conservative, observe-only project hook config plus a vendored reference example, adapted from KristjanPikhof/Pi-YAML-Hooks/examples. - .pi/settings.json: pin engine in packages[]; settings.test.ts kept in lockstep (toEqual assertion). - .pi/hook/hooks.yaml: active demonstration hook β NDJSON audit log + setStatus on dep changes. Non-blocking, no prompt injection (won't interfere with autopilot/cron); inert until the project is trusted. - .pi/hook/examples/pre-tool-developer-guards: vendored reference-only; intentionally NOT wired (superseded by .pi/extensions/path-guard.ts). - atomic-commit-snapshot-worker: deliberately not vendored (repo-only, destructive auto-commit, ~3.4k LOC) β documented via pointer. - .gitignore: ignore .pi-hook-logs/ audit output. - .pi/UPSTREAM.md: tracking entry (MIT, quarterly review, lockstep bump). Trust is an operator decision (/hooks-trust or PI_YAML_HOOKS_TRUST_PROJECT=1); the harness does not auto-trust globally. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Collaborator
Author
|
Closing as superseded by #655 (merged as 0eaa152), which adopted cc-safety-net@1.0.6 as the canonical cross-provider bash guard and retired Why close rather than rebase:
Salvageable idea not covered elsewhere: an observe-only write/edit audit log (cc-safety-net only sees Bash, not file-edit tools). If wanted, re-scope as a slim fresh PR on the new baseline: engine pin + Branch |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Adds pi-yaml-hooks support to the harness β event-driven YAML hooks for the pi coding agent, adapted from KristjanPikhof/Pi-YAML-Hooks
examples/.Approach (scope decisions)
Advisor-guided. The three upstream example packs were triaged rather than dumped in wholesale:
pi-yaml-hooksnpm).pi/settings.jsonpackages[].pi/hook/hooks.yaml).pi/extensions/path-guard.ts; wiring it would double-fire confirmationsChanges
.pi/settings.jsonβ pinnpm:pi-yaml-hooks@2026.6.14;settings.test.tsupdated in lockstep (the array is asserted withtoEqual)..pi/hook/hooks.yamlβ active hook: NDJSON audit log (tool.after.write|editunder harness source areas) +setStatuson dependency-file changes. Deliberately observe-only: nobashblocking, notool:prompt injection (would interfere with autopilot/cron pi sessions)..pi/hook/post-tool-log.mjsβ audit-log helper (writes git-ignored.pi-hook-logs/)..pi/hook/README.mdβ provenance, event/action/condition schema, trust model, and why packs 1/3 aren't wired..pi/hook/examples/pre-tool-developer-guards/β vendored reference pack..gitignoreβ ignore.pi-hook-logs/..pi/UPSTREAM.mdβ tracking entry (MIT, quarterly review, lockstep-bump note).Project hooks are inert until the repo is trusted via
/hooks-trustorPI_YAML_HOOKS_TRUST_PROJECT=1. This PR does not auto-trust globally β that would change behavior across every pi session (autopilot, cron, slack bridge) and is left as an explicit operator choice, documented in.pi/hook/README.md. The engine loads everywhere via the pin, buthooks.yamldoes nothing until trusted.Verification
node_modules/.bin/vitest run .pi/extensions/__tests__/β 57 passed (incl.settings.test.tswith the new pin).node --checkon both.mjshelpers; activehooks.yamlconfirmed free ofcommand:actions (rejected by pi at load).npm view pi-yaml-hooks versionβ2026.6.14(pin verified against registry, not guessed).π€ Generated with Claude Code